[issue15903] Make rawiobase_read() read directly to bytes object

2019-04-08 Thread Inada Naoki
Change by Inada Naoki : -- nosy: +inada.naoki ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue35210] Use bytes + memoryview + resize instead of bytesarray + array in io.RawIOBase.read

2019-04-08 Thread Inada Naoki
Inada Naoki added the comment: Maybe, we need C version of memoryview.release() to invalidate pointer in memoryview object. -- nosy: +inada.naoki ___ Python tracker ___

[issue36558] Change time.mktime() return type from float to int?

2019-04-08 Thread STINNER Victor
New submission from STINNER Victor : time.mktime() returns a floating point number: >>> type(time.mktime(time.localtime())) The documentation says: "It returns a floating point number, for compatibility with :func:`.time`." time.time() returns a float because it has sub-second resolution,

[issue36557] Python (Launcher)3.7.3 CMDLine install/uninstall

2019-04-08 Thread SilentGhost
Change by SilentGhost : -- components: +Windows nosy: +paul.moore, steve.dower, tim.golden, zach.ware ___ Python tracker ___ ___

[issue36551] Optimize list comprehensions with preallocate size and protect against overflow

2019-04-08 Thread Inada Naoki
Inada Naoki added the comment: I'm sorry. list_extend raises OverflowError too. -- ___ Python tracker ___ ___ Python-bugs-list

[issue34373] test_time errors on AIX

2019-04-08 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +12649 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue36551] Optimize list comprehensions with preallocate size and protect against overflow

2019-04-08 Thread Inada Naoki
Inada Naoki added the comment: "useful" doesn't mean "use it as-is". It is just a hint. It will be wrong. See here for list example: https://github.com/python/cpython/blob/7a0630c530121725136526a88c49589b54da6492/Objects/listobject.c#L929-L940 --

[issue36556] Trashcan causing duplicated __del__ calls

2019-04-08 Thread Jeroen Demeyer
Change by Jeroen Demeyer : -- keywords: +patch pull_requests: +12648 stage: -> patch review ___ Python tracker ___ ___

[issue36557] Python (Launcher)3.7.3 CMDLine install/uninstall

2019-04-08 Thread mattcher_h
New submission from mattcher_h : Hi, I´m trying to generate an automated install and uninstall from Python. For this I normally use cmdlines, but I got some issues. If I try to uninstall by my automated version I got the problem that it doesn´t finish. When I do this at the PC himself it

[issue36551] Optimize list comprehensions with preallocate size and protect against overflow

2019-04-08 Thread anthony shaw
anthony shaw added the comment: > If your patch uses __length_hint__, it is bug. I’m not sure I understand this comment, PEP424 says “This is useful for presizing containers when building from an iterable.“ This patch uses __length_hint__ to presize the list container for a list

[issue36551] Optimize list comprehensions with preallocate size and protect against overflow

2019-04-08 Thread anthony shaw
anthony shaw added the comment: > If your patch uses __length_hint__, it is bug. iterator will return 2**1000 for __length_hint__, but produce no item on iteration. It raises an OverflowError because of the goto

[issue36551] Optimize list comprehensions with preallocate size and protect against overflow

2019-04-08 Thread Inada Naoki
Inada Naoki added the comment: > Try > > [x for x in range(2**1000)] > > in a REPL. It doesn’t raise anything, it tries to create a list that will > eventually exceed PY_SIZE_MAX, but it only crashes once it reaches that > iteration. It is expected behavior. > This raises an OverflowError

[issue36551] Optimize list comprehensions with preallocate size and protect against overflow

2019-04-08 Thread anthony shaw
anthony shaw added the comment: > In such case, current behavior works. And your patch will raise > OverflowError. Try [x for x in range(2**1000)] in a REPL. It doesn’t raise anything, it tries to create a list that will eventually exceed PY_SIZE_MAX, but it only crashes once it reaches

[issue13475] Add '--mainpath'/'--nomainpath' command line options to override sys.path[0] initialisation

