Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-113171: Fix "private" (non-global) IP address ranges #113179

Merged
merged 9 commits into from
Mar 22, 2024

Conversation

jstasiak
Copy link
Contributor

@jstasiak jstasiak commented Dec 15, 2023

The _private_networks variables, used by various is_private implementations, were missing some ranges and at the same time had overly strict ranges (where there are more specific ranges considered globally reachable by the IANA registries).

This patch updates the ranges with what was missing or otherwise incorrect.

I left 100.64.0.0/10 alone, for now, as it's been made special in [1] and I'm not sure if we want to undo that as I don't quite understand the motivation behind it.

Additionally I mainly focused on adding tests for IPAddress.is_global and I left IPNetwork.is_global alone. The reasons for that are:

  • I don't think it makes much sense to have properties like is_global, is_private etc. on networks, where there are more than two possibilities (can be global, can be non-global, can be partially global).
  • The properties aren't documented for network objects in the first place so it's unclear what the semantics are

[1] #61602

The _private_networks variables, used by various is_private
implementations, were missing some ranges and at the same time had
overly strict ranges (where there are more specific ranges considered
globally reachable by the IANA registries).

This patch updates the ranges with what was missing or otherwise
incorrect.

A _address_exclude_many() helper function is created to calculate
the necessary network ranges in the trickier cases.

I left 100.64.0.0/10 alone, for now, as it's been made special in [1]
and I'm not sure if we want to undo that as I don't quite understand the
motivation behind it.

Additionally I mainly focused on adding tests for IP*Address.is_global
and I left IP*Network.is_global alone. The reasons for that are:

* I don't think it makes much sense to have properties like is_global,
  is_private etc. on networks, where there are more than two
  possibilities (can be global, can be non-global, can be partially global).
* The properties aren't documented for network objects in the first
  place so it's unclear what the semantics are

The _address_exclude_many() call returns 8 networks for IPv4, 121
networks for IPv6.

[1] python#61602
@jstasiak
Copy link
Contributor Author

Two concerns to resolve:

  1. What to do about 100.64.0.0/10?
  2. Should I add a news entry for this? It's both a fix and a somewhat breaking change.

@jstasiak jstasiak changed the title GH-113171: Fix "private" (really non-global) IP address ranges GH-113171: Fix "private" (non-global) IP address ranges Dec 15, 2023
@jstasiak
Copy link
Contributor Author

I thought about it a little bit and I'll have a much simpler implementations of this, not today though

@jstasiak
Copy link
Contributor Author

jstasiak commented Jan 9, 2024

Simplified. I continue to be unsure about the semantics of these properties for networks, I left them alone (for now at least).

@encukou
Copy link
Member

encukou commented Mar 13, 2024

IMO:

What to do about 100.64.0.0/10?

Keep it as it is, and document it? I see you did that in #113186.

Should I add a news entry for this? It's both a fix and a somewhat breaking change.

Yes, and also add it to What's New.

unsure about the semantics of these properties for networks

It would probably be best to document that if not all addresses in the network share a single value, the result is unspecified. That's the case now, too.
However, if all of the network is in an exception, I think that should be honored.

@jstasiak
Copy link
Contributor Author

Thank you for your feedback @encukou.

To address your points in reverse order:

unsure about the semantics of these properties for networks

It would probably be best to document that if not all addresses in the network share a single value, the result is unspecified. That's the case now, too. However, if all of the network is in an exception, I think that should be honored.

Agreed and done (as far as I can tell).

Should I add a news entry for this? It's both a fix and a somewhat breaking change.

Yes, and also add it to What's New.

Done. Feedback very much appreciated, especially regarding the wording and verbosity (I opted to be verbose in the news entry but terse in the What's new entry per the "Rules for maintenance" listed in the file, I expect it'll be overwritten by an editor or a maintainer).

IMO:

What to do about 100.64.0.0/10?

Keep it as it is, and document it? I see you did that in #113186.

Here's the thing: after some thinking I realized I actually would like to fix that one too – #113186 documents the status quo but I believe we can (and IMO should) still improve it.

So I went ahead and fixed it as well. I don't think it deserves the kind of special, not quite consistent treatment it's been getting.

The fix is self-contained in a single commit which can be reverted away if you (or any else) tell me it doesn't belong in this PR or it otherwise becomes a blocker – I'd rather have this PR merged without the shared address space fix than not have it merged at all.

Happy to update the PR description to reflect the above when we know the final shape of this change.

@encukou
Copy link
Member

encukou commented Mar 20, 2024

Thank you! This looks great. (I haven't checked details like the individual numbers in this pass.)

Feedback [for changelogs] very much appreciated, especially regarding the wording and verbosity

It looks fine, but it would be even better to you can link from the less-verbose docs to the details. Then the details only need to be in one place.

The fix is self-contained in a single commit which can be reverted away if you (or any else) tell me it doesn't belong in this PR or it otherwise becomes a blocker

Yup, I'll be the one to tell you. Please don't do that in this PR.
We squash every PR into a single commit; this change would be better as its own revertable commit.
Also, I'm not really an expert on ipaddress, and I don't feel as comfortable reviewing this change.

Leaving this for a separate PR (possibly).

This reverts commit d3ee80d.
@jstasiak
Copy link
Contributor Author

Done and done.

@encukou encukou merged commit 40d75c2 into python:main Mar 22, 2024
33 checks passed
@encukou
Copy link
Member

encukou commented Mar 22, 2024

Looks good, thank you!

adorilson pushed a commit to adorilson/cpython that referenced this pull request Mar 25, 2024
…GH-113179)

* pythonGH-113171: Fix "private" (really non-global) IP address ranges

The _private_networks variables, used by various is_private
implementations, were missing some ranges and at the same time had
overly strict ranges (where there are more specific ranges considered
globally reachable by the IANA registries).

This patch updates the ranges with what was missing or otherwise
incorrect.

I left 100.64.0.0/10 alone, for now, as it's been made special in [1]
and I'm not sure if we want to undo that as I don't quite understand the
motivation behind it.

The _address_exclude_many() call returns 8 networks for IPv4, 121
networks for IPv6.

