[issue46726] Thread spuriously marked dead after interrupting a join call

2022-02-13 Thread Eryk Sun
Eryk Sun added the comment: > is there a bulletproof way to guarantee that `self._stop()` gets > called if the acquire_and_release() succeeds? I don't think it's critical. But we still should deal with the common case in Windows in which a KeyboardInterrupt is raised immediately after the

[issue46737] Default to the standard normal distribution

2022-02-13 Thread Mark Dickinson
Mark Dickinson added the comment: +1 -- nosy: +mark.dickinson ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue46615] Use-after-free by mutating set during set operations

2022-02-13 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset c31b8a97a8a7e8255231c9e12ed581c6240c0d6c by Dennis Sweeney in branch '3.9': bpo-46615: Don't crash when set operations mutate the sets (GH-31120) (GH-31312) https://github.com/python/cpython/commit/c31b8a97a8a7e8255231c9e12ed581c6240c0d6c

[issue46615] Use-after-free by mutating set during set operations

2022-02-13 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Thanks Dennis for your report and PRs. Do you mind to analyze also uses of _PySet_NextEntry(), PyDict_Next() and _PyDict_Next()? Many of them look safe, but _pickle.c seems vulnerable. -- ___ Python tracker

[issue46738] Allow http.server to emit HTML 5

2022-02-13 Thread Tzu-ping Chung
New submission from Tzu-ping Chung : Currently, a directory listing page emitted by http.parser uses the HTML 4.01 doctype. While this is perfectly fine for most uses, the server tool is sometimes used for things that require another doctype; PEP 503[1], for example, requires an HTML 5

[issue39805] Copying functions doesn't actually copy them

2022-02-13 Thread Steven D'Aprano
Steven D'Aprano added the comment: If we can't change the default behaviour of copying functions, can we add a specialised copy_function() function, for when we really need to make a genuine copy? -- ___ Python tracker

[issue46737] Default to the standard normal distribution

2022-02-13 Thread Raymond Hettinger
New submission from Raymond Hettinger : This is really minor, but it would convenient if we provided default arguments: random.gauss(mu=0.0, sigma=1.0) random.normalvariate(mu=0.0, sigma=1.0) -- components: Library (Lib) messages: 413177 nosy: rhettinger priority: normal

[issue39805] Copying functions doesn't actually copy them

2022-02-13 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: It is by design. Functions and types are pickled by name. The copy module uses the pickling protocol and only use different methods for performance or for non-pickleable objects. Changing this will break existing code. -- nosy: +serhiy.storchaka

[issue39805] Copying functions doesn't actually copy them

2022-02-13 Thread Numerlor
Numerlor added the comment: Having copy be an identity function for anything mutable seems very bug prone, even if it's functions. If not changed in the copy interface I would say that at least a warning would be helpful. -- ___ Python tracker

[issue46622] Support decorating a coroutine with functools.cached_property

2022-02-13 Thread Tzu-ping Chung
Change by Tzu-ping Chung : -- keywords: +patch pull_requests: +29476 stage: -> patch review pull_request: https://github.com/python/cpython/pull/31314 ___ Python tracker ___

[issue46586] In documentation contents enum.property erroneously links to built-in property

2022-02-13 Thread Meer Suri
Meer Suri added the comment: Thanks Jelle for the cool idea of the script to look for more instances of this problem. I've been working on this script and am still refining it, but one of the candidates that my program returned is in zipfile.rst -

[issue46716] regrtest didn't respect the timeout when running test_subprocess on AMD64 Windows11 3.x

2022-02-13 Thread Eryk Sun
Eryk Sun added the comment: > the fix should be as simple as coercing the timeout values to >= 0. Popen._remaining_time() should return max(endtime - _time(), 0). Popen._wait() should raise OverflowError if the timeout is too large for the implementation. In Windows, the upper limit in

[issue46736] Generate HTML 5 with SimpleHTTPRequestHandler.list_directory

2022-02-13 Thread Dominic Davis-Foster
New submission from Dominic Davis-Foster : Currently SimpleHTTPRequestHandler.list_directory (which is used with `python3 -m http.server` amongst other things) generates HTML with the doctype: http://www.w3.org/TR/html4/strict.dtd;> i.e. HTML 4.01. I propose making the generated page