2019-04-08 Thread Nick Coghlan
Nick Coghlan added the comment: Retitled the issue using the `--mainpath` spelling, as I wanted to link to it from the PEP 582 discussion, and that's my current favourite from the various ideas I've had since first filing the issue. (I decided I didn't like `--basepath` because we already

[issue36551] Optimize list comprehensions with preallocate size and protect against overflow

2019-04-08 Thread anthony shaw
anthony shaw added the comment: > This patch makes it slow for small iterators That is a one-off cost for the __length_hint__ of the range object specifically. Objects with a known length (lists, sets, tuples) would not have that overhead. I can run a more useful set of benchmarks against

[issue36551] Optimize list comprehensions with preallocate size and protect against overflow

2019-04-08 Thread Inada Naoki
Inada Naoki added the comment: > > This might cause a MemoryError when the __length_hint__ of the source > > returns a too large value, even when the actual size of the comprehension > > is smaller, e.g.: > > The current implementation of list comprehensions raise neither a memoryerror > or

[issue36551] Optimize list comprehensions with preallocate size and protect against overflow

2019-04-08 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: More benchmarks for slow iterators: import perf runner = perf.Runner() runner.timeit("list_comp", stmt="[x**2 for x in k]", setup="k=iter(list(range(10)))") Current master: ❯ ./python.exe ../check.py

[issue36551] Optimize list comprehensions with preallocate size and protect against overflow

2019-04-08 Thread Inada Naoki
Inada Naoki added the comment: > I should have been more explicit, this patch improves the performance of all > list comprehensions that don’t have an if clause. But in these cases, overhead of reallocation will be smaller than simple case. -- ___

[issue36551] Optimize list comprehensions with preallocate size and protect against overflow

2019-04-08 Thread anthony shaw
anthony shaw added the comment: > This might cause a MemoryError when the __length_hint__ of the source returns > a too large value, even when the actual size of the comprehension is smaller, > e.g.: The current implementation of list comprehensions raise neither a memoryerror or overflow

[issue36551] Optimize list comprehensions with preallocate size and protect against overflow

2019-04-08 Thread anthony shaw
anthony shaw added the comment: > How about converting `[x for x in it]` to `[*it]` in AST? I should have been more explicit, this patch improves the performance of all list comprehensions that don’t have an if clause. Not just [x for x in y] but: d = {} # some sort of dictionary [f”{k} —

[issue36551] Optimize list comprehensions with preallocate size and protect against overflow

2019-04-08 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: This patch makes it slow for small iterators: Perf program: import perf runner = perf.Runner() runner.timeit("list_comp", stmt="[x for x in range(10)]", setup="") Current master: ❯ ./python.exe ../check.py

[issue35459] Use PyDict_GetItemWithError() instead of PyDict_GetItem()

2019-04-08 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset 7a0630c530121725136526a88c49589b54da6492 by Serhiy Storchaka in branch 'master': Add a What's New entry for bpo-35459. (GH-12706) https://github.com/python/cpython/commit/7a0630c530121725136526a88c49589b54da6492 --

[issue36555] PEP484 @overload vs. str/bytes

2019-04-08 Thread Ivan Levkivskyi
Ivan Levkivskyi added the comment: Mypy already takes first overload for ambiguous arguments. This example is however genuinely unsafe from the static typing point of view. Please read the docs https://mypy.readthedocs.io/en/latest/more_types.html#type-checking-the-variants --

[issue36551] Optimize list comprehensions with preallocate size and protect against overflow

2019-04-08 Thread Inada Naoki
Inada Naoki added the comment: $ python3 -m timeit -s 'r=range(1000)' -- '[x for x in r]' 5000 loops, best of 5: 40 usec per loop $ python3 -m timeit -s 'r=range(1000)' -- '[*r]' 2 loops, best of 5: 17.3 usec per loop -- ___ Python tracker

[issue36551] Optimize list comprehensions with preallocate size and protect against overflow

2019-04-08 Thread Inada Naoki
Inada Naoki added the comment: I agree with Serhiy. Benefit seems too small to add new opcode. > I could seek another way of implementing the same behaviour without an > additional opcode? How about converting `[x for x in it]` to `[*it]` in AST? --

[issue36555] PEP484 @overload vs. str/bytes

2019-04-08 Thread Karthikeyan Singaravelan
Change by Karthikeyan Singaravelan : -- nosy: +gvanrossum, levkivskyi ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue36551] Optimize list comprehensions with preallocate size and protect against overflow

