]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
2 years agogh-104301: Allow leading whitespace in disambiguated pdb statements (#104342)
James Gerity [Thu, 11 May 2023 17:12:02 +0000 (13:12 -0400)] 
gh-104301: Allow leading whitespace in disambiguated pdb statements (#104342)

2 years agogh-104057: Fix direct invocation of test_support (GH-104069)
Kirill Podoprigora [Thu, 11 May 2023 14:44:39 +0000 (17:44 +0300)] 
gh-104057: Fix direct invocation of test_support (GH-104069)

2 years agogh-87729: improve hit rate of LOAD_SUPER_ATTR specialization (#104270)
Carl Meyer [Thu, 11 May 2023 14:08:13 +0000 (08:08 -0600)] 
gh-87729: improve hit rate of LOAD_SUPER_ATTR specialization (#104270)

2 years agogh-101819: Fix inverted debug preprocessor check in winconsoleio.c (#104388)
Erlend E. Aasland [Thu, 11 May 2023 13:01:05 +0000 (15:01 +0200)] 
gh-101819: Fix inverted debug preprocessor check in winconsoleio.c (#104388)

2 years agogh-87849: fix SEND specialization family definition (GH-104268)
Carl Meyer [Thu, 11 May 2023 11:52:06 +0000 (05:52 -0600)] 
gh-87849: fix SEND specialization family definition (GH-104268)

2 years agogh-101819: Adapt _io.IOBase.seek and _io.IOBase.truncate to Argument Clinic (#104384)
Erlend E. Aasland [Thu, 11 May 2023 10:34:26 +0000 (12:34 +0200)] 
gh-101819: Adapt _io.IOBase.seek and _io.IOBase.truncate to Argument Clinic (#104384)

2 years agogh-101819: Adapt _io._Buffered* methods to Argument Clinic (#104367)
Erlend E. Aasland [Thu, 11 May 2023 10:29:23 +0000 (12:29 +0200)] 
gh-101819: Adapt _io._Buffered* methods to Argument Clinic (#104367)

2 years agogh-101819: Refactor `_io` futher in preparation for module isolation (#104369)
Erlend E. Aasland [Thu, 11 May 2023 10:26:30 +0000 (12:26 +0200)] 
gh-101819: Refactor `_io` futher in preparation for module isolation (#104369)

2 years agogh-101819: Adapt _io.TextIOBase methods to Argument Clinic (#104383)
Erlend E. Aasland [Thu, 11 May 2023 10:19:22 +0000 (12:19 +0200)] 
gh-101819: Adapt _io.TextIOBase methods to Argument Clinic (#104383)

2 years agogh-101117: Improve accuracy of sqlite3.Cursor.rowcount docs (#104287)
Erlend E. Aasland [Thu, 11 May 2023 08:44:31 +0000 (10:44 +0200)] 
gh-101117: Improve accuracy of sqlite3.Cursor.rowcount docs (#104287)

The SQLite C API sqlite3_changes() can only be relied upon when the
current active statement has been run to completion.

2 years agoGH-92184: Convert os.altsep to '/' in filenames when creating ZipInfo objects (#92185)
Carey Metcalfe [Thu, 11 May 2023 07:25:16 +0000 (01:25 -0600)] 
GH-92184: Convert os.altsep to '/' in filenames when creating ZipInfo objects (#92185)

This causes the zipfile module to also consider the character defined by
`os.altsep` (if there is one) to be a path separator and convert it to a
forward slash, as defined by the zip specification.

A logical no-op on all known platforms today as os.altsep is currently only set to a meaningful value on Windows (where it is "/").

2 years agogh-104357: fix inlined comprehensions that close over iteration var (#104368)
Carl Meyer [Thu, 11 May 2023 01:08:40 +0000 (19:08 -0600)] 
gh-104357: fix inlined comprehensions that close over iteration var (#104368)

2 years agoGH-90208: Suppress OSError exceptions from `pathlib.Path.glob()` (GH-104141)
Barney Gale [Thu, 11 May 2023 00:01:39 +0000 (01:01 +0100)] 
GH-90208: Suppress OSError exceptions from `pathlib.Path.glob()` (GH-104141)

`pathlib.Path.glob()` now suppresses all OSError exceptions, except
those raised from calling `is_dir()` on the top-level path.

Previously, `glob()` suppressed ENOENT, ENOTDIR, EBADF and ELOOP
errors and their Windows equivalents. PermissionError was also
suppressed unless it occurred when calling `is_dir()` on the
top-level path. However, the selector would abort prematurely
if a PermissionError was raised, and so `glob()` could return
incomplete results.

2 years agoGH-102181: Improve specialization stats for SEND (GH-102182)
penguin_wwy [Wed, 10 May 2023 22:40:59 +0000 (06:40 +0800)] 
GH-102181: Improve specialization stats for SEND (GH-102182)

2 years agogh-103000: Optimise `dataclasses.asdict` for the common case (#104364)
Alex Waygood [Wed, 10 May 2023 21:43:51 +0000 (22:43 +0100)] 
gh-103000: Optimise `dataclasses.asdict` for the common case (#104364)

Co-authored-by: David Ellis <ducksual@gmail.com>
2 years agogh-103538: Remove unused TK_AQUA code (GH-103539)
Christopher Chavez [Wed, 10 May 2023 18:53:13 +0000 (13:53 -0500)] 
gh-103538: Remove unused TK_AQUA code (GH-103539)

2 years agoGH-87695: Fix OSError from `pathlib.Path.glob()` (GH-104292)
Barney Gale [Wed, 10 May 2023 17:17:08 +0000 (18:17 +0100)] 
GH-87695: Fix OSError from `pathlib.Path.glob()` (GH-104292)

Fix issue where `pathlib.Path.glob()` raised `OSError` when it encountered
a symlink to an overly long path.

2 years agogh-104263: Rely on Py_NAN and introduce Py_INFINITY (GH-104202)
Sebastian Berg [Wed, 10 May 2023 16:44:52 +0000 (18:44 +0200)] 
gh-104263: Rely on Py_NAN and introduce Py_INFINITY (GH-104202)

This PR removes `_Py_dg_stdnan` and `_Py_dg_infinity` in favour of
using the standard `NAN` and `INFINITY` macros provided by C99.
This change has the side-effect of fixing a bug on MIPS where the
hard-coded value used by `_Py_dg_stdnan` gave a signalling NaN
rather than a quiet NaN.
---------

Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
2 years agogh-104010: Separate and improve docs for `typing.get_origin` and `typing.get_args...
chgnrdv [Wed, 10 May 2023 14:48:55 +0000 (17:48 +0300)] 
gh-104010: Separate and improve docs for `typing.get_origin` and `typing.get_args` (#104013)

* separate documentation and examples for both functions
* add examples demonstrating behaviour with unsupported types
* document return value of `get_origin` for `ParamSpecArgs` and `ParamSpecKwargs` instances

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2 years agogh-101819: Adapt _io._BufferedIOBase_Type methods to Argument Clinic (#104355)
Erlend E. Aasland [Wed, 10 May 2023 14:22:55 +0000 (16:22 +0200)] 
gh-101819: Adapt _io._BufferedIOBase_Type methods to Argument Clinic (#104355)

Make sure the defining class is passed to all methods,
so we can easily fetch module state from them in the future.

2 years agogh-103960: Dark mode: invert image brightness (#103983)
Hugo van Kemenade [Wed, 10 May 2023 13:46:37 +0000 (16:46 +0300)] 
gh-103960: Dark mode: invert image brightness (#103983)

2 years agogh-104252: Immortalize Py_EMPTY_KEYS (gh-104253)
Eric Snow [Wed, 10 May 2023 13:28:40 +0000 (07:28 -0600)] 
gh-104252: Immortalize Py_EMPTY_KEYS (gh-104253)

This was missed in gh-19474.  It matters for with a per-interpreter GIL since PyDictKeysObject.dk_refcnt breaks isolation and leads to races.

2 years agogh-101819: Clean up _io windows console io after gh-104197 (#104354)
Erlend E. Aasland [Wed, 10 May 2023 10:59:31 +0000 (12:59 +0200)] 
gh-101819: Clean up _io windows console io after gh-104197 (#104354)

2 years agogh-101819: Harden _io init (#104352)
Erlend E. Aasland [Wed, 10 May 2023 10:59:03 +0000 (12:59 +0200)] 
gh-101819: Harden _io init (#104352)

Fix potential refleak if PyModule_AddObject() fails.

2 years agogh-103247: clear the module cache in a test in test_importlib/extensions/test_loader...
sunmy2019 [Wed, 10 May 2023 00:59:04 +0000 (08:59 +0800)] 
gh-103247: clear the module cache in a test in test_importlib/extensions/test_loader.py (GH-104226)

2 years agogh-103848: Adds checks to ensure that bracketed hosts found by urlsplit are of IPv6...
JohnJamesUtley [Wed, 10 May 2023 00:18:35 +0000 (20:18 -0400)] 
gh-103848: Adds checks to ensure that bracketed hosts found by urlsplit are of IPv6 or IPvFuture format (#103849)

* Adds checks to ensure that bracketed hosts found by urlsplit are of IPv6 or IPvFuture format

---------

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2 years agogh-74895: adjust tests to work on Solaris (#104326)
Jakub Kulík [Tue, 9 May 2023 23:49:55 +0000 (01:49 +0200)] 
gh-74895: adjust tests to work on Solaris (#104326)

Solaris is unusual here, but apparently everyone is happy when SOCK_STREAM is explicitly specified.

2 years agogh-101819: Refactor _io in preparation for module isolation (#104334)
Erlend E. Aasland [Tue, 9 May 2023 23:09:03 +0000 (01:09 +0200)] 
gh-101819: Refactor _io in preparation for module isolation (#104334)

- Replace query with parameter in bufferediobase_unsupported()
- Replace query with parameter in iobase_unsupported()
- Hide delegate: Add method wrapper for _PyIOBase_check_seekable
- Hide delegate: Add method wraper for _PyIOBase_check_readable
- Hide delegate: Add method wraper for _PyIOBase_check_writable
- Replace query with parameter in _PyIOBase_check_seekable()
- Replace query with parameter in _PyIOBase_check_readable()
- Replace query with parameter in _PyIOBase_check_writable()

2 years agogh-90953: Don't use deprecated AST nodes in clinic.py (#104322)
Alex Waygood [Tue, 9 May 2023 21:16:22 +0000 (22:16 +0100)] 
gh-90953: Don't use deprecated AST nodes in clinic.py (#104322)

2 years agogh-102327: Extend docs for "url" and "headers" parameters to HTTPConnection.request()
David Foster [Tue, 9 May 2023 19:57:17 +0000 (15:57 -0400)] 
gh-102327: Extend docs for "url" and "headers" parameters to HTTPConnection.request()

Added example on how to use the HTTPConnection object for making GET request.

Original issue: https://github.com/python/cpython/issues/102327

---------

Co-authored-by: Éric <earaujo@caravan.coop>
2 years agogh-104328: Fix typo in ``typing.Generic`` multiple inheritance error message (#104335)
Kirill Podoprigora [Tue, 9 May 2023 19:18:15 +0000 (22:18 +0300)] 
gh-104328: Fix typo in ``typing.Generic`` multiple inheritance error message (#104335)

2 years agogh-97696 Add documentation for get_coro() behavior with eager tasks (#104304)
Jacob Bower [Tue, 9 May 2023 17:09:16 +0000 (10:09 -0700)] 
gh-97696 Add documentation for get_coro() behavior with eager tasks (#104304)

2 years agogh-97933: (PEP 709) inline list/dict/set comprehensions (#101441)
Carl Meyer [Tue, 9 May 2023 17:02:14 +0000 (11:02 -0600)] 
gh-97933: (PEP 709) inline list/dict/set comprehensions (#101441)

Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2 years agogh-99889: Fix directory traversal security flaw in uu.decode() (#104096)
Sam Carroll [Tue, 9 May 2023 16:01:58 +0000 (12:01 -0400)] 
gh-99889: Fix directory traversal security flaw in uu.decode() (#104096)

* Fix directory traversal security flaw in uu.decode()
* also check absolute paths and os.altsep
* Add a regression test.

---------

Co-authored-by: Gregory P. Smith <greg@krypto.org> [Google]
2 years agogh-104184: fix building --with-pydebug --enable-pystats (#104217)
Carl Meyer [Tue, 9 May 2023 14:53:19 +0000 (08:53 -0600)] 
gh-104184: fix building --with-pydebug --enable-pystats (#104217)

2 years agogh-104139: Add itms-services to uses_netloc urllib.parse. (#104312)
Gregory P. Smith [Tue, 9 May 2023 14:04:50 +0000 (07:04 -0700)] 
gh-104139: Add itms-services to uses_netloc urllib.parse. (#104312)

Teach unsplit to retain the `"//"` when assembling `itms-services://?action=generate-bugs` style
[Apple Platform Deployment](https://support.apple.com/en-gb/guide/deployment/depce7cefc4d/web) URLs.

2 years agogh-104240: return code unit metadata from codegen (#104300)
Irit Katriel [Tue, 9 May 2023 13:33:40 +0000 (14:33 +0100)] 
gh-104240: return code unit metadata from codegen (#104300)

2 years agogh-104276: Make `_struct.unpack_iterator` type use type flag instead of custom constr...
chgnrdv [Tue, 9 May 2023 12:41:09 +0000 (15:41 +0300)] 
gh-104276: Make `_struct.unpack_iterator` type use type flag instead of custom constructor (#104277)

2 years agogh-97696: Move around and update the whatsnew entry for asyncio eager task factory...
Itamar Ostricher [Tue, 9 May 2023 12:39:59 +0000 (05:39 -0700)] 
gh-97696: Move around and update the whatsnew entry for asyncio eager task factory (#104298)

2 years agogh-103193: Fix refleaks in `test_inspect` and `test_typing` (#104320)
Alex Waygood [Tue, 9 May 2023 12:33:36 +0000 (13:33 +0100)] 
gh-103193: Fix refleaks in `test_inspect` and `test_typing` (#104320)

2 years agorequire-pr-label.yml: Add missing "permissions:" (#104309)
Sebastian Pipping [Tue, 9 May 2023 10:29:00 +0000 (12:29 +0200)] 
require-pr-label.yml: Add missing "permissions:" (#104309)

2 years agogh-90656: Add platform triplets for 64-bit LoongArch (LA64) (#30939)
Zhang Na [Tue, 9 May 2023 09:19:40 +0000 (17:19 +0800)] 
gh-90656: Add platform triplets for 64-bit LoongArch (LA64) (#30939)

Signed-off-by: Zhang Na <zhangna@loongson.cn>
Co-authored-by: WANG Xuerui <git@xen0n.name>
2 years agogh-104180: Read SOCKS proxies from macOS System Configuration (#104181)
samschott [Tue, 9 May 2023 08:24:29 +0000 (10:24 +0200)] 
gh-104180: Read SOCKS proxies from macOS System Configuration (#104181)

read SOCKS proxies from macOS System Configuration in ``urllib.request``.

---------

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
2 years ago gh-97696 Remove unnecessary check for eager_start kwarg (#104188)
Jacob Bower [Tue, 9 May 2023 00:51:58 +0000 (17:51 -0700)] 
 gh-97696 Remove unnecessary check for eager_start kwarg (#104188)

Instead, add docstring to create_eager_task_factory.

2 years agoGH-104308: socket.getnameinfo should release the GIL (#104307)
Nathaniel J. Smith [Mon, 8 May 2023 23:27:20 +0000 (16:27 -0700)] 
GH-104308: socket.getnameinfo should release the GIL (#104307)

* socket.getnameinfo should release the GIL

* 📜🤖 Added by blurb_it.

---------

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2 years agogh-104310: Add importlib.util.allowing_all_extensions() (gh-104311)
Eric Snow [Mon, 8 May 2023 22:56:01 +0000 (16:56 -0600)] 
gh-104310: Add importlib.util.allowing_all_extensions() (gh-104311)

(I'll be adding docs for this separately.)

2 years agogh-99113: A Per-Interpreter GIL! (gh-104210)
Eric Snow [Mon, 8 May 2023 19:15:09 +0000 (13:15 -0600)] 
gh-99113: A Per-Interpreter GIL! (gh-104210)

This is the culmination of PEP 684 (and of my 8-year long multi-core Python project)!

Each subinterpreter may now be created with its own GIL (via Py_NewInterpreterFromConfig()).  If not so configured then the interpreter will share with the main interpreter--the status quo since subinterpreters were added decades ago.  The main interpreter always has its own GIL and subinterpreters from Py_NewInterpreter() will always share with the main interpreter.

2 years agoGH-104284: Fix documentation gettext build (#104296)
Adam Turner [Mon, 8 May 2023 19:01:25 +0000 (20:01 +0100)] 
GH-104284: Fix documentation gettext build (#104296)

2 years agogh-89550: Buffer GzipFile.write to reduce execution time by ~15% (#101251)
Arjun [Mon, 8 May 2023 17:55:59 +0000 (10:55 -0700)] 
gh-89550: Buffer GzipFile.write to reduce execution time by ~15% (#101251)

Use `io.BufferedWriter` to buffer gzip writes.

---------

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2 years agogh-104223: Fix issues with inheriting from buffer classes (#104227)
Jelle Zijlstra [Mon, 8 May 2023 16:52:41 +0000 (09:52 -0700)] 
gh-104223: Fix issues with inheriting from buffer classes (#104227)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2 years agogh-99108: fix typo in Modules/Setup (#104293)
Jonathan Protzenko [Mon, 8 May 2023 16:52:11 +0000 (09:52 -0700)] 
gh-99108: fix typo in Modules/Setup (#104293)

case sensitive filename

2 years agoGH-104145: Use fully-qualified cross reference types for the bisect module (#104172)
Adam Turner [Mon, 8 May 2023 16:32:18 +0000 (17:32 +0100)] 
GH-104145: Use fully-qualified cross reference types for the bisect module (#104172)

2 years agogh-103193: Improve `getattr_static` test coverage (#104286)
Alex Waygood [Mon, 8 May 2023 14:18:36 +0000 (15:18 +0100)] 
gh-103193: Improve `getattr_static` test coverage (#104286)

2 years agoTrim trailing whitespace and test on CI (#104275)
Hugo van Kemenade [Mon, 8 May 2023 14:03:52 +0000 (17:03 +0300)] 
Trim trailing whitespace and test on CI (#104275)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2 years agogh-102500: Remove mention of bytes shorthand (#104281)
Shantanu [Mon, 8 May 2023 13:40:51 +0000 (06:40 -0700)] 
gh-102500: Remove mention of bytes shorthand (#104281)

The bytes shorthand was removed in PEP 688:
https://peps.python.org/pep-0688/#no-special-meaning-for-bytes

I also remove the reference to `collections.abc.ByteString`, since that
object is deprecated (#91896) and has different semantics (#102092)

2 years agogh-97696: Improve and fix documentation for asyncio eager tasks (#104256)
Itamar Ostricher [Mon, 8 May 2023 11:59:34 +0000 (04:59 -0700)] 
gh-97696: Improve and fix documentation for asyncio eager tasks (#104256)

2 years agogh-99108: Replace SHA3 implementation HACL* version (#103597)
Jonathan Protzenko [Mon, 8 May 2023 03:50:04 +0000 (20:50 -0700)] 
gh-99108: Replace SHA3 implementation HACL* version (#103597)

Replaces our built-in SHA3 implementation with a verified one from the HACL* project.

This implementation is used when OpenSSL does not provide SHA3 or is not present.

3.11 shiped with a very slow tiny sha3 implementation to get off of the <=3.10 reference implementation that wound up having serious bugs. This brings us back to a reasonably performing built-in implementation consistent with what we've just replaced our other guaranteed available standard hash algorithms with: code from the HACL* project.

---------

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2 years agogh-104273: Remove redundant len() calls in argparse function (#104274)
Burak Saler [Sun, 7 May 2023 23:43:50 +0000 (02:43 +0300)] 
gh-104273: Remove redundant len() calls in argparse function (#104274)

2 years agogh-64660: Don't hardcode Argument Clinic return converter result variable name (...
Erlend E. Aasland [Sun, 7 May 2023 21:55:37 +0000 (23:55 +0200)] 
gh-64660: Don't hardcode Argument Clinic return converter result variable name (#104200)

2 years agogh-104265 Disallow instantiation of `_csv.Reader` and `_csv.Writer` (#104266)
chgnrdv [Sun, 7 May 2023 21:15:44 +0000 (00:15 +0300)] 
gh-104265 Disallow instantiation of `_csv.Reader` and `_csv.Writer` (#104266)

2 years agoGH-102613: Improve performance of `pathlib.Path.rglob()` (GH-104244)
Barney Gale [Sun, 7 May 2023 21:12:50 +0000 (22:12 +0100)] 
GH-102613: Improve performance of `pathlib.Path.rglob()` (GH-104244)

Stop de-duplicating results in `_RecursiveWildcardSelector`. A new
`_DoubleRecursiveWildcardSelector` class is introduced which performs
de-duplication, but this is used _only_ for patterns with multiple
non-adjacent `**` segments, such as `path.glob('**/foo/**')`. By avoiding
the use of a set, `PurePath.__hash__()` is not called, and so paths do not
need to be stringified and case-normalised.

Also merge adjacent '**' segments in patterns.

2 years agogh-103650: Fix perf maps address format (#103651)
Arthur Pastel [Sun, 7 May 2023 19:42:26 +0000 (21:42 +0200)] 
gh-103650: Fix perf maps address format (#103651)

2 years agoGH-89812: Churn `pathlib.Path` methods (GH-104243)
Barney Gale [Sun, 7 May 2023 19:07:07 +0000 (20:07 +0100)] 
GH-89812: Churn `pathlib.Path` methods (GH-104243)

Re-arrange `pathlib.Path` methods in source code. No other changes.

The methods are arranged as follows:

1. `stat()` and dependants (`exists()`, `is_dir()`, etc)
2. `open()` and dependants (`read_text()`, `write_bytes()`, etc)
3. `iterdir()` and dependants (`glob()`, `walk()`, etc)
4. All other `Path` methods

This patch prepares the ground for a new `_AbstractPath` class, which will
support the methods in groups 1, 2 and 3 above. By churning the methods
here, subsequent patches will be easier to review and less likely to break
things.

2 years agogh-104240: make _PyCompile_CodeGen support different compilation modes (#104241)
Irit Katriel [Sun, 7 May 2023 17:47:28 +0000 (18:47 +0100)] 
gh-104240: make _PyCompile_CodeGen support different compilation modes (#104241)

2 years agogh-103193: cache calls to `inspect._shadowed_dict` in `inspect.getattr_static` (...
Alex Waygood [Sun, 7 May 2023 17:45:09 +0000 (18:45 +0100)] 
gh-103193: cache calls to `inspect._shadowed_dict` in `inspect.getattr_static` (#104267)

Co-authored-by: Carl Meyer <carl@oddbird.net>
2 years agoGH-100479: Fix pathlib test failure on WASI (#104215)
Barney Gale [Sun, 7 May 2023 16:54:40 +0000 (17:54 +0100)] 
GH-100479: Fix pathlib test failure on WASI (#104215)

2 years agogh-101819: Port _io.PyBytesIOBuffer_Type to heap type (#104264)
Erlend E. Aasland [Sun, 7 May 2023 14:01:27 +0000 (16:01 +0200)] 
gh-101819: Port _io.PyBytesIOBuffer_Type to heap type (#104264)

2 years agogh-100370: fix OverflowError in sqlite3.Connection.blobopen for 32-bit builds (#103902)
Erlend E. Aasland [Sun, 7 May 2023 10:55:31 +0000 (12:55 +0200)] 
gh-100370: fix OverflowError in sqlite3.Connection.blobopen for 32-bit builds (#103902)

2 years agogh-101819: Adapt _io.PyWindowsConsoleIO_Type to heap type (#104197)
Erlend E. Aasland [Sun, 7 May 2023 09:23:11 +0000 (11:23 +0200)] 
gh-101819: Adapt _io.PyWindowsConsoleIO_Type to heap type (#104197)

2 years agogh-101819: Port _io.PyIncrementalNewlineDecoder_Type to heap type (#104249)
Erlend E. Aasland [Sun, 7 May 2023 09:20:34 +0000 (11:20 +0200)] 
gh-101819: Port _io.PyIncrementalNewlineDecoder_Type to heap type (#104249)

2 years agoRe-enable commented-out test in test_generators.py (#104130)
ymki4360 [Sun, 7 May 2023 04:44:46 +0000 (13:44 +0900)] 
Re-enable commented-out test in test_generators.py (#104130)

2 years agogh-104018: remove unused format "z" handling in string formatfloat() (#104107)
John Belmonte [Sun, 7 May 2023 04:41:42 +0000 (13:41 +0900)] 
gh-104018: remove unused format "z" handling in string formatfloat() (#104107)

This is a cleanup overlooked in PR #104033.

2 years agogh-97696: Use `PyObject_CallMethodNoArgs` and inline is_loop_running check in `_async...
Itamar Ostricher [Sun, 7 May 2023 04:25:45 +0000 (21:25 -0700)] 
gh-97696: Use `PyObject_CallMethodNoArgs` and inline is_loop_running check in `_asyncio` (#104255)

2 years agogh-103886: Improve `builtins.__doc__` (#104179)
Tomas R [Sun, 7 May 2023 02:05:34 +0000 (04:05 +0200)] 
gh-103886: Improve `builtins.__doc__` (#104179)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2 years agogh-104254: Document the optional keyword-only "context" argument to Task constructor...
Itamar Ostricher [Sun, 7 May 2023 01:31:53 +0000 (18:31 -0700)] 
gh-104254: Document the optional keyword-only "context" argument to Task constructor (#104251)

(This was added in 3.11. It was already documented for `create_task()`, but not for `Task()`.)

2 years agogh-101640: Make argparse _print_message catch any write error (#101802)
Oleg Iarygin [Sat, 6 May 2023 22:53:48 +0000 (02:53 +0400)] 
gh-101640: Make argparse _print_message catch any write error (#101802)

* In particular, don't exit when trying to print to stderr = None.
* Add tests

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2 years agogh-99113: Make Sure the GIL is Acquired at the Right Places (gh-104208)
Eric Snow [Sat, 6 May 2023 21:59:30 +0000 (15:59 -0600)] 
gh-99113: Make Sure the GIL is Acquired at the Right Places (gh-104208)

This is a pre-requisite for a per-interpreter GIL.  Without it this change isn't strictly necessary.  However, there is no real downside otherwise.

2 years agogh-99113: Add a check for Py_MOD_PER_INTERPRETER_GIL_SUPPORTED (gh-104206)
Eric Snow [Sat, 6 May 2023 21:57:35 +0000 (15:57 -0600)] 
gh-99113: Add a check for Py_MOD_PER_INTERPRETER_GIL_SUPPORTED (gh-104206)

Py_MOD_PER_INTERPRETER_GIL_SUPPORTED is a new supported value for Py_mod_multiple_interpreters, added in gh-104205.

2 years agogh-101819: Remove unused 'locale_module' from _io state (#104246)
Erlend E. Aasland [Sat, 6 May 2023 20:26:06 +0000 (22:26 +0200)] 
gh-101819: Remove unused 'locale_module' from _io state (#104246)

The locale module reference was introduced by 932ff8368 in 2013,
and rendered unused by 710e82630 (gh-23050) in 2020.

2 years agoGH-103548: Improve performance of `pathlib.Path.[is_]absolute()` (GH-103549)
Barney Gale [Sat, 6 May 2023 18:03:07 +0000 (19:03 +0100)] 
GH-103548: Improve performance of `pathlib.Path.[is_]absolute()` (GH-103549)

Improve performance of `pathlib.Path.absolute()` and `cwd()` by joining paths only when necessary. Also improve
performance of `PurePath.is_absolute()` on Posix by skipping path parsing and normalization.

2 years agogh-90953: Emit deprecation warnings for `ast` features deprecated in Python 3.8 ...
Alex Waygood [Sat, 6 May 2023 16:48:07 +0000 (17:48 +0100)] 
gh-90953: Emit deprecation warnings for `ast` features deprecated in Python 3.8 (#104199)

`ast.Num`, `ast.Str`, `ast.Bytes`, `ast.Ellipsis` and `ast.NameConstant` now all emit deprecation warnings on import, access, instantation or `isinstance()` checks.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2 years agogh-104144: Optimize gather to finish eagerly when all futures complete eagerly (...
Itamar Ostricher [Sat, 6 May 2023 15:15:27 +0000 (08:15 -0700)] 
gh-104144: Optimize gather to finish eagerly when all futures complete eagerly (#104138)

2 years agoRewrite the turtledemo makeGraphFrame method (#104224)
Terry Jan Reedy [Sat, 6 May 2023 15:09:08 +0000 (11:09 -0400)] 
Rewrite the turtledemo makeGraphFrame method (#104224)

Replace `self._canvas` and `self.scanvas`, both bound to `canvas`,
with `self.canvas, which is accessed in other methods.
Replace `_s_` with `screen` and `_s_._canvas` with `canvas`.
Add a comment explaining the unorthodox use of
function turtle.Screen and singleton class turtle._Screen.

2 years agogh-65772: Clean-up turtle module (#104218)
Terry Jan Reedy [Sat, 6 May 2023 15:04:41 +0000 (11:04 -0400)] 
gh-65772: Clean-up turtle module (#104218)

* Remove the unused, private, and undocumented name `_ver` and
the commented-out `print` call.

* Don't add math functions to `__all__`.  Beginners should learn
to `import math` to access them.

* Gregor Lindel, who wrote this version of turtle, dropped plans
to implement turtle on another toolkit at least a decade ago.
Drop `_dot` code preparing for this, but add a hint comment.

* `_Screen` is meant to be a singleton class.  To enforce that,
it needs either a `__new__` that returns the singleton or
`else...raise` in `__iter__`.  Merely removing the `if` clauses
as suggested might break something if a user were to call `_Screen`
directly.  Leave the code alone until a problem is evident.

* Turtledemo injects into _Screen both _root and _canvas,
configured as it needs them to be.  Making _canvas an `__init__`
option would require skipping some but not all of the lines under
'if _Screen._canvas is None:`.  Leave working code alone.

2 years agogh-104233: Fix "unused variable" warning in `ceval_gil.c` (#104234)
Nikita Sobolev [Sat, 6 May 2023 14:58:32 +0000 (17:58 +0300)] 
gh-104233: Fix "unused variable" warning in `ceval_gil.c` (#104234)

2 years agoGH-97950: Use new-style index directive ('builtin') (#104164)
Adam Turner [Sat, 6 May 2023 03:54:08 +0000 (04:54 +0100)] 
GH-97950: Use new-style index directive ('builtin') (#104164)

* Uncomment builtin removal in pairindextypes

* Use new-style index directive ('builtin') - C API

* Use new-style index directive ('builtin') - Extending

* Use new-style index directive ('builtin') - Library

* Use new-style index directive ('builtin') - Reference

* Use new-style index directive ('builtin') - Tutorial

2 years agogh-102215: importlib documentation cleanups
Sam Morris [Sat, 6 May 2023 02:40:19 +0000 (03:40 +0100)] 
gh-102215: importlib documentation cleanups

2 years agogh-101819: Prepare to modernize the _io extension (#104178)
Victor Stinner [Fri, 5 May 2023 23:53:55 +0000 (01:53 +0200)] 
gh-101819: Prepare to modernize the _io extension (#104178)

* Add references to static types to _PyIO_State:

  * PyBufferedIOBase_Type
  * PyBytesIOBuffer_Type
  * PyIncrementalNewlineDecoder_Type
  * PyRawIOBase_Type
  * PyTextIOBase_Type

* Add the defining class to methods:

  * _io.BytesIO.getbuffer()
  * _io.FileIO.close()

* Add get_io_state_by_cls() function.
* Add state parameter to _textiowrapper_decode()
* _io_TextIOWrapper___init__() now sets self->state before calling
  _textiowrapper_set_decoder().

Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2 years agogh-97696: Remove redundant #include (#104216)
Jacob Bower [Fri, 5 May 2023 23:50:06 +0000 (16:50 -0700)] 
gh-97696: Remove redundant #include (#104216)

Remove "#include cpython/context.h"` from `_asynciomodule.c`.

It's already included in `Python.h`.

2 years agogh-104144: Skip scheduling a done callback if a TaskGroup task completes eagerly...
Itamar Ostricher [Fri, 5 May 2023 23:44:03 +0000 (16:44 -0700)] 
gh-104144: Skip scheduling a done callback if a TaskGroup task completes eagerly (#104140)

Co-authored-by: Carl Meyer <carl@oddbird.net>
2 years agogh-99113: Add PyInterpreterConfig.own_gil (gh-104204)
Eric Snow [Fri, 5 May 2023 21:59:20 +0000 (15:59 -0600)] 
gh-99113: Add PyInterpreterConfig.own_gil (gh-104204)

We also add PyInterpreterState.ceval.own_gil to record if the interpreter actually has its own GIL.

Note that for now we don't actually respect own_gil; all interpreters still share the one GIL.  However, PyInterpreterState.ceval.own_gil does reflect PyInterpreterConfig.own_gil.  That lie is a temporary one that we will fix when the GIL really becomes per-interpreter.

2 years agogh-104146: Remove unused var 'parser_body_declarations' from clinic.py (#104214)
Erlend E. Aasland [Fri, 5 May 2023 21:35:24 +0000 (23:35 +0200)] 
gh-104146: Remove unused var 'parser_body_declarations' from clinic.py (#104214)

2 years agogh-99113: Add Py_MOD_PER_INTERPRETER_GIL_SUPPORTED (gh-104205)
Eric Snow [Fri, 5 May 2023 21:11:27 +0000 (15:11 -0600)] 
gh-99113: Add Py_MOD_PER_INTERPRETER_GIL_SUPPORTED (gh-104205)

Here we are doing no more than adding the value for Py_mod_multiple_interpreters and using it for stdlib modules.  We will start checking for it in gh-104206 (once PyInterpreterState.ceval.own_gil is added in gh-104204).

2 years agogh-104108: Add the Py_mod_multiple_interpreters Module Def Slot (gh-104148)
Eric Snow [Fri, 5 May 2023 20:04:55 +0000 (14:04 -0600)] 
gh-104108: Add the Py_mod_multiple_interpreters Module Def Slot (gh-104148)

I'll be adding a value to indicate support for per-interpreter GIL in gh-99114.

2 years agogh-99113: Share the GIL via PyInterpreterState.ceval.gil (gh-104203)
Eric Snow [Fri, 5 May 2023 19:23:00 +0000 (13:23 -0600)] 
gh-99113: Share the GIL via PyInterpreterState.ceval.gil (gh-104203)

In preparation for a per-interpreter GIL, we add PyInterpreterState.ceval.gil, set it to the shared GIL for each interpreter, and use that rather than using _PyRuntime.ceval.gil directly.  Note that _PyRuntime.ceval.gil is still the actual GIL.

2 years agoGH-100479: Add `pathlib.PurePath.with_segments()` (GH-103975)
Barney Gale [Fri, 5 May 2023 19:04:53 +0000 (20:04 +0100)] 
GH-100479: Add `pathlib.PurePath.with_segments()` (GH-103975)

Add `pathlib.PurePath.with_segments()`, which creates a path object from arguments. This method is called whenever a derivative path is created, such as from `pathlib.PurePath.parent`. Subclasses may override this method to share information between path objects.

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2 years agogh-69152: Add _proxy_response_headers attribute to HTTPConnection (#26152)
Alexey Namyotkin [Fri, 5 May 2023 18:52:24 +0000 (21:52 +0300)] 
gh-69152: Add _proxy_response_headers attribute to HTTPConnection (#26152)

Add _proxy_response_headers attribute to HTTPConnection (#26152)

---------

Co-authored-by: Senthil Kumaran <senthil@python.org>
2 years agogh-103533: Use PEP 669 APIs for cprofile (GH-103534)
Tian Gao [Fri, 5 May 2023 17:38:47 +0000 (10:38 -0700)] 
gh-103533: Use PEP 669 APIs for cprofile (GH-103534)

2 years agoGH-96803: Add three C-API functions to make _PyInterpreterFrame less opaque for users...
Mark Shannon [Fri, 5 May 2023 16:53:07 +0000 (17:53 +0100)] 
GH-96803: Add three C-API functions to make _PyInterpreterFrame less opaque for users of PEP 523. (GH-96849)

2 years agogh-64595: Argument Clinic: Touch source file if any output file changed (#104152)
Erlend E. Aasland [Fri, 5 May 2023 12:38:38 +0000 (14:38 +0200)] 
gh-64595: Argument Clinic: Touch source file if any output file changed (#104152)