[issue46735] gettext.translations crashes when locale is unset

2022-02-13 Thread Pablo Galindo Salgado
Change by Pablo Galindo Salgado : -- nosy: -pablogsal ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue46586] In documentation contents enum.property erroneously links to built-in property

2022-02-13 Thread Meer Suri
Meer Suri added the comment: Also this one?- https://docs.python.org/3.11/library/urllib.request.html?highlight=urllib%20request#urllib.request.OpenerDirector.open Arguments, return values and exceptions raised are the same as those of urlopen() (which simply calls the open() method on the

[issue46586] In documentation contents enum.property erroneously links to built-in property

2022-02-13 Thread Meer Suri
Meer Suri added the comment: Looks like another one - https://docs.python.org/3.11/library/fileinput.html#fileinput.hook_encoded Deprecated since version 3.10: This function is deprecated since input() and FileInput now have encoding and errors parameters. The input() here points to

[issue43464] set intersections should short-circuit

2022-02-13 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: See also issue46721. set.issuperset() can get similar optimization. And set.issubset() will benefit from this optimization if use set.intersection() in issue46705. -- keywords: -patch stage: patch review ->

[issue45976] Random._randbelow() loses time by caching an attribute lookup

2022-02-13 Thread Raymond Hettinger
Raymond Hettinger added the comment: I'm thinking that we care more about the unhappy cases (the extreme values) than we care about a mild and implementation dependent improvement to the average case. -- resolution: later -> rejected ___ Python

[issue46733] pathlib.Path methods can raise NotImplementedError

2022-02-13 Thread Éric Araujo
Change by Éric Araujo : -- nosy: +eric.araujo, pitrou, serhiy.storchaka ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue46716] regrtest didn't respect the timeout when running test_subprocess on AMD64 Windows11 3.x

2022-02-13 Thread Jeremy Kloth
Jeremy Kloth added the comment: > > the fix should be as simple as coercing the timeout values to >= 0. > > Popen._remaining_time() should return max(endtime - _time(), 0). That was my first initial instinct as well, however, that change would also affect more of the Popen behavior and need a

[issue46705] Memory optimization for set.issubset

2022-02-13 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: It will be even more efficient after applying a set.intersection() optimization in issue43464. -- ___ Python tracker ___

[issue46743] Enable usage of object.__orig_class__ in __init__

2022-02-13 Thread Gobot1234
Gobot1234 added the comment: Currently I have code that uses the generic argument to a class as the constructor for its `items` https://github.com/Gobot1234/steam.py/blob/f99cb77d58b552f1d493663e7b3455f94977347e/steam/trade.py#L380. As this is called from `BaseInventory.__init__` it

[issue43464] set intersections should short-circuit

2022-02-13 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- keywords: +patch nosy: +serhiy.storchaka nosy_count: 2.0 -> 3.0 pull_requests: +29477 stage: -> patch review pull_request: https://github.com/python/cpython/pull/31316 ___ Python tracker

[issue46744] installers on ARM64 suggest wrong folders

2022-02-13 Thread conio
New submission from conio : Thank you for your work on bringing Python to Windows on ARM64. I recently installed it an noticed some strange behaviours. On ARM64 Windows 11 the recent prerelease (3.11.0a5, post #33125) acts in a way I believe is wrong: Checking the _install for all users_

[issue46743] Enable usage of object.__orig_class__ in __init__

2022-02-13 Thread Gobot1234
New submission from Gobot1234 : When using `__call__` on a `typing/types.GenericAlias` `__orig_class__` is set to the `GenericAlias` instance, however currently the mechanism for this does not allow the `__origin__` to access the `GenericAlias` from `__origin__.__init__` as it performs

[issue46743] Enable usage of object.__orig_class__ in __init__

2022-02-13 Thread Guido van Rossum
Guido van Rossum added the comment: In the early days the design and implementation were changed so many times, your question (why was it changed) is unanswerable. I do not actually understand your description of your problem -- you mention so many dunders that it obscures your use case.

[issue46739] dataclasses __eq__ isn't logical

2022-02-13 Thread Eric V. Smith
Eric V. Smith added the comment: I agree with Mark. It's identical to: >>> () == () True As for the non-dataclass version, that's a normal object identity comparison if no __eq__ is defined: https://docs.python.org/3/reference/datamodel.html#object.__eq__ , third paragraph. --

[issue46726] Thread spuriously marked dead after interrupting a join call

2022-02-13 Thread Tim Peters
Tim Peters added the comment: >> is there a bulletproof way to guarantee that `self._stop()` gets >> called if the acquire_and_release() succeeds? > I don't think it's critical. Agreed! Anything at the Python level that cares whether the thread is still alive will call

[issue46739] dataclasses __eq__ isn't logical

2022-02-13 Thread Eric V. Smith
Change by Eric V. Smith : -- assignee: -> eric.smith ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue46742] Add '-d $fd' option to trace module, akin to bash -x feature