2019-04-08 Thread Ronald Oussoren
Ronald Oussoren added the comment: This might cause a MemoryError when the __length_hint__ of the source returns a too large value, even when the actual size of the comprehension is smaller, e.g.: [x**2 for x in range(LARGE_VALUE) if is_prime(x)] See also issue28940 -- nosy:

[issue36556] Trashcan causing duplicated __del__ calls

2019-04-08 Thread Jeroen Demeyer
New submission from Jeroen Demeyer : NOTE: because of PEP 442, this issue is specific to Python 2. This bug was discovered while adding testcases for bpo-35983 to the Python 2.7 backport. There is a nasty interaction between the trashcan and __del__: if you're very close to the trashcan

[issue36555] PEP484 @overload vs. str/bytes

2019-04-08 Thread Crusader Ky
New submission from Crusader Ky : An exceedingly common pattern in many Python libraries is for a function to accept either a string or a list of strings, and change the function output accordingly. This however does not play nice with @typing.overload, as a str variable is also an

[issue36551] Optimize list comprehensions with preallocate size and protect against overflow

2019-04-08 Thread Karthikeyan Singaravelan
Change by Karthikeyan Singaravelan : -- nosy: +inada.naoki ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue35983] tp_dealloc trashcan shouldn't be called for subclasses

2019-04-08 Thread Jeroen Demeyer
Jeroen Demeyer added the comment: In Python 3, the resurrection issue probably appears too. But it's not so much a problem since __del__ (mapped to tp_finalize) is only called once anyway. So there are no bad consequences if the object is resurrected incorrectly. --

[issue36554] unittest.TestCase: "subTest" cannot be used together with "debug"

2019-04-08 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: Can you please provide an example script to reproduce this? There is similar None check fixed with issue34900 -- nosy: +xtreak ___ Python tracker

[issue36554] unittest.TestCase: "subTest" cannot be used together with "debug"

2019-04-08 Thread Dieter Maurer
New submission from Dieter Maurer : "subTest" accesses "self._outcome" which is "None" when the test is performed via "debug". -- components: Library (Lib) messages: 339607 nosy: dmaurer priority: normal severity: normal status: open title: unittest.TestCase: "subTest" cannot be used

[issue36478] backport of pickle fixes to Python 3.5.7 uses C99 for loops

2019-04-08 Thread STINNER Victor
STINNER Victor added the comment: > Which compiler do you use to build deadsnakes? Sorry, which compiler *flags*. -- ___ Python tracker ___

[issue36478] backport of pickle fixes to Python 3.5.7 uses C99 for loops

2019-04-08 Thread STINNER Victor
STINNER Victor added the comment: > ../Modules/_pickle.c:677:5: error: 'for' loop initial declarations are only > allowed in C99 mode Why do you get an error? Which compiler do you use to build deadsnakes? -- ___ Python tracker

[issue18372] _Pickler_New() doesn't call PyObject_GC_Track(self)

2019-04-08 Thread STINNER Victor
STINNER Victor added the comment: It has been decided to not fix the issue in Python 2.7: https://github.com/python/cpython/pull/8505#issuecomment-480771689 -- versions: -Python 3.6 ___ Python tracker

[issue36553] inspect.is_decorator_call(frame)

2019-04-08 Thread Karthikeyan Singaravelan
Change by Karthikeyan Singaravelan : -- nosy: +yselivanov versions: +Python 3.8 ___ Python tracker ___ ___ Python-bugs-list mailing

[issue36053] pkgutil.walk_packages jumps out from given path if there is package with the same name in sys.path

2019-04-08 Thread Piotr Karkut
Piotr Karkut added the comment: Nick: From what I've checked, it jumps in case the module is already imported. The problem is that the original implementation is quite naive, and it's trying to import the module before looking for it in `sys.modules` - So if the module with a conflicting

