Commit graph

13601 commits

Author SHA1 Message Date
Miss Islington (bot)
446203e122
[3.12] gh-121023: Improve _xxtestfuzz/README.rst (GH-121024) (#124141)
gh-121023: Improve `_xxtestfuzz/README.rst` (GH-121024)
(cherry picked from commit a9c2bc1634)

Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: Illia Volochii <illia.volochii@gmail.com>
2024-09-16 20:29:02 +00:00
Miss Islington (bot)
b2a7d718e3
[3.12] gh-123974: Fix time.get_clock_info() on NetBSD (GH-123975) (#124073)
gh-123974: Fix time.get_clock_info() on NetBSD (GH-123975)

Fix OSError for thread_time clock on NetBSD by setting default resolution.
(cherry picked from commit b1d6f8a2ee)

Co-authored-by: Furkan Onder <furkanonder@protonmail.com>
2024-09-13 20:54:09 +00:00
Miss Islington (bot)
58e01a1c7f
[3.12] gh-123431: Harmonize extension code checks in pickle (GH-123434) (#123460)
This checks are redundant in normal circumstances and can only work if
the extension registry was intentionally broken.

(cherry picked from commit 0c3ea30238)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-09-06 15:50:27 +02:00
Miss Islington (bot)
747abc00d0
[3.12] gh-123213: Fixed xml.etree.ElementTree.Element.extend and assignment to no longer hide exceptions (GH-123214) (#123258)
Co-authored-by: Bar Harel <bharel@barharel.com>
2024-09-06 11:51:18 +03:00
Sergey B Kirpichev
1d8ab25742
[3.12] gh-111495: Add tests for PyNumber C API (GH-111996) (#123376)
(cherry picked from commit 2f20f5a9bc)
2024-09-06 00:51:26 +02:00
Sergey B Kirpichev
625072f76e
[3.12] gh-111495: Add tests for PyTuple C API (GH-118757) (#123379)
(cherry picked from commit dbc1752d41)

Co-authored-by: kalyanr <kalyan.ben10@live.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2024-09-06 00:51:02 +02:00
Miss Islington (bot)
3cf7d334f2
[3.12] gh-123678: Upgrade libexpat 2.6.3 (GH-123689) (GH-123708)
gh-123678: Upgrade libexpat 2.6.3 (GH-123689)

Upgrade libexpat 2.6.3
(cherry picked from commit 40bdb0deee)

Co-authored-by: Seth Michael Larson <seth@python.org>
2024-09-04 20:19:33 +00:00
Miss Islington (bot)
41090b7ba0
[3.12] gh-112182: Replace StopIteration with RuntimeError for future (GH-113220) (GH-123033)
When an `StopIteration` raises into `asyncio.Future`, this will cause
a thread to hang. This commit address this by not raising an exception
and silently transforming the `StopIteration` with a `RuntimeError`,
which the caller can reconstruct from `fut.exception().__cause__`
(cherry picked from commit 4826d52338)

Co-authored-by: Jamie Phan <jamie@ordinarylab.dev>
2024-08-15 15:34:53 +00:00
Miss Islington (bot)
9d7209fc93
[3.12] gh-113785: csv: fields starting with escapechar are not quoted (GH-122110) (GH-122259)
(cherry picked from commit a3327dbfd4)

Co-authored-by: Mikołaj Kuranowski <mkuranowski@gmail.com>
2024-08-09 16:04:29 +00:00
Victor Stinner
c57a33d006
[3.12] gh-122695: Fix double-free when using gc.get_referents with a freed _asyncio.FutureIter (#122837) (#122859)
[3.13] gh-122695: Fix double-free when using `gc.get_referents` with a freed `_asyncio.FutureIter` (#122837)

* Backport #122834 for 3.13

(cherry picked from commit e8fb088dba)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2024-08-09 14:33:24 +00:00
Serhiy Storchaka
f2cc8ad989
[3.12] gh-118814: Fix the TypeVar constructor when name is passed by keyword (GH-122664) (GH-122807)
Fix _PyArg_UnpackKeywordsWithVararg for the case when argument for
positional-or-keyword parameter is passed by keyword.
There was only one such case in the stdlib -- the TypeVar constructor.
(cherry picked from commit 540fcc62f5)
2024-08-08 09:49:50 +03:00
Miss Islington (bot)
8f4892ac52
gh-100256: Skip inaccessible registry keys in the WinAPI mimetype implementation (GH-122047)
(cherry picked from commit 0bd93755f3)

Co-authored-by: Lucas Esposito <LucasEsposito@users.noreply.github.com>
2024-08-07 19:39:51 +01:00
Gregory P. Smith
b31764104e
[3.12] gh-119577: Adjust DeprecationWarning when testing element truth values in Element tree (GH-119762) (#120190)
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.

Co-authored-by: Jacob Walls <jacobtylerwalls@gmail.com>
2024-08-06 17:20:06 +00:00
Miss Islington (bot)
bad84975ff
[3.12] gh-122311: Fix a refleak in pickle (GH-122411) (GH-122416)
(cherry picked from commit 68840e91ac)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-07-29 19:10:46 +00:00
Serhiy Storchaka
e6878fc3c8
Revert "[3.12] gh-120713: Normalize year with century for datetime.strftime (GH-120820) (GH-121145)" (GH-122409)
This reverts commit 027902b56f.
2024-07-29 21:55:12 +03:00
Miss Islington (bot)
a3076c734d
[3.12] gh-122311: Fix some error messages in pickle (GH-122386) (GH-122388)
(cherry picked from commit 3b034d26eb)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-07-29 12:27:34 +03:00
Miss Islington (bot)
102dc44a0a
[3.12] gh-122332: Fix missing NULL check in asyncio.Task.get_coro (GH-122338) (#122345)
gh-122332: Fix missing `NULL` check in `asyncio.Task.get_coro` (GH-122338)
(cherry picked from commit c08696286f)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2024-07-27 12:36:40 +05:30
Miss Islington (bot)
9d65ea14ce
[3.12] gh-82951: Fix serializing by name in pickle protocols < 4 (GH-122149) (GH-122265)
Serializing objects with complex __qualname__ (such as unbound methods and
nested classes) by name no longer involves serializing parent objects by value
in pickle protocols < 4.
(cherry picked from commit dc07f65a53)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-07-25 13:44:25 +03:00
Łukasz Langa
c1e834dd78
[3.12] gh-121957: Emit audit events for python -i and python -m asyncio (GH-122117) 2024-07-22 13:41:23 +02:00
Serhiy Storchaka
39dea212f4
[3.12] gh-121905: Consistently use "floating-point" instead of "floating point" (GH-121907) (GH-122013)
(cherry picked from commit 1a0c7b9ba4)
2024-07-19 09:08:33 +00:00
Miss Islington (bot)
0403cb41bf
[3.12] gh-120289: Add external timer in traverse of _lsprof.Profiler (GH-121998) (#122001)
gh-120289: Add external timer in traverse of _lsprof.Profiler (GH-121998)
(cherry picked from commit eaf094c09b)

Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
2024-07-19 04:05:08 +00:00
Miss Islington (bot)
001584da03
[3.12] gh-120289: Disallow disable() and clear() in external timer to prevent use-after-free (GH-120297) (#121989)
gh-120289: Disallow disable() and clear() in external timer to prevent use-after-free (GH-120297)
(cherry picked from commit 1ab1778283)

Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
2024-07-18 16:37:49 -07:00
Miss Islington (bot)
106d6456ca
[3.12] gh-121791: Check for NULL in MethodDescriptor2_new in _testcapi (GH-121792) (#121840)
gh-121791: Check for `NULL` in `MethodDescriptor2_new` in `_testcapi` (GH-121792)
(cherry picked from commit 8b6d475581)

Co-authored-by: sobolevn <mail@sobolevn.me>
2024-07-16 08:51:50 +00:00
Serhiy Storchaka
027902b56f
[3.12] gh-120713: Normalize year with century for datetime.strftime (GH-120820) (GH-121145)
(cherry picked from commit 6d34938dc8)

Co-authored-by: blhsing <blhsing@gmail.com>
2024-06-29 06:54:27 +00:00
Miss Islington (bot)
5c06b34665
[3.12] gh-121137: Add missing Py_DECREF calls for ADDITEMS opcode of _pickle.c (GH-121136) (#121140)
gh-121137: Add missing Py_DECREF calls for ADDITEMS opcode of _pickle.c (GH-121136)

PyObject_GetAttr returns a new reference, but this reference is never decremented using Py_DECREF, so Py_DECREF calls to this referece are added
(cherry picked from commit 92893fd8dc)

Co-authored-by: Justin Applegate <70449145+Legoclones@users.noreply.github.com>
2024-06-28 16:17:51 -07:00
Miss Islington (bot)
d5a8d4b196
[3.12] gh-119614: Fix truncation of strings with embedded null characters in Tkinter (GH-120909) (GH-120939)
Now the null character is always represented as \xc0\x80 for
Tcl_NewStringObj().
(cherry picked from commit c38e2f64d0)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-06-24 09:39:56 +00:00
Serhiy Storchaka
c525cb3a7b
[3.12] gh-101830: Fix Tcl_Obj to string conversion (GH-120884) (GH-120913)
Accessing the Tkinter object's string representation no longer converts
the underlying Tcl object to a string on Windows.
(cherry picked from commit f4ddaa3967)
2024-06-23 16:02:43 +00:00
Miss Islington (bot)
cde976d85c
[3.12] gh-119506: fix _io.TextIOWrapper.write() write during flush (GH-119507) (#119965)
gh-119506: fix `_io.TextIOWrapper.write()` write during flush (GH-119507)
(cherry picked from commit 52586f930f)

Co-authored-by: Radislav Chugunov <52372310+chgnrdv@users.noreply.github.com>
Co-authored-by: Inada Naoki <songofacandy@gmail.com>
2024-06-19 10:23:29 +00:00
Miss Islington (bot)
e004914045
[3.12] gh-120586: Fix several "unused function" warnings in posixmodule.c (GH-120588) (#120617)
gh-120586: Fix several "unused function" warnings in `posixmodule.c` (GH-120588)
(cherry picked from commit 3df2022931)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2024-06-17 07:01:15 +00:00
neonene
7719eefcce
[3.12] gh-71587: Drop local reference cache to _strptime module in _datetime (gh-120431)
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()).

(cherry picked from commit 127c1d2771, AKA gh-120224)
2024-06-13 12:47:46 -06:00
Miss Islington (bot)
ab30934365
[3.12] gh-120155: Add assertion to sre.c match_getindex() (GH-120402) (#120410)
gh-120155: Add assertion to sre.c match_getindex() (GH-120402)

Add an assertion to help static analyzers to detect that i*2 cannot
overflow.
(cherry picked from commit 42b25dd61f)

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-06-12 13:57:45 +00:00
Miss Islington (bot)
ff980e3f7a
[3.12] gh-120155: Fix Coverity issue in zoneinfo load_data() (GH-120232) (#120311)
gh-120155: Fix Coverity issue in zoneinfo load_data() (GH-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|
(cherry picked from commit b90bd3e5bb)

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-06-10 10:12:25 +00:00
Miss Islington (bot)
46e69f8c25
[3.12] gh-120244: Fix re.sub() reference leak (GH-120245) (GH-120265)
(cherry picked from commit 38a25e9560)

Co-authored-by: neonene <53406459+neonene@users.noreply.github.com>
2024-06-08 14:10:44 +03:00
Miss Islington (bot)
ec139c8fae
[3.12] gh-112672: Fix builtin Tkinter with Tcl 9.0 (GH-112681) (GH-120209)
* Add declaration of Tcl_AppInit(), missing in Tcl 9.0.
* Use Tcl_Size instead of int where needed.

(cherry picked from commit e079935282)

Co-authored-by: Christopher Chavez <chrischavez@gmx.us>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-06-07 10:18:42 +00:00
Serhiy Storchaka
f98ec7574a
[3.12] gh-89928: Fix integer conversion of device numbers (GH-31794) (GH-120054)
Fix os.major(), os.minor() and os.makedev().
Support device numbers larger than 2**63-1.
Support non-existent device number (NODEV).
(cherry picked from commit 7111d9605f)
2024-06-04 17:12:13 +00:00
Victor Stinner
34a0e7a824
[3.12] Revert "[3.12] gh-69214: Fix fcntl.ioctl() request type (#119498) (#1… (#119905)
Revert "[3.12] gh-69214: Fix fcntl.ioctl() request type (#119498) (#119505)"

This reverts commit 078da88ad1.

The change modified how negative values, like termios.TIOCSWINSZ, was
treated and is actually backward incompatible.
2024-06-01 17:08:07 +02:00
Sam Gross
738cf21609
[3.12] gh-119585: Fix crash involving PyGILState_Release() and PyThreadState_Clear() (GH-119753) (#119861)
Make sure that `gilstate_counter` is not zero in when calling
`PyThreadState_Clear()`. A destructor called from `PyThreadState_Clear()` may
call back into `PyGILState_Ensure()` and `PyGILState_Release()`. If
`gilstate_counter` is zero, it will try to create a new thread state before
the current active thread state is destroyed, leading to an assertion failure
or crash.
(cherry picked from commit bcc1be39cb)
2024-05-31 15:42:09 +00:00
Serhiy Storchaka
d4680b9e17
[3.12] gh-103194: Fix Tkinter’s Tcl value type handling for Tcl 8.7/9.0 (GH-103846) (GH-119831)
Some of standard Tcl types were renamed, removed, or no longer
registered in Tcl 8.7/9.0. This change fixes automatic conversion of Tcl
values to Python values to avoid returning a Tcl_Obj where the primary
Python types (int, bool, str, bytes) were returned in older Tcl.
(cherry picked from commit 94e9585e99)

Co-authored-by: Christopher Chavez <chrischavez@gmx.us>
2024-05-31 09:15:53 +00:00
Steve Dower
e85e813bf1
gh-119690: Adds Unicode support for named pipes in _winapi (GH-119717)
Also backports a minor improvement to test_audit.
2024-05-30 15:40:23 +01:00
Nice Zombies
09a85eaa4c
gh-118263: Add additional arguments to path_t (Argument Clinic type) in posixmodule (GH-119608) 2024-05-28 11:13:01 +01:00
Victor Stinner
078da88ad1
[3.12] gh-69214: Fix fcntl.ioctl() request type (#119498) (#119505)
gh-69214: Fix fcntl.ioctl() request type (#119498)

Use an 'unsigned long' instead of an 'unsigned int' for the request
parameter of fcntl.ioctl() to support requests larger than UINT_MAX.

(cherry picked from commit 92fab3356f)
2024-05-24 12:53:41 +00:00
Eric Snow
0d5fe2c7b4
[3.12] gh-119213: Be More Careful About _PyArg_Parser.kwtuple Across Interpreters (gh-119331) (gh-119425)
_PyArg_Parser holds static global data generated for modules by Argument Clinic.  The _PyArg_Parser.kwtuple field is a tuple object, even though it's stored within a static global.  In some cases the tuple is statically allocated and thus it's okay that it gets shared by multiple interpreters.  However, in other cases the tuple is set lazily, allocated from the heap using the active interprepreter at the point the tuple is needed.

This is a problem once that interpreter is destroyed since _PyArg_Parser.kwtuple becomes at dangling pointer, leading to crashes.  It isn't a problem if the tuple is allocated under the main interpreter, since its lifetime is bound to the lifetime of the runtime.  The solution here is to temporarily switch to the main interpreter.  The alternative would be to always statically allocate the tuple.

This change also fixes a bug where only the most recent parser was added to the global linked list.

(cherry picked from commit 81865002ae)
2024-05-22 22:26:58 +00:00
Nice Zombies
874a4f7d08
gh-118507 : Refactor ntpath native functions (gh-119381)
This refactoring will make future backports easier without changing behaviours,
apart from correcting a bug when passing a pipe to `ntpath.isfile`.
2024-05-22 15:49:26 +01:00
Miss Islington (bot)
6d0850c4c8
gh-118486: Simplify test_win32_mkdir_700 to check the exact ACL (GH-119056)
(cherry picked from commit 94591dca51)

Co-authored-by: Steve Dower <steve.dower@python.org>
2024-05-15 11:21:57 +00:00
Miss Islington (bot)
5bf7f5c6a8
[3.12] gh-118998: Handle errors correctly in tmtotuple in timemodule (GH-118999) (#119019)
gh-118998: Handle errors correctly in `tmtotuple` in `timemodule` (GH-118999)
(cherry picked from commit fc75792594)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2024-05-13 21:47:12 +00:00
Steve Dower
eb29e2f590
gh-118486: Support mkdir(mode=0o700) on Windows (GH-118488) 2024-05-09 19:18:56 +01:00
Miss Islington (bot)
656491783d
[3.12] gh-118671: Updated dead ActiveState links (GH-118730) (#118754)
Co-authored-by: trag1c <trag1cdev@yahoo.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
2024-05-08 07:22:35 +00:00
Miss Islington (bot)
56c61cc564
[3.12] gh-118314: Fix padding edge case in binascii.a2b_base64 strict mode (GH-118320) (GH-118691)
gh-118314: Fix padding edge case in binascii.a2b_base64 strict mode (GH-118320)

Fix an edge case in `binascii.a2b_base64` strict mode, where
excessive padding was not detected when no padding is necessary.

(cherry picked from commit fe47d9bee3)

Co-authored-by: Youfu Zhang <1315097+zhangyoufu@users.noreply.github.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
2024-05-07 09:35:49 +00:00
Serhiy Storchaka
bee1c322c0
[3.12] gh-71592: Add ability to trace Tcl commands executed by Tkinter (GH-118291) (GH-118662)
This is an experimental feature, for internal use.

Setting tkinter._debug = True before creating the root window enables
printing every executed Tcl command (or a Tcl command equivalent to the
used Tcl C API).

This will help to convert a Tkinter example into Tcl script to check
whether the issue is caused by Tkinter or exists in the underlying Tcl/Tk
library.
(cherry picked from commit 1ff626ebda)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-05-06 19:26:08 +00:00
Miss Islington (bot)
33d1cfffe1
[3.12] gh-117968: Make the test for closed file more safe in the C API tests (GH-118230) (GH-118266)
The behavior of fileno() after fclose() is undefined, but it is the only
practical way to check whether the file was closed.
Only test this on the known platforms (Linux, Windows, macOS), where we
already tested that it works.
(cherry picked from commit 546cbcfa0e)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-04-25 05:16:43 +00:00