[1] python#61602
NGRsoftlab pushed a commit to NGRsoftlab/cpython that referenced this pull request Apr 2, 2024
commit 9dae05ee59eeba0e67af2a46f2a2907c9f8d7e4a
Author: Moshe Kaplan <mosheekaplan@gmail.com>
Date:   Mon Apr 1 15:53:00 2024 -0400

    Docs: specify XML document name in xml.etree.elementtree example (#24223)

commit fc2071687b708598264a3403b7f9104667c1092f
Author: Matthew Davis <7035647+mdavis-xyz@users.noreply.github.com>
Date:   Mon Apr 1 21:49:14 2024 +0200

    Docs: add more links to PIPE in subprocess docs (#25416)

commit fc8007ee3635db6ab73e132ebff987c910b6d538
Author: Barney Gale <barney.gale@gmail.com>
Date:   Mon Apr 1 20:37:41 2024 +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.

commit c741ad3537193c63fe697a8f0316aecd45eeb9ba
Author: Justin Turner Arthur <justinarthur@gmail.com>
Date:   Mon Apr 1 12:07:29 2024 -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>

commit ddf814db744006e0f42328aa15ace97c9d8ad681
Author: Guido van Rossum <guido@python.org>
Date:   Mon Apr 1 09:13:38 2024 -0700

    Silence compiler warnings in gc.c (#117422)

commit 179869af922252a0c1cef65fd2923856895e7d1b
Author: Petr Viktorin <encukou@gmail.com>
Date:   Mon Apr 1 17:01:22 2024 +0200

    gh-94808: Fix refcounting in PyObject_Print tests (GH-117421)

commit dd44ab994b7262f0704d64996e0a1bc37b233407
Author: neonene <53406459+neonene@users.noreply.github.com>
Date:   Mon Apr 1 22:28:14 2024 +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()`.

commit 3de09cadde788065a4f2d45117e789c9353bbd12
Author: Steve (Gadget) Barnes <gadgetsteve@hotmail.com>
Date:   Mon Apr 1 14:02:07 2024 +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>

commit 90c3c68a658db6951b77a5be50088ec2f6adc8eb
Author: MonadChains <monadchains@gmail.com>
Date:   Mon Apr 1 13:52:25 2024 +0100

    gh-94808:Improve coverage of PyObject_Print (GH-98749)

commit 348cf6e0078eae156c503e8f61ef5e27ae28e57b
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Date:   Mon Apr 1 11:14:37 2024 +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>

commit 9b403fb559bfce93a478937e0ef7e539a9a95283
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Date:   Mon Apr 1 11:05:14 2024 +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>

commit 93c7d9d17b571b6a181af7c02830d29819535c35
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Date:   Mon Apr 1 11:38:38 2024 +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>

commit 3bb12e407c183946471272f8aee098e54e62a333
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Date:   Mon Apr 1 09:54:33 2024 +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>

commit 56e99307c49adcc6df355f8070229371c97d654f
Author: Adorilson Bezerra <adorilson@gmail.com>
Date:   Sun Mar 31 23:34:54 2024 +0100

    Doc: printf-style library/stdtype improvements (#16741)

commit 18e12641a61a88f7d08b2114ebe965892c6661c5
Author: Raymond Hettinger <rhettinger@users.noreply.github.com>
Date:   Sun Mar 31 16:09:22 2024 -0500

    gh-117387 Remove hash mark from introductory text (#117409)

commit a32d6939486d7f90ee57e215077f6116e19de24d
Author: Deborah <32307299+dlwrnc@users.noreply.github.com>
Date:   Sun Mar 31 22:11:48 2024 +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>

commit 262445358e21c56d7c68e3ee76c13e469d2ea348
Author: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
Date:   Sun Mar 31 12:02:48 2024 -0700

    Link to the Python type system specification (#117400)

commit 752e18389ed03087b51b38eac9769ef8dfd167b7
Author: Barney Gale <barney.gale@gmail.com>
Date:   Sun Mar 31 19:14:48 2024 +0100

    GH-114575: Rename `PurePath.pathmod` to `PurePath.parser` (#116513)

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

commit bfc57d43d8766120ba0c8f3f6d7b2ac681a81d8a
Author: Sam Gross <colesbury@gmail.com>
Date:   Fri Mar 29 18:58:08 2024 -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.

commit 05e0b67a43c5c1778dc2643c8b7c12864e135999
Author: Erlend E. Aasland <erlend@python.org>
Date:   Fri Mar 29 21:23:28 2024 +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()

commit 019143fecbfc26e69800d28d2a9e3392a051780b
Author: Jason R. Coombs <jaraco@jaraco.com>
Date:   Fri Mar 29 16:06:09 2024 -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.

commit 01bd74eadbc4ff839d39762fae6366f50c1e116e
Author: Sam Gross <colesbury@gmail.com>
Date:   Fri Mar 29 15:33:06 2024 -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.

commit 94c97423a9c4969f8ddd4a3aa4aacb99c4d5263d
Author: Guido van Rossum <guido@python.org>
Date:   Fri Mar 29 11:31:09 2024 -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.

commit 5d21d884b6ffa45dac50a5f9a07c41356a8478b4
Author: mpage <mpage@meta.com>
Date:   Fri Mar 29 10:42:02 2024 -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.

commit 19c1dd60c5b53fb0533610ad139ef591294f26e8
Author: Sam Gross <colesbury@gmail.com>
Date:   Fri Mar 29 13:35:43 2024 -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.

commit 397d88db5e9ab2a43de3fdf5f8b973a949edc405
Author: Sam Gross <colesbury@gmail.com>
Date:   Fri Mar 29 13:34:04 2024 -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.

commit f05fb2e65c2dffdfae940f2707765c4994925205
Author: Sam Gross <colesbury@gmail.com>
Date:   Fri Mar 29 13:33:04 2024 -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.

commit ddf95b5f16031cdbd0d728e55eb06dff002a8678
Author: Erlend E. Aasland <erlend@python.org>
Date:   Fri Mar 29 18:26:06 2024 +0100

    gh-116664: Fix unused var warnings in _warnings.c in non-free-threaded builds (#117373)

    The warnings were introduced by commit c1712ef06.

commit 0fa571dbcdf19b541276cb00bb929381930467b2
Author: Tian Gao <gaogaotiantian@hotmail.com>
Date:   Fri Mar 29 09:02:01 2024 -0700

    Refactor pdb executable targets (#112570)

    Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>

commit 54f7e14500471d1c46fb553adb3ca24cd1fef084
Author: Pedro Lacerda <pslacerda@users.noreply.github.com>
Date:   Fri Mar 29 12:05:00 2024 -0300

    gh-66449: configparser: Add support for unnamed sections (#117273)

    Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>

commit d9cfe7e565a6e2dc15747a904736264e31a10be4
Author: Nikita Sobolev <mail@sobolevn.me>
Date:   Fri Mar 29 14:14:25 2024 +0300

    gh-117166: Ignore empty and temporary dirs in `test_makefile` (#117190)

commit 35b6c4a4da201a947b2ceb96ae4c0d83d4d2df4f
Author: Victor Stinner <vstinner@python.org>
Date:   Fri Mar 29 11:25:17 2024 +0100

    gh-117347: Fix test_clinic side effects (#117363)

    Save/restore converters in ClinicWholeFileTest and
    ClinicExternalTest.

commit 7e2fef865899837c47e91ef0180fa59eb03e840b
Author: neonene <53406459+neonene@users.noreply.github.com>
Date:   Fri Mar 29 18:40:48 2024 +0900

    gh-117142: ctypes: Migrate global vars to module state (GH-117189)

commit 2e9be80c99f635c2f7761e8356b0260922d6e7a6
Author: Gregory P. Smith <greg@krypto.org>
Date:   Thu Mar 28 17:58:37 2024 -0700

    Fix reversed assertRegex checks in test_ssl. (#117351)

commit 8eec7ed714e65d616573b7331780b0aa43c6ed6a
Author: 傅立业(Chris Fu) <17433201@qq.com>
Date:   Fri Mar 29 08:19:20 2024 +0800

    gh-117110: Fix subclasses of typing.Any with custom constructors (#117111)

commit a17f313e3958e825db9a83594c8471a984316536
Author: Christopher Chianelli <christopher@timefold.ai>
Date:   Thu Mar 28 18:26:56 2024 -0400

    gh-117339: Use NULL instead of None for LOAD_SUPER_ATTR in dis docs (GH-117343)

commit 26d328b2ba26374fb8d9ffe8215ecef7c5e3f7a2
Author: Michael Droettboom <mdboom@gmail.com>
Date:   Thu Mar 28 18:23:08 2024 -0400

    GH-117121: Add pystats to JIT builds (GH-117346)

commit 14f1ca7d5363386163839b31ce987423daecc3de
Author: Nice Zombies <nineteendo19d0@gmail.com>
Date:   Thu Mar 28 22:20:08 2024 +0100

    gh-117335: Handle non-iterables for `ntpath.commonpath` (GH-117336)

commit 18cf239e39e25e6cef50ecbb7f197a82f8920ff5
Author: Brandt Bucher <brandtbucher@microsoft.com>
Date:   Thu Mar 28 14:02:34 2024 -0700

    Increase the JIT CI timeouts to 75 minutes (GH-117342)

commit 29829b58a8328a7c2ccacaa74c1d7d120a5e5ca5
Author: Malcolm Smith <smith@chaquo.com>
Date:   Thu Mar 28 19:59:12 2024 +0000

    gh-117294: Report DocTestCase as skipped if all examples in the doctest are skipped (GH-117297)

commit efcc96844e7c66fcd6c23ac2d557ca141614ce9a
Author: Tian Gao <gaogaotiantian@hotmail.com>
Date:   Thu Mar 28 11:23:29 2024 -0700

    gh-69201: Separate stdout and stderr stream in test_pdb (#117308)

commit 6702d2bf6edcd5b5415e17837383623b9d76a5b8
Author: Victor Stinner <vstinner@python.org>
Date:   Thu Mar 28 17:40:58 2024 +0100

    gh-114331: Skip decimal test_maxcontext_exact_arith on s390x (#117326)

commit c1712ef066321c01bf09cba3f22fc474b5b8dfa7
Author: Erlend E. Aasland <erlend@python.org>
Date:   Thu Mar 28 16:05:08 2024 +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.

commit 9a388b9a64927c372d85f0eaec3de9b7320a6fb5
Author: Joachim Wuttke <j.wuttke@fz-juelich.de>
Date:   Thu Mar 28 14:43:07 2024 +0100

    bpo-43848: explain optional argument mtime in gzip.py. (GH-25410)

    Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>

commit 8dbfdb2957a7baade3a88661517f163ad694c39f
Author: Sam Gross <colesbury@gmail.com>
Date:   Thu Mar 28 09:28:39 2024 -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.

commit 9a1e55b8c5723206116f7016921be3937ef2f4e5
Author: Chris Markiewicz <effigies@gmail.com>
Date:   Thu Mar 28 06:59:31 2024 -0400

    gh-117178: Recover lazy loading of self-referential modules (#117179)

commit 4c71d51a4b7989fc8754ba512c40e21666f9db0d
Author: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Date:   Thu Mar 28 04:30:31 2024 -0600

    gh-117266: Fix crashes on user-created AST subclasses (GH-117276)

    Fix crashes on user-created AST subclasses

commit 8cb7d7ff86a1a2d41195f01ba4f218941dd7308c
Author: Gregory P. Smith <greg@krypto.org>
Date:   Thu Mar 28 03:11:58 2024 -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.

commit 6c8ac8a32fd6de1960526561c44bc5603fab0f3e
Author: Erlend E. Aasland <erlend@python.org>
Date:   Thu Mar 28 09:40:37 2024 +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.

commit 0f27672c5002de96c9f1228b12460d5ce3f1d190
Author: Russell Keith-Magee <russell@keith-magee.com>
Date:   Thu Mar 28 16:13:13 2024 +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>

commit f006338017cfbf846e8f7391b9ee5f69df8dc620
Author: Russell Keith-Magee <russell@keith-magee.com>
Date:   Thu Mar 28 15:59:33 2024 +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>

commit b44898299a2ed97045c270f6474785da2ff07ced
Author: Tim Hatch <tim@timhatch.com>
Date:   Wed Mar 27 23:54:51 2024 -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>

commit 2cedd25c14d3acfdcb5e8ee55132ce3e334ab8fe
Author: Illia Volochii <illia.volochii@gmail.com>
Date:   Thu Mar 28 08:46:01 2024 +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.

commit eefff682f09394fe4f18b7d7c6ac4c635caadd02
Author: Malcolm Smith <smith@chaquo.com>
Date:   Wed Mar 27 22:11:44 2024 +0000

    gh-108277: Make test_os tolerate 10 ms diff for timerfd on Android emulators (#117223)

commit 7aa89bc43e0bcf49eee5a39b5a7ba8f996f20d00
Author: Victor Stinner <vstinner@python.org>
Date:   Wed Mar 27 23:10:14 2024 +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>

commit 669ef49c7d42f35da6f7ee280102353b9b37f83e
Author: Seth Michael Larson <seth@python.org>
Date:   Wed Mar 27 16:56:14 2024 -0500

    gh-99108: Update and check HACL* version information (GH-117295)

    * Update and check HACL* version information

commit 262fb911ab7df8e890ebd0efb0773c3e0b5a757f
Author: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
Date:   Wed Mar 27 17:38:19 2024 +0000

    gh-117288: Allocate fewer label IDs in _PyCfg_ToInstructionSequence (#117290)

commit 74c8568d07719529b874897598d8b3bc25ff0434
Author: Malcolm Smith <smith@chaquo.com>
Date:   Wed Mar 27 16:53:27 2024 +0000

    gh-71042: Add `platform.android_ver` (#116674)

commit ce00de4c8cd39816f992e749c1074487d93abe9d
Author: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Date:   Wed Mar 27 16:46:35 2024 +0200

    gh-117225: doctest: only print "and X failed" when non-zero, don't pluralise "1 items" (#117228)

commit 92397d5ead38dde4154e70d00f24973bcf2a925a
Author: Raymond Hettinger <rhettinger@users.noreply.github.com>
Date:   Wed Mar 27 09:04:32 2024 -0500

    Add statistics recipe for sampling from an estimated probability density distribution (#117221)

commit b3e8c78ed7aa9bbd1084375587b99200c687cec9
Author: Tian Gao <gaogaotiantian@hotmail.com>
Date:   Tue Mar 26 18:20:12 2024 -0700

    gh-113548: Allow CLI arguments to `pdb -m` (#113557)

commit 48c0b05cf0dd2db275bd4653f84aa36c22bddcd2
Author: Adorilson Bezerra <adorilson@gmail.com>
Date:   Tue Mar 26 19:08:08 2024 +0000

    Change links on the index page (#117230)

commit af1b0e94400d1bf732466d675054df8cf7dfb62d
Author: AN Long <aisk@users.noreply.github.com>
Date:   Wed Mar 27 02:26:48 2024 +0800

    gh-104242: Enable test_is_char_device_true in pathlib test on all platform (GH-116983)

commit 79be75735c9d77972112cecc8d7e1af28c176ed0
Author: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
Date:   Tue Mar 26 15:18:17 2024 +0000

    gh-115775: Compiler adds __static_attributes__ field to classes (#115913)

commit 70969d53a77a8a190c40a30419e772bc874a4f62
Author: Antonio <57417288+amaddio@users.noreply.github.com>
Date:   Tue Mar 26 15:10:29 2024 +0100

    gh-97901 add missing text/rtf to mimetypes (GH-97902)

    Co-authored-by: Noam Cohen <noam@noam.me>

commit 4ec347760f98b156c6a2d42ca397af6b0b6ecc50
Author: AN Long <aisk@users.noreply.github.com>
Date:   Tue Mar 26 22:09:57 2024 +0800

    gh-115538: Use isolate mode when running venv test_multiprocessing_recursion() (#117116)

    Co-authored-by: Victor Stinner <vstinner@python.org>

commit 743f2c68f478279e1e56577fe95a0ed112b9abc5
Author: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Date:   Tue Mar 26 16:09:09 2024 +0200

    pre-commit: add `check-case-conflict` and `check-merge-conflict` (#117259)

commit 4abca7e1e7e2764faf20c7e677ea5c9ea9dbffe2
Author: Paulo Neves <ptsneves@users.noreply.github.com>
Date:   Tue Mar 26 13:37:50 2024 +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>

commit 9654daf793b534b44a831c80f43505ab9e380f1f
Author: Serhiy Storchaka <storchaka@gmail.com>
Date:   Tue Mar 26 13:26:45 2024 +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>

commit 8bef34f625e21886b1c64544c060e19ee2e229bf
Author: Mark Shannon <mark@hotpy.org>
Date:   Tue Mar 26 11:11:42 2024 +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.

commit bf82f77957a31c3731b4ec470c406f5708ca9ba3
Author: Mark Shannon <mark@hotpy.org>
Date:   Tue Mar 26 09:35:11 2024 +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.

commit 61599a48f52e951d8813877ee311d2a830ba2cd8
Author: Pablo Galindo Salgado <Pablogsal@gmail.com>
Date:   Tue Mar 26 09:30:46 2024 +0000

    bpo-24612: Improve syntax error for 'not' after an operator (GH-28170)

    Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>

commit 771902c257372e6c4df1ead4e8c46308561db7a7
Author: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Date:   Tue Mar 26 11:13:32 2024 +0200

    gh-83845: Add tests for operator module (#115883)

    Co-authored-by: Karthikeyan Singaravelan <tir.karthi@gmail.com>

commit ea9a296fce2f786b4cf43c7924e5de01061f27ca
Author: yevgeny hong <hongyevgeny@gmail.com>
Date:   Tue Mar 26 16:45:43 2024 +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>

commit d52bdfb19fadd7614a0e5abaf68525fc7300e841
Author: Victor Stinner <vstinner@python.org>
Date:   Tue Mar 26 08:35:59 2024 +0100

    gh-83434: Disable XML in regrtest when -R option is used (#117232)

commit 9f74e86c78853c101a23e938f8e32ea838d8f62e
Author: Sebastian Pipping <sebastian@pipping.org>
Date:   Tue Mar 26 02:48:27 2024 +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)

commit 872e212378ef86392069034afd80bb53896fd93d
Author: Jonathan Protzenko <protz@microsoft.com>
Date:   Mon Mar 25 17:35:26 2024 -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`.

commit 8945b7ff55b87d11c747af2dad0e3e4d631e62d6
Author: Eric V. Smith <ericvsmith@users.noreply.github.com>
Date:   Mon Mar 25 19:59:14 2024 -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%.

commit 7ebad77ad65ab4d5d8d0c333256a882262cec189
Author: Raymond Hettinger <rhettinger@users.noreply.github.com>
Date:   Mon Mar 25 18:49:44 2024 -0500

    Sync main docs and docstring for median_grouped(). (gh-117214)

commit 0821923aa979a72464c5da8dfa53a719bba5801c
Author: Nice Zombies <nineteendo19d0@gmail.com>
Date:   Mon Mar 25 23:55:11 2024 +0100

    gh-117114: Make os.path.isdevdrive available on all platforms (GH-117115)

commit c2276176d543a2fc2d57709c2787f99850fbb073
Author: Adorilson Bezerra <adorilson@gmail.com>
Date:   Mon Mar 25 22:34:20 2024 +0000

    Add information about negative  indexes to sequence datamodel doc (#110903)

    Co-authored by Terry Jan Reedy

commit 23e4f80ce2a2bac50acd1785e791316d5b578b8d
Author: Mark Shannon <mark@hotpy.org>
Date:   Mon Mar 25 20:43:51 2024 +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.

commit 507896d97dcff2d7999efa264b29d9003c525c49
Author: Victor Stinner <vstinner@python.org>
Date:   Mon Mar 25 17:32:20 2024 +0100

    gh-116936: Add PyType_GetModuleByDef() to the limited C API (#116937)

commit 0c1a42cf9c8cd0d4534d5c1d58f118ce7c5c446e
Author: Serhiy Storchaka <storchaka@gmail.com>
Date:   Mon Mar 25 17:32:11 2024 +0200

    gh-87193: Support bytes objects with refcount > 1 in _PyBytes_Resize() (GH-117160)

    Create a new bytes object and destroy the old one if it has refcount > 1.

commit 01e7405da400e8997f8964d06cc414045e144681
Author: Tian Gao <gaogaotiantian@hotmail.com>
Date:   Mon Mar 25 08:18:09 2024 -0700

    gh-112948: Make pdb completion similar to repl completion (#112950)

commit 9db2a8f914ad59019d448cecc43b6d45f46424a0
Author: Raymond Hettinger <rhettinger@users.noreply.github.com>
Date:   Mon Mar 25 09:26:42 2024 -0500

    Minor markup and grammar fixes in the statistics docs (gh-117216)

commit eebea7e515462b503632ada74923ec3246599c9c
Author: Kirill Podoprigora <kirill.bast9@mail.ru>
Date:   Sun Mar 24 20:34:55 2024 +0200

    gh-117176: Fix compiler warning in Python/optimizer_bytecodes.c (GH-117199)

commit 83485a095363dad6c97b19af2826ca0c34343bfc
Author: Totally a booplicate <53382877+Booplicate@users.noreply.github.com>
Date:   Sun Mar 24 18:48:40 2024 +0300

    gh-112571: Move fish venv activation script into the common folder (GH-117169)

    pythongh-112571: allow using fish venv activation script on windows

    The fish shell can be used on windows under cygwin or msys2.
    This change moves the script to the common folder
    so the venv module will install it on both posix and nt systems (like the bash script).

commit 78a651fd7fbe7a3d1702e40f4cbfa72d87241ef0
Author: Terry Jan Reedy <tjreedy@udel.edu>
Date:   Sun Mar 24 11:38:34 2024 -0400

    gh-117194: Properly format 'base64' header in What's New (#117198)

    It needs 6, not 3, '-'s.

commit f267d5bf2a99fbeb26a720d1c87c1f0557424b14
Author: Kerim Kabirov <the.privat33r+gh@pm.me>
Date:   Sun Mar 24 14:59:14 2024 +0100

    GH-115986 Docs: promote pprint.pp usage as a default (#116614)

    Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>

commit 39df7732178c8e8f75b12f069a3dbc1715c99995
Author: LilKS <1244886+LilKS@users.noreply.github.com>
Date:   Sun Mar 24 11:01:07 2024 +0100

    gh-101760: Improve the imaplib.IMAP4 example (#101764)

    Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>

commit a1e948edba9ec6ba61365429857f7a087c5edf51
Author: Raymond Hettinger <rhettinger@users.noreply.github.com>
Date:   Sun Mar 24 11:35:58 2024 +0200

    Add cumulative option for the new statistics.kde() function. (#117033)

commit d610d821fd210dce63a1132c274ffdf8acc510bc
Author: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
Date:   Sat Mar 23 22:32:33 2024 +0000

    gh-112383: teach dis how to interpret ENTER_EXECUTOR (#117171)

commit 6c83352bfe78a7d567c8d76257df6eb91d5a7245
Author: Ken Jin <kenjin@python.org>
Date:   Sun Mar 24 06:19:17 2024 +0800

    gh-117180: Complete call sequence when trace stack overflow (GH-117184)

    ---------

    Co-authored-by: Peter Lazorchak <lazorchakp@gmail.com>
    Co-authored-by: Guido van Rossum <gvanrossum@users.noreply.github.com>
    Co-authored-by: Guido van Rossum <gvanrossum@gmail.com>

commit f11d0d8be8af28e1368c3c7c116218cf65ddf93e
Author: Erik Soma <stillusingirc@gmail.com>
Date:   Sat Mar 23 11:39:35 2024 -0400

    gh-91227: Ignore ERROR_PORT_UNREACHABLE in proactor recvfrom() (#32011)

commit 9967b568edd2e35b0415c14c7242f3ca2c0dc03d
Author: Victor Stinner <vstinner@python.org>
Date:   Sat Mar 23 13:01:20 2024 +0100

    gh-117008: Fix functools test_recursive_pickle() (#117009)

    Use support.infinite_recursion() in test_recursive_pickle() of
    test_functools to prevent a stack overflow on "ARM64 Windows
    Non-Debug" buildbot.

    Lower Py_C_RECURSION_LIMIT to 1,000 frames on Windows ARM64.

commit 72eea512b88f8fd68b7258242c37da963ad87360
Author: Barney Gale <barney.gale@gmail.com>
Date:   Fri Mar 22 19:14:09 2024 +0000

    GH-106747: Document another difference between `glob` and `pathlib`. (#116518)

    Document that `path.glob()` might return *path*, whereas
    `glob.glob(root_dir=path)` will never return an empty string corresponding
    to *path*.

commit e28477f214276db941e715eebc8cdfb96c1207d9
Author: Mark Shannon <mark@hotpy.org>
Date:   Fri Mar 22 18:43:25 2024 +0000

    GH-117108: Change the size of the GC increment to about 1% of the total heap size. (GH-117120)

commit e2e0b4b4b92694ba894e02b4a66fd87c166ed10f
Author: Serhiy Storchaka <storchaka@gmail.com>
Date:   Fri Mar 22 20:19:10 2024 +0200

    gh-113024: C API: Add PyObject_GenericHash() function (GH-113025)

commit 567ab3bd15398c8c7b791f3e376ae3e3c0bbe079
Author: Serhiy Storchaka <storchaka@gmail.com>
Date:   Fri Mar 22 20:08:00 2024 +0200

    gh-117084: Fix ZIP file extraction for directory entry names with backslashes on Windows (GH-117129)

commit 5a78f6e798d5c2af1dba2df6c9f1f1e5aac02a86
Author: Serhiy Storchaka <storchaka@gmail.com>
Date:   Fri Mar 22 20:03:48 2024 +0200

    gh-117134: Microoptimize glob() for include_hidden=True (GH-117135)

commit 00baaa21de229a6db80ff2b84c2fd6ad1999a24c
Author: Vinay Sajip <vinay_sajip@yahoo.co.uk>
Date:   Fri Mar 22 17:25:51 2024 +0000

    [docs] Fix typo in docstring and add example to logging cookbook. (GH-117157)

commit 40d75c2b7f5c67e254d0a025e0f2e2c7ada7f69f
Author: Jakub Stasiak <jakub@stasiak.at>
Date:   Fri Mar 22 17:49:56 2024 +0100

    GH-113171: Fix "private" (non-global) IP address ranges (GH-113179)

    * GH-113171: Fix "private" (really non-global) IP address ranges

    The _private_networks variables, used by various is_private
    implementations, were missing some ranges and at the same time had
    overly strict ranges (where there are more specific ranges considered
    globally reachable by the IANA registries).

    This patch updates the ranges with what was missing or otherwise
    incorrect.

    I left 100.64.0.0/10 alone, for now, as it's been made special in [1]
    and I'm not sure if we want to undo that as I don't quite understand the
    motivation behind it.

    The _address_exclude_many() call returns 8 networks for IPv4, 121
    networks for IPv6.

    [1] https://github.com/python/cpython/issues/61602

commit 3be9b9d8722696b95555937bb211dc4cda714d56
Author: Steve Dower <steve.dower@python.org>
Date:   Fri Mar 22 15:00:50 2024 +0000

    Fix get_packagefamilyname helper function on Windows 32-bit (GH-117153)

commit 63d6f2623ef2aa90f51c6a928b96845b9b380d89
Author: NGRsoftlab <78017794+NGRsoftlab@users.noreply.github.com>
Date:   Fri Mar 22 14:25:38 2024 +0300

    gh-117068: Remove useless code in bytesio.c:resize_buffer() (GH-117069)

    Co-authored-by: i.khabibulin <i.khabibulin@ngrsoftlab.ru>

commit 42ae924d278c48a719fb0ab86357f3235a9f7ab9
Author: Petr Viktorin <encukou@gmail.com>
Date:   Fri Mar 22 10:42:18 2024 +0100

    gh-117127: glob tests: Reopen dir_fd to pick up directory changes (GH-117128)

commit 8383915031942f441f435a5ae800790116047b80
Author: Tim Peters <tim.peters@gmail.com>
Date:   Thu Mar 21 22:27:25 2024 -0500

    GH-116939: Rewrite binarysort() (#116940)

    Rewrote binarysort() for clarity.

    Also changed the signature to be more coherent (it was mixing sortslice with raw pointers).

    No change in method or functionality. However, I left some experiments in, disabled for now
    via `#if` tricks. Since this code was first written, some kinds of comparisons have gotten
    enormously faster (like for lists of floats), which changes the tradeoffs.

    For example, plain insertion sort's simpler innermost loop and highly predictable branches
    leave it very competitive (even beating, by a bit) binary insertion when comparisons are
    very cheap, despite that it can do many more compares. And it wins big on runs that
    are already sorted (moving the next one in takes only 1 compare then).

    So I left code for a plain insertion sort, to make future experimenting easier.

    Also made the maximum value of minrun a `#define` (``MAX_MINRUN`) to make
    experimenting with that easier too.

    And another bit of `#if``-disabled code rewrites binary insertion's innermost loop to
    remove its unpredictable branch. Surprisingly, this doesn't really seem to help
    overall. I'm unclear on why not. It certainly adds more instructions, but they're very
    simple, and it's hard to be believe they cost as much as a branch miss.

commit 97ba910e47ad298114800587979ce7beb0a705a3
Author: Guido van Rossum <guido@python.org>
Date:   Thu Mar 21 18:27:48 2024 -0700

    gh-108716:: Remove _PyStaticCode_Init/Fini (#117141)

    More deepfreeze cleanup.

commit b3d25df8d38b79310587da54dbd88b06a16d4904
Author: Eric Snow <ericsnowcurrently@gmail.com>
Date:   Thu Mar 21 18:20:20 2024 -0600

    gh-105716: Fix _PyInterpreterState_IsRunningMain() For Embedders (gh-117140)

    When I added _PyInterpreterState_IsRunningMain() and friends last year, I tried to accommodate applications that embed Python but don't call _PyInterpreterState_SetRunningMain() (not that they're expected to).  That mostly worked fine until my recent changes in gh-117049, where the subtleties with the fallback code led to failures; the change ended up breaking test_tools.test_freeze, which exercises a basic embedding situation.

    The simplest fix is to drop the fallback code I originally added to _PyInterpreterState_IsRunningMain() (and later to _PyThreadState_IsRunningMain()).  I've kept the fallback in the _xxsubinterpreters module though.  I've also updated Py_FrozenMain() to call _PyInterpreterState_SetRunningMain().

commit c4bf58a14f162557038a1535ca22c52b49d81d7b
Author: Thomas A Caswell <tcaswell@gmail.com>
Date:   Thu Mar 21 19:54:50 2024 -0400

    gh-116745: Remove all internal usage of @LIBPYTHON@ (#116746)

    Replace with MODULE_LDFLAGS.

commit 3ec57307e70ee6f42410e844d3399bbd598917ba
Author: Malcolm Smith <smith@chaquo.com>
Date:   Thu Mar 21 23:52:29 2024 +0000

    gh-71052: Add Android build script and instructions (#116426)

commit 50f9b0b1e0fb181875751cef951351ed007b6397
Author: Victor Stinner <vstinner@python.org>
Date:   Thu Mar 21 23:17:09 2024 +0100

    gh-117061: Fix test_posix.test_sched_setaffinity() on RHEL9 (#117126)

    On RHEL9, sched_setaffinity(0, []) does not fail.

commit 0907871d43bffb613cbd560224e1a9db13d06c06
Author: Ned Batchelder <ned@nedbatchelder.com>
Date:   Thu Mar 21 15:47:09 2024 -0400

    docs: fix over-linking in dataclasses.rst (#117005)

commit 570a82d46abfebb9976961113fb0f8bb400ad182
Author: Guido van Rossum <guido@python.org>
Date:   Thu Mar 21 12:37:41 2024 -0700

    gh-117045: Add code object to function version cache (#117028)

    Changes to the function version cache:

    - In addition to the function object, also store the code object,
      and allow the latter to be retrieved even if the function has been evicted.
    - Stop assigning new function versions after a critical attribute (e.g. `__code__`)
      has been modified; the version is permanently reset to zero in this case.
    - Changes to `__annotations__` are no longer considered critical. (This fixes gh-109998.)

    Changes to the Tier 2 optimization machinery:

    - If we cannot map a function version to a function, but it is still mapped to a code object,
      we continue projecting the trace.
      The operand of the `_PUSH_FRAME` and `_POP_FRAME` opcodes can be either NULL,
      a function object, or a code object with the lowest bit set.

    This allows us to trace through code that calls an ephemeral function,
    i.e., a function that may not be alive when we are constructing the executor,
    e.g. a generator expression or certain nested functions.
    We will lose globals removal inside such functions,
    but we can still do other peephole operations
    (and even possibly [call inlining](https://github.com/python/cpython/pull/116290),
    if we decide to do it), which only need the code object.
    As before, if we cannot retrieve the code object from the cache, we stop projecting.

commit c85d84166a84a5cb2d724012726bad34229ad24e
Author: Will Childs-Klein <willck93@gmail.com>
Date:   Thu Mar 21 14:16:36 2024 -0500

    gh-116333: Relax error string text expectations in SSL-related tests (GH-116334)

    * Relax error string text expectations in SSL-related tests

    As suggested [here][1], this change relaxes the OpenSSL error string
    text expectations in a number of tests. This was specifically done in
    support of more easily building CPython [AWS-LC][2], but because AWS-LC
    is a fork of [BoringSSL][3], it should increase compatibility with that
    library as well.

    In addition to the error string relaxations, we also add some guards
    around the `tls-unique` channel binding being used with TLSv1.3, as that
    feature (described in [RFC 6929][4]) is [not defined][5] for TLSv1.3.

    [1]: https://discuss.python.org/t/support-building-ssl-and-hashlib-modules-against-aws-lc/44505/4
    [2]: https://github.com/aws/aws-lc
    [3]: https://github.com/google/boringssl
    [4]: https://datatracker.ietf.org/doc/html/rfc5929#section-3
    [5]: https://datatracker.ietf.org/doc/html/rfc8446#appendix-C.5

commit 1f72fb5447ef3f8892b4a7a6213522579c618e8e
Author: Sam Gross <colesbury@gmail.com>
Date:   Thu Mar 21 14:21:02 2024 -0400

    gh-116522: Refactor `_PyThreadState_DeleteExcept` (#117131)

    Split `_PyThreadState_DeleteExcept` into two functions:

    - `_PyThreadState_RemoveExcept` removes all thread states other than one
      passed as an argument. It returns the removed thread states as a
      linked list.

    - `_PyThreadState_DeleteList` deletes those dead thread states. It may
      call destructors, so we want to "start the world" before calling
      `_PyThreadState_DeleteList` to avoid potential deadlocks.

commit 50369e6c34d05222e5a0ec9443a9f7b230e83112
Author: Michael Droettboom <mdboom@gmail.com>
Date:   Thu Mar 21 13:27:46 2024 -0400

    gh-116996: Add pystats about _Py_uop_analyse_and_optimize (GH-116997)

commit 617158e07811edfd6fd552a3d84b0beedd8f1d18
Author: Eric Snow <ericsnowcurrently@gmail.com>
Date:   Thu Mar 21 11:15:02 2024 -0600

    gh-76785: Drop PyInterpreterID_Type (gh-117101)

    I added it quite a while ago as a strategy for managing interpreter lifetimes relative to the PEP 554 (now 734) implementation.  Relatively recently I refactored that implementation to no longer rely on InterpreterID objects.  Thus now I'm removing it.

commit abdd1f938f08e536864532b2071f144515ecc88b
Author: Victor Stinner <vstinner@python.org>
Date:   Thu Mar 21 17:45:43 2024 +0100

    gh-85283: Build _testconsole extension with limited C API (#117125)

commit 8bea6c411d65cd987616b4ecdb86373e4f21f1c6
Author: Victor Stinner <vstinner@python.org>
Date:   Thu Mar 21 17:07:00 2024 +0100

    gh-115754: Add Py_GetConstant() function (#116883)

    Add Py_GetConstant() and Py_GetConstantBorrowed() functions.

    In the limited C API version 3.13, getting Py_None, Py_False,
    Py_True, Py_Ellipsis and Py_NotImplemented singletons is now
    implemented as function calls at the stable ABI level to hide
    implementation details. Getting these constants still return borrowed
    references.

    Add _testlimitedcapi/object.c and test_capi/test_object.py to test
    Py_GetConstant() and Py_GetConstantBorrowed() functions.

commit 5a76d1be8ef371b75ca65166726923c249b5f615
Author: Eric Snow <ericsnowcurrently@gmail.com>
Date:   Thu Mar 21 10:06:35 2024 -0600

    gh-105716: Update interp->threads.main After Fork (gh-117049)

    I missed this in gh-109921.

    We also update Py_Exit() to call _PyInterpreterState_SetNotRunningMain(), if necessary.

commit bbee57fa8c318cb26d6c8651254927a1972c9738
Author: Eric Snow <ericsnowcurrently@gmail.com>
Date:   Thu Mar 21 09:56:12 2024 -0600

    gh-76785: Clean Up Interpreter ID Conversions (gh-117048)

    Mostly we unify the two different implementations of the conversion code (from PyObject * to int64_t.  We also drop the PyArg_ParseTuple()-style converter function, as well as rename and move PyInterpreterID_LookUp().

commit e728303532168efab7694c55c82ea19b18bf8385
Author: Sam Gross <colesbury@gmail.com>
Date:   Thu Mar 21 10:01:16 2024 -0400

    gh-116522: Stop the world before fork() and during shutdown (#116607)

    This changes the free-threaded build to perform a stop-the-world pause
    before deleting other thread states when forking and during shutdown.
    This fixes some crashes when using multiprocessing and during shutdown
    when running with `PYTHON_GIL=0`.

    This also changes `PyOS_BeforeFork` to acquire the runtime lock
    (i.e., `HEAD_LOCK(&_PyRuntime)`) before forking to ensure that data
    protected by the runtime lock (and not just the GIL or stop-the-world)
    is in a consistent state before forking.

commit 1f8b24ef69896680d6ba6005e75e1cc79a744f9e
Author: Malcolm Smith <smith@chaquo.com>
Date:   Thu Mar 21 13:20:57 2024 +0000

    gh-71052: Implement `ctypes.util.find_library` on Android (GH-116379)

commit d16c9d1278164f04778861814ebc87ed087511fc
Author: Tian Gao <gaogaotiantian@hotmail.com>
Date:   Thu Mar 21 03:30:10 2024 -0700

    gh-116987: Support class code objects in inspect.findsource() (GH-117025)

commit 6547330f4e896c6748da23704b617e060e6cc68e
Author: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Date:   Thu Mar 21 03:49:10 2024 +0000

    GH-109653: Defer import of ``importlib.metadata._adapters`` (#109829)

    * adapters

    * Add comments for deferred imports with links to rationale.

    * Add blurb

    ---------

    Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>

commit 667294d5b2ee812ebe0c9c1efd58e2006b61f827
Author: Jason R. Coombs <jaraco@jaraco.com>
Date:   Wed Mar 20 23:01:24 2024 -0400

    gh-117089: Apply changes from importlib_metadata 7.1.0 (#117094)

    * Apply changes from importlib_metadata 7.1.0

    * Include the data sources in the makefile (even though they're not needed)

commit f4cc77d494ee0e10ed84ce369f0910c70a2f6d44
Author: Victor Stinner <vstinner@python.org>
Date:   Thu Mar 21 00:06:24 2024 +0100

    gh-116869: Enable -Werror in test_cext for Free Threading (#117106)

    Check for warnings, but don't enable the compiler flag
    -Werror=declaration-after-statement.

commit 104602a6078564765b7b8f42888f8eaa37b129b1
Author: Victor Stinner <vstinner@python.org>
Date:   Wed Mar 20 23:52:23 2024 +0100

    gh-105927: Limit PyWeakref_GetRef() to limited C API 3.13 (#117091)

commit 8ad88984200b2ccddc0a08229dd2f4c14d1a71fc
Author: Jason R. Coombs <jaraco@jaraco.com>
Date:   Wed Mar 20 17:11:00 2024 -0400

    gh-117089: Move importlib.metadata tests to their own package (#117092)

    * Ensure importlib.metadata tests do not leak references in sys.modules.

    * Move importlib.metadata tests to their own package for easier syncing with importlib_metadata.

    * Update owners and makefile for new directories.

    * Add blurb

commit 7d446548ef53f6c3de1097c6d44cada6642ddc85
Author: Carol Willing <carolcode@willingconsulting.com>
Date:   Wed Mar 20 14:00:59 2024 -0700

    Fix sort order for "locale encoding" glossary item (#115794)

    Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>

commit 63289b9dfbc7d87e81f1517422ee91b6b6d19531
Author: Mark Shannon <mark@hotpy.org>
Date:   Wed Mar 20 18:24:02 2024 +0000

    GH-117066: Tier 2 optimizer: Don't throw away good traces if we can't optimize them perfectly. (GH-117067)

commit dcaf33a41d5d220523d71c9b35bc08f5b8405dac
Author: Petr Viktorin <encukou@gmail.com>
Date:   Wed Mar 20 17:33:08 2024 +0100

    gh-114314: ctypes: remove stgdict and switch to heap types (GH-116458)

    Before this change, ctypes classes used a custom dict subclass, `StgDict`,
    as their `tp_dict`. This acts like a regular dict but also includes extra information
    about the type.

    This replaces stgdict by `StgInfo`, a C struct on the type, accessed by
    `PyObject_GetTypeData()` (PEP-697).
    All usage of `StgDict` (mainly variables named `stgdict`, `dict`, `edict` etc.) is
    converted to `StgInfo` (named `stginfo`, `info`, `einfo`, etc.).
    Where the dict is actually used for class attributes (as a regular PyDict), it's now
    called `attrdict`.

    This change -- not overriding `tp_dict` -- is made to make me comfortable with
    the next part of this PR: moving the initialization logic from `tp_new` to `tp_init`.

    The `StgInfo` is set up in `__init__` of each class, with a guard that prevents
    calling `__init__` more than once. Note that abstract classes (like `Array` or
    `Structure`) are created using `PyType_FromMetaclass` and do not have
    `__init__` called.
    Previously, this was done in `__new__`, which also wasn't called for abstract
    classes.
    Since `__init__` can be called from Python code or skipped, there is a tested
    guard to ensure `StgInfo` is initialized exactly once before it's used.

    Co-authored-by: neonene <53406459+neonene@users.noreply.github.com>
    Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>

commit 44fbab43d8f3f2df07091d237824cf4fa1f6c57c
Author: Russell Keith-Magee <russell@keith-magee.com>
Date:   Wed Mar 20 23:32:56 2024 +0800

    gh-117058: Update GUI and packaging recommendations for macOS. (#117059)

commit 9221ef2d8cb7f4cf37592eb650d4c8f972033000
Author: Brett Simmers <swtaarrs@users.noreply.github.com>
Date:   Wed Mar 20 08:18:26 2024 -0700

    gh-116908: Only write to `_pending_calls.calls_to_do` with atomic operations (#117044)

    These writes to `pending->calls_to_do` need to be atomic, because other threads
    can read (atomically) from `calls_to_do` without holding `pending->mutex`.

commit fc4599800778f9b130d5e336deadbdeb5bd3e5ee
Author: jkriegshauser <jkriegshauser@gmail.com>
Date:   Wed Mar 20 07:33:28 2024 -0700

    gh-116773: Ensure overlapped objects on Windows are not deallocated too early by asyncio (GH-116774)

commit 519b2ae22b54760475bbf62b9558d453c703f9c6
Author: Serhiy Storchaka <storchaka@gmail.com>
Date:   Wed Mar 20 15:39:53 2024 +0200

    gh-117021: Fix integer overflow in PyLong_AsPid() on non-Windows 64-bit platforms (GH-117064)
NGRsoftlab pushed a commit to NGRsoftlab/cpython that referenced this pull request Apr 2, 2024
commit 9dae05ee59eeba0e67af2a46f2a2907c9f8d7e4a
Author: Moshe Kaplan <mosheekaplan@gmail.com>
Date:   Mon Apr 1 15:53:00 2024 -0400

    Docs: specify XML document name in xml.etree.elementtree example (#24223)

commit fc2071687b708598264a3403b7f9104667c1092f
Author: Matthew Davis <7035647+mdavis-xyz@users.noreply.github.com>
Date:   Mon Apr 1 21:49:14 2024 +0200

    Docs: add more links to PIPE in subprocess docs (#25416)

commit fc8007ee3635db6ab73e132ebff987c910b6d538
Author: Barney Gale <barney.gale@gmail.com>
Date:   Mon Apr 1 20:37:41 2024 +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.

commit c741ad3537193c63fe697a8f0316aecd45eeb9ba
Author: Justin Turner Arthur <justinarthur@gmail.com>
Date:   Mon Apr 1 12:07:29 2024 -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>

commit ddf814db744006e0f42328aa15ace97c9d8ad681
Author: Guido van Rossum <guido@python.org>
Date:   Mon Apr 1 09:13:38 2024 -0700

    Silence compiler warnings in gc.c (#117422)

commit 179869af922252a0c1cef65fd2923856895e7d1b
Author: Petr Viktorin <encukou@gmail.com>
Date:   Mon Apr 1 17:01:22 2024 +0200

    gh-94808: Fix refcounting in PyObject_Print tests (GH-117421)

commit dd44ab994b7262f0704d64996e0a1bc37b233407
Author: neonene <53406459+neonene@users.noreply.github.com>
Date:   Mon Apr 1 22:28:14 2024 +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()`.

commit 3de09cadde788065a4f2d45117e789c9353bbd12
Author: Steve (Gadget) Barnes <gadgetsteve@hotmail.com>
Date:   Mon Apr 1 14:02:07 2024 +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>

commit 90c3c68a658db6951b77a5be50088ec2f6adc8eb
Author: MonadChains <monadchains@gmail.com>
Date:   Mon Apr 1 13:52:25 2024 +0100

    gh-94808:Improve coverage of PyObject_Print (GH-98749)

commit 348cf6e0078eae156c503e8f61ef5e27ae28e57b
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Date:   Mon Apr 1 11:14:37 2024 +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>

commit 9b403fb559bfce93a478937e0ef7e539a9a95283
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Date:   Mon Apr 1 11:05:14 2024 +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>

commit 93c7d9d17b571b6a181af7c02830d29819535c35
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Date:   Mon Apr 1 11:38:38 2024 +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>

commit 3bb12e407c183946471272f8aee098e54e62a333
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Date:   Mon Apr 1 09:54:33 2024 +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>

commit 56e99307c49adcc6df355f8070229371c97d654f
Author: Adorilson Bezerra <adorilson@gmail.com>
Date:   Sun Mar 31 23:34:54 2024 +0100

    Doc: printf-style library/stdtype improvements (#16741)

commit 18e12641a61a88f7d08b2114ebe965892c6661c5
Author: Raymond Hettinger <rhettinger@users.noreply.github.com>
Date:   Sun Mar 31 16:09:22 2024 -0500

    gh-117387 Remove hash mark from introductory text (#117409)

commit a32d6939486d7f90ee57e215077f6116e19de24d
Author: Deborah <32307299+dlwrnc@users.noreply.github.com>
Date:   Sun Mar 31 22:11:48 2024 +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>

commit 262445358e21c56d7c68e3ee76c13e469d2ea348
Author: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
Date:   Sun Mar 31 12:02:48 2024 -0700

    Link to the Python type system specification (#117400)

commit 752e18389ed03087b51b38eac9769ef8dfd167b7
Author: Barney Gale <barney.gale@gmail.com>
Date:   Sun Mar 31 19:14:48 2024 +0100

    GH-114575: Rename `PurePath.pathmod` to `PurePath.parser` (#116513)

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

commit bfc57d43d8766120ba0c8f3f6d7b2ac681a81d8a
Author: Sam Gross <colesbury@gmail.com>
Date:   Fri Mar 29 18:58:08 2024 -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.

commit 05e0b67a43c5c1778dc2643c8b7c12864e135999
Author: Erlend E. Aasland <erlend@python.org>
Date:   Fri Mar 29 21:23:28 2024 +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()

commit 019143fecbfc26e69800d28d2a9e3392a051780b
Author: Jason R. Coombs <jaraco@jaraco.com>
Date:   Fri Mar 29 16:06:09 2024 -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.

commit 01bd74eadbc4ff839d39762fae6366f50c1e116e
Author: Sam Gross <colesbury@gmail.com>
Date:   Fri Mar 29 15:33:06 2024 -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.

commit 94c97423a9c4969f8ddd4a3aa4aacb99c4d5263d
Author: Guido van Rossum <guido@python.org>
Date:   Fri Mar 29 11:31:09 2024 -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.

commit 5d21d884b6ffa45dac50a5f9a07c41356a8478b4
Author: mpage <mpage@meta.com>
Date:   Fri Mar 29 10:42:02 2024 -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.

commit 19c1dd60c5b53fb0533610ad139ef591294f26e8
Author: Sam Gross <colesbury@gmail.com>
Date:   Fri Mar 29 13:35:43 2024 -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.

commit 397d88db5e9ab2a43de3fdf5f8b973a949edc405
Author: Sam Gross <colesbury@gmail.com>
Date:   Fri Mar 29 13:34:04 2024 -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.

commit f05fb2e65c2dffdfae940f2707765c4994925205
Author: Sam Gross <colesbury@gmail.com>
Date:   Fri Mar 29 13:33:04 2024 -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.

commit ddf95b5f16031cdbd0d728e55eb06dff002a8678
Author: Erlend E. Aasland <erlend@python.org>
Date:   Fri Mar 29 18:26:06 2024 +0100

    gh-116664: Fix unused var warnings in _warnings.c in non-free-threaded builds (#117373)

    The warnings were introduced by commit c1712ef06.

commit 0fa571dbcdf19b541276cb00bb929381930467b2
Author: Tian Gao <gaogaotiantian@hotmail.com>
Date:   Fri Mar 29 09:02:01 2024 -0700

    Refactor pdb executable targets (#112570)

    Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>

commit 54f7e14500471d1c46fb553adb3ca24cd1fef084
Author: Pedro Lacerda <pslacerda@users.noreply.github.com>
Date:   Fri Mar 29 12:05:00 2024 -0300

    gh-66449: configparser: Add support for unnamed sections (#117273)

    Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>

commit d9cfe7e565a6e2dc15747a904736264e31a10be4
Author: Nikita Sobolev <mail@sobolevn.me>
Date:   Fri Mar 29 14:14:25 2024 +0300

    gh-117166: Ignore empty and temporary dirs in `test_makefile` (#117190)

commit 35b6c4a4da201a947b2ceb96ae4c0d83d4d2df4f
Author: Victor Stinner <vstinner@python.org>
Date:   Fri Mar 29 11:25:17 2024 +0100

    gh-117347: Fix test_clinic side effects (#117363)

    Save/restore converters in ClinicWholeFileTest and
    ClinicExternalTest.

commit 7e2fef865899837c47e91ef0180fa59eb03e840b
Author: neonene <53406459+neonene@users.noreply.github.com>
Date:   Fri Mar 29 18:40:48 2024 +0900

    gh-117142: ctypes: Migrate global vars to module state (GH-117189)

commit 2e9be80c99f635c2f7761e8356b0260922d6e7a6
Author: Gregory P. Smith <greg@krypto.org>
Date:   Thu Mar 28 17:58:37 2024 -0700

    Fix reversed assertRegex checks in test_ssl. (#117351)

commit 8eec7ed714e65d616573b7331780b0aa43c6ed6a
Author: 傅立业(Chris Fu) <17433201@qq.com>
Date:   Fri Mar 29 08:19:20 2024 +0800

    gh-117110: Fix subclasses of typing.Any with custom constructors (#117111)

commit a17f313e3958e825db9a83594c8471a984316536
Author: Christopher Chianelli <christopher@timefold.ai>
Date:   Thu Mar 28 18:26:56 2024 -0400

    gh-117339: Use NULL instead of None for LOAD_SUPER_ATTR in dis docs (GH-117343)

commit 26d328b2ba26374fb8d9ffe8215ecef7c5e3f7a2
Author: Michael Droettboom <mdboom@gmail.com>
Date:   Thu Mar 28 18:23:08 2024 -0400

    GH-117121: Add pystats to JIT builds (GH-117346)

commit 14f1ca7d5363386163839b31ce987423daecc3de
Author: Nice Zombies <nineteendo19d0@gmail.com>
Date:   Thu Mar 28 22:20:08 2024 +0100

    gh-117335: Handle non-iterables for `ntpath.commonpath` (GH-117336)

commit 18cf239e39e25e6cef50ecbb7f197a82f8920ff5
Author: Brandt Bucher <brandtbucher@microsoft.com>
Date:   Thu Mar 28 14:02:34 2024 -0700

    Increase the JIT CI timeouts to 75 minutes (GH-117342)

commit 29829b58a8328a7c2ccacaa74c1d7d120a5e5ca5
Author: Malcolm Smith <smith@chaquo.com>
Date:   Thu Mar 28 19:59:12 2024 +0000

    gh-117294: Report DocTestCase as skipped if all examples in the doctest are skipped (GH-117297)

commit efcc96844e7c66fcd6c23ac2d557ca141614ce9a
Author: Tian Gao <gaogaotiantian@hotmail.com>
Date:   Thu Mar 28 11:23:29 2024 -0700

    gh-69201: Separate stdout and stderr stream in test_pdb (#117308)

commit 6702d2bf6edcd5b5415e17837383623b9d76a5b8
Author: Victor Stinner <vstinner@python.org>
Date:   Thu Mar 28 17:40:58 2024 +0100

    gh-114331: Skip decimal test_maxcontext_exact_arith on s390x (#117326)

commit c1712ef066321c01bf09cba3f22fc474b5b8dfa7
Author: Erlend E. Aasland <erlend@python.org>
Date:   Thu Mar 28 16:05:08 2024 +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.

commit 9a388b9a64927c372d85f0eaec3de9b7320a6fb5
Author: Joachim Wuttke <j.wuttke@fz-juelich.de>
Date:   Thu Mar 28 14:43:07 2024 +0100

    bpo-43848: explain optional argument mtime in gzip.py. (GH-25410)

    Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>

commit 8dbfdb2957a7baade3a88661517f163ad694c39f
Author: Sam Gross <colesbury@gmail.com>
Date:   Thu Mar 28 09:28:39 2024 -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.

commit 9a1e55b8c5723206116f7016921be3937ef2f4e5
Author: Chris Markiewicz <effigies@gmail.com>
Date:   Thu Mar 28 06:59:31 2024 -0400

    gh-117178: Recover lazy loading of self-referential modules (#117179)

commit 4c71d51a4b7989fc8754ba512c40e21666f9db0d
Author: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Date:   Thu Mar 28 04:30:31 2024 -0600

    gh-117266: Fix crashes on user-created AST subclasses (GH-117276)

    Fix crashes on user-created AST subclasses

commit 8cb7d7ff86a1a2d41195f01ba4f218941dd7308c
Author: Gregory P. Smith <greg@krypto.org>
Date:   Thu Mar 28 03:11:58 2024 -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.

commit 6c8ac8a32fd6de1960526561c44bc5603fab0f3e
Author: Erlend E. Aasland <erlend@python.org>
Date:   Thu Mar 28 09:40:37 2024 +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.

commit 0f27672c5002de96c9f1228b12460d5ce3f1d190
Author: Russell Keith-Magee <russell@keith-magee.com>
Date:   Thu Mar 28 16:13:13 2024 +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>

commit f006338017cfbf846e8f7391b9ee5f69df8dc620
Author: Russell Keith-Magee <russell@keith-magee.com>
Date:   Thu Mar 28 15:59:33 2024 +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>

commit b44898299a2ed97045c270f6474785da2ff07ced
Author: Tim Hatch <tim@timhatch.com>
Date:   Wed Mar 27 23:54:51 2024 -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>

commit 2cedd25c14d3acfdcb5e8ee55132ce3e334ab8fe
Author: Illia Volochii <illia.volochii@gmail.com>
Date:   Thu Mar 28 08:46:01 2024 +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.

commit eefff682f09394fe4f18b7d7c6ac4c635caadd02
Author: Malcolm Smith <smith@chaquo.com>
Date:   Wed Mar 27 22:11:44 2024 +0000

    gh-108277: Make test_os tolerate 10 ms diff for timerfd on Android emulators (#117223)

commit 7aa89bc43e0bcf49eee5a39b5a7ba8f996f20d00
Author: Victor Stinner <vstinner@python.org>
Date:   Wed Mar 27 23:10:14 2024 +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>

commit 669ef49c7d42f35da6f7ee280102353b9b37f83e
Author: Seth Michael Larson <seth@python.org>
Date:   Wed Mar 27 16:56:14 2024 -0500

    gh-99108: Update and check HACL* version information (GH-117295)

    * Update and check HACL* version information

commit 262fb911ab7df8e890ebd0efb0773c3e0b5a757f
Author: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
Date:   Wed Mar 27 17:38:19 2024 +0000

    gh-117288: Allocate fewer label IDs in _PyCfg_ToInstructionSequence (#117290)

commit 74c8568d07719529b874897598d8b3bc25ff0434
Author: Malcolm Smith <smith@chaquo.com>
Date:   Wed Mar 27 16:53:27 2024 +0000

    gh-71042: Add `platform.android_ver` (#116674)

commit ce00de4c8cd39816f992e749c1074487d93abe9d
Author: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Date:   Wed Mar 27 16:46:35 2024 +0200

    gh-117225: doctest: only print "and X failed" when non-zero, don't pluralise "1 items" (#117228)

commit 92397d5ead38dde4154e70d00f24973bcf2a925a
Author: Raymond Hettinger <rhettinger@users.noreply.github.com>
Date:   Wed Mar 27 09:04:32 2024 -0500

    Add statistics recipe for sampling from an estimated probability density distribution (#117221)

commit b3e8c78ed7aa9bbd1084375587b99200c687cec9
Author: Tian Gao <gaogaotiantian@hotmail.com>
Date:   Tue Mar 26 18:20:12 2024 -0700

    gh-113548: Allow CLI arguments to `pdb -m` (#113557)

commit 48c0b05cf0dd2db275bd4653f84aa36c22bddcd2
Author: Adorilson Bezerra <adorilson@gmail.com>
Date:   Tue Mar 26 19:08:08 2024 +0000

    Change links on the index page (#117230)

commit af1b0e94400d1bf732466d675054df8cf7dfb62d
Author: AN Long <aisk@users.noreply.github.com>
Date:   Wed Mar 27 02:26:48 2024 +0800

    gh-104242: Enable test_is_char_device_true in pathlib test on all platform (GH-116983)

commit 79be75735c9d77972112cecc8d7e1af28c176ed0
Author: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
Date:   Tue Mar 26 15:18:17 2024 +0000

    gh-115775: Compiler adds __static_attributes__ field to classes (#115913)

commit 70969d53a77a8a190c40a30419e772bc874a4f62
Author: Antonio <57417288+amaddio@users.noreply.github.com>
Date:   Tue Mar 26 15:10:29 2024 +0100

    gh-97901 add missing text/rtf to mimetypes (GH-97902)

    Co-authored-by: Noam Cohen <noam@noam.me>

commit 4ec347760f98b156c6a2d42ca397af6b0b6ecc50
Author: AN Long <aisk@users.noreply.github.com>
Date:   Tue Mar 26 22:09:57 2024 +0800

    gh-115538: Use isolate mode when running venv test_multiprocessing_recursion() (#117116)

    Co-authored-by: Victor Stinner <vstinner@python.org>

commit 743f2c68f478279e1e56577fe95a0ed112b9abc5
Author: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Date:   Tue Mar 26 16:09:09 2024 +0200

    pre-commit: add `check-case-conflict` and `check-merge-conflict` (#117259)

commit 4abca7e1e7e2764faf20c7e677ea5c9ea9dbffe2
Author: Paulo Neves <ptsneves@users.noreply.github.com>
Date:   Tue Mar 26 13:37:50 2024 +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>

commit 9654daf793b534b44a831c80f43505ab9e380f1f
Author: Serhiy Storchaka <storchaka@gmail.com>
Date:   Tue Mar 26 13:26:45 2024 +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>

commit 8bef34f625e21886b1c64544c060e19ee2e229bf
Author: Mark Shannon <mark@hotpy.org>
Date:   Tue Mar 26 11:11:42 2024 +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.

commit bf82f77957a31c3731b4ec470c406f5708ca9ba3
Author: Mark Shannon <mark@hotpy.org>
Date:   Tue Mar 26 09:35:11 2024 +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.

commit 61599a48f52e951d8813877ee311d2a830ba2cd8
Author: Pablo Galindo Salgado <Pablogsal@gmail.com>
Date:   Tue Mar 26 09:30:46 2024 +0000

    bpo-24612: Improve syntax error for 'not' after an operator (GH-28170)

    Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>

commit 771902c257372e6c4df1ead4e8c46308561db7a7
Author: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Date:   Tue Mar 26 11:13:32 2024 +0200

    gh-83845: Add tests for operator module (#115883)

    Co-authored-by: Karthikeyan Singaravelan <tir.karthi@gmail.com>

commit ea9a296fce2f786b4cf43c7924e5de01061f27ca
Author: yevgeny hong <hongyevgeny@gmail.com>
Date:   Tue Mar 26 16:45:43 2024 +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>

commit d52bdfb19fadd7614a0e5abaf68525fc7300e841
Author: Victor Stinner <vstinner@python.org>
Date:   Tue Mar 26 08:35:59 2024 +0100

    gh-83434: Disable XML in regrtest when -R option is used (#117232)

commit 9f74e86c78853c101a23e938f8e32ea838d8f62e
Author: Sebastian Pipping <sebastian@pipping.org>
Date:   Tue Mar 26 02:48:27 2024 +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)

commit 872e212378ef86392069034afd80bb53896fd93d
Author: Jonathan Protzenko <protz@microsoft.com>
Date:   Mon Mar 25 17:35:26 2024 -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`.

commit 8945b7ff55b87d11c747af2dad0e3e4d631e62d6
Author: Eric V. Smith <ericvsmith@users.noreply.github.com>
Date:   Mon Mar 25 19:59:14 2024 -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%.

commit 7ebad77ad65ab4d5d8d0c333256a882262cec189
Author: Raymond Hettinger <rhettinger@users.noreply.github.com>
Date:   Mon Mar 25 18:49:44 2024 -0500

    Sync main docs and docstring for median_grouped(). (gh-117214)

commit 0821923aa979a72464c5da8dfa53a719bba5801c
Author: Nice Zombies <nineteendo19d0@gmail.com>
Date:   Mon Mar 25 23:55:11 2024 +0100

    gh-117114: Make os.path.isdevdrive available on all platforms (GH-117115)

commit c2276176d543a2fc2d57709c2787f99850fbb073
Author: Adorilson Bezerra <adorilson@gmail.com>
Date:   Mon Mar 25 22:34:20 2024 +0000

    Add information about negative  indexes to sequence datamodel doc (#110903)

    Co-authored by Terry Jan Reedy

commit 23e4f80ce2a2bac50acd1785e791316d5b578b8d
Author: Mark Shannon <mark@hotpy.org>
Date:   Mon Mar 25 20:43:51 2024 +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.

commit 507896d97dcff2d7999efa264b29d9003c525c49
Author: Victor Stinner <vstinner@python.org>
Date:   Mon Mar 25 17:32:20 2024 +0100

    gh-116936: Add PyType_GetModuleByDef() to the limited C API (#116937)

commit 0c1a42cf9c8cd0d4534d5c1d58f118ce7c5c446e
Author: Serhiy Storchaka <storchaka@gmail.com>
Date:   Mon Mar 25 17:32:11 2024 +0200

    gh-87193: Support bytes objects with refcount > 1 in _PyBytes_Resize() (GH-117160)

    Create a new bytes object and destroy the old one if it has refcount > 1.

commit 01e7405da400e8997f8964d06cc414045e144681
Author: Tian Gao <gaogaotiantian@hotmail.com>
Date:   Mon Mar 25 08:18:09 2024 -0700

    gh-112948: Make pdb completion similar to repl completion (#112950)

commit 9db2a8f914ad59019d448cecc43b6d45f46424a0
Author: Raymond Hettinger <rhettinger@users.noreply.github.com>
Date:   Mon Mar 25 09:26:42 2024 -0500

    Minor markup and grammar fixes in the statistics docs (gh-117216)

commit eebea7e515462b503632ada74923ec3246599c9c
Author: Kirill Podoprigora <kirill.bast9@mail.ru>
Date:   Sun Mar 24 20:34:55 2024 +0200

    gh-117176: Fix compiler warning in Python/optimizer_bytecodes.c (GH-117199)

commit 83485a095363dad6c97b19af2826ca0c34343bfc
Author: Totally a booplicate <53382877+Booplicate@users.noreply.github.com>
Date:   Sun Mar 24 18:48:40 2024 +0300

    gh-112571: Move fish venv activation script into the common folder (GH-117169)

    pythongh-112571: allow using fish venv activation script on windows

    The fish shell can be used on windows under cygwin or msys2.
    This change moves the script to the common folder
    so the venv module will install it on both posix and nt systems (like the bash script).

commit 78a651fd7fbe7a3d1702e40f4cbfa72d87241ef0
Author: Terry Jan Reedy <tjreedy@udel.edu>
Date:   Sun Mar 24 11:38:34 2024 -0400

    gh-117194: Properly format 'base64' header in What's New (#117198)

    It needs 6, not 3, '-'s.

commit f267d5bf2a99fbeb26a720d1c87c1f0557424b14
Author: Kerim Kabirov <the.privat33r+gh@pm.me>
Date:   Sun Mar 24 14:59:14 2024 +0100

    GH-115986 Docs: promote pprint.pp usage as a default (#116614)

    Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>

commit 39df7732178c8e8f75b12f069a3dbc1715c99995
Author: LilKS <1244886+LilKS@users.noreply.github.com>
Date:   Sun Mar 24 11:01:07 2024 +0100

    gh-101760: Improve the imaplib.IMAP4 example (#101764)

    Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>

commit a1e948edba9ec6ba61365429857f7a087c5edf51
Author: Raymond Hettinger <rhettinger@users.noreply.github.com>
Date:   Sun Mar 24 11:35:58 2024 +0200

    Add cumulative option for the new statistics.kde() function. (#117033)

commit d610d821fd210dce63a1132c274ffdf8acc510bc
Author: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
Date:   Sat Mar 23 22:32:33 2024 +0000

    gh-112383: teach dis how to interpret ENTER_EXECUTOR (#117171)

commit 6c83352bfe78a7d567c8d76257df6eb91d5a7245
Author: Ken Jin <kenjin@python.org>
Date:   Sun Mar 24 06:19:17 2024 +0800

    gh-117180: Complete call sequence when trace stack overflow (GH-117184)

    ---------

    Co-authored-by: Peter Lazorchak <lazorchakp@gmail.com>
    Co-authored-by: Guido van Rossum <gvanrossum@users.noreply.github.com>
    Co-authored-by: Guido van Rossum <gvanrossum@gmail.com>

commit f11d0d8be8af28e1368c3c7c116218cf65ddf93e
Author: Erik Soma <stillusingirc@gmail.com>
Date:   Sat Mar 23 11:39:35 2024 -0400

    gh-91227: Ignore ERROR_PORT_UNREACHABLE in proactor recvfrom() (#32011)

commit 9967b568edd2e35b0415c14c7242f3ca2c0dc03d
Author: Victor Stinner <vstinner@python.org>
Date:   Sat Mar 23 13:01:20 2024 +0100

    gh-117008: Fix functools test_recursive_pickle() (#117009)

    Use support.infinite_recursion() in test_recursive_pickle() of
    test_functools to prevent a stack overflow on "ARM64 Windows
    Non-Debug" buildbot.

    Lower Py_C_RECURSION_LIMIT to 1,000 frames on Windows ARM64.

commit 72eea512b88f8fd68b7258242c37da963ad87360
Author: Barney Gale <barney.gale@gmail.com>
Date:   Fri Mar 22 19:14:09 2024 +0000

    GH-106747: Document another difference between `glob` and `pathlib`. (#116518)

    Document that `path.glob()` might return *path*, whereas
    `glob.glob(root_dir=path)` will never return an empty string corresponding
    to *path*.

commit e28477f214276db941e715eebc8cdfb96c1207d9
Author: Mark Shannon <mark@hotpy.org>
Date:   Fri Mar 22 18:43:25 2024 +0000

    GH-117108: Change the size of the GC increment to about 1% of the total heap size. (GH-117120)

commit e2e0b4b4b92694ba894e02b4a66fd87c166ed10f
Author: Serhiy Storchaka <storchaka@gmail.com>
Date:   Fri Mar 22 20:19:10 2024 +0200

    gh-113024: C API: Add PyObject_GenericHash() function (GH-113025)

commit 567ab3bd15398c8c7b791f3e376ae3e3c0bbe079
Author: Serhiy Storchaka <storchaka@gmail.com>
Date:   Fri Mar 22 20:08:00 2024 +0200

    gh-117084: Fix ZIP file extraction for directory entry names with backslashes on Windows (GH-117129)

commit 5a78f6e798d5c2af1dba2df6c9f1f1e5aac02a86
Author: Serhiy Storchaka <storchaka@gmail.com>
Date:   Fri Mar 22 20:03:48 2024 +0200

    gh-117134: Microoptimize glob() for include_hidden=True (GH-117135)

commit 00baaa21de229a6db80ff2b84c2fd6ad1999a24c
Author: Vinay Sajip <vinay_sajip@yahoo.co.uk>
Date:   Fri Mar 22 17:25:51 2024 +0000

    [docs] Fix typo in docstring and add example to logging cookbook. (GH-117157)

commit 40d75c2b7f5c67e254d0a025e0f2e2c7ada7f69f
Author: Jakub Stasiak <jakub@stasiak.at>
Date:   Fri Mar 22 17:49:56 2024 +0100

    GH-113171: Fix "private" (non-global) IP address ranges (GH-113179)

    * GH-113171: Fix "private" (really non-global) IP address ranges

    The _private_networks variables, used by various is_private
    implementations, were missing some ranges and at the same time had
    overly strict ranges (where there are more specific ranges considered
    globally reachable by the IANA registries).

    This patch updates the ranges with what was missing or otherwise
    incorrect.

    I left 100.64.0.0/10 alone, for now, as it's been made special in [1]
    and I'm not sure if we want to undo that as I don't quite understand the
    motivation behind it.

    The _address_exclude_many() call returns 8 networks for IPv4, 121
    networks for IPv6.

    [1] https://github.com/python/cpython/issues/61602

commit 3be9b9d8722696b95555937bb211dc4cda714d56
Author: Steve Dower <steve.dower@python.org>
Date:   Fri Mar 22 15:00:50 2024 +0000

    Fix get_packagefamilyname helper function on Windows 32-bit (GH-117153)

commit 63d6f2623ef2aa90f51c6a928b96845b9b380d89
Author: NGRsoftlab <78017794+NGRsoftlab@users.noreply.github.com>
Date:   Fri Mar 22 14:25:38 2024 +0300

    gh-117068: Remove useless code in bytesio.c:resize_buffer() (GH-117069)

    Co-authored-by: i.khabibulin <i.khabibulin@ngrsoftlab.ru>

commit 42ae924d278c48a719fb0ab86357f3235a9f7ab9
Author: Petr Viktorin <encukou@gmail.com>
Date:   Fri Mar 22 10:42:18 2024 +0100

    gh-117127: glob tests: Reopen dir_fd to pick up directory changes (GH-117128)

commit 8383915031942f441f435a5ae800790116047b80
Author: Tim Peters <tim.peters@gmail.com>
Date:   Thu Mar 21 22:27:25 2024 -0500

    GH-116939: Rewrite binarysort() (#116940)

    Rewrote binarysort() for clarity.

    Also changed the signature to be more coherent (it was mixing sortslice with raw pointers).

    No change in method or functionality. However, I left some experiments in, disabled for now
    via `#if` tricks. Since this code was first written, some kinds of comparisons have gotten
    enormously faster (like for lists of floats), which changes the tradeoffs.

    For example, plain insertion sort's simpler innermost loop and highly predictable branches
    leave it very competitive (even beating, by a bit) binary insertion when comparisons are
    very cheap, despite that it can do many more compares. And it wins big on runs that
    are already sorted (moving the next one in takes only 1 compare then).

    So I left code for a plain insertion sort, to make future experimenting easier.

    Also made the maximum value of minrun a `#define` (``MAX_MINRUN`) to make
    experimenting with that easier too.

    And another bit of `#if``-disabled code rewrites binary insertion's innermost loop to
    remove its unpredictable branch. Surprisingly, this doesn't really seem to help
    overall. I'm unclear on why not. It certainly adds more instructions, but they're very
    simple, and it's hard to be believe they cost as much as a branch miss.

commit 97ba910e47ad298114800587979ce7beb0a705a3
Author: Guido van Rossum <guido@python.org>
Date:   Thu Mar 21 18:27:48 2024 -0700

    gh-108716:: Remove _PyStaticCode_Init/Fini (#117141)

    More deepfreeze cleanup.

commit b3d25df8d38b79310587da54dbd88b06a16d4904
Author: Eric Snow <ericsnowcurrently@gmail.com>
Date:   Thu Mar 21 18:20:20 2024 -0600

    gh-105716: Fix _PyInterpreterState_IsRunningMain() For Embedders (gh-117140)

    When I added _PyInterpreterState_IsRunningMain() and friends last year, I tried to accommodate applications that embed Python but don't call _PyInterpreterState_SetRunningMain() (not that they're expected to).  That mostly worked fine until my recent changes in gh-117049, where the subtleties with the fallback code led to failures; the change ended up breaking test_tools.test_freeze, which exercises a basic embedding situation.

    The simplest fix is to drop the fallback code I originally added to _PyInterpreterState_IsRunningMain() (and later to _PyThreadState_IsRunningMain()).  I've kept the fallback in the _xxsubinterpreters module though.  I've also updated Py_FrozenMain() to call _PyInterpreterState_SetRunningMain().

commit c4bf58a14f162557038a1535ca22c52b49d81d7b
Author: Thomas A Caswell <tcaswell@gmail.com>
Date:   Thu Mar 21 19:54:50 2024 -0400

    gh-116745: Remove all internal usage of @LIBPYTHON@ (#116746)

    Replace with MODULE_LDFLAGS.

commit 3ec57307e70ee6f42410e844d3399bbd598917ba
Author: Malcolm Smith <smith@chaquo.com>
Date:   Thu Mar 21 23:52:29 2024 +0000

    gh-71052: Add Android build script and instructions (#116426)

commit 50f9b0b1e0fb181875751cef951351ed007b6397
Author: Victor Stinner <vstinner@python.org>
Date:   Thu Mar 21 23:17:09 2024 +0100

    gh-117061: Fix test_posix.test_sched_setaffinity() on RHEL9 (#117126)

    On RHEL9, sched_setaffinity(0, []) does not fail.

commit 0907871d43bffb613cbd560224e1a9db13d06c06
Author: Ned Batchelder <ned@nedbatchelder.com>
Date:   Thu Mar 21 15:47:09 2024 -0400

    docs: fix over-linking in dataclasses.rst (#117005)

commit 570a82d46abfebb9976961113fb0f8bb400ad182
Author: Guido van Rossum <guido@python.org>
Date:   Thu Mar 21 12:37:41 2024 -0700

    gh-117045: Add code object to function version cache (#117028)

    Changes to the function version cache:

    - In addition to the function object, also store the code object,
      and allow the latter to be retrieved even if the function has been evicted.
    - Stop assigning new function versions after a critical attribute (e.g. `__code__`)
      has been modified; the version is permanently reset to zero in this case.
    - Changes to `__annotations__` are no longer considered critical. (This fixes gh-109998.)

    Changes to the Tier 2 optimization machinery:

    - If we cannot map a function version to a function, but it is still mapped to a code object,
      we continue projecting the trace.
      The operand of the `_PUSH_FRAME` and `_POP_FRAME` opcodes can be either NULL,
      a function object, or a code object with the lowest bit set.

    This allows us to trace through code that calls an ephemeral function,
    i.e., a function that may not be alive when we are constructing the executor,
    e.g. a generator expression or certain nested functions.
    We will lose globals removal inside such functions,
    but we can still do other peephole operations
    (and even possibly [call inlining](https://github.com/python/cpython/pull/116290),
    if we decide to do it), which only need the code object.
    As before, if we cannot retrieve the code object from the cache, we stop projecting.

commit c85d84166a84a5cb2d724012726bad34229ad24e
Author: Will Childs-Klein <willck93@gmail.com>
Date:   Thu Mar 21 14:16:36 2024 -0500

    gh-116333: Relax error string text expectations in SSL-related tests (GH-116334)

    * Relax error string text expectations in SSL-related tests

    As suggested [here][1], this change relaxes the OpenSSL error string
    text expectations in a number of tests. This was specifically done in
    support of more easily building CPython [AWS-LC][2], but because AWS-LC
    is a fork of [BoringSSL][3], it should increase compatibility with that
    library as well.

    In addition to the error string relaxations, we also add some guards
    around the `tls-unique` channel binding being used with TLSv1.3, as that
    feature (described in [RFC 6929][4]) is [not defined][5] for TLSv1.3.

    [1]: https://discuss.python.org/t/support-building-ssl-and-hashlib-modules-against-aws-lc/44505/4
    [2]: https://github.com/aws/aws-lc
    [3]: https://github.com/google/boringssl
    [4]: https://datatracker.ietf.org/doc/html/rfc5929#section-3
    [5]: https://datatracker.ietf.org/doc/html/rfc8446#appendix-C.5

commit 1f72fb5447ef3f8892b4a7a6213522579c618e8e
Author: Sam Gross <colesbury@gmail.com>
Date:   Thu Mar 21 14:21:02 2024 -0400

    gh-116522: Refactor `_PyThreadState_DeleteExcept` (#117131)

    Split `_PyThreadState_DeleteExcept` into two functions:

    - `_PyThreadState_RemoveExcept` removes all thread states other than one
      passed as an argument. It returns the removed thread states as a
      linked list.

    - `_PyThreadState_DeleteList` deletes those dead thread states. It may
      call destructors, so we want to "start the world" before calling
      `_PyThreadState_DeleteList` to avoid potential deadlocks.

commit 50369e6c34d05222e5a0ec9443a9f7b230e83112
Author: Michael Droettboom <mdboom@gmail.com>
Date:   Thu Mar 21 13:27:46 2024 -0400

    gh-116996: Add pystats about _Py_uop_analyse_and_optimize (GH-116997)

commit 617158e07811edfd6fd552a3d84b0beedd8f1d18
Author: Eric Snow <ericsnowcurrently@gmail.com>
Date:   Thu Mar 21 11:15:02 2024 -0600

    gh-76785: Drop PyInterpreterID_Type (gh-117101)

    I added it quite a while ago as a strategy for managing interpreter lifetimes relative to the PEP 554 (now 734) implementation.  Relatively recently I refactored that implementation to no longer rely on InterpreterID objects.  Thus now I'm removing it.

commit abdd1f938f08e536864532b2071f144515ecc88b
Author: Victor Stinner <vstinner@python.org>
Date:   Thu Mar 21 17:45:43 2024 +0100

    gh-85283: Build _testconsole extension with limited C API (#117125)

commit 8bea6c411d65cd987616b4ecdb86373e4f21f1c6
Author: Victor Stinner <vstinner@python.org>
Date:   Thu Mar 21 17:07:00 2024 +0100

    gh-115754: Add Py_GetConstant() function (#116883)

    Add Py_GetConstant() and Py_GetConstantBorrowed() functions.

    In the limited C API version 3.13, getting Py_None, Py_False,
    Py_True, Py_Ellipsis and Py_NotImplemented singletons is now
    implemented as function calls at the stable ABI level to hide
    implementation details. Getting these constants still return borrowed
    references.

    Add _testlimitedcapi/object.c and test_capi/test_object.py to test
    Py_GetConstant() and Py_GetConstantBorrowed() functions.

commit 5a76d1be8ef371b75ca65166726923c249b5f615
Author: Eric Snow <ericsnowcurrently@gmail.com>
Date:   Thu Mar 21 10:06:35 2024 -0600

    gh-105716: Update interp->threads.main After Fork (gh-117049)

    I missed this in gh-109921.

    We also update Py_Exit() to call _PyInterpreterState_SetNotRunningMain(), if necessary.

commit bbee57fa8c318cb26d6c8651254927a1972c9738
Author: Eric Snow <ericsnowcurrently@gmail.com>
Date:   Thu Mar 21 09:56:12 2024 -0600

    gh-76785: Clean Up Interpreter ID Conversions (gh-117048)

    Mostly we unify the two different implementations of the conversion code (from PyObject * to int64_t.  We also drop the PyArg_ParseTuple()-style converter function, as well as rename and move PyInterpreterID_LookUp().

commit e728303532168efab7694c55c82ea19b18bf8385
Author: Sam Gross <colesbury@gmail.com>
Date:   Thu Mar 21 10:01:16 2024 -0400

    gh-116522: Stop the world before fork() and during shutdown (#116607)

    This changes the free-threaded build to perform a stop-the-world pause
    before deleting other thread states when forking and during shutdown.
    This fixes some crashes when using multiprocessing and during shutdown
    when running with `PYTHON_GIL=0`.

    This also changes `PyOS_BeforeFork` to acquire the runtime lock
    (i.e., `HEAD_LOCK(&_PyRuntime)`) before forking to ensure that data
    protected by the runtime lock (and not just the GIL or stop-the-world)
    is in a consistent state before forking.

commit 1f8b24ef69896680d6ba6005e75e1cc79a744f9e
Author: Malcolm Smith <smith@chaquo.com>
Date:   Thu Mar 21 13:20:57 2024 +0000

    gh-71052: Implement `ctypes.util.find_library` on Android (GH-116379)

commit d16c9d1278164f04778861814ebc87ed087511fc
Author: Tian Gao <gaogaotiantian@hotmail.com>
Date:   Thu Mar 21 03:30:10 2024 -0700

    gh-116987: Support class code objects in inspect.findsource() (GH-117025)

commit 6547330f4e896c6748da23704b617e060e6cc68e
Author: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Date:   Thu Mar 21 03:49:10 2024 +0000

    GH-109653: Defer import of ``importlib.metadata._adapters`` (#109829)

    * adapters

    * Add comments for deferred imports with links to rationale.

    * Add blurb

    ---------

    Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>

commit 667294d5b2ee812ebe0c9c1efd58e2006b61f827
Author: Jason R. Coombs <jaraco@jaraco.com>
Date:   Wed Mar 20 23:01:24 2024 -0400

    gh-117089: Apply changes from importlib_metadata 7.1.0 (#117094)

    * Apply changes from importlib_metadata 7.1.0

    * Include the data sources in the makefile (even though they're not needed)

commit f4cc77d494ee0e10ed84ce369f0910c70a2f6d44
Author: Victor Stinner <vstinner@python.org>
Date:   Thu Mar 21 00:06:24 2024 +0100

    gh-116869: Enable -Werror in test_cext for Free Threading (#117106)

    Check for warnings, but don't enable the compiler flag
    -Werror=declaration-after-statement.

commit 104602a6078564765b7b8f42888f8eaa37b129b1
Author: Victor Stinner <vstinner@python.org>
Date:   Wed Mar 20 23:52:23 2024 +0100

    gh-105927: Limit PyWeakref_GetRef() to limited C API 3.13 (#117091)

commit 8ad88984200b2ccddc0a08229dd2f4c14d1a71fc
Author: Jason R. Coombs <jaraco@jaraco.com>
Date:   Wed Mar 20 17:11:00 2024 -0400

    gh-117089: Move importlib.metadata tests to their own package (#117092)

    * Ensure importlib.metadata tests do not leak references in sys.modules.

    * Move importlib.metadata tests to their own package for easier syncing with importlib_metadata.

    * Update owners and makefile for new directories.

    * Add blurb

commit 7d446548ef53f6c3de1097c6d44cada6642ddc85
Author: Carol Willing <carolcode@willingconsulting.com>
Date:   Wed Mar 20 14:00:59 2024 -0700

    Fix sort order for "locale encoding" glossary item (#115794)

    Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>

commit 63289b9dfbc7d87e81f1517422ee91b6b6d19531
Author: Mark Shannon <mark@hotpy.org>
Date:   Wed Mar 20 18:24:02 2024 +0000

    GH-117066: Tier 2 optimizer: Don't throw away good traces if we can't optimize them perfectly. (GH-117067)

commit dcaf33a41d5d220523d71c9b35bc08f5b8405dac
Author: Petr Viktorin <encukou@gmail.com>
Date:   Wed Mar 20 17:33:08 2024 +0100

    gh-114314: ctypes: remove stgdict and switch to heap types (GH-116458)

    Before this change, ctypes classes used a custom dict subclass, `StgDict`,
    as their `tp_dict`. This acts like a regular dict but also includes extra information
    about the type.

    This replaces stgdict by `StgInfo`, a C struct on the type, accessed by
    `PyObject_GetTypeData()` (PEP-697).
    All usage of `StgDict` (mainly variables named `stgdict`, `dict`, `edict` etc.) is
    converted to `StgInfo` (named `stginfo`, `info`, `einfo`, etc.).
    Where the dict is actually used for class attributes (as a regular PyDict), it's now
    called `attrdict`.

    This change -- not overriding `tp_dict` -- is made to make me comfortable with
    the next part of this PR: moving the initialization logic from `tp_new` to `tp_init`.

    The `StgInfo` is set up in `__init__` of each class, with a guard that prevents
    calling `__init__` more than once. Note that abstract classes (like `Array` or
    `Structure`) are created using `PyType_FromMetaclass` and do not have
    `__init__` called.
    Previously, this was done in `__new__`, which also wasn't called for abstract
    classes.
    Since `__init__` can be called from Python code or skipped, there is a tested
    guard to ensure `StgInfo` is initialized exactly once before it's used.

    Co-authored-by: neonene <53406459+neonene@users.noreply.github.com>
    Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>

commit 44fbab43d8f3f2df07091d237824cf4fa1f6c57c
Author: Russell Keith-Magee <russell@keith-magee.com>
Date:   Wed Mar 20 23:32:56 2024 +0800

    gh-117058: Update GUI and packaging recommendations for macOS. (#117059)

commit 9221ef2d8cb7f4cf37592eb650d4c8f972033000
Author: Brett Simmers <swtaarrs@users.noreply.github.com>
Date:   Wed Mar 20 08:18:26 2024 -0700

    gh-116908: Only write to `_pending_calls.calls_to_do` with atomic operations (#117044)

    These writes to `pending->calls_to_do` need to be atomic, because other threads
    can read (atomically) from `calls_to_do` without holding `pending->mutex`.

commit fc4599800778f9b130d5e336deadbdeb5bd3e5ee
Author: jkriegshauser <jkriegshauser@gmail.com>
Date:   Wed Mar 20 07:33:28 2024 -0700

    gh-116773: Ensure overlapped objects on Windows are not deallocated too early by asyncio (GH-116774)

commit 519b2ae22b54760475bbf62b9558d453c703f9c6
Author: Serhiy Storchaka <storchaka@gmail.com>
Date:   Wed Mar 20 15:39:53 2024 +0200

    gh-117021: Fix integer overflow in PyLong_AsPid() on non-Windows 64-bit platforms (GH-117064)
paravoid added a commit to paravoid/home-assistant-core that referenced this pull request Apr 11, 2024
* Remove the constants LINK_LOCAL_NETWORKS and LOOPBACK_NETWORKS, as
  they are currently unreferenced, due to the changes made by PR#102019.

* Replace the PRIVATE_NETWORKS check with stdlib's is_private() method.
  Besides a reduction of code, this results in a more comprehensive
  check, as stdlib includes additional address spaces that were not
  covered before, and is ever evolving (see, for example,
  python/cpython#113179).

* In contrast with CPython, loopbacks and link-locals are NOT included
  in our definition of "private", so adjust the code to keep the
  existing semantics

* However, this *does* change the semantics for some address spaces to
  follow Python's interpretation of IANA, such as marking reserved
  documentation spaces as "local". Invert the test cases for
  198.51.100.0/24 (TEST-NET-2) and 2001:db8::/32 (Documentation)
  accordingly.

* We now need a new globally reachable IP space to use as
  EXTERNAL_ADDRESSES in test_auth. Use AS112's address space, as it is
  reserved by IANA, but marked as Globally Reachable.

* Finally, inline the last remaining constant IPV6_IPV4_LOOPBACK, and
  leave a comment that work is underway in CPython by yours truly to
  reduce the need for it and have is_loopback() subsume it.

Further work is required to align the semantics of e.g. what "private"
means with stdlib, and replace these seldomly used util functions with
stdlib properties across the tree (as is already the case in several
integrations), but hopefully this provides a stepping stone towards this
direction.
@miss-islington-app
Copy link

Sorry, @jstasiak and @encukou, I could not cleanly backport this to 3.11 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 40d75c2b7f5c67e254d0a025e0f2e2c7ada7f69f 3.11

@miss-islington-app
Copy link

Sorry, @jstasiak and @encukou, I could not cleanly backport this to 3.12 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 40d75c2b7f5c67e254d0a025e0f2e2c7ada7f69f 3.12

encukou pushed a commit to encukou/cpython that referenced this pull request Apr 23, 2024
…ythonGH-113179)

The _private_networks variables, used by various is_private
implementations, were missing some ranges and at the same time had
overly strict ranges (where there are more specific ranges considered
globally reachable by the IANA registries).

This patch updates the ranges with what was missing or otherwise
incorrect.

I left 100.64.0.0/10 alone, for now, as it's been made special in [1]
and I'm not sure if we want to undo that as I don't quite understand the
motivation behind it.

The _address_exclude_many() call returns 8 networks for IPv4, 121
networks for IPv6.

[1] python#61602

(cherry picked from commit 40d75c2)
@encukou
Copy link
Member

encukou commented Apr 23, 2024

#118177 is a backport of this pull request to the 3.12 branch.

encukou added a commit that referenced this pull request Apr 24, 2024
…ges (GH-113179) (GH-113186) (GH-118177)

* GH-113171: Fix "private" (non-global) IP address ranges (GH-113179)

The _private_networks variables, used by various is_private
implementations, were missing some ranges and at the same time had
overly strict ranges (where there are more specific ranges considered
globally reachable by the IANA registries).

This patch updates the ranges with what was missing or otherwise
incorrect.

100.64.0.0/10 is left alone, for now, as it's been made special in [1].

The _address_exclude_many() call returns 8 networks for IPv4, 121
networks for IPv6.

[1] #61602

* GH-65056: Improve the IP address' is_global/is_private documentation (GH-113186)

It wasn't clear what the semantics of is_global/is_private are and, when
one gets to the bottom of it, it's not quite so simple (hence the
exceptions listed).

(cherry picked from commit 2a4cbf1)
(cherry picked from commit 40d75c2)

---------

Co-authored-by: Jakub Stasiak <jakub@stasiak.at>
encukou added a commit to encukou/cpython that referenced this pull request Apr 24, 2024
…s ranges (pythonGH-113179) (pythonGH-113186) (pythonGH-118177)

* pythonGH-113171: Fix "private" (non-global) IP address ranges (pythonGH-113179)

The _private_networks variables, used by various is_private
implementations, were missing some ranges and at the same time had
overly strict ranges (where there are more specific ranges considered
globally reachable by the IANA registries).

This patch updates the ranges with what was missing or otherwise
incorrect.

100.64.0.0/10 is left alone, for now, as it's been made special in [1].

The _address_exclude_many() call returns 8 networks for IPv4, 121
networks for IPv6.

[1] python#61602

* pythonGH-65056: Improve the IP address' is_global/is_private documentation (pythonGH-113186)

It wasn't clear what the semantics of is_global/is_private are and, when
one gets to the bottom of it, it's not quite so simple (hence the
exceptions listed).

(cherry picked from commit 2a4cbf1)
(cherry picked from commit 40d75c2)

---------

(cherry picked from commit f86b17a)

Co-authored-by: Jakub Stasiak <jakub@stasiak.at>
encukou added a commit to encukou/cpython that referenced this pull request Apr 24, 2024
…s ranges (pythonGH-113179) (pythonGH-113186) (pythonGH-118177)

* pythonGH-113171: Fix "private" (non-global) IP address ranges (pythonGH-113179)

The _private_networks variables, used by various is_private
implementations, were missing some ranges and at the same time had
overly strict ranges (where there are more specific ranges considered
globally reachable by the IANA registries).

This patch updates the ranges with what was missing or otherwise
incorrect.

100.64.0.0/10 is left alone, for now, as it's been made special in [1].

The _address_exclude_many() call returns 8 networks for IPv4, 121
networks for IPv6.

[1] python#61602

* pythonGH-65056: Improve the IP address' is_global/is_private documentation (pythonGH-113186)

It wasn't clear what the semantics of is_global/is_private are and, when
one gets to the bottom of it, it's not quite so simple (hence the
exceptions listed).

(cherry picked from commit 2a4cbf1)
(cherry picked from commit 40d75c2)

---------

(cherry picked from commit f86b17a)

Co-authored-by: Jakub Stasiak <jakub@stasiak.at>
encukou added a commit to encukou/cpython that referenced this pull request May 1, 2024
…s ranges (pythonGH-113179) (pythonGH-113186) (pythonGH-118177)

* pythonGH-113171: Fix "private" (non-global) IP address ranges (pythonGH-113179)

The _private_networks variables, used by various is_private
implementations, were missing some ranges and at the same time had
overly strict ranges (where there are more specific ranges considered
globally reachable by the IANA registries).

This patch updates the ranges with what was missing or otherwise
incorrect.

100.64.0.0/10 is left alone, for now, as it's been made special in [1].

The _address_exclude_many() call returns 8 networks for IPv4, 121
networks for IPv6.

[1] python#61602

* pythonGH-65056: Improve the IP address' is_global/is_private documentation (pythonGH-113186)

It wasn't clear what the semantics of is_global/is_private are and, when
one gets to the bottom of it, it's not quite so simple (hence the
exceptions listed).

(cherry picked from commit 2a4cbf1)
(cherry picked from commit 40d75c2)

---------

(cherry picked from commit f86b17a)

Co-authored-by: Jakub Stasiak <jakub@stasiak.at>
encukou added a commit to encukou/cpython that referenced this pull request May 1, 2024
…s ranges (pythonGH-113179) (pythonGH-113186) (pythonGH-118177)

* pythonGH-113171: Fix "private" (non-global) IP address ranges (pythonGH-113179)

The _private_networks variables, used by various is_private
implementations, were missing some ranges and at the same time had
overly strict ranges (where there are more specific ranges considered
globally reachable by the IANA registries).

This patch updates the ranges with what was missing or otherwise
incorrect.

100.64.0.0/10 is left alone, for now, as it's been made special in [1].

The _address_exclude_many() call returns 8 networks for IPv4, 121
networks for IPv6.

[1] python#61602

* pythonGH-65056: Improve the IP address' is_global/is_private documentation (pythonGH-113186)

It wasn't clear what the semantics of is_global/is_private are and, when
one gets to the bottom of it, it's not quite so simple (hence the
exceptions listed).

(cherry picked from commit 2a4cbf1)
(cherry picked from commit 40d75c2)

---------

(cherry picked from commit f86b17a)

Co-authored-by: Jakub Stasiak <jakub@stasiak.at>
ambv pushed a commit that referenced this pull request May 7, 2024
…ges (GH-113179) (GH-113186) (GH-118177) (GH-118229)

The _private_networks variables, used by various is_private
implementations, were missing some ranges and at the same time had
overly strict ranges (where there are more specific ranges considered
globally reachable by the IANA registries).

This patch updates the ranges with what was missing or otherwise
incorrect.

100.64.0.0/10 is left alone, for now, as it's been made special in [1].

The _address_exclude_many() call returns 8 networks for IPv4, 121
networks for IPv6.

[1] #61602

In 3.10 and below, is_private checks whether the network and broadcast
address are both private.
In later versions (where the test wss backported from), it checks
whether they both are in the same private network.

For 0.0.0.0/0, both 0.0.0.0 and 255.225.255.255 are private,
but one is in 0.0.0.0/8 ("This network") and the other in
255.255.255.255/32 ("Limited broadcast").

---------

Co-authored-by: Jakub Stasiak <jakub@stasiak.at>
ambv pushed a commit that referenced this pull request May 7, 2024
…es (GH-113179) (GH-113186) (GH-118177) (GH-118472)

The _private_networks variables, used by various is_private
implementations, were missing some ranges and at the same time had
overly strict ranges (where there are more specific ranges considered
globally reachable by the IANA registries).

This patch updates the ranges with what was missing or otherwise
incorrect.

100.64.0.0/10 is left alone, for now, as it's been made special in [1].

The _address_exclude_many() call returns 8 networks for IPv4, 121
networks for IPv6.

[1] #61602

In 3.10 and below, is_private checks whether the network and broadcast
address are both private.
In later versions (where the test wss backported from), it checks
whether they both are in the same private network.

For 0.0.0.0/0, both 0.0.0.0 and 255.225.255.255 are private,
but one is in 0.0.0.0/8 ("This network") and the other in
255.255.255.255/32 ("Limited broadcast").

---------

Co-authored-by: Jakub Stasiak <jakub@stasiak.at>
ambv pushed a commit that referenced this pull request May 7, 2024
…es (GH-113179) (GH-113186) (GH-118177) (GH-118479)

The _private_networks variables, used by various is_private
implementations, were missing some ranges and at the same time had
overly strict ranges (where there are more specific ranges considered
globally reachable by the IANA registries).

This patch updates the ranges with what was missing or otherwise
incorrect.

100.64.0.0/10 is left alone, for now, as it's been made special in [1].

The _address_exclude_many() call returns 8 networks for IPv4, 121
networks for IPv6.

[1] #61602

In 3.10 and below, is_private checks whether the network and broadcast
address are both private.
In later versions (where the test wss backported from), it checks
whether they both are in the same private network.

For 0.0.0.0/0, both 0.0.0.0 and 255.225.255.255 are private,
but one is in 0.0.0.0/8 ("This network") and the other in
255.255.255.255/32 ("Limited broadcast").

---------

Co-authored-by: Jakub Stasiak <jakub@stasiak.at>
@jstasiak jstasiak deleted the fix-ipaddress-private-ranges branch May 30, 2024 18:39
rickprice pushed a commit to ActiveState/cpython that referenced this pull request Jul 3, 2024
…113179) (pythonGH-113186) (pythonGH-118177)

(cherry picked from commit f86b17a)

Co-authored-by: Jakub Stasiak <jakub@stasiak.at>
(cherry picked from commit 05a1467)

pythongh-113171: pythongh-65056: Fix "private" (non-global) IP address ranges (pythonGH-113179) (pythonGH-113186) (pythonGH-118177)

* pythonGH-113171: Fix "private" (non-global) IP address ranges (pythonGH-113179)

The _private_networks variables, used by various is_private
implementations, were missing some ranges and at the same time had
overly strict ranges (where there are more specific ranges considered
globally reachable by the IANA registries).

This patch updates the ranges with what was missing or otherwise
incorrect.

100.64.0.0/10 is left alone, for now, as it's been made special in [1].

The _address_exclude_many() call returns 8 networks for IPv4, 121
networks for IPv6.

[1] python#61602

* pythonGH-65056: Improve the IP address' is_global/is_private documentation (pythonGH-113186)

It wasn't clear what the semantics of is_global/is_private are and, when
one gets to the bottom of it, it's not quite so simple (hence the
exceptions listed).

(cherry picked from commit 2a4cbf1)
(cherry picked from commit 40d75c2)

---------

(cherry picked from commit f86b17a)

Co-authored-by: Jakub Stasiak <jakub@stasiak.at>
(cherry picked from commit 05a1467)

Add IPv6 addresses to suspignore.csv

That's a lot of semicolons!

(cherry picked from commit e366724)

Add notable changes
rickprice pushed a commit to ActiveState/cpython that referenced this pull request Jul 4, 2024
…113179) (pythonGH-113186) (pythonGH-118177)

* Fix "private" (non-global) IP address ranges (pythonGH-113179) (pythonGH-113186)
(pythonGH-118177)

(cherry picked from commit f86b17a)

Co-authored-by: Jakub Stasiak <jakub@stasiak.at>
(cherry picked from commit 05a1467)

pythongh-113171: pythongh-65056: Fix "private" (non-global) IP address ranges
(pythonGH-113179) (pythonGH-113186) (pythonGH-118177)

* pythonGH-113171: Fix "private" (non-global) IP address ranges (pythonGH-113179)

The _private_networks variables, used by various is_private
implementations, were missing some ranges and at the same time had
overly strict ranges (where there are more specific ranges considered
globally reachable by the IANA registries).

This patch updates the ranges with what was missing or otherwise
incorrect.

100.64.0.0/10 is left alone, for now, as it's been made special in [1].

The _address_exclude_many() call returns 8 networks for IPv4, 121
networks for IPv6.

[1] python#61602

* pythonGH-65056: Improve the IP address' is_global/is_private documentation (pythonGH-113186)

It wasn't clear what the semantics of is_global/is_private are and, when
one gets to the bottom of it, it's not quite so simple (hence the
exceptions listed).

(cherry picked from commit 2a4cbf1)
(cherry picked from commit 40d75c2)

---------

(cherry picked from commit f86b17a)

Co-authored-by: Jakub Stasiak <jakub@stasiak.at>
(cherry picked from commit 05a1467)

Add IPv6 addresses to suspignore.csv

That's a lot of semicolons!

(cherry picked from commit e366724)
rickprice pushed a commit to ActiveState/cpython that referenced this pull request Jul 8, 2024
…113179) (pythonGH-113186) (pythonGH-118177)

* Fix "private" (non-global) IP address ranges (pythonGH-113179) (pythonGH-113186)
(pythonGH-118177)

(cherry picked from commit f86b17a)

Co-authored-by: Jakub Stasiak <jakub@stasiak.at>
(cherry picked from commit 05a1467)

pythongh-113171: pythongh-65056: Fix "private" (non-global) IP address ranges
(pythonGH-113179) (pythonGH-113186) (pythonGH-118177)

* pythonGH-113171: Fix "private" (non-global) IP address ranges (pythonGH-113179)

The _private_networks variables, used by various is_private
implementations, were missing some ranges and at the same time had
overly strict ranges (where there are more specific ranges considered
globally reachable by the IANA registries).

This patch updates the ranges with what was missing or otherwise
incorrect.

100.64.0.0/10 is left alone, for now, as it's been made special in [1].

The _address_exclude_many() call returns 8 networks for IPv4, 121
networks for IPv6.

[1] python#61602

* pythonGH-65056: Improve the IP address' is_global/is_private documentation (pythonGH-113186)

It wasn't clear what the semantics of is_global/is_private are and, when
one gets to the bottom of it, it's not quite so simple (hence the
exceptions listed).

(cherry picked from commit 2a4cbf1)
(cherry picked from commit 40d75c2)

---------

(cherry picked from commit f86b17a)

Co-authored-by: Jakub Stasiak <jakub@stasiak.at>
(cherry picked from commit 05a1467)

Add IPv6 addresses to suspignore.csv

That's a lot of semicolons!

(cherry picked from commit e366724)
icanhasmath added a commit to ActiveState/cpython that referenced this pull request Jul 8, 2024
rickprice pushed a commit to ActiveState/cpython that referenced this pull request Jul 12, 2024
…113179) (pythonGH-113186) (pythonGH-118177)

* Fix "private" (non-global) IP address ranges (pythonGH-113179) (pythonGH-113186)
(pythonGH-118177)

(cherry picked from commit f86b17a)

Co-authored-by: Jakub Stasiak <jakub@stasiak.at>
(cherry picked from commit 05a1467)

pythongh-113171: pythongh-65056: Fix "private" (non-global) IP address ranges
(pythonGH-113179) (pythonGH-113186) (pythonGH-118177)

* pythonGH-113171: Fix "private" (non-global) IP address ranges (pythonGH-113179)

The _private_networks variables, used by various is_private
implementations, were missing some ranges and at the same time had
overly strict ranges (where there are more specific ranges considered
globally reachable by the IANA registries).

This patch updates the ranges with what was missing or otherwise
incorrect.

100.64.0.0/10 is left alone, for now, as it's been made special in [1].

The _address_exclude_many() call returns 8 networks for IPv4, 121
networks for IPv6.

[1] python#61602

* pythonGH-65056: Improve the IP address' is_global/is_private documentation (pythonGH-113186)

It wasn't clear what the semantics of is_global/is_private are and, when
one gets to the bottom of it, it's not quite so simple (hence the
exceptions listed).

(cherry picked from commit 2a4cbf1)
(cherry picked from commit 40d75c2)

---------

(cherry picked from commit f86b17a)

Co-authored-by: Jakub Stasiak <jakub@stasiak.at>
(cherry picked from commit 05a1467)

Add IPv6 addresses to suspignore.csv

That's a lot of semicolons!

(cherry picked from commit e366724)
frenzymadness pushed a commit to frenzymadness/cpython that referenced this pull request Aug 13, 2024
… address ranges (pythonGH-113179) (pythonGH-113186) (pythonGH-118177) (pythonGH-118472)

The _private_networks variables, used by various is_private
implementations, were missing some ranges and at the same time had
overly strict ranges (where there are more specific ranges considered
globally reachable by the IANA registries).

This patch updates the ranges with what was missing or otherwise
incorrect.

100.64.0.0/10 is left alone, for now, as it's been made special in [1].

The _address_exclude_many() call returns 8 networks for IPv4, 121
networks for IPv6.

[1] python#61602

In 3.10 and below, is_private checks whether the network and broadcast
address are both private.
In later versions (where the test wss backported from), it checks
whether they both are in the same private network.

For 0.0.0.0/0, both 0.0.0.0 and 255.225.255.255 are private,
but one is in 0.0.0.0/8 ("This network") and the other in
255.255.255.255/32 ("Limited broadcast").

---------

Co-authored-by: Jakub Stasiak <jakub@stasiak.at>
frenzymadness pushed a commit to fedora-python/cpython that referenced this pull request Aug 15, 2024
… address ranges (pythonGH-113179) (pythonGH-113186) (pythonGH-118177) (pythonGH-118472)

The _private_networks variables, used by various is_private
implementations, were missing some ranges and at the same time had
overly strict ranges (where there are more specific ranges considered
globally reachable by the IANA registries).

This patch updates the ranges with what was missing or otherwise
incorrect.

100.64.0.0/10 is left alone, for now, as it's been made special in [1].

The _address_exclude_many() call returns 8 networks for IPv4, 121
networks for IPv6.

[1] python#61602

In 3.10 and below, is_private checks whether the network and broadcast
address are both private.
In later versions (where the test wss backported from), it checks
whether they both are in the same private network.

For 0.0.0.0/0, both 0.0.0.0 and 255.225.255.255 are private,
but one is in 0.0.0.0/8 ("This network") and the other in
255.255.255.255/32 ("Limited broadcast").

---------

Co-authored-by: Jakub Stasiak <jakub@stasiak.at>
stratakis pushed a commit to stratakis/cpython that referenced this pull request Aug 15, 2024
… address ranges (pythonGH-113179) (pythonGH-113186) (pythonGH-118177) (pythonGH-118472)

The _private_networks variables, used by various is_private
implementations, were missing some ranges and at the same time had
overly strict ranges (where there are more specific ranges considered
globally reachable by the IANA registries).

This patch updates the ranges with what was missing or otherwise
incorrect.

100.64.0.0/10 is left alone, for now, as it's been made special in [1].

The _address_exclude_many() call returns 8 networks for IPv4, 121
networks for IPv6.

[1] python#61602

In 3.10 and below, is_private checks whether the network and broadcast
address are both private.
In later versions (where the test wss backported from), it checks
whether they both are in the same private network.

For 0.0.0.0/0, both 0.0.0.0 and 255.225.255.255 are private,
but one is in 0.0.0.0/8 ("This network") and the other in
255.255.255.255/32 ("Limited broadcast").
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs backport to 3.9 only security fixes needs backport to 3.10 only security fixes needs backport to 3.11 only security fixes needs backport to 3.12 bug and security fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants