gh-149025: Heap size should be added at end of the struct#149240
Closed
DinoV wants to merge 2299 commits intopython:mainfrom
Closed
gh-149025: Heap size should be added at end of the struct#149240DinoV wants to merge 2299 commits intopython:mainfrom
DinoV wants to merge 2299 commits intopython:mainfrom
Conversation
…GH-145935) (python#145936) Docs: fix missing period in `Doc/library/stdtypes.rst` (pythonGH-145935) (cherry picked from commit 51e8acf) Co-authored-by: Connor Gibson <connor@nextdoortech.net>
…nvalid `SimpleNamespace` instances (pythonGH-143655) (python#145938) pythongh-143636: fix a crash when calling ``__replace__`` on invalid `SimpleNamespace` instances (pythonGH-143655) (cherry picked from commit 9796856) Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
…nGH-145959) pythongh-141004: Document `PyDTrace*` (pythonGH-141856) (cherry picked from commit 1dfe99a) Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Bump mypy to 1.19.1 (pythonGH-145956) (cherry picked from commit e167e06) Co-authored-by: Brian Schubert <brianm.schubert@gmail.com>
… object (pythonGH-145538) (python#145595) Co-authored-by: Andrew Barnes <bortstheboat@gmail.com>
…y objects (pythonGH-145226) (python#145982) (cherry picked from commit 2f4e4ec) Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
…del` in `pyexpat.c` (CVE 2026-4224) (pythonGH-145987) (python#145995) pythongh-145986: Avoid unbound C recursion in `conv_content_model` in `pyexpat.c` (CVE 2026-4224) (pythonGH-145987) Fix C stack overflow (CVE-2026-4224) when an Expat parser with a registered `ElementDeclHandler` parses inline DTD containing deeply nested content model. --------- (cherry picked from commit eb0e8be) Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com> Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
…ythonGH-145993) * Sort --help-xoptions alphabetically by name. * add a sorting regression test in test_help_xoptions manual backport of pythonGH-145991
…iable name (pythonGH-146001) * sort --help-env alphabetically by name. * add a sorting regression test in test_help_env. manual backport of pythonGH-145997
…side effect (pythonGH-144608) (python#146008) pythongh-140814: Fix freeze_support() setting start method as side effect (pythonGH-144608) freeze_support() called get_start_method() without allow_none=True, which locked in the default start method context. This caused a subsequent set_start_method() call to raise "context has already been set". Use allow_none=True and accept None as a matching value, since spawn.freeze_support() independently detects spawned child processes. Test that freeze_support() does not lock in the default start method, which would prevent a subsequent set_start_method() call. (cherry picked from commit ee53180) Co-authored-by: Gregory P. Smith <68491+gpshead@users.noreply.github.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
…H-144987) (python#145020) pythongh-144986: Fix memory leak in atexit.register() (pythonGH-144987) (cherry picked from commit 50c1471) Co-authored-by: Shamil <ashm.tech@proton.me>
…ythonGH-140989) (python#146012) Docs: fix a form error and a grammatical error in float.rst (pythonGH-140989) (cherry picked from commit 70397fd) Co-authored-by: RayXu <xu_ruihong2009@163.com>
…ythonGH-145820) (python#145922) pythongh-145376: Fix GC tracking in `structseq.__replace__` (pythonGH-145820) (cherry picked from commit 00a2585) Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
…honGH-145656) (python#146015) pythongh-145649: Fix man page text wrapping for -X option (pythonGH-145656) Replace hardcoded space indentation with proper troff macros (.TP, .RS/.RE, .IP) for -X sub-options so text wraps correctly at any terminal width. (cherry picked from commit 36b5284) Co-authored-by: Matt Van Horn <mvanhorn@users.noreply.github.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
…http.cookies.Morsel.update()` (pythonGH-145600) (python#146023) pythongh-145599, CVE 2026-3644: Reject control characters in `http.cookies.Morsel.update()` (pythonGH-145600) Reject control characters in `http.cookies.Morsel.update()` and `http.cookies.BaseCookie.js_output`. (cherry picked from commit 57e88c1) Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com> Co-authored-by: Victor Stinner <vstinner@python.org> Co-authored-by: Victor Stinner <victor.stinner@gmail.com>
) (python#146028) The test doesn't actually test any pyrepl code (it runs Python with -S) and has a race condition that causes intermittent timeouts on CI. (cherry picked from commit e18abc6) Co-authored-by: Sam Gross <colesbury@gmail.com>
pythonGH-146035) (python#146037) Docs: remove unmatched parenthesis for `asyncio.TaskGroup` note (pythonGH-146035) (cherry picked from commit 4e96282) Co-authored-by: trag1c <dev@jakubr.me>
…ate` error paths (pythonGH-144992) (python#146019) pythongh-144984: Fix crash in Expat's `ExternalEntityParserCreate` error paths (pythonGH-144992) (cherry picked from commit e6b9a14) Co-authored-by: Ramin Farajpour Cami <ramin.blackhat@gmail.com> Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
pythonGH-145806) (python#146043) Moves Emscripten build files into Platforms/emscripten. (cherry picked from commit 1b11835) Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
…145984) (python#146049) Docs: a brief note in the sets tutorial about order (pythonGH-145984) (cherry picked from commit 4f5e798) Docs: a brief note in the sets tut about order Co-authored-by: Ned Batchelder <ned@nedbatchelder.com>
… long name handling (pythonGH-145819) (cherry picked from commit 42d754e) Co-authored-by: Seth Michael Larson <seth@python.org> Co-authored-by: Eashwar Ranganathan <eashwar@eashwar.com>
…t Clinic (pythonGH-146016) (pythonGH-146052) * Add the c_init_default attribute which is used to initialize the C variable if the default is not explicitly provided. * Add the c_default_init() method which is used to derive c_default from default if c_default is not explicitly provided. * Explicit c_default and py_default are now almost always have precedence over the generated value. * Add support for bytes literals as default values. * Improve support for str literals as default values (support non-ASCII and non-printable characters and special characters like backslash or quotes). * Fix support for str and bytes literals containing trigraphs, "/*" and "*/". * Improve support for default values in converters "char" and "int(accept={str})". * Converter "int(accept={str})" now requires 1-character string instead of integer as default value. * Add support for non-None default values in converter "Py_buffer": NULL, str and bytes literals. * Improve error handling for invalid default values. * Rename Null to NullType for consistency. (cherry picked from commit 99e2c5e)
…etMethodStackRef` (pythonGH-136412) (python#146077) (cherry picked from commit cbe6ebe) Co-authored-by: Kumar Aditya <kumaraditya@python.org>
…n` cache (pythonGH-146055) (pythonGH-146067) (cherry picked from commit 9d7621b) Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
…ol (pythonGH-145911) (python#146106) (cherry picked from commit 847f83e) Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
…ng a `_weak_cache` (pythonGH-146082) (pythonGH-146116) (cherry picked from commit 3b06d68) Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
…oc/dealloc thrashing (pythonGH-145789) (python#145828) Cache one datachunk per tstate to prevent alloc/dealloc thrashing when repeatedly hitting the same call depth at exactly the wrong boundary. Move new _ts member to the end to not mess up remote debuggers' ideas of the struct's layout. (The struct is only created by the runtime, and the new field only used by the runtime, so it should be safe.) (cherry picked from commit 706fd4e) Co-authored-by: T. Wouters <thomas@python.org> Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
…ythonGH-146109) (python#146125) (cherry picked from commit 5b25eae) Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
…ASCII() failed (pythonGH-146113) (python#146130) pythongh-146093: Fix csv _set_str(): check if PyUnicode_DecodeASCII() failed (pythonGH-146113) The function can fail on a memory allocation failure. Bug reported by devdanzin. (cherry picked from commit 724c7c8) Co-authored-by: Victor Stinner <vstinner@python.org>
…perly (python#146124) (python#146132) pythongh-146092: Handle _PyFrame_GetFrameObject() failures properly (python#146124) * Fix _PyFrame_GetLocals() and _PyFrame_GetLocals() error handling. * _PyEval_ExceptionGroupMatch() now fails on _PyFrame_GetLocals() error. (cherry picked from commit e1e4852)
…and oparg in compiler (pythonGH-148974) (python#148980) pythongh-148973: fix segfault on mismatch between consts size and oparg in compiler (pythonGH-148974) (cherry picked from commit c650b51) Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
pythonGH-148948) (python#148995) pythongh-148947: dataclasses: fix error on empty __class__ cell (pythonGH-148948) Also add a test demonstrating the need for the existing "is oldcls" check. (cherry picked from commit 6d7bbee) Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> Co-authored-by: Bartosz Sławecki <bartosz@ilikepython.com>
…large_input long tail (pythonGH-149003) (python#149004) pythongh-141473: Speed up subprocess test_communicate_timeout_large_input long tail (pythonGH-149003) pythongh-141473: Speed up test_communicate_timeout_large_input Replace the slow reader's 30s sleep with a parent-driven wake over a loopback socket so post-timeout communicate() doesn't block waiting for the child to wake on its own. Worst-case runtime: ~30s -> <1s. (cherry picked from commit e1384cf) Co-authored-by: Gregory P. Smith <68491+gpshead@users.noreply.github.com>
…ng moved to CFG (pythonGH-146456) (python#149011) pythongh-146455: Fix O(N²) in add_const() after constant folding moved to CFG (pythonGH-146456) The add_const() function in flowgraph.c uses a linear search over the consts list to find the index of a constant. After pythongh-126835 moved constant folding from the AST optimizer to the CFG optimizer, this function is now called N times for N inner tuple elements during fold_tuple_of_constants(), resulting in O(N²) total time. Fix by maintaining an auxiliary _Py_hashtable_t that maps object pointers to their indices in the consts list, providing O(1) lookup. For a file with 100,000 constant 2-tuples: - Before: 10.38s (add_const occupies 83.76% of CPU time) - After: 1.48s (cherry picked from commit 5d41632) Co-authored-by: zSirius <107359899+zSirius@users.noreply.github.com>
Co-authored-by: Neil Schemenauer <nas@arctrix.com> Co-authored-by: Sergey Miryanov <sergey.miryanov@gmail.com> Co-authored-by: Zanie Blue <contact@zanie.dev> Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Co-authored-by: Neil Schemenauer <nas-github@arctrix.com>
… as trusted (pythonGH-149001) (python#149033) Document that multiprocessing treats local same-user processes as trusted (pythonGH-149001) Clarify in the Authentication keys section that the authkey handshake covers Listener/Client (addressable endpoints) only, not the anonymous pipes behind Pipe() and Queue, and that isolation between same-user processes must be arranged at the OS level. (cherry picked from commit f27e91e) Co-authored-by: Gregory P. Smith <68491+gpshead@users.noreply.github.com>
…an be None (pythonGH-134312) (python#149037) pythongh-82665 Mention that HTMLParser.handle_starttag value can be None (pythonGH-134312) * Specify boolean attribute behavior in parser * Tweak wording and example * Fix backticks --------- (cherry picked from commit 804c213) Co-authored-by: Micah Najacht <micah.najacht@gmail.com> Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com> Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
) (python#149054) Improve `hash()` builtin docstring with caveats. Mention its return type and that the value can be expected to change between processes (hash randomization). Why? The `hash` builtin gets reached for and used by a lot of people whether it is the right tool or not. IDEs surface docstrings and people use pydoc and `help(hash)`. (cherry picked from commit 665b7df)
…for ZIP files on Windows (pythonGH-146591) (pythonGH-149064) Use ZipFile.extractall() to sanitize file names and extract files. Files with invalid names (e.g. absolute paths) are now skipped. Files containing ".." in the name are no longer skipped. (cherry picked from commit fc829e8) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
…herits from both `ValueError` and `IndexError` (pythonGH-148664) (python#148917) (cherry picked from commit 435be06) Co-authored-by: Eoin Shaughnessy <45000144+EoinTrial@users.noreply.github.com> Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com> Co-authored-by: Stan Ulbrych <stan@python.org>
…entation (pythonGH-148565) (pythonGH-149063) * Document that 's' and 'p' accept bytes and bytearray. * Fix some footnotes. * Clarify that "string" is a byte string. * Fix the module docstring. (cherry picked from commit 3e5a3cb) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
…rial/stdlib2.rst` (pythonGH-149036) (python#149089) Co-authored-by: ByteFlow <fakeshadow1337@gmail.com> Co-authored-by: Copilot <copilot@github.com>
…) (python#149073) (cherry picked from commit 005555a)
…he asyncio REPL (pythonGH-140288) (python#148987) Co-authored-by: Bartosz Sławecki <bartosz@ilikepython.com>
…of dash-prefix check (pythonGH-148170) (python#148516) Co-authored-by: Stan Ulbrych <stan@python.org>
…ythongh-115508) (pythonGH-148141) (python#148414) Co-authored-by: Neil Schemenauer <nas-github@arctrix.com> Co-authored-by: Ned Deily <nad@python.org>
… functions are passed a coroutine as arg (pythonGH-149138) (python#149151) pythongh-149122: Fix segfault in compiler when certain builtin functions are passed a coroutine as arg (pythonGH-149138) (cherry picked from commit 16f292e) Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
…5 namespaces (pythonGH-148741) (python#149152) pythongh-148740: Fix `uuid` CLI with custom UUIDs for UUIDv3/v5 namespaces (pythonGH-148741) (cherry picked from commit f1588d4) Co-authored-by: Jansen Price <sumpygump@gmail.com> Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
…python#149154) Co-authored-by: Victor Stinner <vstinner@python.org> Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
…hon#149181) pythongh-149122: Fix refleak in codegen (pythonGH-149179) (cherry picked from commit 4599335) Co-authored-by: Petr Viktorin <encukou@gmail.com>
…id-mailbox (pythonGH-24872) (python#149191) When an address in an address-list has garbage at the end, the code will currently: 1. change the mailbox in the last parsed address into invalid-mailbox by overriding its token_type; 2. wrap the trailing garbage into another invalid-mailbox and append it to the last parsed address. However, that does not take into account that an address may also contain a Group instead of a single mailbox. In that case, overwriting token_type leads to undesirable results, e.g. parsing an email with the following 'To' header: unlisted-recipients:; (no To-header on input) raises an AttributeError from trying to treat the Group as a Mailbox. Moreover it is questionable whether the previously parsed mailbox should be treated as invalid in addition to the trailing garbage. Address both of the above by wrapping the trailing garbage in a new Address with a single invalid-mailbox, and append it to the AddressList directly. Changes the results of the test_get_address_list_mailboxes_invalid_addresses test, where the address list is now parsed into 4 mailboxes instead of 3 (all but the first one are invalid). (cherry picked from commit b413bc7) Co-authored-by: elenril <anton@khirnov.net>
…onGH-148344) (python#148964) (cherry picked from commit 1b69156)
…nGH-148522) (python#149200) As part of fixing bpo-27931 code was introduced to get_bare_quoted_string that added an empty Terminal if the quoted string was empty. This isn't the best answer in terms of the parse tree; we really want the token list to be empty in that case. But having it be empty resulted in local_part raising the index error. We find that same problem if we try to parse an address consisting of a single dquote. By fixing local_part to not raise on an empty token list, we can have the bare_quoted_string code correctly return an empty token list for the empty string cases (two dquotes or a single dquote as the entire addrespec, at the end of a line). (cherry picked from commit bdbb55c) Co-authored-by: R. David Murray <rdmurray@bitdance.com>
…ocs (pythonGH-146209) (pythonGH-149223) (cherry picked from commit 9d41e2a) Co-authored-by: Stan Ulbrych <stan@python.org>
…upport in set_stginfo_ffi_type_pointer (pythonGH-148969) (pythonGH-149224) (cherry picked from commit f2c7c0d) Co-authored-by: sunmy2019 <59365878+sunmy2019@users.noreply.github.com>
…st("?")` (pythonGH-148454) (pythonGH-148667)
(cherry picked from commit 69e0a78)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The offset. of``_gc_runtime_state` is exported via the debug offsets, but only offset within it is exported. It's likely that someone could be doing something slimey like looking at other fields. init. It's probably best to only add things to the end rather than change the offsets of existing members of the struct in a patch release.