[issue42945] weakref.finalize documentation contradicts itself RE: finalizer callback or args referencing object

2021-01-16 Thread Ryan Heisler
Ryan Heisler added the comment: Perfect, thanks for your quick response. I was passing a bound method of obj as the func to `weakref.finalize(obj, func, /, *args, **kwargs)`. It slipped my mind that an instance variable like self.name and a bound method like self.clean_up, though they both

[issue42945] weakref.finalize documentation contradicts itself RE: finalizer callback or args referencing object

2021-01-16 Thread Tim Peters
Tim Peters added the comment: Not a problem. Arguments to a function are evaluated before the function is invoked. So in self._finalizer = weakref.finalize(self, shutil.rmtree, self.name) self.name is evaluated before weakref.finalize is called(). `self.name` _extracts_ the `.name`

[issue42945] weakref.finalize documentation contradicts itself RE: finalizer callback or args referencing object

2021-01-16 Thread Ryan Heisler
New submission from Ryan Heisler : In the documentation for `weakref.finalize` (https://docs.python.org/3.9/library/weakref.html#weakref.finalize), it says: "Note It is important to ensure that func, args and kwargs do not own any references to obj, either directly or indirectly, since

[issue32509] doctest syntax ambiguity between continuation line and ellipsis

2021-01-16 Thread Jason R. Coombs
Jason R. Coombs added the comment: I've encountered this issue again with a different use-case. I'm attempting to add a doctest to a routine that emits the paths of the files it processes. I want to use ellipses to ignore the prefixes of the output because they're not pertinent to the test.

[issue42944] random.Random.sample bug when counts is not None

2021-01-16 Thread Raymond Hettinger
Raymond Hettinger added the comment: Would you like to submit a PR for this? -- ___ Python tracker ___ ___ Python-bugs-list

[issue42944] random.Random.sample bug when counts is not None

2021-01-16 Thread Raymond Hettinger
Change by Raymond Hettinger : -- assignee: -> rhettinger ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue42944] random.Random.sample bug when counts is not None

2021-01-16 Thread Jon FRANCO
New submission from Jon FRANCO : Hello, If I am reading right, random.Random.sample method has a bug if counts is not None. Line 482 (of master): """ selections = sample(range(total), k=k) """ this is calling the module function 'sample' and not the instance method. IMO this

[issue42943] singledispatchmethod should expose registry of all known overloads

2021-01-16 Thread Ilya Kulakov
New submission from Ilya Kulakov : The wrapper created by singledispatchmethod does not (trivially) expose registry of all known overloads. Consider the following example: @singledispatchmethod def on_message(message): raise NotImplementedError @on_message.register

[issue42942] Feature request: Add decdigest() to hashlib

2021-01-16 Thread Arnim Rupp
New submission from Arnim Rupp : Problem: hashlib only offers digest() and hexdigest() but the fastest way to work with hashes is as integer. The first thing loki does after getting the hashes is to convert them to int: md5, sha1, sha256 = generateHashes(fileData)

[issue42885] Optimize re.search() for \A (and maybe ^)

2021-01-16 Thread Arnim Rupp
Change by Arnim Rupp : -- components: +Regular Expressions -Library (Lib) nosy: +ezio.melotti, mrabarnett ___ Python tracker ___

[issue42935] Pickle can't import builtins at exit

2021-01-16 Thread Christian Heimes
Christian Heimes added the comment: At the end of a Python process, the interpreter is shut down in multiple steps. Object finalizers such as __del__ may be executed late in the interpreter shut down process. In your case, most of the interpreter is already gone. There isn't anything we can

[issue42659] Objects of uname_result Class Cannot be Successfully Pickled

2021-01-16 Thread Jason R. Coombs
Change by Jason R. Coombs : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed versions: +Python 3.10 ___ Python tracker ___

[issue42189] copy.deepcopy() no longer works on platform.uname_result objects

2021-01-16 Thread Jason R. Coombs
Change by Jason R. Coombs : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___

