[issue37324] collections: remove deprecated aliases to ABC classes

2021-01-12 Thread STINNER Victor
STINNER Victor added the comment: New changeset c47c78b878ff617164b2b94ff711a6103e781753 by Hugo van Kemenade in branch 'master': bpo-37324: Remove ABC aliases from collections (GH-23754) https://github.com/python/cpython/commit/c47c78b878ff617164b2b94ff711a6103e781753 -- _

[issue42914] pprint numbers with underscore

2021-01-12 Thread Felipe
New submission from Felipe : It would be nice if pprint learned to insert underscores in long numbers Current behavior: >>> pprint.pprint(int(1e9)) 10 Desired behavior >>> pprint.pprint(int(1e9)) 1_000_000_000 Wikipedia tells me that "groups of 3" is the international standard to be

[issue42862] Use functools.lru_cache iso. _sqlite.Cache in sqlite3 module

2021-01-12 Thread Erlend Egeberg Aasland
Change by Erlend Egeberg Aasland : -- pull_requests: +23028 pull_request: https://github.com/python/cpython/pull/24203 ___ Python tracker ___ __

[issue42915] enum.Flag ~ bitwise negation is very slow and can't be defined as a Flag value

2021-01-12 Thread Kevin Chen
New submission from Kevin Chen : Here's a code sample: ``` import time from enum import Flag, auto class MyFlag(Flag): NONE = 0 FLAG_1 = auto() FLAG_2 = auto() FLAG_3 = auto() FLAG_4 = auto() FLAG_5 = auto() FLAG_6 = auto() # # NOT_FLAG_1_OR_2 = ~FLAG_1 & ~

[issue25988] collections.abc.Indexable

2021-01-12 Thread STINNER Victor
STINNER Victor added the comment: New changeset c47c78b878ff617164b2b94ff711a6103e781753 by Hugo van Kemenade in branch 'master': bpo-37324: Remove ABC aliases from collections (GH-23754) https://github.com/python/cpython/commit/c47c78b878ff617164b2b94ff711a6103e781753 -- ___

[issue42914] pprint numbers with underscore

