[issue39942] Making instance of `TypeVar` fails because of missing `__name__`

2020-04-20 Thread hongweipeng
Change by hongweipeng : -- keywords: +patch nosy: +hongweipeng nosy_count: 1.0 -> 2.0 pull_requests: +18948 stage: -> patch review pull_request: https://github.com/python/cpython/pull/19616 ___ Python tracker __

[issue34037] asyncio: BaseEventLoop.close() shutdowns the executor without waiting causing leak of dangling threads

2020-04-20 Thread Petr Viktorin
Petr Viktorin added the comment: I got a report from a library that ties together asyncio and some other async libraries, getting errors like this: tests/test_taskgroups.py:60: in test_run_natively module.run(testfunc()) /usr/lib64/python3.9/asyncio/runners.py:48: in run loop.run_unti

[issue21622] ctypes.util incorrectly fails for libraries without DT_SONAME

2020-04-20 Thread Natanael Copa
Natanael Copa added the comment: I create a PR for this issue. It would be nice to have it reviewed. https://github.com/python/cpython/pull/18380 Thanks! -- ___ Python tracker _

[issue40332] RegEx for numbers in documentation (easy fix - solution provided)

2020-04-20 Thread Mark Dickinson
Mark Dickinson added the comment: As you say, isn't this just a personal preference? Is there an objective reason to prefer something that accepts ".5" and rejects "3." over something that rejects ".5" and accepts "3."? The exact form of numbers accepted seems to be to be irrelevant to the p

[issue40275] test.support has way too many imports

2020-04-20 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Reducing the import time is not a goal, it is just a measurable side effect. The goal is to reduce the number of imported modules unneeded for the particular test. Importing every module can have side effects which affects the tested behavior. It would be

[issue40332] RegEx for numbers in documentation (easy fix - solution provided)

2020-04-20 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I concur with Mark. It is just an example. The regular expression which would support all possible forms of numbers (including exponent, underscores, non-decimal numbers) would be more complex and would distract from the main goal of the example.

[issue40335] Regression in multiline SyntaxError offsets

2020-04-20 Thread Pablo Galindo Salgado
Change by Pablo Galindo Salgado : -- keywords: +patch pull_requests: +18949 stage: -> patch review pull_request: https://github.com/python/cpython/pull/19619 ___ Python tracker __

[issue40336] Refactor typing._SpecialForm

2020-04-20 Thread Serhiy Storchaka
New submission from Serhiy Storchaka : The proposed PR refactors the implementation of typing._SpecialForm. Different special forms are different by name, docstring, and the behavior of __getitem__. Instead of special casing by name in __getitem__, instances are now parametrized by the implem

[issue40336] Refactor typing._SpecialForm

2020-04-20 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- keywords: +patch pull_requests: +18950 stage: -> patch review pull_request: https://github.com/python/cpython/pull/19620 ___ Python tracker ___

[issue40255] Fixing Copy on Writes from reference counting

2020-04-20 Thread Mark Shannon
Mark Shannon added the comment: Eddie, How did you compare the branching vs. non-branching implementations? I have read the code in the PR. What is the non-branching version that you used to compare it against? Why not use the sign bit as the immortal bit? It simplifies the test considerab

[issue39983] test.regrtest: test marked as failed (env changed), but no warning: test_multiprocessing_forkserver

2020-04-20 Thread STINNER Victor
STINNER Victor added the comment: Another example: test_asyncio on AMD64 Fedora Stable Clang 3.x https://buildbot.python.org/all/#/builders/226/builds/630 -- ___ Python tracker __

[issue17986] Alternative async subprocesses (pep 3145)

2020-04-20 Thread STINNER Victor
STINNER Victor added the comment: Well, this issue is basically inactive for 5 years. It doesn't sound like a common feature request. I close it. -- resolution: -> rejected stage: -> resolved status: open -> closed ___ Python tracker

[issue34037] asyncio: BaseEventLoop.close() shutdowns the executor without waiting causing leak of dangling threads

2020-04-20 Thread STINNER Victor
STINNER Victor added the comment: I reopen the issue. > /usr/lib64/python3.9/asyncio/events.py:254: in shutdown_default_executor > raise NotImplementedError That means that the project (python-anyio) implements its own event loop which inherits from AbstractEventLoop, it doesn't use Base