[issue34488] improve performance of BytesIO.writelines() by avoiding creation of unused PyLongs

2019-04-08 Thread Inada Naoki
Inada Naoki added the comment: Hm, what happened if subclass of BytesIO overrides `write` but not `writelines`? -- nosy: +inada.naoki ___ Python tracker ___

[issue33461] json.loads(encoding=) does not emit deprecation warning.

2019-04-08 Thread Inada Naoki
Inada Naoki added the comment: Since we didn't raise DeprecationWarning, I think at least one version with DeprecationWarning is preferable. -- nosy: +inada.naoki versions: +Python 3.8 ___ Python tracker

[issue36553] inspect.is_decorator_call(frame)

2019-04-08 Thread Sylvain Marie
New submission from Sylvain Marie : Python decorators are frequently proposed by libraries as an easy way to add functionality to user-written functions: see `attrs`, `pytest`, `click`, `marshmallow`, etc. A common pattern in most such libraries, is that they do not want to provide users

[issue33228] Use Random.choices in tempfile

2019-04-08 Thread Inada Naoki
Inada Naoki added the comment: I'm +0 too. Since there are no +1 from core dev for a long time, I close this issue for now. -- resolution: -> wont fix stage: patch review -> resolved status: open -> closed ___ Python tracker

[issue32534] Speed-up list.insert: use memmove()

2019-04-08 Thread Inada Naoki
Change by Inada Naoki : -- resolution: -> wont fix stage: patch review -> resolved status: open -> closed ___ Python tracker ___

[issue35488] pathlib Path.match does not behave as described

2019-04-08 Thread anthony shaw
Change by anthony shaw : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___ ___

[issue31155] Encode set, frozenset, bytearray, and iterators as json arrays

2019-04-08 Thread Inada Naoki
Inada Naoki added the comment: I concur with Raymond. If you really need this feature, please discuss on python-dev ML. -- nosy: +inada.naoki resolution: -> rejected stage: -> resolved status: open -> closed ___ Python tracker

[issue36546] Add quantiles() to the statistics module

2019-04-08 Thread Raymond Hettinger
Raymond Hettinger added the comment: Thanks for taking a detailed look. I'll explore the links you provided shortly. The API is designed to be extendable so that we don't get trapped by the choice of computation method. If needed, any or all of the following extensions are possible without

[issue36551] Optimize list comprehensions with preallocate size and protect against overflow

2019-04-08 Thread anthony shaw
anthony shaw added the comment: The opcode would not solely apply to this specific use case. I could seek another way of implementing the same behaviour without an additional opcode? -- ___ Python tracker

[issue36551] Optimize list comprehensions with preallocate size and protect against overflow

2019-04-08 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: The benefit is too small to add a new opcode. -- nosy: +serhiy.storchaka ___ Python tracker ___

[issue36546] Add quantiles() to the statistics module

2019-04-08 Thread Mark Dickinson
Mark Dickinson added the comment: Related previous discussion on python-ideas: https://mail.python.org/pipermail/python-ideas/2018-March/049327.html -- nosy: +mark.dickinson ___ Python tracker

[issue36552] Replace OverflowError with ValueError when calculating length of range objects > PY_SIZE_MAX

2019-04-08 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: For large but smaller than the C limit ranges the list constructor raises a MemoryError. It should raise the same error for larger ranges. Raising an OverflowError in range.__len__ is legitimate. -- nosy: +serhiy.storchaka

[issue26730] SpooledTemporaryFile doesn't correctly preserve data for text (non-binary) SpooledTemporaryFile objects when Unicode characters are written

2019-04-08 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- assignee: -> serhiy.storchaka versions: +Python 3.7, Python 3.8 -Python 3.5, Python 3.6 ___ Python tracker ___

[issue28190] Cross-build _curses failed if host ncurses headers and target ncurses headers have different layouts

2019-04-08 Thread Chih-Hsuan Yen
Chih-Hsuan Yen added the comment: I created https://github.com/python/cpython/pull/12587 as a preparation pull request to fix the __sgi issue mentioned in msg282782. -- ___ Python tracker

<    1   2