]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
17 months agogh-119819: Conditional skip of logging tests that require multiprocessing subprocess...
Russell Keith-Magee [Sat, 15 Jun 2024 00:05:18 +0000 (08:05 +0800)] 
gh-119819: Conditional skip of logging tests that require multiprocessing subprocess support (#120476)

Skip tests that require multiprocessing subprocess support.

17 months agogh-120524: Temporarily Skip test_create_many_threaded In test_interpreters.test_stres...
Eric Snow [Fri, 14 Jun 2024 22:12:35 +0000 (18:12 -0400)] 
gh-120524: Temporarily Skip test_create_many_threaded In test_interpreters.test_stress (gh-120525)

17 months agogh-120161: Fix a Crash in the _datetime Module (gh-120182)
Eric Snow [Fri, 14 Jun 2024 19:29:09 +0000 (15:29 -0400)] 
gh-120161: Fix a Crash in the _datetime Module (gh-120182)

In gh-120009 I used an atexit hook to finalize the _datetime module's static types at interpreter shutdown.  However, atexit hooks are executed very early in finalization, which is a problem in the few cases where a subclass of one of those static types is still alive until the final GC collection.  The static builtin types don't have this probably because they are finalized toward the end, after the final GC collection.  To avoid the problem for _datetime, I have applied a similar approach here.

Also, credit goes to @mgorny and @neonene for the new tests.

FYI, I would have liked to take a slightly cleaner approach with managed static types, but wanted to get a smaller fix in first for the sake of backporting.  I'll circle back to the cleaner approach with a future change on the main branch.

17 months agogh-120417: Fix "imported but unused" linter warnings (#120461)
Victor Stinner [Fri, 14 Jun 2024 18:39:50 +0000 (20:39 +0200)] 
gh-120417: Fix "imported but unused" linter warnings (#120461)

Add __all__ to the following modules:
importlib.machinery, importlib.util and xml.sax.

Add also "# noqa: F401" in collections.abc,
subprocess and xml.sax.

* Sort __all__; remove collections.abc.__all__; remove private names

* Add tests

17 months agogh-119824: Print stack entry when user input is needed (#119882)
Tian Gao [Fri, 14 Jun 2024 18:25:23 +0000 (11:25 -0700)] 
gh-119824: Print stack entry when user input is needed (#119882)

Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
17 months agogh-120361: Add `nonmember` test with enum flags inside to `test_enum` (GH-120364)
Nikita Sobolev [Fri, 14 Jun 2024 17:25:35 +0000 (20:25 +0300)] 
gh-120361: Add `nonmember` test with enum flags inside to `test_enum` (GH-120364)

* gh-120361: Add `nonmember` test with enum flags inside to `test_enum`

17 months agoGH-73991: Add `pathlib.Path.copy()` (#119058)
Barney Gale [Fri, 14 Jun 2024 16:15:49 +0000 (17:15 +0100)] 
GH-73991: Add `pathlib.Path.copy()` (#119058)

Add a `Path.copy()` method that copies the content of one file to another.

This method is similar to `shutil.copyfile()` but differs in the following ways:

- Uses `fcntl.FICLONE` where available (see GH-81338)
- Uses `os.copy_file_range` where available (see GH-81340)
- Uses `_winapi.CopyFile2` where available, even though this copies more metadata than the other implementations. This makes `WindowsPath.copy()` more similar to `shutil.copy2()`.

The method is presently _less_ specified than the `shutil` functions to allow OS-specific optimizations that might copy more or less metadata.

Incorporates code from GH-81338 and GH-93152.

Co-authored-by: Eryk Sun <eryksun@gmail.com>
17 months agogh-117657: Add TSAN suppression for set_default_allocator_unlocked (#120500)
AN Long [Fri, 14 Jun 2024 16:10:18 +0000 (00:10 +0800)] 
gh-117657: Add TSAN suppression for set_default_allocator_unlocked (#120500)

Add TSAN suppression for set_default_allocator_unlocked

17 months agoUpdate tests for the itertools docs rough equivalents (#120509)
Raymond Hettinger [Fri, 14 Jun 2024 16:00:46 +0000 (11:00 -0500)] 
Update tests for the itertools docs rough equivalents (#120509)

17 months agoStronger tests for the statistics kernel formulas (gh-120506)
Raymond Hettinger [Fri, 14 Jun 2024 15:21:35 +0000 (10:21 -0500)] 
Stronger tests for the statistics kernel formulas (gh-120506)

17 months agogh-114053: Fix bad interaction of PEP 695, PEP 563 and `inspect.get_annotations`...
Alex Waygood [Thu, 13 Jun 2024 21:16:40 +0000 (22:16 +0100)] 
gh-114053: Fix bad interaction of PEP 695, PEP 563 and `inspect.get_annotations` (#120270)

17 months agoGH-119054: Add "Renaming and deleting" section to pathlib docs. (#120465)
Barney Gale [Thu, 13 Jun 2024 20:25:26 +0000 (21:25 +0100)] 
GH-119054: Add "Renaming and deleting" section to pathlib docs. (#120465)

Add dedicated subsection for `pathlib.Path.rename()`, `replace()`,
`unlink()` and `rmdir()`.

17 months agogh-120012: clarify the behaviour of `multiprocessing.Queue.empty` on closed queues...
Bénédikt Tran [Thu, 13 Jun 2024 19:03:01 +0000 (21:03 +0200)] 
gh-120012: clarify the behaviour of `multiprocessing.Queue.empty` on closed queues. (GH-120102)

* improve doc for `multiprocessing.Queue.empty`
* add tests for checking emptiness of queues

Co-authored-by: Gregory P. Smith <greg@krypto.org>
17 months agoAdd codeowner for Makefile.pre.in and Modules/Setup* (#120468)
Erlend E. Aasland [Thu, 13 Jun 2024 19:01:05 +0000 (21:01 +0200)] 
Add codeowner for Makefile.pre.in and Modules/Setup* (#120468)

17 months agogh-117398: Add datetime C-API type check test for subinterpreters (gh-119604)
neonene [Thu, 13 Jun 2024 18:05:03 +0000 (03:05 +0900)] 
gh-117398: Add datetime C-API type check test for subinterpreters (gh-119604)

Check if the DateTime C-API type matches the datetime.date type on main and shared/isolated subinterpreters.

17 months agoGH-119054: Add "Creating files and directories" section to pathlib docs. (#120186)
Barney Gale [Thu, 13 Jun 2024 17:58:46 +0000 (18:58 +0100)] 
GH-119054: Add "Creating files and directories" section to pathlib docs. (#120186)

Add dedicated subsection for `pathlib.Path.touch()`, `mkdir()`,
`symlink_to()` and `hardlink_to()`. Also note that `open()`, `write_text()`
and `write_bytes()` are often used to create files.

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
17 months agogh-120397: Fix typo in NEWS entry (#120455)
Kirill Podoprigora [Thu, 13 Jun 2024 16:53:45 +0000 (19:53 +0300)] 
gh-120397: Fix typo in NEWS entry (#120455)

17 months agogh-120397: Optimize str.count() for single characters (#120398)
Ruben Vorderman [Thu, 13 Jun 2024 14:28:59 +0000 (16:28 +0200)] 
gh-120397: Optimize str.count() for single characters (#120398)

17 months agogh-120417: Add #noqa to used imports in the stdlib (#120421)
Victor Stinner [Thu, 13 Jun 2024 14:14:50 +0000 (16:14 +0200)] 
gh-120417: Add #noqa to used imports in the stdlib (#120421)

Tools such as ruff can ignore "imported but unused" warnings if a
line ends with "# noqa: F401". It avoids the temptation to remove
an import which is used effectively.

17 months agogh-119146: Update ``regexp`` in `build.yml` to not trigger the jobs on `*.md` and...
Kirill Podoprigora [Thu, 13 Jun 2024 11:38:31 +0000 (14:38 +0300)] 
gh-119146: Update ``regexp`` in `build.yml` to not trigger the jobs on `*.md` and `*.ini` files. (#120435)

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
17 months agoFix typos in documentation (GH-120440)
Xie Yanbo [Thu, 13 Jun 2024 09:37:21 +0000 (17:37 +0800)] 
Fix typos in documentation (GH-120440)

17 months agogh-117657: Fix some simple races in instrumentation.c (GH-120118)
Ken Jin [Thu, 13 Jun 2024 09:31:21 +0000 (17:31 +0800)] 
gh-117657: Fix some simple races in instrumentation.c (GH-120118)

* stop the world when setting local events

17 months agogh-117657: Make PyType_HasFeature atomic (GH-120210)
Ken Jin [Thu, 13 Jun 2024 09:29:19 +0000 (17:29 +0800)] 
gh-117657: Make PyType_HasFeature atomic (GH-120210)

Make PyType_HasFeature atomic

17 months agogh-120418: Don't assume wheeldata is deleted if `WHEEL_PKG_DIR` is set (#120419)
Stefano Rivera [Wed, 12 Jun 2024 19:19:36 +0000 (12:19 -0700)] 
gh-120418: Don't assume wheeldata is deleted if `WHEEL_PKG_DIR` is set (#120419)

Remove wheeldata from both sides of the `assertEqual`, so that we're
*actually* ignoring it from the test set.

This test is only making assertions about the source tree, no code is
being executed that would do anything different based on the value of
`WHEEL_PKG_DIR`.

17 months agogh-118908: Protect the REPL subprocess with a timeout in tests (#120408)
Pablo Galindo Salgado [Wed, 12 Jun 2024 19:09:25 +0000 (20:09 +0100)] 
gh-118908: Protect the REPL subprocess with a timeout in tests (#120408)

17 months agogh-120417: Remove unused imports in the stdlib (#120420)
Victor Stinner [Wed, 12 Jun 2024 18:56:42 +0000 (20:56 +0200)] 
gh-120417: Remove unused imports in the stdlib (#120420)

17 months agogh-120343: Fix column offsets of multiline tokens in tokenize (#120391)
Lysandros Nikolaou [Wed, 12 Jun 2024 18:52:55 +0000 (20:52 +0200)] 
gh-120343: Fix column offsets of multiline tokens in tokenize (#120391)

17 months agogh-71587: Drop local reference cache to `_strptime` module in `_datetime` (gh-120224)
neonene [Wed, 12 Jun 2024 16:46:39 +0000 (01:46 +0900)] 
gh-71587: Drop local reference cache to `_strptime` module in `_datetime` (gh-120224)

The _strptime module object was cached in a static local variable (in the datetime.strptime() implementation).  That's a problem when it crosses isolation boundaries, such as reinitializing the runtme or between interpreters.  This change fixes the problem by dropping the static variable, instead always relying on the normal sys.modules cache (via PyImport_Import()).

17 months agogh-120388: Improve deprecation warning message, when test returns non-None (#120401)
Nikita Sobolev [Wed, 12 Jun 2024 14:50:58 +0000 (17:50 +0300)] 
gh-120388: Improve deprecation warning message, when test returns non-None (#120401)

Co-authored-by: Alex Waygood <alex.waygood@gmail.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
17 months agogh-120345: Fix incorrect use of the :class: role with the "()" suffix (GH-120347)
Serhiy Storchaka [Wed, 12 Jun 2024 14:23:03 +0000 (17:23 +0300)] 
gh-120345: Fix incorrect use of the :class: role with the "()" suffix (GH-120347)

* Remove "()" when refer to a class as a type.
* Use :func: when refer to a callable.
* Fix reference to the datetime.astimezone() method.

17 months agogh-120155: Add assertion to sre.c match_getindex() (#120402)
Victor Stinner [Wed, 12 Jun 2024 13:27:07 +0000 (15:27 +0200)] 
gh-120155: Add assertion to sre.c match_getindex() (#120402)

Add an assertion to help static analyzers to detect that i*2 cannot
overflow.

17 months agogh-120400 :Support Linux perf profile to see Python calls on RISC-V architecture...
ixgbe00 [Wed, 12 Jun 2024 13:24:46 +0000 (21:24 +0800)] 
gh-120400 :Support Linux perf profile to see Python calls on RISC-V architecture (#120089)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
17 months agogh-120029: remove unused macros in ``symtable.c`` (#120222)
Bénédikt Tran [Wed, 12 Jun 2024 13:23:45 +0000 (15:23 +0200)] 
gh-120029: remove unused macros in ``symtable.c`` (#120222)

Co-authored-by: Carl Meyer <carl@oddbird.net>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
17 months agogh-117657: Make Py_TYPE and Py_SET_TYPE thread safe (GH-120165)
Ken Jin [Wed, 12 Jun 2024 12:41:07 +0000 (20:41 +0800)] 
gh-117657: Make Py_TYPE and Py_SET_TYPE thread safe (GH-120165)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Nadeshiko Manju <me@manjusaka.me>
17 months agoFix typos in documentation (#120338)
Xie Yanbo [Wed, 12 Jun 2024 12:24:43 +0000 (20:24 +0800)] 
Fix typos in documentation (#120338)

17 months agogh-93691: fix too broad source locations of for statement iterators (#120330)
Irit Katriel [Wed, 12 Jun 2024 11:53:19 +0000 (12:53 +0100)] 
gh-93691: fix too broad source locations of for statement iterators (#120330)

17 months agogh-120029: make `symtable.Symbol.__repr__` correctly reflect the compiler's flags...
Bénédikt Tran [Wed, 12 Jun 2024 11:14:50 +0000 (13:14 +0200)] 
gh-120029: make `symtable.Symbol.__repr__` correctly reflect the compiler's flags, add methods  (#120099)

Expose :class:`symtable.Symbol` methods :meth:`~symtable.Symbol.is_free_class`,
:meth:`~symtable.Symbol.is_comp_iter` and :meth:`~symtable.Symbol.is_comp_cell`.

---------

Co-authored-by: Carl Meyer <carl@oddbird.net>
17 months agogh-101575: document Decimal.__round__() (GH-101737)
Owain Davies [Wed, 12 Jun 2024 10:07:25 +0000 (17:07 +0700)] 
gh-101575: document Decimal.__round__() (GH-101737)

17 months agogh-118908: Fix completions after namespace change in REPL (#120370)
Lysandros Nikolaou [Wed, 12 Jun 2024 08:21:53 +0000 (10:21 +0200)] 
gh-118908: Fix completions after namespace change in REPL (#120370)

17 months agogh-120385: Fix reference leak in symtable (#120386)
Kirill Podoprigora [Wed, 12 Jun 2024 07:37:14 +0000 (10:37 +0300)] 
gh-120385: Fix reference leak in symtable (#120386)

Decref 'new_ste' if symtable_visit_annotations() fails.

17 months agogh-120056: Add `IP_RECVERR`, `IP_RECVORIGDSTADDR`, `IP_RECVTTL` to `socket` module...
Nikita Sobolev [Wed, 12 Jun 2024 01:00:56 +0000 (04:00 +0300)] 
gh-120056: Add `IP_RECVERR`, `IP_RECVORIGDSTADDR`, `IP_RECVTTL` to `socket` module (#120058)

* gh-120056: Add `IP_RECVERR` and `IP_RECVTTL` to `socket` module

* Fix news

* Address review

* Update NEWS

17 months agogh-120221: Deliver real singals on Ctrl-C and Ctrl-Z in the new REPL (#120354)
Pablo Galindo Salgado [Tue, 11 Jun 2024 19:20:25 +0000 (20:20 +0100)] 
gh-120221: Deliver real singals on Ctrl-C and Ctrl-Z in the new REPL (#120354)

17 months agogh-120198: Fix race condition when editing __class__ with an audit hook active (GH...
Ken Jin [Tue, 11 Jun 2024 19:10:23 +0000 (03:10 +0800)] 
gh-120198: Fix race condition when editing __class__ with an audit hook active (GH-120195)

17 months agogh-120326: Include <intrin.h> on Windows with Free Threading (#120329)
Kirill Podoprigora [Tue, 11 Jun 2024 17:50:21 +0000 (20:50 +0300)] 
gh-120326: Include <intrin.h> on Windows with Free Threading (#120329)

17 months agogh-118908: Limit exposed globals from internal imports and definitions on new REPL...
Eugene Triguba [Tue, 11 Jun 2024 17:40:31 +0000 (13:40 -0400)] 
gh-118908: Limit exposed globals from internal imports and definitions on new REPL startup (#119547)

17 months agoFix typo in ElementTree docs (#120342)
naglis [Tue, 11 Jun 2024 17:01:48 +0000 (20:01 +0300)] 
Fix typo in ElementTree docs (#120342)

17 months agogh-120343: Do not reset byte_col_offset_diff after multiline tokens (#120352)
Lysandros Nikolaou [Tue, 11 Jun 2024 17:00:53 +0000 (19:00 +0200)] 
gh-120343: Do not reset byte_col_offset_diff after multiline tokens (#120352)

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
17 months agogh-119517: Fixes for pasting in pyrepl (#120253)
Matt Wozniski [Tue, 11 Jun 2024 16:42:10 +0000 (12:42 -0400)] 
gh-119517: Fixes for pasting in pyrepl (#120253)

* Remove pyrepl's optimization for self-insert

This will be replaced by a less specialized optimization.

* Use line-buffering when pyrepl echoes pastes

Previously echoing was totally suppressed until the entire command had
been pasted and the terminal ended paste mode, but this gives the user
no feedback to indicate that an operation is in progress. Drawing
something to the screen once per line strikes a balance between
perceived responsiveness and performance.

* Remove dead code from pyrepl

`msg_at_bottom` is always true.

* Speed up pyrepl's screen rendering computation

The Reader in pyrepl doesn't hold a complete representation of the
screen area being drawn as persistent state. Instead, it recomputes it,
on each keypress. This is fast enough for a few hundred bytes, but
incredibly slow as the input buffer grows into the kilobytes (likely
because of pasting).

Rather than making some expensive and expansive changes to the repl's
internal representation of the screen, add some caching: remember some
data from one refresh to the next about what was drawn to the screen
and, if we don't find anything that has invalidated the results that
were computed last time around, reuse them. To keep this caching as
simple as possible, all we'll do is look for lines in the buffer that
were above the cursor the last time we were asked to update the screen,
and that are still above the cursor now. We assume that nothing can
affect a line that comes before both the old and new cursor location
without us being informed. Based on this assumption, we can reuse old
lines, which drastically speeds up the overwhelmingly common case where
the user is typing near the end of the buffer.

* Speed up pyrepl prompt drawing

Cache the `can_colorize()` call rather than repeatedly recomputing it.
This call looks up an environment variable, and is called once per
character typed at the REPL. The environment variable lookup shows up as
a hot spot when profiling, and we don't expect this to change while the
REPL is running.

* Speed up pasting multiple lines into the REPL

Previously, we were checking whether the command should be accepted each
time a line break was encountered, but that's not the expected behavior.
In bracketed paste mode, we expect everything pasted to be part of
a single block of code, and encountering a newline shouldn't behave like
a user pressing <Enter> to execute a command. The user should always
have a chance to review the pasted command before running it.

* Use a read buffer for input in pyrepl

Previously we were reading one byte at a time, which causes much slower
IO than necessary. Instead, read in chunks, processing previously read
data before asking for more.

* Optimize finding width of a single character

`wlen` finds the width of a multi-character string by adding up the
width of each character, and then subtracting the width of any escape
sequences. It's often called for single character strings, however,
which can't possibly contain escape sequences. Optimize for that case.

* Optimize disp_str for ASCII characters

Since every ASCII character is known to display as single width, we can
avoid not only the Unicode data lookup in `disp_str` but also the one
hidden in `str_width` for them.

* Speed up cursor movements in long pyrepl commands

When the current pyrepl command buffer contains many lines, scrolling up
becomes slow. We have optimizations in place to reuse lines above the
cursor position from one refresh to the next, but don't currently try to
reuse lines below the cursor position in the same way, so we wind up
with quadratic behavior where all lines of the buffer below the cursor
are recomputed each time the cursor moves up another line.

Optimize this by only computing one screen's worth of lines beyond the
cursor position. Any lines beyond that can't possibly be shown by the
console, and bounding this makes scrolling up have linear time
complexity instead.

---------

Signed-off-by: Matt Wozniski <mwozniski@bloomberg.net>
Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
17 months agogh-120346: Respect PYTHON_BASIC_REPL when running in interactive inspect mode (#120349)
Pablo Galindo Salgado [Tue, 11 Jun 2024 16:15:01 +0000 (17:15 +0100)] 
gh-120346: Respect PYTHON_BASIC_REPL when running in interactive inspect mode (#120349)

17 months agogh-119180: PEP 649 compiler changes (#119361)
Jelle Zijlstra [Tue, 11 Jun 2024 13:06:49 +0000 (07:06 -0600)] 
gh-119180: PEP 649 compiler changes (#119361)

17 months agogh-120080: Mark test_round_with_none_arg_direct_call as cpython_only (#120328)
Kirill Podoprigora [Tue, 11 Jun 2024 07:56:38 +0000 (10:56 +0300)] 
gh-120080: Mark test_round_with_none_arg_direct_call as cpython_only (#120328)

17 months agogh-120291: Fix a bashism in python-config.sh.in (#120292)
Michał Górny [Tue, 11 Jun 2024 07:11:13 +0000 (09:11 +0200)] 
gh-120291: Fix a bashism in python-config.sh.in (#120292)

gh-120291: Fix bashisms in python-config.sh.in

Replace the use of bash-specific `[[ ... ]]` with POSIX-compliant
`[ ... ]` to make the `python-config` shell script work with non-bash
shells again.  While at it, use `local` in a safer way, since it is
not in POSIX either (though universally supported).

Fixes #120291

17 months agogh-120298: Fix use-after-free in `list_richcompare_impl` (#120303)
Nikita Sobolev [Tue, 11 Jun 2024 07:04:27 +0000 (10:04 +0300)] 
gh-120298: Fix use-after-free in `list_richcompare_impl` (#120303)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
17 months agogh-65454: avoid triggering call to a PropertyMock in NonCallableMock.__setattr__...
blhsing [Tue, 11 Jun 2024 05:42:49 +0000 (13:42 +0800)] 
gh-65454: avoid triggering call to a PropertyMock in NonCallableMock.__setattr__ (#120019)

17 months agogh-119600: mock: do not access attributes of original when new_callable is set (...
Robert Collins [Tue, 11 Jun 2024 05:41:12 +0000 (07:41 +0200)] 
gh-119600: mock: do not access attributes of original when new_callable is set (#119601)

In order to patch flask.g e.g. as in #84982, that
proxies getattr must not be invoked. For that,
mock must not try to read from the original
object. In some cases that is unavoidable, e.g.
when doing autospec. However, patch("flask.g",
new_callable=MagicMock) should be entirely safe.

17 months agoFix the CODEOWNERS for _interpretersmodule.c (gh-120288)
AN Long [Mon, 10 Jun 2024 16:45:16 +0000 (00:45 +0800)] 
Fix the CODEOWNERS for _interpretersmodule.c (gh-120288)

17 months agogh-120057: Add os.environ.refresh() method (#120059)
Victor Stinner [Mon, 10 Jun 2024 16:34:17 +0000 (18:34 +0200)] 
gh-120057: Add os.environ.refresh() method (#120059)

17 months agogh-119786: copy compiler doc from devguide to InternalDocs and convert to markdown...
Irit Katriel [Mon, 10 Jun 2024 15:15:12 +0000 (16:15 +0100)] 
gh-119786: copy compiler doc from devguide to InternalDocs and convert to markdown (#120134)

* gh-119876: move compiler doc from devguide to InternalDocs

Copy of https://github.com/python/devguide/commit/78fc0d7aa9fd0d6733d10c23b178b2a0e2799afc

Co-Authored-By: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-Authored-By: Adam Turner <9087854+aa-turner@users.noreply.github.com>
Co-Authored-By: Brett Cannon <brett@python.org>
Co-Authored-By: Carol Willing <carolcode@willingconsulting.com>
Co-Authored-By: Daniel Porteous <danielporteous1@gmail.com>
Co-Authored-By: Dennis Sweeney <36520290+sweeneyde@users.noreply.github.com>
Co-Authored-By: Éric Araujo <merwok@netwok.org>
Co-Authored-By: Erlend Egeberg Aasland <erlend.aasland@innova.no>
Co-Authored-By: Ezio Melotti <ezio.melotti@gmail.com>
Co-Authored-By: Georg Brandl <georg@python.org>
Co-Authored-By: Guido van Rossum <guido@python.org>
Co-Authored-By: Hugo van Kemenade <hugovk@users.noreply.github.com>
Co-Authored-By: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
Co-Authored-By: Jeff Allen <ja.py@farowl.co.uk>
Co-Authored-By: Jim Fasarakis-Hilliard <d.f.hilliard@gmail.com>
Co-Authored-By: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
Co-Authored-By: Lincoln <71312724+Lincoln-developer@users.noreply.github.com>
Co-Authored-By: Mariatta <Mariatta@users.noreply.github.com>
Co-Authored-By: Muhammad Mahad <mahadpy@gmail.com>
Co-Authored-By: Ned Deily <nad@acm.org>
Co-Authored-By: Pablo Galindo Salgado <Pablogsal@gmail.com>
Co-Authored-By: Serhiy Storchaka <storchaka@gmail.com>
Co-Authored-By: Stéphane Wirtel <stephane@wirtel.be>
Co-Authored-By: Suriyaa ✌️️ <isc.suriyaa@gmail.com>
Co-Authored-By: Zachary Ware <zachary.ware@gmail.com>
Co-Authored-By: psyker156 <242220+psyker156@users.noreply.github.com>
Co-Authored-By: slateny <46876382+slateny@users.noreply.github.com>
Co-Authored-By: svelankar <17737361+svelankar@users.noreply.github.com>
Co-Authored-By: zikcheng <surfingbyte@gmail.com>
* convert to markdown

* add to index

* update more of the out of date stuff

---------

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Brett Cannon <brett@python.org>
Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
Co-authored-by: Daniel Porteous <danielporteous1@gmail.com>
Co-authored-by: Dennis Sweeney <36520290+sweeneyde@users.noreply.github.com>
Co-authored-by: Éric Araujo <merwok@netwok.org>
Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>
Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
Co-authored-by: Georg Brandl <georg@python.org>
Co-authored-by: Guido van Rossum <guido@python.org>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Co-authored-by: Jeff Allen <ja.py@farowl.co.uk>
Co-authored-by: Jim Fasarakis-Hilliard <d.f.hilliard@gmail.com>
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
Co-authored-by: Lincoln <71312724+Lincoln-developer@users.noreply.github.com>
Co-authored-by: Mariatta <Mariatta@users.noreply.github.com>
Co-authored-by: Muhammad Mahad <mahadpy@gmail.com>
Co-authored-by: Ned Deily <nad@acm.org>
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Stéphane Wirtel <stephane@wirtel.be>
Co-authored-by: Suriyaa ✌️️ <isc.suriyaa@gmail.com>
Co-authored-by: Zachary Ware <zachary.ware@gmail.com>
Co-authored-by: psyker156 <242220+psyker156@users.noreply.github.com>
Co-authored-by: slateny <46876382+slateny@users.noreply.github.com>
Co-authored-by: svelankar <17737361+svelankar@users.noreply.github.com>
Co-authored-by: zikcheng <surfingbyte@gmail.com>
17 months agogh-115801: Only allow sequence of strings as input for difflib.unified_diff (GH-118333)
Pieter Eendebak [Mon, 10 Jun 2024 11:06:18 +0000 (13:06 +0200)] 
gh-115801: Only allow sequence of strings as input for difflib.unified_diff (GH-118333)

17 months agogh-120155: Fix Coverity issue in zoneinfo load_data() (#120232)
Victor Stinner [Mon, 10 Jun 2024 09:54:35 +0000 (11:54 +0200)] 
gh-120155: Fix Coverity issue in zoneinfo load_data() (#120232)

Declare the 'rv' varaible at the top of the load_data() function to
make sure that it's initialized before the first 'goto error' which
uses 'rv' (return rv).

Fix the Coverity issue:

Error: UNINIT (CWE-457):
Python-3.12.2/Modules/_zoneinfo.c:1233:5: skipped_decl: Jumping over declaration of ""rv"".
Python-3.12.2/Modules/_zoneinfo.c:1284:5: uninit_use: Using uninitialized value ""rv"".
  1282|       }
  1283|
  1284|->     return rv;
  1285|   }
  1286|

17 months agobpo-24766: doc= argument to subclasses of property not handled correctly (GH-2487)
E. M. Bray [Mon, 10 Jun 2024 08:55:49 +0000 (10:55 +0200)] 
bpo-24766: doc= argument to subclasses of property not handled correctly (GH-2487)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
17 months agogh-120296: Fix format string of fcntl.ioctl() audit (#120301)
Clinton [Mon, 10 Jun 2024 08:17:50 +0000 (04:17 -0400)] 
gh-120296: Fix format string of fcntl.ioctl() audit (#120301)

17 months agogh-119666: fix multiple class-scope comprehensions referencing __class__ (#120295)
Carl Meyer [Mon, 10 Jun 2024 02:23:30 +0000 (22:23 -0400)] 
gh-119666: fix multiple class-scope comprehensions referencing __class__ (#120295)

17 months agogh-120268: Prohibit passing ``None`` to ``_pydatetime.date.fromtimestamp`` (#120269)
Kirill Podoprigora [Sat, 8 Jun 2024 20:45:57 +0000 (23:45 +0300)] 
gh-120268: Prohibit passing ``None`` to ``_pydatetime.date.fromtimestamp`` (#120269)

This makes the pure Python implementation consistent with the C implementation.

17 months agogh-120276: Fix incorrect email.header.Header maxlinelen default (GH-120277)
Clinton [Sat, 8 Jun 2024 17:18:58 +0000 (13:18 -0400)] 
gh-120276: Fix incorrect email.header.Header maxlinelen default (GH-120277)

17 months agogh-120121: Add InvalidStateError to concurrent.futures.__all__ (#120123)
AN Long [Sat, 8 Jun 2024 16:11:19 +0000 (00:11 +0800)] 
gh-120121: Add InvalidStateError to concurrent.futures.__all__ (#120123)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
17 months agogh-120244: Fix re.sub() reference leak (GH-120245)
neonene [Sat, 8 Jun 2024 10:22:07 +0000 (19:22 +0900)] 
gh-120244: Fix re.sub() reference leak (GH-120245)

17 months agogh-119258: Eliminate Type Guards in Tier 2 Optimizer with Watcher (GH-119365)
Saul Shanabrook [Sat, 8 Jun 2024 09:41:45 +0000 (05:41 -0400)] 
gh-119258: Eliminate Type Guards in Tier 2 Optimizer with Watcher (GH-119365)

Co-authored-by: parmeggiani <parmeggiani@spaziodati.eu>
Co-authored-by: dpdani <git@danieleparmeggiani.me>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Brandt Bucher <brandtbucher@microsoft.com>
Co-authored-by: Ken Jin <kenjin@python.org>
17 months agobpo-37755: Use configured output in pydoc instead of pager (GH-15105)
Enrico Tröger [Sat, 8 Jun 2024 09:19:13 +0000 (11:19 +0200)] 
bpo-37755: Use configured output in pydoc instead of pager (GH-15105)

If the Helper() class was initialized with an output, the topics, keywords
and symbols help still use the pager instead of the output.
Change the behavior so  the output is used if available while keeping the
previous behavior if no output was configured.

17 months agogh-120242: Fix handling of `[setUp,tearDown]Class` in `test_datetime` (#120243)
Nikita Sobolev [Sat, 8 Jun 2024 07:51:09 +0000 (10:51 +0300)] 
gh-120242: Fix handling of `[setUp,tearDown]Class` in `test_datetime` (#120243)

17 months agogh-120225: fix crash in compiler on empty block at end of exception handler (#120235)
Irit Katriel [Fri, 7 Jun 2024 21:37:35 +0000 (22:37 +0100)] 
gh-120225: fix crash in compiler on empty block at end of exception handler (#120235)

17 months agogh-119659: Get the datetime CAPI Tests Running Again (gh-120180)
Eric Snow [Fri, 7 Jun 2024 17:44:56 +0000 (13:44 -0400)] 
gh-119659: Get the datetime CAPI Tests Running Again (gh-120180)

The tests were accidentally disabled by 2da0dc0, which didn't handle classes correctly.

I considered updating no_rerun() to support classes, but the way test_datetime.py works would have made things fairly messy.  Plus, it looks like the refleaks we had encountered before have been resolved.

17 months agoGH-116380: Move pathlib-specific code from `glob` to `pathlib._abc`. (#120011)
Barney Gale [Fri, 7 Jun 2024 16:59:34 +0000 (17:59 +0100)] 
GH-116380: Move pathlib-specific code from `glob` to `pathlib._abc`. (#120011)

In `glob._Globber`, move pathlib-specific methods to `pathlib._abc.PathGlobber` and replace them with abstract methods. Rename `glob._Globber` to `glob._GlobberBase`. As a result, the `glob` module is no longer befouled by code that can only ever apply to pathlib.

No change of behaviour.

17 months agogh-120155: Fix copy/paste error in HAVE_SUBOFFSETS_IN_LAST_DIM() (#120228)
Victor Stinner [Fri, 7 Jun 2024 15:58:21 +0000 (17:58 +0200)] 
gh-120155: Fix copy/paste error in HAVE_SUBOFFSETS_IN_LAST_DIM() (#120228)

Don't hardcode 'dest' in HAVE_SUBOFFSETS_IN_LAST_DIM() macro of
memoryobject.c, but use its 'view' parameter instead.

Fix the Coverity issue:

Error: COPY_PASTE_ERROR (CWE-398):
Python-3.12.2/Objects/memoryobject.c:273:14: original: ""dest->suboffsets + (dest->ndim - 1)"" looks like the original copy.
Python-3.12.2/Objects/memoryobject.c:274:14: copy_paste_error: ""dest"" in ""src->suboffsets + (dest->ndim - 1)"" looks like a copy-paste error.
Python-3.12.2/Objects/memoryobject.c:274:14: remediation: Should it say ""src"" instead?
#  272|       assert(dest->ndim > 0 && src->ndim > 0);
#  273|       return (!HAVE_SUBOFFSETS_IN_LAST_DIM(dest) &&
#  274|->             !HAVE_SUBOFFSETS_IN_LAST_DIM(src) &&
#  275|               dest->strides[dest->ndim-1] == dest->itemsize &&
#  276|               src->strides[src->ndim-1] == src->itemsize);

17 months agogh-120226: Fix test_sendfile_close_peer_in_the_middle_of_receiving on Linux >= 6...
Xi Ruoyao [Fri, 7 Jun 2024 15:51:32 +0000 (23:51 +0800)] 
gh-120226: Fix test_sendfile_close_peer_in_the_middle_of_receiving on Linux >= 6.10 (#120227)

The worst case is that the kernel buffers 17 pages with a page size of 64k.

17 months agogh-120200: Fix `inspect.iscoroutinefunction(inspect) is True` corner case (#120214)
Nikita Sobolev [Fri, 7 Jun 2024 15:48:31 +0000 (18:48 +0300)] 
gh-120200: Fix `inspect.iscoroutinefunction(inspect) is True` corner case (#120214)

17 months agogh-114264: Optimize performance of copy.deepcopy by adding a fast path for atomic...
Pieter Eendebak [Fri, 7 Jun 2024 15:42:01 +0000 (17:42 +0200)] 
gh-114264: Optimize performance of copy.deepcopy by adding a fast path for atomic types (GH-114266)

17 months agogh-110383: Improve 'old string formatting' text in tutorial (#120219)
Erlend E. Aasland [Fri, 7 Jun 2024 13:37:18 +0000 (15:37 +0200)] 
gh-110383: Improve 'old string formatting' text in tutorial (#120219)

17 months agogh-93691: fix too broad source locations of with-statement instructions (#120125)
Irit Katriel [Fri, 7 Jun 2024 13:06:24 +0000 (14:06 +0100)] 
gh-93691: fix too broad source locations of with-statement instructions (#120125)

17 months agogh-120211: Fix tkinter.ttk with Tcl/Tk 9.0 (GH-120213)
Serhiy Storchaka [Fri, 7 Jun 2024 10:49:07 +0000 (13:49 +0300)] 
gh-120211: Fix tkinter.ttk with Tcl/Tk 9.0 (GH-120213)

* Use new methods for tracing Tcl variable.
* Fix Combobox.current() for empty combobox.

17 months agogh-110383: Clarify "non-integral" wording in pow() docs (#119688)
Aditya Borikar [Fri, 7 Jun 2024 09:44:42 +0000 (03:44 -0600)] 
gh-110383: Clarify "non-integral" wording in pow() docs (#119688)

17 months agogh-120164: Fix test_os.test_win32_mkdir_700() (#120177)
Kirill Podoprigora [Fri, 7 Jun 2024 09:14:13 +0000 (12:14 +0300)] 
gh-120164: Fix test_os.test_win32_mkdir_700() (#120177)

Don't compare the path to avoid encoding issues.

Co-authored-by: Eryk Sun <eryksun@gmail.com>
17 months agogh-120154: Fix Emscripten/WASI pattern in case statement for LDSHARED (#120173)
Michael Allwright [Fri, 7 Jun 2024 08:38:15 +0000 (10:38 +0200)] 
gh-120154: Fix Emscripten/WASI pattern in case statement for LDSHARED (#120173)

Fix Emscripten/WASI pattern in case statement for LDSHARED

17 months agoFix typos in comments (#120188)
Xie Yanbo [Fri, 7 Jun 2024 08:19:41 +0000 (16:19 +0800)] 
Fix typos in comments (#120188)

17 months agogh-120080: Accept ``None`` as a valid argument for direct call of the ``int.__round__...
Kirill Podoprigora [Fri, 7 Jun 2024 08:03:28 +0000 (11:03 +0300)] 
gh-120080: Accept ``None`` as a valid argument for direct call of the ``int.__round__`` (#120088)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
17 months agogh-120157: Remove unused code in concurrent.future (gh-120187)
Clinton [Fri, 7 Jun 2024 07:39:19 +0000 (03:39 -0400)] 
gh-120157: Remove unused code in concurrent.future (gh-120187)

17 months agoAdd Plausible for docs metrics (#119977)
Hugo van Kemenade [Fri, 7 Jun 2024 06:38:31 +0000 (00:38 -0600)] 
Add Plausible for docs metrics (#119977)

Co-authored-by: Julien Palard <julien@palard.fr>
17 months agogh-119577: Adjust DeprecationWarning when testing element truth values in ElementTree...
Jacob Walls [Fri, 7 Jun 2024 03:18:30 +0000 (23:18 -0400)] 
gh-119577: Adjust DeprecationWarning when testing element truth values in ElementTree (GH-119762)

Adjust DeprecationWarning when testing element truth values in ElementTree, we're planning to go with the more natural True return rather than a disruptive harder to code around exception raise, and are deferring the behavior change for a few more releases.

17 months agoGH-119054: Add "Reading directories" section to pathlib docs (#119956)
Barney Gale [Thu, 6 Jun 2024 23:27:39 +0000 (00:27 +0100)] 
GH-119054: Add "Reading directories" section to pathlib docs (#119956)

Add a dedicated subsection for `Path.iterdir()`-related methods,
specifically `iterdir()`, `glob()`, `rglob()` and `walk()`.

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
17 months agogh-120178: Documentation typo corrections (#120179)
David Lowry-Duda [Thu, 6 Jun 2024 21:35:24 +0000 (17:35 -0400)] 
gh-120178: Documentation typo corrections (#120179)

17 months agogh-117657: Fix TSAN race involving import lock (#118523)
Sam Gross [Thu, 6 Jun 2024 17:40:58 +0000 (13:40 -0400)] 
gh-117657: Fix TSAN race involving import lock (#118523)

This adds a `_PyRecursiveMutex` type based on `PyMutex` and uses that
for the import lock. This fixes some data races in the free-threaded
build and generally simplifies the import lock code.

17 months agoAdd Tian Gao to CODEOWNERS and ACKS (GH-120166)
Tian Gao [Thu, 6 Jun 2024 17:20:37 +0000 (10:20 -0700)] 
Add Tian Gao to CODEOWNERS and ACKS (GH-120166)

17 months agoRestore decimal context after decimal doctests (GH-120149)
Serhiy Storchaka [Thu, 6 Jun 2024 17:12:32 +0000 (20:12 +0300)] 
Restore decimal context after decimal doctests (GH-120149)

The modified context caused tests failures in several other tests.

17 months agoCODEOWNERS: Add myself to symtable and AST (#120139)
Jelle Zijlstra [Thu, 6 Jun 2024 16:25:05 +0000 (09:25 -0700)] 
CODEOWNERS: Add myself to symtable and AST (#120139)

Co-authored-by: Carl Meyer <carl@oddbird.net>
17 months agogh-120155: Initialize variables in _tkinter.c (#120156)
Victor Stinner [Thu, 6 Jun 2024 15:31:33 +0000 (17:31 +0200)] 
gh-120155: Initialize variables in _tkinter.c (#120156)

Initialize variables in _tkinter.c to make static analyzers happy.

17 months agogh-119679: Fix layout of PYD and DLL files on Windows when using PC/layout script...
Steve Dower [Thu, 6 Jun 2024 15:11:42 +0000 (16:11 +0100)] 
gh-119679: Fix layout of PYD and DLL files on Windows when using PC/layout script (GH-120133)

17 months agogh-120111: Don't use cirrus M1 macOS runners on fork (#120116)
Nice Zombies [Thu, 6 Jun 2024 11:40:37 +0000 (13:40 +0200)] 
gh-120111: Don't use cirrus M1 macOS runners on fork (#120116)

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
17 months agogh-119786: move adaptive interpreter doc from Python to InternalsDoc (#120137)
Irit Katriel [Thu, 6 Jun 2024 10:56:58 +0000 (11:56 +0100)] 
gh-119786: move adaptive interpreter doc from Python to InternalsDoc (#120137)

17 months agogh-120128: fix description of argument to ipaddress.collapse_addresses() (#120131)
Jan Kaliszewski [Wed, 5 Jun 2024 21:52:40 +0000 (23:52 +0200)] 
gh-120128: fix description of argument to ipaddress.collapse_addresses() (#120131)

The argument to collapse_addresses() is now described as an *iterable*
(rather than *iterator*).

17 months agopathlib ABCs: remove duplicate `realpath()` implementation. (#119178)
Barney Gale [Wed, 5 Jun 2024 17:54:50 +0000 (18:54 +0100)] 
pathlib ABCs: remove duplicate `realpath()` implementation. (#119178)

Add private `posixpath._realpath()` function, which is a generic version of `realpath()` that can be parameterised with string tokens (`sep`, `curdir`, `pardir`) and query functions (`getcwd`, `lstat`, `readlink`). Also add support for limiting the number of symlink traversals.

In the private `pathlib._abc.PathBase` class, call `posixpath._realpath()` and remove our re-implementation of the same algorithm.

No change to any public APIs, either in `posixpath` or `pathlib`.

Co-authored-by: Nice Zombies <nineteendo19d0@gmail.com>