]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
2 years agoUpdate name in acknowledgements and add mailmap (#103696)
Amethyst Reese [Sun, 30 Apr 2023 03:21:20 +0000 (20:21 -0700)] 
Update name in acknowledgements and add mailmap (#103696)

I changed my name last year, and would like to update my name in the
acknowledgements and git history accordingly.

git-mailmap reference: https://git-scm.com/docs/gitmailmap

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2 years agogh-82054: allow test runner to split test_asyncio to execute in parallel by sharding...
Joshua Herman [Sun, 30 Apr 2023 01:26:24 +0000 (20:26 -0500)] 
gh-82054: allow test runner to split test_asyncio to execute in parallel by sharding. (#103927)

This runs test_asyncio sub-tests in parallel using sharding from Cinder. This suite is typically the longest-pole in runs because it is a test package with a lot of further sub-tests otherwise run serially. By breaking out the sub-tests as independent modules we can run a lot more in parallel.

After porting we can see the direct impact on a multicore system.

Without this change:
  Running make test is 5 min 26 seconds
With this change:
  Running make test takes 3 min 39 seconds

That'll vary based on system and parallelism. On a `-j 4` run similar to what CI and buildbot systems often do, it reduced the overall test suite completion latency by 10%.

The drawbacks are that this implementation is hacky and due to the sorting of the tests it obscures when the asyncio tests occur and involves changing CPython test infrastructure but, the wall time saved it is worth it, especially in low-core count CI runs as it pulls a long tail. The win for productivity and reserved CI resource usage is significant.

Future tests that deserve to be refactored into split up suites to benefit from are test_concurrent_futures and the way the _test_multiprocessing suite gets run for all start methods. As exposed by passing the -o flag to python -m test to get a list of the 10 longest running tests.

---------

Co-authored-by: Carl Meyer <carl@oddbird.net>
Co-authored-by: Gregory P. Smith <greg@krypto.org> [Google, LLC]
2 years agoRemove non-existing tools from Sundry skiplist (#103991)
Oleg Iarygin [Sat, 29 Apr 2023 19:11:15 +0000 (23:11 +0400)] 
Remove non-existing tools from Sundry skiplist (#103991)

2 years agogh-103793: Defer formatting task name (#103767)
Itamar Ostricher [Sat, 29 Apr 2023 15:20:09 +0000 (08:20 -0700)] 
gh-103793: Defer formatting task name (#103767)

The default task name is "Task-<counter>" (if no name is passed in during Task creation).
This is initialized in `Task.__init__` (C impl) using string formatting, which can be quite slow.
Actually using the task name in real world code is not very common, so this is wasted init.

Let's defer this string formatting to the first time the name is read (in `get_name` impl),
so we don't need to pay the string formatting cost if the task name is never read.

We don't change the order in which tasks are assigned numbers (if they are) --
the number is set on task creation, as a PyLong instead of a formatted string.

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2 years agogh-87092: change assembler to use instruction sequence instead of CFG (#103933)
Irit Katriel [Sat, 29 Apr 2023 11:06:04 +0000 (12:06 +0100)] 
gh-87092: change assembler to use instruction sequence instead of CFG (#103933)

2 years agogh-103636: issue warning for deprecated calendar constants (#103833)
Prince Roshan [Sat, 29 Apr 2023 07:16:46 +0000 (12:46 +0530)] 
gh-103636: issue warning for deprecated calendar constants (#103833)

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Co-authored-by: Éric <merwok@netwok.org>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2 years agoVarious small fixes to dis docs (#103923)
Jelle Zijlstra [Sat, 29 Apr 2023 07:02:21 +0000 (00:02 -0700)] 
Various small fixes to dis docs (#103923)

- Fix description of MAKE_CELL, which appeared to be inverted from the
  actual behavior
- Fix stray ".:" (sphinx-contrib/sphinx-lint#63)
- Fix inconsistent indentation
- Add some missing code blocks
- Slight style improvements

2 years agoGH-103082: Code cleanup in instrumentation code (#103474)
Mark Shannon [Sat, 29 Apr 2023 04:51:55 +0000 (05:51 +0100)] 
GH-103082: Code cleanup in instrumentation code (#103474)

2 years agogh-98040: Remove just the `imp` module (#98573)
Barry Warsaw [Fri, 28 Apr 2023 23:17:58 +0000 (16:17 -0700)] 
gh-98040: Remove just the `imp` module (#98573)

2 years agoGH-103971: Forward-port test from GH-103980 (GH-103984)
Tian Gao [Fri, 28 Apr 2023 20:25:48 +0000 (13:25 -0700)] 
GH-103971: Forward-port test from GH-103980 (GH-103984)

2 years agoGH-103944: Check error status when raising DeprecationWarning (#103949)
Paul Ganssle [Fri, 28 Apr 2023 19:44:13 +0000 (13:44 -0600)] 
GH-103944: Check error status when raising DeprecationWarning (#103949)

2 years agogh-103978: avoid using 'class' as an identifier (#103979)
Carl Meyer [Fri, 28 Apr 2023 19:20:50 +0000 (13:20 -0600)] 
gh-103978: avoid using 'class' as an identifier (#103979)

2 years agogh-101100: Add reference doc for __post_init__ (#103818)
Olga Matoula [Fri, 28 Apr 2023 19:10:26 +0000 (13:10 -0600)] 
gh-101100: Add reference doc for __post_init__ (#103818)

Signed-off-by: Olga Matoula <olgamatoula@gmail.com>
2 years agoUpdate itertool recipe: polynomial_from_roots() (GH-103973)
Raymond Hettinger [Fri, 28 Apr 2023 17:25:50 +0000 (12:25 -0500)] 
Update itertool recipe: polynomial_from_roots() (GH-103973)

2 years agoGH-103804: Add test for dis.disco (#103901)
Juhi Chandalia [Fri, 28 Apr 2023 11:11:21 +0000 (05:11 -0600)] 
GH-103804: Add test for dis.disco (#103901)

2 years agogh-100021: Document that sqlite3's executemany() discards resulting rows (#103939)
Erlend E. Aasland [Fri, 28 Apr 2023 08:02:23 +0000 (10:02 +0200)] 
gh-100021: Document that sqlite3's executemany() discards resulting rows (#103939)

2 years agoFix typo in math.log docstring (#103943)
Wes Turner [Fri, 28 Apr 2023 07:31:31 +0000 (03:31 -0400)] 
Fix typo in math.log docstring (#103943)

2 years agogh-83925: Make asyncio.subprocess communicate similar to non-asyncio (#18650)
Marek Marczykowski-Górecki [Fri, 28 Apr 2023 00:30:26 +0000 (20:30 -0400)] 
gh-83925: Make asyncio.subprocess communicate similar to non-asyncio (#18650)

subprocess's communicate(None) closes stdin of the child process, after
sending no (extra) data. Make asyncio variant do the same.
This fixes issues with processes that waits for EOF on stdin before
continuing.

2 years agogh-94673: Fix _PyTypes_InitTypes() and get_type_attr_as_size() (gh-103961)
Eric Snow [Fri, 28 Apr 2023 00:28:51 +0000 (18:28 -0600)] 
gh-94673: Fix _PyTypes_InitTypes() and get_type_attr_as_size() (gh-103961)

This change has two small parts:

1. a follow-up to gh-103940 with one case I missed
2. adding a missing return that I noticed while working on related code

2 years agogh-94673: Ensure Builtin Static Types are Readied Properly (gh-103940)
Eric Snow [Thu, 27 Apr 2023 22:19:43 +0000 (16:19 -0600)] 
gh-94673: Ensure Builtin Static Types are Readied Properly (gh-103940)

There were cases where we do unnecessary work for builtin static types. This also simplifies some work necessary for a per-interpreter GIL.

2 years agogh-102628: Fix sqlite3 CLI prompt in IDLE on Windows (#103945)
Erlend E. Aasland [Thu, 27 Apr 2023 21:22:26 +0000 (23:22 +0200)] 
gh-102628: Fix sqlite3 CLI prompt in IDLE on Windows (#103945)

2 years agoDocs: fix dunders with too many underscores (#103955)
Erlend E. Aasland [Thu, 27 Apr 2023 21:17:43 +0000 (23:17 +0200)] 
Docs: fix dunders with too many underscores (#103955)

2 years agogh-103935: Use `io.open_code()` when executing code in trace and profile modules...
Tian Gao [Thu, 27 Apr 2023 20:29:35 +0000 (13:29 -0700)] 
gh-103935: Use `io.open_code()` when executing code in trace and profile modules (GH-103947)

2 years agogh-98822: Add missing test directories to TESTSUBDIRS (#103942)
Erlend E. Aasland [Thu, 27 Apr 2023 19:43:53 +0000 (21:43 +0200)] 
gh-98822: Add missing test directories to TESTSUBDIRS (#103942)

2 years agogh-87092: update CODEOWNERS for split of compile.c to 3 files (#103941)
Irit Katriel [Thu, 27 Apr 2023 19:35:53 +0000 (20:35 +0100)] 
gh-87092: update CODEOWNERS for split of compile.c to 3 files (#103941)

2 years agogh-102628: Fix sqlite3 CLI prompt for Windows console users (#103898)
Erlend E. Aasland [Thu, 27 Apr 2023 19:23:10 +0000 (21:23 +0200)] 
gh-102628: Fix sqlite3 CLI prompt for Windows console users (#103898)

The prompt will still be incorrect in IDLE on Windows,
as IDLE uses CTRL-D for EOF on all platforms.

2 years agoGH-103903: Test the minimum Sphinx version in CI (#103904)
Adam Turner [Thu, 27 Apr 2023 18:27:38 +0000 (19:27 +0100)] 
GH-103903: Test the minimum Sphinx version in CI (#103904)

2 years agoGH-103857: Deprecate utcnow and utcfromtimestamp (#103858)
Paul Ganssle [Thu, 27 Apr 2023 17:32:30 +0000 (11:32 -0600)] 
GH-103857: Deprecate utcnow and utcfromtimestamp (#103858)

Using `datetime.datetime.utcnow()` and `datetime.datetime.utcfromtimestamp()` will now raise a `DeprecationWarning`.

We also have removed our internal uses of these functions and documented the change.

2 years agoGH-90750: Use datetime.fromisocalendar in _strptime (#103802)
Paul Ganssle [Thu, 27 Apr 2023 16:27:27 +0000 (10:27 -0600)] 
GH-90750: Use datetime.fromisocalendar in _strptime (#103802)

Use datetime.fromisocalendar in _strptime

This unifies the ISO → Gregorian conversion logic and improves handling
of invalid ISO weeks.

2 years agogh-102765: Update ntpath.isdir/isfile/islink/exists to use GetFileInformationByName... 103859/head
Finn Womack [Thu, 27 Apr 2023 14:23:26 +0000 (07:23 -0700)] 
gh-102765: Update ntpath.isdir/isfile/islink/exists to use GetFileInformationByName when available (GH-103485)

2 years agogh-103583: Isolate CJK codec modules (#103869)
Erlend E. Aasland [Thu, 27 Apr 2023 13:02:43 +0000 (15:02 +0200)] 
gh-103583: Isolate CJK codec modules (#103869)

2 years agogh-103092: Isolate _ctypes, part 1 (#103893)
Erlend E. Aasland [Thu, 27 Apr 2023 12:57:54 +0000 (14:57 +0200)] 
gh-103092: Isolate _ctypes, part 1 (#103893)

Establish global state and port the following types to heap types:

- DictRemover_Type
- PyCArg_Type
- PyCThunk_Type
- PyCField_Type
- StructParam_Type

2 years agogh-103590: do not wrap a single exception raised from a try-except* (#103665)
Irit Katriel [Thu, 27 Apr 2023 11:52:15 +0000 (12:52 +0100)] 
gh-103590: do not wrap a single exception raised from a try-except* (#103665)

2 years agogh-103607: Fix `pause_reading` to work when called from `connection_made` in `asyncio...
Itayazolay [Thu, 27 Apr 2023 10:03:29 +0000 (13:03 +0300)] 
gh-103607: Fix `pause_reading` to work when called from `connection_made` in `asyncio`. (#17425)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2 years agogh-103880: Fix `assertRaises` usage in `test_genericalias` (GH-103916)
Nikita Sobolev [Thu, 27 Apr 2023 08:54:59 +0000 (11:54 +0300)] 
gh-103880: Fix `assertRaises` usage in `test_genericalias` (GH-103916)

2 years agogh-103883: Doc: Move PyUnicode_FromObject doc (#103913)
Inada Naoki [Thu, 27 Apr 2023 05:53:11 +0000 (14:53 +0900)] 
gh-103883: Doc: Move PyUnicode_FromObject doc (#103913)

This API is one of Unicode creator APIs.

2 years agogh-89415: Add source-specific multicast constants to socket module (#103684)
Reese Hyde [Thu, 27 Apr 2023 04:05:55 +0000 (00:05 -0400)] 
gh-89415: Add source-specific multicast constants to socket module (#103684)

Add socket options for source-specific multicast when present as C #defines.

Co-authored-by: Oleg Iarygin <dralife@yandex.ru>
2 years agogh-103656: Transfer f-string buffers to parser to avoid use-after-free (GH-103896)
Lysandros Nikolaou [Thu, 27 Apr 2023 01:33:31 +0000 (19:33 -0600)] 
gh-103656: Transfer f-string buffers to parser to avoid use-after-free (GH-103896)

Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
2 years agogh-62432: unittest runner: Exit code 5 if no tests were run (#102051)
Stefano Rivera [Thu, 27 Apr 2023 01:28:46 +0000 (18:28 -0700)] 
gh-62432: unittest runner: Exit code 5 if no tests were run (#102051)

As discussed in https://discuss.python.org/t/unittest-fail-if-zero-tests-were-discovered/21498/7

It is common for test runner misconfiguration to fail to find any tests,
This should be an error.

Fixes: #62432
2 years agogh-103629: Update typing.Unpack docs in compliance with PEP 692 (#103894)
Franek Magiera [Wed, 26 Apr 2023 22:39:39 +0000 (00:39 +0200)] 
gh-103629: Update typing.Unpack docs in compliance with PEP 692 (#103894)

2 years agogh-60436: fix curses textbox backspace/del (#103783)
Aidan Melen [Wed, 26 Apr 2023 20:54:07 +0000 (14:54 -0600)] 
gh-60436: fix curses textbox backspace/del (#103783)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Michael Blahay <mblahay@gmail.com>
2 years agogh-48241: Clarify URL needs to be encoded when provided to urlopen and Request (...
Michael Blahay [Wed, 26 Apr 2023 20:52:23 +0000 (14:52 -0600)] 
gh-48241: Clarify URL needs to be encoded when provided to urlopen and Request (#103855)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2 years agoUpdate MAC_address wikipedia URL in comments (#29019)
180909 [Wed, 26 Apr 2023 20:27:03 +0000 (04:27 +0800)] 
Update MAC_address wikipedia URL in comments (#29019)

2 years agogh-103884: Docs CI: Only attempt nit-picky PR annotations for PRs (#103889)
Hugo van Kemenade [Wed, 26 Apr 2023 20:20:19 +0000 (23:20 +0300)] 
gh-103884: Docs CI: Only attempt nit-picky PR annotations for PRs (#103889)

2 years agogh-103489: Add get/set config methods to sqlite3.Connection (#103506)
Erlend E. Aasland [Wed, 26 Apr 2023 19:57:48 +0000 (21:57 +0200)] 
gh-103489: Add get/set config methods to sqlite3.Connection (#103506)

2 years agogh-103015: Add entrypoint keyword param to sqlite3.Connection.load_extension (#103073)
Erlend E. Aasland [Wed, 26 Apr 2023 19:22:03 +0000 (21:22 +0200)] 
gh-103015: Add entrypoint keyword param to sqlite3.Connection.load_extension (#103073)

2 years agogh-101879: docs - italicize argument in smtplib.SMPT() description (#101886)
Owain Davies [Wed, 26 Apr 2023 19:00:19 +0000 (02:00 +0700)] 
gh-101879: docs - italicize argument in smtplib.SMPT() description (#101886)

2 years agogh-91441: Clarify the docs of asyncio.loop.subprocess_exec() (#91442)
July Tikhonov [Wed, 26 Apr 2023 18:57:19 +0000 (21:57 +0300)] 
gh-91441: Clarify the docs of asyncio.loop.subprocess_exec() (#91442)

Clarify the docs of asyncio.loop.subprocess_exec()

Clarify the documentation of stdin, stdout and stderr arguments of
asyncio.loop.subprocess_exec().

Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
2 years agoGH-99944: Make dis display the value of oparg of KW_NAMES (#103856)
Juhi Chandalia [Wed, 26 Apr 2023 18:00:36 +0000 (12:00 -0600)] 
GH-99944: Make dis display the value of oparg of KW_NAMES (#103856)

Co-authored-by: chilaxan <chilaxan@gmail.com>
2 years agoAdd willingc to CODEOWNERS for asyncio (#103885)
Carol Willing [Wed, 26 Apr 2023 17:22:52 +0000 (11:22 -0600)] 
Add willingc to CODEOWNERS for asyncio (#103885)

2 years agoDocs build: Add upper bounds to transitive dependencies (#103860)
Alex Waygood [Wed, 26 Apr 2023 17:07:31 +0000 (11:07 -0600)] 
Docs build: Add upper bounds to transitive dependencies (#103860)

2 years agogh-103879: Fix refleak in super specialization (#103882)
Jelle Zijlstra [Wed, 26 Apr 2023 15:50:19 +0000 (08:50 -0700)] 
gh-103879: Fix refleak in super specialization (#103882)

2 years agogh-101786: Clarify docs that asyncio.Server.sockets is a socket-like TransportSocket...
Carol Willing [Wed, 26 Apr 2023 12:32:24 +0000 (06:32 -0600)] 
gh-101786: Clarify docs that asyncio.Server.sockets is a socket-like TransportSocket (#103877)

Clarify that asyncio.Server.sockets is a socket-like TransportSocket

2 years agogh-103875: Use ascii and latin1 singletons in deepfreeze (#103876)
Yichen Yan [Wed, 26 Apr 2023 11:45:58 +0000 (19:45 +0800)] 
gh-103875: Use ascii and latin1 singletons in deepfreeze (#103876)

2 years agogh-103872: Update bundled pip version to 23.1.2 (gh-103873)
Paul Moore [Wed, 26 Apr 2023 10:22:25 +0000 (11:22 +0100)] 
gh-103872: Update bundled pip version to 23.1.2 (gh-103873)

closes: #103872
xref: https://github.com/pypa/pip/pull/12000

<!-- gh-issue-number: gh-103872 -->
* Issue: gh-103872
<!-- /gh-issue-number -->

---------

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2 years agogh-74940: Allow fallback to UTF-8 encoding on systems with no locales installed ...
Gordon Messmer [Wed, 26 Apr 2023 06:33:09 +0000 (23:33 -0700)] 
gh-74940: Allow fallback to UTF-8 encoding on systems with no locales installed (GH-14925)

This change removes the alias of the 'C' locale to 'en_US'. Because of
this alias, it is currently impossible for an application to use
setlocale() to specify a UTF-8 locale on a system that has no locales
installed, but which supports the C.UTF-8 locale/encoding.

2 years agogh-103578: Fix pdb reading code with non-utf8 encoding (#103581) 31302/head
Tian Gao [Wed, 26 Apr 2023 05:04:51 +0000 (22:04 -0700)] 
gh-103578: Fix pdb reading code with non-utf8 encoding (#103581)

`pdb` should use `io.open_code` to open code to avoid encoding issue.

2 years ago gh-99352: Ensure HTTPSConnection is available before exercising https tests. (...
Senthil Kumaran [Wed, 26 Apr 2023 01:02:27 +0000 (19:02 -0600)] 
  gh-99352: Ensure HTTPSConnection is available before exercising https tests. (#103828)

gh-99352: Ensure HTTPSConnection is available before exercising https
tests.

This will fix the buildbot issue mentioned in

https://github.com/python/cpython/pull/99353

2 years agoGH-103804: Add test for dis.findlinestarts (#103806)
Juhi Chandalia [Tue, 25 Apr 2023 21:23:35 +0000 (15:23 -0600)] 
GH-103804: Add test for dis.findlinestarts (#103806)

2 years agogh-87729: specialize LOAD_SUPER_ATTR_METHOD (#103809)
Carl Meyer [Tue, 25 Apr 2023 17:45:51 +0000 (11:45 -0600)] 
gh-87729: specialize LOAD_SUPER_ATTR_METHOD (#103809)

2 years agogh-103721: Improve cross-references for generic-alias docs (#103838)
Alex Waygood [Tue, 25 Apr 2023 16:24:49 +0000 (10:24 -0600)] 
gh-103721: Improve cross-references for generic-alias docs (#103838)

Cc. @adriangb

The "stub documentation" in `types.rst` does already link to the
in-depth docs in `stdtypes.rst`, but the link isn't obvious for new
users. It deserves to be made more prominent.

- Issue: https://github.com/python/cpython/issues/103721

2 years agogh-51574: Make tempfile.mkdtemp() always return absolute paths (#94612)
Samuel Sloniker [Tue, 25 Apr 2023 16:05:59 +0000 (09:05 -0700)] 
gh-51574: Make tempfile.mkdtemp() always return absolute paths (#94612)

Co-authored-by: Éric <merwok@netwok.org>
Co-authored-by: AlexWaygood <alex.waygood@gmail.com>
2 years agogh-102950: Adjust tarfile filter tests for systems that don't set the sticky bit...
Petr Viktorin [Tue, 25 Apr 2023 12:56:01 +0000 (14:56 +0200)] 
gh-102950: Adjust tarfile filter tests for systems that don't set the sticky bit (GH-103831)

Also remove expilcit `type=tarfile.DIRTYPE`, the slash at the end is
enough.

2 years agogh-103726: Set up gcc-10 for ASAN (gh-103728)
Dong-hee Na [Tue, 25 Apr 2023 12:13:36 +0000 (21:13 +0900)] 
gh-103726: Set up gcc-10 for ASAN (gh-103728)

<!--
Thanks for your contribution!
Please read this comment in its entirety. It's quite important.

# Pull Request title

It should be in the following format:

```
gh-NNNNN: Summary of the changes made
```

Where: gh-NNNNN refers to the GitHub issue number.

Most PRs will require an issue number. Trivial changes, like fixing a
typo, do not need an issue.

# Backport Pull Request title

If this is a backport PR (PR made against branches other than `main`),
please ensure that the PR title is in the following format:

```
[X.Y] <title from the original PR> (GH-NNNN)
```

Where: [X.Y] is the branch name, e.g. [3.6].

GH-NNNN refers to the PR number from `main`.

-->

<!-- gh-issue-number: gh-103726 -->
* Issue: gh-103726
<!-- /gh-issue-number -->

2 years agoDOC: remove reference to OpenSolaris (#102671)
partev [Tue, 25 Apr 2023 10:45:18 +0000 (06:45 -0400)] 
DOC: remove reference to OpenSolaris (#102671)

2 years agogh-103826: fix unused variable warning introduced in gh-102343 (#103825)
sunmy2019 [Tue, 25 Apr 2023 10:01:04 +0000 (18:01 +0800)] 
gh-103826: fix unused variable warning introduced in gh-102343 (#103825)

2 years agogh-100227: Add a Granular Lock for _PyRuntime.imports.extensions.dict (gh-103460)
Eric Snow [Tue, 25 Apr 2023 03:09:35 +0000 (21:09 -0600)] 
gh-100227: Add a Granular Lock for _PyRuntime.imports.extensions.dict (gh-103460)

The lock is unnecessary as long as there's a GIL, but completely
necessary with a per-interpreter GIL.

2 years agogh-103636: add enums for days and months in calendar module (GH-103642)
Prince Roshan [Tue, 25 Apr 2023 02:51:27 +0000 (08:21 +0530)] 
gh-103636: add enums for days and months in calendar module (GH-103642)

Convert day contants to a Day enum, and add a Month enum.

2 years agogh-103718: Correctly set f-string buffers in all cases (GH-103815)
Lysandros Nikolaou [Tue, 25 Apr 2023 01:31:21 +0000 (19:31 -0600)] 
gh-103718: Correctly set f-string buffers in all cases (GH-103815)

Turns out we always need to remember/restore fstring buffers in all of
the stack of tokenizer modes, cause they might change to
`TOK_REGULAR_MODE` and have newlines inside the braces (which is when we
need to reallocate the buffer and restore the fstring ones).

2 years agogh-82814: fix shutil access error on WSL (#103790)
Allan Lago [Tue, 25 Apr 2023 00:45:38 +0000 (18:45 -0600)] 
gh-82814: fix shutil access error on WSL (#103790)

gh-82814: Adds `errno.EACCES` to the list of ignored errors on
`_copyxattr`.  EPERM and EACCES are different constants but
in general should be treated the same.

News entry authored by: Gregory P. Smith <greg@krypto.org>

2 years agoAlso fail DO-NOT-MERGE when "awaiting changes" or "awaiting change review" present...
Łukasz Langa [Mon, 24 Apr 2023 23:49:50 +0000 (01:49 +0200)] 
Also fail DO-NOT-MERGE when "awaiting changes" or "awaiting change review" present on PR (#103807)

"awaiting changes" means somebody put a review that requested changes.

"awaiting change review" means that the PR author published changes
after a red review and then requested a re-review.

2 years agogh-103765: Remove pkgutil.rst from .nitignore (GH-103797)
Jaime Alonso Lorenzo [Mon, 24 Apr 2023 23:42:43 +0000 (17:42 -0600)] 
gh-103765: Remove pkgutil.rst from .nitignore (GH-103797)

2 years agogh-103810: Fix broken references in dataclasses (#103811)
Olga Matoula [Mon, 24 Apr 2023 23:26:18 +0000 (17:26 -0600)] 
gh-103810: Fix broken references in dataclasses (#103811)

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2 years agoGH-103805: Lib test f541 linting issue fix (#103812)
Rodolfo M. Pereira [Mon, 24 Apr 2023 23:24:49 +0000 (17:24 -0600)] 
GH-103805: Lib test f541 linting issue fix (#103812)

This PR makes some minor linting adjustments to the Lib/test module
caught by [ruff](https://github.com/charliermarsh/ruff). The adjustments
are all related to the `F541 f-string without any placeholders` issue.

Issue: https://github.com/python/cpython/issues/103805

<!-- gh-issue-number: gh-103805 -->
* Issue: gh-103805
<!-- /gh-issue-number -->

---------

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2 years agogh-101659: Isolate "obmalloc" State to Each Interpreter (gh-101660)
Eric Snow [Mon, 24 Apr 2023 23:23:57 +0000 (17:23 -0600)] 
gh-101659: Isolate "obmalloc" State to Each Interpreter (gh-101660)

This is strictly about moving the "obmalloc" runtime state from
`_PyRuntimeState` to `PyInterpreterState`.  Doing so improves isolation
between interpreters, specifically most of the memory (incl. objects)
allocated for each interpreter's use.  This is important for a
per-interpreter GIL, but such isolation is valuable even without it.

FWIW, a per-interpreter obmalloc is the proverbial
canary-in-the-coalmine when it comes to the isolation of objects between
interpreters.  Any object that leaks (unintentionally) to another
interpreter is highly likely to cause a crash (on debug builds at
least).  That's a useful thing to know, relative to interpreter
isolation.

2 years agogh-103801: Tools/wasm linting and formatting (#103796)
Daniel Versoza [Mon, 24 Apr 2023 22:42:02 +0000 (19:42 -0300)] 
gh-103801: Tools/wasm linting and formatting (#103796)

This PR makes three minor linting adjustments to the `wasm` module
caught by [ruff](https://github.com/charliermarsh/ruff).

<!-- gh-issue-number: gh-103801 -->
* Issue: gh-103801
<!-- /gh-issue-number -->

---------

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2 years agogh-103673: Add missing ForkingUnixStreamServer and ForkingUnixDatagramServer socketse...
jb2170 [Mon, 24 Apr 2023 22:35:52 +0000 (23:35 +0100)] 
gh-103673: Add missing ForkingUnixStreamServer and ForkingUnixDatagramServer socketservers (#103674)

sockserver gains ForkingUnixStreamServer and ForkingUnixDatagramServer classes for consistency with all of the others. Ironically these existed but were buried in our test suite.

Addresses #103673

<!-- gh-issue-number: gh-103673 -->
* Issue: gh-103673
<!-- /gh-issue-number -->

---------

Co-authored-by: Gregory P. Smith <greg@krypto.org>
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2 years agogh-95795: Move types.next_version_tag to PyInterpreterState (gh-102343)
Eric Snow [Mon, 24 Apr 2023 22:30:13 +0000 (16:30 -0600)] 
gh-95795: Move types.next_version_tag to PyInterpreterState (gh-102343)

Core static types will continue to use the global value.  All other types
will use the per-interpreter value.  They all share the same range, where
the global types use values < 2^16 and each interpreter uses values
higher than that.

2 years agogh-87729: add LOAD_SUPER_ATTR instruction for faster super() (#103497)
Carl Meyer [Mon, 24 Apr 2023 22:22:14 +0000 (16:22 -0600)] 
gh-87729: add LOAD_SUPER_ATTR instruction for faster super() (#103497)

This speeds up `super()` (by around 85%, for a simple one-level
`super().meth()` microbenchmark) by avoiding allocation of a new
single-use `super()` object on each use.

2 years agogh-103791: Make contextlib.suppress also act on exceptions within an ExceptionGroup...
Łukasz Langa [Mon, 24 Apr 2023 22:17:02 +0000 (00:17 +0200)] 
gh-103791: Make contextlib.suppress also act on exceptions within an ExceptionGroup (#103792)

Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
2 years agogh-100227: Only Use deepfreeze for the Main Interpreter (gh-103794)
Eric Snow [Mon, 24 Apr 2023 21:48:05 +0000 (15:48 -0600)] 
gh-100227: Only Use deepfreeze for the Main Interpreter (gh-103794)

Deep-frozen code objects are cannot be shared (currently) by
interpreters, due to how adaptive specialization can modify the
bytecodes. We work around this by only using the deep-frozen objects in
the main interpreter. This does incur a performance penalty for
subinterpreters, which we may be able to resolve later.

2 years agogh-103492: Clarify SyntaxWarning with literal comparison (#103493)
Shantanu [Mon, 24 Apr 2023 21:42:57 +0000 (15:42 -0600)] 
gh-103492: Clarify SyntaxWarning with literal comparison (#103493)

2 years agogh-101100: Fix Sphinx warnings in `argparse` module (#103289)
Hugo van Kemenade [Mon, 24 Apr 2023 21:36:32 +0000 (15:36 -0600)] 
gh-101100: Fix Sphinx warnings in `argparse` module (#103289)

Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
2 years agogh-101517: fix line number propagation in code generated for except* (#103550)
Irit Katriel [Mon, 24 Apr 2023 20:58:51 +0000 (14:58 -0600)] 
gh-101517: fix line number propagation in code generated for except* (#103550)

2 years agogh-103780: Use patch instead of mock in asyncio unix events test (#103782)
Itamar Ostricher [Mon, 24 Apr 2023 20:12:48 +0000 (13:12 -0700)] 
gh-103780: Use patch instead of mock in asyncio unix events test (#103782)

2 years agogh-102498 Clean up unused variables and imports in the email module (#102482)
JosephSBoyle [Mon, 24 Apr 2023 19:19:28 +0000 (20:19 +0100)] 
gh-102498 Clean up unused variables and imports in the email module  (#102482)

* Clean up unused variables and imports in the email module

* Remove extra newline char

* Remove superflous dict+unpacking syntax

* Remove unused 'msg' var

* Clean up unused variables and imports in the email module

* Remove extra newline char

* Remove superflous dict+unpacking syntax

* Remove unused 'msg' var

---------

Co-authored-by: Barry Warsaw <barry@python.org>
2 years agogh-99184: Bypass instance attribute access in `repr` of `weakref.ref` (#99244)
Nikita Sobolev [Mon, 24 Apr 2023 18:57:36 +0000 (21:57 +0300)] 
gh-99184: Bypass instance attribute access in `repr` of `weakref.ref` (#99244)

2 years agogh-99032: datetime docs: Encoding is no longer relevant (#93365)
William Andrea [Mon, 24 Apr 2023 18:54:16 +0000 (14:54 -0400)] 
gh-99032: datetime docs: Encoding is no longer relevant (#93365)

This removes a section of the `strftime` and `strptime` documentation that refers to a bygone era when `strftime` would return an encoded byte string.

---------

Co-authored-by: Paul Ganssle <1377457+pganssle@users.noreply.github.com>
2 years agogh-94300: Update datetime.strptime documentation (#95318)
Howie Zhao [Mon, 24 Apr 2023 18:35:15 +0000 (02:35 +0800)] 
gh-94300: Update datetime.strptime documentation (#95318)

The new wording better reflects the cases where `datetime.strptime` differs from` time.strptime`.

---------

Co-authored-by: Paul Ganssle <git@m.ganssle.io>
2 years agogh-103776: Remove explicit uses of $(SHELL) from Makefile (GH-103778)
Zachary Ware [Mon, 24 Apr 2023 18:31:43 +0000 (13:31 -0500)] 
gh-103776: Remove explicit uses of $(SHELL) from Makefile (GH-103778)

This avoids conflicting with the shebang of the called scripts as well
as avoiding hard errors on platforms where the called script runs a
failing unchecked command in the usual course of checking since
`SHELL=/bin/sh -e` as of a90863c.

Fixes gh-103776.

2 years agogh-87092: fix a few cases of incorrect error handling in compiler (#103456)
Irit Katriel [Mon, 24 Apr 2023 18:30:49 +0000 (12:30 -0600)] 
gh-87092: fix a few cases of incorrect error handling in compiler (#103456)

gh-87092: fix a few cases of incorrect error handling

2 years agoGH-103727: Avoid advancing tokenizer too far in f-string mode (GH-103775)
Lysandros Nikolaou [Mon, 24 Apr 2023 18:30:21 +0000 (12:30 -0600)] 
GH-103727: Avoid advancing tokenizer too far in f-string mode (GH-103775)

2 years agoRevert "Add tests for empty range equality (#103751)" (#103770)
Terry Jan Reedy [Mon, 24 Apr 2023 18:29:57 +0000 (14:29 -0400)] 
Revert "Add tests for empty range equality (#103751)" (#103770)

This reverts commit dca27a69a8261353f7f986eb8f808f0d487ac4b7.
Added tests are redundant with existing tests.

2 years agogh-94518: Port 23-argument `_posixsubprocess.fork_exec` to Argument Clinic (#94519)
Oleg Iarygin [Mon, 24 Apr 2023 18:27:48 +0000 (22:27 +0400)] 
gh-94518: Port 23-argument `_posixsubprocess.fork_exec` to Argument Clinic (#94519)

Convert fork_exec to pre-inlined-argparser Argument Clinic

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2 years agoGH-65022: Fix description of copyreg.pickle function (#102656)
Furkan Onder [Mon, 24 Apr 2023 17:26:40 +0000 (20:26 +0300)] 
GH-65022: Fix description of copyreg.pickle function (#102656)

Fix description of copyreg.pickle function

2 years agogh-103323: Get the "Current" Thread State from a Thread-Local Variable (gh-103324)
Eric Snow [Mon, 24 Apr 2023 17:17:02 +0000 (11:17 -0600)] 
gh-103323: Get the "Current" Thread State from a Thread-Local Variable (gh-103324)

We replace _PyRuntime.tstate_current with a thread-local variable. As part of this change, we add a _Py_thread_local macro in pyport.h (only for the core runtime) to smooth out the compiler differences. The main motivation here is in support of a per-interpreter GIL, but this change also provides some performance improvement opportunities.

Note that we do not provide a fallback to the thread-local, either falling back to the old tstate_current or to thread-specific storage (PyThread_tss_*()). If that proves problematic then we can circle back. I consider it unlikely, but will run the buildbots to double-check.

Also note that this does not change any of the code related to the GILState API, where it uses a thread state stored in thread-specific storage. I suspect we can combine that with _Py_tss_tstate (from here). However, that can be addressed separately and is not urgent (nor critical).

(While this change was mostly done independently, I did take some inspiration from earlier (~2020) work by @markshannon (main...markshannon:threadstate_in_tls) and @vstinner (#23976).)

2 years agogh-91687: modernize dataclass example typing (#103773)
Allan Lago [Mon, 24 Apr 2023 17:16:23 +0000 (11:16 -0600)] 
gh-91687: modernize dataclass example typing (#103773)

modernize dataclass example typing `list` rather than `List` and comment as to that line being the alluded too error.

2 years agogh-103746: Test `types.UnionType` and `Literal` types together (#103747)
Nikita Sobolev [Mon, 24 Apr 2023 16:55:16 +0000 (19:55 +0300)] 
gh-103746: Test `types.UnionType` and `Literal` types together (#103747)

2 years agogh-103765: Fix 'Warning: py:class reference target not found: ModuleSpec' (GH-103769)
Jaime Alonso Lorenzo [Mon, 24 Apr 2023 16:51:45 +0000 (10:51 -0600)] 
gh-103765: Fix 'Warning: py:class reference target not found: ModuleSpec' (GH-103769)

2 years agogh-87452: Improve the Popen.returncode docs
Joshua Herman [Mon, 24 Apr 2023 16:46:12 +0000 (10:46 -0600)] 
gh-87452: Improve the Popen.returncode docs

Clarifies that it remains None until a method checking the child process status has been called and noticed it has terminated.