]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
2 years agogh-111178: Avoid calling functions from incompatible pointer types in dictobject...
Christopher Chavez [Tue, 2 Jan 2024 14:32:37 +0000 (08:32 -0600)] 
gh-111178: Avoid calling functions from incompatible pointer types in dictobject.c (#112892)

Fix undefined behavior warnings (UBSan  -fsanitize=function).

2 years agogh-111178: Avoid calling functions from incompatible pointer types in descrobject...
Christopher Chavez [Tue, 2 Jan 2024 14:03:39 +0000 (08:03 -0600)] 
gh-111178: Avoid calling functions from incompatible pointer types in descrobject.c (GH-112861)

Fix undefined behavior warnings (UBSan  -fsanitize=function), for example:

Python/generated_cases.c.h:3315:13: runtime error: call to function mappingproxy_dealloc through pointer to incorrect function type 'void (*)(struct _object *)'
descrobject.c:1160: note: mappingproxy_dealloc defined here
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior Python/generated_cases.c.h:3315:13 in

2 years agogh-111178: Avoid calling functions from incompatible pointer types in listobject...
Christopher Chavez [Tue, 2 Jan 2024 13:41:32 +0000 (07:41 -0600)] 
gh-111178: Avoid calling functions from incompatible pointer types in listobject.c (GH-112820)

Fix undefined behavior warnings (UBSan  -fsanitize=function), for example:

Objects/object.c:674:11: runtime error: call to function list_repr through pointer to incorrect function type 'struct _object *(*)(struct _object *)'
listobject.c:382: note: list_repr defined here
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior Objects/object.c:674:11 in

2 years agogh-113602: Bail out when the parser tries to override existing errors (#113607)
Pablo Galindo Salgado [Tue, 2 Jan 2024 13:00:52 +0000 (13:00 +0000)] 
gh-113602: Bail out when the parser tries to override existing errors (#113607)

Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
2 years agogh-81094: Refer to PEP 318 in compound_statements.rst (#113588)
John D. McDonald [Tue, 2 Jan 2024 08:40:14 +0000 (02:40 -0600)] 
gh-81094: Refer to PEP 318 in compound_statements.rst (#113588)

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2 years agogh-101100: Fix Sphinx warnings from removed `~!` references (#113629)
Hugo van Kemenade [Tue, 2 Jan 2024 07:37:37 +0000 (09:37 +0200)] 
gh-101100: Fix Sphinx warnings from removed `~!` references (#113629)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2 years agono-issue: Use the official term "free-threading" for GitHub Action (gh-113622)
Donghee Na [Tue, 2 Jan 2024 00:16:53 +0000 (09:16 +0900)] 
no-issue: Use the official term "free-threading" for GitHub Action (gh-113622)

2 years agoGH-113633: Use module state structure for _testcapi. (GH-113634)
Neil Schemenauer [Mon, 1 Jan 2024 23:04:09 +0000 (15:04 -0800)] 
GH-113633: Use module state structure for _testcapi. (GH-113634)

Use module state structure for _testcapi.

2 years agogh-53502: Fixes for tests in gh-113363 (#113627)
Ronald Oussoren [Mon, 1 Jan 2024 20:31:43 +0000 (21:31 +0100)] 
gh-53502: Fixes for tests in gh-113363 (#113627)

* gh-53502: Fixes for tests in gh-113363

* Use 32-bit compatible date in test_dump_naive_datetime_with_aware_datetime_option

* Saving non-aware datetimes will use the old behaviour regardless of the aware_datimetime setting

2 years agogh-53502: add a new option aware_datetime in plistlib to loads or dumps aware datetim...
AN Long [Mon, 1 Jan 2024 18:51:24 +0000 (02:51 +0800)] 
gh-53502: add a new option aware_datetime in plistlib to loads or dumps aware datetime. (#113363)

* add options to loads and dumps aware datetime in plistlib

2 years agogh-113536: Expose `os.waitid` on macOS (#113542)
Ronald Oussoren [Mon, 1 Jan 2024 18:38:29 +0000 (19:38 +0100)] 
gh-113536: Expose `os.waitid` on macOS (#113542)

* gh-113536: Expose `os.waitid` on macOS

This API has been available on macOS for a long time, but was
explicitly excluded due to unspecified problems with the API
in ancient versions of macOS.

* Document that the API is available on macOS starting in Python 3.13

2 years agogh-62260: Fix ctypes.Structure subclassing with multiple layers (GH-13374)
Jeffrey Kintscher [Mon, 1 Jan 2024 16:24:24 +0000 (08:24 -0800)] 
gh-62260: Fix ctypes.Structure subclassing with multiple layers (GH-13374)

The length field of StgDictObject for Structure class contains now
the total number of items in ffi_type_pointer.elements (excluding
the trailing null).

The old behavior of using the number of elements in the parent class can
cause the array to be truncated when it is copied, especially when there
are multiple layers of subclassing.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2 years agobuild(deps): bump hypothesis from 6.91.0 to 6.92.2 in /Tools (#113615)
dependabot[bot] [Mon, 1 Jan 2024 09:42:44 +0000 (09:42 +0000)] 
build(deps): bump hypothesis from 6.91.0 to 6.92.2 in /Tools (#113615)

Bumps [hypothesis](https://github.com/HypothesisWorks/hypothesis) from 6.91.0 to 6.92.2.
- [Release notes](https://github.com/HypothesisWorks/hypothesis/releases)
- [Commits](https://github.com/HypothesisWorks/hypothesis/compare/hypothesis-python-6.91.0...hypothesis-python-6.92.2)

---
updated-dependencies:
- dependency-name: hypothesis
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2 years agobuild(deps): bump github/codeql-action from 2 to 3 (#113613)
dependabot[bot] [Mon, 1 Jan 2024 09:30:30 +0000 (09:30 +0000)] 
build(deps): bump github/codeql-action from 2 to 3 (#113613)

Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2 to 3.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/v2...v3)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2 years agobuild(deps): bump actions/setup-python from 4 to 5 (#113612)
dependabot[bot] [Mon, 1 Jan 2024 09:25:58 +0000 (09:25 +0000)] 
build(deps): bump actions/setup-python from 4 to 5 (#113612)

Bumps [actions/setup-python](https://github.com/actions/setup-python) from 4 to 5.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2 years ago# gh-111700: Fix syntax highlighting for C code in the "What's New In Python 3.12...
Parth Doshi [Mon, 1 Jan 2024 08:08:05 +0000 (00:08 -0800)] 
# gh-111700: Fix syntax highlighting for C code in the "What's New In Python 3.12" documentation (#113609)

Fix PEP 684 syntax highlighting in what's new Python 3.12

2 years agogh-101578: [doc] mention that PyErr_GetRaisedException returns NULL when the error...
Irit Katriel [Sun, 31 Dec 2023 23:16:33 +0000 (23:16 +0000)] 
gh-101578: [doc] mention that PyErr_GetRaisedException returns NULL when the error indicator is not set (#113369)

2 years agogh-101100: Fix Sphinx warnings in `library/configparser.rst` (#113598)
Hugo van Kemenade [Sun, 31 Dec 2023 17:57:33 +0000 (19:57 +0200)] 
gh-101100: Fix Sphinx warnings in `library/configparser.rst` (#113598)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2 years agoUpdate ConfigParser docs defining valid section name (#110506)
Delgan [Sat, 30 Dec 2023 23:18:06 +0000 (00:18 +0100)] 
Update ConfigParser docs defining valid section name (#110506)

2 years agogh-89414: Document that SIGCLD is not available on macOS (#113580)
Ronald Oussoren [Sat, 30 Dec 2023 15:19:47 +0000 (16:19 +0100)] 
gh-89414: Document that SIGCLD is not available on macOS (#113580)

Document that SIGCLD is not available on macOS

2 years agogh-112536: Add support for thread sanitizer (TSAN) (gh-112648)
Samet YASLAN [Sat, 30 Dec 2023 08:17:02 +0000 (09:17 +0100)] 
gh-112536: Add support for thread sanitizer (TSAN) (gh-112648)

2 years agogh-103708: Make directory layout in sysconfig implementation configurable (#103709)
Ankit Kumar Pandey [Fri, 29 Dec 2023 17:55:17 +0000 (23:25 +0530)] 
gh-103708: Make directory layout in sysconfig implementation configurable (#103709)

2 years agogh-103092: Make ``pyexpat`` module importable in sub-interpreters (#113555)
Kirill Podoprigora [Fri, 29 Dec 2023 13:13:46 +0000 (16:13 +0300)] 
gh-103092: Make ``pyexpat`` module importable in sub-interpreters (#113555)

2 years agoGH-113528: Remove a couple of expensive pathlib ABC tests (#113534)
Barney Gale [Thu, 28 Dec 2023 22:44:29 +0000 (22:44 +0000)] 
GH-113528: Remove a couple of expensive pathlib ABC tests (#113534)

Run expensive tests for walking and globbing from `test_pathlib` but not
`test_pathlib_abc`. The ABCs are not as tightly optimised as the classes
in top-level `pathlib`, and so these tests are taking rather a long time on
some buildbots. Coverage of the main `pathlib` classes should suffice.

2 years agoGH-113225: Speed up `pathlib._abc.PathBase.glob()` (#113556)
Barney Gale [Thu, 28 Dec 2023 22:23:01 +0000 (22:23 +0000)] 
GH-113225: Speed up `pathlib._abc.PathBase.glob()` (#113556)

`PathBase._scandir()` is implemented using `iterdir()`, so we can use its
results directly, rather than passing them through `_make_child_relpath()`.

2 years agoDoc/library/os.rst: `os.waitid` absent on MacOS (#104558)
John Hawkinson [Thu, 28 Dec 2023 19:36:20 +0000 (14:36 -0500)] 
Doc/library/os.rst: `os.waitid` absent on MacOS (#104558)

* Doc/library/os.rst: `os.waitid` absent on MacOS

Co-authored-by: AN Long <aisk@users.noreply.github.com>
2 years agogh-101100: Fix Sphinx warnings in library/random.rst (#112981)
Hugo van Kemenade [Thu, 28 Dec 2023 19:29:12 +0000 (21:29 +0200)] 
gh-101100: Fix Sphinx warnings in library/random.rst (#112981)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2 years agogh-113543: Make sure that `MacOSXOSAScript` sends `webbrowser.open` audit event ...
Nikita Sobolev [Thu, 28 Dec 2023 18:58:06 +0000 (21:58 +0300)] 
gh-113543: Make sure that `MacOSXOSAScript` sends `webbrowser.open` audit event (#113544)

2 years agobpo-11102: Make configure enable major(), makedev(), and minor() on HP-UX (GH-19856)
Zackery Spytz [Thu, 28 Dec 2023 10:47:44 +0000 (02:47 -0800)] 
bpo-11102: Make configure enable major(), makedev(), and minor() on HP-UX (GH-19856)

Always include <sys/types.h> before <sys/sysmacros.h>.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2 years agogh-103092: Make `_elementtree` module importable in sub-interpreters (#113434)
Kirill Podoprigora [Thu, 28 Dec 2023 09:12:21 +0000 (12:12 +0300)] 
gh-103092: Make `_elementtree` module importable in sub-interpreters (#113434)

Enable imports of _elementtree module in sub-interpreters

2 years agogh-110459: Make sure --with-openssl-rpath works on macOS (#113441)
Ronald Oussoren [Thu, 28 Dec 2023 08:42:05 +0000 (09:42 +0100)] 
gh-110459: Make sure --with-openssl-rpath works on macOS (#113441)

* gh-110459: Make sure --with-openssl-rpath works on macOS

On macOS the `-rpath` linker flag is spelled differently
than on on platforms.

2 years agogh-73427: deprecate `_enablelegacywindowsfsencoding` (#107729)
Inada Naoki [Thu, 28 Dec 2023 08:31:19 +0000 (17:31 +0900)] 
gh-73427: deprecate  `_enablelegacywindowsfsencoding` (#107729)

2 years agogh-113299: Move cpp.py into libclinic (#113526)
Erlend E. Aasland [Wed, 27 Dec 2023 23:20:57 +0000 (00:20 +0100)] 
gh-113299: Move cpp.py into libclinic (#113526)

2 years agogh-113317: Rework Argument Clinic cpp.py error handling (#113525)
Erlend E. Aasland [Wed, 27 Dec 2023 21:43:19 +0000 (22:43 +0100)] 
gh-113317: Rework Argument Clinic cpp.py error handling (#113525)

Rework error handling in the C preprocessor helper. Instead of monkey-
patching the cpp.Monitor.fail() method from within clinic.py, rewrite
cpp.py to use a subclass of the ClinicError exception. As a side-effect,
ClinicError is moved into Tools/clinic/libclinic/errors.py.

Yak-shaving in preparation for putting cpp.py into libclinic.

2 years agogh-57795: Add news to idlelib/News3.txt (#113522)
Terry Jan Reedy [Wed, 27 Dec 2023 20:51:49 +0000 (15:51 -0500)] 
gh-57795: Add news to idlelib/News3.txt (#113522)

2 years agogh-67641: Clarify documentation on bytes vs text with non-seeking tarfile stream...
Stanley [Wed, 27 Dec 2023 17:16:36 +0000 (09:16 -0800)] 
gh-67641: Clarify documentation on bytes vs text with non-seeking tarfile stream (GH-31610)

2 years agobpo-26791: Update shutil.move() to provide the same symlink move behavior as the...
Jeffrey Kintscher [Wed, 27 Dec 2023 16:23:42 +0000 (08:23 -0800)] 
bpo-26791: Update shutil.move() to provide the same symlink move behavior as the mv shell when moving a symlink into a directory that is the target of the symlink (GH-21759)

2 years agoGH-110109: pathlib ABCs: drop use of `warnings._deprecated()` (#113419)
Barney Gale [Wed, 27 Dec 2023 15:40:03 +0000 (15:40 +0000)] 
GH-110109: pathlib ABCs: drop use of `warnings._deprecated()` (#113419)

The `pathlib._abc` module will be made available as a PyPI backport
supporting Python 3.8+. The `warnings._deprecated()` function was only
added last year, and it's private from an external package perspective, so
here we switch to `warnings.warn()` instead.

2 years agoGH-110109: pathlib ABCs: drop use of `io.text_encoding()` (#113417)
Barney Gale [Wed, 27 Dec 2023 15:32:35 +0000 (15:32 +0000)] 
GH-110109: pathlib ABCs: drop use of `io.text_encoding()` (#113417)

Do not use the locale-specific default encoding in `PathBase.read_text()`
and `write_text()`. Locale settings shouldn't influence the operation of
these base classes, which are intended mostly for implementing rich paths
on *nonlocal* filesystems.

2 years agogh-57795: IDLE: Enter the selected text when opening the "Replace" dialog (GH-17593)
Zackery Spytz [Wed, 27 Dec 2023 14:27:40 +0000 (06:27 -0800)] 
gh-57795: IDLE: Enter the selected text when opening the "Replace" dialog (GH-17593)

Co-authored-by: Roger Serwy <roger.serwy@gmail.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2 years agogh-64020: Deprecate pydoc.ispackage() (GH-20908)
Zackery Spytz [Wed, 27 Dec 2023 14:04:31 +0000 (06:04 -0800)] 
gh-64020: Deprecate pydoc.ispackage() (GH-20908)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2 years agogh-101100: Fix Sphinx warnings in `library/cmd.rst` (#113502)
Hugo van Kemenade [Wed, 27 Dec 2023 10:17:30 +0000 (12:17 +0200)] 
gh-101100: Fix Sphinx warnings in `library/cmd.rst` (#113502)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2 years agogh-101100: Fix Sphinx warnings in `library/calendar.rst` (#113500)
Hugo van Kemenade [Wed, 27 Dec 2023 09:36:17 +0000 (11:36 +0200)] 
gh-101100: Fix Sphinx warnings in `library/calendar.rst` (#113500)

2 years agogh-111615: Fix regression in QueueHandler configuration. (GH-111638)
Vinay Sajip [Wed, 27 Dec 2023 09:35:15 +0000 (09:35 +0000)] 
gh-111615: Fix regression in QueueHandler configuration. (GH-111638)

2 years agogh-113350: Improve the wording of python logging docs to remove an ambiguity around...
Vaishnavi Maheshwari [Wed, 27 Dec 2023 07:51:45 +0000 (13:21 +0530)] 
gh-113350: Improve the wording of python logging docs to remove an ambiguity around use of the word "higher". (GH-113491)

Co-authored-by: Wei-Hsiang (Matt) Wang <mattwang44@gmail.com>
2 years agogh-113332: Simplify calls to SSL_(CTX_)set_verify in _ssl.c (#113333)
David Benjamin [Tue, 26 Dec 2023 21:35:41 +0000 (16:35 -0500)] 
gh-113332: Simplify calls to SSL_(CTX_)set_verify in _ssl.c (#113333)

_ssl.c currently tries to preserve the verification callback, but at no
point does it ever set one. Just pass in NULL.

2 years agogh-101100: Fix Sphinx warnings in `library/bisect.rst` (#113496)
Hugo van Kemenade [Tue, 26 Dec 2023 21:12:15 +0000 (23:12 +0200)] 
gh-101100: Fix Sphinx warnings in `library/bisect.rst` (#113496)

2 years agogh-101100: Fix Sphinx warnings in `howto/isolating-extensions.rst` (#113493)
Hugo van Kemenade [Tue, 26 Dec 2023 19:40:48 +0000 (21:40 +0200)] 
gh-101100: Fix Sphinx warnings in `howto/isolating-extensions.rst` (#113493)

2 years agobpo-36959: Fix error messages for invalid ISO format string in _strptime() (GH-13408)
Gordon P. Hemsley [Tue, 26 Dec 2023 19:26:17 +0000 (14:26 -0500)] 
bpo-36959: Fix error messages for invalid ISO format string in _strptime() (GH-13408)

Previously some error messages complained about incompatible
combinations of directives that are not contained in the format string.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2 years agogh-112532: Fix peg generator build.py for mimalloc build (gh-113492)
Donghee Na [Tue, 26 Dec 2023 17:54:16 +0000 (17:54 +0000)] 
gh-112532: Fix peg generator build.py for mimalloc build (gh-113492)

gh-112532: Fix peg generator for mimalloc build

2 years agogh-112532: Use separate mimalloc heaps for GC objects (gh-113263)
Sam Gross [Tue, 26 Dec 2023 16:53:20 +0000 (11:53 -0500)] 
gh-112532: Use separate mimalloc heaps for GC objects (gh-113263)

* gh-112532: Use separate mimalloc heaps for GC objects

In `--disable-gil` builds, we now use four separate heaps in
anticipation of using mimalloc to find GC objects when the GIL is
disabled. To support this, we also make a few changes to mimalloc:

* `mi_heap_t` and `mi_tld_t` initialization is split from allocation.
  This allows us to have a `mi_tld_t` per-`PyThreadState`, which is
  important to keep interpreter isolation, since the same OS thread may
  run in multiple interpreters (using different PyThreadStates.)

* Heap abandoning (mi_heap_collect_ex) can now be called from a
  different thread than the one that created the heap. This is necessary
  because we may clear and delete the containing PyThreadStates from a
  different thread during finalization and after fork().

* Use enum instead of defines and guard mimalloc includes.

* The enum typedef will be convenient for future PRs that use the type.
* Guarding the mimalloc includes allows us to unconditionally include
  pycore_mimalloc.h from other header files that rely on things like
  `struct _mimalloc_thread_state`.

* Only define _mimalloc_thread_state in Py_GIL_DISABLED builds

2 years agogh-111971: Make _PyUnicode_FromId thread-safe in --disable-gil (gh-113489)
Donghee Na [Tue, 26 Dec 2023 16:48:33 +0000 (16:48 +0000)] 
gh-111971: Make _PyUnicode_FromId thread-safe in --disable-gil (gh-113489)

2 years agoDocs: make htmllive: open browser when ready (#113288)
Hugo van Kemenade [Tue, 26 Dec 2023 12:02:13 +0000 (14:02 +0200)] 
Docs: make htmllive: open browser when ready (#113288)

2 years agogh-113468: Remove the "_new_ suffix from class names in pydocfodder (GH-113469)
Serhiy Storchaka [Tue, 26 Dec 2023 10:54:05 +0000 (12:54 +0200)] 
gh-113468: Remove the "_new_ suffix from class names in pydocfodder (GH-113469)

2 years agogh-66515: mailbox.MH now supports folders withou the ".mh_sequences" file (GH-804)
Serhiy Storchaka [Tue, 26 Dec 2023 09:15:14 +0000 (11:15 +0200)] 
gh-66515: mailbox.MH now supports folders withou the ".mh_sequences" file (GH-804)

(for example Claws Mail IMAP-cache folders).

2 years agoMisc minor improvements to the itertools recipes (gh-113477)
Raymond Hettinger [Mon, 25 Dec 2023 22:26:04 +0000 (16:26 -0600)] 
Misc minor improvements to the itertools recipes (gh-113477)

2 years agogh-106905: Use separate structs to track recursion depth in each PyAST_mod2obj call...
Yilei Yang [Mon, 25 Dec 2023 17:36:59 +0000 (09:36 -0800)] 
gh-106905: Use separate structs to track recursion depth in each PyAST_mod2obj call. (GH-113035)

Co-authored-by: Gregory P. Smith [Google LLC] <greg@krypto.org>
2 years agobpo-21360: mailbox.Maildir now ignores files with a leading dot (GH-11833)
Zackery Spytz [Mon, 25 Dec 2023 15:07:51 +0000 (07:07 -0800)] 
bpo-21360: mailbox.Maildir now ignores files with a leading dot (GH-11833)

The maildir format specification states that files with a leading dot
should be ignored.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2 years agofix bullet-list in `LOAD_SUPER_ATTR` documentation on `dis` page (#113461)
denballakh [Sun, 24 Dec 2023 20:28:39 +0000 (23:28 +0300)] 
fix bullet-list in `LOAD_SUPER_ATTR` documentation on `dis` page (#113461)

2 years agoGH-111485: Fix handling of FOR_ITER in Tier 2 (GH-113394)
Mark Shannon [Sun, 24 Dec 2023 18:07:34 +0000 (18:07 +0000)] 
GH-111485:  Fix handling of FOR_ITER in Tier 2 (GH-113394)

2 years agogh-113407: Fix import of unittest.mock when CPython is built without docstrings ...
Serhiy Storchaka [Sun, 24 Dec 2023 11:38:56 +0000 (13:38 +0200)] 
gh-113407: Fix import of unittest.mock when CPython is built without docstrings (GH-113408)

2 years agoAdd codeowners for `Lib/ensurepip/` (#112805)
Alex Waygood [Sun, 24 Dec 2023 11:09:50 +0000 (11:09 +0000)] 
Add codeowners for `Lib/ensurepip/` (#112805)

2 years agogh-113191: Add support of os.fchmod() on Windows (GH-113192)
Serhiy Storchaka [Sun, 24 Dec 2023 10:57:11 +0000 (12:57 +0200)] 
gh-113191: Add support of os.fchmod() on Windows (GH-113192)

Also support a file descriptor in os.chmod().

2 years agogh-113440: Ignore the "ver" command failure with exit code 0xc0000142 (GH-113435)
Serhiy Storchaka [Sun, 24 Dec 2023 10:31:23 +0000 (12:31 +0200)] 
gh-113440: Ignore the "ver" command failure with exit code 0xc0000142 (GH-113435)

2 years agogh-113421: Fix multiprocessing logger for "%(filename)s" (GH-113423)
Xu Song [Sun, 24 Dec 2023 10:04:12 +0000 (18:04 +0800)] 
gh-113421: Fix multiprocessing logger for "%(filename)s" (GH-113423)

2 years agogh-113028: Correctly memoize str in pickle when escapes added (GH-113436)
Jeff Allen [Sun, 24 Dec 2023 09:43:44 +0000 (09:43 +0000)] 
gh-113028: Correctly memoize str in pickle when escapes added (GH-113436)

This fixes a divergence between the Python and C implementations of pickle
for protocol 0, such that it pickle.py fails to re-use the first pickled
representation of strings involving characters that have to be escaped.

2 years agogh-111784: Fix two segfaults in the elementtree module (GH-113405)
Kirill Podoprigora [Sun, 24 Dec 2023 08:57:41 +0000 (11:57 +0300)] 
gh-111784: Fix two segfaults in the elementtree module (GH-113405)

First fix resolve situation when pyexpat module (which contains expat_CAPI
capsule) deallocates before _elementtree, so we need to hold a strong
reference to pyexpat module to.

Second fix resolve situation when module state is deallocated before
deallocation of XMLParser instances, which uses module state to clear
some stuff.

2 years agogh-112559: Avoid unnecessary conversion attempts to enum_klass in signal.py (#113040)
Yilei Yang [Sun, 24 Dec 2023 01:07:52 +0000 (17:07 -0800)] 
gh-112559: Avoid unnecessary conversion attempts to enum_klass in signal.py (#113040)

2 years agogh-112800: Ignore PermissionError on SubprocessTransport.close() in asyncio (#112803)
Allison Karlitskaya [Sun, 24 Dec 2023 00:43:39 +0000 (01:43 +0100)] 
gh-112800: Ignore PermissionError on SubprocessTransport.close() in asyncio (#112803)

In case the spawned process is setuid, we may not be able to send
signals to it, in which case our .kill() call will raise
PermissionError.

Ignore that in order to avoid .close() raising an exception.  Hopefully
the process will exit as a result of receiving EOF on its stdin.

2 years agogh-113317: Move more formatting helpers into libclinic (#113438)
Erlend E. Aasland [Sat, 23 Dec 2023 17:08:10 +0000 (18:08 +0100)] 
gh-113317: Move more formatting helpers into libclinic (#113438)

Move the following global helpers into libclinic:
- format_escape()
- normalize_snippet()
- wrap_declarations()

Also move strip_leading_and_trailing_blank_lines() and make it internal to libclinic.

2 years agoFix trivial typo in test_interpreters (GH-113381)
Jeff Allen [Sat, 23 Dec 2023 14:10:41 +0000 (14:10 +0000)] 
Fix trivial typo in test_interpreters (GH-113381)

2 years agogh-74573: document that ndbm can silently corrupt databases on macOS (#113354)
Ronald Oussoren [Sat, 23 Dec 2023 12:33:34 +0000 (13:33 +0100)] 
gh-74573: document that ndbm can silently corrupt databases on macOS (#113354)

* gh-74573: document that ndbm can silently corrupt databases on macOS

The system ndbm implementation on macOS has an undocumented limitation
on the size of values and can silently corrupt database files when those
are exceeded.

Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2 years agogh-113188: Fix shutil.copymode() on Windows (GH-113189)
Serhiy Storchaka [Sat, 23 Dec 2023 11:07:54 +0000 (13:07 +0200)] 
gh-113188: Fix shutil.copymode() on Windows (GH-113189)

Previously it worked differently if dst is a symbolic link:
it modified the permission bits of dst itself rather than the file
it points to if follow_symlinks is true or src is not a symbolic link,
and did nothing if follow_symlinks is false and src is a symbolic link.

Also document similar changes in shutil.copystat().

2 years agogh-112925: Fix error in example of `datetime.time.fromisoformat` and add doctest...
F-park [Sat, 23 Dec 2023 10:44:27 +0000 (18:44 +0800)] 
gh-112925: Fix error in example of `datetime.time.fromisoformat` and add doctest marker (GH-112931)

2 years agogh-81682: Fix test failures when CPython is built without docstrings (GH-113410)
Serhiy Storchaka [Sat, 23 Dec 2023 09:56:30 +0000 (11:56 +0200)] 
gh-81682: Fix test failures when CPython is built without docstrings (GH-113410)

2 years agogh-113317: Clean up Argument Clinic global namespace (#113414)
Erlend E. Aasland [Sat, 23 Dec 2023 00:37:39 +0000 (01:37 +0100)] 
gh-113317: Clean up Argument Clinic global namespace (#113414)

Split up clinic.py by establishing libclinic as a support package for
Argument Clinic. Get rid of clinic.py globals by either making them
class members, or by putting them into libclinic.

- Move INCLUDE_COMMENT_COLUMN to BlockPrinter
- Move NO_VARARG to CLanguage
- Move formatting helpers to libclinic
- Move some constants to libclinic (and annotate them as Final)

2 years agogh-113317: Remove TextAccumulator type alias from clinic.py (#113413)
Erlend E. Aasland [Fri, 22 Dec 2023 22:35:16 +0000 (23:35 +0100)] 
gh-113317: Remove TextAccumulator type alias from clinic.py (#113413)

Clean-up after gh-113402.

2 years agoGH-110109: Adjust `test_pathlib_abc` imports to ease backporting (#113411)
Barney Gale [Fri, 22 Dec 2023 20:59:17 +0000 (20:59 +0000)] 
GH-110109: Adjust `test_pathlib_abc` imports to ease backporting (#113411)

This very boring patch reduces the number of changes needed in
`test_pathlib_abc.py` when backporting to the external `pathlib_abc`
package.

2 years agogh-113317: Argument Clinic: tear out internal text accumulator APIs (#113402)
Erlend E. Aasland [Fri, 22 Dec 2023 20:28:15 +0000 (21:28 +0100)] 
gh-113317: Argument Clinic: tear out internal text accumulator APIs (#113402)

Replace the internal accumulator APIs by using lists of strings and join().

Yak-shaving for separating out formatting code into a separate file.

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2 years agoGH-110109: pathlib ABCs: do not vary path syntax by host OS. (#113219)
Barney Gale [Fri, 22 Dec 2023 18:09:50 +0000 (18:09 +0000)] 
GH-110109: pathlib ABCs: do not vary path syntax by host OS. (#113219)

Change the value of `pathlib._abc.PurePathBase.pathmod` from `os.path` to
`posixpath`.

User subclasses of `PurePathBase` and `PathBase` previously used the host
OS's path syntax, e.g. backslashes as separators on Windows. This is wrong
in most use cases, and likely to catch developers out unless they test on
both Windows and non-Windows machines.

In this patch we change the default to POSIX syntax, regardless of OS. This
is somewhat arguable (why not make all aspects of syntax abstract and
individually configurable?) but an improvement all the same.

This change has no effect on `PurePath`, `Path`, nor their subclasses. Only
private APIs are affected.

2 years agoGH-112855: Slightly improve tests for `pathlib.PurePath` pickling (#113243)
Barney Gale [Fri, 22 Dec 2023 17:49:09 +0000 (17:49 +0000)] 
GH-112855: Slightly improve tests for `pathlib.PurePath` pickling (#113243)

Add a few more simple test cases, like non-anchored paths. Remove misplaced
and indirect test that pickling doesn't change the `stat()` value.

2 years agogh-113212: Improve error message & document zero-arg super inside nested functions...
Yan Yanchii [Fri, 22 Dec 2023 15:12:08 +0000 (16:12 +0100)] 
gh-113212: Improve error message & document zero-arg super inside nested functions and generator expressions (GH-113307)

2 years agoGH-110109: Fix misleading `pathlib._abc.PurePathBase` repr (#113376)
Barney Gale [Fri, 22 Dec 2023 15:11:16 +0000 (15:11 +0000)] 
GH-110109: Fix misleading `pathlib._abc.PurePathBase` repr (#113376)

`PurePathBase.__repr__()` produces a string like `MyPath('/foo')`. This
repr is incorrect/misleading when a subclass's `__init__()` method is
customized, which I expect to be the very common.

This commit moves the `__repr__()` method to `PurePath`, leaving
`PurePathBase` with the default `object` repr.

No user-facing changes because the `pathlib._abc` module remains private.

2 years agoGH-112215: Increase C recursion limit for non debug builds (GH-113397)
Mark Shannon [Fri, 22 Dec 2023 14:25:25 +0000 (14:25 +0000)] 
GH-112215: Increase C recursion limit for non debug builds (GH-113397)

2 years agogh-109989: Fix test_c_locale_coercion when PYTHONIOENCODING is set (#113378)
Ronald Oussoren [Fri, 22 Dec 2023 11:09:16 +0000 (12:09 +0100)] 
gh-109989: Fix test_c_locale_coercion when PYTHONIOENCODING is set (#113378)

* gh-109989: Fix test_c_locale_coercion when PYTHONIOENCODING is set

This fixes the existing tests when PYTHONIOENCODING is
set by unsetting PYTHONIOENCODING.

Also add a test that explicitly checks what happens
when PYTHONIOENCODING is set.

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2 years agogh-113384: Skip test_freeze for framework builds on macOS (#113390)
Ronald Oussoren [Fri, 22 Dec 2023 10:35:54 +0000 (11:35 +0100)] 
gh-113384: Skip test_freeze for framework builds on macOS (#113390)

2 years agogh-113297: Fix segfault in compiler for with statement with 19 context managers ...
Irit Katriel [Fri, 22 Dec 2023 01:50:26 +0000 (01:50 +0000)] 
gh-113297: Fix segfault in compiler for with statement with 19 context managers (#113327)

2 years agogh-112027: Don't print mimalloc warning after mmap() call (gh-113372)
Sam Gross [Fri, 22 Dec 2023 00:38:27 +0000 (19:38 -0500)] 
gh-112027: Don't print mimalloc warning after mmap() call (gh-113372)

gh-112027: Don't print mimalloc warning after mmap

This changes the warning to a "verbose"-level message in prim.c. The
address passed to mmap is only a hint -- it's normal for mmap() to
sometimes not respect the hint and return a different address.

2 years agoBump mypy to 1.8.0 (#113385)
Alex Waygood [Thu, 21 Dec 2023 23:14:24 +0000 (23:14 +0000)] 
Bump mypy to 1.8.0 (#113385)

2 years agogh-113157 gh-89519: Fix method descriptors (gh-113233)
Raymond Hettinger [Thu, 21 Dec 2023 22:08:35 +0000 (16:08 -0600)] 
gh-113157 gh-89519:  Fix method descriptors (gh-113233)

Restore behaviors before classmethod descriptor chaining was introduced.

2 years agogh-113313: Note that slice support is not required for all sequences. (gh-113377)
Raymond Hettinger [Thu, 21 Dec 2023 21:54:59 +0000 (15:54 -0600)] 
gh-113313: Note that slice support is not required for all sequences. (gh-113377)

2 years agogh-113370: Add missing obmalloc.o dependencies on mimalloc (#113371)
Sam Gross [Thu, 21 Dec 2023 21:44:55 +0000 (16:44 -0500)] 
gh-113370: Add missing obmalloc.o dependencies on mimalloc (#113371)

2 years agogh-95754: Better AttributeError on partially initialised module (#112577)
Shantanu [Thu, 21 Dec 2023 21:24:10 +0000 (13:24 -0800)] 
gh-95754: Better AttributeError on partially initialised module (#112577)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2 years agogh-113174: Sync with importlib_metadata 7.0 (#113175)
Jason R. Coombs [Thu, 21 Dec 2023 20:04:05 +0000 (15:04 -0500)] 
gh-113174: Sync with importlib_metadata 7.0 (#113175)

* Sync with importlib_metadata 7.0.0

* Add blurb

* Update docs to reflect changes.

* Link datamodel docs for object.__getitem__

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
* Add what's new for removed __getattr__

* Link datamodel docs for object.__getitem__

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
* Add exclamation point, as that seems to be used for other classes.

---------

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2 years agogh-113343: Fix error check on mmap(2) (#113342)
Namhyung Kim [Thu, 21 Dec 2023 19:28:55 +0000 (11:28 -0800)] 
gh-113343: Fix error check on mmap(2) (#113342)

Fix error check on mmap(2)

It should check MAP_FAILED instead of NULL for error.

On mmap(2) man page:

  RETURN VALUE
       On success, mmap() returns a pointer to the mapped area.
       On error, the value MAP_FAILED (that is, (void *) -1) is
       returned, and errno is set to indicate the error.

2 years agogh-113325: Remove a debugging print accidentally left in test_symtable (GH-113368)
Serhiy Storchaka [Thu, 21 Dec 2023 18:12:07 +0000 (20:12 +0200)] 
gh-113325: Remove a debugging print accidentally left in test_symtable (GH-113368)

2 years agogh-65701: document that freeze doesn't work with framework builds on macOS (#113352)
Ronald Oussoren [Thu, 21 Dec 2023 15:28:00 +0000 (16:28 +0100)] 
gh-65701: document that freeze doesn't work with framework builds on macOS (#113352)

* gh-65701: document that freeze doesn't work with framework builds on macOS

The framework install is inherently incompatible with freeze. Document
that that freeze doesn't work with framework builds and bail out
early when trying to run freeze anyway.

Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2 years agogh-110383: Improve accuracy of str.split() and str.rsplit() docstrings (#113355)
Erlend E. Aasland [Thu, 21 Dec 2023 14:22:39 +0000 (15:22 +0100)] 
gh-110383: Improve accuracy of str.split() and str.rsplit() docstrings (#113355)

Clarify split direction in the docstring body,
instead of in the 'maxsplit' param docstring.

2 years agogh-87277: Don't look for X11 browsers on macOS in webbrowser (#24480)
Ronald Oussoren [Thu, 21 Dec 2023 13:43:38 +0000 (14:43 +0100)] 
gh-87277: Don't look for X11 browsers on macOS in webbrowser (#24480)

The installation of XQuartz on macOS will unconditionally
set the $DISPLAY variable. The X11 server will be launched
when a program tries to access the display.  This results
in launching the X11 server when using the webbrowser module,
even though X11 browsers won't be used in practice.

2 years agoGH-111485: Delete the old generator code. (GH-113321)
Mark Shannon [Thu, 21 Dec 2023 12:46:28 +0000 (12:46 +0000)] 
GH-111485: Delete the old generator code. (GH-113321)