]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
2 years agogh-92446: Improve argparse choices docs; revert bad change to lzma docs (#94627)
Guy Yagev [Mon, 26 Dec 2022 06:22:53 +0000 (08:22 +0200)] 
gh-92446: Improve argparse choices docs; revert bad change to lzma docs (#94627)

Based on the definition of the collections.abc classes, it is more accurate to use "sequence" instead of "container" when describing argparse choices.

A previous attempt at fixing this in #92450 was mistaken; this PR reverts that change.

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2 years agogh-99308: Clarify re docs for byte pattern group names (#99311)
Ilya Kulakov [Sun, 25 Dec 2022 06:55:27 +0000 (22:55 -0800)] 
gh-99308: Clarify re docs for byte pattern group names (#99311)

2 years agogh-100519: simplification to `eff_request_host` in cookiejar.py (#99588)
Glyph [Sun, 25 Dec 2022 00:14:51 +0000 (16:14 -0800)] 
gh-100519: simplification to `eff_request_host` in cookiejar.py (#99588)

`IPV4_RE` includes a `.`, and the `.find(".") == -1` included here is already testing to make sure there's no dot, so this part of the expression is tautological. Instead use more modern `in` syntax to make it clear what the check is doing here. The simplified implementation more clearly matches the wording in RFC 2965.

Co-authored-by: hauntsaninja <hauntsaninja@gmail.com>
2 years agogh-100472: Fix docs claim that compileall parameters could be bytes (#100473)
Shantanu [Sat, 24 Dec 2022 20:22:49 +0000 (14:22 -0600)] 
gh-100472: Fix docs claim that compileall parameters could be bytes (#100473)

2 years ago[Minor PR] Quotes in documentation changed into code blocks (#99536)
Bart Broere [Sat, 24 Dec 2022 20:17:39 +0000 (21:17 +0100)] 
[Minor PR] Quotes in documentation changed into code blocks (#99536)

Minor formatting fix in documentation

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2 years agogh-100428: Make float documentation more accurate (#100437)
Shantanu [Sat, 24 Dec 2022 20:09:31 +0000 (14:09 -0600)] 
gh-100428: Make float documentation more accurate (#100437)

Previously, the grammar did not accept `float("10")`.
Also implement mdickinson's suggestion of removing the indirection.

2 years agogh-99535: Add test for inheritance of annotations and update documentation (#99990)
MonadChains [Sat, 24 Dec 2022 20:07:14 +0000 (21:07 +0100)] 
gh-99535: Add test for inheritance of annotations and update documentation (#99990)

2 years agogh-100287: Fix unittest.mock.seal with AsyncMock (#100496)
Shantanu [Sat, 24 Dec 2022 19:39:39 +0000 (13:39 -0600)] 
gh-100287: Fix unittest.mock.seal with AsyncMock (#100496)

2 years agogh-100474: Fix handling of dirs named index.html in http.server (GH-100475)
James Frost [Sat, 24 Dec 2022 18:28:59 +0000 (18:28 +0000)] 
gh-100474: Fix handling of dirs named index.html in http.server (GH-100475)

If you had a directory called index.html or index.htm within a directory, it would cause http.server to return a 404 Not Found error instead of the directory listing. This came about due to not checking that the index was a regular file.

I have also added a test case for this situation.

Automerge-Triggered-By: GH:merwok
2 years agogh-99908: Tutorial: Modernize the 'data-record class' example (#100499)
JosephSBoyle [Sat, 24 Dec 2022 15:23:24 +0000 (15:23 +0000)] 
gh-99908: Tutorial: Modernize the 'data-record class' example (#100499)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2 years agoRemove wrong comment about `repr` in `test_unicode` (#100495)
Nikita Sobolev [Sat, 24 Dec 2022 14:48:43 +0000 (17:48 +0300)] 
Remove wrong comment about `repr` in `test_unicode` (#100495)

2 years agogh-100357: Convert several functions in `bltinsmodule` to AC (#100358)
Nikita Sobolev [Sat, 24 Dec 2022 14:45:47 +0000 (17:45 +0300)] 
gh-100357: Convert several functions in `bltinsmodule` to AC (#100358)

2 years agoMisc Itertools recipe tweaks (GH-100493)
Raymond Hettinger [Sat, 24 Dec 2022 08:21:30 +0000 (00:21 -0800)] 
Misc Itertools recipe tweaks (GH-100493)

2 years agoGH-91166: Implement zero copy writes for `SelectorSocketTransport` in asyncio (#31871)
Kumar Aditya [Sat, 24 Dec 2022 05:51:48 +0000 (11:21 +0530)] 
GH-91166: Implement zero copy writes for `SelectorSocketTransport` in asyncio (#31871)

Co-authored-by: Guido van Rossum <gvanrossum@gmail.com>
2 years agoGH-91166: Implement zero copy writes for `SelectorSocketTransport` in asyncio (#31871)
Kumar Aditya [Sat, 24 Dec 2022 05:51:11 +0000 (11:21 +0530)] 
GH-91166: Implement zero copy writes for `SelectorSocketTransport` in asyncio (#31871)

Co-authored-by: Guido van Rossum <gvanrossum@gmail.com>
2 years agogh-77771: Add enterabs example in sched (#92716)
Stanley [Sat, 24 Dec 2022 05:21:52 +0000 (21:21 -0800)] 
gh-77771: Add enterabs example in sched (#92716)

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2 years agogh-100268: Add is_integer method to int (#100439)
Shantanu [Sat, 24 Dec 2022 02:30:27 +0000 (20:30 -0600)] 
gh-100268: Add is_integer method to int (#100439)

This improves the lives of type annotation users of `float` - which type checkers implicitly treat as `int|float` because that is what most code actually wants. Before this change a `.is_integer()` method could not be assumed to exist on things annotated as `: float` due to the method not existing on both types.

2 years agogh-100454: Start running SSL tests with OpenSSL 3.1.0-beta1 (#100456)
Illia Volochii [Sat, 24 Dec 2022 02:04:20 +0000 (04:04 +0200)] 
gh-100454: Start running SSL tests with OpenSSL 3.1.0-beta1 (#100456)

2 years agogh-94808: improve test coverage of number formatting (#99472)
Nikita Sobolev [Sat, 24 Dec 2022 00:03:31 +0000 (03:03 +0300)] 
gh-94808: improve test coverage of number formatting (#99472)

2 years agoAdd "strict" to dotproduct(). Add docstring. Factor-out common code. (GH-100480)
Raymond Hettinger [Fri, 23 Dec 2022 23:52:16 +0000 (15:52 -0800)] 
Add "strict" to dotproduct(). Add docstring. Factor-out common code. (GH-100480)

2 years agogh-99947: Ensure unreported errors are chained for SystemError during import (GH...
Sebastian Berg [Fri, 23 Dec 2022 23:43:19 +0000 (00:43 +0100)] 
gh-99947: Ensure unreported errors are chained for SystemError during import (GH-99946)

2 years agogh-68320, gh-88302 - Allow for private `pathlib.Path` subclassing (GH-31691)
Barney Gale [Fri, 23 Dec 2022 22:52:23 +0000 (22:52 +0000)] 
gh-68320, gh-88302 - Allow for private `pathlib.Path` subclassing (GH-31691)

Users may wish to define subclasses of `pathlib.Path` to add or modify
existing methods. Before this change, attempting to instantiate a subclass
raised an exception like:

    AttributeError: type object 'PPath' has no attribute '_flavour'

Previously the `_flavour` attribute was assigned as follows:

    PurePath._flavour        = xxx not set!! xxx
    PurePosixPath._flavour   = _PosixFlavour()
    PureWindowsPath._flavour = _WindowsFlavour()

This change replaces it with a `_pathmod` attribute, set as follows:

    PurePath._pathmod        = os.path
    PurePosixPath._pathmod   = posixpath
    PureWindowsPath._pathmod = ntpath

Functionality from `_PosixFlavour` and `_WindowsFlavour` is moved into
`PurePath` as underscored-prefixed classmethods. Flavours are removed.

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Brett Cannon <brett@python.org>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Eryk Sun <eryksun@gmail.com>
2 years agoGH-100425: Improve accuracy of builtin sum() for float inputs (GH-100426)
Raymond Hettinger [Fri, 23 Dec 2022 22:35:58 +0000 (14:35 -0800)] 
GH-100425: Improve accuracy of builtin sum() for float inputs (GH-100426)

2 years agobpo-40447: accept all path-like objects in compileall.compile_file (#19883)
Filipe Laíns [Fri, 23 Dec 2022 20:19:16 +0000 (20:19 +0000)] 
bpo-40447: accept all path-like objects in compileall.compile_file (#19883)

Signed-off-by: Filipe Laíns <lains@archlinux.org>
Signed-off-by: Filipe Laíns <lains@riseup.net>
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2 years agogh-99482: remove `jython` compatibility parts from stdlib and tests (#99484)
Nikita Sobolev [Fri, 23 Dec 2022 20:17:24 +0000 (23:17 +0300)] 
gh-99482: remove `jython` compatibility parts from stdlib and tests (#99484)

2 years agogh-83076: 3.8x speed improvement in (Async)Mock instantiation (#100252)
Carl Meyer [Fri, 23 Dec 2022 19:41:37 +0000 (12:41 -0700)] 
gh-83076: 3.8x speed improvement in (Async)Mock instantiation (#100252)

2 years agogh-94155: Reduce hash collisions for code objects (#100183)
Dennis Sweeney [Fri, 23 Dec 2022 18:15:47 +0000 (13:15 -0500)] 
gh-94155: Reduce hash collisions for code objects (#100183)

* Uses a better hashing algorithm to get better dispersion and remove commutativity.

* Incorporates `co_firstlineno`, `Py_SIZE(co)`, and bytecode instructions.

* This is now the entire set of criteria used in `code_richcompare`, except for `_PyCode_ConstantKey` (which would incorporate the types of `co_consts` rather than just their values).

2 years agoRevert "gh-100288: Specialise LOAD_ATTR_METHOD for managed dictionaries (GH-100289...
Ken Jin [Fri, 23 Dec 2022 17:48:43 +0000 (01:48 +0800)] 
Revert "gh-100288: Specialise LOAD_ATTR_METHOD for managed dictionaries (GH-100289)" (#100468)

This reverts commit c3c7848a48b74a321632202e4bdcf2f465fb1cc6.

2 years agogh-100288: Specialise LOAD_ATTR_METHOD for managed dictionaries (GH-100289)
Ken Jin [Fri, 23 Dec 2022 16:26:42 +0000 (00:26 +0800)] 
gh-100288: Specialise LOAD_ATTR_METHOD for managed dictionaries (GH-100289)

2 years agogh-92216: improve performance of `hasattr` for type objects (GH-99979)
Pieter Eendebak [Fri, 23 Dec 2022 15:23:36 +0000 (16:23 +0100)] 
gh-92216: improve performance of `hasattr` for type objects (GH-99979)

2 years agogh-98712: Clarify "readonly bytes-like object" semantics in C arg-parsing docs (...
Petr Viktorin [Fri, 23 Dec 2022 15:00:21 +0000 (16:00 +0100)] 
gh-98712: Clarify "readonly bytes-like object" semantics in C arg-parsing docs (#98710)

2 years agogh-99110: Initialize `frame->previous` in init_frame to fix segmentation fault when...
Bill Fisher [Fri, 23 Dec 2022 14:45:53 +0000 (07:45 -0700)] 
gh-99110: Initialize `frame->previous` in init_frame to fix segmentation fault when accessing `frame.f_back` (#100182)

2 years agoGH-100459: fix copy-paste errors in specialization stats (GH-100460)
Irit Katriel [Fri, 23 Dec 2022 14:42:24 +0000 (14:42 +0000)] 
GH-100459: fix copy-paste errors in specialization stats (GH-100460)

2 years agogh-76963: PEP3118 itemsize of an empty ctypes array should not be 0 (GH-5576)
Eric Wieser [Fri, 23 Dec 2022 08:23:19 +0000 (08:23 +0000)] 
gh-76963: PEP3118 itemsize of an empty ctypes array should not be 0 (GH-5576)

The itemsize returned in a memoryview of a ctypes array is now computed from the item type, instead of dividing the total size by the length and assuming that the length is not zero.

2 years agoFix typo in 3.12 What's New (#100449)
Shantanu [Fri, 23 Dec 2022 06:22:31 +0000 (00:22 -0600)] 
Fix typo in 3.12 What's New (#100449)

2 years agogh-48496: Added example and link to faq for UnboundLocalError in reference (#93068)
Stanley [Thu, 22 Dec 2022 23:23:25 +0000 (15:23 -0800)] 
gh-48496: Added example and link to faq for UnboundLocalError in reference (#93068)

2 years agogh-57762: fix misleading tkinter.Tk docstring (#98837)
Shantanu [Thu, 22 Dec 2022 22:35:32 +0000 (16:35 -0600)] 
gh-57762: fix misleading tkinter.Tk docstring (#98837)

Mentioned as a desired change by terryjreedy on the corresponding issue,
since Tk is not a subclass of Toplevel.

2 years agogh-85432: Harmonise parameter names between C and pure-Python implementations of...
Alex Waygood [Thu, 22 Dec 2022 21:57:18 +0000 (21:57 +0000)] 
gh-85432: Harmonise parameter names between C and pure-Python implementations of `datetime.time.strftime`, `datetime.datetime.fromtimestamp` (#99993)

2 years agoGH-99554: Trim trailing whitespace (GH-100435)
Brandt Bucher [Thu, 22 Dec 2022 20:13:51 +0000 (12:13 -0800)] 
GH-99554: Trim trailing whitespace (GH-100435)

Automerge-Triggered-By: GH:brandtbucher
2 years agogh-100344: Add C implementation for `asyncio.current_task` (#100345)
Itamar Ostricher [Thu, 22 Dec 2022 13:38:12 +0000 (15:38 +0200)] 
gh-100344: Add C implementation for `asyncio.current_task` (#100345)

Co-authored-by: pranavtbhat
2 years agogh-78997: fix bad rebase of moved test file (#100424)
Eli Schwartz [Thu, 22 Dec 2022 13:28:25 +0000 (08:28 -0500)] 
gh-78997: fix bad rebase of moved test file (#100424)

2 years agoGH-99770: Make the correct call specialization fail kind show up in the stats (GH...
penguin_wwy [Thu, 22 Dec 2022 12:44:59 +0000 (20:44 +0800)] 
GH-99770: Make the correct call specialization fail kind show up in the stats (GH-99771)

2 years agogh-99761: Add `_PyLong_IsPositiveSingleDigit` function to check for single digit...
Pieter Eendebak [Thu, 22 Dec 2022 11:30:18 +0000 (12:30 +0100)] 
gh-99761: Add `_PyLong_IsPositiveSingleDigit` function to check for single digit integers  (#100064)

2 years agoCorrect typo in typing.py (#100423)
david-why [Thu, 22 Dec 2022 11:20:52 +0000 (19:20 +0800)] 
Correct typo in typing.py (#100423)

In the docstring of `ParamSpec`, the name of `P = ParamSpec('P')` was
mistakenly written as `'T'`.

2 years agoGH-99554: Pack location tables more effectively (GH-99556)
Brandt Bucher [Thu, 22 Dec 2022 00:41:18 +0000 (16:41 -0800)] 
GH-99554: Pack location tables more effectively (GH-99556)

2 years agoGH-69564: Clarify use of octal format of mode argument in help(os.chmod) (#20621)
amaajemyfren [Wed, 21 Dec 2022 17:48:25 +0000 (20:48 +0300)] 
GH-69564: Clarify use of octal format of mode argument in help(os.chmod) (#20621)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2 years agogh-78878: Fix crash when creating an instance of `_ctypes.CField` (#14837)
Hai Shi [Wed, 21 Dec 2022 17:31:17 +0000 (01:31 +0800)] 
gh-78878: Fix crash when creating an instance of `_ctypes.CField` (#14837)

2 years agoRemove unused variable from `dis._find_imports` (#100396)
Nikita Sobolev [Wed, 21 Dec 2022 16:55:02 +0000 (19:55 +0300)] 
Remove unused variable from `dis._find_imports` (#100396)

2 years agogh-100129: Add tests for pickling all builtin types and functions (GH-100142)
Serhiy Storchaka [Wed, 21 Dec 2022 14:31:22 +0000 (16:31 +0200)] 
gh-100129: Add tests for pickling all builtin types and functions (GH-100142)

2 years agogh-100374: Fixed a bug in socket.getfqdn() (gh-100375)
Dominic Socular [Wed, 21 Dec 2022 13:25:04 +0000 (21:25 +0800)] 
gh-100374: Fixed a bug in socket.getfqdn() (gh-100375)

2 years agoGH-100133: fix `asyncio` subprocess losing `stderr` and `stdout` output (#100154)
Kumar Aditya [Wed, 21 Dec 2022 09:50:26 +0000 (15:20 +0530)] 
GH-100133: fix `asyncio` subprocess losing `stderr` and `stdout` output (#100154)

2 years agoGH-100363: Speed up `asyncio.get_running_loop` (#100364)
Kumar Aditya [Wed, 21 Dec 2022 09:49:44 +0000 (15:19 +0530)] 
GH-100363: Speed up `asyncio.get_running_loop` (#100364)

2 years agogh-85267: Improvements to inspect.signature __text_signature__ handling (#98796)
Shantanu [Wed, 21 Dec 2022 03:29:02 +0000 (21:29 -0600)] 
gh-85267: Improvements to inspect.signature __text_signature__ handling (#98796)

This makes a couple related changes to inspect.signature's behaviour
when parsing a signature from `__text_signature__`.

First, `inspect.signature` is documented as only raising ValueError or
TypeError. However, in some cases, we could raise RuntimeError.  This PR
changes that, thereby fixing #83685.

(Note that the new ValueErrors in RewriteSymbolics are caught and then
reraised with a message)

Second, `inspect.signature` could randomly drop parameters that it
didn't understand (corresponding to `return None` in the `p` function).
This is the core issue in #85267. I think this is very surprising
behaviour and it seems better to fail outright.

Third, adding this new failure broke a couple tests. To fix them (and to
e.g. allow `inspect.signature(select.epoll.register)` as in #85267), I
add constant folding of a couple binary operations to RewriteSymbolics.

(There's some discussion of making signature expression evaluation
arbitrary powerful in #68155. I think that's out of scope. The
additional constant folding here is pretty straightforward, useful, and
not much of a slippery slope)

Fourth, while #85267 is incorrect about the cause of the issue, it turns
out if you had consecutive newlines in __text_signature__, you'd get
`tokenize.TokenError`.

Finally, the `if name is invalid:` code path was dead, since
`parse_name` never returned `invalid`.

2 years agogh-91081: Add note on WeakKeyDictionary behavior when deleting a replaced entry ...
Stanley [Wed, 21 Dec 2022 03:27:02 +0000 (19:27 -0800)] 
gh-91081: Add note on WeakKeyDictionary behavior when deleting a replaced entry (#91499)

Co-authored-by: Pieter Eendebak <P.T.eendebak@tudelft.nl>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2 years agogh-99991: improve docs on str.encode and bytes.decode (#100198)
Bisola Olasehinde [Wed, 21 Dec 2022 02:02:14 +0000 (02:02 +0000)] 
gh-99991: improve docs on str.encode and bytes.decode (#100198)

Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2 years agogh-100188: Reduce misses in BINARY_SUBSCR_(LIST/TUPLE)_INT (#100189)
Dennis Sweeney [Tue, 20 Dec 2022 20:46:16 +0000 (15:46 -0500)] 
gh-100188: Reduce misses in BINARY_SUBSCR_(LIST/TUPLE)_INT (#100189)

Don't specialize if the index is negative.

2 years agogh-99576: Fix cookiejar file that was not truncated for some classes (GH-99616)
Nikita Sobolev [Tue, 20 Dec 2022 16:51:26 +0000 (19:51 +0300)] 
gh-99576: Fix cookiejar file that was not truncated for some classes (GH-99616)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2 years agoClarify that every thread has its own default context in contextvars (#99246)
Pablo Galindo Salgado [Tue, 20 Dec 2022 11:35:48 +0000 (11:35 +0000)] 
Clarify that every thread has its own default context in contextvars (#99246)

2 years agogh-99925: Fix inconsistency in `json.dumps()` error messages (GH-99926)
František Nesveda [Tue, 20 Dec 2022 10:54:56 +0000 (10:54 +0000)] 
gh-99925: Fix inconsistency in `json.dumps()` error messages (GH-99926)

2 years agogh-100348: Fix ref cycle in `asyncio._SelectorSocketTransport` with `_read_ready_cb...
Richard Kojedzinszky [Tue, 20 Dec 2022 10:40:56 +0000 (11:40 +0100)] 
gh-100348: Fix ref cycle in `asyncio._SelectorSocketTransport` with `_read_ready_cb` (#100349)

2 years agogh-88211: Change lower-case and upper-case to match recommendations in imaplib docs...
Brad Wolfe [Tue, 20 Dec 2022 10:10:31 +0000 (11:10 +0100)] 
gh-88211: Change lower-case and upper-case to match recommendations in imaplib docs (#99625)

2 years agogh-89051: Add ssl.OP_LEGACY_SERVER_CONNECT (#93927)
Thomas Grainger [Tue, 20 Dec 2022 07:10:30 +0000 (07:10 +0000)] 
gh-89051: Add ssl.OP_LEGACY_SERVER_CONNECT (#93927)

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Christian Heimes <christian@python.org>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Fixes https://github.com/python/cpython/issues/89051

2 years agogh-69929: re docs: Add more specific definition of \w (#92015)
Stanley [Tue, 20 Dec 2022 03:07:31 +0000 (19:07 -0800)] 
gh-69929: re docs: Add more specific definition of \w (#92015)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2 years agogh-89727: Fix os.walk RecursionError on deep trees (#99803)
Jon Burdo [Mon, 19 Dec 2022 18:59:01 +0000 (13:59 -0500)] 
gh-89727: Fix os.walk RecursionError on deep trees (#99803)

Use a stack to implement os.walk iteratively instead of recursively to
avoid hitting recursion limits on deeply nested trees.

2 years agoDocs: Don't upload CI artifacts (#100330)
Hugo van Kemenade [Mon, 19 Dec 2022 08:40:11 +0000 (10:40 +0200)] 
Docs: Don't upload CI artifacts (#100330)

2 years agogh-94912: Added marker for non-standard coroutine function detection (#99247)
Carlton Gibson [Sun, 18 Dec 2022 19:13:24 +0000 (20:13 +0100)] 
gh-94912: Added marker for non-standard coroutine function detection (#99247)

This introduces a new decorator `@inspect.markcoroutinefunction`,
which, applied to a sync function, makes it appear async to
`inspect.iscoroutinefunction()`.

2 years agoCorrect CVE-2020-10735 documentation (#100306)
Jeremy Paige [Sun, 18 Dec 2022 07:11:21 +0000 (23:11 -0800)] 
Correct CVE-2020-10735 documentation (#100306)

2 years agogh-100272: Fix JSON serialization of OrderedDict (GH-100273)
Serhiy Storchaka [Sat, 17 Dec 2022 12:32:48 +0000 (14:32 +0200)] 
gh-100272: Fix JSON serialization of OrderedDict (GH-100273)

It now preserves the order of keys.

2 years agogh-93649: Split tracemalloc tests from _testcapimodule.c (#99551)
Erlend E. Aasland [Sat, 17 Dec 2022 08:53:36 +0000 (09:53 +0100)] 
gh-93649: Split tracemalloc tests from _testcapimodule.c (#99551)

2 years agoDocs: Use `PY_VERSION_HEX` for version comparison (#100179)
Hugo van Kemenade [Sat, 17 Dec 2022 07:42:18 +0000 (09:42 +0200)] 
Docs: Use `PY_VERSION_HEX` for version comparison (#100179)

2 years agogh-97909: Fix markup for `PyMethodDef` members (#100089)
ram vikram singh [Sat, 17 Dec 2022 07:12:39 +0000 (12:42 +0530)] 
gh-97909: Fix markup for `PyMethodDef` members (#100089)

2 years agogh-99240: Reset pointer to NULL when the pointed memory is freed in argument parsing...
colorfulappl [Sat, 17 Dec 2022 06:40:51 +0000 (14:40 +0800)] 
gh-99240: Reset pointer to NULL when the pointed memory is freed in argument parsing (#99890)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2 years agogh-99240: Reset pointer to NULL when the pointed memory is freed in argument parsing...
colorfulappl [Sat, 17 Dec 2022 06:37:44 +0000 (14:37 +0800)] 
gh-99240: Reset pointer to NULL when the pointed memory is freed in argument parsing (#99890)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2 years agoGH-98831: Add DECREF_INPUTS(), expanding to DECREF() each stack input (#100205)
Guido van Rossum [Sat, 17 Dec 2022 04:45:55 +0000 (20:45 -0800)] 
GH-98831: Add DECREF_INPUTS(), expanding to DECREF() each stack input (#100205)

The presence of this macro indicates that a particular instruction
may be considered for conversion to a register-based format
(see https://github.com/faster-cpython/ideas/issues/485).

An invariant (currently unchecked) is that `DEOPT_IF()` may only
occur *before* `DECREF_INPUTS()`, and `ERROR_IF()` may only occur
*after* it. One reason not to check this is that there are a few
places where we insert *two* `DECREF_INPUTS()` calls, in different
branches of the code. The invariant checking would have to be able
to do some flow control analysis to understand this.

Note that many instructions, especially specialized ones,
can't be converted to use this macro straightforwardly.
This is because the generator currently only generates plain
`Py_DECREF(variable)` statements, and cannot generate
things like `_Py_DECREF_SPECIALIZED()` let alone deal with
`_PyList_AppendTakeRef()`.

2 years agogh-78707: deprecate passing >1 argument to `PurePath.[is_]relative_to()` (GH-94469)
Barney Gale [Sat, 17 Dec 2022 00:14:27 +0000 (00:14 +0000)] 
gh-78707: deprecate passing >1 argument to `PurePath.[is_]relative_to()` (GH-94469)

This brings `relative_to()` and `is_relative_to()` more in line with other pathlib methods like `rename()` and `symlink_to()`.

Resolves #78707.

2 years agogh-99540: Constant hash for _PyNone_Type to aid reproducibility (GH-99541)
yonillasky [Fri, 16 Dec 2022 20:36:13 +0000 (22:36 +0200)] 
gh-99540: Constant hash for _PyNone_Type to aid reproducibility (GH-99541)

Needed for ASLR builds of Python.

2 years agogh-100039: enhance __signature__ to work with str and callables (GH-100168)
Ethan Furman [Fri, 16 Dec 2022 20:30:47 +0000 (12:30 -0800)] 
gh-100039: enhance __signature__ to work with str and callables (GH-100168)

Callables should be either class- or static-methods.
Enum now uses the classmethod version to greatly improve the help
given for enums and flags.

2 years agogh-99830: asyncio: Document returns of remove_{reader,writer} (#100302)
Ben Darnell [Fri, 16 Dec 2022 19:04:55 +0000 (14:04 -0500)] 
gh-99830: asyncio: Document returns of remove_{reader,writer} (#100302)

2 years ago"Compound statement" docs: Fix with-statement step indexing (#100286)
Frank Dana [Fri, 16 Dec 2022 18:43:43 +0000 (13:43 -0500)] 
"Compound statement" docs: Fix with-statement step indexing (#100286)

Back in commit 226e6e7d4326cf91ef37e13528eb1f62de1bb832
an item was added to the list, renumbering all the rest of the
items, but the forward-reference wasn't updated to match.

2 years agoGH-90043: Handle NaNs in COMPARE_OP_FLOAT_JUMP (GH-100278)
Brandt Bucher [Fri, 16 Dec 2022 18:18:31 +0000 (10:18 -0800)] 
GH-90043: Handle NaNs in COMPARE_OP_FLOAT_JUMP (GH-100278)

2 years agoImprove stats presentation for calls. (GH-100274)
Mark Shannon [Fri, 16 Dec 2022 15:43:04 +0000 (15:43 +0000)] 
Improve stats presentation for calls. (GH-100274)

2 years agoBetter stats for `LOAD_ATTR` and `STORE_ATTR` (GH-100295)
Mark Shannon [Fri, 16 Dec 2022 15:41:23 +0000 (15:41 +0000)] 
Better stats for `LOAD_ATTR` and `STORE_ATTR` (GH-100295)

* Don't attempt to specialize for LOAD_ATTR on instance if class has attribute

* Improvement to LOAD_ATTR and STORE_ATTR specialization stats.

2 years agogh-81057: Move the Cached Parser Dummy Name to _PyRuntimeState (#100277)
Eric Snow [Fri, 16 Dec 2022 13:48:03 +0000 (06:48 -0700)] 
gh-81057: Move the Cached Parser Dummy Name to _PyRuntimeState (#100277)

2 years agoDocument that zipfile's pwd parameter is a `bytes` object (#100209)
JustAnotherArchivist [Fri, 16 Dec 2022 10:40:10 +0000 (10:40 +0000)] 
Document that zipfile's pwd parameter is a `bytes` object (#100209)

2 years agogh-99767: mark `PyTypeObject.tp_watched` as internal use only in table (#100271)
Carl Meyer [Fri, 16 Dec 2022 10:32:09 +0000 (03:32 -0700)] 
gh-99767: mark `PyTypeObject.tp_watched` as internal use only in table (#100271)

2 years agoFix typo in introduction.rst (#100266)
Mikhail Berkov [Fri, 16 Dec 2022 10:26:30 +0000 (11:26 +0100)] 
Fix typo in introduction.rst (#100266)

2 years agogh-78997: AttributeError if loading fails in LibraryLoader.__getattr__
Ateeq Sharfuddin [Thu, 15 Dec 2022 22:59:37 +0000 (17:59 -0500)] 
gh-78997: AttributeError if loading fails in LibraryLoader.__getattr__

Co-authored-by: Zachary Ware <zachary.ware@gmail.com>
Co-authored-by: Filipe Laíns <filipe.lains@gmail.com>
Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
2 years agoGH-100234: Set a default value for random.expovariate() (GH-100235)
Raymond Hettinger [Thu, 15 Dec 2022 18:40:45 +0000 (20:40 +0200)] 
GH-100234: Set a default value for random.expovariate() (GH-100235)

2 years agoRemove uninformative itertools recipe (GH-100253)
Raymond Hettinger [Thu, 15 Dec 2022 18:39:01 +0000 (20:39 +0200)] 
Remove uninformative itertools recipe (GH-100253)

2 years agoGH-99767: update PyTypeObject docs for type watchers (GH-99928)
Carl Meyer [Thu, 15 Dec 2022 11:26:08 +0000 (04:26 -0700)] 
GH-99767: update PyTypeObject docs for type watchers (GH-99928)

2 years agoMove stats for the method cache into the `Py_STAT` machinery (GH-100255)
Mark Shannon [Thu, 15 Dec 2022 09:45:03 +0000 (09:45 +0000)] 
Move stats for the method cache into the `Py_STAT` machinery (GH-100255)

2 years agoGH-100222: fix typo _py_set_opocde -> _py_set_opcode (GH-100259)
Carl Meyer [Thu, 15 Dec 2022 00:39:00 +0000 (17:39 -0700)] 
GH-100222: fix typo _py_set_opocde -> _py_set_opcode (GH-100259)

Typo introduced in #100223.

Automerge-Triggered-By: GH:brandtbucher
2 years agoGH-100000: Cleanup and polish various watchers code (GH-99998)
Itamar Ostricher [Wed, 14 Dec 2022 19:14:16 +0000 (11:14 -0800)] 
GH-100000: Cleanup and polish various watchers code (GH-99998)

* Initialize `type_watchers` array to `NULL`s
* Optimize code watchers notification
* Optimize func watchers notification

2 years agogh-90111: Minor Cleanup for Runtime-Global Objects (gh-100254)
Eric Snow [Wed, 14 Dec 2022 18:53:57 +0000 (11:53 -0700)] 
gh-90111: Minor Cleanup for Runtime-Global Objects (gh-100254)

* move _PyRuntime.global_objects.interned to _PyRuntime.cached_objects.interned_strings (and use _Py_CACHED_OBJECT())
* rename _PyRuntime.global_objects to _PyRuntime.static_objects

(This also relates to gh-96075.)

https://github.com/python/cpython/issues/90111

2 years agogh-100248: Add missing `ssl_shutdown_timeout` parameter in `asyncio` docs (#100249)
busywhitespace [Wed, 14 Dec 2022 16:57:02 +0000 (17:57 +0100)] 
gh-100248: Add missing `ssl_shutdown_timeout` parameter in `asyncio` docs (#100249)

2 years agoAssorted minor fixes for specialization stats. (GH-100219)
Mark Shannon [Wed, 14 Dec 2022 15:50:02 +0000 (15:50 +0000)] 
Assorted minor fixes for specialization stats. (GH-100219)

2 years agogh-100176: venv: Remove redundant compat code for Python <= 3.2 (#100177)
Hugo van Kemenade [Wed, 14 Dec 2022 11:37:11 +0000 (13:37 +0200)] 
gh-100176: venv: Remove redundant compat code for Python <= 3.2 (#100177)

gh-100176: Remove redundant compat code for Python 3.2 and older

Python 3.2 has been EOL since 2016-02-20 and 2.7 since 2020-01-01, so we
can remove this old compatibility check and unindent the old else-block.

Also, in the unindented block, replace a .format() call with an f-string.

Plus similar changes in the documentation.

2 years agoGH-100222: Redefine _Py_CODEUNIT as a union to clarify structure of code unit. (GH...
Mark Shannon [Wed, 14 Dec 2022 11:12:53 +0000 (11:12 +0000)] 
GH-100222: Redefine _Py_CODEUNIT as a union to clarify structure of code unit. (GH-100223)

2 years agogh-99955: undef ERROR and SUCCESS before redefining (fixes sanitizer warning) (#100215)
Irit Katriel [Tue, 13 Dec 2022 13:55:10 +0000 (13:55 +0000)] 
gh-99955: undef ERROR and SUCCESS before redefining (fixes sanitizer warning) (#100215)

2 years agoGH-100206: use versionadded for the addition of sysconfig.get_default_scheme (#100207)
Filipe Laíns [Tue, 13 Dec 2022 10:54:07 +0000 (10:54 +0000)] 
GH-100206: use versionadded for the addition of sysconfig.get_default_scheme (#100207)