2021-01-12 Thread Felipe
Felipe added the comment: Here is an implementation of the safe repr for numbers if helpful: ``` def safe_repr_int(object): sign = '' if object < 0: sign = '-' object = -object r = repr(object) if len(r) <= 4: return sign + r parts = [sign] left

[issue41036] Visit the type of instance of heap types if tp_traverse is not implemented

2021-01-12 Thread STINNER Victor
STINNER Victor added the comment: I created a thread on python-dev: "Heap types (PyType_FromSpec) must fully implement the GC protocol" https://mail.python.org/archives/list/python-...@python.org/thread/C4ILXGPKBJQYUN5YDMTJOEOX7RHOD4S3/ -- ___ Pytho

[issue1635741] Py_Finalize() doesn't clear all Python objects at exit

2021-01-12 Thread STINNER Victor
STINNER Victor added the comment: > In GH-23598, PyModule_AddObjectRef was added as EXPORT_DATA. Shouldn't it be > EXPORT_FUNC? Oh, I didn't notice that there was EXPORT_DATA. Right, EXPORT_FUNC must be used. -- ___ Python tracker

[issue42800] Traceback objects allow accessing frame objects without triggering audit hooks

2021-01-12 Thread STINNER Victor
STINNER Victor added the comment: Aaaah, PR 24182 doesn't add a hook to object.__getattr__, but to the C getter functions on traceback and frame. That sounds more acceptable to me :-) These operations are uncommon and should not be part of "hot code" (critical for performance) unless you're

[issue42916] Support for DICOM image file format in imghdr module

2021-01-12 Thread Charles Law
New submission from Charles Law : DICOM is a file format used frequently in medical imaging (it is also a communications protocol). It has been used since the 80's, and is still widely used by modern medical equipment. It has a well defined format: http://dicom.nema.org/dicom/2013/output/cht

[issue42848] asyncio produces an unexpected traceback with recursive __getattribute__

2021-01-12 Thread Guido van Rossum
Guido van Rossum added the comment: Will be fixed in 3.10. I prefer not to backport the solution (Irit, do you agree?) -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker

[issue42917] Block stack size for frame objects should be dynamically sizable

2021-01-12 Thread Thomas Anderson
New submission from Thomas Anderson : Currently the block stack size is hardcoded to 20. Similar to how the value stack is dynamically sizable, we should make the block stack dynamically sizable. This will reduce space on average (since the typical number of blocks for a function is well be

[issue42917] Block stack size for frame objects should be dynamically sizable

2021-01-12 Thread Roundup Robot
Change by Roundup Robot : -- keywords: +patch nosy: +python-dev nosy_count: 1.0 -> 2.0 pull_requests: +23029 stage: -> patch review pull_request: https://github.com/python/cpython/pull/24204 ___ Python tracker _

[issue42914] pprint numbers with underscore

2021-01-12 Thread Raymond Hettinger
Raymond Hettinger added the comment: > It would be nice if pprint learned to insert underscores in long numbers +1 but I would make this optional. > Here is an implementation of the safe repr for numbers if helpful I suggest using the existing string formatting tools as a foundation >>

[issue42915] enum.Flag ~ bitwise negation is very slow and can't be defined as a Flag value

2021-01-12 Thread Guido van Rossum
Change by Guido van Rossum : -- nosy: +ethan.furman ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://m

[issue15373] copy.copy() does not properly copy os.environment

2021-01-12 Thread Josh Rosenberg
Josh Rosenberg added the comment: Would we remove the functionality of os.environ.copy()? It seems very odd for types to have a .copy() method that works, while not supporting copy.copy, especially when there is zero documentation, on the web or the docstring, to even hint at the difference.

[issue42899] Is it legal to eliminate tests of a value, when that test has no effect on control flow?

2021-01-12 Thread Josh Rosenberg
Josh Rosenberg added the comment: Gregory: Even in a low-level compiled language (say, C++), pretty sure the compiler can't automatically optimize out: if (x) { } unless it has sure knowledge of the implementation of operator bool; if operator bool's implementation isn't in the header f

[issue42918] Nested multi-line expression will lead to "compile()" fails

2021-01-12 Thread Xinmeng Xia
New submission from Xinmeng Xia : For build-in function compile() in mode 'single', only single statement can be well compiled. If we compile multiple statements, the parser will raise a syntaxError. Seeing the following two programs, In program 1, 2 statement are compiled. So the parser ra

[issue42919] Blank in multiline “if expressions” will lead to EOF errors

2021-01-12 Thread Xinmeng Xia
New submission from Xinmeng Xia : In build-in function compile() of mode 'single', single statement can be well compiled. (see program 1 and program 2). However, if we leave 4 blank spaces before the end of triple-quotation mark of "if expression",(see program 3), The parser will raise synta

[issue42918] Nested multi-line expression will lead to "compile()" fails

2021-01-12 Thread Xinmeng Xia
Change by Xinmeng Xia : -- components: +Interpreter Core ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http

[issue21895] signal.pause() and signal handlers don't react to SIGCHLD in non-main thread

2021-01-12 Thread Guido van Rossum
Guido van Rossum added the comment: When I removed myself from the nosy list I did mean to stop working on this bug, just that I am unlikely to be of any help. :-) -- nosy: +gvanrossum ___ Python tracker __

[issue1635741] Py_Finalize() doesn't clear all Python objects at exit

2021-01-12 Thread Dong-hee Na
Change by Dong-hee Na : -- pull_requests: +23031 pull_request: https://github.com/python/cpython/pull/24205 ___ Python tracker ___ ___

[issue42913] asyncio.ProactorEventLoop mishandles signal wakeup file descriptor

2021-01-12 Thread Guido van Rossum
Guido van Rossum added the comment: Looks this was not tested or thought through with multiple loops and signals (admittedly, using signals is never fun, and even less so on Windows). Can you send a PR with a fix? -- nosy: +gvanrossum ___ Python t

[issue42919] Blank in multiline “if expressions” will lead to EOF errors

2021-01-12 Thread Guido van Rossum
Change by Guido van Rossum : -- nosy: +lys.nikolaou ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://m

[issue42918] Nested multi-line expression will lead to "compile()" fails

2021-01-12 Thread Guido van Rossum
Change by Guido van Rossum : -- nosy: +lys.nikolaou ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://m

[issue42918] Nested multi-line expression will lead to "compile()" fails

2021-01-12 Thread Guido van Rossum
Guido van Rossum added the comment: What does the bytecode for c in program 2 look like? Also, how do you find all these bugs? Are you developing a new fuzzier? -- nosy: +gvanrossum ___ Python tracker _

[issue42918] Nested multi-line expression will lead to "compile()" fails

2021-01-12 Thread Xinmeng Xia
Xinmeng Xia added the comment: The bytecode of c is as following: 0 LOAD_CONST 0 (1) 2 STORE_NAME 0 (d) 4 LOAD_CONST 1 (None) 6 RETURN_VALUE === Yes, m

[issue42918] Nested multi-line expression will lead to "compile()" fails

2021-01-12 Thread Guido van Rossum
Guido van Rossum added the comment: It’s good work! Is it open source? -- ___ Python tracker ___ ___ Python-bugs-list mailing list U

[issue42920] How to add end_lineno in pyclbr?

2021-01-12 Thread Aviral Srivastava
New submission from Aviral Srivastava : I created a PR a year ago, https://github.com/python/cpython/pull/16466/files, and now the source code is completely changed. How do I create another PR or if there is another way through which I can get an end line for each object (class and function)

[issue42918] Nested multi-line expression will lead to "compile()" fails

2021-01-12 Thread Xinmeng Xia
Xinmeng Xia added the comment: For sure! As soon as we validate this technique, we will open source it on GitHub. -- ___ Python tracker ___ __

[issue42915] enum.Flag ~ bitwise negation is very slow and can't be defined as a Flag value

2021-01-12 Thread Ethan Furman
Ethan Furman added the comment: I just finished a rewrite of Flag for 3.10. Using your test below I was able to tweak the rewrite so the final numbers are: Took normal 0.148092 seconds. Took cached 0.017438 seconds. Your original post had a ratio of nearly 200 -- it is now 8.7ish.

[issue42921] Inferred Optional type of wrapper function arguments

2021-01-12 Thread Joseph Perez
New submission from Joseph Perez : `typing.get_type_hints` gives a different result for a wrapper created with `functools.wraps` in case of inferred `Optional` arguments (when the default value of the argument is None) ```python from functools import wraps from typing import get_type_hints d

[issue42901] [Enum] move member creation to __set_name__ in order to support __init_subclass__

2021-01-12 Thread Ethan Furman
Ethan Furman added the comment: New changeset c314e60388282d9829762fb6c30b12e2807caa19 by Ethan Furman in branch 'master': bpo-42901: [Enum] move member creation to `__set_name__` (GH-24196) https://github.com/python/cpython/commit/c314e60388282d9829762fb6c30b12e2807caa19 -- __

<    1   2