[issue40284] Add mapping methods to types.SimpleNamespace

2020-04-20 Thread STINNER Victor
STINNER Victor added the comment: Raymond started a thread on python-dev: https://mail.python.org/archives/list/python-...@python.org/message/JOMND56PJGRN7FQQLLCWONE5Z7R2EKXW/ It seems like most core developers are against modifying types.SimpleNamespace, the trend is more about adding a diff

[issue40275] test.support has way too many imports

2020-04-20 Thread STINNER Victor
STINNER Victor added the comment: Vinay Sajip: "What is the practical impact on the time taken for test runs?" My first concern is that our "unit tests" are not "unit" anymore. test_threading should be restricted to test the threading module: it should not test "indirectly" the logging modul

[issue38905] venv python reports wrong sys.executable in a subprocess on Windows

2020-04-20 Thread Steve Dower
Steve Dower added the comment: I posted a workaround right above your post for when you want to resolve executables against PATH instead of using Windows's normal rules. I'm not sure we reached any good approach for launching sys.executable in a venv and automatically bypassing the redirecto

[issue40255] Fixing Copy on Writes from reference counting

2020-04-20 Thread Steve Dower
Steve Dower added the comment: > I would expect that the negative impact on branch predictability would easily > outweigh the cost of the memory write (A guaranteed L1 hit) If that were true then Spectre and Meltdown wouldn't have been so interesting :) Pipelining processors are going to spe

[issue40255] Fixing Copy on Writes from reference counting

2020-04-20 Thread Antoine Pitrou
Antoine Pitrou added the comment: > Benchmarking already showed that the branching version is faster. But micro-benchmarks may tell you things which are not true in the real-world (for example an easily-predicted branch). -- ___ Python tracker

[issue40260] modulefinder traceback regression starting on Windows

