Skip to content

Commit 1865aad

Browse files
generatedunixname1734921407115435facebook-github-bot
authored andcommitted
Import upstream CPython branch '3.14'
Summary: Python `3.14.0rc2+` (`3.14`) was **published** on 2025-08-22 14:27:49+00:00. # Commit Info Base: (`3.14.0rc2+`) - `57c46013e352aa59c02701a0e6e43ddcb6a6095c` (commit date: 2025-08-22 08:11:38+00:00) Imported: (`3.14.0rc2+`) - `3.14` (commit date: 2025-08-22 14:27:49+00:00) # Files added ``` Misc/NEWS.d/next/Core_and_Builtins/2025-08-22-11-39-40.gh-issue-137384.j4b_in.rst ``` Reviewed By: itamaro Differential Revision: D80876028 fbshipit-source-id: 6075f686511b31e90cc99b9a84f9d84a0f868936
1 parent 2a9c459 commit 1865aad

4 files changed

Lines changed: 19 additions & 3 deletions

File tree

.github/workflows/tail-call.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,8 @@ jobs:
114114
find /usr/local/bin -lname '*/Library/Frameworks/Python.framework/*' -delete
115115
brew install llvm@${{ matrix.llvm }}
116116
export SDKROOT="$(xcrun --show-sdk-path)"
117-
export PATH="/usr/local/opt/llvm/bin:$PATH"
118-
export PATH="/opt/homebrew/opt/llvm/bin:$PATH"
117+
export PATH="/usr/local/opt/llvm@${{ matrix.llvm }}/bin:$PATH"
118+
export PATH="/opt/homebrew/opt/llvm@${{ matrix.llvm }}/bin:$PATH"
119119
CC=clang-20 ./configure --with-tail-call-interp
120120
make all --jobs 4
121121
./python.exe -m test --multiprocess 0 --timeout 4500 --verbose2 --verbose3

Lib/test/test_gc.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1522,6 +1522,19 @@ def test_ast_fini(self):
15221522
""")
15231523
assert_python_ok("-c", code)
15241524

1525+
def test_warnings_fini(self):
1526+
# See https://github.com/python/cpython/issues/137384
1527+
code = textwrap.dedent('''
1528+
import asyncio
1529+
from contextvars import ContextVar
1530+
1531+
context_loop = ContextVar("context_loop", default=None)
1532+
loop = asyncio.new_event_loop()
1533+
context_loop.set(loop)
1534+
''')
1535+
1536+
assert_python_ok("-c", code)
1537+
15251538

15261539
def setUpModule():
15271540
global enabled, debug
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix a crash when using the :mod:`warnings` module in a finalizer at shutdown. Patch by Kumar Aditya.

Python/pystate.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -914,7 +914,6 @@ interpreter_clear(PyInterpreterState *interp, PyThreadState *tstate)
914914
_Py_ClearExecutorDeletionList(interp);
915915
#endif
916916
_PyAST_Fini(interp);
917-
_PyWarnings_Fini(interp);
918917
_PyAtExit_Fini(interp);
919918

920919
// All Python types must be destroyed before the last GC collection. Python
@@ -925,6 +924,9 @@ interpreter_clear(PyInterpreterState *interp, PyThreadState *tstate)
925924
_PyGC_CollectNoFail(tstate);
926925
_PyGC_Fini(interp);
927926

927+
// Finalize warnings after last gc so that any finalizers can
928+
// access warnings state
929+
_PyWarnings_Fini(interp);
928930
/* We don't clear sysdict and builtins until the end of this function.
929931
Because clearing other attributes can execute arbitrary Python code
930932
which requires sysdict and builtins. */

0 commit comments

Comments
 (0)