[issue29960] _random.Random state corrupted on exception

2017-04-22 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- assignee: -> serhiy.storchaka stage: needs patch -> backport needed versions: +Python 2.7, Python 3.5, Python 3.6 ___ Python tracker

[issue30024] Treat `import a.b.c as m` as `m = sys.modules['a.b.c']`

2017-04-22 Thread Nick Coghlan
Nick Coghlan added the comment: Expanding on Serhiy's answer: the ModuleNotFoundError for "import sys.path" comes from IMPORT_NAME, not from any of the subsequent attribute lookups. That difference is visible in the bytecode: >>> dis("import sys.path as path") 1 0 LOAD_CONST

[issue30113] Allow helper functions to wrap sys.setprofile

2017-04-22 Thread Louie Lu
Louie Lu added the comment: Thanks, Nick. Your analysis is very helpful. After some testing, I found the problem here is because when we using `sys.setprofile` in the helper function, we didn't simulate the call (from where profiler create to helper function), that cause profile's frame link

[issue30113] Allow helper functions to wrap sys.setprofile

2017-04-22 Thread Louie Lu
Changes by Louie Lu : -- pull_requests: +1368 ___ Python tracker ___ ___ Python-bugs-list

[issue29802] A possible null-pointer dereference in struct.s_unpack_internal()

2017-04-22 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- pull_requests: +1366 ___ Python tracker ___ ___

[issue30135] default value of argument seems to be overwritten

