gh-127303: Add docs for token.EXACT_TOKEN_TYPES (GH-127304)
---------
(cherry picked from commit dd3a87d2a8)
Co-authored-by: Илья Любавский <100635212+lubaskinc0de@users.noreply.github.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Link to correct class methods in asyncio primitives docs (GH-127270)
(cherry picked from commit 15d6506d17)
Co-authored-by: Ollanta Cuba Gyllensten <ollantaster@gmail.com>
gh-127208: Reject null character in _imp.create_dynamic() (GH-127400)
_imp.create_dynamic() now rejects embedded null characters in the
path and in the module name.
(cherry picked from commit b14fdadc6c)
Co-authored-by: Victor Stinner <vstinner@python.org>
gh-124873: Skip timerfd tests on Android (GH-127279)
* Revert "[3.13] gh-124873: Tolerate 100 ms in TimerfdTests on Android (GH-127101) (GH-127105)"
This reverts commit c09366b1fe.
* Skip timerfd tests on Android.
(cherry picked from commit 4ca2c82862)
Co-authored-by: Malcolm Smith <smith@chaquo.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
gh-127258: Fix asyncio test_staggered_race_with_eager_tasks() (GH-127358)
Replace the sleep(2) with a task which is blocked forever.
(cherry picked from commit bfabf96b50)
Co-authored-by: Victor Stinner <vstinner@python.org>
fix param type in PyObject_HasAttrWithError (docs) (GH-127403)
(cherry picked from commit 3afb639f39)
Co-authored-by: biggus-developerus <74741815+biggus-developerus@users.noreply.github.com>
gh-122273: Support PyREPL history on Windows (#127141)
Co-authored-by: devdanzin <74280297+devdanzin@users.noreply.github.com>
(cherry picked from commit 3c7a90a831)
* gh-126316: Make grp.getgrall() thread-safe: add a mutex (#127055)
grpmodule.c is no longer built with the limited C API, since PyMutex
is excluded from the limited C API.
(cherry picked from commit 3c2bd66e21)
* Revert ABI changes
Don't use Argument Clinic for grp.getgrgid() to avoid changing the
ABI (change PyInterpreterState structure by adding an "id"
identifier).
gh-127182: Fix `io.StringIO.__setstate__` crash when `None` is the first value (GH-127219)
(cherry picked from commit a2ee899682)
Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: Victor Stinner <vstinner@python.org>
Improve `pathname2url()` and `url2pathname()` docs (GH-127125)
These functions have long sown confusion among Python developers. The
existing documentation says they deal with URL path components, but that
doesn't fit the evidence on Windows:
>>> pathname2url(r'C:\foo')
'///C:/foo'
>>> pathname2url(r'\\server\share')
'////server/share' # or '//server/share' as of quite recently
If these were URL path components, they would imply complete URLs like
`file://///C:/foo` and `file://////server/share`. Clearly this isn't right.
Yet the implementation in `nturl2path` is deliberate, and the
`url2pathname()` function correctly inverts it.
On non-Windows platforms, the behaviour until quite recently is to simply
quote/unquote the path without adding or removing any leading slashes. This
behaviour is compatible with *both* interpretations -- 1) the value is a
URL path component (existing docs), and 2) the value is everything
following `file:` (this commit)
The conclusion I draw is that these functions operate on everything after
the `file:` prefix, which may include an authority section. This is the
only explanation that fits both the Windows and non-Windows behaviour.
It's also a better match for the function names.
(cherry picked from commit 307c633586)
Co-authored-by: Barney Gale <barney.gale@gmail.com>
Fix "useable" typo in docs (GH-127200)
Fix typo in docs
(cherry picked from commit dbd23790db)
Co-authored-by: Stan U <89152624+StanFromIreland@users.noreply.github.com>
Doc: C API: Fix `Py_NewInterpreterFromConfig` example code (GH-126667)
(cherry picked from commit e3038e976b)
Co-authored-by: Richard Hansen <rhansen@rhansen.org>
This change enables custom GHA runners for Ubuntu-24.04 that run on Arm hardware. It also prepares for Windows runners on Arm hardware, but doesn't enable that just yet, because the Arm GHA runner images for Windows need to be updated.
(cherry picked from commit 8214e0f709)
Fix a few typos found in the docs (GH-127126)
(cherry picked from commit 39e60aeb38)
Co-authored-by: Rafael Fontenelle <rffontenelle@users.noreply.github.com>
If Python fails to start newly created thread
due to failure of underlying PyThread_start_new_thread() call,
its state should be removed from interpreter' thread states list
to avoid its double cleanup.
(cherry picked from commit ca3ea9ad05)
Co-authored-by: Radislav Chugunov <52372310+chgnrdv@users.noreply.github.com>
Threads are gone after fork, so clear the queues too. Otherwise the
child process (here created via multiprocessing.Process) crashes on
interpreter exit.
(cherry picked from commit 1848ce61f3)
Co-authored-by: Andrei Bodrov <Drino@users.noreply.github.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
gh-109413: Fix libregrtest get_running() (GH-127153)
Skip threads which are not running.
(cherry picked from commit 0cb20177d6)
Co-authored-by: Victor Stinner <vstinner@python.org>
* Name without a PATHEXT extension is only searched if the mode does not
include X_OK.
* Support multi-component PATHEXT extensions (e.g. ".foo.bar").
* Support files without extensions in PATHEXT contains dot-only extension
(".", "..", etc).
* Support PATHEXT extensions that end with a dot (e.g. ".foo.").
(cherry picked from commit 8899e85de1)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
The `methodcaller` C vectorcall implementation uses an arguments array
that is shared across calls. The first argument is modified on every
invocation. This isn't thread-safe in the free threading build. I think
it's also not safe in general, but for now just disable it in the free
threading build.
(cherry picked from commit f83ca6962a)
Co-authored-by: Sam Gross <colesbury@gmail.com>
GH-127078: `url2pathname()`: handle extra slash before UNC drive in URL path (GH-127132)
Decode a file URI like `file://///server/share` as a UNC path like
`\\server\share`. This form of file URI is created by software the simply
prepends `file:///` to any absolute Windows path.
(cherry picked from commit 8c98ed846a)
Co-authored-by: Barney Gale <barney.gale@gmail.com>
GH-126766: `url2pathname()`: handle 'localhost' authority (GH-127129)
Discard any 'localhost' authority from the beginning of a `file:` URI. As a
result, file URIs like `//localhost/etc/hosts` are correctly decoded as
`/etc/hosts`.
(cherry picked from commit ebf564a1d3)
Co-authored-by: Barney Gale <barney.gale@gmail.com>
This is a pseudo-backport of d6b3e78 (gh-126988). In that change for 3.14+, we dropped _PyInterpreterState_FailIfNotRunning() and added _PyErr_SetInterpreterAlreadyRunning(). Here, we replace usage of _PyInterpreterState_FailIfNotRunning() with the inlined equivalent of _PyErr_SetInterpreterAlreadyRunning(), without adding that function. That way we avoid changing the 3.13 ABI.
Some fields in PyCodeObject are lazily initialized. Use atomics and
critical sections to make their initializations and accesses thread-safe.
(cherry picked from commit 3926842117)
Co-authored-by: Sam Gross <colesbury@gmail.com>
gh-124873: Tolerate 100 ms in TimerfdTests on Android (GH-127101)
On Android, TimerfdTests of test_os now uses 100 ms accuracy instead
of 10 ms.
(cherry picked from commit bab4b0462e)
Co-authored-by: Victor Stinner <vstinner@python.org>
It now returns multiple era description segments separated by semicolons.
Previously it only returned the first segment on platforms with Glibc.
(cherry picked from commit 4803cd0244)
* Fix support of STRING and GLOBAL opcodes with non-ASCII arguments.
* dis() now outputs non-ASCII bytes in STRING, BINSTRING and
SHORT_BINSTRING arguments as escaped (\xXX).
(cherry picked from commit eaf2171082)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
GH-85168: Use filesystem encoding when converting to/from `file` URIs (GH-126852)
Adjust `urllib.request.url2pathname()` and `pathname2url()` to use the
filesystem encoding when quoting and unquoting file URIs, rather than
forcing use of UTF-8.
No changes are needed in the `nturl2path` module because Windows always
uses UTF-8, per PEP 529.
(cherry picked from commit c9b399fbdb)
Co-authored-by: Barney Gale <barney.gale@gmail.com>
Doc: C API: `PyThreadState::on_delete` was removed in v3.13 (GH-126536)
(cherry picked from commit 9bca3ef575)
Co-authored-by: Richard Hansen <rhansen@rhansen.org>
If PyObject_SetItem() fails in the `load_build()` function of _pickle.c, no DECREF for the `dict` variable.
(cherry picked from commit 29cbcbd73b)
Co-authored-by: Justin Applegate <70449145+Legoclones@users.noreply.github.com>