Commit Graph

53622 Commits

Author SHA1 Message Date
Xuanteng Huang 35df4eb959
gh-126072: do not add `None` to `co_consts` if there is no docstring (GH-126101) 2024-10-30 09:01:09 +00:00
Brian Schubert 224c370a36
gh-126139: Improve error message location for future statement with unknown feature (#126140) 2024-10-29 23:57:59 +00:00
Pablo Galindo Salgado 9dfef4e5f4
gh-125588: Teach the python PEG generator the new f-string tokens (#125589)
Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
2024-10-29 23:40:12 +00:00
Kirill Podoprigora 4877e33708
gh-126146: Remove ``__cmp__`` method from tests (#126147)
Remove ``__cmp__`` method from the tests because it was removed in 3.0 version.
2024-10-30 00:47:26 +02:00
Barney Gale 6742f14dfd
GH-125866: Improve tests for `pathname2url()` and `url2pathname()` (#125993)
Merge `URL2PathNameTests` and `PathName2URLTests` test cases (which test
only the Windows-specific implementations from `nturl2path`) into the main
`Pathname_Tests` test case for these functions.

Copy/port some test cases for `pathlib.Path.as_uri()` and `from_uri()`.
2024-10-29 20:44:57 +00:00
Christian Ullrich 802d405ff1
gh-126084: Fix venvwlauncher.exe to run pythonw.exe (GH-126088) 2024-10-29 19:52:52 +00:00
Tomas R. aab58a93ef
gh-118423: Add `INSTRUCTION_SIZE` macro to code generator (GH-125467) 2024-10-29 17:25:05 +00:00
sobolevn b2eaa75b17
gh-126105: Fix crash in `ast` module, when `._fields` is deleted (#126115)
Previously, if the `ast.AST._fields` attribute was deleted, attempts to create a new `as`t node would crash due to the assumption that `_fields` always had a non-NULL value. Now it has been fixed by adding an extra check to ensure that `_fields` does not have a NULL value (this can happen when you manually remove `_fields` attribute).
2024-10-29 17:42:48 +02:00
Mark Shannon faa3272fb8
GH-125837: Split `LOAD_CONST` into three. (GH-125972)
* Add LOAD_CONST_IMMORTAL opcode

* Add LOAD_SMALL_INT opcode

* Remove RETURN_CONST opcode
2024-10-29 11:15:42 +00:00
Taneli Hukkinen 67f5c5bd6f
tomllib: Add a comment about implicit lru_cache bound (GH-126078) 2024-10-29 11:36:14 +01:00
Sergey B Kirpichev 9b14083497
Align functools.reduce() docstring with PEP-257 (#126045)
Yak-shave in preparation for Argument Clinic adaption in gh-125999.
2024-10-29 08:08:08 +00:00
sobolevn aeafaf4cda
gh-126014: Ignore `__pycache__`-only folders in makefile tests (#126066)
Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
2024-10-29 10:43:48 +03:00
Tomas R. 6870eb3f73
gh-124295: Skip translation tests when pygettext is missing (GH-126051) 2024-10-27 18:09:08 +00:00
Bénédikt Tran ed5059eeb1
gh-125966: fix use-after-free on `fut->fut_callback0` due to an evil callback's `__eq__` in asyncio (#125967) 2024-10-27 22:40:10 +05:30
Tomas R. 0922a4ae0d
gh-124295: Add translation tests for argparse (GH-124803) 2024-10-27 18:52:31 +02:00
Bénédikt Tran f819d4301d
gh-125984: fix use-after-free on `fut->fut_{callback,context}0` due to an evil `loop.__getattribute__` (#126003) 2024-10-27 20:34:43 +05:30
devdanzin 80eec52fc8
gh-126018: Avoid aborting due to unnecessary assert in `sys.audit` (#126020)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-10-27 07:41:42 -07:00
Brian Schubert dc76a4ad3c
gh-126012: Add `__class_getitem__` to `memoryview` (#126013)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2024-10-27 13:36:03 +03:00
Zhikang Yan dad3453129
gh-125633: Add function `ispackage` to stdlib `inspect` (#125634)
---------

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2024-10-27 14:57:43 +10:00
Malcolm Smith c51b56038b
Android: Update tests for newly-available functions affected by SELinux (#126015)
Skip tests on Android that involve use of SELinux-protected methods.
2024-10-27 10:35:53 +08:00
devdanzin 44becb8cba
gh-125666: Avoid PyREPL exiting when a null byte is in input (#125732) 2024-10-27 01:23:53 +00:00
Bogdan Romanyuk 51b012b2a8
gh-125593: Use colors to highlight error locations in tracebacks from exception group (#125681) 2024-10-27 01:57:10 +01:00
Bénédikt Tran c5b99f5c2c
gh-125969: fix OOB in `future_schedule_callbacks` due to an evil `call_soon` (#125970)
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2024-10-25 23:45:09 +05:30
Jun Komoda 1384409460
gh-125783: Add tests to prevent regressions with the combination of `ctypes` and metaclasses. (GH-125881) 2024-10-25 18:31:35 +02:00
Kumar Aditya cae853e3b4
GH-125789: fix `fut._callbacks` to always return a copy of callbacks (#125922)
Fix `asyncio.Future._callbacks` to always return a copy of the internal list of callbacks to avoid mutation from user code affecting the internal state.
2024-10-25 18:19:30 +05:30
Victor Stinner db96327203
gh-121654: Add PyType_Freeze() function (#122457)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2024-10-25 11:12:48 +02:00
Russell Keith-Magee 75401febc9
gh-123930: Correct test of attribute failure to account for iOS (#125959)
Update a test of importing attributes from binary modules to account for iOS conditions.
2024-10-25 07:18:45 +00:00
Tian Gao 2513593303
Fixed a few type mismatches in pdb (#125952) 2024-10-25 00:17:58 -04:00
Malcolm Smith 371c537dff
Increase minimum Android API level to 24 (#125946)
Minimum Android API level has been increased to 24 (Android 7.0).
2024-10-25 08:41:07 +08:00
Malcolm Smith b08570c90e
gh-125942: Android: set stdout to `errors="backslashreplace"` (#125943)
Android stdout/err streams now use `backslashreplace` encoding to ensure readability of the Android log.
2024-10-25 08:35:41 +08:00
Sam Gross fed501d724
gh-125245: Fix race condition when importing `collections.abc` (#125415)
If multiple threads concurrently imported `collections.abc`, some of the
threads might incorrectly see the "shim" `Lib/collections/abc.py` module
instead of the correct `Lib/_collections_abc.py` module.  This affected
both the free threading build and the default GIL-enabled build.
2024-10-24 18:12:51 -04:00
Sam Gross 332356b880
gh-125900: Clean-up logic around immortalization in free-threading (#125901)
* Remove `@suppress_immortalization` decorator
* Make suppression flag per-thread instead of per-interpreter
* Suppress immortalization in `eval()` to avoid refleaks in three tests
  (test_datetime.test_roundtrip, test_logging.test_config8_ok, and
   test_random.test_after_fork).
* frozenset() is constant, but not a singleton. When run multiple times,
  the test could fail due to constant interning.
2024-10-24 18:09:59 -04:00
Shantanu 500f5338a8
gh-123930: Better error for "from imports" when script shadows module (#123929) 2024-10-24 12:11:12 -07:00
Javad Shafique 3f24bde0b6
gh-118950: Fix SSLProtocol.connection_lost not being called when OSError is thrown (#118960)
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2024-10-24 17:41:16 +00:00
Peter Bierma 41bd9d959c
gh-125864: Propagate `pickle.loads()` failures in `InterpreterPoolExecutor` (gh-125898)
Authored-by: Peter Bierma <zintensitydev@gmail.com>
2024-10-24 10:51:45 -06:00
Sam Gross ad6110a93f
gh-125842: Fix `sys.exit(0xffff_ffff)` on Windows (#125896)
On Windows, `long` is a signed 32-bit integer so it can't represent
`0xffff_ffff` without overflow. Windows exit codes are unsigned 32-bit
integers, so if a child process exits with `-1`, it will be represented
as `0xffff_ffff`.

Also fix a number of other possible cases where `_Py_HandleSystemExit`
could return with an exception set, leading to a `SystemError` (or
fatal error in debug builds) later on during shutdown.
2024-10-24 12:03:50 -04:00
Sam Gross e545ead66c
gh-125859: Fix crash when `gc.get_objects` is called during GC (#125882)
This fixes a crash when `gc.get_objects()` or `gc.get_referrers()` is
called during a GC in the free threading build.

Switch to `_PyObjectStack` to avoid corrupting the `struct worklist`
linked list maintained by the GC. Also, don't return objects that are frozen
(`gc.freeze()`) or in the process of being collected to more closely match
the behavior of the default build.
2024-10-24 09:33:11 -04:00
Mark Shannon b61fece852
GH-125868: Fix STORE_ATTR_WITH_HINT specialization (GH-125876) 2024-10-24 11:57:02 +01:00
Jelle Zijlstra d3be6f945a
gh-125614: annotationlib: Fix bug where not all Stringifiers are converted (#125635) 2024-10-23 16:27:55 -07:00
Tian Gao 8f2c0f7a03
gh-125884: Support breakpoint on functions with annotations (#125892) 2024-10-23 18:04:30 -04:00
Petr Viktorin 13c9fa3d64
gh-121938: ctypes: Skip test of _pack_-ed struct with c_int64 on x86 (GH-125877)
The current auto-generated tests don't cover this; it's instead
tested manually.
2024-10-23 16:37:06 -05:00
Wulian 9c01db40aa
gh-125665: Update turtledemo docstrings with correct file names (#125691)
Co-authored-by: Wulian <xiguawulian@gmail.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2024-10-23 16:29:32 -04:00
Serhiy Storchaka 834ba5aaf2
gh-58032: Deprecate the argparse.FileType type converter (GH-124664) 2024-10-23 10:50:29 +03:00
Jacob Walls c75ff2ef8e
gh-80958: unittest: discovery support for namespace packages as start directory (#123820) 2024-10-23 13:41:33 +09:00
Mario Šaško 34653bba64
gh-125259: Fix error notes removal in enum initialization (GH-125647) 2024-10-22 13:42:22 -07:00
Ethan Furman aaed91cabc
gh-125710: [Enum] fix hashable<->nonhashable comparisons for member values (GH-125735) 2024-10-22 11:04:00 -07:00
Mikhail Efimov 079875e395
gh-125038: Fix crash after genexpr.gi_frame.f_locals manipulations (#125178) 2024-10-22 09:00:25 -07:00
Serhiy Storchaka 759a54d28f
gh-125355: Rewrite parse_intermixed_args() in argparse (GH-125356)
* The parser no longer changes temporarily during parsing.
* Default values are not processed twice.
* Required mutually exclusive groups containing positional arguments are
  now supported.
* The missing arguments report now includes the names of all required
  optional and positional arguments.
* Unknown options can be intermixed with positional arguments in
  parse_known_intermixed_args().
2024-10-22 10:57:25 +00:00
Mark Shannon 57e3c59bb6
GH-125521: Remove `if (true)` from generated output to reduce C compiler warnings (GH-125700) 2024-10-22 10:11:29 +01:00
Mikhail Efimov 4efe64aa56
gh-125811: Remove DeprecationWarnings in test_peg_generator (#125812) 2024-10-22 09:41:30 +01:00
Y5 d48cc82ed2
gh-124651: Quote template strings in `venv` activation scripts (GH-124712)
This patch properly quotes template strings in `venv` activation
scripts. This mitigates potential command injection.
2024-10-21 21:48:04 +01:00
Serhiy Storchaka 9dde4638e4
gh-53203: Fix test_strptime on Solaris (GH-125785)
Use fixed timezone.
Skip roundtrip tests on locales with 2-digit year.
2024-10-21 22:17:39 +03:00
Serhiy Storchaka dcc4fb2c90
gh-124969: Make locale.nl_langinfo(locale.ALT_DIGITS) returning a string again (GH-125774)
This is a follow up of GH-124974. Only Glibc needed a fix.
Now the returned value is a string consisting of semicolon-separated
symbols on all Posix platforms.
2024-10-21 18:54:12 +00:00
Serhiy Storchaka 5ca4e34bc1
gh-125767: Fix pickling and copying of super objects (GH-125781)
Previously, copying a super object returned a copy of the instance
invoking super(). Pickling a super object could pickle the instance
invoking super() or fail, depending on its type and protocol.

Now deep copying returns a new super object and pickling pickles the super
object. Shallow copying returns the same super object.
2024-10-21 21:30:45 +03:00
Tian Gao 5b7a872b26
gh-125590: Allow FrameLocalsProxy to delete and pop keys from extra locals (#125616) 2024-10-21 11:43:08 -04:00
Sam Gross 5989eb7446
gh-125608: Trigger dictionary watchers when inline values change (#125611)
Dictionary watchers on an object's attributes dictionary
(`object.__dict__`) were not triggered when the managed dictionary used
the object's inline values.
2024-10-21 08:23:38 -04:00
Alex Waygood c5c21fee7a
gh-125519: Improve traceback if `importlib.reload()` is called with a non-module object (#125520) 2024-10-21 07:53:21 +01:00
Tian Gao 8f5e39d5c8
gh-125378: Trigger a repeat for the full multi-line statement for empty line command (#125717) 2024-10-19 17:46:57 -04:00
Peter Bierma 4c53b25775
gh-124984: Enhance `ssl` thread safety (#124993)
Make SSL objects thread safe in Free Theaded build by
using critical sections.

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-10-19 23:16:36 +02:00
Julien 2a378dba98
gh-125398: Convert paths in venv activate script when using Git Bash under Windows (GH-125399)
* Convert paths in venv activate script when using Git Bash under Windows

With https://github.com/python/cpython/pull/112508 the check to converts paths when running on Windows was changed from using the non-posix environment variable `$OSTYPE` to using `uname` instead.

However this missed the fact that when running under Git Bash on Windows, uname reports `MINGW*` (`$OSTYPE` is still `msys`).

This results in `$PATH` being set to something like `D:\a\github-actions-shells\github-actions-shells\venv/Scripts:…`, instead of `/d/a/github-actions-shells/github-actions-shells/venv/Scripts`.

Notably, the Git Bash is the bash shell that’s used for GitHub Actions Windows runners, and ships with VSCode.
2024-10-19 18:34:41 +01:00
Irit Katriel 4b421e8aca
gh-125522: Fix bare except in test_math.testTan (#125544) 2024-10-19 12:49:14 +01:00
Serhiy Storchaka a7443a1735
gh-52551: Use wcsftime() to implement time.strftime() on Windows (GH-125658) 2024-10-19 11:29:51 +03:00
Eric Snow 322f14eeff
gh-124694: In test_interpreter_pool, Restore the Asyncio Event Loop Policy During Cleanup (gh-125708)
This resolves a failure on the android buildbot.
2024-10-18 16:05:12 -06:00
Serhiy Storchaka 2e950e3419
Add tests for time.strftime() with invalid format string (GH-125696) 2024-10-18 16:51:29 +03:00
RUANG (Roy James) 10c4c95395
gh-123610: Added additional types to ctypes/wintypes.py (GH-124086) 2024-10-18 13:45:17 +01:00
Nice Zombies df751363e3
gh-125660: Reject invalid unicode escapes for Python implementation of JSON decoder (GH-125683) 2024-10-18 15:29:47 +03:00
Nice Zombies d358425e69
gh-125682: Reject non-ASCII digits in the Python implementation of JSON decoder (GH-125687) 2024-10-18 15:26:29 +03:00
Furkan Onder a0f5c8e627
gh-125620: Skip check_resource_tracker_death on NetBSD due to long wait for SIGKILL process termination (GH-125621)
* Skip test_resource_tracker_sigkill on NetBSD
2024-10-17 19:08:34 -07:00
Tian Gao 77cebb1ce9
gh-125600: Only show stale code warning on source code display commands (#125601) 2024-10-17 20:29:11 -04:00
Jelle Zijlstra f203d1cb52
gh-125017: Fix crash on premature access to classmethod/staticmethod annotations (#125636) 2024-10-17 09:45:25 -07:00
George Pittock 04d6dd23e2
gh-113570: reprlib.repr does not use builtin __repr__ for reshadowed builtins (GH-113577) 2024-10-17 16:34:37 +00:00
Serhiy Storchaka ad3eac1963
gh-52551: Fix encoding issues in strftime() (GH-125193)
Fix time.strftime(), the strftime() method and formatting of the
datetime classes datetime, date and time.

* Characters not encodable in the current locale are now acceptable in
  the format string.
* Surrogate pairs and sequence of surrogatescape-encoded bytes are no
  longer recombinated.
* Embedded null character no longer terminates the format string.

This fixes also gh-78662 and gh-124531.
2024-10-17 15:46:59 +00:00
Wulian c124577ebe
gh-123370: Fix the canvas not clearing after running turtledemo.clock (#123457)
Rewriting the day and date every tick somehow prevented them from being removed either by clicking STOP or loading another example.  The solution is to rewrite them only when they change.
2024-10-17 11:23:37 -04:00
Savannah Ostrowski 7b04496e5c
gh-125542: Deprecate prefix_chars in ArgumentParser.add_argument_group() (GH-125563) 2024-10-17 09:11:47 +00:00
Savannah Ostrowski 624be8699a
GH-99749: Add optional feature to suggest correct names (ArgumentParser) (GH-124456) 2024-10-17 10:07:37 +03:00
Eric Snow a5a7f5e16d
gh-124694: Add concurrent.futures.InterpreterPoolExecutor (gh-124548)
This is an implementation of InterpreterPoolExecutor that builds on ThreadPoolExecutor.

(Note that this is not tied to PEP 734, which is strictly about adding a new stdlib module.)

Possible future improvements:

* support passing a script for the initializer or to submit()
* support passing (most) arbitrary functions without pickling
* support passing closures
* optionally exec functions against __main__ instead of the their original module
2024-10-16 16:50:46 -06:00
Furkan Onder a38fef4439
gh-125620: Remove unnecessary import of subprocess in spawnv_passfds (#125624)
Remove unnecessary import of subprocess in multiprocessing.util.spawnv_passfds.
2024-10-16 22:42:29 +00:00
Vincent Fazio aecbc2e6f4
gh-115382: Fix cross compiles when host and target use same SOABI
Co-authored-by: Erlend E. Aasland <erlend@python.org>
2024-10-16 23:01:42 +01:00
Sam Gross 760872efec
gh-125451: Fix deadlock in ProcessPoolExecutor shutdown (#125492)
There was a deadlock when `ProcessPoolExecutor` shuts down at the same
time that a queueing thread handles an error processing a task.

Don't use `_shutdown_lock` to protect the `_ThreadWakeup` pipes -- use
an internal lock instead. This fixes the ordering deadlock where the
`ExecutorManagerThread` holds the `_shutdown_lock` and joins the
queueing thread, while the queueing thread is attempting to acquire the
`_shutdown_lock` while closing the `_ThreadWakeup`.
2024-10-16 11:39:17 -04:00
Michał Górny e4d90be845
gh-125584: Require network resource in ``test_urllib2.HandlerTests.test_ftp_error`` (#125586) 2024-10-16 13:24:41 +00:00
Kirill Podoprigora bee112a94d
gh-124872: Replace enter/exit events with "switched" (#125532)
Users want to know when the current context switches to a different
context object.  Right now this happens when and only when a context
is entered or exited, so the enter and exit events are synonymous with
"switched".  However, if the changes proposed for gh-99633 are
implemented, the current context will also switch for reasons other
than context enter or exit.  Since users actually care about context
switches and not enter or exit, replace the enter and exit events with
a single switched event.

The former exit event was emitted just before exiting the context.
The new switched event is emitted after the context is exited to match
the semantics users expect of an event with a past-tense name.  If
users need the ability to clean up before the switch takes effect,
another event type can be added in the future.  It is not added here
because YAGNI.

I skipped 0 in the enum as a matter of practice.  Skipping 0 makes it
easier to troubleshoot when code forgets to set zeroed memory, and it
aligns with best practices for other tools (e.g.,
https://protobuf.dev/programming-guides/dos-donts/#unspecified-enum).

Co-authored-by: Richard Hansen <rhansen@rhansen.org>
Co-authored-by: Victor Stinner <vstinner@python.org>
2024-10-16 13:53:21 +02:00
Hugo van Kemenade 37e533a397 Merge remote-tracking branch 'upstream/main' 2024-10-16 01:13:48 +03:00
Tian Gao 12eaadc0ad
gh-58956: Set f_trace on frames with breakpoints after setting a new breakpoint (#124454) 2024-10-15 15:56:33 -04:00
Hugo van Kemenade 8cdaca8b25 Python 3.14.0a1 2024-10-15 22:34:54 +03:00
Tian Gao 9c2bb7d551
gh-125115: Pass unknown pdb command line args to script instead of fail (#125424)
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
2024-10-15 15:30:28 -04:00
Mikhail Efimov aac89b54c5
gh-125206: Bug in ctypes with old libffi is fixed (#125322)
Workaround for old libffi versions is added.
Module ctypes now supports C11 double complex only with libffi >= 3.3.0.

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2024-10-15 16:17:10 +00:00
Irit Katriel e97910cdb7
gh-125522 : add explicit exception types to bare excepts in tests (#125523) 2024-10-15 17:00:04 +01:00
Tian Gao bb9604b62a
gh-100141: Allow pdb to deal with empty file (#125425) 2024-10-15 11:45:23 -04:00
Victor Stinner c6e8ff86b2
gh-125451: Skip concurrent.futures test_processes_terminate() (#125533)
The test hangs randomly. It tries to serialize local lock and a local
function which are not possible.
2024-10-15 15:42:55 +00:00
Tian Gao 703227dd02
gh-125422: Don't set the caller's f_trace if it's botframe (#125427) 2024-10-15 10:51:37 -04:00
Kirill Podoprigora d3c82b9cce
gh-125512: Revert "gh-124872: Replace enter/exit events with "switched" (#124776)" (#125513) 2024-10-15 17:42:16 +03:00
Irit Katriel 55c4f4c30b
gh-125514: fix bug in test_traceback utility. Specify exception types in except: clauses (#125516) 2024-10-15 15:11:02 +01:00
Petr Viktorin cc5a225cdc
gh-125041: test_zlib: For s390x HW acceleration, only skip checking the compressed bytes (#125042) 2024-10-15 11:29:43 +00:00
foreignmeloman fcef3fc9a5
gh-119535: Support 𝜋thon in Python 3.14 venvs (#125035) 2024-10-15 13:26:19 +03:00
Serhiy Storchaka 92af191a6a
gh-53203: Fix strptime() tests for %X on glibc < 2.29 (#125469) 2024-10-15 11:05:40 +03:00
Thomas Grainger 0b28ea4a35
gh-124958: Revert "gh-125472: Revert "gh-124958: fix asyncio.TaskGroup and _PyFuture refcycles ... (#125486)
* Revert "gh-125472: Revert "gh-124958: fix asyncio.TaskGroup and _PyFuture refcycles (#12… (#125476)"

This reverts commit e99650b80a.

* fix incompatability with gh-124392
2024-10-14 15:45:58 -07:00
Terry Jan Reedy 3fea1d000e
Fix idlelib typos (#125484)
Propagate fixes in Doc/library/idle.rst to help.html.
Change 'interruptable' to 'interruptible' in run.py.
The latter was reported by ember91 in PR 125473.
2024-10-14 17:11:58 -04:00
Richard Hansen 843d28f59d
gh-124872: Replace enter/exit events with "switched" (#124776)
Users want to know when the current context switches to a different
context object.  Right now this happens when and only when a context
is entered or exited, so the enter and exit events are synonymous with
"switched".  However, if the changes proposed for gh-99633 are
implemented, the current context will also switch for reasons other
than context enter or exit.  Since users actually care about context
switches and not enter or exit, replace the enter and exit events with
a single switched event.

The former exit event was emitted just before exiting the context.
The new switched event is emitted after the context is exited to match
the semantics users expect of an event with a past-tense name.  If
users need the ability to clean up before the switch takes effect,
another event type can be added in the future.  It is not added here
because YAGNI.

I skipped 0 in the enum as a matter of practice.  Skipping 0 makes it
easier to troubleshoot when code forgets to set zeroed memory, and it
aligns with best practices for other tools (e.g.,
https://protobuf.dev/programming-guides/dos-donts/#unspecified-enum).
2024-10-14 12:28:41 -07:00
Kirill Podoprigora e99650b80a
gh-125472: Revert "gh-124958: fix asyncio.TaskGroup and _PyFuture refcycles (#12… (#125476)
Revert "gh-124958: fix asyncio.TaskGroup and _PyFuture refcycles (#124959)"

This reverts commit d5dbbf4372.
2024-10-14 17:59:13 +00:00
Thomas Grainger d5dbbf4372
gh-124958: fix asyncio.TaskGroup and _PyFuture refcycles (#124959) 2024-10-14 08:19:56 -07:00