| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
|
| |
gh-116810: fix memory leak in ssl module (GH-123249)
Resolve a memory leak introduced in CPython 3.10's :mod:`ssl` when the :attr:`ssl.SSLSocket.session` property was accessed. Speeds up read and write access to said property by no longer unnecessarily cloning session objects via serialization.
(cherry picked from commit 7e7223e18f58ec48fb36a68fb75b5c5b7a45042a)
Co-authored-by: Jeffrey R. Van Voorst <jeff.vanvoorst@gmail.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
Co-authored-by: Antoine Pitrou <antoine@python.org>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
GH-121903, GH-122303) (#123065)
This backports several PRs for gh-113993, making interned strings mortal so they can be garbage-collected when no longer needed.
* Allow interned strings to be mortal, and fix related issues (GH-120520)
* Add an InternalDocs file describing how interning should work and how to use it.
* Add internal functions to *explicitly* request what kind of interning is done:
- `_PyUnicode_InternMortal`
- `_PyUnicode_InternImmortal`
- `_PyUnicode_InternStatic`
* Switch uses of `PyUnicode_InternInPlace` to those.
* Disallow using `_Py_SetImmortal` on strings directly.
You should use `_PyUnicode_InternImmortal` instead:
- Strings should be interned before immortalization, otherwise you're possibly
interning a immortalizing copy.
- `_Py_SetImmortal` doesn't handle the `SSTATE_INTERNED_MORTAL` to
`SSTATE_INTERNED_IMMORTAL` update, and those flags can't be changed in
backports, as they are now part of public API and version-specific ABI.
* Add private `_only_immortal` argument for `sys.getunicodeinternedsize`, used in refleak test machinery.
Make sure the statically allocated string singletons are unique. This means these sets are now disjoint:
- `_Py_ID`
- `_Py_STR` (including the empty string)
- one-character latin-1 singletons
Now, when you intern a singleton, that exact singleton will be interned.
* Add a `_Py_LATIN1_CHR` macro, use it instead of `_Py_ID`/`_Py_STR` for one-character latin-1 singletons everywhere (including Clinic).
* Intern `_Py_STR` singletons at startup.
* Beef up the tests. Cover internal details (marked with `@cpython_only`).
* Add lots of assertions
* Don't immortalize in PyUnicode_InternInPlace; keep immortalizing in other API (GH-121364)
* Switch PyUnicode_InternInPlace to _PyUnicode_InternMortal, clarify docs
* Document immortality in some functions that take `const char *`
This is PyUnicode_InternFromString;
PyDict_SetItemString, PyObject_SetAttrString;
PyObject_DelAttrString; PyUnicode_InternFromString;
and the PyModule_Add convenience functions.
Always point out a non-immortalizing alternative.
* Don't immortalize user-provided attr names in _ctypes
* Immortalize names in code objects to avoid crash (GH-121903)
* Intern latin-1 one-byte strings at startup (GH-122303)
There are some 3.12-specific changes, mainly to allow statically allocated strings in deepfreeze. (In 3.13, deepfreeze switched to the general `_Py_ID`/`_Py_STR`.)
Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
|
| |
|
|
|
| |
Fix a bug that can cause a crash when sub-interpreters use "basic"
single-phase extension modules. Shared objects could refer to PyGC_Head
nodes that had been freed as part of interpreter shutdown.
|
| |
|
|
|
|
|
|
| |
(#124278)
gh-124248: Fix crash in struct when processing 0p fields (GH-124251)
(cherry picked from commit 63f196090f90cbfe5f698824655f74dea5cb2b29)
Co-authored-by: Brian Schubert <brianm.schubert@gmail.com>
|
| |
|
|
|
|
|
|
| |
(GH-124115) (GH-124200)
This reverts commit b1d6f8a2ee04215c64aa8752cc515b7e98a08d28.
(cherry picked from commit 79a74102362996bbd4ff5d410a0d57d43c236da4)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Buildbot failure on Windows 10 with MSC v.1916 64 bit (AMD64):
FAIL: testFmod (test.test_math.MathTests.testFmod)
----------------------------------------------------------------------
Traceback (most recent call last):
File "D:\buildarea\3.x.bolen-windows10\build\Lib\test\test_math.py", line 605, in testFmod
self.ftest('fmod(-10, 1)', math.fmod(-10, 1), -0.0)
~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\buildarea\3.x.bolen-windows10\build\Lib\test\test_math.py", line 258, in ftest
self.fail("{}: {}".format(name, failure))
~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: fmod(-10, 1): expected -0.0, got 0.0 (zero has wrong sign)
Here Windows loose sign of the result; if y is nonzero, the result
should have the same sign as x.
This amends commit 28aea5d07d.
(cherry picked from commit f4dd4402108cc005d45acd4ca83c8530c36a93ca)
|
| |
|
|
|
|
|
| |
gh-121023: Improve `_xxtestfuzz/README.rst` (GH-121024)
(cherry picked from commit a9c2bc16349c2be3005f97249f3ae9699988f218)
Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: Illia Volochii <illia.volochii@gmail.com>
|
| |
|
|
|
|
|
|
| |
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 b1d6f8a2ee04215c64aa8752cc515b7e98a08d28)
Co-authored-by: Furkan Onder <furkanonder@protonmail.com>
|
| |
|
|
|
|
|
|
|
|
|
| |
(#123460)
This checks are redundant in normal circumstances and can only work if
the extension registry was intentionally broken.
(cherry picked from commit 0c3ea3023878f5ad5ca4680d5510da1fe208cbfa)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
|
| |
|
|
|
|
| |
to no longer hide exceptions (GH-123214) (#123258)
Co-authored-by: Bar Harel <bharel@barharel.com>
|
| |
|
| |
(cherry picked from commit 2f20f5a9bc7dafdb3c2ae723da90eca1727a95f7)
|
| |
|
|
|
|
|
| |
(cherry picked from commit dbc1752d4107532d312c78263212e807a3674eb1)
Co-authored-by: kalyanr <kalyan.ben10@live.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
|
| |
|
|
|
|
|
|
| |
gh-123678: Upgrade libexpat 2.6.3 (GH-123689)
Upgrade libexpat 2.6.3
(cherry picked from commit 40bdb0deee746e51c71c56329df21e5172fd8aa0)
Co-authored-by: Seth Michael Larson <seth@python.org>
|
| |
|
|
|
|
|
|
|
|
|
| |
(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 4826d52338396758b2d6790a498c2a06eec19a86)
Co-authored-by: Jamie Phan <jamie@ordinarylab.dev>
|
| |
|
|
|
|
|
| |
(GH-122110) (GH-122259)
(cherry picked from commit a3327dbfd4db9e5ad1ca514963d503abbbbfede7)
Co-authored-by: Mikołaj Kuranowski <mkuranowski@gmail.com>
|
| |
|
|
|
|
|
|
|
|
|
| |
`_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 e8fb088dbaa71dd5f0146b2f4a8f7ecbe2ce9625)
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
|
| |
|
|
|
|
|
|
| |
(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 540fcc62f5da982b79504221cac01bfab8b73ba1)
|
| |
|
|
|
|
|
| |
implementation (GH-122047)
(cherry picked from commit 0bd93755f37e6b8beb597787fce39eb141179965)
Co-authored-by: Lucas Esposito <LucasEsposito@users.noreply.github.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
| |
|
|
|
| |
(cherry picked from commit 68840e91ac6689d3954b98a9ab136e194b5250b8)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
|
| |
|
|
|
| |
(GH-120820) (GH-121145)" (GH-122409)
This reverts commit 027902b56f2176c571e5e244c3c23dc7247b67dc.
|
| |
|
|
|
| |
(cherry picked from commit 3b034d26eb8480f8d12ae11f42d038d24cf8498a)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
|
| |
|
|
|
|
|
|
| |
(GH-122338) (#122345)
gh-122332: Fix missing `NULL` check in `asyncio.Task.get_coro` (GH-122338)
(cherry picked from commit c08696286f52d286674f264eecf7b33a335a890b)
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
|
| |
|
|
|
|
|
|
|
|
| |
(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 dc07f65a53baf60d9857186294d3d7ba92d5606d)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
|
| |
|
|
| |
(GH-122117)
|
| |
|
|
|
| |
point" (GH-121907) (GH-122013)
(cherry picked from commit 1a0c7b9ba48a2dffb70bb0c7327abae1d3e87356)
|
| |
|
|
|
|
|
|
| |
(GH-121998) (#122001)
gh-120289: Add external timer in traverse of _lsprof.Profiler (GH-121998)
(cherry picked from commit eaf094c09b5b1c33435c60ef49b1cec78c32573c)
Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
|
| |
|
|
|
|
|
|
| |
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 1ab17782832bb1b6baa915627aead3e3516a0894)
Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
|
| |
|
|
|
|
|
|
| |
(GH-121792) (#121840)
gh-121791: Check for `NULL` in `MethodDescriptor2_new` in `_testcapi` (GH-121792)
(cherry picked from commit 8b6d4755812d0b02e9f26beb9c9a7714e4c5ac28)
Co-authored-by: sobolevn <mail@sobolevn.me>
|
| |
|
|
|
|
|
| |
(GH-120820) (GH-121145)
(cherry picked from commit 6d34938dc8163f4a4bcc68069a1645a7ab76e935)
Co-authored-by: blhsing <blhsing@gmail.com>
|
| |
|
|
|
|
|
|
|
|
| |
_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 92893fd8dc803ed7cdde55d29d25f84ccb5e3ef0)
Co-authored-by: Justin Applegate <70449145+Legoclones@users.noreply.github.com>
|
| |
|
|
|
|
|
|
|
| |
Tkinter (GH-120909) (GH-120939)
Now the null character is always represented as \xc0\x80 for
Tcl_NewStringObj().
(cherry picked from commit c38e2f64d012929168dfef7363c9e48bd1a6c731)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
|
| |
|
|
|
| |
Accessing the Tkinter object's string representation no longer converts
the underlying Tcl object to a string on Windows.
(cherry picked from commit f4ddaa396715855ffbd94590f89ab7d55feeec07)
|
| |
|
|
|
|
|
|
|
| |
(GH-119507) (#119965)
gh-119506: fix `_io.TextIOWrapper.write()` write during flush (GH-119507)
(cherry picked from commit 52586f930f62bd80374f0f240a4ecce0c0238174)
Co-authored-by: Radislav Chugunov <52372310+chgnrdv@users.noreply.github.com>
Co-authored-by: Inada Naoki <songofacandy@gmail.com>
|
| |
|
|
|
|
|
|
| |
(GH-120588) (#120617)
gh-120586: Fix several "unused function" warnings in `posixmodule.c` (GH-120588)
(cherry picked from commit 3df2022931f77c5cadb3f51b371be6ae17587ede)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
|
| |
|
|
|
|
|
| |
`_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 127c1d2771749853e287632c086b6054212bf12a, AKA gh-120224)
|
| |
|
|
|
|
|
|
|
| |
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 42b25dd61ff3593795c4cc2ffe876ab766098b24)
Co-authored-by: Victor Stinner <vstinner@python.org>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(#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 b90bd3e5bbc136f53b24ee791824acd6b17e0d42)
Co-authored-by: Victor Stinner <vstinner@python.org>
|
| |
|
|
|
| |
(cherry picked from commit 38a25e9560cf0ff0b80d9e90bce793ff24c6e027)
Co-authored-by: neonene <53406459+neonene@users.noreply.github.com>
|
| |
|
|
|
|
|
|
|
| |
* Add declaration of Tcl_AppInit(), missing in Tcl 9.0.
* Use Tcl_Size instead of int where needed.
(cherry picked from commit e0799352823289fafb8131341abd751923ee9c08)
Co-authored-by: Christopher Chavez <chrischavez@gmx.us>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
|
| |
|
|
|
|
| |
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 7111d9605f9db7aa0b095bb8ece7ccc0b8115c3f)
|
| |
|
|
|
|
|
|
|
|
| |
(#1… (#119905)
Revert "[3.12] gh-69214: Fix fcntl.ioctl() request type (#119498) (#119505)"
This reverts commit 078da88ad19e8f7474b6943edd39b7e61511bd20.
The change modified how negative values, like termios.TIOCSWINSZ, was
treated and is actually backward incompatible.
|
| |
|
|
|
|
|
|
|
|
|
| |
`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 bcc1be39cb1d04ad9fc0bd1b9193d3972835a57c)
|
| |
|
|
|
|
|
|
|
|
|
| |
(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 94e9585e99abc2d060cedc77b3c03e06b4a0a9c4)
Co-authored-by: Christopher Chavez <chrischavez@gmx.us>
|
| |
|
| |
Also backports a minor improvement to test_audit.
|
| |
|
|
| |
posixmodule (GH-119608)
|
| |
|
|
|
|
|
|
| |
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 92fab3356f4c61d4c73606e4fae705c6d8f6213b)
|
| |
|
|
|
|
|
|
|
|
|
| |
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 81865002aee8eaaeb3c7e402f86183afa6de77bf)
|
| |
|
|
| |
This refactoring will make future backports easier without changing behaviours,
apart from correcting a bug when passing a pipe to `ntpath.isfile`.
|
| |
|
|
|
| |
(cherry picked from commit 94591dca510c796c7d40e9b4167ea56f2fdf28ca)
Co-authored-by: Steve Dower <steve.dower@python.org>
|