2020-04-20 Thread Steve Dower
Steve Dower added the comment: Thanks! I deleted the NEWS file (we've already got one for this issue in this release) and skipped the check instead. Once CI passes, I'll merge it. -- ___ Python tracker

[issue40255] Fixing Copy on Writes from reference counting

2020-04-20 Thread Steve Dower
Steve Dower added the comment: > But micro-benchmarks may tell you things which are not true in the real-world > (for example an easily-predicted branch) This is true, though this branch should be more easily predictable because INCREF/DECREF are inlined. If there were only one function doin

[issue40337] builtins.RuntimeError: Caught RuntimeError in pin memory thread for device 0.

2020-04-20 Thread shawn
New submission from shawn :  File "D:\yolov3\train.py", line 430, in train() # train normally  File "D:\yolov3\train.py", line 236, in train for i, (imgs, targets, paths, _) in pbar: # batch - File "D:\Programs\Python\Python38\Li

[issue40337] builtins.RuntimeError: Caught RuntimeError in pin memory thread for device 0.

2020-04-20 Thread Eric V. Smith
Eric V. Smith added the comment: This appears to be a problem in a third-party library: torch. You didn't include any code example that triggers the problem. Without some way to duplicate this issue, there's not much we can do about it. -- nosy: +eric.smith _

[issue40333] Request for multi-phase initialization API to run code after importlib init

2020-04-20 Thread STINNER Victor
STINNER Victor added the comment: The current workaround is to use PyConfig._init_main=0, call Py_InitializeFromConfig(), tune Python, and then call _Py_InitializeMain() to finish the "main" initialization: https://docs.python.org/dev/c-api/init_config.html#multi-phase-initialization-private

[issue40333] Request for multi-phase initialization API to run code after importlib init

2020-04-20 Thread STINNER Victor
Change by STINNER Victor : -- nosy: +eric.snow, ncoghlan, steve.dower ___ Python tracker ___ ___ Python-bugs-list mailing list Unsub

[issue40338] [Security] urllib and anti-slash (\) in the hostname

2020-04-20 Thread STINNER Victor
New submission from STINNER Victor : David Schütz reported the following urllib vulnerability to the PSRT at 2020-03-29. He wrote an article about a similar vulnerability in Closure (Javascript): https://bugs.xdavidhu.me/google/2020/03/08/the-unexpected-google-wide-domain-check-bypass/ David w

[issue40338] [Security] urllib and anti-slash (\) in the hostname

2020-04-20 Thread STINNER Victor
STINNER Victor added the comment: (The first message is basically David's email rephrased. Here is my reply ;-)) > This could present issues if server-side checks are used by applications to > validate a URLs authority. Which kind of application would be affected by this vulnerability? It's

[issue37006] Add top level await statement support for doctest

2020-04-20 Thread Batuhan Taskaya
Change by Batuhan Taskaya : -- nosy: +BTaskaya versions: +Python 3.9 -Python 3.8 ___ Python tracker ___ ___ Python-bugs-list mailing

[issue40255] Fixing Copy on Writes from reference counting

2020-04-20 Thread Antoine Pitrou
Antoine Pitrou added the comment: > We also have the real world app that is Instagram. I don't think Instagram is a single app. What is Python used for at Instagram? -- ___ Python tracker __

[issue40260] modulefinder traceback regression starting on Windows

2020-04-20 Thread Steve Dower
Steve Dower added the comment: New changeset 9b0b5d2baebd0b6a545317200c313a6a7408731e by Barry in branch 'master': bpo-40260: Revert breaking changes made in modulefinder (GH-19595) https://github.com/python/cpython/commit/9b0b5d2baebd0b6a545317200c313a6a7408731e -- ___

[issue40260] modulefinder traceback regression starting on Windows

2020-04-20 Thread miss-islington
Change by miss-islington : -- pull_requests: +18951 pull_request: https://github.com/python/cpython/pull/19621 ___ Python tracker ___ __

[issue40255] Fixing Copy on Writes from reference counting

2020-04-20 Thread Rémi Lapeyre
Rémi Lapeyre added the comment: >> We also have the real world app that is Instagram. > I don't think Instagram is a single app. What is Python used for at Instagram? According to their engineering blog (https://instagram-engineering.com/static-analysis-at-scale-an-instagram-story-8f498ab71a0

[issue40255] Fixing Copy on Writes from reference counting

2020-04-20 Thread Antoine Pitrou
Antoine Pitrou added the comment: Wow. I see, thank you. -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue39562] Asynchronous comprehensions don't work in asyncio REPL

2020-04-20 Thread STINNER Victor
STINNER Victor added the comment: Is there an update of this *release blocker* issue? Should we revert the commit 9052f7a41b90f2d34011c8da68f9a4facebc8a97? -- ___ Python tracker

[issue39651] Exceptions raised by EventLoop.call_soon_threadsafe

2020-04-20 Thread Chris Meyer
Chris Meyer added the comment: Is this related to bpo-39010 too? -- nosy: +cmeyer ___ Python tracker ___ ___ Python-bugs-list maili

[issue39010] ProactorEventLoop raises unhandled ConnectionResetError

2020-04-20 Thread Chris Meyer
Change by Chris Meyer : -- nosy: +cmeyer ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.

[issue37373] Configuration of windows event loop for libraries

2020-04-20 Thread Chris Meyer
Change by Chris Meyer : -- nosy: +cmeyer ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.

[issue39651] Exceptions raised by EventLoop.call_soon_threadsafe

2020-04-20 Thread Ben Darnell
Ben Darnell added the comment: No, this is unrelated to bpo-39010. -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsu

[issue34037] asyncio: BaseEventLoop.close() shutdowns the executor without waiting causing leak of dangling threads

2020-04-20 Thread Chris Meyer
Change by Chris Meyer : -- nosy: +cmeyer ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.

[issue39562] Asynchronous comprehensions don't work in asyncio REPL

2020-04-20 Thread Batuhan Taskaya
Batuhan Taskaya added the comment: > Is there an update of this *release blocker* issue? Should we revert the > commit 9052f7a41b90f2d34011c8da68f9a4facebc8a97? I dont think we can gain much by reverting 9052f7a41b90f2d34011c8da68f9a4facebc8a97 because it doesn't introduce a new issue, it j

[issue39849] Compiler warninig: warning: variable ‘res’ set but not used [-Wunused-but-set-variable]

2020-04-20 Thread hai shi
Change by hai shi : -- pull_requests: +18952 pull_request: https://github.com/python/cpython/pull/19623 ___ Python tracker ___ ___ P

[issue40260] modulefinder traceback regression starting on Windows

2020-04-20 Thread miss-islington
miss-islington added the comment: New changeset 81de3c225774179cdc82a1733a64e4a876ff02b5 by Miss Islington (bot) in branch '3.8': bpo-40260: Revert breaking changes made in modulefinder (GH-19595) https://github.com/python/cpython/commit/81de3c225774179cdc82a1733a64e4a876ff02b5 --

[issue39562] Asynchronous comprehensions don't work in asyncio REPL

2020-04-20 Thread Batuhan Taskaya
Batuhan Taskaya added the comment: GH 19230: (.venv) [ 6:17PM ] [ isidentical@threeheadedgiant:~ ] $ ./cpython/python z.py ** File "/home/isidentical/doctest.txt", line 4, in doctest.txt Failed example: await __import__(

[issue40312] Weakref callbacks running before finalizers in GC collection

2020-04-20 Thread Allan Feldman
Allan Feldman added the comment: Thanks for the explanation! I agree that "about to be finalized" is unclear in the docs :) I still believe that having different behavior for the ordering of finalizers versus weakref callbacks depending on whether the path is through gc versus reference cou

[issue40312] Weakref callbacks running before finalizers in GC collection

2020-04-20 Thread Allan Feldman
Allan Feldman added the comment: Also I just noticed this statement: > In current CPython, for your ForeverObject(False), `del o` does not make the > object trash "for real". __del__ runs immediately (due to deterministic, > synchronous reference counting) and resurrects it. That cuts off

[issue40338] [Security] urllib and anti-slash (\) in the hostname

2020-04-20 Thread hai shi
Change by hai shi : -- nosy: +shihai1991 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.

[issue23117] Properly codesign Mac python 2.7.9.pkg so it can work thru OS X firewall

2020-04-20 Thread Ned Deily
Ned Deily added the comment: Thanks to the additional requirements of Gatekeeper in macOS 10.15 Catalina, the binaries included in current python.org installers for macOS are now codesigned as of 3.8.2, 3.7.7, and 2.7.18. -- resolution: -> fixed stage: needs patch -> resolved status

[issue36890] python-3.7.3-macosx10.6.pkg verification error on macOS 10.6 Snow Leopard

2020-04-20 Thread Ned Deily
Ned Deily added the comment: Beginning in 2020, we have stopped providing the 10.6+ installer variant for macOS since all evidence that we have is that it was used very little and there are a grower number of problems with trying to use it on very old systems, as evidenced in this issue. Si

[issue40312] Weakref callbacks running before finalizers in GC collection

2020-04-20 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: I think this is a good summary of what you are referring to: >>> import gc, weakref >>> class Lazarus: ...def __del__(self): ... global x ... x = self ... >>> def callback(*args): ... print("DEAD") ... # No gc dead: >>> x = None >>

[issue40312] Weakref callbacks running before finalizers in GC collection

2020-04-20 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: One thing we could do is call the weakref callbacks *after* we call `finalize_garbage` and only on the "final_unreachable" set (the objects that do not resurrect). Notice that doing this still has one difference: the callback will be executed AFTER th

[issue39562] Asynchronous comprehensions don't work in asyncio REPL

2020-04-20 Thread STINNER Victor
STINNER Victor added the comment: Either the regression should be fixed, or the commits which introduced the regression should be reverted. I'm talking about python-gmpy2 doctest which pass on Python 3.8: msg365311. -- ___ Python tracker

[issue39562] Asynchronous comprehensions don't work in asyncio REPL

2020-04-20 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: > Either the regression should be fixed, or the commits which introduced the > regression should be reverted. If you do that we will have now two problems: * The asyncio repr will not work correctly. * The flags in compile still have a clash. The sol

[issue40260] modulefinder traceback regression starting on Windows

2020-04-20 Thread Steve Dower
Change by Steve Dower : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___ ___ P

[issue40255] Fixing Copy on Writes from reference counting

2020-04-20 Thread Mark Shannon
Mark Shannon added the comment: On 20/04/2020 2:33 pm, Steve Dower wrote: > > Steve Dower added the comment: > >> I would expect that the negative impact on branch predictability would >> easily outweigh the cost of the memory write (A guaranteed L1 hit) > > If that were true then Spectre

[issue40312] Weakref callbacks running before finalizers in GC collection

2020-04-20 Thread Tim Peters
Tim Peters added the comment: Allan, we don't (at least not knowingly) write tests that rely on order of end-of-life actions, because the _language_ defines nothing about the order. So you can permute the order and it's unlikely any standard tests would fail. The only reason your example "w

[issue40327] list(sys.modules.items()) can throw RuntimeError: dictionary changed size during iteration

2020-04-20 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I afraid that this is a part of the larger issue (see also issue31165). Seems the cause is that the GIL can be released when allocate or reallocate the memory. Does your project use some memory managing hooks? Using sys.modules.copy().items() can help a lo

[issue39849] Compiler warninig: warning: variable ‘res’ set but not used [-Wunused-but-set-variable]

2020-04-20 Thread Dong-hee Na
Dong-hee Na added the comment: Thanks hai shi, now the issue is fixed :) -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___