2022-02-13 Thread Charles Howes
Change by Charles Howes : -- keywords: +patch pull_requests: +29478 stage: -> patch review pull_request: https://github.com/python/cpython/pull/31319 ___ Python tracker ___

[issue46622] Support decorating a coroutine with functools.cached_property

2022-02-13 Thread Andrew Svetlov
Andrew Svetlov added the comment: I have a design question. Does `print(await a.hello)` look awkward? I'm not speaking about correction. In asyncio code I have seen before, `await val` means waiting for a future object. `await func()` means async function call. `await obj.attr` looks more

[issue46739] dataclasses __eq__ isn't logical

2022-02-13 Thread Craig Coleman
New submission from Craig Coleman : In a test, dataclasses generate an __eq__ function appears to be wrong. @dataclass class C: pass class K: pass a = C() b = C() c = K() d = K() (a is b) # False (a == b) # True # Incorrect, Why? (c is d) # False (c == d) # False # Correct

[issue46739] dataclasses __eq__ isn't logical

2022-02-13 Thread Alex Waygood
Change by Alex Waygood : -- nosy: +eric.smith ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue46739] dataclasses __eq__ isn't logical

2022-02-13 Thread Mark Dickinson
Mark Dickinson added the comment: Can you explain why you think the result of `a == b` should be `False` rather than `True`? By default, equality for dataclasses is structural equality, and `True` is the result that I'd expect here. >From the

[issue46740] Improve Telnetlib's throughput

2022-02-13 Thread Martin Kirchgessner
New submission from Martin Kirchgessner : While using `telnetlib` I sometimes received unusually "large" messages (around 1Mb) from another process on the same machine, and was surprised `read_until` took more than a second. After instrumenting I discovered such messages were received at

[issue46741] Docstring for asyncio.protocols.BufferedProtocol appears out of date

2022-02-13 Thread Alex Waygood
New submission from Alex Waygood : The docstring for asyncio.protocols.BufferedProtocol includes this paragraph: """ Important: this has been added to asyncio in Python 3.7 *on a provisional basis*! Consider it as an experimental API that might be changed or removed in Python 3.8. """ The

[issue46742] Add '-d $fd' option to trace module, akin to bash -x feature

2022-02-13 Thread Charles Howes
New submission from Charles Howes : The 'trace' module logs trace output to stdout, intermingled with regular program output. This is a problem when you want to read either the trace output or the normal output of the program separately. To separate the trace output, it could be written to

[issue46743] Enable usage of object.__orig_class__ in __init__

2022-02-13 Thread Guido van Rossum
Guido van Rossum added the comment: Thanks for the small example, I understand what you are trying to do now. I don't think it's possible in general, since you are blindly instantiating the type (self.__orig_class__.__args__[0]) without arguments. That doesn't work for all types. But that

[issue45447] Make IDLE recognize .pyi stub files as source for open, save, and edit

2022-02-13 Thread Terry J. Reedy
Terry J. Reedy added the comment: Issue 46746 is the followup for browsers (currently restricted to .py files) and anything else. -- title: Make IDLE recognize .pyi stub files (and .pyw) as python source -> Make IDLE recognize .pyi stub files as source for open, save, and edit

[issue46726] Thread spuriously marked dead after interrupting a join call

