]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
19 months agogh-117281: Change weakref repr() to fully qualified name (#117285)
Victor Stinner [Wed, 3 Apr 2024 10:18:05 +0000 (12:18 +0200)] 
gh-117281: Change weakref repr() to fully qualified name (#117285)

Use the fully qualified type name in repr() of weakref.ref and
weakref.proxy types.

Fix a crash in proxy_repr() when the reference is dead.

Add also test_ref_repr() and test_proxy_repr().

19 months agogh-91565: Update issue tracker URL in error message. (#117450)
Ezio Melotti [Wed, 3 Apr 2024 08:43:52 +0000 (10:43 +0200)] 
gh-91565: Update issue tracker URL in error message. (#117450)

* Update issue tracker URL in commit message.

* Also update issue tracker URL in comment.

19 months agogh-117431: Adapt str.startswith and str.endswith to Argument Clinic (#117466)
Erlend E. Aasland [Wed, 3 Apr 2024 07:11:39 +0000 (09:11 +0200)] 
gh-117431: Adapt str.startswith and str.endswith to Argument Clinic (#117466)

This change gives a significant speedup, as the METH_FASTCALL calling
convention is now used.

19 months agogh-76785: Fix a Refleak in _interpreters.new_config() (gh-117491)
Eric Snow [Wed, 3 Apr 2024 01:10:26 +0000 (19:10 -0600)] 
gh-76785: Fix a Refleak in _interpreters.new_config() (gh-117491)

This is a follow-up to gh-117170 and gh-117485.

19 months agogh-76785: Consolidate Some Interpreter-related Testing Helpers (gh-117485)
Eric Snow [Tue, 2 Apr 2024 23:16:50 +0000 (17:16 -0600)] 
gh-76785: Consolidate Some Interpreter-related Testing Helpers (gh-117485)

This eliminates the duplication of functionally identical helpers in the _testinternalcapi and _xxsubinterpreters modules.

19 months agogh-76785: Add PyInterpreterConfig Helpers (gh-117170)
Eric Snow [Tue, 2 Apr 2024 20:35:52 +0000 (14:35 -0600)] 
gh-76785: Add PyInterpreterConfig Helpers (gh-117170)

These helpers make it easier to customize and inspect the config used to initialize interpreters.  This is especially valuable in our tests.  I found inspiration from the PyConfig API for the PyInterpreterConfig dict conversion stuff.  As part of this PR I've also added a bunch of tests.

19 months agogh-117349: Micro-optimize a few `os.path` functions (#117350)
Nice Zombies [Tue, 2 Apr 2024 20:32:35 +0000 (22:32 +0200)] 
gh-117349: Micro-optimize a few `os.path` functions (#117350)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Barney Gale <barney.gale@gmail.com>
Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
19 months agoFix successor opcode name printing in Tier 2 DEOPT debug message (#117471)
Guido van Rossum [Tue, 2 Apr 2024 18:25:48 +0000 (11:25 -0700)] 
Fix successor opcode name printing in Tier 2 DEOPT debug message (#117471)

19 months agogh-112087: Make `list.extend(dict)` behave atomically (#117438)
Sam Gross [Tue, 2 Apr 2024 14:45:00 +0000 (10:45 -0400)] 
gh-112087: Make `list.extend(dict)` behave atomically (#117438)

Add a special case for `list.extend(dict)` and `list(dict)` so that those
patterns behave atomically with respect to modifications to the list or
dictionary.

This is required by multiprocessing, which assumes that
`list(_finalizer_registry)` is atomic.

19 months agogh-117440: Make `syslog` thread-safe in free-threaded builds (#117441)
Sam Gross [Tue, 2 Apr 2024 14:44:26 +0000 (10:44 -0400)] 
gh-117440: Make `syslog` thread-safe in free-threaded builds (#117441)

Use critical sections to protect access to the syslog module.

19 months agogh-117074: Update Traversable.joinpath docs to the 3.11+ protocol (GH-117113)
Petr Viktorin [Tue, 2 Apr 2024 14:08:16 +0000 (16:08 +0200)] 
gh-117074: Update Traversable.joinpath docs to the 3.11+ protocol (GH-117113)

19 months agogh-115538: Use pathlib to compare prefixes in test_venv (GH-117076)
AN Long [Tue, 2 Apr 2024 13:10:24 +0000 (21:10 +0800)] 
gh-115538: Use pathlib to compare prefixes in test_venv (GH-117076)

19 months agogh-113317: Argument Clinic: Add libclinic.return_converters (#117451)
Victor Stinner [Tue, 2 Apr 2024 11:29:39 +0000 (13:29 +0200)] 
gh-113317: Argument Clinic: Add libclinic.return_converters (#117451)

Move the following converter classes to libclinic.return_converters:

* CReturnConverter
* CReturnConverterAutoRegister
* Py_ssize_t_return_converter
* bool_return_converter
* double_return_converter
* float_return_converter
* int_return_converter
* long_return_converter
* size_t_return_converter
* unsigned_int_return_converter
* unsigned_long_return_converter

Move also the add_c_return_converter() function there.

19 months agoGH-115776: Embed the values array into the object, for "normal" Python objects. ...
Mark Shannon [Tue, 2 Apr 2024 10:59:21 +0000 (11:59 +0100)] 
GH-115776: Embed the values array into the object, for "normal" Python objects. (GH-116115)

19 months agogh-109120: Fix syntax error in handlinh of incorrect star expressions (#117444)
Grigoriev Semyon [Tue, 2 Apr 2024 10:42:58 +0000 (13:42 +0300)] 
gh-109120: Fix syntax error in handlinh of incorrect star expressions (#117444)

19 months agogh-117411: move PyFutureFeatures to pycore_symtable.h and make it private (#117412)
Irit Katriel [Tue, 2 Apr 2024 10:34:49 +0000 (11:34 +0100)] 
gh-117411: move PyFutureFeatures to pycore_symtable.h and make it private (#117412)

19 months agogh-113317: Argument Clinic: Add libclinic.converters module (#117315)
Victor Stinner [Tue, 2 Apr 2024 10:09:53 +0000 (12:09 +0200)] 
gh-113317: Argument Clinic: Add libclinic.converters module (#117315)

Move the following converter classes to libclinic.converters:

* PyByteArrayObject_converter
* PyBytesObject_converter
* Py_UNICODE_converter
* Py_buffer_converter
* Py_complex_converter
* Py_ssize_t_converter
* bool_converter
* byte_converter
* char_converter
* defining_class_converter
* double_converter
* fildes_converter
* float_converter
* int_converter
* long_converter
* long_long_converter
* object_converter
* self_converter
* short_converter
* size_t_converter
* slice_index_converter
* str_converter
* unicode_converter
* unsigned_char_converter
* unsigned_int_converter
* unsigned_long_converter
* unsigned_long_long_converter
* unsigned_short_converter

Move also the following classes to libclinic.converters:

* buffer
* robuffer
* rwbuffer

Move the following functions to libclinic.converters:

* correct_name_for_self()
* r()
* str_converter_key()

Move Null and NULL to libclinic.utils.

19 months agoDocs: specify XML document name in xml.etree.elementtree example (#24223) 113771/head
Moshe Kaplan [Mon, 1 Apr 2024 19:53:00 +0000 (15:53 -0400)] 
Docs: specify XML document name in xml.etree.elementtree example (#24223)

19 months agoDocs: add more links to PIPE in subprocess docs (#25416)
Matthew Davis [Mon, 1 Apr 2024 19:49:14 +0000 (21:49 +0200)] 
Docs: add more links to PIPE in subprocess docs (#25416)

19 months agoGH-117337: Deprecate `glob.glob0()` and `glob.glob1()`. (#117371)
Barney Gale [Mon, 1 Apr 2024 19:37:41 +0000 (20:37 +0100)] 
GH-117337: Deprecate `glob.glob0()` and `glob.glob1()`. (#117371)

These undocumented functions are no longer used by `msilib`, so there's no
reason to keep them around.

19 months agogh-77714: Provide an async iterator version of as_completed (GH-22491)
Justin Turner Arthur [Mon, 1 Apr 2024 17:07:29 +0000 (12:07 -0500)] 
gh-77714: Provide an async iterator version of as_completed (GH-22491)

* as_completed returns object that is both iterator and async iterator
* Existing tests adjusted to test both the old and new style
* New test to ensure iterator can be resumed
* New test to ensure async iterator yields any passed-in Futures as-is

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Guido van Rossum <gvanrossum@gmail.com>
19 months agoSilence compiler warnings in gc.c (#117422)
Guido van Rossum [Mon, 1 Apr 2024 16:13:38 +0000 (09:13 -0700)] 
Silence compiler warnings in gc.c (#117422)

19 months agogh-94808: Fix refcounting in PyObject_Print tests (GH-117421)
Petr Viktorin [Mon, 1 Apr 2024 15:01:22 +0000 (17:01 +0200)] 
gh-94808: Fix refcounting in PyObject_Print tests (GH-117421)

19 months agogh-117142: ctypes: Unify meta tp slot functions (GH-117143)
neonene [Mon, 1 Apr 2024 13:28:14 +0000 (22:28 +0900)] 
gh-117142: ctypes: Unify meta tp slot functions (GH-117143)

Integrates the following ctypes meta tp slot functions:
* `CDataType_traverse()` into `CType_Type_traverse()`.
* `CDataType_clear()` into `CType_Type_clear()`.
* `CDataType_dealloc()` into `CType_Type_dealloc()`.
* `CDataType_repeat()` into `CType_Type_repeat()`.

19 months agogh-91565: Replace bugs.python.org links with Devguide/GitHub ones (GH-91568)
Steve (Gadget) Barnes [Mon, 1 Apr 2024 13:02:07 +0000 (14:02 +0100)] 
gh-91565: Replace bugs.python.org links with Devguide/GitHub ones  (GH-91568)

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
19 months agogh-94808:Improve coverage of PyObject_Print (GH-98749)
MonadChains [Mon, 1 Apr 2024 12:52:25 +0000 (13:52 +0100)] 
gh-94808:Improve coverage of PyObject_Print (GH-98749)

19 months agoBump mypy from 1.8.0 to 1.9.0 in /Tools (#117418)
dependabot[bot] [Mon, 1 Apr 2024 11:14:37 +0000 (11:14 +0000)] 
Bump mypy from 1.8.0 to 1.9.0 in /Tools (#117418)

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
19 months agobuild(deps-dev): bump types-psutil from 5.9.5.20240205 to 5.9.5.20240316 in /Tools...
dependabot[bot] [Mon, 1 Apr 2024 11:05:14 +0000 (11:05 +0000)] 
build(deps-dev): bump types-psutil from 5.9.5.20240205 to 5.9.5.20240316 in /Tools (#117417)

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
19 months agobuild(deps-dev): bump types-setuptools from 69.1.0.20240301 to 69.2.0.20240317 in...
dependabot[bot] [Mon, 1 Apr 2024 10:38:38 +0000 (11:38 +0100)] 
build(deps-dev): bump types-setuptools from 69.1.0.20240301 to 69.2.0.20240317 in /Tools (#117419)

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
19 months agobuild(deps): bump actions/add-to-project from 0.6.0 to 1.0.0 (#117415)
dependabot[bot] [Mon, 1 Apr 2024 09:54:33 +0000 (09:54 +0000)] 
build(deps): bump actions/add-to-project from 0.6.0 to 1.0.0 (#117415)

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
19 months agoDoc: printf-style library/stdtype improvements (#16741)
Adorilson Bezerra [Sun, 31 Mar 2024 22:34:54 +0000 (23:34 +0100)] 
Doc: printf-style library/stdtype improvements (#16741)

19 months agogh-117387 Remove hash mark from introductory text (#117409)
Raymond Hettinger [Sun, 31 Mar 2024 21:09:22 +0000 (16:09 -0500)] 
gh-117387 Remove hash mark from introductory text (#117409)

19 months agogh-102190: Add additional zipfile `pwd=` arg docstrings (gh-102195)
Deborah [Sun, 31 Mar 2024 20:11:48 +0000 (22:11 +0200)] 
gh-102190: Add additional zipfile `pwd=` arg docstrings (gh-102195)

This just documents the parameter that already exists.

---------

Co-authored-by: Gregory P. Smith <greg@krypto.org>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
19 months agoLink to the Python type system specification (#117400)
Shantanu [Sun, 31 Mar 2024 19:02:48 +0000 (12:02 -0700)] 
Link to the Python type system specification (#117400)

19 months agoGH-114575: Rename `PurePath.pathmod` to `PurePath.parser` (#116513)
Barney Gale [Sun, 31 Mar 2024 18:14:48 +0000 (19:14 +0100)] 
GH-114575: Rename `PurePath.pathmod` to `PurePath.parser` (#116513)

And rename the private base class from `PathModuleBase` to `ParserBase`.

19 months agogh-117303: Don't detach in `PyThreadState_DeleteCurrent()` (#117304)
Sam Gross [Fri, 29 Mar 2024 22:58:08 +0000 (18:58 -0400)] 
gh-117303: Don't detach in `PyThreadState_DeleteCurrent()` (#117304)

This fixes a crash in `test_threading.test_reinit_tls_after_fork()` when
running with the GIL disabled. We already properly handle the case where
the thread state is `_Py_THREAD_ATTACHED` in `tstate_delete_common()` --
we just need to remove an assertion.

Keeping the thread attached means that a stop-the-world pause, such as
for a `fork()`, won't commence until we remove our thread state from the
interpreter's linked list. This prevents a crash when the child process
tries to clean up the dead thread states.

19 months agogh-116664: In _warnings.c, make filters_version access thread-safe (#117374)
Erlend E. Aasland [Fri, 29 Mar 2024 20:23:28 +0000 (21:23 +0100)] 
gh-116664: In _warnings.c, make filters_version access thread-safe (#117374)

- assert that the lock is held in already_warned()
- protect 'filters_version' increment in warnings_filters_mutated_impl()

19 months agogh-117348: Refactored RawConfigParser._read for similicity and comprehensibility...
Jason R. Coombs [Fri, 29 Mar 2024 20:06:09 +0000 (16:06 -0400)] 
gh-117348: Refactored RawConfigParser._read for similicity and comprehensibility (#117372)

* Extract method for _read_inner, reducing complexity and indentation by 1.

* Extract method for _raise_all and yield ParseErrors from _read_inner.

Reduces complexity by 1 and reduces touch points for handling errors in _read_inner.

* Prefer iterators to splat expansion and literal indexing.

* Extract method for _strip_comments. Reduces complexity by 7.

* Model the file lines in a class to encapsulate the comment status and cleaned value.

* Encapsulate the read state as a dataclass

* Extract _handle_continuation_line and _handle_rest methods. Reduces complexity by 8.

* Reindent

* At least for now, collect errors in the ReadState

* Check for missing section header separately.

* Extract methods for _handle_header and _handle_option. Reduces complexity by 6.

* Remove unreachable code. Reduces complexity by 4.

* Remove unreachable branch

* Handle error condition early. Reduces complexity by 1.

* Add blurb

* Move _raise_all to ParsingError, as its behavior is most closely related to the exception class and not the reader.

* Split _strip* into separate methods.

* Refactor _strip_full to compute the strip just once and use 'not any' to determine the factor.

* Replace use of 'sys.maxsize' with direct computation of the stripped value.

* Extract has_comments as a dynamic property.

* Implement clean as a cached property.

* Model comment prefixes in the RawConfigParser within a prefixes namespace.

* Use a regular expression to search for the first match.

Avoids mutating variables and tricky logic and over-computing all of the starts when only the first is relevant.

19 months agogh-117300: Use stop the world to make `sys._current_frames` and `sys._current_excepti...
Sam Gross [Fri, 29 Mar 2024 19:33:06 +0000 (15:33 -0400)] 
gh-117300: Use stop the world to make `sys._current_frames` and `sys._current_exceptions` thread-safe. (#117301)

This adds a stop the world pause to make the two functions thread-safe
when the GIL is disabled in the free-threaded build.

Additionally, the main test thread may call `sys._current_exceptions()` as
soon as `g_raised.set()` is called. The background thread may not yet reach
the `leave_g.wait()` line.

19 months agoFix broken format in error for bad input in summarize_stats.py (#117375)
Guido van Rossum [Fri, 29 Mar 2024 18:31:09 +0000 (11:31 -0700)] 
Fix broken format in error for bad input in summarize_stats.py (#117375)

When you pass the script a non-existent input file, you get a TypeError instead of the intended ValueError.

19 months agogh-111926: Avoid locking in PyType_IsSubtype (#117275)
mpage [Fri, 29 Mar 2024 17:42:02 +0000 (10:42 -0700)] 
gh-111926: Avoid locking in PyType_IsSubtype (#117275)

Read the MRO in a thread-unsafe way in `PyType_IsSubtype` to avoid locking. Fixing this is tracked in #117306.

The motivation for this change is in support of making weakrefs thread-safe in free-threaded builds:

`WeakValueDictionary` uses a special dictionary function, `_PyDict_DelItemIf`
to remove dead weakrefs from the dictionary. `_PyDict_DelItemIf` removes a key
if a user supplied predicate evaluates to true for the value associated with
the key. Crucially for the `WeakValueDictionary` use case, the predicate
evaluation + deletion sequence is atomic, provided that the predicate doesn’t
suspend. The predicate used by `WeakValueDictionary` includes a subtype check,
which we must ensure doesn't suspend in free-threaded builds.

19 months agogh-117323: Make `cell` thread-safe in free-threaded builds (#117330)
Sam Gross [Fri, 29 Mar 2024 17:35:43 +0000 (13:35 -0400)] 
gh-117323: Make `cell` thread-safe in free-threaded builds (#117330)

Use critical sections to lock around accesses to cell contents. The critical sections are no-ops in the default (with GIL) build.

19 months agogh-117344: Skip flaky tests in free-threaded build (#117355)
Sam Gross [Fri, 29 Mar 2024 17:34:04 +0000 (13:34 -0400)] 
gh-117344: Skip flaky tests in free-threaded build (#117355)

The tests are not reliable with the GIL disabled. In theory, they can
fail with the GIL enabled too, but the failures are much more likely
with the GIL disabled.

19 months agogh-112529: Don't untrack tuples or dicts with zero refcount (#117370)
Sam Gross [Fri, 29 Mar 2024 17:33:04 +0000 (13:33 -0400)] 
gh-112529: Don't untrack tuples or dicts with zero refcount (#117370)

The free-threaded GC sometimes sees objects with zero refcount. This can
happen due to the delay in merging biased reference counting fields,
and, in the future, due to deferred reference counting. We should not
untrack these objects or they will never be collected.

This fixes the refleaks in the free-threaded build.

19 months agogh-116664: Fix unused var warnings in _warnings.c in non-free-threaded builds (#117373)
Erlend E. Aasland [Fri, 29 Mar 2024 17:26:06 +0000 (18:26 +0100)] 
gh-116664: Fix unused var warnings in _warnings.c in non-free-threaded builds (#117373)

The warnings were introduced by commit c1712ef06.

19 months agoRefactor pdb executable targets (#112570)
Tian Gao [Fri, 29 Mar 2024 16:02:01 +0000 (09:02 -0700)] 
Refactor pdb executable targets (#112570)

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
19 months agogh-66449: configparser: Add support for unnamed sections (#117273)
Pedro Lacerda [Fri, 29 Mar 2024 15:05:00 +0000 (12:05 -0300)] 
gh-66449: configparser: Add support for unnamed sections (#117273)

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
19 months agogh-117166: Ignore empty and temporary dirs in `test_makefile` (#117190)
Nikita Sobolev [Fri, 29 Mar 2024 11:14:25 +0000 (14:14 +0300)] 
gh-117166: Ignore empty and temporary dirs in `test_makefile` (#117190)

19 months agogh-117347: Fix test_clinic side effects (#117363)
Victor Stinner [Fri, 29 Mar 2024 10:25:17 +0000 (11:25 +0100)] 
gh-117347: Fix test_clinic side effects (#117363)

Save/restore converters in ClinicWholeFileTest and
ClinicExternalTest.

19 months agogh-117142: ctypes: Migrate global vars to module state (GH-117189)
neonene [Fri, 29 Mar 2024 09:40:48 +0000 (18:40 +0900)] 
gh-117142: ctypes: Migrate global vars to module state (GH-117189)

19 months agoFix reversed assertRegex checks in test_ssl. (#117351)
Gregory P. Smith [Fri, 29 Mar 2024 00:58:37 +0000 (17:58 -0700)] 
Fix reversed assertRegex checks in test_ssl. (#117351)

19 months agogh-117110: Fix subclasses of typing.Any with custom constructors (#117111)
傅立业(Chris Fu) [Fri, 29 Mar 2024 00:19:20 +0000 (08:19 +0800)] 
gh-117110: Fix subclasses of typing.Any with custom constructors (#117111)

19 months agogh-117339: Use NULL instead of None for LOAD_SUPER_ATTR in dis docs (GH-117343)
Christopher Chianelli [Thu, 28 Mar 2024 22:26:56 +0000 (18:26 -0400)] 
gh-117339: Use NULL instead of None for LOAD_SUPER_ATTR in dis docs (GH-117343)

19 months agoGH-117121: Add pystats to JIT builds (GH-117346)
Michael Droettboom [Thu, 28 Mar 2024 22:23:08 +0000 (18:23 -0400)] 
GH-117121: Add pystats to JIT builds (GH-117346)

19 months agogh-117335: Handle non-iterables for `ntpath.commonpath` (GH-117336)
Nice Zombies [Thu, 28 Mar 2024 21:20:08 +0000 (22:20 +0100)] 
gh-117335: Handle non-iterables for `ntpath.commonpath` (GH-117336)

19 months agoIncrease the JIT CI timeouts to 75 minutes (GH-117342)
Brandt Bucher [Thu, 28 Mar 2024 21:02:34 +0000 (14:02 -0700)] 
Increase the JIT CI timeouts to 75 minutes (GH-117342)

19 months agogh-117294: Report DocTestCase as skipped if all examples in the doctest are skipped...
Malcolm Smith [Thu, 28 Mar 2024 19:59:12 +0000 (19:59 +0000)] 
gh-117294: Report DocTestCase as skipped if all examples in the doctest are skipped (GH-117297)

19 months agogh-69201: Separate stdout and stderr stream in test_pdb (#117308)
Tian Gao [Thu, 28 Mar 2024 18:23:29 +0000 (11:23 -0700)] 
gh-69201: Separate stdout and stderr stream in test_pdb (#117308)

19 months agogh-114331: Skip decimal test_maxcontext_exact_arith on s390x (#117326)
Victor Stinner [Thu, 28 Mar 2024 16:40:58 +0000 (17:40 +0100)] 
gh-114331: Skip decimal test_maxcontext_exact_arith on s390x (#117326)

19 months agogh-116664: Make module state Py_SETREF's in _warnings thread-safe (#116959)
Erlend E. Aasland [Thu, 28 Mar 2024 15:05:08 +0000 (16:05 +0100)] 
gh-116664: Make module state Py_SETREF's in _warnings thread-safe (#116959)

Mark the swap operations as critical sections.

Add an internal Py_BEGIN_CRITICAL_SECTION_MUT API that takes a PyMutex
pointer instead of a PyObject pointer.

19 months agobpo-43848: explain optional argument mtime in gzip.py. (GH-25410)
Joachim Wuttke [Thu, 28 Mar 2024 13:43:07 +0000 (14:43 +0100)] 
bpo-43848: explain optional argument mtime in gzip.py. (GH-25410)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
19 months agogh-110481: Fix biased reference counting queue initialization. (#117271)
Sam Gross [Thu, 28 Mar 2024 13:28:39 +0000 (09:28 -0400)] 
gh-110481: Fix biased reference counting queue initialization. (#117271)

The biased reference counting queue must be initialized from the bound
(active) thread because it uses `_Py_ThreadId()` as the key in a hash
table.

19 months agogh-117178: Recover lazy loading of self-referential modules (#117179)
Chris Markiewicz [Thu, 28 Mar 2024 10:59:31 +0000 (06:59 -0400)] 
gh-117178: Recover lazy loading of self-referential modules (#117179)

19 months agogh-117266: Fix crashes on user-created AST subclasses (GH-117276)
Jelle Zijlstra [Thu, 28 Mar 2024 10:30:31 +0000 (04:30 -0600)] 
gh-117266: Fix crashes on user-created AST subclasses (GH-117276)

Fix crashes on user-created AST subclasses

19 months agogh-117310: Remove extra DECREF on "no ciphers" error path in `_ssl._SSLContext` const...
Gregory P. Smith [Thu, 28 Mar 2024 10:11:58 +0000 (03:11 -0700)] 
gh-117310: Remove extra DECREF on "no ciphers" error path in `_ssl._SSLContext` constructor (#117309)

Remove extra self DECREF on ssl "no ciphers" error path.

This doesn't come up in practice because nobody links against a broken
OpenSSL library that provides nothing.

19 months agogh-116303: Handle disabled test modules in test.support helpers (#116482)
Erlend E. Aasland [Thu, 28 Mar 2024 08:40:37 +0000 (09:40 +0100)] 
gh-116303: Handle disabled test modules in test.support helpers (#116482)

Make sure test.support helpers skip iso. failing if test extension
modules are disabled. Also log TEST_MODULES in test.pythoninfo.

19 months agogh-114099: Add documentation for iOS platform (GH-117057)
Russell Keith-Magee [Thu, 28 Mar 2024 08:13:13 +0000 (16:13 +0800)] 
gh-114099: Add documentation for iOS platform (GH-117057)

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Jacob Coffee <jacob@z7x.org>
Co-authored-by: Malcolm Smith <smith@chaquo.com>
Co-authored-by: Ned Deily <nad@python.org>
19 months agogh-114099: Additions to standard library to support iOS (GH-117052)
Russell Keith-Magee [Thu, 28 Mar 2024 07:59:33 +0000 (15:59 +0800)] 
gh-114099: Additions to standard library to support iOS (GH-117052)

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Malcolm Smith <smith@chaquo.com>
Co-authored-by: Ned Deily <nad@python.org>
19 months agogh-89739: gh-77140: Support zip64 in zipimport (GH-94146)
Tim Hatch [Thu, 28 Mar 2024 06:54:51 +0000 (23:54 -0700)] 
gh-89739: gh-77140: Support zip64 in zipimport (GH-94146)

* Reads zip64 files as produced by the zipfile module
* Include tests (somewhat slow, however, because of the need to create "large" zips)
* About the same amount of strictness reading invalid zip files as zipfile has
* Still works on files with prepended data (like pex)

There are a lot more test cases at https://github.com/thatch/zipimport64/ that give me confidence that this works for real-world files.

Fixes #89739 and #77140.

---------

Co-authored-by: Itamar Ostricher <itamarost@gmail.com>
Reviewed-by: Gregory P. Smith <greg@krypto.org>
19 months agoRevert "gh-116886: Temporarily disable CIfuzz (memory) (GH-117018)" (GH-117289)
Illia Volochii [Thu, 28 Mar 2024 06:46:01 +0000 (08:46 +0200)] 
Revert "gh-116886: Temporarily disable CIfuzz (memory) (GH-117018)" (GH-117289)

This reverts commit 1ab0d0b1167d78bf19661a3b5e533a2b68a57604.

This reverts #117018.

I expect the issue to be fixed based on https://github.com/google/oss-fuzz/pull/11708#issuecomment-2006442396 and https://github.com/actions/runner-images/issues/9491.

19 months agogh-108277: Make test_os tolerate 10 ms diff for timerfd on Android emulators (#117223)
Malcolm Smith [Wed, 27 Mar 2024 22:11:44 +0000 (22:11 +0000)] 
gh-108277: Make test_os tolerate 10 ms diff for timerfd on Android emulators (#117223)

19 months agogh-113317: Change how Argument Clinic lists converters (#116853)
Victor Stinner [Wed, 27 Mar 2024 22:10:14 +0000 (23:10 +0100)] 
gh-113317: Change how Argument Clinic lists converters (#116853)

* Add a new create_parser_namespace() function for
  PythonParser to pass objects to executed code.
* In run_clinic(), list converters using 'converters' and
  'return_converters' dictionarties.
* test_clinic: add 'object()' return converter.
* Use also create_parser_namespace() in eval_ast_expr().

Co-authored-by: Erlend E. Aasland <erlend@python.org>
19 months agogh-99108: Update and check HACL* version information (GH-117295)
Seth Michael Larson [Wed, 27 Mar 2024 21:56:14 +0000 (16:56 -0500)] 
gh-99108: Update and check HACL* version information (GH-117295)

* Update and check HACL* version information

19 months agogh-117288: Allocate fewer label IDs in _PyCfg_ToInstructionSequence (#117290)
Irit Katriel [Wed, 27 Mar 2024 17:38:19 +0000 (17:38 +0000)] 
gh-117288: Allocate fewer label IDs in _PyCfg_ToInstructionSequence (#117290)

19 months agogh-71042: Add `platform.android_ver` (#116674)
Malcolm Smith [Wed, 27 Mar 2024 16:53:27 +0000 (16:53 +0000)] 
gh-71042: Add `platform.android_ver` (#116674)

19 months agogh-117225: doctest: only print "and X failed" when non-zero, don't pluralise "1 items...
Hugo van Kemenade [Wed, 27 Mar 2024 14:46:35 +0000 (16:46 +0200)] 
gh-117225: doctest: only print "and X failed" when non-zero, don't pluralise "1 items" (#117228)

19 months agoAdd statistics recipe for sampling from an estimated probability density distribution...
Raymond Hettinger [Wed, 27 Mar 2024 14:04:32 +0000 (09:04 -0500)] 
Add statistics recipe for sampling from an estimated probability density distribution (#117221)

19 months agogh-113548: Allow CLI arguments to `pdb -m` (#113557)
Tian Gao [Wed, 27 Mar 2024 01:20:12 +0000 (18:20 -0700)] 
gh-113548: Allow CLI arguments to `pdb -m` (#113557)

19 months agoChange links on the index page (#117230)
Adorilson Bezerra [Tue, 26 Mar 2024 19:08:08 +0000 (19:08 +0000)] 
Change links on the index page (#117230)

19 months agogh-104242: Enable test_is_char_device_true in pathlib test on all platform (GH-116983)
AN Long [Tue, 26 Mar 2024 18:26:48 +0000 (02:26 +0800)] 
gh-104242: Enable test_is_char_device_true in pathlib test on all platform (GH-116983)

19 months agogh-115775: Compiler adds __static_attributes__ field to classes (#115913)
Irit Katriel [Tue, 26 Mar 2024 15:18:17 +0000 (15:18 +0000)] 
gh-115775: Compiler adds __static_attributes__ field to classes (#115913)

19 months agogh-97901 add missing text/rtf to mimetypes (GH-97902)
Antonio [Tue, 26 Mar 2024 14:10:29 +0000 (15:10 +0100)] 
gh-97901 add missing text/rtf to mimetypes (GH-97902)

Co-authored-by: Noam Cohen <noam@noam.me>
19 months agogh-115538: Use isolate mode when running venv test_multiprocessing_recursion() (...
AN Long [Tue, 26 Mar 2024 14:09:57 +0000 (22:09 +0800)] 
gh-115538: Use isolate mode when running venv test_multiprocessing_recursion() (#117116)

Co-authored-by: Victor Stinner <vstinner@python.org>
19 months agopre-commit: add `check-case-conflict` and `check-merge-conflict` (#117259)
Hugo van Kemenade [Tue, 26 Mar 2024 14:09:09 +0000 (16:09 +0200)] 
pre-commit: add `check-case-conflict` and `check-merge-conflict` (#117259)

19 months agogh-98966: Handle stdout=subprocess.STDOUT (GH-98967)
Paulo Neves [Tue, 26 Mar 2024 12:37:50 +0000 (13:37 +0100)] 
gh-98966: Handle stdout=subprocess.STDOUT (GH-98967)

Explicitly handle the case where stdout=STDOUT
as otherwise the existing error handling gets
confused and reports hard to understand errors.

Signed-off-by: Paulo Neves <ptsneves@gmail.com>
19 months agogh-66543: Fix mimetype.guess_type() (GH-117217)
Serhiy Storchaka [Tue, 26 Mar 2024 11:26:45 +0000 (13:26 +0200)] 
gh-66543: Fix mimetype.guess_type() (GH-117217)

Fix parsing of the following corner cases:

* URLs with only a host name
* URLs containing a fragment
* URLs containing a query
* filenames with only a UNC sharepoint on Windows

Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
19 months agoGH-117108: Set the "old space bit" to "visited" for all young objects (#117213)
Mark Shannon [Tue, 26 Mar 2024 11:11:42 +0000 (11:11 +0000)] 
GH-117108: Set the "old space bit" to "visited" for all young objects  (#117213)

Change old space bit of young objects from 0 to gcstate->visited_space.
This ensures that any object created *and* collected during cycle GC has the bit set correctly.

19 months agoGH-116422: Tier2 hot/cold splitting (GH-116813)
Mark Shannon [Tue, 26 Mar 2024 09:35:11 +0000 (09:35 +0000)] 
GH-116422: Tier2 hot/cold splitting (GH-116813)

Splits the "cold" path, deopts and exits, from the "hot" path, reducing the size of most jitted instructions, at the cost of slower exits.

19 months agobpo-24612: Improve syntax error for 'not' after an operator (GH-28170)
Pablo Galindo Salgado [Tue, 26 Mar 2024 09:30:46 +0000 (09:30 +0000)] 
bpo-24612: Improve syntax error for 'not' after an operator (GH-28170)

Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
19 months agogh-83845: Add tests for operator module (#115883)
Hugo van Kemenade [Tue, 26 Mar 2024 09:13:32 +0000 (11:13 +0200)] 
gh-83845: Add tests for operator module (#115883)

Co-authored-by: Karthikeyan Singaravelan <tir.karthi@gmail.com>
19 months agogh-115627: Fix PySSL_SetError handling SSL_ERROR_SYSCALL (GH-115628)
yevgeny hong [Tue, 26 Mar 2024 07:45:43 +0000 (16:45 +0900)] 
gh-115627: Fix PySSL_SetError handling SSL_ERROR_SYSCALL (GH-115628)

Python 3.10 changed from using SSL_write() and SSL_read() to SSL_write_ex() and
SSL_read_ex(), but did not update handling of the return value.

Change error handling so that the return value is not examined.
OSError (not EOF) is now returned when retval is 0.

According to *recent* man pages of all functions for which we call
PySSL_SetError, (in OpenSSL 3.0 and 1.1.1), their return value should
be used to determine whether an error happened (i.e. if PySSL_SetError
should be called), but not what kind of error happened (so,
PySSL_SetError shouldn't need retval). To get the error,
we need to use SSL_get_error.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
19 months agogh-83434: Disable XML in regrtest when -R option is used (#117232)
Victor Stinner [Tue, 26 Mar 2024 07:35:59 +0000 (08:35 +0100)] 
gh-83434: Disable XML in regrtest when -R option is used (#117232)

19 months agogh-117187: Fix XML tests for vanilla Expat <2.6.0 (GH-117203)
Sebastian Pipping [Tue, 26 Mar 2024 01:48:27 +0000 (02:48 +0100)] 
gh-117187: Fix XML tests for vanilla Expat <2.6.0 (GH-117203)

This fixes XML unittest fallout from the https://github.com/python/cpython/issues/115398 security fix.  When configured using `--with-system-expat` on systems with older pre 2.6.0 versions of libexpat, our unittests were failing.

* sax|etree: Simplify Expat version guard where simplifiable

Idea by MatÄ›j Cepl

* sax|etree: Fix reparse deferral tests for vanilla Expat <2.6.0

This *does not fix* the case of distros with an older version of libexpat with the 2.6.0 feature backported as a security fix.  (Ubuntu is a known example of this with its libexpat1 2.5.0-2ubunutu0.1 package)

19 months agogh-99108: Refresh HACL*; update modules accordingly; fix namespacing (GH-117237)
Jonathan Protzenko [Tue, 26 Mar 2024 00:35:26 +0000 (17:35 -0700)] 
gh-99108: Refresh HACL*; update modules accordingly; fix namespacing (GH-117237)

Pulls in a new update from https://github.com/hacl-star/hacl-star and fixes our C "namespacing" done by `Modules/_hacl/refresh.sh`.

19 months agogh-109870: Dataclasses: batch up exec calls (gh-110851)
Eric V. Smith [Mon, 25 Mar 2024 23:59:14 +0000 (19:59 -0400)] 
gh-109870: Dataclasses: batch up exec calls (gh-110851)

Instead of calling `exec()` once for each function added to a dataclass, only call `exec()` once per dataclass. This can lead to speed improvements of up to 20%.

19 months agoSync main docs and docstring for median_grouped(). (gh-117214)
Raymond Hettinger [Mon, 25 Mar 2024 23:49:44 +0000 (18:49 -0500)] 
Sync main docs and docstring for median_grouped(). (gh-117214)

19 months agogh-117114: Make os.path.isdevdrive available on all platforms (GH-117115)
Nice Zombies [Mon, 25 Mar 2024 22:55:11 +0000 (23:55 +0100)] 
gh-117114: Make os.path.isdevdrive available on all platforms (GH-117115)

19 months agoAdd information about negative indexes to sequence datamodel doc (#110903)
Adorilson Bezerra [Mon, 25 Mar 2024 22:34:20 +0000 (22:34 +0000)] 
Add information about negative  indexes to sequence datamodel doc (#110903)

Co-authored by Terry Jan Reedy

19 months agoA few minor tweaks to get stats working and compiling cleanly. (#117219)
Mark Shannon [Mon, 25 Mar 2024 20:43:51 +0000 (20:43 +0000)] 
A few minor tweaks to get stats working and compiling cleanly. (#117219)

Fixes a compilation error when configured with `--enable-pystats`,
an array size issue, and an unused variable.

19 months agogh-116936: Add PyType_GetModuleByDef() to the limited C API (#116937)
Victor Stinner [Mon, 25 Mar 2024 16:32:20 +0000 (17:32 +0100)] 
gh-116936: Add PyType_GetModuleByDef() to the limited C API (#116937)