[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

[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

[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

[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

[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

[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

[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

[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 ___

[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

[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

[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

[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 ___

[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

[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

[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:

[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

[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 ___

[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 ___ ___

[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 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

[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

[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:

[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

[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

[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

[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') == >

[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 --

[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 ___

[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

[issue40312] Weakref callbacks running before finalizers in GC collection

2020-04-20 Thread Tim Peters
Tim Peters added the comment: A simple (finalizer-only) example of what an SCC-based DAG topsort ordering would accomplish: import gc class C: def __init__(self, val): self.val = val def __del__(self): print("finalizing", self.val) c, b,

[issue40346] Redesign random.Random class inheritance

2020-04-20 Thread Antoine Pitrou
Change by Antoine Pitrou : -- keywords: +patch nosy: +pitrou nosy_count: 1.0 -> 2.0 pull_requests: +18957 stage: -> patch review pull_request: https://github.com/python/cpython/pull/19539 ___ Python tracker

[issue40347] Programming FAQ about "How do you remove duplicates from a list?" -- Improve the examples + Mention possible caveats

2020-04-20 Thread Dominik V.
New submission from Dominik V. : https://docs.python.org/3/faq/programming.html#how-do-you-remove-duplicates-from-a-list In the beginning it points to the recipes at https://code.activestate.com/recipes/52560/ which does mention various caveats such as > [...] whether [elements are]

[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: Your contributions are welcome. -- ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue40335] Regression in multiline SyntaxError offsets

2020-04-20 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: New changeset 11a7f158ef51b0edcde3c3d9215172354e385877 by Pablo Galindo in branch 'master': bpo-40335: Correctly handle multi-line strings in tokenize error scenarios (GH-19619)

[issue40335] Regression in multiline SyntaxError offsets

2020-04-20 Thread Pablo Galindo Salgado
Change by Pablo Galindo Salgado : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___

[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

[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

[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:

[issue40348] Programming FAQ about "What is delegation?": Fix typos

2020-04-20 Thread Dominik V.
New submission from Dominik V. : https://docs.python.org/3/faq/programming.html#what-is-delegation The code example uses `self._outfile` with a single leading underscore, however in the subsequent text it is referred to with a double leading underscore: * [...] calling the underlying

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

2020-04-20 Thread Raymond Hettinger
Raymond Hettinger added the comment: I disagree with the rationale given in the PEP. The reason that "startswith" and "endswith" don't have underscores is that the aren't needed to disambiguate the text. Our rules are to add underscores when it improves readability, which in this case it

[issue40346] Redesign random.Random class inheritance

2020-04-20 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +18958 pull_request: https://github.com/python/cpython/pull/19631 ___ Python tracker ___

[issue40313] bytes.hex(sep, bytes_per_sep) is many times slower than manually inserting the separators

2020-04-20 Thread miss-islington
miss-islington added the comment: New changeset 6a9e80a93148b13e4d3bceaab5ea1804ab0e64d5 by sweeneyde in branch 'master': bpo-40313: speed up bytes.hex() (GH-19594) https://github.com/python/cpython/commit/6a9e80a93148b13e4d3bceaab5ea1804ab0e64d5 -- nosy: +miss-islington

[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 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

[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

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

2020-04-20 Thread STINNER Victor
STINNER Victor added the comment: I created bpo-40346: "Redesign random.Random class inheritance". -- ___ Python tracker ___ ___

[issue40346] Redesign random class inheritance

2020-04-20 Thread STINNER Victor
New submission from STINNER Victor : The random.Random class has a strange inheritance which is something uncommon in Python: it inherits from _random.Random which a concrete Mersenne Twister PRNG. When a class inherit it, like random.SystemRandom, it should carefully override the right

[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 ___

[issue40346] Redesign random.Random class inheritance

2020-04-20 Thread STINNER Victor
STINNER Victor added the comment: Attached PR 19631 adds random.BaseRandom. random.SystemRandom now inherits from BaseRandom and so no longer inherits from _random.Random: an instance now only takes 48 bytes of memory, rather than 2568 bytes (on x86-64). --

[issue40346] Redesign random.Random class inheritance

2020-04-20 Thread Raymond Hettinger
Raymond Hettinger added the comment: Having SystemRandom() use less memory is nice. The seed() logic is reusable (not MT specific) and should be kept. Historically, subclassers were supposed to supply random(), and the getrandbits() method was optional and just added greater range to

[issue40346] Redesign random.Random class inheritance

2020-04-20 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: -18957 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[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

[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("

[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

[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:

[issue40346] Redesign random.Random class inheritance

2020-04-20 Thread Raymond Hettinger
Raymond Hettinger added the comment: The randbytes() method could have been added effortlessly as a one line pure python method. It only became complicated as a result of premature optimization into C code and as a result of ignoring the API promises. You really don't have to redesign the

[issue40313] bytes.hex(sep, bytes_per_sep) is many times slower than manually inserting the separators

2020-04-20 Thread STINNER Victor
STINNER Victor added the comment: Thanks Dennis for the optimization! FYI I also pushed another optimization recently: commit 455df9779873b8335b20292b8d0c43d66338a4db Author: Victor Stinner Date: Wed Apr 15 14:05:24 2020 +0200 Optimize _Py_strhex_impl() (GH-19535) Avoid a

[issue39933] test_gdb fails on AMD64 FreeBSD Shared 3.x: ptrace: Operation not permitted

2020-04-20 Thread STINNER Victor
STINNER Victor added the comment: AMD64 FreeBSD Shared 3.x is green again, I close the issue. -- resolution: -> fixed stage: -> resolved status: open -> closed ___ 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

[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

[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

[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: It was not my intention to disturb the traffic on the bug tracker. My apologies if that caused any trouble. I also thought only people subscribed to the indicated topic (e.g. "Documentation") would receive a notification. The docs pages mention that for

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

2020-04-20 Thread Andy Lester
Change by Andy Lester : -- nosy: +petdance ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue40313] bytes.hex(sep, bytes_per_sep) is many times slower than manually inserting the separators

2020-04-20 Thread Gregory P. Smith
Change by Gregory P. Smith : -- assignee: -> gregory.p.smith ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue39954] test_subprocess: test_specific_shell() fails on AMD64 FreeBSD Shared 3.x

2020-04-20 Thread STINNER Victor
STINNER Victor added the comment: AMD64 FreeBSD Shared 3.x is green again, I close the issue. -- resolution: -> fixed stage: -> resolved status: open -> closed ___ Python tracker

[issue40089] Add _at_fork_reinit() method to locks

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

[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

[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

[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

[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

[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

[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

[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 Vedran Čačić
Vedran Čačić added the comment: I must say I agree with Dominik here. Too many times my students write list comprehensions when they mean a for loop. It's not just a "has result vs updates inplace" dichotomy: often it produces some output like a drawing or just a print() call [one of rare

[issue40349] Python3.9 changes col_offset for some ast nodes

2020-04-20 Thread Shantanu
New submission from Shantanu : With Python 3.8: ``` Python 3.8.1 (default, Jan 23 2020, 23:36:06) [Clang 11.0.0 (clang-1100.0.33.17)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import ast >>> ast.parse("(a).x").body[0].value.col_offset 1 ``` With

[issue40349] Python3.9 changes col_offset for some ast nodes

2020-04-20 Thread Karthikeyan Singaravelan
Change by Karthikeyan Singaravelan : -- nosy: +BTaskaya, pablogsal ___ Python tracker ___ ___ Python-bugs-list mailing list

[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

[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 ___ ___

[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

[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

[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:

[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

[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.

[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

[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

[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

[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

[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

[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
Change by Serhiy Storchaka : -- keywords: +patch pull_requests: +18950 stage: -> patch review pull_request: https://github.com/python/cpython/pull/19620 ___ Python tracker

[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.

[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

[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

[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

[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

  1   2   >