René's URL Explorer Experiment


Title: use-after-free: functools partial · Issue #154189 · python/cpython · GitHub

Open Graph Title: use-after-free: functools partial · Issue #154189 · python/cpython

X Title: use-after-free: functools partial · Issue #154189 · python/cpython

Description: Bug report Bug description: Similar to #144475 although this is a use after free gap. def test_call_safety_against_reentrant_mutation(self): partial = self.partial def original(*args, **kwargs): return "original" def replacement(*args, *...

Open Graph Description: Bug report Bug description: Similar to #144475 although this is a use after free gap. def test_call_safety_against_reentrant_mutation(self): partial = self.partial def original(*args, **kwargs): re...

X Description: Bug report Bug description: Similar to #144475 although this is a use after free gap. def test_call_safety_against_reentrant_mutation(self): partial = self.partial def original(*args, **kwargs): re...

Opengraph URL: https://github.com/python/cpython/issues/154189

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"use-after-free: functools partial","articleBody":"# Bug report\n\n### Bug description:\n\nSimilar to https://github.com/python/cpython/issues/144475 although this is a use after free gap. \n\n```\ndef test_call_safety_against_reentrant_mutation(self):\n        partial = self.partial\n\n        def original(*args, **kwargs):\n            return \"original\"\n\n        def replacement(*args, **kwargs):\n            return \"replacement\"\n\n        g = None\n\n        class EvilKey(str):\n            armed = False\n            def __hash__(self):\n                if EvilKey.armed and g is not None:\n                    EvilKey.armed = False\n                    # Reset g, freeing the old (uniquely referenced) args\n                    # tuple.  New args of a different length avoid recycling\n                    # that freed block, so any dangling read hits freed memory.\n                    g.__setstate__((replacement, (), {\"k\": 1}, None))\n                    gc.collect()\n                return str.__hash__(self)\n            def __eq__(self, other):\n                return str.__eq__(self, other)\n\n        # Stored positionals (non-trivial pto->args) plus a stored keyword so\n        # the keyword-merge path -- which hashes the call keywords -- runs.\n        stored = tuple(object() for _ in range(5))\n        g = partial(original, *stored, k=0)\n        del stored\n\n        ek = EvilKey(\"zzz\")\n        kwargs = {ek: 2}          # hashed here while disarmed: no re-entrancy\n        EvilKey.armed = True\n        # Must not crash (use-after-free in the C partial before the fix).\n        g(**kwargs)\n        self.assertFalse(EvilKey.armed)  # the re-entrant __setstate__ ran\n```\n\nInside of `partial_vectorcall` we store a raw pointer of `pto->args` in `pto_args`, however with the EvilKey we can reset `pto->args` causing a UAF gap. \n\nUnsure how much of an issue this is though.\n\n\u003cdetails>\n./python.exe -m test test_functools -v -m test_call_safety_against_reentrant_mutation\n== CPython 3.16.0a0 free-threading build (heads/find-memory-leaks-dirty:69d44f80b5, Jul 19 2026, 20:02:27) [Clang 21.0.0 (clang-2100.0.123.102)]\n== macOS-26.3.2-arm64-arm-64bit-Mach-O little-endian\n== Python build: free_threading debug TSAN\n== cwd: /Users/johng/repos/cpython/build/test_python_worker_6548æ\n== CPU count: 18\n== encodings: locale=UTF-8 FS=utf-8\n== resources: all test resources are disabled, use -u option to unskip tests\n== sanitizers: thread\n\nUsing random seed: 952320050\n0:00:00 load avg: 4.25 mem: 131.7 MiB Run 1 test sequentially in a single process\n0:00:00 load avg: 4.25 mem: 131.7 MiB [1/1] test_functools\ntest_call_safety_against_reentrant_mutation (test.test_functools.TestPartialC.test_call_safety_against_reentrant_mutation) ... Fatal Python error: Segmentation fault\n\n\u003cCannot show all threads while the GIL is disabled>\nStack (most recent call first):\n  File \"/Users/johng/repos/cpython/Lib/test/test_functools.py\", line 622 in test_call_safety_against_reentrant_mutation\n  File \"/Users/johng/repos/cpython/Lib/unittest/case.py\", line 637 in _callTestMethod\n  File \"/Users/johng/repos/cpython/Lib/unittest/case.py\", line 691 in run\n  File \"/Users/johng/repos/cpython/Lib/unittest/case.py\", line 747 in __call__\n  File \"/Users/johng/repos/cpython/Lib/unittest/suite.py\", line 122 in run\n  File \"/Users/johng/repos/cpython/Lib/unittest/suite.py\", line 84 in __call__\n  File \"/Users/johng/repos/cpython/Lib/unittest/suite.py\", line 122 in run\n  File \"/Users/johng/repos/cpython/Lib/unittest/suite.py\", line 84 in __call__\n  File \"/Users/johng/repos/cpython/Lib/unittest/runner.py\", line 256 in run\n  File \"/Users/johng/repos/cpython/Lib/test/libregrtest/single.py\", line 84 in _run_suite\n  File \"/Users/johng/repos/cpython/Lib/test/libregrtest/single.py\", line 42 in run_unittest\n  File \"/Users/johng/repos/cpython/Lib/test/libregrtest/single.py\", line 162 in test_func\n  File \"/Users/johng/repos/cpython/Lib/test/libregrtest/single.py\", line 118 in regrtest_runner\n  File \"/Users/johng/repos/cpython/Lib/test/libregrtest/single.py\", line 165 in _load_run_test\n  File \"/Users/johng/repos/cpython/Lib/test/libregrtest/single.py\", line 210 in _runtest_env_changed_exc\n  File \"/Users/johng/repos/cpython/Lib/test/libregrtest/single.py\", line 319 in _runtest\n  File \"/Users/johng/repos/cpython/Lib/test/libregrtest/single.py\", line 348 in run_single_test\n  File \"/Users/johng/repos/cpython/Lib/test/libregrtest/main.py\", line 390 in run_test\n  File \"/Users/johng/repos/cpython/Lib/test/libregrtest/main.py\", line 425 in run_tests_sequentially\n  File \"/Users/johng/repos/cpython/Lib/test/libregrtest/main.py\", line 565 in _run_tests\n  File \"/Users/johng/repos/cpython/Lib/test/libregrtest/main.py\", line 600 in run_tests\n  File \"/Users/johng/repos/cpython/Lib/test/libregrtest/main.py\", line 793 in main\n  File \"/Users/johng/repos/cpython/Lib/test/libregrtest/main.py\", line 801 in main\n  File \"/Users/johng/repos/cpython/Lib/test/__main__.py\", line 2 in \u003cmodule>\n  File \"/Users/johng/repos/cpython/Lib/runpy.py\", line 87 in _run_code\n  File \"/Users/johng/repos/cpython/Lib/runpy.py\", line 201 in _run_module_as_main\n\nCurrent thread's C stack trace (most recent call first):\n  Binary file \"/Users/johng/repos/cpython/python.exe\", at _Py_DumpStack+0x44 [0x102720a10]\n  Binary file \"/Users/johng/repos/cpython/python.exe\", at faulthandler_fatal_error+0x2c4 [0x10274efac]\n  Binary file \"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/21/lib/darwin/libclang_rt.tsan_osx_dynamic.dylib\", at _ZN6__tsanL21CallUserSignalHandlerEPNS_11ThreadStateEbbiPN11__sanitizer23__sanitizer_siginfo_padEPv+0xfc [0x103405274]\n  Binary file \"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/21/lib/darwin/libclang_rt.tsan_osx_dynamic.dylib\", at _Z10sighandleriPN11__sanitizer23__sanitizer_siginfo_padEPv+0x1cc [0x1034054d4]\n  Binary file \"/usr/lib/system/libsystem_platform.dylib\", at _sigtramp+0x38 [0x1963f1764]\n  Binary file \"/Users/johng/repos/cpython/python.exe\", at partial_vectorcall+0x370 [0x10282204c]\n  Binary file \"/Users/johng/repos/cpython/python.exe\", at partial_vectorcall+0x370 [0x10282204c]\n  Binary file \"/Users/johng/repos/cpython/python.exe\", at _PyVectorcall_Call+0xe4 [0x10247f7b0]\n  Binary file \"/Users/johng/repos/cpython/python.exe\", at _PyEval_EvalFrameDefault+0x837c [0x102628d40]\n  Binary file \"/Users/johng/repos/cpython/python.exe\", at _PyEval_Vector+0x350 [0x10261ec5c]\n  Binary file \"/Users/johng/repos/cpython/python.exe\", at _PyObject_VectorcallTstate+0x74 [0x10247e938]\n  Binary file \"/Users/johng/repos/cpython/python.exe\", at _PyObject_VectorcallPrepend+0x154 [0x102480b4c]\n  Binary file \"/Users/johng/repos/cpython/python.exe\", at _PyEval_EvalFrameDefault+0x837c [0x102628d40]\n  Binary file \"/Users/johng/repos/cpython/python.exe\", at _PyEval_Vector+0x350 [0x10261ec5c]\n  Binary file \"/Users/johng/repos/cpython/python.exe\", at _PyObject_VectorcallDictTstate+0x170 [0x10247eb30]\n  Binary file \"/Users/johng/repos/cpython/python.exe\", at _PyObject_Call_Prepend+0xd4 [0x10247fdb4]\n  Binary file \"/Users/johng/repos/cpython/python.exe\", at call_method+0x9c [0x10255c8c0]\n  Binary file \"/Users/johng/repos/cpython/python.exe\", at _PyObject_MakeTpCall+0x120 [0x10247ed18]\n  Binary file \"/Users/johng/repos/cpython/python.exe\", at _Py_VectorCall_StackRefSteal+0x118 [0x10261ee60]\n  Binary file \"/Users/johng/repos/cpython/python.exe\", at _PyEval_EvalFrameDefault+0xb8cc [0x10262c290]\n  Binary file \"/Users/johng/repos/cpython/python.exe\", at _PyEval_Vector+0x350 [0x10261ec5c]\n  Binary file \"/Users/johng/repos/cpython/python.exe\", at _PyObject_VectorcallTstate+0x74 [0x10247e938]\n  Binary file \"/Users/johng/repos/cpython/python.exe\", at _PyObject_VectorcallPrepend+0x154 [0x102480b4c]\n  Binary file \"/Users/johng/repos/cpython/python.exe\", at _PyEval_EvalFrameDefault+0x798c [0x102628350]\n  Binary file \"/Users/johng/repos/cpython/python.exe\", at _PyEval_Vector+0x350 [0x10261ec5c]\n  Binary file \"/Users/johng/repos/cpython/python.exe\", at _PyObject_VectorcallDictTstate+0x170 [0x10247eb30]\n  Binary file \"/Users/johng/repos/cpython/python.exe\", at _PyObject_Call_Prepend+0xd4 [0x10247fdb4]\n  Binary file \"/Users/johng/repos/cpython/python.exe\", at call_method+0x9c [0x10255c8c0]\n  Binary file \"/Users/johng/repos/cpython/python.exe\", at _PyObject_MakeTpCall+0x120 [0x10247ed18]\n  Binary file \"/Users/johng/repos/cpython/python.exe\", at _Py_VectorCall_StackRefSteal+0x118 [0x10261ee60]\n  Binary file \"/Users/johng/repos/cpython/python.exe\", at _PyEval_EvalFrameDefault+0xb8cc [0x10262c290]\n  Binary file \"/Users/johng/repos/cpython/python.exe\", at _PyEval_Vector+0x350 [0x10261ec5c]\n  \u003ctruncated rest of calls>\n\nExtension modules: _testcapi (total: 1)\nThreadSanitizer:DEADLYSIGNAL\n==6548==ERROR: ThreadSanitizer: SEGV on unknown address 0x000000000000 (pc 0x0001024eb61c bp 0x00016da153e0 sp 0x00016da153a0 T35112809)\n==6548==The signal is caused by a READ memory access.                                                                                                                                                                             \n==6548==Hint: address points to the zero page.\n    #0 _PyDict_Contains_KnownHash dictobject.c:5315 (python.exe:arm64+0x10010b61c)\n    #1 partial_vectorcall _functoolsmodule.c:460 (python.exe:arm64+0x100442048)\n    #2 _PyVectorcall_Call call.c:285 (python.exe:arm64+0x10009f7ac)\n    #3 _PyEval_EvalFrameDefault generated_cases.c.h:3161 (python.exe:arm64+0x100248d3c)\n    #4 _PyEval_Vector ceval.c:2172 (python.exe:arm64+0x10023ec58)\n    #5 _PyObject_VectorcallTstate pycore_call.h:144 (python.exe:arm64+0x10009e934)\n    #6 _PyObject_VectorcallPrepend call.c:877 (python.exe:arm64+0x1000a0b48)\n    #7 _PyEval_EvalFrameDefault generated_cases.c.h:3161 (python.exe:arm64+0x100248d3c)\n    #8 _PyEval_Vector ceval.c:2172 (python.exe:arm64+0x10023ec58)\n    #9 _PyObject_VectorcallDictTstate call.c:135 (python.exe:arm64+0x10009eb2c)\n    #10 _PyObject_Call_Prepend call.c:504 (python.exe:arm64+0x10009fdb0)\n    #11 call_method typeobject.c:3100 (python.exe:arm64+0x10017c8bc)\n    #12 _PyObject_MakeTpCall call.c:242 (python.exe:arm64+0x10009ed14)\n    #13 _Py_VectorCall_StackRefSteal ceval.c:726 (python.exe:arm64+0x10023ee5c)\n    #14 _PyEval_EvalFrameDefault generated_cases.c.h:4559 (python.exe:arm64+0x10024c28c)\n    #15 _PyEval_Vector ceval.c:2172 (python.exe:arm64+0x10023ec58)\n    #16 _PyObject_VectorcallTstate pycore_call.h:144 (python.exe:arm64+0x10009e934)\n    #17 _PyObject_VectorcallPrepend call.c:877 (python.exe:arm64+0x1000a0b48)\n    #18 _PyEval_EvalFrameDefault generated_cases.c.h:2831 (python.exe:arm64+0x10024834c)\n    #19 _PyEval_Vector ceval.c:2172 (python.exe:arm64+0x10023ec58)\n    #20 _PyObject_VectorcallDictTstate call.c:135 (python.exe:arm64+0x10009eb2c)\n    #21 _PyObject_Call_Prepend call.c:504 (python.exe:arm64+0x10009fdb0)\n    #22 call_method typeobject.c:3100 (python.exe:arm64+0x10017c8bc)\n    #23 _PyObject_MakeTpCall call.c:242 (python.exe:arm64+0x10009ed14)\n    #24 _Py_VectorCall_StackRefSteal ceval.c:726 (python.exe:arm64+0x10023ee5c)\n    #25 _PyEval_EvalFrameDefault generated_cases.c.h:4559 (python.exe:arm64+0x10024c28c)\n    #26 _PyEval_Vector ceval.c:2172 (python.exe:arm64+0x10023ec58)\n    #27 _PyObject_VectorcallTstate pycore_call.h:144 (python.exe:arm64+0x10009e934)\n    #28 _PyObject_VectorcallPrepend call.c:877 (python.exe:arm64+0x1000a0b48)\n    #29 _PyEval_EvalFrameDefault generated_cases.c.h:3161 (python.exe:arm64+0x100248d3c)\n    #30 _PyEval_Vector ceval.c:2172 (python.exe:arm64+0x10023ec58)\n    #31 _PyObject_VectorcallDictTstate call.c:135 (python.exe:arm64+0x10009eb2c)\n    #32 _PyObject_Call_Prepend call.c:504 (python.exe:arm64+0x10009fdb0)\n    #33 call_method typeobject.c:3100 (python.exe:arm64+0x10017c8bc)\n    #34 _PyObject_MakeTpCall call.c:242 (python.exe:arm64+0x10009ed14)\n    #35 _Py_VectorCallInstrumentation_StackRefSteal ceval.c:768 (python.exe:arm64+0x10023f3a8)\n    #36 _PyEval_EvalFrameDefault generated_cases.c.h:1906 (python.exe:arm64+0x1002462d0)\n    #37 _PyEval_Vector ceval.c:2172 (python.exe:arm64+0x10023ec58)\n    #38 PyEval_EvalCode ceval.c:679 (python.exe:arm64+0x10023e708)\n    #39 builtin_exec bltinmodule.c.h:676 (python.exe:arm64+0x1002382a0)\n    #40 cfunction_vectorcall_FASTCALL_KEYWORDS methodobject.c:465 (python.exe:arm64+0x100126060)\n    #41 _PyObject_VectorcallTstate pycore_call.h:144 (python.exe:arm64+0x10009e934)\n    #42 _Py_VectorCallInstrumentation_StackRefSteal ceval.c:768 (python.exe:arm64+0x10023f3a8)\n    #43 _PyEval_EvalFrameDefault generated_cases.c.h:1906 (python.exe:arm64+0x1002462d0)\n    #44 _PyEval_Vector ceval.c:2172 (python.exe:arm64+0x10023ec58)\n    #45 pymain_run_module main.c:420 (python.exe:arm64+0x100351668)\n    #46 Py_RunMain main.c:891 (python.exe:arm64+0x1003510e8)\n    #47 pymain_main main.c:921 (python.exe:arm64+0x100351560)\n    #48 Py_BytesMain main.c:945 (python.exe:arm64+0x1003515b0)\n    #49 start \u003cnull> (dyld:arm64e+0x8d50)\n\n==6548==Register values:\n x[0] = 0xdddddddddddddddd   x[1] = 0x0000000302c51520   x[2] = 0x87e87aa3ff897c45   x[3] = 0x00000003035f6a80  \n x[4] = 0x00000001033fc6d8   x[5] = 0x0000000000000063   x[6] = 0x0000000000000070   x[7] = 0x0000000102b31ca0  \n x[8] = 0x0000000000000000   x[9] = 0x72331224a8250b2b  x[10] = 0x011062c8e6dcd17b  x[11] = 0x0000000000000002  \nx[12] = 0x000000000001c5af  x[13] = 0x591cdb992c3f488c  x[14] = 0x000000008f01dca6  x[15] = 0x011562c8e6dcd17b  \nx[16] = 0x00000001963f10b0  x[17] = 0x0000000103480820  x[18] = 0x0000000000000000  x[19] = 0x0000000303bf1510  \nx[20] = 0x0000000302c51520  x[21] = 0x87e87aa3ff897c45  x[22] = 0x00000003020917e8  x[23] = 0x0000000000000000  \nx[24] = 0x0000000102ad60d8  x[25] = 0x8000000000000000  x[26] = 0x0000000303bf04c0  x[27] = 0x0000000303bf0490  \nx[28] = 0x0000000000000000     fp = 0x000000016da153e0     lr = 0x000000010282204c     sp = 0x000000016da153a0  \nThreadSanitizer can not provide additional info.\nSUMMARY: ThreadSanitizer: SEGV dictobject.c:5315 in _PyDict_Contains_KnownHash\n==6548==ABORTING\nFatal Python error: Aborted\n\n\u003cCannot show all threads while the GIL is disabled>\nStack (most recent call first):\n  File \"/Users/johng/repos/cpython/Lib/test/test_functools.py\", line 622 in test_call_safety_against_reentrant_mutation\n  File \"/Users/johng/repos/cpython/Lib/unittest/case.py\", line 637 in _callTestMethod\n  File \"/Users/johng/repos/cpython/Lib/unittest/case.py\", line 691 in run\n  File \"/Users/johng/repos/cpython/Lib/unittest/case.py\", line 747 in __call__\n  File \"/Users/johng/repos/cpython/Lib/unittest/suite.py\", line 122 in run\n  File \"/Users/johng/repos/cpython/Lib/unittest/suite.py\", line 84 in __call__\n  File \"/Users/johng/repos/cpython/Lib/unittest/suite.py\", line 122 in run\n  File \"/Users/johng/repos/cpython/Lib/unittest/suite.py\", line 84 in __call__\n  File \"/Users/johng/repos/cpython/Lib/unittest/runner.py\", line 256 in run\n  File \"/Users/johng/repos/cpython/Lib/test/libregrtest/single.py\", line 84 in _run_suite\n  File \"/Users/johng/repos/cpython/Lib/test/libregrtest/single.py\", line 42 in run_unittest\n  File \"/Users/johng/repos/cpython/Lib/test/libregrtest/single.py\", line 162 in test_func\n  File \"/Users/johng/repos/cpython/Lib/test/libregrtest/single.py\", line 118 in regrtest_runner\n  File \"/Users/johng/repos/cpython/Lib/test/libregrtest/single.py\", line 165 in _load_run_test\n  File \"/Users/johng/repos/cpython/Lib/test/libregrtest/single.py\", line 210 in _runtest_env_changed_exc\n  File \"/Users/johng/repos/cpython/Lib/test/libregrtest/single.py\", line 319 in _runtest\n  File \"/Users/johng/repos/cpython/Lib/test/libregrtest/single.py\", line 348 in run_single_test\n  File \"/Users/johng/repos/cpython/Lib/test/libregrtest/main.py\", line 390 in run_test\n  File \"/Users/johng/repos/cpython/Lib/test/libregrtest/main.py\", line 425 in run_tests_sequentially\n  File \"/Users/johng/repos/cpython/Lib/test/libregrtest/main.py\", line 565 in _run_tests\n  File \"/Users/johng/repos/cpython/Lib/test/libregrtest/main.py\", line 600 in run_tests\n  File \"/Users/johng/repos/cpython/Lib/test/libregrtest/main.py\", line 793 in main\n  File \"/Users/johng/repos/cpython/Lib/test/libregrtest/main.py\", line 801 in main\n  File \"/Users/johng/repos/cpython/Lib/test/__main__.py\", line 2 in \u003cmodule>\n  File \"/Users/johng/repos/cpython/Lib/runpy.py\", line 87 in _run_code\n  File \"/Users/johng/repos/cpython/Lib/runpy.py\", line 201 in _run_module_as_main\n\nCurrent thread's C stack trace (most recent call first):\n  Binary file \"/Users/johng/repos/cpython/python.exe\", at _Py_DumpStack+0x44 [0x102720a10]\n  Binary file \"/Users/johng/repos/cpython/python.exe\", at faulthandler_fatal_error+0x2c4 [0x10274efac]\n  Binary file \"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/21/lib/darwin/libclang_rt.tsan_osx_dynamic.dylib\", at _ZN6__tsanL21CallUserSignalHandlerEPNS_11ThreadStateEbbiPN11__sanitizer23__sanitizer_siginfo_padEPv+0xfc [0x103405274]\n  Binary file \"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/21/lib/darwin/libclang_rt.tsan_osx_dynamic.dylib\", at _Z10sighandleriPN11__sanitizer23__sanitizer_siginfo_padEPv+0x1cc [0x1034054d4]\n  Binary file \"/usr/lib/system/libsystem_platform.dylib\", at _sigtramp+0x38 [0x1963f1764]\n  Binary file \"/usr/lib/system/libsystem_pthread.dylib\", at pthread_kill+0x128 [0x1963e7888]\n  Binary file \"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/21/lib/darwin/libclang_rt.tsan_osx_dynamic.dylib\", at wrap_pthread_kill+0x144 [0x103405bbc]\n  Binary file \"/usr/lib/system/libsystem_c.dylib\", at abort+0x7c [0x1962ec850]\n  Binary file \"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/21/lib/darwin/libclang_rt.tsan_osx_dynamic.dylib\", at _ZN11__sanitizer6AtexitEPFvvE+0x0 [0x1033e5dd8]\n  Binary file \"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/21/lib/darwin/libclang_rt.tsan_osx_dynamic.dylib\", at _ZN11__sanitizer3DieEv+0x6c [0x1033e53d0]\n  Binary file \"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/21/lib/darwin/libclang_rt.tsan_osx_dynamic.dylib\", at _ZN11__sanitizer13SignalContextC1EPvS1_+0x0 [0x1033f2b1c]\n  Binary file \"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/21/lib/darwin/libclang_rt.tsan_osx_dynamic.dylib\", at _ZN6__tsanL21CallUserSignalHandlerEPNS_11ThreadStateEbbiPN11__sanitizer23__sanitizer_siginfo_padEPv+0xfc [0x103405274]\n  Binary file \"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/21/lib/darwin/libclang_rt.tsan_osx_dynamic.dylib\", at _Z10sighandleriPN11__sanitizer23__sanitizer_siginfo_padEPv+0x1cc [0x1034054d4]\n  Binary file \"/usr/lib/system/libsystem_platform.dylib\", at _sigtramp+0x38 [0x1963f1764]\n  Binary file \"/Users/johng/repos/cpython/python.exe\", at partial_vectorcall+0x370 [0x10282204c]\n  Binary file \"/Users/johng/repos/cpython/python.exe\", at partial_vectorcall+0x370 [0x10282204c]\n  Binary file \"/Users/johng/repos/cpython/python.exe\", at _PyVectorcall_Call+0xe4 [0x10247f7b0]\n  Binary file \"/Users/johng/repos/cpython/python.exe\", at _PyEval_EvalFrameDefault+0x837c [0x102628d40]\n  Binary file \"/Users/johng/repos/cpython/python.exe\", at _PyEval_Vector+0x350 [0x10261ec5c]\n  Binary file \"/Users/johng/repos/cpython/python.exe\", at _PyObject_VectorcallTstate+0x74 [0x10247e938]\n  Binary file \"/Users/johng/repos/cpython/python.exe\", at _PyObject_VectorcallPrepend+0x154 [0x102480b4c]\n  Binary file \"/Users/johng/repos/cpython/python.exe\", at _PyEval_EvalFrameDefault+0x837c [0x102628d40]\n  Binary file \"/Users/johng/repos/cpython/python.exe\", at _PyEval_Vector+0x350 [0x10261ec5c]\n  Binary file \"/Users/johng/repos/cpython/python.exe\", at _PyObject_VectorcallDictTstate+0x170 [0x10247eb30]\n  Binary file \"/Users/johng/repos/cpython/python.exe\", at _PyObject_Call_Prepend+0xd4 [0x10247fdb4]\n  Binary file \"/Users/johng/repos/cpython/python.exe\", at call_method+0x9c [0x10255c8c0]\n  Binary file \"/Users/johng/repos/cpython/python.exe\", at _PyObject_MakeTpCall+0x120 [0x10247ed18]\n  Binary file \"/Users/johng/repos/cpython/python.exe\", at _Py_VectorCall_StackRefSteal+0x118 [0x10261ee60]\n  Binary file \"/Users/johng/repos/cpython/python.exe\", at _PyEval_EvalFrameDefault+0xb8cc [0x10262c290]\n  Binary file \"/Users/johng/repos/cpython/python.exe\", at _PyEval_Vector+0x350 [0x10261ec5c]\n  Binary file \"/Users/johng/repos/cpython/python.exe\", at _PyObject_VectorcallTstate+0x74 [0x10247e938]\n  Binary file \"/Users/johng/repos/cpython/python.exe\", at _PyObject_VectorcallPrepend+0x154 [0x102480b4c]\n  \u003ctruncated rest of calls>\n\nExtension modules: _testcapi (total: 1)\n[1]    6548 abort      ./python.exe -m test test_functools -v -m \n\u003c/details\n\n### CPython versions tested on:\n\nCPython main branch\n\n### Operating systems tested on:\n\nmacOS\n\n\u003c!-- gh-linked-prs -->\n### Linked PRs\n* gh-154284\n* gh-154508\n* gh-154652\n\u003c!-- /gh-linked-prs -->\n","author":{"url":"https://github.com/johng","@type":"Person","name":"johng"},"datePublished":"2026-07-19T19:09:26Z","url":"https://github.com/python/cpython/issues/154189"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:18bbaf15-bedf-e1d1-fe78-57f8fc692f04
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id8458:268903:B57C6E:F0BF24:6AF85B0A
html-safe-nonce3d89072ff050367c368542bd146997fc556785f2baeed564997cd7508a93c51d
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NDU4OjI2ODkwMzpCNTdDNkU6RjBCRjI0OjZBRjg1QjBBIiwidmlzaXRvcl9pZCI6IjQ0Mjg4NzcyNTQzMTA5ODk4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac784d20973712f8cd2cbfc3f0fb4adbef23ee1ff184418747b3dcb4f676622b80
hovercard-subject-tagissue:4924024877
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/154189/issue_layout
twitter:imagehttps://opengraph.githubassets.com/9e8961646caaedbb5a72d4fea52496b8b7ac22718f5329d511e8b5ee1e656b99/python/cpython/issues/154189
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/9e8961646caaedbb5a72d4fea52496b8b7ac22718f5329d511e8b5ee1e656b99/python/cpython/issues/154189
og:image:altBug report Bug description: Similar to #144475 although this is a use after free gap. def test_call_safety_against_reentrant_mutation(self): partial = self.partial def original(*args, **kwargs): re...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamejohng
hostnamegithub.com
expected-hostnamegithub.com
None5713ecd83001b2f55c3509fb7a292bf7d66d0f167c7ae87a9f7eaec5a52bf8db
turbo-cache-controlno-preview
go-importgithub.com/python/cpython git https://github.com/python/cpython.git
octolytics-dimension-user_id1525981
octolytics-dimension-user_loginpython
octolytics-dimension-repository_id81598961
octolytics-dimension-repository_nwopython/cpython
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id81598961
octolytics-dimension-repository_network_root_nwopython/cpython
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release653be32ff5c755082a4db662491bfbbcfc9112c1
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/python/cpython/issues/154189#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F154189
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F154189
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=python%2Fcpython
Reloadhttps://github.com/python/cpython/issues/154189
Reloadhttps://github.com/python/cpython/issues/154189
Reloadhttps://github.com/python/cpython/issues/154189
pythonhttps://github.com/python
cpythonhttps://github.com/python/cpython
Codehttps://github.com/python/cpython
Issues5k+ (5k+)https://github.com/python/cpython/issues
Pull requests2.4k (2.4k)https://github.com/python/cpython/pulls
Actionshttps://github.com/python/cpython/actions
Projectshttps://github.com/python/cpython/projects
Security and qualityhttps://github.com/python/cpython/security
Insightshttps://github.com/python/cpython/pulse
https://github.com/python/cpython
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/154189
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/154189
use-after-free: functools partialhttps://github.com/python/cpython/issues/154189#top
extension-modulesC modules in the Modules dirhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22extension-modules%22
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%22
https://github.com/johng
johnghttps://github.com/johng
on Jul 19, 2026https://github.com/python/cpython/issues/154189#issue-4924024877
#144475https://github.com/python/cpython/issues/144475
#1https://github.com/python/cpython/pull/1
#2https://github.com/python/cpython/pull/2
#3https://github.com/python/cpython/pull/3
#4https://github.com/python/cpython/pull/4
#5https://github.com/python/cpython/pull/5
#6https://github.com/python/cpython/pull/6
#7https://github.com/python/cpython/pull/7
#8https://github.com/python/cpython/pull/8
#9https://github.com/python/cpython/pull/9
#10https://github.com/python/cpython/pull/10
#11https://github.com/python/cpython/pull/11
#12https://github.com/python/cpython/pull/12
#13https://github.com/python/cpython/pull/13
#14https://github.com/python/cpython/pull/14
#15https://github.com/python/cpython/pull/15
#16https://github.com/python/cpython/pull/16
#17https://github.com/python/cpython/pull/17
#18https://github.com/python/cpython/pull/18
#19https://github.com/python/cpython/pull/19
#20https://github.com/python/cpython/pull/20
#21https://github.com/python/cpython/pull/21
#22https://github.com/python/cpython/pull/22
#23https://github.com/python/cpython/pull/23
#24https://github.com/python/cpython/pull/24
#25https://github.com/python/cpython/pull/25
#26https://github.com/python/cpython/pull/26
#27https://github.com/python/cpython/pull/27
#28https://github.com/python/cpython/pull/28
#29https://github.com/python/cpython/pull/29
#30https://github.com/python/cpython/pull/30
#31https://github.com/python/cpython/pull/31
#32https://github.com/python/cpython/pull/32
#33https://github.com/python/cpython/pull/33
#34https://github.com/python/cpython/pull/34
#35https://github.com/python/cpython/pull/35
#36https://github.com/python/cpython/pull/36
#37https://github.com/python/cpython/pull/37
#38https://github.com/python/cpython/pull/38
#39https://github.com/python/cpython/pull/39
#40https://github.com/python/cpython/pull/40
#41https://github.com/python/cpython/pull/41
#42https://github.com/python/cpython/pull/42
#43https://github.com/python/cpython/pull/43
#44https://github.com/python/cpython/pull/44
#45https://github.com/python/cpython/pull/45
#46https://github.com/python/cpython/pull/46
#47https://github.com/python/cpython/pull/47
#48https://github.com/python/cpython/pull/48
#49https://github.com/python/cpython/pull/49
gh-154189: Fix use-after-free in partial_vectorcall from reentrant __setstate__ #154284https://github.com/python/cpython/pull/154284
gh-154189: Fix use-after-free in functools.partial_vectorcall #154508https://github.com/python/cpython/pull/154508
[3.15] gh-154189: Fix use-after-free in functools.partial_vectorcall (GH-154508) #154652https://github.com/python/cpython/pull/154652
johnghttps://github.com/johng
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%22
on Jul 19, 2026https://github.com/python/cpython/issues/154189#event-28185725307
picnixzhttps://github.com/picnixz
extension-modulesC modules in the Modules dirhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22extension-modules%22
on Jul 19, 2026https://github.com/python/cpython/issues/154189#event-28185875666
encukouhttps://github.com/encukou
on Jul 24, 2026https://github.com/python/cpython/issues/154189#event-28457606028
gh-154189: Fix use-after-free in `functools.partial_vectorcall` (GH-1…https://github.com/python/cpython/commit/1a742d403243ac9915ffcc54e29516e58c44dc42
gh-154189https://github.com/python/cpython/issues/154189
GH-1…https://github.com/python/cpython/pull/154508
1a742d4https://github.com/python/cpython/commit/1a742d403243ac9915ffcc54e29516e58c44dc42
[3.15] gh-154189: Fix use-after-free in `functools.partial_vectorcall` (https://github.com/python/cpython/commit/624634242965e50d587a6a01b9faba27de0b2344
gh-154189https://github.com/python/cpython/issues/154189
6246342https://github.com/python/cpython/commit/624634242965e50d587a6a01b9faba27de0b2344
encukouhttps://github.com/encukou
completedhttps://github.com/python/cpython/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Jul 27, 2026https://github.com/python/cpython/issues/154189#event-28545542077
mbeijenhttps://github.com/mbeijen
on Aug 14, 2026https://github.com/python/cpython/issues/154189#event-29455489586
pythongh-154189: Fix use-after-free in `functools.partial_vectorcall` (…https://github.com/mbeijen/cpython/commit/231b8c66ebd3a0f02ab157e86db6b5c417e05d7e
pythongh-154189https://github.com/python/cpython/issues/154189
…https://github.com/python/cpython/pull/154508
231b8c6https://github.com/mbeijen/cpython/commit/231b8c66ebd3a0f02ab157e86db6b5c417e05d7e
Sign up for freehttps://github.com/signup?return_to=https://github.com/python/cpython/issues/154189
Sign in to commenthttps://github.com/login?return_to=https://github.com/python/cpython/issues/154189
extension-modulesC modules in the Modules dirhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22extension-modules%22
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.