]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
2 years agogh-88569: add `ntpath.isreserved()` (#95486)
Barney Gale [Fri, 26 Jan 2024 18:14:24 +0000 (18:14 +0000)] 
gh-88569: add `ntpath.isreserved()` (#95486)

Add `ntpath.isreserved()`, which identifies reserved pathnames such as "NUL", "AUX" and "CON".

Deprecate `pathlib.PurePath.is_reserved()`.

---------

Co-authored-by: Eryk Sun <eryksun@gmail.com>
Co-authored-by: Brett Cannon <brett@python.org>
Co-authored-by: Steve Dower <steve.dower@microsoft.com>
2 years agoDocs: rework the dbm.dumb introduction (#114550)
Erlend E. Aasland [Fri, 26 Jan 2024 18:12:48 +0000 (19:12 +0100)] 
Docs: rework the dbm.dumb introduction (#114550)

- consistently use correct parameter markup
- consistently use submodule name as database name
- improve accuracy of the dbm.dumb.open() spec
- remove dumbdbm class refs and replace them with generic "database object"
- use parameter list for dbm.dumb.open()

2 years agoDocument PyOS_strtoul and PyOS_strtol (GH-114048)
Sergey B Kirpichev [Fri, 26 Jan 2024 17:44:45 +0000 (20:44 +0300)] 
Document PyOS_strtoul and PyOS_strtol (GH-114048)

2 years agogh-114435: Allow test_stat_inaccessible_file() to have matching ino/dev (GH-114571)
Steve Dower [Fri, 26 Jan 2024 17:33:44 +0000 (17:33 +0000)] 
gh-114435: Allow test_stat_inaccessible_file() to have matching ino/dev (GH-114571)

This may occur if Windows allows reading stat information from a file even if the current user does not have access.

2 years agoUse Unicode unconditionally for _winapi.CreateFile (GH-114611)
Steve Dower [Fri, 26 Jan 2024 17:27:29 +0000 (17:27 +0000)] 
Use Unicode unconditionally for _winapi.CreateFile (GH-114611)

Currently it switches based on build settings, but argument clinic does not handle it correctly.

2 years agogh-112087: Make list_repr and list_length to be thread-safe (gh-114582)
Donghee Na [Fri, 26 Jan 2024 16:20:21 +0000 (01:20 +0900)] 
gh-112087: Make list_repr and list_length to be thread-safe (gh-114582)

2 years agogh-111968: Unify freelist naming schema to Eric's suggestion (gh-114581)
Donghee Na [Fri, 26 Jan 2024 15:25:16 +0000 (00:25 +0900)] 
gh-111968: Unify freelist naming schema to Eric's suggestion (gh-114581)

2 years agogh-77749: Fix inconsistent behavior of non-ASCII handling in EmailPolicy.fold() ...
Rito Takeuchi [Fri, 26 Jan 2024 15:19:41 +0000 (00:19 +0900)] 
gh-77749: Fix inconsistent behavior of non-ASCII handling in EmailPolicy.fold() (GH-6986)

It now always encodes non-ASCII characters in headers if utf8 is false.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2 years agoDocs: mark up dbm.open() with param list (#114601)
Erlend E. Aasland [Fri, 26 Jan 2024 15:11:45 +0000 (16:11 +0100)] 
Docs: mark up dbm.open() with param list (#114601)

Also consolidate following paragraphs regarding database objects.

2 years agogh-114272: Allow _wmi audit test to succeed even if it times out (GH-114602)
Steve Dower [Fri, 26 Jan 2024 14:38:24 +0000 (14:38 +0000)] 
gh-114272: Allow _wmi audit test to succeed even if it times out (GH-114602)

2 years agoDocs: 'still' is a better word than 'nonetheless' (#114598)
Ned Batchelder [Fri, 26 Jan 2024 13:42:49 +0000 (08:42 -0500)] 
Docs: 'still' is a better word than 'nonetheless' (#114598)

2 years agoDocs: fix versionchanged directives for dbm.open() and dbm.whichdb() (#114594)
Erlend E. Aasland [Fri, 26 Jan 2024 12:36:37 +0000 (13:36 +0100)] 
Docs: fix versionchanged directives for dbm.open() and dbm.whichdb() (#114594)

2 years agoDocs: reword dbm.ndbm introduction (#114549)
Erlend E. Aasland [Fri, 26 Jan 2024 12:35:56 +0000 (13:35 +0100)] 
Docs: reword dbm.ndbm introduction (#114549)

- add abbreviation directives for NDBM and GDBM
- consistently spell NDBM as NDBM
- silence broken ndbm class refs
- improve accuracy of dbm.ndbm.open() spec
- use replacement text for NDBM/GDBM file format incompatibility note

2 years agoDocs: rework dbm introduction (#114551)
Erlend E. Aasland [Fri, 26 Jan 2024 10:15:34 +0000 (11:15 +0100)] 
Docs: rework dbm introduction (#114551)

- add refs to other parts of the docs (dict, bytes, etc.)
- clarify whichdb() return value by using list markup
- silence refs to example or generic submodule methods (keys, get, etc.)

2 years agogh-114569: Use PyMem_* APIs for most non-PyObject uses (#114574)
Erlend E. Aasland [Fri, 26 Jan 2024 10:11:35 +0000 (11:11 +0100)] 
gh-114569: Use PyMem_* APIs for most non-PyObject uses (#114574)

Fix usage in Modules, Objects, and Parser subdirectories.

2 years agogh-114312: Fix rare event counter tests on aarch64 (GH-114554)
Michael Droettboom [Fri, 26 Jan 2024 10:10:03 +0000 (05:10 -0500)] 
gh-114312: Fix rare event counter tests on aarch64 (GH-114554)

2 years agoDocs: reword dbm.gnu introduction (#114548)
Erlend E. Aasland [Fri, 26 Jan 2024 10:05:08 +0000 (11:05 +0100)] 
Docs: reword dbm.gnu introduction (#114548)

Also...
- consistently spell GDBM as GDBM
- silence gdbm class refs
- improve accuracy of dbm.gdbm.open() spec

2 years agogh-101100: Fix sphinx warnings in `c-api/file.rst` (#114546)
Nikita Sobolev [Fri, 26 Jan 2024 09:55:22 +0000 (12:55 +0300)] 
gh-101100: Fix sphinx warnings in `c-api/file.rst` (#114546)

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2 years agogh-114250: Fetch metadata for pip and its vendored dependencies from PyPI (#114450)
Seth Michael Larson [Fri, 26 Jan 2024 09:48:13 +0000 (03:48 -0600)] 
gh-114250: Fetch metadata for pip and its vendored dependencies from PyPI (#114450)

2 years agogh-112451: Prohibit subclassing of datetime.timezone. (#114190)
Mariusz Felisiak [Fri, 26 Jan 2024 08:33:13 +0000 (09:33 +0100)] 
gh-112451: Prohibit subclassing of datetime.timezone. (#114190)

This is consistent with C-extension datetime.timezone.

2 years agoGH-73435: Add `pathlib.PurePath.full_match()` (#114350)
Barney Gale [Fri, 26 Jan 2024 01:12:46 +0000 (01:12 +0000)] 
GH-73435: Add `pathlib.PurePath.full_match()` (#114350)

In 49f90ba we added support for the recursive wildcard `**` in
`pathlib.PurePath.match()`. This should allow arbitrary prefix and suffix
matching, like `p.match('foo/**')` or `p.match('**/foo')`, but there's a
problem: for relative patterns only, `match()` implicitly inserts a `**`
token on the left hand side, causing all patterns to match from the right.
As a result, it's impossible to match relative patterns from the left:
`PurePath('foo/bar').match('bar/**')` is true!

This commit reverts the changes to `match()`, and instead adds a new
`full_match()` method that:

- Allows empty patterns
- Supports the recursive wildcard `**`
- Matches the *entire* path when given a relative pattern

2 years agoAdd CODEOWNERS for dbm (gh-114555)
Donghee Na [Thu, 25 Jan 2024 20:49:37 +0000 (05:49 +0900)] 
Add CODEOWNERS for dbm (gh-114555)

2 years agogh-107901: compiler replaces POP_BLOCK instruction by NOPs before optimisations ...
Irit Katriel [Thu, 25 Jan 2024 20:06:48 +0000 (20:06 +0000)] 
gh-107901: compiler replaces POP_BLOCK instruction by NOPs before optimisations (#114530)

2 years agogh-114561: Mark some tests in ``test_wincosoleio`` with `requires_resource('console...
Kirill Podoprigora [Thu, 25 Jan 2024 20:00:52 +0000 (23:00 +0300)] 
gh-114561: Mark some tests in ``test_wincosoleio`` with `requires_resource('console')` decorator  (GH-114565)

2 years agogh-114315: Make `threading.Lock` a real class, not a factory function (#114479)
Nikita Sobolev [Thu, 25 Jan 2024 19:46:32 +0000 (22:46 +0300)] 
gh-114315: Make `threading.Lock` a real class, not a factory function (#114479)

`threading.Lock` is now the underlying class and is constructable rather than the old
factory function. This allows for type annotations to refer to it which had no non-ugly
way to be expressed prior to this.

---------

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2 years agogh-112529: Implement GC for free-threaded builds (#114262)
Sam Gross [Thu, 25 Jan 2024 18:27:36 +0000 (13:27 -0500)] 
gh-112529: Implement GC for free-threaded builds (#114262)

* gh-112529: Implement GC for free-threaded builds

This implements a mark and sweep GC for the free-threaded builds of
CPython. The implementation relies on mimalloc to find GC tracked
objects (i.e., "containers").

2 years agogh-112075: Add try-incref functions from nogil branch for use in dict thread safety...
Dino Viehland [Thu, 25 Jan 2024 17:34:03 +0000 (09:34 -0800)] 
gh-112075: Add try-incref functions from nogil branch for use in dict thread safety (#114512)

* Bring in a subset of biased reference counting:
https://github.com/colesbury/nogil/commit/b6b12a9a94e

The NoGIL branch has functions for attempting to do an incref on an object which may or may not be in flight. This just brings those functions over so that they will be usable from in the dict implementation to get items w/o holding a lock.

There's a handful of small simple modifications:

    Adding inline to the force inline functions to avoid a warning, and switching from _Py_ALWAYS_INLINE to Py_ALWAYS_INLINE as that's available
    Remove _Py_REF_LOCAL_SHIFT as it doesn't exist yet (and is currently 0 in the 3.12 nogil branch anyway)
    ob_ref_shared is currently Py_ssize_t and not uint32_t, so use that
    _PY_LIKELY doesn't exist, so drop it
    _Py_ThreadLocal becomes _Py_IsOwnedByCurrentThread
    Add '_PyInterpreterState_GET()' to _Py_IncRefTotal calls.

Co-Authored-By: Sam Gross <colesbury@gmail.com>
2 years agogh-111051: Check if file is modifed during debugging in `pdb` (#111052)
Tian Gao [Thu, 25 Jan 2024 16:48:50 +0000 (08:48 -0800)] 
gh-111051: Check if file is modifed during debugging in `pdb` (#111052)

2 years agoDoc/library/sys.monitoring.rst: remove contradictory paragraph. (GH-113619)
Ned Batchelder [Thu, 25 Jan 2024 14:38:43 +0000 (09:38 -0500)] 
Doc/library/sys.monitoring.rst: remove contradictory paragraph. (GH-113619)

2 years agogh-77465: Increase test coverage for the numbers module (GH-111738)
AN Long [Thu, 25 Jan 2024 14:35:05 +0000 (22:35 +0800)] 
gh-77465: Increase test coverage for the numbers module (GH-111738)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2 years agogh-114265: remove i_loc_propagated, jump threading does not consider line numbers...
Irit Katriel [Thu, 25 Jan 2024 12:54:19 +0000 (12:54 +0000)] 
gh-114265: remove i_loc_propagated, jump threading does not consider line numbers anymore (#114535)

2 years agogh-114312: Collect stats for unlikely events (GH-114493)
Michael Droettboom [Thu, 25 Jan 2024 11:10:51 +0000 (06:10 -0500)] 
gh-114312: Collect stats for unlikely events (GH-114493)

2 years agogh-114272: Fix or skip tests that fail due to spaces in paths (GH-114451)
Steve Dower [Thu, 25 Jan 2024 00:38:34 +0000 (00:38 +0000)] 
gh-114272: Fix or skip tests that fail due to spaces in paths (GH-114451)

2 years agogh-100107: Make py.exe launcher ignore app aliases that launch Microsoft Store (GH...
Vincent Cunningham [Thu, 25 Jan 2024 00:23:28 +0000 (16:23 -0800)] 
gh-100107: Make py.exe launcher ignore app aliases that launch Microsoft Store (GH-114358)

2 years agogh-108731: Add description of __slots__ to MemberDescriptorType docs (GH-108745)
plokmijnuhby [Wed, 24 Jan 2024 19:58:34 +0000 (19:58 +0000)] 
gh-108731: Add description of __slots__ to MemberDescriptorType docs (GH-108745)

2 years agoUpdate outdated comment in ``Python/bytecodes.c`` (#114522)
Kirill Podoprigora [Wed, 24 Jan 2024 17:14:15 +0000 (20:14 +0300)] 
Update outdated comment in ``Python/bytecodes.c`` (#114522)

2 years agoGH-112354: `END_FOR` instruction to only pop one value. (GH-114247)
Mark Shannon [Wed, 24 Jan 2024 15:10:17 +0000 (15:10 +0000)] 
GH-112354: `END_FOR` instruction to only pop one value. (GH-114247)

* Compiler emits END_FOR; POP_TOP instead of END_FOR. To support tier 2 side exits in loops.

2 years agoDocs: mark up the FTP_TLS() docs with param list (#114510)
Erlend E. Aasland [Wed, 24 Jan 2024 15:06:14 +0000 (16:06 +0100)] 
Docs: mark up the FTP_TLS() docs with param list (#114510)

Also turn sentence about prot_p() into a note.

2 years agogh-104360: remove reference to removed module-level wrap_socket (GH-104361)
Thomas Grainger [Wed, 24 Jan 2024 14:24:00 +0000 (14:24 +0000)] 
gh-104360: remove reference to removed module-level wrap_socket (GH-104361)

* remove reference to removed module-level wrap_socket
* drive by typo fix

2 years agogh-101100: Fix Sphinx warnings in `c-api/structures.rst` (#113564)
Hugo van Kemenade [Wed, 24 Jan 2024 13:40:09 +0000 (15:40 +0200)] 
gh-101100: Fix Sphinx warnings in `c-api/structures.rst` (#113564)

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2 years agogh-101100: Fix sphinx warnings in `concurrent.futures.rst` (#114521)
Nikita Sobolev [Wed, 24 Jan 2024 13:30:50 +0000 (16:30 +0300)] 
gh-101100: Fix sphinx warnings in `concurrent.futures.rst` (#114521)

2 years agoGH-113710: Add a tier 2 peephole optimization pass. (GH-114487)
Mark Shannon [Wed, 24 Jan 2024 12:08:31 +0000 (12:08 +0000)] 
GH-113710: Add a tier 2 peephole optimization pass. (GH-114487)

* Convert _LOAD_CONST to inline versions

* Remove PEP 523 checks

2 years agogh-101100: Fix sphinx warnings in `asyncio-task.rst` (#114469)
Nikita Sobolev [Wed, 24 Jan 2024 07:23:34 +0000 (10:23 +0300)] 
gh-101100: Fix sphinx warnings in `asyncio-task.rst` (#114469)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2 years agogh-113205: test_multiprocessing.test_terminate: Give tasks a chance to start (GH...
Serhiy Storchaka [Wed, 24 Jan 2024 07:13:09 +0000 (09:13 +0200)] 
gh-113205: test_multiprocessing.test_terminate: Give tasks a chance to start (GH-114249)

2 years agoFix a typo in the contextlib documentation (#114507)
Daniel Hollas [Wed, 24 Jan 2024 04:16:31 +0000 (04:16 +0000)] 
Fix a typo in the contextlib documentation (#114507)

2 years agoGH-114456: lower the recursion limit under WASI for debug builds (GH-114457)
Brett Cannon [Tue, 23 Jan 2024 23:48:14 +0000 (15:48 -0800)] 
GH-114456: lower the recursion limit under WASI for debug builds (GH-114457)

Testing under wasmtime 16.0.0 w/ code from https://github.com/python/cpython/issues/114413 is how the value was found.

2 years agogh-112075: Adapt more dict methods to Argument Clinic (#114256)
Dino Viehland [Tue, 23 Jan 2024 22:10:04 +0000 (14:10 -0800)] 
gh-112075: Adapt more dict methods to Argument Clinic (#114256)

* Move more dict objects to argument clinic

* Improve doc strings

* More doc string improvements

* Update Objects/dictobject.c

Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
* Update Objects/dictobject.c

Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
* Update Objects/dictobject.c

Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
* Update Objects/dictobject.c

Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
* Update Objects/dictobject.c

Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
* Update Objects/dictobject.c

Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
* Update Objects/dictobject.c

Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
---------

Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2 years agogh-114492: Initialize struct termios before calling tcgetattr() (GH-114495)
Serhiy Storchaka [Tue, 23 Jan 2024 21:27:04 +0000 (23:27 +0200)] 
gh-114492: Initialize struct termios before calling tcgetattr() (GH-114495)

On Alpine Linux it could leave some field non-initialized.

2 years agogh-101438: Avoid reference cycle in ElementTree.iterparse. (GH-114269)
Sam Gross [Tue, 23 Jan 2024 20:14:46 +0000 (15:14 -0500)] 
gh-101438: Avoid reference cycle in ElementTree.iterparse. (GH-114269)

The iterator returned by ElementTree.iterparse() may hold on to a file
descriptor. The reference cycle prevented prompt clean-up of the file
descriptor if the returned iterator was not exhausted.

2 years agoDocs: use placeholders in dbm flag param docs (#114482)
Erlend E. Aasland [Tue, 23 Jan 2024 19:54:44 +0000 (20:54 +0100)] 
Docs: use placeholders in dbm flag param docs (#114482)

Also correct the default flag param for dbm.dumb.open();
it's 'c', not 'r'.

2 years agogh-113884: Make queue.SimpleQueue thread-safe when the GIL is disabled (#114161)
mpage [Tue, 23 Jan 2024 19:25:41 +0000 (11:25 -0800)] 
gh-113884: Make queue.SimpleQueue thread-safe when the GIL is disabled (#114161)

* use the ParkingLot API to manage waiting threads
* use Argument Clinic's critical section directive to protect queue methods
* remove unnecessary overflow check

Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2 years agogh-111964: Implement stop-the-world pauses (gh-112471)
Sam Gross [Tue, 23 Jan 2024 18:08:23 +0000 (13:08 -0500)] 
gh-111964: Implement stop-the-world pauses (gh-112471)

The `--disable-gil` builds occasionally need to pause all but one thread.  Some
examples include:

* Cyclic garbage collection, where this is often called a "stop the world event"
* Before calling `fork()`, to ensure a consistent state for internal data structures
* During interpreter shutdown, to ensure that daemon threads aren't accessing Python objects

This adds the following functions to implement global and per-interpreter pauses:

* `_PyEval_StopTheWorldAll()` and `_PyEval_StartTheWorldAll()` (for the global runtime)
* `_PyEval_StopTheWorld()` and `_PyEval_StartTheWorld()` (per-interpreter)

(The function names may change.)

These functions are no-ops outside of the `--disable-gil` build.

2 years agogh-112984: Fix link error on free-threaded Windows build (GH-114455)
Sam Gross [Tue, 23 Jan 2024 18:05:15 +0000 (13:05 -0500)] 
gh-112984: Fix link error on free-threaded Windows build (GH-114455)

The test_peg_generator test tried to link the python313_d.lib library,
which failed because the library is now named python313t_d.lib. The
underlying problem is that the "compiler" attribute was not set when
we call get_libraries() from distutils.

2 years agogh-108303: Move `.whl` test files to `Lib/test/wheeldata/` (#114343)
Nikita Sobolev [Tue, 23 Jan 2024 15:33:12 +0000 (18:33 +0300)] 
gh-108303: Move `.whl` test files to `Lib/test/wheeldata/` (#114343)

2 years agoDocs: mark up FTP.connect() and FTP.login() with param lists (#114395)
Erlend E. Aasland [Tue, 23 Jan 2024 13:57:23 +0000 (14:57 +0100)] 
Docs: mark up FTP.connect() and FTP.login() with param lists (#114395)

Use rst substitutions to reduce raw text duplication.

Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2 years agoDocs: mark up FTP.retrbinary and FTP.storbinary with param lists (#114399)
Erlend E. Aasland [Tue, 23 Jan 2024 13:53:35 +0000 (14:53 +0100)] 
Docs: mark up FTP.retrbinary and FTP.storbinary with param lists (#114399)

Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
2 years agogh-114423: Remove DummyThread from threading._active when thread dies (GH-114424)
Fabio Zadrozny [Tue, 23 Jan 2024 12:12:50 +0000 (09:12 -0300)] 
gh-114423: Remove DummyThread from threading._active when thread dies (GH-114424)

2 years agogh-101100: Fix sphinx warnings in `Doc/library/locale.rst` (#114425)
Nikita Sobolev [Tue, 23 Jan 2024 11:05:27 +0000 (14:05 +0300)] 
gh-101100: Fix sphinx warnings in `Doc/library/locale.rst` (#114425)

* gh-101100: Fix sphinx warnings in `Doc/library/locale.rst`

* Remove `/` from signatures

2 years agogh-113317: Don't use global clinic instance in bad_argument() (#114330)
Erlend E. Aasland [Tue, 23 Jan 2024 10:07:56 +0000 (11:07 +0100)] 
gh-113317: Don't use global clinic instance in bad_argument() (#114330)

Make it possible for a converter to have multiple includes, by collecting
them in a list on the converter instance. This implies converter includes
are added during template generation, so we have to add them to the
clinic instance at the end of the template generation instead of in the
beginning.

2 years agogh-89427: Provide the original prompt value for VIRTUAL_ENV_PROMPT (GH-106726)
Jim Porter [Tue, 23 Jan 2024 08:53:04 +0000 (00:53 -0800)] 
gh-89427: Provide the original prompt value for VIRTUAL_ENV_PROMPT (GH-106726)

This improves the implementation in gh-106643.

Previously, venv passed "(<prompt>) " to the activation scripts, but we want
to provide the original value so that users can inspect it in the
$VIRTUAL_ENV_PROMPT env var.

Note: Lib/venv/scripts/common/Activate.ps1 surrounded the prompt value with
parens a second time, so no change was necessary in that file.

2 years agoGH-105900: Fix `pathlib.Path.symlink_to(target_is_directory=...)` docs (#114035)
Barney Gale [Tue, 23 Jan 2024 05:30:16 +0000 (05:30 +0000)] 
GH-105900: Fix `pathlib.Path.symlink_to(target_is_directory=...)` docs (#114035)

Clarify that *target_is_directory* only matters if the target doesn't
exist.

2 years agoGH-82695: Clarify `pathlib.Path.mkdir()` documentation (#114032)
Barney Gale [Tue, 23 Jan 2024 02:31:09 +0000 (02:31 +0000)] 
GH-82695: Clarify `pathlib.Path.mkdir()` documentation (#114032)

Remove a double negative in the documentation of `mkdir()`'s *exist_ok*
parameter.

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2 years agoGH-99334: Explain that `PurePath.is_relative_to()` is purely lexical. (#114031)
Barney Gale [Tue, 23 Jan 2024 01:06:44 +0000 (01:06 +0000)] 
GH-99334: Explain that `PurePath.is_relative_to()` is purely lexical. (#114031)

2 years agogh-66944: Note that the `contextlib.closing` example is for illustrative purposes...
Ville Skyttä [Tue, 23 Jan 2024 01:00:53 +0000 (03:00 +0200)] 
gh-66944: Note that the `contextlib.closing` example is for illustrative purposes (#112198)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2 years agoDocs: minor amendments to runpy.rst (#18416)
Géry Ogam [Tue, 23 Jan 2024 00:00:26 +0000 (01:00 +0100)] 
Docs: minor amendments to runpy.rst (#18416)

- Add missing single quote in inline code
- Align parameter formatting with style guide recommendations
- Fix punctuation around parenthesised sentence

2 years agoAdd me to codeowners for hashlib & multiprocessing (#114454)
Gregory P. Smith [Mon, 22 Jan 2024 23:55:12 +0000 (15:55 -0800)] 
Add me to codeowners for hashlib & multiprocessing (#114454)

I already effectively own these. (multiprocessing reluctantly, but I've
spent enough time in the code of late, it is important, and and
championing some changes, so I may as well be looped in there).

2 years agoDocs: align usage of versionadded/versionchanged with recommended practice (#114409)
Erlend E. Aasland [Mon, 22 Jan 2024 21:40:26 +0000 (22:40 +0100)] 
Docs: align usage of versionadded/versionchanged with recommended practice (#114409)

Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
2 years agogh-113655: Revert extra stack reserve in PGO builds unless UseExtraStackReserve=true...
Steve Dower [Mon, 22 Jan 2024 21:19:16 +0000 (21:19 +0000)] 
gh-113655: Revert extra stack reserve in PGO builds unless UseExtraStackReserve=true (GH-114263)

2 years agogh-112532: Improve mimalloc page visiting (#114133)
Sam Gross [Mon, 22 Jan 2024 21:10:21 +0000 (16:10 -0500)] 
gh-112532: Improve mimalloc page visiting (#114133)

This adds support for visiting abandoned pages in mimalloc and improves
the performance of the page visiting code. Abandoned pages contain
memory blocks from threads that have exited. At some point, they may be
later reclaimed by other threads. We still need to visit those pages in
the free-threaded GC because they contain live objects.

This also reduces the overhead of visiting mimalloc pages:

 * Special cases for full, empty, and pages containing only a single
   block.
 * Fix free_map to use one bit instead of one byte per block.
 * Use fast integer division by a constant algorithm when computing
   block offset from block size and index.

2 years agoGH-114448: Don't sort summarize_stats.py histograms by amount of change (GH-114449)
Michael Droettboom [Mon, 22 Jan 2024 19:45:15 +0000 (14:45 -0500)] 
GH-114448: Don't sort summarize_stats.py histograms by amount of change (GH-114449)

2 years agoFix `wasi.py build` after adding the `clean` subcommand. ({GH-114447)
Brett Cannon [Mon, 22 Jan 2024 18:28:57 +0000 (10:28 -0800)] 
Fix `wasi.py build` after adding the `clean` subcommand. ({GH-114447)

2 years agogh-114257: Ignore the FileNotFound error in ctypes.util._is_elf() (GH-114394)
AN Long [Mon, 22 Jan 2024 17:15:29 +0000 (01:15 +0800)] 
gh-114257: Ignore the FileNotFound error in ctypes.util._is_elf() (GH-114394)

2 years agogh-114083: apply optimization of LOAD_CONST instructions to the whole CFG before...
Irit Katriel [Mon, 22 Jan 2024 17:12:06 +0000 (17:12 +0000)] 
gh-114083: apply optimization of LOAD_CONST instructions to the whole CFG before optimize_basic_block. (#114408)

2 years agogh-75128: Ignore EADDRNOTAVAIL error in asyncio.BaseEventLoop.create_server() (GH...
Serhiy Storchaka [Mon, 22 Jan 2024 16:40:35 +0000 (18:40 +0200)] 
gh-75128: Ignore EADDRNOTAVAIL error in asyncio.BaseEventLoop.create_server() (GH-114420)

Co-authored-by: Antoine Pitrou <pitrou@free.fr>
2 years agogh-101100: Fix Sphinx warnings in `reference/expressions.rst` (#114194)
Hugo van Kemenade [Mon, 22 Jan 2024 16:21:14 +0000 (18:21 +0200)] 
gh-101100: Fix Sphinx warnings in `reference/expressions.rst` (#114194)

2 years agogh-114321: Expose more constants in the fcntl module (GH-114322)
Serhiy Storchaka [Mon, 22 Jan 2024 16:09:22 +0000 (18:09 +0200)] 
gh-114321: Expose more constants in the fcntl module (GH-114322)

2 years agoDocs: Fix typo in code snippet (GH-114421)
Kirill Podoprigora [Mon, 22 Jan 2024 15:56:30 +0000 (18:56 +0300)] 
Docs: Fix typo in code snippet (GH-114421)

2 years agogh-108303: Remove `Lib/test/shadowed_super.py` (#114372)
Nikita Sobolev [Mon, 22 Jan 2024 15:09:10 +0000 (18:09 +0300)] 
gh-108303: Remove `Lib/test/shadowed_super.py` (#114372)

Move code into Lib/test/test_super.py.

2 years agogh-102512: Turn _DummyThread into _MainThread after os.fork() called from a foreign...
Serhiy Storchaka [Mon, 22 Jan 2024 14:14:42 +0000 (16:14 +0200)] 
gh-102512: Turn _DummyThread into _MainThread after os.fork() called from a foreign thread (GH-113261)

Always set a _MainThread as a main thread after os.fork() is called from
a thread started not by the threading module.

A new _MainThread was already set as a new main thread after fork if
threading.current_thread() was not called for a foreign thread before fork.
Now, if it was called before fork, the implicitly created _DummyThread will
be turned into _MainThread after fork.

It fixes, in particularly, an incompatibility of _DummyThread with
the threading shutdown logic which relies on the main thread
having tstate_lock.

Co-authored-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
2 years agogh-103092: Ensure `_ctypes.c` static types are accessed via global state (#113857)
neonene [Mon, 22 Jan 2024 13:40:36 +0000 (22:40 +0900)] 
gh-103092: Ensure `_ctypes.c` static types are accessed via global state (#113857)

2 years agogh-108303: Move `smtpd` to `test.support` (#114368)
Nikita Sobolev [Mon, 22 Jan 2024 13:36:29 +0000 (16:36 +0300)] 
gh-108303: Move `smtpd` to `test.support` (#114368)

Update test_logging.py and test_smtplib.py.

2 years agogh-113796: Add more validation checks in the csv.Dialect constructor (GH-113797)
Serhiy Storchaka [Mon, 22 Jan 2024 13:34:16 +0000 (15:34 +0200)] 
gh-113796: Add more validation checks in the csv.Dialect constructor (GH-113797)

ValueError is now raised if the same character is used in different roles.

2 years agogh-113102: Fix typo in INSTRUMENTED_RESUME (GH-114349)
Guido van Rossum [Mon, 22 Jan 2024 11:56:28 +0000 (03:56 -0800)] 
gh-113102: Fix typo in INSTRUMENTED_RESUME (GH-114349)

2 years agogh-114414: Assert PyType_GetModuleByDef result in _threadmodule (#114415)
Nikita Sobolev [Mon, 22 Jan 2024 09:19:25 +0000 (12:19 +0300)] 
gh-114414: Assert PyType_GetModuleByDef result in _threadmodule (#114415)

2 years agogh-114115: Update documentation of array.array (GH-114117)
Serhiy Storchaka [Mon, 22 Jan 2024 08:42:50 +0000 (10:42 +0200)] 
gh-114115: Update documentation of array.array (GH-114117)

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2 years agogh-114328: tty cbreak mode should not alter ICRNL (#114335)
Gregory P. Smith [Sun, 21 Jan 2024 23:25:52 +0000 (15:25 -0800)] 
gh-114328: tty cbreak mode should not alter ICRNL (#114335)

The terminal CR -> NL mapping setting should be inherited in cbreak mode as OSes do not specify altering it as part of their stty cbreak mode definition.

2 years agogh-111803: Make test_deep_nesting from test_plistlib more strict (GH-114026)
Serhiy Storchaka [Sun, 21 Jan 2024 20:29:51 +0000 (22:29 +0200)] 
gh-111803: Make test_deep_nesting from test_plistlib more strict (GH-114026)

It is no longer silently passed if RecursionError was raised for low
recursion depth.

2 years agogh-114241: Fix and improve the ftplib CLI (GH-114242)
Serhiy Storchaka [Sun, 21 Jan 2024 20:16:45 +0000 (22:16 +0200)] 
gh-114241: Fix and improve the ftplib CLI (GH-114242)

* Fix writing the retrieved binary file to stdout.
* Add a newline after writing warnings to stderr.
* Fix a TypeError if the netrc file doesn't contain a host/default entry.
* Improve the usage message.

2 years agoDocs: align sqlite3 docs with versionadded/versionchanged recommendations (#114400)
Erlend E. Aasland [Sun, 21 Jan 2024 19:54:19 +0000 (20:54 +0100)] 
Docs: align sqlite3 docs with versionadded/versionchanged recommendations (#114400)

When a parameter is added to a function or method, use the 'versionchanged'
directive, not 'versionadded'.

2 years agoDocs: link to sys.stdout in ftplib docs (#114396)
Erlend E. Aasland [Sun, 21 Jan 2024 17:41:21 +0000 (18:41 +0100)] 
Docs: link to sys.stdout in ftplib docs (#114396)

2 years agogh-114384: Align sys.set_asyncgen_hooks signature in docs to reflect implementation...
Nikita Sobolev [Sun, 21 Jan 2024 12:49:49 +0000 (15:49 +0300)] 
gh-114384: Align sys.set_asyncgen_hooks signature in docs to reflect implementation (#114385)

2 years agoDocs: mark up FTP() constructor with param list (#114359)
Erlend E. Aasland [Sun, 21 Jan 2024 11:27:33 +0000 (12:27 +0100)] 
Docs: mark up FTP() constructor with param list (#114359)

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2 years agogh-80931: Skip some socket tests while hunting for refleaks on macOS (#114057)
Ronald Oussoren [Sun, 21 Jan 2024 10:25:15 +0000 (11:25 +0100)] 
gh-80931: Skip some socket tests while hunting for refleaks on macOS (#114057)

Some socket tests related to sending file descriptors cause a file descriptor leak on macOS, all of them tests that send one or more descriptors than cannot be received on the read end.  This appears to be a platform bug.

This PR skips those tests when doing a refleak test run to avoid hiding other problems.

2 years agogh-101100: Fix sphinx warnings in `Doc/c-api/memory.rst` (#114373)
Nikita Sobolev [Sun, 21 Jan 2024 09:34:43 +0000 (12:34 +0300)] 
gh-101100: Fix sphinx warnings in `Doc/c-api/memory.rst` (#114373)

2 years agoDocs: mark up the FTP debug levels as a list (#114360)
Erlend E. Aasland [Sun, 21 Jan 2024 09:19:31 +0000 (10:19 +0100)] 
Docs: mark up the FTP debug levels as a list (#114360)

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2 years agoFix the confusing "User-defined methods" reference in the datamodel (#114276)
cdzhan [Sun, 21 Jan 2024 03:45:38 +0000 (11:45 +0800)] 
Fix the confusing "User-defined methods" reference in the datamodel (#114276)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2 years agoRemove deleted `time_hashlib.py` from `Lib/test/.ruff.toml` (#114355)
Hugo van Kemenade [Sat, 20 Jan 2024 21:10:43 +0000 (23:10 +0200)] 
Remove deleted `time_hashlib.py` from `Lib/test/.ruff.toml` (#114355)

2 years agoRemove the non-test Lib/test/time_hashlib.py. (#114354)
Gregory P. Smith [Sat, 20 Jan 2024 20:09:50 +0000 (12:09 -0800)] 
Remove the non-test Lib/test/time_hashlib.py. (#114354)

I believe I added this while chasing some performance of hash functions
when I first created hashlib.  It hasn't been used since, is frankly
trivial, and not a test.

2 years agoDocs: Add missing line continuation to FTP_TLS class docs (#114352)
Erlend E. Aasland [Sat, 20 Jan 2024 19:39:44 +0000 (20:39 +0100)] 
Docs: Add missing line continuation to FTP_TLS class docs (#114352)

Regression introduced by b1ad5a5d4.

2 years agogh-114281: Remove incorrect type hints from `asyncio.staggered` (#114282)
Nikita Sobolev [Sat, 20 Jan 2024 16:49:48 +0000 (19:49 +0300)] 
gh-114281: Remove incorrect type hints from `asyncio.staggered` (#114282)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>