2017-04-22 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: See "Why are default values shared between objects?" in Python FAQ (https://docs.python.org/3/faq/programming.html#id13). -- nosy: +serhiy.storchaka resolution: -> not a bug stage: -> resolved status: open -> closed

[issue29960] _random.Random state corrupted on exception

2017-04-22 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset 9616a82e7802241a4b74cf7ae38d43c37bf66e48 by Serhiy Storchaka (bladebryan) in branch 'master': bpo-29960 _random.Random corrupted on exception in setstate(). (#1019)

[issue29802] A possible null-pointer dereference in struct.s_unpack_internal()

2017-04-22 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset 7bfd740e3d484e6fdf3f5c2d4640450957f9d89c by Serhiy Storchaka in branch 'master': Remove unneeded Misc/NEWS entry for bpo-29802. (#1251) https://github.com/python/cpython/commit/7bfd740e3d484e6fdf3f5c2d4640450957f9d89c --

[issue18576] Document test.support.script_helper

2017-04-22 Thread Louie Lu
Changes by Louie Lu : -- pull_requests: +1367 ___ Python tracker ___ ___ Python-bugs-list

[issue29802] A possible null-pointer dereference in struct.s_unpack_internal()

2017-04-22 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker

[issue30135] default value of argument seems to be overwritten

2017-04-22 Thread Klaus Wolf
Klaus Wolf added the comment: A documented misbheavior is still a misbehavior. -- ___ Python tracker ___ ___

[issue29840] Avoid raising OverflowError in bool()

2017-04-22 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I had similar doubts about this patch and needed opinions of other core developers. > Maybe, if __len__() raises an OverflowError: call again the len(), but using > the "__len__" method instead of the slot? Following patch implements this idea. I don't

[issue26423] Integer overflow in wrap_lenfunc() on 64-bit build of Windows with len > 2**31-1

2017-04-22 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Could you create a PR for your patch Victor? -- ___ Python tracker ___

[issue27613] Empty iterator with fake __len__ is rendered as a single bracket ] when using json's iterencode

2017-04-22 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- pull_requests: +1370 ___ Python tracker ___ ___

[issue29782] Use __builtin_clzl for bits_in_digit if available

2017-04-22 Thread Mark Dickinson
Mark Dickinson added the comment: Closing. -- resolution: -> rejected stage: -> resolved status: open -> closed ___ Python tracker ___

[issue30024] Treat `import a.b.c as m` as `m = sys.modules['a.b.c']`

2017-04-22 Thread Victor Varvariuc
Victor Varvariuc added the comment: How can I facilitate/contribute to get the changes suggested by Serhiy into Python? -- ___ Python tracker ___

[issue30137] Equivalent syntax regarding List returns List objects with non-similar list elements.

2017-04-22 Thread Akshay Deogaonkar
New submission from Akshay Deogaonkar: lst = [0,1,2,3,4] print(lst[0:3]) #returns [0,1,2] print(lst[:3]) #returns [0,1,2] #Above two syntax returns same lists. print(lst[0:3:-1]) #returns [] print(lst[:3:-1]) #returns [4] #Here is a bug; what expected was that the both syntax would have

[issue15718] Possible OverflowError in __len__ method undocumented (when called via len() function)

2017-04-22 Thread Terry J. Reedy
Terry J. Reedy added the comment: Has or will builtin classes be modified to follow advice to include a separate __bool__? In 3.6.1, >>> r = range(19**100) >>> bool(r) Traceback (most recent call last): File "", line 1, in bool(r) OverflowError: Python int too large to

[issue27613] Empty iterator with fake __len__ is rendered as a single bracket ] when using json's iterencode

2017-04-22 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: > I am surprised that dumping to a string and to a file give different answers. This is a difference between Python and C implementations. An iterable with fake __len__ looks breaking the invariants, but if a collection with overridden __bool__() is

[issue18576] Document test.support.script_helper

2017-04-22 Thread Louie Lu
Louie Lu added the comment: The PR on GitHub is based on bobcatfist's patch, addressed on Martin request and some minor change. -- nosy: +louielu ___ Python tracker

[issue29782] Use __builtin_clzl for bits_in_digit if available

2017-04-22 Thread Louie Lu
Louie Lu added the comment: If this issue is closed by "not a big performance improvement", maybe the XXX in mathmoudle.c should be take off? """ /* XXX: This routine does more or less the same thing as * bits_in_digit() in Objects/longobject.c. Someday it would be nice to * consolidate

[issue29442] Replace optparse with argparse in setup.py

2017-04-22 Thread Chi Hsuan Yen
Chi Hsuan Yen added the comment: I guess you were asking whether the newly compiled Python binary is able to build extension modules or not? I rebased PR 139 against the latest git master and seems it's fine. Running `make distclean`, `./configure` and then `make` builds all modules as

[issue30135] default value of argument seems to be overwritten

2017-04-22 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: This is correct behavior. You just made a common mistake made by newcomers. Read Python FAQ and other resources, this can help you to avoid other pitfalls. -- ___ Python tracker

[issue15718] Possible OverflowError in __len__ method undocumented (when called via len() function)

2017-04-22 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- pull_requests: +1369 ___ Python tracker ___ ___

[issue15718] Possible OverflowError in __len__ method undocumented (when called via len() function)

2017-04-22 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Yes, and the range object already is fixed by issue28876. -- ___ Python tracker ___

[issue29782] Use __builtin_clzl for bits_in_digit if available

2017-04-22 Thread STINNER Victor
STINNER Victor added the comment: I'm in favor of documenting in comments decisions to not micro-optimize such code. I did something similar in ceval.c for 1+1. -- ___ Python tracker

[issue29840] Avoid raising OverflowError in bool()

2017-04-22 Thread STINNER Victor
STINNER Victor added the comment: If someone wants to return a value larger than maxsize and support bool(): it is already possible right now by defining a __bool__ method no? If yes, I suggest to only document this CPython implementation detail (consequence of slots, for efficiency) and suggest

[issue29619] st_ino (unsigned long long) is casted to long long in posixmodule.c:_pystat_fromstructstat

2017-04-22 Thread Xavier de Gaye
Xavier de Gaye added the comment: The compilation of Modules/posixmodule.c fails now on Android architecture 'x86' at api level 21, after the above change 0f6d73343d342c106cda2219ebb8a6f0c4bd9b3c: /opt/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang

[issue29619] st_ino (unsigned long long) is casted to long long in posixmodule.c:_pystat_fromstructstat

2017-04-22 Thread STINNER Victor
STINNER Victor added the comment: Would it work with unsigned long long? What is the value of HAVE_LARGEFILE_SUPPORT? Maybe the code should be simplified to always use unsigned long long. -- ___ Python tracker

[issue30140] Binary arithmetic does not always call subclasses first

2017-04-22 Thread Stephan Hoyer
New submission from Stephan Hoyer: We are writing a system for overloading NumPy operations (see PR [1] and design doc [2]) that is designed to copy and extend Python's system for overloading binary operators. The reference documentation on binary arithmetic [3] states: > Note: If the right

[issue9285] Add a profile decorator to profile and cProfile

2017-04-22 Thread Louie Lu
Louie Lu added the comment: Giampaolo, the assertion is still worked good, and no need to remove them. The assertion is to prevent dispatch return too more, to return upper then when the profiler was created. The problem why profile __enter__ can't work, is because it misses the

[issue15718] Possible OverflowError in __len__ method undocumented (when called via len() function)

2017-04-22 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- pull_requests: +1373 ___ Python tracker ___ ___

[issue15718] Possible OverflowError in __len__ method undocumented (when called via len() function)

2017-04-22 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- pull_requests: +1372 ___ Python tracker ___ ___

[issue15718] Possible OverflowError in __len__ method undocumented (when called via len() function)

2017-04-22 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset 85157cd89a6edac347a5b6871fcf20c500c6fbbf by Serhiy Storchaka in branch 'master': bpo-15718: Document the upper bound constrain on the __len__ return value. (#1256)

[issue15718] Possible OverflowError in __len__ method undocumented (when called via len() function)

2017-04-22 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset c358536fd5e40e8f29ee4f086588a82fccb25a09 by Serhiy Storchaka in branch '3.5': [3.5] bpo-15718: Document the upper bound constrain on the __len__ return value. (GH-1256) (#1260)

[issue15718] Possible OverflowError in __len__ method undocumented (when called via len() function)

2017-04-22 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset f2ed2858eea7569c8915b3611ca5ec92ae10b17f by Serhiy Storchaka in branch '3.6': [3.6] bpo-15718: Document the upper bound constrain on the __len__ return value. (GH-1256) (#1259)

[issue15718] Possible OverflowError in __len__ method undocumented (when called via len() function)

2017-04-22 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- pull_requests: +1374 ___ Python tracker ___ ___

[issue15718] Possible OverflowError in __len__ method undocumented (when called via len() function)

2017-04-22 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset bfc7dff63b9b30371e3423a5c35ccda2f3b52218 by Serhiy Storchaka in branch '2.7': [2.7] bpo-15718: Document the upper bound constrain on the __len__ return value. (GH-1256). (#1261)

[issue30135] default value of argument seems to be overwritten

2017-04-22 Thread Steven D'Aprano
Steven D'Aprano added the comment: In the future please don't post binary files containing source code, especially something as non-standard as 7z. That just makes it difficult for people to review the code. Either paste your code snippet directly into the bug report, or attach it as a .py

[issue29816] Get rid of C limitation for shift count in right shift

2017-04-22 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- pull_requests: +1371 ___ Python tracker ___ ___

[issue30138] Incorrect documentation of replacement of slice of length 0

2017-04-22 Thread Stephen J. Turnbull
Stephen J. Turnbull added the comment: Sorry, I just realized this note only applies to slices with a stride (k in i:j:k). Closing. -- stage: -> resolved status: open -> closed ___ Python tracker

[issue26143] Ensure that IDLE's stdlib imports are from the stdlib

2017-04-22 Thread Matthew Cowles
Matthew Cowles added the comment: This bug should be fixed urgently. Over at python-help we just got another Python beginner who was using IDLE and then started to get the "IDLE's subprocess didn't make connection" error. The problem was that the user had named one of their programs

[issue29352] provide the authorative source for s[i:j] negative slice indices (<-len(s)) behavior for standard sequences

2017-04-22 Thread Stephen J. Turnbull
Stephen J. Turnbull added the comment: I prefer Josh's wording. The important point to me is that >>> [1, 2][2:0] = "AB" [1, 2, "A", "B"] not an error or ["B", "A"] == [1, 2][2:0:-1]. I think too much talk about the endpoints obscures this important fact. (I think I'd like it to be an

[issue30137] Equivalent syntax regarding List returns List objects with non-similar list elements.

2017-04-22 Thread Steven D'Aprano
Steven D'Aprano added the comment: The behaviour is as documented and is not a bug. When you have a three-argument extended slice, the starting and stopping values depend on whether the stride (step) is positive or negative. Although that's buried in a footnote to the table.

[issue29816] Get rid of C limitation for shift count in right shift

2017-04-22 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset 997a4adea606069e01beac6269920709db3994d1 by Serhiy Storchaka in branch 'master': Remove outdated note about constraining of the bit shift right operand. (#1258) https://github.com/python/cpython/commit/997a4adea606069e01beac6269920709db3994d1

[issue23404] 'make touch' does not work with git clones of the source repository

2017-04-22 Thread Brett Cannon
Brett Cannon added the comment: Would it make sense to have a `make rebuild` or something which explicitly ignores prebuilt files? That could then also serve as non-obvious documentation on how to build those files in the first place. -- nosy: +ncoghlan

[issue30138] Incorrect documentation of replacement of slice of length 0

2017-04-22 Thread Stephen J. Turnbull
New submission from Stephen J. Turnbull: In section 4.6.3. "Mutable Sequence Types" of current documentation, Note 1 to the table says "[iterable] t must have the same length as the slice it is replacing." This is incorrect in the case of extension: s[len(s):] = t according to the rest of the

[issue30139] Fix for issue 8743 not available in python MacOS 3.5.1

2017-04-22 Thread Horacio Hoyos
New submission from Horacio Hoyos: Hi all, I was having issues while testing a custom Set implementation using the _collections_abc base MutableSet and found that my issue was apparently resolved with issue 8743. My test is simple: ms = MySetImpl() ms & 'testword' which should fail with

[issue30139] Fix for issue 8743 not available in python MacOS 3.5.1

2017-04-22 Thread R. David Murray
R. David Murray added the comment: Then you have a broken copy of 3.5.1. There is nothing OS-specific about that file. -- nosy: +r.david.murray ___ Python tracker

[issue30139] Fix for issue 8743 not available in python MacOS 3.5.1

2017-04-22 Thread Ned Deily
Ned Deily added the comment: >> Then you have a broken copy of 3.5.1. Yes. You don't say from where you installed Python 3.5.1 but I just took a quick look at _collections_abc.py in both the versions installed by the python.org 3.5.1 macOS installer and by the current 3.5.3 version (which you

[issue30139] Fix for issue 8743 not available in python MacOS 3.5.1

2017-04-22 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: But there is no neither an entry #8743, nor neighbour entries #14710 and #13355 in Misc/NEWS. Seems Misc/NEWS is broken. -- nosy: +serhiy.storchaka resolution: works for me -> stage: resolved -> status: closed -> open

[issue30139] Fix for issue 8743 not available in python MacOS 3.5.1

2017-04-22 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- resolution: -> works for me stage: -> resolved status: open -> closed ___ Python tracker

[issue30139] Fix for issue 8743 not available in python MacOS 3.5.1

2017-04-22 Thread Ned Deily
Ned Deily added the comment: > But there is no neither an entry #8743, nor neighbour entries #14710 and > #13355 in Misc/NEWS. Seems Misc/NEWS is broken. Hmm. They seem to have been properly preserved in the current 3.6 and master branch versions of Misc/HISTORY. Perhaps the 3.5 Misc/NEWS

[issue9285] Add a profile decorator to profile and cProfile

2017-04-22 Thread Giampaolo Rodola'
Giampaolo Rodola' added the comment: Original patch still applies. Not sure if we should continue with that one or with your new PR. The original assertion error is still there. I CCed Tim Peters as it appears he's the one who originally added it in 2001 - maybe he has some clue. --

[issue23404] 'make touch' does not work with git clones of the source repository

2017-04-22 Thread Martin Panter
Martin Panter added the comment: Do you mean a separate makefile rule to rebuild the generated files, rather than rebuilding them in a normal “make all” build? I would support this; this is what I meant with my “make regenerate” proposal in response to Nick linked above. --

[issue30134] BytesWarning is missing from the documents

2017-04-22 Thread Martin Panter
Martin Panter added the comment: . Issue 11681 is already open for the -b option, with a patch in progress. If updating the doc string, also change “buffer” to “bytearray”. This is what “bytearray” was originally called in Python 3, and “buffer” is something different in Python 2. --

[issue29237] Create enum for pstats sorting options

2017-04-22 Thread Louie Lu
Louie Lu added the comment: Mariatta, is there any movement on this issue? Thanks! -- nosy: +louielu ___ Python tracker ___

[issue23420] python -m cProfile -s fails with non informative message

2017-04-22 Thread Louie Lu
Louie Lu added the comment: If we can solve #30118 for argument unittest, and apply #18971 for optparse to argparse, this issue will then can be solve, too. -- nosy: +louielu ___ Python tracker