Commit Graph

119878 Commits

Author SHA1 Message Date
Taylor Packard ed8720ace4
gh-112758: Updated pathlib documentation for PurePath.match (#112814) 2023-12-08 18:13:17 +00:00
Raymond Hettinger f3bff4ee9d
gh-112540: Support zero inputs in geometric_mean() (gh-112880) 2023-12-08 12:05:56 -06:00
Barney Gale 76929fdeeb
GH-110109: Add `pathlib._PurePathBase` (#110670)
Add private `pathlib._PurePathBase` class: a private superclass of both `PurePath` and `_PathBase`. Unlike `PurePath`, it does not define any of these special methods: `__fspath__`, `__bytes__`, `__reduce__`, `__hash__`, `__eq__`, `__lt__`, `__le__`, `__gt__`, `__ge__`. Its initializer and path joining methods accept only strings, not os.PathLike objects more broadly.

This is important for supporting *virtual paths*: user subclasses of `_PathBase` that provide access to archive files, FTP servers, etc. In these classes, the above methods should be implemented by users only as appropriate, with due consideration for the hash/equality of any backing objects, such as file objects or sockets.
2023-12-08 17:39:04 +00:00
AN Long 5a0137ca34
gh-112278: In _wmi, treat initialization timeout separately from connection timeout (GH-112878) 2023-12-08 16:52:22 +00:00
Sam Gross 4d1eea59bd
gh-112779: Check 1-byte atomics in configure (gh-112819) 2023-12-08 16:31:32 +00:00
Donghee Na c744dbe9ac
gh-112535: Update _Py_ThreadId() to support s390/s390x (gh-112751) 2023-12-08 23:28:07 +09:00
Seth Michael Larson e6ac25429f
gh-112302: Annotate SBOM file as generated in .gitattributes (#112854)
Annotate SBOM file as generated in .gitattributes
2023-12-08 14:46:19 +01:00
Alex Waygood ed21d0c1f4
gh-101100: Improve documentation for attributes on instance methods (#112832) 2023-12-08 13:18:53 +00:00
Alex Waygood e4c0876033
gh-101100: Fix Sphinx nits in `library/contextlib.rst` (#112870) 2023-12-08 13:17:57 +00:00
Alex Waygood 3cdcc2edf8
gh-101100: Fix Sphinx nitpicks in `library/shelve.rst` (#112836) 2023-12-08 14:31:11 +02:00
Mark Shannon aefdebdef1
GH-111485: Factor out opcode ID generator from the main cases generator. (GH-112831) 2023-12-08 11:48:30 +00:00
Ronald Oussoren 15a80b15af
gh-110820: Make sure processor specific defines are correct for Universal 2 build on macOS (#112828)
* gh-110820: Make sure processor specific defines are correct for Universal 2 build on macOS

A number of processor specific defines are different for x86-64 and
arm64, and need to be adjusted in pymacconfig.h.

* remove debug stuf
2023-12-08 10:09:34 +01:00
Serhiy Storchaka 4ac1e8fb25
Add a versionchanged directive for gh-94692 (GH-112846)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-12-08 10:18:15 +02:00
Barney Gale 28b2b7407c
GH-112675: Move path joining tests into `test_posixpath` and `test_ntpath` (#112676)
In `test_pathlib`, the `check_drive_root_parts` test methods evaluated
both joining and parsing/normalisation of paths. This dates from a time
when pathlib implemented both functions itself, but nowadays path joining
is done with `posixpath.join()` and `ntpath.join()`.

This commit moves the joining-related test cases into `test_posixpath` and
`test_ntpath`.
2023-12-07 21:45:40 +00:00
Alex Waygood 2c3906bc4b
gh-101100: Silence Sphinx warnings when `ntpath` or `posixpath` are referenced (#112833) 2023-12-07 20:57:30 +00:00
Eric Snow 64d8b4c709
gh-112826: Add a "What's New" Entry About _thread._is_main_interpreter (gh-112853)
As of gh-112661, the threading module expects the _thread module to have a _is_main_interpreter(), which is used in the internal threading._shutdown().  This change causes a problem for anyone that replaces the _thread module with a custom one (only if they don't provide _is_main_interpreter()).  They need to be sure to add it for 3.13+, thus this PR is adding a note in "What's New".

This also forward-ports the "What's New" entry from 3.12 (gh-112850).  Note that we do not also forward-port the fix in that PR.  The fix is there only due to a regression from 3.12.0. There is no regression in 3.13+.
2023-12-07 13:22:15 -07:00
Sam Gross cf6110ba13
gh-111924: Use PyMutex for Runtime-global Locks. (gh-112207)
This replaces some usages of PyThread_type_lock with PyMutex, which does not require memory allocation to initialize.

This simplifies some of the runtime initialization and is also one step towards avoiding changing the default raw memory allocator during initialize/finalization, which can be non-thread-safe in some circumstances.
2023-12-07 12:33:40 -07:00
Sam Gross db460735af
gh-112538: Add internal-only _PyThreadStateImpl "wrapper" for PyThreadState (gh-112560)
Every PyThreadState instance is now actually a _PyThreadStateImpl.
It is safe to cast from `PyThreadState*` to `_PyThreadStateImpl*` and back.
The _PyThreadStateImpl will contain fields that we do not want to expose
in the public C API.
2023-12-07 12:11:45 -07:00
Ronald Oussoren bf0beae6a0
gh-110017: Disable test_signal.test_stress_modifying_handlers on macOS (#112834)
Test test_stress_modifying_handlers in test_signal can crash
the interpreter due to a bug in macOS. Filed as FB13453490
with Apple.
2023-12-07 19:41:27 +01:00
AN Long a955fd68d6
gh-112278: Disable WMI queries on Windows after they time out (GH-112658) 2023-12-07 17:26:29 +00:00
Serhiy Storchaka b2923a61a1
gh-79325: Fix recursion error in TemporaryDirectory cleanup on Windows (GH-112762) 2023-12-07 17:21:36 +00:00
Serhiy Storchaka ba18893555
gh-87319: Simplify TemporaryDirectory cleanup using os.path.isjunction() (GH-112791) 2023-12-07 18:32:10 +02:00
Søren Løvborg 81c16cd94e
gh-91133: tempfile.TemporaryDirectory: fix symlink bug in cleanup (GH-99930)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-12-07 18:04:06 +02:00
Seth Michael Larson 21221c398f
gh-112302: Add Software Bill-of-Materials (SBOM) tracking for dependencies (#112303) 2023-12-07 18:01:58 +02:00
Sam Gross 2d76be251d
gh-111962: Make dtoa thread-safe in `--disable-gil` builds. (#112049)
This updates `dtoa.c` to avoid using the Bigint free-list in --disable-gil builds and
to pre-computes the needed powers of 5 during interpreter initialization.

* gh-111962: Make dtoa thread-safe in `--disable-gil` builds.

This avoids using the Bigint free-list in `--disable-gil` builds
and pre-computes the needed powers of 5 during interpreter initialization.

* Fix size of cached powers of 5 array.

We need the powers of 5 up to 5**512 because we only jump straight to
underflow when the exponent is less than -512 (or larger than 308).

* Rename Py_NOGIL to Py_GIL_DISABLED

* Changes from review

* Fix assertion placement
2023-12-07 13:47:55 +00:00
Łukasz Langa 9f67042f28
gh-110190: Temporarily skip new test introduced in gh-112604 on PPC64LE (#112818) 2023-12-07 14:29:15 +01:00
Christopher Chavez 7576534f4a
bpo-42519: Remove outdated sentence in comment (#112822)
Update objimpl.h
2023-12-07 14:24:11 +01:00
andrewluotechnologies 9c3458e058
gh-112125: Fix None.__ne__(None) returning NotImplemented instead of False (#112504) 2023-12-07 13:56:01 +01:00
Mark Shannon b449415b2f
GH-111485: Separate out parsing, analysis and code-gen phases of tier 1 code generator (GH-112299) 2023-12-07 12:49:40 +00:00
Tian Gao 3d712a9f4c
gh-102980: Redirect output of pdb's `interact` command, add tests and improve docs (#111194) 2023-12-07 11:19:33 +00:00
Ronald Oussoren 4b125dd31a
gh-51944: Add missing macOS constants to termios (#112823)
* gh-51944: Add some macOS constants to termios

This changeset adds all public constants in <termio.h>
and <sys/termios.h> on macOS that weren't present
already.

Based on the macOS 14.2 SDK

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-12-07 11:27:30 +01:00
Kushal Das 4ba15de191
gh-74616: Raise ValueError in case of null character in input prompt (GH-1738)
If the input prompt to the builtin input function on terminal has any null
character, then raise ValueError instead of silently truncating it.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-12-07 10:22:52 +00:00
Serhiy Storchaka 8660fb7fd7
gh-112660: Do not clear arbitrary errors on import (GH-112661)
Previously arbitrary errors could be cleared during formatting error
messages for ImportError or AttributeError for modules. Now all
unexpected errors are reported.
2023-12-07 12:19:43 +02:00
Ronald Oussoren 953ee622b3
gh-109981: Fix support.fd_count() on macOS 14 (#112797)
Use scanning "/dev/fd/" on macOS in support.fd_count(). That's both more efficient than scanning all possible file descriptors, and avoids crashing the interpreter when there are open "guarded" file descriptors.

"Guarded" file descriptors are a macOS feature where file descriptors used by system libraries are marked and cause hard crashes when used by "user" code.

Co-authored-by: Victor Stinner <vstinner@python.org>
2023-12-07 10:30:15 +01:00
Pablo Galindo Salgado 16448cab44
gh-112730: Use color to highlight error locations (gh-112732)
Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2023-12-06 23:29:54 +01:00
Alex Waygood 3870d19d15
gh-101100: Fix Sphinx nitpicks in `library/reprlib.rst` (#112811) 2023-12-06 20:16:12 +00:00
Alex Waygood e9707d3c3d
gh-101100: Improve documentation of code object attributes (#112781) 2023-12-06 20:15:46 +00:00
Christopher Chavez b920d6ceaa
gh-111178: Define `visitproc` callback functions properly and remove unnecessary casts in gcmodule.c (#112687) 2023-12-06 15:30:37 +00:00
Serhiy Storchaka cc7e45cc57
gh-75666: Tkinter: "unbind(sequence, funcid)" now only unbinds "funcid" (GH-111322)
Previously, "widget.unbind(sequence, funcid)" destroyed the current binding
for "sequence", leaving "sequence" unbound, and deleted the "funcid"
command.

Now it removes only "funcid" from the binding for "sequence", keeping
other commands, and deletes the "funcid" command.
It leaves "sequence" unbound only if "funcid" was the last bound command.

Co-authored-by: GiovanniL <13402461+GiovaLomba@users.noreply.github.com>
2023-12-06 16:42:15 +02:00
Victor Stinner 828451dfde
gh-111545: Add Py_HashPointer() function (#112096)
* Implement _Py_HashPointerRaw() as a static inline function.
* Add Py_HashPointer() tests to test_capi.test_hash.
* Keep _Py_HashPointer() function as an alias to Py_HashPointer().
2023-12-06 15:09:22 +01:00
Victor Stinner f8852634ed
gh-108223: Refer to PEP 703 as Free Threading (#112780) 2023-12-06 12:55:58 +01:00
Christopher Chavez 00cce0fe49
gh-111178: Docs: fix `traverseproc`, `inquiry`, and `destructor` parameters in slot typedefs table (GH-112742)
In the slot typedefs table, the parameter of `destructor`
and the first parameter of `traverseproc` should both be
`PyObject *` rather than `void *`.
Same for `inquiry`.
2023-12-06 10:44:41 +01:00
Alex Waygood e3f670e137
gh-101100: Fix most Sphinx nitpicks in the glossary and `stdtypes.rst` (#112757) 2023-12-06 08:44:06 +00:00
Serhiy Storchaka f8c0198e3b
gh-108927: Include new dir test/regrtestdata in the installation (GH-112765)
Co-authored-by: Victor Stinner <vstinner@python.org>
2023-12-06 09:48:27 +02:00
Matt Prodani a2a46f9f1e
gh-112606: Use sem_clockwait with monotonic time when supported in parking_lot.c (gh-112733) 2023-12-06 15:54:57 +09:00
Miro Hrončok d384813ff1
gh-112769: test_zlib: Fix comparison of ZLIB_RUNTIME_VERSION with non-int suffix (GH-112771)
zlib-ng defines the version as "1.3.0.zlib-ng".
2023-12-05 21:39:28 +02:00
Alex Waygood d109f637c0
gh-101100: Properly document frame object attributes (#112735) 2023-12-05 19:27:59 +00:00
Jurjen N. E. Bos c2e2df8356
Minor stylistic edit to the grouper recipe (gh112759) 2023-12-05 12:44:06 -06:00
Zackery Spytz 11d88a178b
bpo-35332: Handle os.close() errors in shutil.rmtree() (GH-23766)
* Ignore os.close() errors when ignore_errors is True.
* Pass os.close() errors to the error handler if specified.
* os.close no longer retried after error.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-12-05 19:09:39 +02:00
Ethan Furman de6bca9564
gh-112328: [Enum] Make some private attributes public. (GH-112514)
* [Enum] Make some private attributes public.

- ``_EnumDict`` --> ``EnumDict``
- ``EnumDict._member_names`` --> ``EnumDict.member_names``
- ``Enum._add_alias_``
- ``Enum._add_value_alias_``

---------

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2023-12-05 08:27:36 -08:00