[issue39849] Compiler warninig: warning: variable ‘res’ set but not used [-Wunused-but-set-variable]

2020-04-20 Thread Dong-hee Na
Dong-hee Na added the comment: New changeset 5dd21f5d1c9b5a9316deca4535932675f04efeee by Hai Shi in branch 'master': bpo-39849: Enable assertions in _testcapimodule.c and _testinternalcapi.c (GH-19623) https://github.com/python/cpython/commit/5dd21f5d1c9b5a9316deca4535932675f04efeee --

[issue40312] Weakref callbacks running before finalizers in GC collection

2020-04-20 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: > Pablo, as above, I'm inclined to leave things alone unless we can "prove" no > current code could possibly be relying (even by accident) on that gc > currently runs callbacks before finalizers. Which may be the case! I don't > know ;-) I very muc

[issue40288] atexit module should not be loaded more than once per interpreter

2020-04-20 Thread Dong-hee Na
Change by Dong-hee Na : -- nosy: +eric.snow ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pyth

[issue40339] Instead of skipping, IPV6 test(s) fail on a non-IPV6 machine

2020-04-20 Thread M T
New submission from M T : I have no use for IPv6 and, when recompiling my OS, disable the feature completely. Python compiles nicely despite of this, but the IPv6-related tests fail instead of being skipped: ERROR: test_create_server_ipv6 (test.test_asyncio.test_base_events.BaseEventLoopWith

[issue40312] Weakref callbacks running before finalizers in GC collection

2020-04-20 Thread Allan Feldman
Allan Feldman added the comment: I definitely understand the possibility that some code is relying on the current gc behavior of weakref callbacks being invoked after finalizers. That being said, the behavior is currently inconsistent between gc and reference counted paths. The language does

[issue40286] Add randbytes() method to random.Random

2020-04-20 Thread Raymond Hettinger
Raymond Hettinger added the comment: The randbytes() method needs to depend on genrandbits(). It is documented that custom generators can supply there own random() and genrandbits() methods and expect that the other downstream generators all follow. See the attached example which demonstra

[issue40286] Add randbytes() method to random.Random

2020-04-20 Thread Raymond Hettinger
Raymond Hettinger added the comment: Direct link to MT code that I would like to leave mostly unmodified: http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/MT2002/CODES/mt19937ar.c -- ___ Python tracker

[issue40312] Weakref callbacks running before finalizers in GC collection

2020-04-20 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: > The result is that behavioral consistency becomes more difficult in > application code when using language provided structures such as > WeakValueDictionary. Well, you are already in tricky territory using finalizers. Note this sentence from the d

[issue40314] python code order of magnitude faster than equivalent CPython code for simple import statement

2020-04-20 Thread Zachary Ware
Zachary Ware added the comment: Are you quite sure you're converting your times correctly, particularly in the C code? The units in the Python version should be seconds; does the C version actually take 23 seconds to execute? What kind of timing do you get if you time both programs with th

[issue40330] ShareableList size guard incorrect for str data

2020-04-20 Thread miss-islington
miss-islington added the comment: New changeset eba9f6155df59c9beed97fb5764c9f01dd941af0 by Antoine Pitrou in branch 'master': bpo-40330: Fix utf-8 size check in ShareableList (GH-19606) https://github.com/python/cpython/commit/eba9f6155df59c9beed97fb5764c9f01dd941af0 -- nosy: +miss

[issue40312] Weakref callbacks running before finalizers in GC collection

2020-04-20 Thread Allan Feldman
Allan Feldman added the comment: Yup agree with all the points above, just wanted to point out that I think self.value is strongly referenced (even though it's just internal references and will be collected by the gc) during Foo.__del__ execution (annotated code below), yet the WeakValueDict

[issue40330] ShareableList size guard incorrect for str data

2020-04-20 Thread Antoine Pitrou
Change by Antoine Pitrou : -- pull_requests: +18953 pull_request: https://github.com/python/cpython/pull/19625 ___ Python tracker ___ __

[issue40339] Instead of skipping, IPV6 test(s) fail on a non-IPV6 machine

2020-04-20 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: See also https://bugs.python.org/issue37199 for related work. -- nosy: +ZackerySpytz, asvetlov, xtreak ___ Python tracker ___ _

[issue40237] Test code coverage (C) job of Travis CI fails on test_distutils which creates _configtest.gcno file

2020-04-20 Thread Brett Cannon
Brett Cannon added the comment: The historical background is code coverage of C code seemed like a good idea, so we set it up. :) Not much else to it. -- ___ Python tracker _

[issue40330] ShareableList size guard incorrect for str data

2020-04-20 Thread Antoine Pitrou
Antoine Pitrou added the comment: New changeset 887ff8e37e238fbce18c647e588283904f38ab24 by Antoine Pitrou in branch '3.8': [3.8] bpo-40330: Fix utf-8 size check in ShareableList (GH-19606) (GH-19625) https://github.com/python/cpython/commit/887ff8e37e238fbce18c647e588283904f38ab24

[issue40330] ShareableList size guard incorrect for str data

2020-04-20 Thread Antoine Pitrou
Change by Antoine Pitrou : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed versions: -Python 3.7 ___ Python tracker ___ ___

[issue40286] Add randbytes() method to random.Random

2020-04-20 Thread Raymond Hettinger
Raymond Hettinger added the comment: When a new method gets added to a module, it should happen in a way that is in harmony with the module's design. -- nosy: +tim.peters ___ Python tracker

[issue40340] Programming FAQ about "How do I convert a string to a number?" contains a typo

2020-04-20 Thread Dominik V.
New submission from Dominik V. : The paragraph about [How do I convert a string to a number?](https://docs.python.org/3/faq/programming.html#how-do-i-convert-a-string-to-a-number) contains the following sentence: > By default, these interpret the number as decimal, so that `int('0144') == >

[issue40340] Programming FAQ about "How do I convert a string to a number?" contains a typo

2020-04-20 Thread Cajetan Rodrigues
Cajetan Rodrigues added the comment: > these interpret the number as decimal I'm no linguist, but I feel both expressions in the subordinate clause have their purposes, with respect to the the main clause: * `int('0144') == 144` to show what works * `int('0x144')` to show what does not work

[issue39942] Making instance of `TypeVar` fails because of missing `__name__`

2020-04-20 Thread Ivan Levkivskyi
Ivan Levkivskyi added the comment: New changeset a25a04fea5446b1712cde0cff556574be139285a by HongWeipeng in branch 'master': bpo-39942:Fix failure in `TypeVar` when missing `__name__` (GH-19616) https://github.com/python/cpython/commit/a25a04fea5446b1712cde0cff556574be139285a -- nos

[issue39942] Making instance of `TypeVar` fails because of missing `__name__`

2020-04-20 Thread miss-islington
Change by miss-islington : -- pull_requests: +18955 pull_request: https://github.com/python/cpython/pull/19627 ___ Python tracker ___ __

[issue39942] Making instance of `TypeVar` fails because of missing `__name__`

2020-04-20 Thread miss-islington
Change by miss-islington : -- nosy: +miss-islington nosy_count: 3.0 -> 4.0 pull_requests: +18954 pull_request: https://github.com/python/cpython/pull/19626 ___ Python tracker _

[issue40312] Weakref callbacks running before finalizers in GC collection

2020-04-20 Thread Tim Peters
Tim Peters added the comment: Well, the refcounts on _everything_ cyclic gc sees are greater than 0. Because if an object's refcount ever falls to 0 in CPython, reference counting deals with it immediately, and so it doesn't survive to participate in cyclic gc. IOW, absolutely everything cy

[issue39942] Making instance of `TypeVar` fails because of missing `__name__`

2020-04-20 Thread miss-islington
miss-islington added the comment: New changeset 694a95ff437613e6295f531336b5bc7cab9e3713 by Miss Islington (bot) in branch '3.7': bpo-39942:Fix failure in `TypeVar` when missing `__name__` (GH-19616) https://github.com/python/cpython/commit/694a95ff437613e6295f531336b5bc7cab9e3713 -

[issue40340] Programming FAQ about "How do I convert a string to a number?" contains a typo

2020-04-20 Thread Dominik V.
Dominik V. added the comment: Indeed, thanks for clarifying. It seems I misunderstood the example, and perhaps that calls for a better separation. What about adding > By default, these interpret the number as decimal, so that `int('0144') == > 144` holds true and `int('0x144')` raises ValueE

[issue39942] Making instance of `TypeVar` fails because of missing `__name__`

2020-04-20 Thread miss-islington
miss-islington added the comment: New changeset 41660cac63c1a216e43335007e329e213054100e by Miss Islington (bot) in branch '3.8': bpo-39942:Fix failure in `TypeVar` when missing `__name__` (GH-19616) https://github.com/python/cpython/commit/41660cac63c1a216e43335007e329e213054100e -

[issue40198] macOS Python builds from Python.org ignore DYLD_LIBRARY_PATH due to hardened runtime

2020-04-20 Thread dgelessus
dgelessus added the comment: I can confirm that the newly released Python 2.7.18 has the .allow-dyld-environment-variables entitlement: $ ./python2.7 --version Python 2.7.18 $ codesign --display --entitlements=:- python2.7 Executable=/Library/Frameworks/Python.framework/Versions/2.7/bin/pytho

[issue40327] list(sys.modules.items()) can throw RuntimeError: dictionary changed size during iteration

2020-04-20 Thread Raymond Hettinger
Change by Raymond Hettinger : -- keywords: +patch pull_requests: +18956 stage: -> patch review pull_request: https://github.com/python/cpython/pull/19628 ___ Python tracker __

[issue39942] Making instance of `TypeVar` fails because of missing `__name__`

2020-04-20 Thread Ivan Levkivskyi
Change by Ivan Levkivskyi : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___ _

[issue40341] Programming FAQ includes actively discouraged solutions; Should those be removed?

2020-04-20 Thread Dominik V.
New submission from Dominik V. : The Programming FAQ contains multiple solutions (examples) which it describes as "shouldn't be used". The question is why are these included in the first place? Some of them are complicated in a way that a (new) programmer is unlikely to discover them by themse

[issue39939] PEP 616: Add str methods to remove prefix or suffix

2020-04-20 Thread STINNER Victor
STINNER Victor added the comment: The documentation should explain well the difference between removeprefix()/removesuffix() and lstrip()/strip()/rstrip(), since it is the rationale of the PEP ;-) An example that can be used to explain the difference: >>> "Monty Python".removesuffix(" Pytho

[issue40342] Programming FAQ about "How do I apply a method to a sequence of objects?" should include the option of an explicit for-loop

2020-04-20 Thread Dominik V.
New submission from Dominik V. : Right now the question is simply answered with: > result = [obj.method() for obj in mylist] However this is only appropriate if the result of the method is needed (i.e. if it's some kind of transformation). There are many cases where it's not and the method i

[issue40341] Programming FAQ includes actively discouraged solutions; Should those be removed?

2020-04-20 Thread Raymond Hettinger
Raymond Hettinger added the comment: I rather like the discussion in [How do I write a function with output parameters]. Some variant of each of those solutions arise in code reviews over and over again. Rarely do the occur in simplistic examples, but they do occur. The simple examples gi

[issue39939] PEP 616: Add str methods to remove prefix or suffix

2020-04-20 Thread STINNER Victor
STINNER Victor added the comment: When, I even expect that some people use .strip() whereas their intent was to use .lstrip(): >>> "Python vs Monty Python".strip("Python") ' vs Monty ' Again, strip() is used with a string whereas the real intent was to use removesuffix() which didn't exist

[issue40120] Undefined C behavior going beyond end of struct via a [1] arrays.

2020-04-20 Thread Antoine Pitrou
Antoine Pitrou added the comment: Another possibility yet would be: typedef struct { PyObject_VAR_HEAD Py_hash_t ob_shash; char ob_sval; } PyBytesObject; #define PyBytes_AS_STRING(op) (assert(PyBytes_Check(op)), \ &(((PyBytesObject *)(op))->ob_sval)

[issue40343] Programming FAQ about "How do I call a method defined in a base class from a derived class that overrides it?" should mention the no-arguments-version of `super`

2020-04-20 Thread Dominik V.
New submission from Dominik V. : Right now it contains the following example: class Derived(Base): def meth(self): super(Derived, self).meth() `super()` without arguments is beneficial for multiple reasons, so it should be used in the example. Also the paragraph speak

[issue40342] Programming FAQ about "How do I apply a method to a sequence of objects?" should include the option of an explicit for-loop

2020-04-20 Thread Raymond Hettinger
Raymond Hettinger added the comment: The current answer seems reasonable to me. It addresses the question that most people want to have answered. Also, it isn't common to loop over methods that don't return values, because those typically do in-place mutations. -- nosy: +rhettinger

[issue39939] PEP 616: Add str methods to remove prefix or suffix

2020-04-20 Thread Raymond Hettinger
Raymond Hettinger added the comment: Please add an underscore to the names: remove_prefix(). and remove_suffix(). The latter method causes a mental hiccup when first reading as removes-uffix, forcing mental backtracking to get to remove-suffix. We had a similar problem with addinfourl initi

[issue40344] Programming FAQ about "What is the most efficient way to concatenate many strings together?" -- Improving the example

2020-04-20 Thread Dominik V.
New submission from Dominik V. : The section mentions the usage of `str.join` and contains the following example: chunks = [] for s in my_strings: chunks.append(s) result = ''.join(chunks) Since `join` accepts any iterable the creation of the `chunks` list in a for loop is

[issue40344] Programming FAQ about "What is the most efficient way to concatenate many strings together?" -- Improving the example

2020-04-20 Thread Dominik V.
Dominik V. added the comment: Here's the link to the relevant section: https://docs.python.org/3/faq/programming.html#what-is-the-most-efficient-way-to-concatenate-many-strings-together -- ___ Python tracker __

[issue40345] Programming FAQ about "How do I iterate over a sequence in reverse order?" should be more precise about `reversed`

2020-04-20 Thread Dominik V.
New submission from Dominik V. : https://docs.python.org/3/faq/programming.html#how-do-i-iterate-over-a-sequence-in-reverse-order It contains the following example: for x in reversed(sequence): ... # do something with x ... With the note: > This won’t touch your original sequence

[issue39939] PEP 616: Add str methods to remove prefix or suffix

2020-04-20 Thread STINNER Victor
STINNER Victor added the comment: > Please add an underscore to the names: remove_prefix(). and remove_suffix(). The PEP 616 was approved with removeprefix() and removesuffix() names. The rationale for the names can be even found in the PEP: https://www.python.org/dev/peps/pep-0616/#alternat

[issue40344] Programming FAQ about "What is the most efficient way to concatenate many strings together?" -- Improving the example

2020-04-20 Thread Raymond Hettinger
Raymond Hettinger added the comment: Dominik, can you please limit your tracker issues to a handful on entries that you really care about? This is turning into a stream of consciousness dump onto our tracker. You really don't need to rewrite every entry you see, especially when we haven't

[issue40346] Redesign random.Random class inheritance

2020-04-20 Thread STINNER Victor
Change by STINNER Victor : -- title: Redesign random class inheritance -> Redesign random.Random class inheritance ___ Python tracker ___ _

  1   2   >