[issue42163] _replace() no longer works on platform.uname_result objects

2021-01-16 Thread Jason R. Coombs
Change by Jason R. Coombs : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___

[issue42189] copy.deepcopy() no longer works on platform.uname_result objects

2021-01-16 Thread Jason R. Coombs
Jason R. Coombs added the comment: New changeset 799722cb0ddb90752cde7798cab543f30623ebf2 by Jason R. Coombs in branch '3.9': [3.9] bpo-42163, bpo-42189, bpo-42659: Support uname_tuple._replace (for all but processor) (GH-23010) (#24232)

[issue42163] _replace() no longer works on platform.uname_result objects

2021-01-16 Thread Jason R. Coombs
Jason R. Coombs added the comment: New changeset 799722cb0ddb90752cde7798cab543f30623ebf2 by Jason R. Coombs in branch '3.9': [3.9] bpo-42163, bpo-42189, bpo-42659: Support uname_tuple._replace (for all but processor) (GH-23010) (#24232)

[issue42659] Objects of uname_result Class Cannot be Successfully Pickled

2021-01-16 Thread Jason R. Coombs
Jason R. Coombs added the comment: New changeset 799722cb0ddb90752cde7798cab543f30623ebf2 by Jason R. Coombs in branch '3.9': [3.9] bpo-42163, bpo-42189, bpo-42659: Support uname_tuple._replace (for all but processor) (GH-23010) (#24232)

[issue42189] copy.deepcopy() no longer works on platform.uname_result objects

2021-01-16 Thread Jason R. Coombs
Change by Jason R. Coombs : -- pull_requests: +23056 pull_request: https://github.com/python/cpython/pull/24232 ___ Python tracker ___

[issue42659] Objects of uname_result Class Cannot be Successfully Pickled

2021-01-16 Thread Jason R. Coombs
Change by Jason R. Coombs : -- pull_requests: +23057 pull_request: https://github.com/python/cpython/pull/24232 ___ Python tracker ___

[issue42163] _replace() no longer works on platform.uname_result objects

2021-01-16 Thread Jason R. Coombs
Change by Jason R. Coombs : -- pull_requests: +23055 pull_request: https://github.com/python/cpython/pull/24232 ___ Python tracker ___

[issue33809] Expose `capture_locals` parameter in `traceback` convenience functions

2021-01-16 Thread Irit Katriel
Change by Irit Katriel : -- keywords: +patch pull_requests: +23054 stage: -> patch review pull_request: https://github.com/python/cpython/pull/24231 ___ Python tracker ___

[issue42531] importlib.resources.path() raises TypeError for packages without __file__

2021-01-16 Thread Jason R. Coombs
Change by Jason R. Coombs : -- versions: -Python 3.7 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue42941] Infinite loop in asyncio sslproto

2021-01-16 Thread Roundup Robot
Change by Roundup Robot : -- keywords: +patch nosy: +python-dev nosy_count: 3.0 -> 4.0 pull_requests: +23053 stage: -> patch review pull_request: https://github.com/python/cpython/pull/24230 ___ Python tracker

[issue42531] importlib.resources.path() raises TypeError for packages without __file__

2021-01-16 Thread Jason R. Coombs
Change by Jason R. Coombs : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___

[issue42531] importlib.resources.path() raises TypeError for packages without __file__

2021-01-16 Thread miss-islington
Change by miss-islington : -- pull_requests: +23052 pull_request: https://github.com/python/cpython/pull/24229 ___ Python tracker ___

[issue42531] importlib.resources.path() raises TypeError for packages without __file__

2021-01-16 Thread miss-islington
miss-islington added the comment: New changeset f08c66467d56c71f75c6659ede9177449fe9d2e6 by William Schwartz in branch '3.8': [3.8] bpo-42531: Teach importlib.resources.path to handle packages without __file__ (GH-23611)

[issue42941] Infinite loop in asyncio sslproto

2021-01-16 Thread Hingyuen Lam
New submission from Hingyuen Lam : There is an infinite loop in feed_appdata() of sslproto.py. The OpenSSL documents said when some fatal I/O error occurred, SSL_ERROR_SYSCALL is returned and no further I/O operations should be performed. This error is ignored in the exception handling of

[issue42940] Incorrect behavior of inspect.signature(f).bind

2021-01-16 Thread Slava Kostrov
New submission from Slava Kostrov : >>> def foo(a, /, b=1, **kwargs): pass ... >>> foo(a=1) Traceback (most recent call last): File "", line 1, in TypeError: foo() missing 1 required positional argument: 'a' >>> inspect.signature(foo).bind(a=1) Traceback (most recent call last): File "",

[issue42885] Optimize re.search() for \A (and maybe ^)

2021-01-16 Thread Arnim Rupp
Arnim Rupp added the comment: some more observations, which might be helpful in tracking it down: x$ is much faster than ^x A$ is as slow as ^x $ python3 -m timeit -s "a = 'A'*1" "import re" "re.search('x$', a)" 10 loops, best of 5: 32.9 msec per loop $ python3 -m timeit -s "a =

[issue42939] Linux's chattr i.e. ioctl(FS_IOC_SETFLAGS) is not supported in os.chflags()

2021-01-16 Thread Марк Коренберг
New submission from Марк Коренберг : https://man7.org/linux/man-pages/man2/ioctl_iflags.2.html Seems the ioctl is only way to implement chattr(). I propose to add all these flags to os.chflags() and to gain its support in Linux. -- components: Library (Lib) messages: 385141 nosy:

[issue42935] Pickle can't import builtins at exit

2021-01-16 Thread Pete Wicken
Pete Wicken added the comment: Out of curiosity, why is there not much we can do? I'm not familiar enough with Python's C code to appreciate the difficulty of making the builtins available at the point where the pickle save is run when exiting. The fact that this segfaults in the 3.8

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

2021-01-16 Thread Ross Rhodes
Ross Rhodes added the comment: Hello Charles, Following the format provided, I've opened a PR to implement your proposal. Feedback welcome. -- ___ Python tracker ___

[issue42643] http.server does not support HTTP range requests

2021-01-16 Thread David Bordeynik
Change by David Bordeynik : -- keywords: +patch nosy: +DavidBord nosy_count: 2.0 -> 3.0 pull_requests: +23051 stage: -> patch review pull_request: https://github.com/python/cpython/pull/24228 ___ Python tracker

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

2021-01-16 Thread Ross Rhodes
Change by Ross Rhodes : -- keywords: +patch nosy: +trrhodes nosy_count: 2.0 -> 3.0 pull_requests: +23050 stage: needs patch -> patch review pull_request: https://github.com/python/cpython/pull/24227 ___ Python tracker

[issue42885] Optimize re.search() for \A (and maybe ^)

2021-01-16 Thread Steven D'Aprano
Steven D'Aprano added the comment: On Sat, Jan 16, 2021 at 08:59:13AM +, Serhiy Storchaka wrote: > > Serhiy Storchaka added the comment: > > ^ matches not just the beginning of the string. It matches the > beginning of a line, i.e. an anchor just after '\n'. Only in MULTILINE mode. I

[issue7946] Convoy effect with I/O bound threads and New GIL

2021-01-16 Thread Charles-François Natali
Change by Charles-François Natali : -- nosy: -neologix ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue42885] Optimize re.search() for \A (and maybe ^)

2021-01-16 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: ^ matches not just the beginning of the string. It matches the beginning of a line, i.e. an anchor just after '\n'. If the input string contains '\n', the result cannot be found less than by linear time. If you want to check if the beginning of the string

[issue42938] ctypes double representation BoF

2021-01-16 Thread Jordy Zomer
New submission from Jordy Zomer : Hi, There's a buffer overflow in the PyCArg_repr() function in _ctypes/callproc.c. The buffer overflow happens due to not checking the length of th sprintf() function on line: case 'd': sprintf(buffer, "", self->tag,