2022-02-13 Thread Eryk Sun
Eryk Sun added the comment: > Anything at the Python level that cares whether the thread is > still alive will call _wait_for_tstate_lock() again It's nice that _maintain_shutdown_locks() gets called in _stop(), but the more important call site is in _set_tstate_lock(). I typed up the

[issue46735] gettext.translations crashes when locale is unset

2022-02-13 Thread Eric V. Smith
Change by Eric V. Smith : -- components: +Library (Lib) -Parser type: crash -> behavior ___ Python tracker ___ ___ Python-bugs-list

[issue46743] Enable usage of object.__orig_class__ in __init__

2022-02-13 Thread Mehdi2277
Mehdi2277 added the comment: Hmm, I actually have code that does something very similar to that. But it does not set it in `__init__` and instead uses it in a property where it is available. Tweaking your code, ```py class DefaultBox(Generic[T]): def __init__(self, value: T | None =

[issue46743] Enable usage of object.__orig_class__ in __init__

2022-02-13 Thread Guido van Rossum
Guido van Rossum added the comment: I'm sorry, that's not a small example that I can follow, and I have no idea why you are doing all those things. I fear that if you cannot be more articulate this will remain unfixed. -- ___ Python tracker

[issue46743] Enable usage of object.__orig_class__ in __init__

2022-02-13 Thread Jelle Zijlstra
Change by Jelle Zijlstra : -- nosy: +Jelle Zijlstra ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue46740] Improve Telnetlib's throughput

2022-02-13 Thread Jelle Zijlstra
Jelle Zijlstra added the comment: Note that telnetlib is being proposed for deprecation in PEP 594. You may be better off using a third-party telnet implementation; the PEP lists https://pypi.org/project/telnetlib3/ and https://pypi.org/project/Exscript/. -- nosy: +Jelle Zijlstra

[issue46746] IDLE: Consistently handle non .py source files

2022-02-13 Thread Terry J. Reedy
New submission from Terry J. Reedy : Python will attempt to execute any file it can decode to unicode text as a startup script. It will only import .py files as a module. #45447 turned on syntax coloring for .pyi stub files. (.pyw files and files starting with "!#.*python" were already

[issue46726] Thread spuriously marked dead after interrupting a join call

2022-02-13 Thread Tim Peters
Tim Peters added the comment: > It's nice that _maintain_shutdown_locks() gets > called in _stop(), but the more important call site is in > _set_tstate_lock(). I didn't have that in mind at all. What at the Python level cares whether the thread is alive? Well. is_alive() does, and it calls

[issue46743] Enable usage of object.__orig_class__ in __init__

2022-02-13 Thread Alex Waygood
Change by Alex Waygood : -- nosy: +AlexWaygood ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue46747] bisect.bisect/insort don't document key parameter

2022-02-13 Thread Stefan Pochmann
New submission from Stefan Pochmann : The signatures for the versions without "_right" suffix are missing the key parameter: bisect.bisect_right(a, x, lo=0, hi=len(a), *, key=None) bisect.bisect(a, x, lo=0, hi=len(a))¶ bisect.insort_right(a, x, lo=0, hi=len(a), *, key=None) bisect.insort(a,

[issue46743] Enable usage of object.__orig_class__ in __init__

2022-02-13 Thread Gobot1234
Gobot1234 added the comment: ```py class DefaultBox(Generic[T]): def __init__(self, value: T | None = None): self.value = ( value if value is not None else # the arg self.__orig_class__.__args__[0]() # or the default for the type argument )

[issue46726] Thread spuriously marked dead after interrupting a join call

2022-02-13 Thread Eryk Sun
Eryk Sun added the comment: > I didn't have that in mind at all. I understood what you had in mind, and I don't disagree. I was just highlighting that the only somewhat important work done in _stop() is to clean up the _shutdown_locks set, to keep it from growing too large. But that task is

[issue46745] Typo in new PositionsIterator

2022-02-13 Thread Robert-André Mauchin
New submission from Robert-André Mauchin : In Objects/codeobject.c, poisitions_iterator should read positions_iterator -- components: C API messages: 413209 nosy: eclipseo priority: normal pull_requests: 29479 severity: normal status: open title: Typo in new PositionsIterator versions: