repo stringclasses 1 value | instance_id stringlengths 20 22 | problem_statement stringlengths 126 60.8k | merge_commit stringlengths 40 40 | base_commit stringlengths 40 40 |
|---|---|---|---|---|
python/cpython | python__cpython-128873 | # Unsused argument in `_PyCode_Quicken`
`_PyCode_Quicken` in `specialize.c` accepts `PyObject *consts` but does not use it. Not sure which type of issue to use, so creating blank one.
<!-- gh-linked-prs -->
### Linked PRs
* gh-128873
<!-- /gh-linked-prs -->
| e6c76b947b2d0708cea1d5e090d02e79fda1cc26 | ecd2f84555bf494007420ba5a37adf8d1c23e856 |
python/cpython | python__cpython-128864 | # [C API] Deprecate private functions which have a public replacement
Hi,
Python 3.13 and 3.14 added public functions to replace private functions. For example, a public function `PyBytes_Join()` was added to replace the private function `_PyBytes_Join()`.
I propose to deprecate the private functions which have a public replacement, and remove them in Python 3.16.
Victor
<!-- gh-linked-prs -->
### Linked PRs
* gh-128864
* gh-129176
* gh-129212
* gh-127939
* gh-129245
<!-- /gh-linked-prs -->
| 9012fa741d55419dc77c5c191794eb93e71ae9a4 | 470a0a68ebbbb4254f1a3e8e22cce0c3a0827055 |
python/cpython | python__cpython-128926 | # Make `_Py_TryIncref` public as an unstable API as `PyUnstable_TryIncref()`
# Feature or enhancement
We should make `_Py_TryIncref` public as function with the following signature:
```c
int PyUnstable_TryIncref(PyObject *op);
```
**EDIT**: Renamed to `PyUnstable_TryIncref` in accordance with Victor's suggestion.
The function increments the reference count if it's not zero in a thread-safe way. It's logically equivalent to the following snippet and in the default (GIL-enabled) build it's implemented as such:
```c
if (Py_REFCNT(op) > 0) {
Py_INCREF(op);
return 1;
}
return 0;
```
Additionally, we should make `_PyObject_SetMaybeWeakref` public as `PyUnstable_Object_EnableTryIncRef`. This function has no equivalent in the GIL-enabled build (it's a no-op), but it's important for making `TryIncref` work reliably with our biased reference counting implementation.
### Motivation
The `TryIncref` primitive is a building block for handling borrowed and unowned references. It addresses an issue that generally cannot be solved by adding extra synchronization like mutexes because it handles the race between the reference count reaching zero (which is outside developers' control) and the `TryIncref`.
We use it internally in three subsystems:
* To implement [weak references](https://github.com/python/cpython/blob/d906bde250d59c396d8dab92285b832c66cdec27/Include/internal/pycore_weakref.h#L77)
* In [asyncio](https://github.com/python/cpython/blob/d906bde250d59c396d8dab92285b832c66cdec27/Modules/_asynciomodule.c#L3782) to access the borrowed/unowned list of tasks
* In the [MRO cache](https://github.com/python/cpython/blob/d906bde250d59c396d8dab92285b832c66cdec27/Objects/typeobject.c#L5567), to safely access the borrowed/unowned cached `PyObject *` entries.
Recently, we discovered a [thread safety bug](https://github.com/pybind/pybind11/issues/5489) in pybind11 related to the use of borrowed/unowned references. Using `_Py_TryIncref` in place of `Py_INCREF` would fix the bug. I think nanobind probably has a similar issue.
### Alternatives
* Use actual [weak reference objects](https://docs.python.org/3/c-api/weakref.html) instead of borrowed/unowned references. This is cleaner, but is not practical for performance reasons in the above use cases. Using `PyWeakRef` objects increases the overhead of pybind11 bindings by 30% in some simple tests.
* Implement something like `_Py_TryIncref` in extensions. I think this is much worse than making the function public as an unstable API because it requires direct access to the reference count fields -- the implementation is tied to the implementation of biased reference counting -- and I'd like to avoid extensions depending directly on those details.
### See also
* https://github.com/python/cpython/issues/113920
* https://github.com/pybind/pybind11/issues/5489
<!-- gh-linked-prs -->
### Linked PRs
* gh-128926
<!-- /gh-linked-prs -->
| d23f5701ad2a64c7877bb37258420c417357423e | 7dd0a7e52ee832559b89d5ccba732c8e91260df8 |
python/cpython | python__cpython-128941 | # JIT: implement memory pystats collection
# Feature or enhancement
### Proposal:
In order to improve the JIT memory allocation, we need to know how much memory it uses.
Specifically it would be useful to know the following metrics:
* code total memory
* data total memory
* trampoline total memory
* padding total memory
* memory that we free
Also print and histogram of the traces total size.
Use the pystats infrastructure to collect these stats.
### Has this already been discussed elsewhere?
No response given
### Links to previous discussion of this feature:
This feature has been discussed with @brandtbucher in the past months.
<!-- gh-linked-prs -->
### Linked PRs
* gh-128941
<!-- /gh-linked-prs -->
| 567394517a10c9a9f3af25a31009589ae2c50f1b | e6c76b947b2d0708cea1d5e090d02e79fda1cc26 |
python/cpython | python__cpython-128841 | # IPv6 address parsing doesn't limit buffer size
# Bug report
### Bug description:
IPv6 addresses have a maximum length (8 colon-separated parts) but the current implementation doesn't limit the length. Similar issue to https://github.com/django/django/commit/ca2be7724e1244a4cb723de40a070f873c6e94bf
### CPython versions tested on:
CPython main branch
### Operating systems tested on:
_No response_
<!-- gh-linked-prs -->
### Linked PRs
* gh-128841
* gh-134610
* gh-134611
* gh-134612
* gh-134613
* gh-134614
* gh-134615
* gh-134836
* gh-134845
* gh-134846
* gh-134847
* gh-135089
* gh-135090
* gh-135091
<!-- /gh-linked-prs -->
| 47f1161d3a2bec52b5b5e952150141709c247da2 | 973b8f69d31b4d86c37e0b7194a209f4f2efff06 |
python/cpython | python__cpython-128817 | # test_doctests failure when running tests with -werror on platforms without readline (win32, wasi)
# Bug report
### Bug description:
```
======================================================================
FAIL: test_lineendings (test.test_doctest.test_doctest)
Doctest: test.test_doctest.test_doctest.test_lineendings
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Lib/doctest.py", line 2327, in runTest
raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for test.test_doctest.test_doctest.test_lineendings
File "/Lib/test/test_doctest/test_doctest.py", line 2901, in test_lineendings
----------------------------------------------------------------------
File "/Lib/test/test_doctest/test_doctest.py", line 2969, in test.test_doctest.test_doctest.test_lineendings
Failed example:
with test_hook(dn):
doctest.testfile("doctest_testfile.txt", package="doctest_testpkg", verbose=False)
Exception raised:
Traceback (most recent call last):
File "/Lib/doctest.py", line 1395, in __run
exec(compile(example.source, filename, "single",
~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
compileflags, True), test.globs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<doctest test.test_doctest.test_doctest.test_lineendings[21]>", line 2, in <module>
doctest.testfile("doctest_testfile.txt", package="doctest_testpkg", verbose=False)
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Lib/doctest.py", line 2197, in testfile
runner.run(test)
~~~~~~~~~~^^^^^^
File "/Lib/doctest.py", line 1548, in run
self.debugger = _OutputRedirectingPdb(save_stdout)
~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
File "/Lib/doctest.py", line 388, in __init__
pdb.Pdb.__init__(self, stdout=out, nosigint=True)
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Lib/pdb.py", line 331, in __init__
import readline
File "<frozen importlib._bootstrap>", line 1359, in _find_and_load
File "<frozen importlib._bootstrap>", line 1330, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 918, in _load_unlocked
ImportWarning: TestImporter.exec_module() not found; falling back to load_module()
```
fix seems to be to upgrade to the non-deprecated exec_module interface:
```patch
From 6659cadb6074c5c9203c26c4baedb47924c2f6d3 Mon Sep 17 00:00:00 2001
From: Thomas Grainger <tagrain@gmail.com>
Date: Tue, 14 Jan 2025 08:56:11 +0000
Subject: [PATCH] fix an import warning in test_doctest.py when importing
readline in WASI
---
Lib/test/test_doctest/test_doctest.py | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/Lib/test/test_doctest/test_doctest.py b/Lib/test/test_doctest/test_doctest.py
index b1e165fe16b..9c39255c241 100644
--- a/Lib/test/test_doctest/test_doctest.py
+++ b/Lib/test/test_doctest/test_doctest.py
@@ -2869,6 +2869,12 @@ def get_data(self, path):
with open(path, mode='rb') as f:
return f.read()
+ def exec_module(self, module):
+ raise ImportError
+
+ def create_module(self, spec):
+ return None
+
class TestHook:
def __init__(self, pathdir):
--
2.43.0
```
### CPython versions tested on:
CPython main branch
### Operating systems tested on:
Windows, Other
<!-- gh-linked-prs -->
### Linked PRs
* gh-128817
* gh-128870
* gh-128871
<!-- /gh-linked-prs -->
| 599be687ec7327c30c6469cf743aa4ee9e82232d | 1a1056d394a489d229b26c06c7c79aa9c06696f6 |
python/cpython | python__cpython-131703 | # Deprecate PyComplexObject.cval and soft-deprecate _Py_c*() API
### Proposal:
Suggested by @vstinner in https://github.com/python/cpython/pull/124829#issuecomment-2588284712.
I would agree, as these routines could be useful (and it seems, they are used by few projects) to implement mathematical functions just like in the cmath module. No alternatives exist.
It's also suggested to use a different convention for arguments: currently we pass them by value. We could use pointers to Py_complex struct instead. (Though my quick tests shows no measurable difference.)
Also, we should decide on naming. For `_Py_c_sum()` - `PyComplex_Add()` was suggested. But this looks misleading, as `PyComplex_` is a prefix for functions, operating with `PyObject*` arguments. Perhaps, rather we could instead use `Py_complex_add()` and `Py_complex_add_real()` (in the GNU GSL style). Current semi-private functions should be deprecated.
Edit:
The C-API WG [decision](https://github.com/capi-workgroup/decisions/issues/56#issuecomment-3136108606): Soft-deprecate the _Py_c_*() functions and Deprecate PyComplexObject.cval.
Previous discussions:
* https://github.com/python/cpython/issues/112019
* https://github.com/python/cpython/issues/106320#issuecomment-1633302147
Other:
* https://github.com/capi-workgroup/decisions/issues/56
* https://discuss.python.org/t/89919/
<!-- gh-linked-prs -->
### Linked PRs
* gh-131703
* gh-137261
* gh-137271
* gh-137579
<!-- /gh-linked-prs -->
| 79f7c67bf607f9d4f39a299aa9a1a4f7b317617c | 5ffb89420c3fb41cb6cc795c9f983a8b5cc207ab |
python/cpython | python__cpython-128808 | # Add marking phase to free-threaded cyclic GC
# Feature or enhancement
### Proposal:
Like gh-126491 but implemented for the free-threaded version of the cyclic GC. This is likely a performance win for mostly the same reasons. In the free-threaded version, the marking phase avoids iterating over the mimalloc arenas as well.
### Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
### Links to previous discussion of this feature:
_No response_
<!-- gh-linked-prs -->
### Linked PRs
* gh-128808
<!-- /gh-linked-prs -->
| 080f444a58dae1bb76a87ce746a09fd499792cfb | 8d8b854824c4723d7c5924f1d5c6a397ea7214a5 |
python/cpython | python__cpython-128971 | # Unexpected location of naked exception wrapped in except* block
# Bug report
### Bug description:
When an `ExceptionGroup` is implicitly constructed by catching a naked exception in an `except*` block, the traceback of the `ExceptionGroup` seems to point to the stackframe above where it is logically created:
```python
def f():
try:
raise Exception # Exception (inner) traceback terminates here
except* Exception as e:
raise
f() # ExceptionGroup (wrapper) traceback terminates here
```
→
```
+ Exception Group Traceback (most recent call last):
| File "/home/jobh/src/hypothesis/test_naked_exception.py", line 7, in <module>
| f() # ExceptionGroup (wrapper) traceback terminates here
| ^^^
| ExceptionGroup: (1 sub-exception)
+-+---------------- 1 ----------------
| Traceback (most recent call last):
| File "/home/jobh/src/hypothesis/test_naked_exception.py", line 3, in f
| raise Exception # Exception (inner) traceback terminates here
| ^^^^^^^^^^^^^^^
| Exception
+------------------------------------
```
I'm not sure if this should be called a bug, as it's not specifically documented how the wrapping ExceptionGroup traceback is constructed. But it is surprising, and did cause a bug in hypothesis where the Exception traceback is used to detect whether an exception originates in hypothesis itself or in user code [^1][^2]. The issue being that for wrapped naked exceptions we have to inspect the inner exception since the outer exception appears to be raised by the calling function.
As an alternative to the current behaviour, would it be possible to create the wrapper ExceptionGroup with a traceback pointing to where it is logically triggered - i.e., the `except*` block - rather than initially empty? IMO, that would be less suprising and would allow us to use the traceback without special-casing ExceptionGroup.
[^1]: https://github.com/HypothesisWorks/hypothesis/issues/4183
[^2]: https://github.com/HypothesisWorks/hypothesis/pull/4239
~([edit] Or, if the desire is to avoid branching the traceback between the wrapper and the inner exception, use the outermost frame of the naked exception as the initial ExceptionGroup traceback. This would still avoid the appearance of happening in the caller.)~
### CPython versions tested on:
3.11, 3.12, 3.13
### Operating systems tested on:
Linux
<!-- gh-linked-prs -->
### Linked PRs
* gh-128971
* gh-129299
* gh-129328
<!-- /gh-linked-prs -->
| c39ae8922bad3e5ceeafa05891536c1584b6f3db | 9e52e553f4a906c120f807e940891f7325011b67 |
python/cpython | python__cpython-129184 | # Python 3.14.0a3 regression: creating venv with `--system-site-packages` doesn't work (system packages are not detected)
# Bug report
### Bug description:
venv created with `--system-site-packages` in Python 3.14.0a3 doesn't really see the site packages. This happens also with the current main.
Bisected to commit: 2b0e2b2893a821ca36cd65a204bed932741ac189
To reproduce:
```
$ ./configure --config-cache --without-ensurepip && make && make install DESTDIR=/tmp/python
$ /tmp/python/usr/local/bin/python3 -m venv venv --system-site-packages && ./venv/bin/python -c "import sys; print(sys.path)"
```
Python 3.14.0a2 on my system:
```
['', '/tmp/python/usr/local/lib/python314.zip', '/tmp/python/usr/local/lib/python3.14', '/tmp/python/usr/local/lib/python3.14/lib-dynload', '/home/user/dev/cpython/venv/lib/python3.14/site-packages', '/tmp/python/usr/local/lib/python3.14/site-packages']
```
Python 3.14.0a3/main on my system:
```
['', '/tmp/python/usr/local/lib/python314.zip', '/tmp/python/usr/local/lib/python3.14', '/tmp/python/usr/local/lib/python3.14/lib-dynload', '/home/user/dev/cpython/venv/lib/python3.14/site-packages']
```
The last item, `'/tmp/python/usr/local/lib/python3.14/site-packages'`, disappeared from the sys.path.
```
$ cat ./venv/pyvenv.cfg
home = /tmp/python/usr/local/bin
include-system-site-packages = true
version = 3.14.0
executable = /tmp/python/usr/local/bin/python3.14
command = /tmp/python/usr/local/bin/python3 -m venv --system-site-packages /home/user/dev/cpython/venv
```
The content is the same in all cases, with **include-system-site-packages = true**.
More context in the Fedora bug tracker: https://bugzilla.redhat.com/show_bug.cgi?id=2336950
cc: @FFY00
### CPython versions tested on:
3.14
### Operating systems tested on:
Linux
<!-- gh-linked-prs -->
### Linked PRs
* gh-129184
* gh-129462
<!-- /gh-linked-prs -->
| a549f439384b4509b25639337ffea21c2e55d452 | 99849ee0d3ebcddc97b6aeaf389f43a12f541068 |
python/cpython | python__cpython-128726 | # configure warnings as errors in the test suite
# Feature or enhancement
### Proposal:
It's very easy (especially when deprecating something) to introduce a lot of noisy test output with new warnings, eg: https://github.com/python/cpython/issues/127949#issuecomment-2558227488
I think it would be useful to either configure warnings as errors in the test suite (and then capture unraisable/threadexcept errors using a mechanism like pytest has) or tee any warnings produced, and fail CI if any have been produced that were not captured with catch_warnings or assertWarns etc like https://pypi.org/project/pytest-max-warnings/
### Has this already been discussed elsewhere?
I have already discussed this feature proposal on Discourse
### Links to previous discussion of this feature:
https://discuss.python.org/t/its-too-easy-to-introduce-noise-in-cpythons-test-suite-output-resourcewarnings-and-deprecationwarnings/75234
<!-- gh-linked-prs -->
### Linked PRs
* gh-128726
* gh-128906
* gh-128935
* gh-128936
* gh-128973
* gh-129179
* gh-131802
* gh-131824
<!-- /gh-linked-prs -->
| 76856ae1659dbba066e51f353b31cb7cf0a8a5fe | 939df0f9f6a76e0916b3ba53841e1413ab90952e |
python/cpython | python__cpython-128764 | # Race on tp_version_tag under free threading
# Bug report
### Bug description:
TSAN reports a data race for the following program in a free-threaded build:
```python
import collections.abc
import concurrent.futures
import functools
import threading
num_threads = 8
def closure(b, x):
b.wait()
for _ in range(10):
type(x).__annotations__
isinstance(x, collections.abc.Mapping)
with concurrent.futures.ThreadPoolExecutor(max_workers=num_threads) as executor:
for i in range(1000):
b = threading.Barrier(num_threads)
class Foo:
pass
for _ in range(num_threads):
executor.submit(functools.partial(closure, b, Foo()))
```
TSAN report:
```
WARNING: ThreadSanitizer: data race (pid=1896711)
Read of size 4 at 0x7f766f2de990 by thread T8:
#0 PyType_Modified /usr/local/google/home/phawkins/p/cpython/Objects/typeobject.c:1053:15 (python3.13+0x305ab3) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#1 type_get_annotations /usr/local/google/home/phawkins/p/cpython/Objects/typeobject.c:1784:17 (python3.13+0x305ab3)
#2 getset_get /usr/local/google/home/phawkins/p/cpython/Objects/descrobject.c:193:16 (python3.13+0x1ff888) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#3 _Py_type_getattro_impl /usr/local/google/home/phawkins/p/cpython/Objects/typeobject.c:5405:19 (python3.13+0x2e955d) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#4 _Py_type_getattro /usr/local/google/home/phawkins/p/cpython/Objects/typeobject.c:5465:12 (python3.13+0x2e99a0) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#5 PyObject_GetAttr /usr/local/google/home/phawkins/p/cpython/Objects/object.c:1261:18 (python3.13+0x2945c7) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#6 _PyEval_EvalFrameDefault /usr/local/google/home/phawkins/p/cpython/Python/generated_cases.c.h:3766:28 (python3.13+0x3ee2b0) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#7 _PyEval_EvalFrame /usr/local/google/home/phawkins/p/cpython/./Include/internal/pycore_ceval.h:119:16 (python3.13+0x3dea3a) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#8 _PyEval_Vector /usr/local/google/home/phawkins/p/cpython/Python/ceval.c:1807:12 (python3.13+0x3dea3a)
#9 _PyFunction_Vectorcall /usr/local/google/home/phawkins/p/cpython/Objects/call.c (python3.13+0x1eb65f) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#10 _PyObject_VectorcallTstate /usr/local/google/home/phawkins/p/cpython/./Include/internal/pycore_call.h:168:11 (python3.13+0x572352) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#11 partial_vectorcall /usr/local/google/home/phawkins/p/cpython/./Modules/_functoolsmodule.c:252:16 (python3.13+0x572352)
#12 _PyVectorcall_Call /usr/local/google/home/phawkins/p/cpython/Objects/call.c:273:16 (python3.13+0x1eb2d3) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#13 _PyObject_Call /usr/local/google/home/phawkins/p/cpython/Objects/call.c:348:16 (python3.13+0x1eb2d3)
#14 PyObject_Call /usr/local/google/home/phawkins/p/cpython/Objects/call.c:373:12 (python3.13+0x1eb355) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#15 _PyEval_EvalFrameDefault /usr/local/google/home/phawkins/p/cpython/Python/generated_cases.c.h:1355:26 (python3.13+0x3e4af2) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#16 _PyEval_EvalFrame /usr/local/google/home/phawkins/p/cpython/./Include/internal/pycore_ceval.h:119:16 (python3.13+0x3dea3a) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#17 _PyEval_Vector /usr/local/google/home/phawkins/p/cpython/Python/ceval.c:1807:12 (python3.13+0x3dea3a)
#18 _PyFunction_Vectorcall /usr/local/google/home/phawkins/p/cpython/Objects/call.c (python3.13+0x1eb65f) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#19 _PyObject_VectorcallTstate /usr/local/google/home/phawkins/p/cpython/./Include/internal/pycore_call.h:168:11 (python3.13+0x1ef62f) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#20 method_vectorcall /usr/local/google/home/phawkins/p/cpython/Objects/classobject.c:70:20 (python3.13+0x1ef62f)
#21 _PyVectorcall_Call /usr/local/google/home/phawkins/p/cpython/Objects/call.c:273:16 (python3.13+0x1eb2d3) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#22 _PyObject_Call /usr/local/google/home/phawkins/p/cpython/Objects/call.c:348:16 (python3.13+0x1eb2d3)
#23 PyObject_Call /usr/local/google/home/phawkins/p/cpython/Objects/call.c:373:12 (python3.13+0x1eb355) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#24 thread_run /usr/local/google/home/phawkins/p/cpython/./Modules/_threadmodule.c:337:21 (python3.13+0x564a32) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#25 pythread_wrapper /usr/local/google/home/phawkins/p/cpython/Python/thread_pthread.h:243:5 (python3.13+0x4bddb7) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
Previous atomic write of size 4 at 0x7f766f2de990 by thread T7:
#0 _Py_atomic_store_uint32_relaxed /usr/local/google/home/phawkins/p/cpython/./Include/cpython/pyatomic_gcc.h:461:3 (python3.13+0x2e4bd9) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#1 set_version_unlocked /usr/local/google/home/phawkins/p/cpython/Objects/typeobject.c:978:5 (python3.13+0x2e4bd9)
#2 assign_version_tag /usr/local/google/home/phawkins/p/cpython/Objects/typeobject.c (python3.13+0x2e4bd9)
#3 _PyType_LookupRef /usr/local/google/home/phawkins/p/cpython/Objects/typeobject.c:5262:23 (python3.13+0x2e6495) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#4 _PyObject_GenericGetAttrWithDict /usr/local/google/home/phawkins/p/cpython/Objects/object.c:1659:13 (python3.13+0x295db9) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#5 PyObject_GenericGetAttr /usr/local/google/home/phawkins/p/cpython/Objects/object.c:1747:12 (python3.13+0x295c62) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#6 PyObject_GetAttr /usr/local/google/home/phawkins/p/cpython/Objects/object.c:1261:18 (python3.13+0x2945c7) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#7 _abc__abc_instancecheck_impl /usr/local/google/home/phawkins/p/cpython/./Modules/_abc.c:625:16 (python3.13+0x56ddb7) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#8 _abc__abc_instancecheck /usr/local/google/home/phawkins/p/cpython/./Modules/clinic/_abc.c.h:106:20 (python3.13+0x56ddb7)
#9 cfunction_vectorcall_FASTCALL /usr/local/google/home/phawkins/p/cpython/Objects/methodobject.c:425:24 (python3.13+0x289e0b) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#10 _PyObject_VectorcallTstate /usr/local/google/home/phawkins/p/cpython/./Include/internal/pycore_call.h:168:11 (python3.13+0x1eafea) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#11 PyObject_Vectorcall /usr/local/google/home/phawkins/p/cpython/Objects/call.c:327:12 (python3.13+0x1eafea)
#12 _PyEval_EvalFrameDefault /usr/local/google/home/phawkins/p/cpython/Python/generated_cases.c.h:813:23 (python3.13+0x3e290b) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#13 _PyEval_EvalFrame /usr/local/google/home/phawkins/p/cpython/./Include/internal/pycore_ceval.h:119:16 (python3.13+0x3dea3a) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#14 _PyEval_Vector /usr/local/google/home/phawkins/p/cpython/Python/ceval.c:1807:12 (python3.13+0x3dea3a)
#15 _PyFunction_Vectorcall /usr/local/google/home/phawkins/p/cpython/Objects/call.c (python3.13+0x1eb65f) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#16 _PyObject_VectorcallTstate /usr/local/google/home/phawkins/p/cpython/./Include/internal/pycore_call.h:168:11 (python3.13+0x1ef575) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#17 method_vectorcall /usr/local/google/home/phawkins/p/cpython/Objects/classobject.c:62:18 (python3.13+0x1ef575)
#18 _PyObject_VectorcallTstate /usr/local/google/home/phawkins/p/cpython/./Include/internal/pycore_call.h:168:11 (python3.13+0x1eb482) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#19 PyObject_CallOneArg /usr/local/google/home/phawkins/p/cpython/Objects/call.c:395:12 (python3.13+0x1eb482)
#20 object_recursive_isinstance /usr/local/google/home/phawkins/p/cpython/Objects/abstract.c:2717:25 (python3.13+0x1c3e69) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#21 PyObject_IsInstance /usr/local/google/home/phawkins/p/cpython/Objects/abstract.c:2742:12 (python3.13+0x1c3d7b) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#22 builtin_isinstance_impl /usr/local/google/home/phawkins/p/cpython/Python/bltinmodule.c:2751:14 (python3.13+0x3d9e16) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#23 builtin_isinstance /usr/local/google/home/phawkins/p/cpython/Python/clinic/bltinmodule.c.h:1191:20 (python3.13+0x3d9e16)
#24 cfunction_vectorcall_FASTCALL /usr/local/google/home/phawkins/p/cpython/Objects/methodobject.c:425:24 (python3.13+0x289e0b) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#25 _PyObject_VectorcallTstate /usr/local/google/home/phawkins/p/cpython/./Include/internal/pycore_call.h:168:11 (python3.13+0x1eafea) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#26 PyObject_Vectorcall /usr/local/google/home/phawkins/p/cpython/Objects/call.c:327:12 (python3.13+0x1eafea)
#27 _PyEval_EvalFrameDefault /usr/local/google/home/phawkins/p/cpython/Python/generated_cases.c.h:813:23 (python3.13+0x3e290b) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#28 _PyEval_EvalFrame /usr/local/google/home/phawkins/p/cpython/./Include/internal/pycore_ceval.h:119:16 (python3.13+0x3dea3a) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#29 _PyEval_Vector /usr/local/google/home/phawkins/p/cpython/Python/ceval.c:1807:12 (python3.13+0x3dea3a)
#30 _PyFunction_Vectorcall /usr/local/google/home/phawkins/p/cpython/Objects/call.c (python3.13+0x1eb65f) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#31 _PyObject_VectorcallTstate /usr/local/google/home/phawkins/p/cpython/./Include/internal/pycore_call.h:168:11 (python3.13+0x572352) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#32 partial_vectorcall /usr/local/google/home/phawkins/p/cpython/./Modules/_functoolsmodule.c:252:16 (python3.13+0x572352)
#33 _PyVectorcall_Call /usr/local/google/home/phawkins/p/cpython/Objects/call.c:273:16 (python3.13+0x1eb2d3) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#34 _PyObject_Call /usr/local/google/home/phawkins/p/cpython/Objects/call.c:348:16 (python3.13+0x1eb2d3)
#35 PyObject_Call /usr/local/google/home/phawkins/p/cpython/Objects/call.c:373:12 (python3.13+0x1eb355) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#36 _PyEval_EvalFrameDefault /usr/local/google/home/phawkins/p/cpython/Python/generated_cases.c.h:1355:26 (python3.13+0x3e4af2) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#37 _PyEval_EvalFrame /usr/local/google/home/phawkins/p/cpython/./Include/internal/pycore_ceval.h:119:16 (python3.13+0x3dea3a) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#38 _PyEval_Vector /usr/local/google/home/phawkins/p/cpython/Python/ceval.c:1807:12 (python3.13+0x3dea3a)
#39 _PyFunction_Vectorcall /usr/local/google/home/phawkins/p/cpython/Objects/call.c (python3.13+0x1eb65f) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#40 _PyObject_VectorcallTstate /usr/local/google/home/phawkins/p/cpython/./Include/internal/pycore_call.h:168:11 (python3.13+0x1ef62f) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#41 method_vectorcall /usr/local/google/home/phawkins/p/cpython/Objects/classobject.c:70:20 (python3.13+0x1ef62f)
#42 _PyVectorcall_Call /usr/local/google/home/phawkins/p/cpython/Objects/call.c:273:16 (python3.13+0x1eb2d3) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#43 _PyObject_Call /usr/local/google/home/phawkins/p/cpython/Objects/call.c:348:16 (python3.13+0x1eb2d3)
#44 PyObject_Call /usr/local/google/home/phawkins/p/cpython/Objects/call.c:373:12 (python3.13+0x1eb355) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#45 thread_run /usr/local/google/home/phawkins/p/cpython/./Modules/_threadmodule.c:337:21 (python3.13+0x564a32) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#46 pythread_wrapper /usr/local/google/home/phawkins/p/cpython/Python/thread_pthread.h:243:5 (python3.13+0x4bddb7) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
```
Tested at Python 3.13 commit 65da5db28a39cb0d9ee311206bdc8745b482c56f
### CPython versions tested on:
3.13
### Operating systems tested on:
Linux
<!-- gh-linked-prs -->
### Linked PRs
* gh-128764
* gh-128769
* gh-129750
* gh-130042
<!-- /gh-linked-prs -->
| 6e1e78054060ad326f26dd8dbf12adfedbb52883 | d0ecbdd838034c1f061e9b4e9b54a900141458c3 |
python/cpython | python__cpython-128735 | # ResourceWarning in urllib tests
Many `urllib` tests produce resource warnings. For example (there are much more cases):
```console
$ ./python -We -m test -vuall test_urllib test_urllib2 test_urllib2_localnet test_urllib_response test_urllibnet
...
test_geturl (test.test_urllib.urlopen_DataTests.test_geturl) ... ok
Warning -- Unraisable exception
Exception ignored in: <function _TemporaryFileCloser.__del__ at 0x7ff6ac410dd0>
Traceback (most recent call last):
File "/home/serhiy/py/cpython/Lib/tempfile.py", line 483, in __del__
_warnings.warn(self.warn_message, ResourceWarning)
ResourceWarning: Implicitly cleaning up <addinfourl at 140697425919168 whose fp = <_io.BytesIO object at 0x7ff6abc15400>>
Warning -- Unraisable exception
Exception ignored in: <function _TemporaryFileCloser.__del__ at 0x7ff6ac410dd0>
Traceback (most recent call last):
File "/home/serhiy/py/cpython/Lib/tempfile.py", line 483, in __del__
_warnings.warn(self.warn_message, ResourceWarning)
ResourceWarning: Implicitly cleaning up <addinfourl at 140697425378528 whose fp = <_io.BytesIO object at 0x7ff6abc15390>>
Warning -- Unraisable exception
Exception ignored in: <function _TemporaryFileCloser.__del__ at 0x7ff6ac410dd0>
Traceback (most recent call last):
File "/home/serhiy/py/cpython/Lib/tempfile.py", line 483, in __del__
_warnings.warn(self.warn_message, ResourceWarning)
ResourceWarning: Implicitly cleaning up <addinfourl at 140697425378176 whose fp = <_io.BytesIO object at 0x7ff6ac21be70>>
test_info (test.test_urllib.urlopen_DataTests.test_info) ... Warning -- Unraisable exception
Exception ignored in: <function _TemporaryFileCloser.__del__ at 0x7ff6ac410dd0>
Traceback (most recent call last):
File "/home/serhiy/py/cpython/Lib/tempfile.py", line 483, in __del__
_warnings.warn(self.warn_message, ResourceWarning)
ResourceWarning: Implicitly cleaning up <addinfourl at 140697420160224 whose fp = <_io.BytesIO object at 0x7ff6abc154e0>>
ok
Warning -- Unraisable exception
Exception ignored in: <function _TemporaryFileCloser.__del__ at 0x7ff6ac410dd0>
Traceback (most recent call last):
File "/home/serhiy/py/cpython/Lib/tempfile.py", line 483, in __del__
_warnings.warn(self.warn_message, ResourceWarning)
ResourceWarning: Implicitly cleaning up <addinfourl at 140697420342752 whose fp = <_io.BytesIO object at 0x7ff6abc15400>>
Warning -- Unraisable exception
Exception ignored in: <function _TemporaryFileCloser.__del__ at 0x7ff6ac410dd0>
Traceback (most recent call last):
File "/home/serhiy/py/cpython/Lib/tempfile.py", line 483, in __del__
_warnings.warn(self.warn_message, ResourceWarning)
ResourceWarning: Implicitly cleaning up <addinfourl at 140697420343392 whose fp = <_io.BytesIO object at 0x7ff6abc15390>>
Warning -- Unraisable exception
Exception ignored in: <function _TemporaryFileCloser.__del__ at 0x7ff6ac410dd0>
Traceback (most recent call last):
File "/home/serhiy/py/cpython/Lib/tempfile.py", line 483, in __del__
_warnings.warn(self.warn_message, ResourceWarning)
ResourceWarning: Implicitly cleaning up <addinfourl at 140697425919168 whose fp = <_io.BytesIO object at 0x7ff6ac21be70>>
test_interface (test.test_urllib.urlopen_DataTests.test_interface) ... ok
Warning -- Unraisable exception
Exception ignored in: <function _TemporaryFileCloser.__del__ at 0x7ff6ac410dd0>
Traceback (most recent call last):
File "/home/serhiy/py/cpython/Lib/tempfile.py", line 483, in __del__
_warnings.warn(self.warn_message, ResourceWarning)
ResourceWarning: Implicitly cleaning up <addinfourl at 140697426455808 whose fp = <_io.BytesIO object at 0x7ff6abc15400>>
Warning -- Unraisable exception
Exception ignored in: <function _TemporaryFileCloser.__del__ at 0x7ff6ac410dd0>
Traceback (most recent call last):
File "/home/serhiy/py/cpython/Lib/tempfile.py", line 483, in __del__
_warnings.warn(self.warn_message, ResourceWarning)
ResourceWarning: Implicitly cleaning up <addinfourl at 140697426462784 whose fp = <_io.BytesIO object at 0x7ff6abc15390>>
Warning -- Unraisable exception
Exception ignored in: <function _TemporaryFileCloser.__del__ at 0x7ff6ac410dd0>
Traceback (most recent call last):
File "/home/serhiy/py/cpython/Lib/tempfile.py", line 483, in __del__
_warnings.warn(self.warn_message, ResourceWarning)
ResourceWarning: Implicitly cleaning up <addinfourl at 140697426467104 whose fp = <_io.BytesIO object at 0x7ff6ac21be70>>
test_invalid_base64_data (test.test_urllib.urlopen_DataTests.test_invalid_base64_data) ... ok
Warning -- Unraisable exception
Exception ignored in: <function _TemporaryFileCloser.__del__ at 0x7ff6ac410dd0>
Traceback (most recent call last):
File "/home/serhiy/py/cpython/Lib/tempfile.py", line 483, in __del__
_warnings.warn(self.warn_message, ResourceWarning)
ResourceWarning: Implicitly cleaning up <addinfourl at 140697426847840 whose fp = <_io.BytesIO object at 0x7ff6abc15400>>
Warning -- Unraisable exception
Exception ignored in: <function _TemporaryFileCloser.__del__ at 0x7ff6ac410dd0>
Traceback (most recent call last):
File "/home/serhiy/py/cpython/Lib/tempfile.py", line 483, in __del__
_warnings.warn(self.warn_message, ResourceWarning)
ResourceWarning: Implicitly cleaning up <addinfourl at 140697426847072 whose fp = <_io.BytesIO object at 0x7ff6abc15390>>
Warning -- Unraisable exception
Exception ignored in: <function _TemporaryFileCloser.__del__ at 0x7ff6ac410dd0>
Traceback (most recent call last):
File "/home/serhiy/py/cpython/Lib/tempfile.py", line 483, in __del__
_warnings.warn(self.warn_message, ResourceWarning)
ResourceWarning: Implicitly cleaning up <addinfourl at 140697426455808 whose fp = <_io.BytesIO object at 0x7ff6ac21be70>>
test_missing_comma (test.test_urllib.urlopen_DataTests.test_missing_comma) ... ok
Warning -- Unraisable exception
Exception ignored in: <function _TemporaryFileCloser.__del__ at 0x7ff6ac410dd0>
Traceback (most recent call last):
File "/home/serhiy/py/cpython/Lib/tempfile.py", line 483, in __del__
_warnings.warn(self.warn_message, ResourceWarning)
ResourceWarning: Implicitly cleaning up <addinfourl at 140697425844896 whose fp = <_io.BytesIO object at 0x7ff6abc15400>>
Warning -- Unraisable exception
Exception ignored in: <function _TemporaryFileCloser.__del__ at 0x7ff6ac410dd0>
Traceback (most recent call last):
File "/home/serhiy/py/cpython/Lib/tempfile.py", line 483, in __del__
_warnings.warn(self.warn_message, ResourceWarning)
ResourceWarning: Implicitly cleaning up <addinfourl at 140697425844000 whose fp = <_io.BytesIO object at 0x7ff6abc15390>>
Warning -- Unraisable exception
Exception ignored in: <function _TemporaryFileCloser.__del__ at 0x7ff6ac410dd0>
Traceback (most recent call last):
File "/home/serhiy/py/cpython/Lib/tempfile.py", line 483, in __del__
_warnings.warn(self.warn_message, ResourceWarning)
ResourceWarning: Implicitly cleaning up <addinfourl at 140697419659664 whose fp = <_io.BytesIO object at 0x7ff6ac21be70>>
test_read_image (test.test_urllib.urlopen_DataTests.test_read_image) ... ok
Warning -- Unraisable exception
Exception ignored in: <function _TemporaryFileCloser.__del__ at 0x7ff6ac410dd0>
Traceback (most recent call last):
File "/home/serhiy/py/cpython/Lib/tempfile.py", line 483, in __del__
_warnings.warn(self.warn_message, ResourceWarning)
ResourceWarning: Implicitly cleaning up <addinfourl at 140697420324640 whose fp = <_io.BytesIO object at 0x7ff6abc15400>>
Warning -- Unraisable exception
Exception ignored in: <function _TemporaryFileCloser.__del__ at 0x7ff6ac410dd0>
Traceback (most recent call last):
File "/home/serhiy/py/cpython/Lib/tempfile.py", line 483, in __del__
_warnings.warn(self.warn_message, ResourceWarning)
ResourceWarning: Implicitly cleaning up <addinfourl at 140697419712848 whose fp = <_io.BytesIO object at 0x7ff6abc15390>>
Warning -- Unraisable exception
Exception ignored in: <function _TemporaryFileCloser.__del__ at 0x7ff6ac410dd0>
Traceback (most recent call last):
File "/home/serhiy/py/cpython/Lib/tempfile.py", line 483, in __del__
_warnings.warn(self.warn_message, ResourceWarning)
ResourceWarning: Implicitly cleaning up <addinfourl at 140697419711184 whose fp = <_io.BytesIO object at 0x7ff6ac21be70>>
test_read_text (test.test_urllib.urlopen_DataTests.test_read_text) ... ok
Warning -- Unraisable exception
Exception ignored in: <function _TemporaryFileCloser.__del__ at 0x7ff6ac410dd0>
Traceback (most recent call last):
File "/home/serhiy/py/cpython/Lib/tempfile.py", line 483, in __del__
_warnings.warn(self.warn_message, ResourceWarning)
ResourceWarning: Implicitly cleaning up <addinfourl at 140697420324832 whose fp = <_io.BytesIO object at 0x7ff6abc15400>>
Warning -- Unraisable exception
Exception ignored in: <function _TemporaryFileCloser.__del__ at 0x7ff6ac410dd0>
Traceback (most recent call last):
File "/home/serhiy/py/cpython/Lib/tempfile.py", line 483, in __del__
_warnings.warn(self.warn_message, ResourceWarning)
ResourceWarning: Implicitly cleaning up <addinfourl at 140697420324448 whose fp = <_io.BytesIO object at 0x7ff6abc15390>>
Warning -- Unraisable exception
Exception ignored in: <function _TemporaryFileCloser.__del__ at 0x7ff6ac410dd0>
Traceback (most recent call last):
File "/home/serhiy/py/cpython/Lib/tempfile.py", line 483, in __del__
_warnings.warn(self.warn_message, ResourceWarning)
ResourceWarning: Implicitly cleaning up <addinfourl at 140697420323104 whose fp = <_io.BytesIO object at 0x7ff6ac21be70>>
test_read_text_base64 (test.test_urllib.urlopen_DataTests.test_read_text_base64) ... ok
Warning -- Unraisable exception
Exception ignored in: <function _TemporaryFileCloser.__del__ at 0x7ff6ac410dd0>
Traceback (most recent call last):
File "/home/serhiy/py/cpython/Lib/tempfile.py", line 483, in __del__
_warnings.warn(self.warn_message, ResourceWarning)
ResourceWarning: Implicitly cleaning up <addinfourl at 140697420324640 whose fp = <_io.BytesIO object at 0x7ff6abc15400>>
Warning -- Unraisable exception
Exception ignored in: <function _TemporaryFileCloser.__del__ at 0x7ff6ac410dd0>
Traceback (most recent call last):
File "/home/serhiy/py/cpython/Lib/tempfile.py", line 483, in __del__
_warnings.warn(self.warn_message, ResourceWarning)
ResourceWarning: Implicitly cleaning up <addinfourl at 140697420325216 whose fp = <_io.BytesIO object at 0x7ff6abc15390>>
Warning -- Unraisable exception
Exception ignored in: <function _TemporaryFileCloser.__del__ at 0x7ff6ac410dd0>
Traceback (most recent call last):
File "/home/serhiy/py/cpython/Lib/tempfile.py", line 483, in __del__
_warnings.warn(self.warn_message, ResourceWarning)
ResourceWarning: Implicitly cleaning up <addinfourl at 140697420323104 whose fp = <_io.BytesIO object at 0x7ff6ac21be70>>
...
test_invalid_redirect (test.test_urllib.urlopen_HttpTests.test_invalid_redirect) ... Warning -- Unraisable exception
Exception ignored in: <function _TemporaryFileCloser.__del__ at 0x7ff6ac410dd0>
Traceback (most recent call last):
File "/home/serhiy/py/cpython/Lib/tempfile.py", line 483, in __del__
_warnings.warn(self.warn_message, ResourceWarning)
ResourceWarning: Implicitly cleaning up <HTTPError 302: "Found - Redirection to url 'file://guidocomputer.athome.com:/python/license' is not allowed">
ok
...
5 tests altered the execution environment (env changed):
test_urllib test_urllib2 test_urllib2_localnet
test_urllib_response test_urllibnet
...
```
The reason is that `addinfourl()` is a subclass of `tempfile._TemporaryFileWrapper`. It keeps a reference to an open file and emits a warning in its destructor if was not explicitly closed.
The solution: every result of `urllib.request.open()` and similar functions and any HTTPError exception should be explicitly closed.
See also #128731.
<!-- gh-linked-prs -->
### Linked PRs
* gh-128735
* gh-128748
* gh-128750
<!-- /gh-linked-prs -->
| 5ace71713b03cb37d829f50c849a8bb8a518738d | cb72feb8a30edb448bc8dc31330ed7420279d7c2 |
python/cpython | python__cpython-128733 | # ResourceWarning in test_robotparser
# Bug report
```console
$ ./python -We -m test -vuall test_robotparser
...
test_read_404 (test.test_robotparser.NetworkTestCase.test_read_404) ... Warning -- Unraisable exception
Exception ignored in: <function _TemporaryFileCloser.__del__ at 0x7ff389434dd0>
Traceback (most recent call last):
File "/home/serhiy/py/cpython/Lib/tempfile.py", line 483, in __del__
_warnings.warn(self.warn_message, ResourceWarning)
ResourceWarning: Implicitly cleaning up <HTTPError 404: 'Not Found'>
ok
testPasswordProtectedSite (test.test_robotparser.PasswordProtectedSiteTestCase.testPasswordProtectedSite) ... Warning -- Unraisable exception
Exception ignored in: <function _TemporaryFileCloser.__del__ at 0x7ff389434dd0>
Traceback (most recent call last):
File "/home/serhiy/py/cpython/Lib/tempfile.py", line 483, in __del__
_warnings.warn(self.warn_message, ResourceWarning)
ResourceWarning: Implicitly cleaning up <HTTPError 403: 'Forbidden access'>
ok
...
```
<!-- gh-linked-prs -->
### Linked PRs
* gh-128733
* gh-128746
* gh-128755
* gh-128756
<!-- /gh-linked-prs -->
| 5e65a1acc0b630397f1d190aed279114e6e99612 | f6c61bf2d7d8b66ccd9f16e723546bdcc251a3d0 |
python/cpython | python__cpython-128730 | # RuntimeWarning in test_unittest
```console
$ ./python -We -m test -vuall test_unittest -m test_deprecation_of_return_val_from_test_async_method
...
test_deprecation_of_return_val_from_test_async_method (test.test_unittest.test_case.Test_TestCase.test_deprecation_of_return_val_from_test_async_method) ... Warning -- Unraisable exception
Exception ignored in: <coroutine object Test_TestCase.test_deprecation_of_return_val_from_test_async_method.<locals>.Foo.test1 at 0x7f5c24cb3a10>
Traceback (most recent call last):
File "/home/serhiy/py/cpython/Lib/warnings.py", line 691, in _warn_unawaited_coroutine
warn(msg, category=RuntimeWarning, stacklevel=2, source=coro)
RuntimeWarning: coroutine 'Test_TestCase.test_deprecation_of_return_val_from_test_async_method.<locals>.Foo.test1' was never awaited
ok
...
```
<!-- gh-linked-prs -->
### Linked PRs
* gh-128730
<!-- /gh-linked-prs -->
| cb72feb8a30edb448bc8dc31330ed7420279d7c2 | 30268b5d2fbb1a5e6c876f0cdc4cbdb5d93315e6 |
python/cpython | python__cpython-128721 | # Top-level code environment docs are outdated for Python 3.13+
# Bug report
### Bug description:
Ref: https://docs.python.org/3/library/__main__.html
There is a script and entry-point example which has a conditional upon `__main__.__file__` and also a remark like:
> Note that in this case the `__main__` scope doesn’t contain a `__file__` attribute as it’s interactive.
This was all working as demonstrated up to and including Python 3.12, but starting in Python 3.13 it's incorrect. The attribute now exists, and is pointing at [`_pyrepl/__main__.py`](https://github.com/python/cpython/blob/3.13/Lib/_pyrepl/__main__.py).
The conditional demonstrated in `namely.py:print_user_name` now always goes into the if branch, and no longer the else branch, resulting in confusing output.
Ping also @jdevries3133 who wrote the original prose in https://github.com/python/cpython/pull/26883
### CPython versions tested on:
3.13
### Operating systems tested on:
Linux
<!-- gh-linked-prs -->
### Linked PRs
* gh-128721
<!-- /gh-linked-prs -->
| a4760ef8e5463116b3076e0f5e3c38b314f7b20f | 01d91500ca5b40bd84ef27fdf1f858a25c602bdb |
python/cpython | python__cpython-128741 | # Race between Py_SetRecursionLimit and _Py_LeaveRecursiveCallPy under free-threading
# Bug report
### Bug description:
Under Python 3.13 at commit 65da5db28a39cb0d9ee311206bdc8745b482c56f, we see the following TSAN race:
```python
import concurrent.futures
import functools
import sys
import threading
num_threads = 8
def count(n):
if n > 0:
return count(n - 1) + 1
return 0
def closure(b):
b.wait()
sys.setrecursionlimit(100)
count(50)
with concurrent.futures.ThreadPoolExecutor(max_workers=num_threads) as executor:
for _ in range(100):
b = threading.Barrier(num_threads)
for _ in range(num_threads):
executor.submit(functools.partial(closure, b))
```
TSAN report:
```
WARNING: ThreadSanitizer: data race (pid=3579557)
Write of size 4 at 0x72a40001e02c by thread T8:
#0 Py_SetRecursionLimit /usr/local/google/home/phawkins/p/cpython/Python/ceval.c:272:35 (python3.13+0x3dd302) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#1 sys_setrecursionlimit_impl /usr/local/google/home/phawkins/p/cpython/./Python/sysmodule.c:1319:5 (python3.13+0x4bab67) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#2 sys_setrecursionlimit /usr/local/google/home/phawkins/p/cpython/./Python/clinic/sysmodule.c.h:509:20 (python3.13+0x4bab67)
#3 cfunction_vectorcall_O /usr/local/google/home/phawkins/p/cpython/Objects/methodobject.c:512:24 (python3.13+0x28a3c5) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#4 _PyObject_VectorcallTstate /usr/local/google/home/phawkins/p/cpython/./Include/internal/pycore_call.h:168:11 (python3.13+0x1eafea) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#5 PyObject_Vectorcall /usr/local/google/home/phawkins/p/cpython/Objects/call.c:327:12 (python3.13+0x1eafea)
#6 _PyEval_EvalFrameDefault /usr/local/google/home/phawkins/p/cpython/Python/generated_cases.c.h:813:23 (python3.13+0x3e290b) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#7 _PyEval_EvalFrame /usr/local/google/home/phawkins/p/cpython/./Include/internal/pycore_ceval.h:119:16 (python3.13+0x3dea3a) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#8 _PyEval_Vector /usr/local/google/home/phawkins/p/cpython/Python/ceval.c:1807:12 (python3.13+0x3dea3a)
#9 _PyFunction_Vectorcall /usr/local/google/home/phawkins/p/cpython/Objects/call.c (python3.13+0x1eb65f) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#10 _PyObject_VectorcallTstate /usr/local/google/home/phawkins/p/cpython/./Include/internal/pycore_call.h:168:11 (python3.13+0x572352) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#11 partial_vectorcall /usr/local/google/home/phawkins/p/cpython/./Modules/_functoolsmodule.c:252:16 (python3.13+0x572352)
#12 _PyVectorcall_Call /usr/local/google/home/phawkins/p/cpython/Objects/call.c:273:16 (python3.13+0x1eb2d3) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#13 _PyObject_Call /usr/local/google/home/phawkins/p/cpython/Objects/call.c:348:16 (python3.13+0x1eb2d3)
#14 PyObject_Call /usr/local/google/home/phawkins/p/cpython/Objects/call.c:373:12 (python3.13+0x1eb355) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#15 _PyEval_EvalFrameDefault /usr/local/google/home/phawkins/p/cpython/Python/generated_cases.c.h:1355:26 (python3.13+0x3e4af2) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#16 _PyEval_EvalFrame /usr/local/google/home/phawkins/p/cpython/./Include/internal/pycore_ceval.h:119:16 (python3.13+0x3dea3a) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#17 _PyEval_Vector /usr/local/google/home/phawkins/p/cpython/Python/ceval.c:1807:12 (python3.13+0x3dea3a)
#18 _PyFunction_Vectorcall /usr/local/google/home/phawkins/p/cpython/Objects/call.c (python3.13+0x1eb65f) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#19 _PyObject_VectorcallTstate /usr/local/google/home/phawkins/p/cpython/./Include/internal/pycore_call.h:168:11 (python3.13+0x1ef62f) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#20 method_vectorcall /usr/local/google/home/phawkins/p/cpython/Objects/classobject.c:70:20 (python3.13+0x1ef62f)
#21 _PyVectorcall_Call /usr/local/google/home/phawkins/p/cpython/Objects/call.c:273:16 (python3.13+0x1eb2d3) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#22 _PyObject_Call /usr/local/google/home/phawkins/p/cpython/Objects/call.c:348:16 (python3.13+0x1eb2d3)
#23 PyObject_Call /usr/local/google/home/phawkins/p/cpython/Objects/call.c:373:12 (python3.13+0x1eb355) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#24 thread_run /usr/local/google/home/phawkins/p/cpython/./Modules/_threadmodule.c:337:21 (python3.13+0x564a32) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#25 pythread_wrapper /usr/local/google/home/phawkins/p/cpython/Python/thread_pthread.h:243:5 (python3.13+0x4bddb7) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
Previous write of size 4 at 0x72a40001e02c by thread T7:
#0 _Py_LeaveRecursiveCallPy /usr/local/google/home/phawkins/p/cpython/Python/ceval_macros.h:389:35 (python3.13+0x3f3993) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#1 _PyEval_EvalFrameDefault /usr/local/google/home/phawkins/p/cpython/Python/generated_cases.c.h:5257:13 (python3.13+0x3f3993)
#2 _PyEval_EvalFrame /usr/local/google/home/phawkins/p/cpython/./Include/internal/pycore_ceval.h:119:16 (python3.13+0x3dea3a) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#3 _PyEval_Vector /usr/local/google/home/phawkins/p/cpython/Python/ceval.c:1807:12 (python3.13+0x3dea3a)
#4 _PyFunction_Vectorcall /usr/local/google/home/phawkins/p/cpython/Objects/call.c (python3.13+0x1eb65f) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#5 _PyObject_VectorcallTstate /usr/local/google/home/phawkins/p/cpython/./Include/internal/pycore_call.h:168:11 (python3.13+0x572352) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#6 partial_vectorcall /usr/local/google/home/phawkins/p/cpython/./Modules/_functoolsmodule.c:252:16 (python3.13+0x572352)
#7 _PyVectorcall_Call /usr/local/google/home/phawkins/p/cpython/Objects/call.c:273:16 (python3.13+0x1eb2d3) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#8 _PyObject_Call /usr/local/google/home/phawkins/p/cpython/Objects/call.c:348:16 (python3.13+0x1eb2d3)
#9 PyObject_Call /usr/local/google/home/phawkins/p/cpython/Objects/call.c:373:12 (python3.13+0x1eb355) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#10 _PyEval_EvalFrameDefault /usr/local/google/home/phawkins/p/cpython/Python/generated_cases.c.h:1355:26 (python3.13+0x3e4af2) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#11 _PyEval_EvalFrame /usr/local/google/home/phawkins/p/cpython/./Include/internal/pycore_ceval.h:119:16 (python3.13+0x3dea3a) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#12 _PyEval_Vector /usr/local/google/home/phawkins/p/cpython/Python/ceval.c:1807:12 (python3.13+0x3dea3a)
#13 _PyFunction_Vectorcall /usr/local/google/home/phawkins/p/cpython/Objects/call.c (python3.13+0x1eb65f) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#14 _PyObject_VectorcallTstate /usr/local/google/home/phawkins/p/cpython/./Include/internal/pycore_call.h:168:11 (python3.13+0x1ef62f) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#15 method_vectorcall /usr/local/google/home/phawkins/p/cpython/Objects/classobject.c:70:20 (python3.13+0x1ef62f)
#16 _PyVectorcall_Call /usr/local/google/home/phawkins/p/cpython/Objects/call.c:273:16 (python3.13+0x1eb2d3) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#17 _PyObject_Call /usr/local/google/home/phawkins/p/cpython/Objects/call.c:348:16 (python3.13+0x1eb2d3)
#18 PyObject_Call /usr/local/google/home/phawkins/p/cpython/Objects/call.c:373:12 (python3.13+0x1eb355) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#19 thread_run /usr/local/google/home/phawkins/p/cpython/./Modules/_threadmodule.c:337:21 (python3.13+0x564a32) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#20 pythread_wrapper /usr/local/google/home/phawkins/p/cpython/Python/thread_pthread.h:243:5 (python3.13+0x4bddb7) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
```
Looks like the per-thread update of `p->py_recursion_remaining` is racy.
### CPython versions tested on:
3.13
### Operating systems tested on:
Linux
<!-- gh-linked-prs -->
### Linked PRs
* gh-128741
* gh-128757
<!-- /gh-linked-prs -->
| f6c61bf2d7d8b66ccd9f16e723546bdcc251a3d0 | ff39e3ff7bebc9d700d89c5cd22145db2c879cf2 |
python/cpython | python__cpython-129016 | # Race in func_get_annotations under free-threading
# Bug report
### Bug description:
With CPython 3.13 from commit 65da5db28a39cb0d9ee311206bdc8745b482c56f TSAN reports the following race, which looks right: the initialization of `p->func_annotations` is racy.
Reproducer:
```python
import concurrent.futures
import functools
import threading
num_threads = 8
def closure(b, f):
b.wait()
f.__annotations__
with concurrent.futures.ThreadPoolExecutor(max_workers=num_threads) as executor:
for _ in range(100):
b = threading.Barrier(num_threads)
def f(x: int) -> int:
return x + 1
for _ in range(num_threads):
executor.submit(functools.partial(closure, b, f))
```
TSAN report (first race):
```
WARNING: ThreadSanitizer: data race (pid=3380651)
Read of size 8 at 0x7f02728d6840 by thread T5:
#0 func_get_annotations /usr/local/google/home/phawkins/p/cpython/Objects/funcobject.c:769:13 (python3.13+0x232542) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#1 getset_get /usr/local/google/home/phawkins/p/cpython/Objects/descrobject.c:193:16 (python3.13+0x1ff888) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#2 _PyObject_GenericGetAttrWithDict /usr/local/google/home/phawkins/p/cpython/Objects/object.c:1665:19 (python3.13+0x295e11) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#3 PyObject_GenericGetAttr /usr/local/google/home/phawkins/p/cpython/Objects/object.c:1747:12 (python3.13+0x295c62) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#4 PyObject_GetAttr /usr/local/google/home/phawkins/p/cpython/Objects/object.c:1261:18 (python3.13+0x2945c7) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#5 _PyEval_EvalFrameDefault /usr/local/google/home/phawkins/p/cpython/Python/generated_cases.c.h:3766:28 (python3.13+0x3ee2b0) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#6 _PyEval_EvalFrame /usr/local/google/home/phawkins/p/cpython/./Include/internal/pycore_ceval.h:119:16 (python3.13+0x3dea3a) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#7 _PyEval_Vector /usr/local/google/home/phawkins/p/cpython/Python/ceval.c:1807:12 (python3.13+0x3dea3a)
#8 _PyFunction_Vectorcall /usr/local/google/home/phawkins/p/cpython/Objects/call.c (python3.13+0x1eb65f) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#9 _PyObject_VectorcallTstate /usr/local/google/home/phawkins/p/cpython/./Include/internal/pycore_call.h:168:11 (python3.13+0x572352) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#10 partial_vectorcall /usr/local/google/home/phawkins/p/cpython/./Modules/_functoolsmodule.c:252:16 (python3.13+0x572352)
#11 _PyVectorcall_Call /usr/local/google/home/phawkins/p/cpython/Objects/call.c:273:16 (python3.13+0x1eb2d3) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#12 _PyObject_Call /usr/local/google/home/phawkins/p/cpython/Objects/call.c:348:16 (python3.13+0x1eb2d3)
#13 PyObject_Call /usr/local/google/home/phawkins/p/cpython/Objects/call.c:373:12 (python3.13+0x1eb355) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#14 _PyEval_EvalFrameDefault /usr/local/google/home/phawkins/p/cpython/Python/generated_cases.c.h:1355:26 (python3.13+0x3e4af2) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#15 _PyEval_EvalFrame /usr/local/google/home/phawkins/p/cpython/./Include/internal/pycore_ceval.h:119:16 (python3.13+0x3dea3a) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#16 _PyEval_Vector /usr/local/google/home/phawkins/p/cpython/Python/ceval.c:1807:12 (python3.13+0x3dea3a)
#17 _PyFunction_Vectorcall /usr/local/google/home/phawkins/p/cpython/Objects/call.c (python3.13+0x1eb65f) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#18 _PyObject_VectorcallTstate /usr/local/google/home/phawkins/p/cpython/./Include/internal/pycore_call.h:168:11 (python3.13+0x1ef62f) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#19 method_vectorcall /usr/local/google/home/phawkins/p/cpython/Objects/classobject.c:70:20 (python3.13+0x1ef62f)
#20 _PyVectorcall_Call /usr/local/google/home/phawkins/p/cpython/Objects/call.c:273:16 (python3.13+0x1eb2d3) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#21 _PyObject_Call /usr/local/google/home/phawkins/p/cpython/Objects/call.c:348:16 (python3.13+0x1eb2d3)
#22 PyObject_Call /usr/local/google/home/phawkins/p/cpython/Objects/call.c:373:12 (python3.13+0x1eb355) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#23 thread_run /usr/local/google/home/phawkins/p/cpython/./Modules/_threadmodule.c:337:21 (python3.13+0x564a32) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#24 pythread_wrapper /usr/local/google/home/phawkins/p/cpython/Python/thread_pthread.h:243:5 (python3.13+0x4bddb7) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
Previous write of size 8 at 0x7f02728d6840 by thread T7:
#0 func_get_annotation_dict /usr/local/google/home/phawkins/p/cpython/Objects/funcobject.c:535:9 (python3.13+0x22f46f) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#1 func_get_annotations /usr/local/google/home/phawkins/p/cpython/Objects/funcobject.c:774:19 (python3.13+0x23256c) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#2 getset_get /usr/local/google/home/phawkins/p/cpython/Objects/descrobject.c:193:16 (python3.13+0x1ff888) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#3 _PyObject_GenericGetAttrWithDict /usr/local/google/home/phawkins/p/cpython/Objects/object.c:1665:19 (python3.13+0x295e11) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#4 PyObject_GenericGetAttr /usr/local/google/home/phawkins/p/cpython/Objects/object.c:1747:12 (python3.13+0x295c62) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#5 PyObject_GetAttr /usr/local/google/home/phawkins/p/cpython/Objects/object.c:1261:18 (python3.13+0x2945c7) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#6 _PyEval_EvalFrameDefault /usr/local/google/home/phawkins/p/cpython/Python/generated_cases.c.h:3766:28 (python3.13+0x3ee2b0) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#7 _PyEval_EvalFrame /usr/local/google/home/phawkins/p/cpython/./Include/internal/pycore_ceval.h:119:16 (python3.13+0x3dea3a) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#8 _PyEval_Vector /usr/local/google/home/phawkins/p/cpython/Python/ceval.c:1807:12 (python3.13+0x3dea3a)
#9 _PyFunction_Vectorcall /usr/local/google/home/phawkins/p/cpython/Objects/call.c (python3.13+0x1eb65f) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#10 _PyObject_VectorcallTstate /usr/local/google/home/phawkins/p/cpython/./Include/internal/pycore_call.h:168:11 (python3.13+0x572352) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#11 partial_vectorcall /usr/local/google/home/phawkins/p/cpython/./Modules/_functoolsmodule.c:252:16 (python3.13+0x572352)
#12 _PyVectorcall_Call /usr/local/google/home/phawkins/p/cpython/Objects/call.c:273:16 (python3.13+0x1eb2d3) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#13 _PyObject_Call /usr/local/google/home/phawkins/p/cpython/Objects/call.c:348:16 (python3.13+0x1eb2d3)
#14 PyObject_Call /usr/local/google/home/phawkins/p/cpython/Objects/call.c:373:12 (python3.13+0x1eb355) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#15 _PyEval_EvalFrameDefault /usr/local/google/home/phawkins/p/cpython/Python/generated_cases.c.h:1355:26 (python3.13+0x3e4af2) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#16 _PyEval_EvalFrame /usr/local/google/home/phawkins/p/cpython/./Include/internal/pycore_ceval.h:119:16 (python3.13+0x3dea3a) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#17 _PyEval_Vector /usr/local/google/home/phawkins/p/cpython/Python/ceval.c:1807:12 (python3.13+0x3dea3a)
#18 _PyFunction_Vectorcall /usr/local/google/home/phawkins/p/cpython/Objects/call.c (python3.13+0x1eb65f) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#19 _PyObject_VectorcallTstate /usr/local/google/home/phawkins/p/cpython/./Include/internal/pycore_call.h:168:11 (python3.13+0x1ef62f) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#20 method_vectorcall /usr/local/google/home/phawkins/p/cpython/Objects/classobject.c:70:20 (python3.13+0x1ef62f)
#21 _PyVectorcall_Call /usr/local/google/home/phawkins/p/cpython/Objects/call.c:273:16 (python3.13+0x1eb2d3) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#22 _PyObject_Call /usr/local/google/home/phawkins/p/cpython/Objects/call.c:348:16 (python3.13+0x1eb2d3)
#23 PyObject_Call /usr/local/google/home/phawkins/p/cpython/Objects/call.c:373:12 (python3.13+0x1eb355) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#24 thread_run /usr/local/google/home/phawkins/p/cpython/./Modules/_threadmodule.c:337:21 (python3.13+0x564a32) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
#25 pythread_wrapper /usr/local/google/home/phawkins/p/cpython/Python/thread_pthread.h:243:5 (python3.13+0x4bddb7) (BuildId: 19c569fa942016d8ac49d19fd40ccb1ddded939b)
```
### CPython versions tested on:
3.13
### Operating systems tested on:
Linux
<!-- gh-linked-prs -->
### Linked PRs
* gh-129016
* gh-129729
<!-- /gh-linked-prs -->
| 55f17b77c305be877ac856d6426b13591cbc7fc8 | 63f0406d5ad25a55e49c3903b29407c50a17cfd5 |
python/cpython | python__cpython-128854 | # Windows 10 Mimetypes for .webp return empty
# Bug report
### Bug description:
on Windows 10 [`guess_file_type()`](https://github.com/python/cpython/blob/3.13/Lib/mimetypes.py#L151) checking `.webp` file return `tuple('', None)` not `tuple('image/webp', None)`
The problem is `db.read_windows_registry()` overwrite default types_map `.webp = 'image/webp'` into `.webp = ''`
https://github.com/python/cpython/blob/65da5db28a39cb0d9ee311206bdc8745b482c56f/Lib/mimetypes.py#L390-L393
### CPython versions tested on:
3.11, 3.12, 3.13
### Operating systems tested on:
Windows
<!-- gh-linked-prs -->
### Linked PRs
* gh-128854
* gh-130121
* gh-130122
<!-- /gh-linked-prs -->
| 303043f5062c1e7ffb7907abde61dbf13c98f8e9 | 3402e133ef26736296c07992266a82b181a5d532 |
python/cpython | python__cpython-128701 | # sysconfig.get_platform(): specify result for Windows ARM64
https://docs.python.org/3/library/sysconfig.html#sysconfig.get_platform currently says for Windows:
> Windows will return one of:
> - win-amd64 (64bit Windows on AMD64, aka x86_64, Intel64, and EM64T)
> - win32 (all others - specifically, sys.platform is returned)
Since #77306 was implemented, ARM64 is a possibility on Windows as well, so the expected platform identifier should be listed in the docs.
<!-- gh-linked-prs -->
### Linked PRs
* gh-128701
* gh-128773
* gh-128774
<!-- /gh-linked-prs -->
| 553cdc6d6856c1b4539a45eb90d0769f7c629355 | 1b39b502d33c68f52fd775c4e6c2174baddd40bd |
python/cpython | python__cpython-128702 | # `./python.exe -m test test_types test_inspect` fails as `(env changed)`
# Bug report
```
» ./python.exe -m test test_types test_inspect
Using random seed: 1107570136
0:00:00 load avg: 3.01 Run 2 tests sequentially in a single process
0:00:00 load avg: 3.01 [1/2] test_types
0:00:00 load avg: 3.01 [2/2] test_inspect.test_inspect
Warning -- asyncio.events._event_loop_policy was modified by test_inspect.test_inspect
Warning -- Before: None
Warning -- After: <asyncio.unix_events._UnixDefaultEventLoopPolicy object at 0x102437760>
test_inspect.test_inspect failed (env changed)
== Tests result: SUCCESS ==
1 test altered the execution environment (env changed):
test_inspect.test_inspect
1 test OK.
Total duration: 1.0 sec
Total tests: run=473
Total test files: run=2/2 env_changed=1
Result: SUCCESS
```
I am working on the fix.
<!-- gh-linked-prs -->
### Linked PRs
* gh-128702
<!-- /gh-linked-prs -->
| 65b484db97b170af0f0e50655c4dcc6b9b1af8e9 | 2fcdc8488c32d18f4567f797094068a994777f16 |
python/cpython | python__cpython-128693 | # `threading.local()` access should scale well from multiple threads
Currently, accessing a `threading.local()` from multiple threads doesn't scale well because of reference count contention on the shared `_thread._local` object. We should use deferred reference counting on `_thread._local` to avoid this bottleneck.
<!-- gh-linked-prs -->
### Linked PRs
* gh-128693
* gh-128753
<!-- /gh-linked-prs -->
| c1417487e98e270d614965ed78ff9439044b65a6 | 087bb48acac997c06e69dae25bae2dd75194b980 |
python/cpython | python__cpython-128708 | # `LOAD_CONST_IMMORTAL` doesn't survive being instrumented and de-instrumented.
# Bug report
### Bug description:
When instrumenting, instructions are first de-optimized to their base instruction.
When instrumentation is removed we assume that specialization will restore the specialized instruction.
However, that doesn't happen for `LOAD_CONST_IMMORTAL` because `LOAD_CONST_IMMORTAL` isn't a specialization form of `LOAD_CONST`, but a quickened form of it.
The fix should be simple. Instead of quickening `LOAD_CONST` to `LOAD_CONST_IMMORTAL`, we add a `LOAD_CONST_MORTAL` and have `LOAD_CONST` specialize (rather than quicken) to either `LOAD_CONST_MORTAL` or `LOAD_CONST_IMMORTAL`.
### CPython versions tested on:
CPython main branch
### Operating systems tested on:
_No response_
<!-- gh-linked-prs -->
### Linked PRs
* gh-128708
<!-- /gh-linked-prs -->
| ddd959987c557beaf823b681bf5e5e573ad657ac | 29fe8072cf404b891dde9c1d415095edddbe19de |
python/cpython | python__cpython-128674 | # `typing.get_type_hints` is not fully covered
<img width="1338" alt="Снимок экрана 2025-01-09 в 15 23 03" src="https://github.com/user-attachments/assets/027336ba-bcbf-4156-b3bf-7b657fc74b63" />
I will send a PR with a new test.
<!-- gh-linked-prs -->
### Linked PRs
* gh-128674
<!-- /gh-linked-prs -->
| 43ac9f505903ba806aa6a5d93e6a67beb04bebc4 | ea39c8b08d8f025273bfa5b7a95f7b5984dc1e86 |
python/cpython | python__cpython-128663 | # `typing.evaluate_forward_ref` is not fully covered
Right now it is:
<img width="1341" alt="Снимок экрана 2025-01-09 в 11 36 03" src="https://github.com/user-attachments/assets/6a44ec6e-3012-46ed-9e90-cac2e6a6d767" />
I have a PR ready.
<!-- gh-linked-prs -->
### Linked PRs
* gh-128663
* gh-128930
<!-- /gh-linked-prs -->
| b725297cee9e5608b709f3c7291d974c97f68fff | 43ac9f505903ba806aa6a5d93e6a67beb04bebc4 |
python/cpython | python__cpython-128886 | # Race in py_digest_by_name, _hashopenssl.c under free-threading
# Bug report
### Bug description:
I built cpython (3.13 branch) with free-threading and TSAN. The following python code from time to time reports TSAN warnings:
```python
import hashlib
import concurrent.futures
import threading
def _hash_string(hash_obj, str_var):
hash_obj.update(str_var.encode("utf-8").strip())
jaxlib_version_str = "abcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdef"
compression_algorithm = "zstandard"
def test_hashlib_sha256():
entries = [
(
"jax_lib version",
lambda hash_obj: hash_obj.update(
bytes(jaxlib_version_str.encode("utf-8"))
),
),
(
"compression",
lambda hash_obj: _hash_string(hash_obj, compression_algorithm),
),
("custom_hook", lambda hash_obj: _hash_string(hash_obj, "")),
]
hash_obj = hashlib.sha256()
for _ in range(20):
for name, hashfn in entries:
hashfn(hash_obj)
for _ in range(20):
hash_obj.digest().hex()
if __name__ == "__main__":
num_workers = 40
num_runs = 100
barrier = threading.Barrier(num_workers)
def closure():
barrier.wait()
for _ in range(num_runs):
test_hashlib_sha256()
with concurrent.futures.ThreadPoolExecutor(max_workers=num_workers) as executor:
futures = []
for i in range(num_workers):
futures.append(executor.submit(closure))
assert len(list(f.result() for f in futures)) == num_workers
```
TSAN report extract:
```
==================
WARNING: ThreadSanitizer: data race (pid=46290)
Write of size 8 at 0x7fffb40402c0 by thread T5:
#0 py_digest_by_name /project/cpython/./Modules/_hashopenssl.c:384:28 (_hashlib.cpython-313t-x86_64-linux-gnu.so+0x7ce6) (BuildId: cc517b229181dc934d8851b36d8993a3b5cedfb1)
#1 py_evp_fromname /project/cpython/./Modules/_hashopenssl.c:914:14 (_hashlib.cpython-313t-x86_64-linux-gnu.so+0x7872) (BuildId: cc517b229181dc934d8851b36d8993a3b5cedfb1)
#2 _hashlib_openssl_sha256_impl /project/cpython/./Modules/_hashopenssl.c:1083:12 (_hashlib.cpython-313t-x86_64-linux-gnu.so+0x6f75) (BuildId: cc517b229181dc934d8851b36d8993a3b5cedfb1)
#3 _hashlib_openssl_sha256 /project/cpython/./Modules/clinic/_hashopenssl.c.h:591:20 (_hashlib.cpython-313t-x86_64-linux-gnu.so+0x6f75)
#4 cfunction_vectorcall_FASTCALL_KEYWORDS /project/cpython/Objects/methodobject.c:441:24 (python3.13t+0x289f20) (BuildId: 0d639d83db92b5fe0f1dbe7fdffbc7405ce29a98)
```
[Full TSAN report](https://gist.github.com/vfdev-5/2896eb30fc6ec6888c2f0dbaa31e550e#file-check-log)
cc @colesbury
### CPython versions tested on:
3.13
### Operating systems tested on:
Linux
<!-- gh-linked-prs -->
### Linked PRs
* gh-128886
* gh-129833
* gh-129852
* gh-129853
* gh-130018
<!-- /gh-linked-prs -->
| c1f352bf0813803bb795b796c16040a5cd4115f2 | 5ce70ad129d2e34a09f8ae6ee0542f4f996fb8ec |
python/cpython | python__cpython-128651 | # incorrect statement in partial documentation
# Documentation
Now:
```rst
...; without :data:`!Placeholder`, only the
first positional argument can be pre-filled.
```
Should be:
```rst
...; without :data:`!Placeholder`, only the chosen number of
leading positional arguments can be pre-filled.
```
<!-- gh-linked-prs -->
### Linked PRs
* gh-128651
<!-- /gh-linked-prs -->
| 8af57810946c216b3e18c94c8f0ee3c0c96566a9 | 7dc41ad6a7826ffc675f088972de96624917696e |
python/cpython | python__cpython-128647 | # GzipFile.readinto reads full file before copying into the provided buffer
# Bug report
### Bug description:
gzip.GzipFile uses the BufferedIOBase implementation of `.readinto()`, which simply calls `.read` and copies the result into a buffer. This negates the purpose of using `.readinto()` at all.
This may be considered more a missed optimization than a bug, but it is being reported in downstream tools and I've traced it back to CPython.
```python
import os
from gzip import GzipFile
n_mbs = 50
with GzipFile('test.gz', mode='wb') as fobj:
for _ in range(n_mbs):
fobj.write(os.urandom(2**20))
buffer = bytearray(n_mbs * 2**20)
with GzipFile('test.gz', mode='rb') as fobj:
fobj.readinto(buffer)
```
```shell
memray load_file.py
memray flamegraph memray-*.bin && rm memray-*.bin
```
**Current memory profile**

Duration: 0:00:01.821000
Total number of allocations: 5064
Total number of frames seen: 85
Peak memory usage: 116.3 MiB
Python allocator: pymalloc
**Patched memory profile**

Duration: 0:00:01.828000
Total number of allocations: 3317
Total number of frames seen: 79
Peak memory usage: 66.2 MiB
Python allocator: pymalloc
**Patch**
```diff
diff --git a/Lib/gzip.py b/Lib/gzip.py
index 1a3c82ce7e0..21bb4b085fd 100644
--- a/Lib/gzip.py
+++ b/Lib/gzip.py
@@ -338,6 +338,20 @@ def read1(self, size=-1):
size = io.DEFAULT_BUFFER_SIZE
return self._buffer.read1(size)
+ def readinto(self, b):
+ self._check_not_closed()
+ if self.mode != READ:
+ import errno
+ raise OSError(errno.EBADF, "readinto() on write-only GzipFile object")
+ return self._buffer.readinto(b)
+
+ def readinto1(self, b):
+ self._check_not_closed()
+ if self.mode != READ:
+ import errno
+ raise OSError(errno.EBADF, "readinto1() on write-only GzipFile object")
+ return self._buffer.readinto1(b)
+
def peek(self, n):
self._check_not_closed()
if self.mode != READ:
```
I believe this should be an uncontroversial patch, so I will open a PR immediately.
cc @psadil
### CPython versions tested on:
3.9, 3.10, 3.11, 3.12, 3.13, CPython main branch
### Operating systems tested on:
Linux
<!-- gh-linked-prs -->
### Linked PRs
* gh-128647
<!-- /gh-linked-prs -->
| 72e5b25efb580fb1f0fdfade516be90d90822164 | 78790811989ab47319e2ee725e0c435b3cdd21ab |
python/cpython | python__cpython-129596 | # Significant Configparser Performance Regression
# Bug report
### Bug description:
Hello, @jaraco! The following commit https://github.com/python/cpython/commit/019143fecbfc26e69800d28d2a9e3392a051780b slows down `ConfigParser.read()` from 2 to 6 times.
`_Line` is created many times when reading a file and the same regular expression is compiled for each object `_strip_inline`. This amounts to a 60% speed loss. The simplest solution would be to add a `__call__` method and preferably create a `_Line(object)` when initializing `RawConfigParser` with an empty string value. Or abandon the `_Line` object altogether.
Another 40% of the performance loss comes from using `cached_property` for `_Line.clean` (10%), writing to `_ReadState` attributes instead of local variables (15%), and breaking up the previous giant loop into new `_handle` functions (15%).
I discovered this circumstance when writing an update to webbrowser. I needed to parse hundreds of small .desktop files. At first I didn't understand the reason for the increase in execution time between different distributions, so I developed 3 versions of the program:
`(M)` Multiprocessing
`(O)` Original Routine
`(T)` Threading
And measured their performance using timeit:
```
Linux arch 6.10.6-arch1-1
Parsing 186 files
Python 3.11.11
(M) 5 loops, best of 5: 62.4 msec per loop
(O) 2 loops, best of 5: 110 msec per loop
(T) 2 loops, best of 5: 130 msec per loop
Python 3.12.8
(M) 5 loops, best of 5: 66.5 msec per loop
(O) 2 loops, best of 5: 118 msec per loop
(T) 2 loops, best of 5: 140 msec per loop
Python 3.13.1
(M) 2 loops, best of 5: 125 msec per loop
(O) 1 loop, best of 5: 222 msec per loop
(T) 1 loop, best of 5: 248 msec per loop
Python 3.13.1 Free-threaded
(M) 1 loop, best of 5: 331 msec per loop
(O) 1 loop, best of 5: 648 msec per loop
(T) 1 loop, best of 5: 340 msec per loop
```
As you can see, performance regression is 2-6 times between 3.11 and 3.13. Isolated comparison of the new and old configparser, which verifies the slowdown of free-threading by 6 times:
```
Python 3.13t (Old)
(M) 10 loops, best of 5: 26.7 msec per loop
(O) 5 loops, best of 5: 59.4 msec per loop
(T) 10 loops, best of 5: 26 msec per loop
Python 3.13t (New)
(M) 2 loops, best of 5: 137 msec per loop
(O) 1 loop, best of 5: 361 msec per loop
(T) 2 loops, best of 5: 125 msec per loop
```
I also attach a small reproducible test, just a module calling read():
```python
import configparser
files = [
"python3.13.desktop",
"python3.10.desktop",
"htop.desktop",
"byobu.desktop",
"com.gexperts.Tilix.desktop",
"snap-handle-link.desktop",
"io.snapcraft.SessionAgent.desktop",
"remote-viewer.desktop",
"python3.12.desktop",
"google-chrome.desktop",
"vim.desktop",
"python3.11.desktop",
"virt-manager.desktop",
"info.desktop",
"ubuntu-desktop-installer_ubuntu-desktop-installer.desktop",
"firefox_firefox.desktop",
]
def main() -> None:
parser = configparser.ConfigParser(interpolation=None)
for shortcut in files:
try:
parser.clear()
if not parser.read(shortcut, encoding="utf-8"):
continue
except (UnicodeDecodeError, configparser.Error):
continue
if __name__ == "__main__":
main()
```
Archive with the above mentioned .desktop files:
[shortcuts.zip](https://github.com/user-attachments/files/18351245/shortcuts.zip)
And a program for generating your own .desktop paths on Linux/BSD:
```python
import glob
import os
XDG_DATA_HOME = os.environ.get(
"XDG_DATA_HOME", os.path.expanduser("~/.local/share")
)
XDG_DATA_DIRS = os.environ.get(
"XDG_DATA_DIRS", "/usr/local/share/:/usr/share/"
)
XDG_DATA_DIRS = XDG_DATA_DIRS.split(os.pathsep)
def main() -> list[str]:
files = []
for appdata in (XDG_DATA_HOME, *XDG_DATA_DIRS):
shortcuts = os.path.join(appdata, "applications")
if not os.path.isdir(shortcuts):
continue
shortcuts = os.path.join(shortcuts, "**", "*.desktop")
files.extend(glob.iglob(shortcuts, recursive=True))
return files
if __name__ == "__main__":
print(main())
```
Just run this example with different interpreters and you will see the difference:
```shell
$ python3.11 -m timeit -s "import nixconfig" "nixconfig.main()"
50 loops, best of 5: 5.27 msec per loop
$ python3.12 -m timeit -s "import nixconfig" "nixconfig.main()"
50 loops, best of 5: 5.33 msec per loop
$ python3.13 -m timeit -s "import nixconfig" "nixconfig.main()"
20 loops, best of 5: 11.2 msec per loop
```
At this point I leave the solution to this problem to you, as I have no architectural vision of configparser. However, I am willing to offer my help in proposing solutions for Pull Request.
### CPython versions tested on:
3.11, 3.12, 3.13
### Operating systems tested on:
Linux
<!-- gh-linked-prs -->
### Linked PRs
* gh-129596
<!-- /gh-linked-prs -->
| cd6abe27a2582786da7b4b8bb008910563f31735 | 071820113f11b8f6a21f98652d0840e10268114c |
python/cpython | python__cpython-128744 | # NULL ptr deref in _PyCode_ConstantKey when compiling code
# Crash report
### What happened?
Unfortunately it's a slightly large minimal reproducer. You can use `xxd -r` to go from the hexdump to the actual binary.
```
~/p/cpython ❯❯❯ xxd ~/Downloads/clusterfuzz-testcase-minimized-fuzz_pycompile-5092056728403968
00000000: 5c62 2320 2323 2063 6f64 696e 673a 206c \b# ## coding: l
00000010: 6174 696e 332f 30ff ffff ffff ffff ff6c atin3/0........l
00000020: 6174 696e 37ff ffff 6463 6173 6564 6464 atin7...dcaseddd
00000030: 6464 6479 2e62 6b0a 0a0a 0a63 6c61 7373 dddy.bk....class
00000040: 2069 6e32 2829 3a0a 2020 2364 6464 6464 in2():. #ddddd
00000050: 6762 6b0a 0a20 2064 6464 6464 640a 0a0a gbk.. dddddd...
00000060: 476c 6174 762e 5f5f 7274 0a63 6c61 7373 Glatv.__rt.class
00000070: 2069 6e32 28ba 293a 0a20 2064 6464 6464 in2(.):. ddddd
00000080: 6467 626c 0a0a 2020 636c 6173 7320 47ed dgbl.. class G.
00000090: 5b5f 7072 7765 616e 7065 725d 3a61 7464 [_prweanper]:atd
000000a0: 6464 640a 0a0a 0a0a 0a0a 0a30 6f37 300a ddd........0o70.
000000b0: 0a0a 0a0a 0a0a 0a0a 7476 6147 6c2e 5f5f ........tvaGl.__
000000c0: 7274 0a63 6c61 7373 2069 6e32 28cf 293a rt.class in2(.):
000000d0: 0a20 2064 6464 6464 6467 626c 0a0a 2020 . ddddddgbl..
000000e0: 636c 6173 7320 47ed 5b5f 7072 7765 616e class G.[_prwean
000000f0: 7065 725d 3a61 2564 6462 2320 6762 6c0a per]:a%ddb# gbl.
00000100: 0a20 2063 6c61 7373 2047 ed5b 5f70 7277 . class G.[_prw
00000110: 6561 6e70 6572 5d3a 6174 6464 6464 0a0a eanper]:atdddd..
00000120: 2320 636f 6469 6e67 3d6c 6174 696e 2d31 # coding=latin-1
00000130: 0a0a 0a47 6c61 7476 2e5f 5f72 740a 636c ...Glatv.__rt.cl
00000140: 6173 7320 696e 3228 ba29 3a0a 2020 6464 ass in2(.):. dd
00000150: 6464 6464 6762 6c0a 0a20 2063 6c61 7373 ddddgbl.. class
00000160: 2047 ed5b 5f5f 636c 6173 7364 6963 745f G.[__classdict_
00000170: 5f5d 3a61 7464 6464 640a 0a0a 0a0a 0a0a _]:atdddd.......
00000180: 0a30 6f37 300a 0a0a 0a0a 0a0a 0a0a 7476 .0o70.........tv
00000190: 6147 6c2e 5f5f 7274 0a63 6c61 7373 2069 aGl.__rt.class i
000001a0: 6e32 28cf 293a 0a20 2064 6464 6464 6467 n2(.):. ddddddg
000001b0: 626c 0a0a 2020 636c 6173 7320 47ed 5b5f bl.. class G.[_
000001c0: 7072 7765 616e 7065 725d 3a61 2564 6462 prweanper]:a%ddb
000001d0: 2320 6762 6c0a 0a20 2063 6c61 7373 2047 # gbl.. class G
000001e0: ed5b 5f70 7277 6561 6e70 6572 5d3a 6174 .[_prweanper]:at
000001f0: 6464 6464 0a0a 2320 636f 2600 0000 0000 dddd..# co&.....
00000200: 0000 6469 6c67 3d6c 6174 696e 2d31 0a0a ..dilg=latin-1..
00000210: 0a47 6c61 7476 2e5f 5f72 740a 636c 6173 .Glatv.__rt.clas
00000220: 7320 696e 3228 ba29 3a0a 2020 6464 6464 s in2(.):. dddd
00000230: 6464 6762 6c0a 0a20 2063 6c61 7373 2047 ddgbl.. class G
00000240: ed5b 5f70 7277 6561 6e70 6572 5d3a 6174 .[_prweanper]:at
00000250: 6464 6464 0aee 0a0a 0a0a 0a0a 306f 3730 dddd........0o70
00000260: 0a0a 0a0a 0a0a 0a0a 0a47 6c61 7476 2e5f .........Glatv._
00000270: 5f72 740a 636c 6173 7320 696e 3228 cf29 _rt.class in2(.)
00000280: 3a0a 2020 6464 6464 6464 6762 6c0a 0a20 :. ddddddgbl..
00000290: 2063 6c61 7373 2047 ed5b 5f70 7277 6561 class G.[_prwea
000002a0: 6e70 6572 5d3a 6125 6464 6223 2023 2320 nper]:a%ddb# ##
000002b0: 636f 64ff ffff ff64 6464 6464 989b 86d1 cod....ddddd....
000002c0: 9d94 f5f5 0a0a 636c 6173 7320 696e 3228 ......class in2(
000002d0: 293a 6f37 300a 0a0a 0a0a 0a0a 0a40 476c ):o70........@Gl
000002e0: 6174 3a61 7464 6464 640a 0a0a 0a0a 0a0a at:atdddd.......
000002f0: 0a30 6f37 300a 0a0a 0a0a 0a0a 0a0a 476c .0o70.........Gl
00000300: 6174 762e 6223 2023 2320 606f 6469 6e67 atv.b# ## `oding
00000310: 3a20 6c61 7469 6e33 2f30 ffff ffff ffff : latin3/0......
00000320: ffff 6c61 7469 6e37 ffff ff64 6361 7365 ..latin7...dcase
00000330: 6464 6464 6464 792e 2e5f 5f72 740a 636c ddddddy..__rt.cl
00000340: 6173 7320 696e 3228 ba29 3a0a 2020 6464 ass in2(.):. dd
00000350: 6464 6464 6762 6c0a 0a20 2063 6c61 7373 ddddgbl.. class
00000360: 2047 ed0a 306f 3730 0a0a 0a0a 0a0a 0a0a G..0o70........
00000370: 0a74 7661 476c 2e5f 5f72 740a 636c 6173 .tvaGl.__rt.clas
00000380: 7320 696e 3228 cf29 3a0a 2020 6464 6464 s in2(.):. dddd
00000390: 6464 6762 6c0a 0a20 2043 6c61 7373 2047 ddgbl.. Class G
000003a0: ed5b 5f70 7277 6561 6e70 6572 5d3a 6125 .[_prweanper]:a%
000003b0: 6464 6223 2067 6237 3531 3734 3631 3034 ddb# gb751746104
000003c0: 3530 3935 3634 3039 3431 3731 3531 2320 50956409417151#
000003d0: 636f 6464 6464 640a 0a23 2063 6f64 696e coddddd..# codin
000003e0: 673d 6c61 7469 6e2d 310a 0a0a 476c 6174 g=latin-1...Glat
000003f0: 762e 5f5f 7274 0a63 6c61 7373 2069 6e32 v.__rt.class in2
00000400: 28ba 293a 0a20 2064 6464 6464 6467 626c (.):. ddddddgbl
00000410: 0a0a 0a0a 0a0a 0a0a 0a47 6c61 7476 2e5f .........Glatv._
00000420: 5f72 740a 636c 6173 7320 696e 3228 cf29 _rt.class in2(.)
00000430: 3a0a 2020 6464 6464 6464 6762 6c0a 0a20 :. ddddddgbl..
00000440: 2063 6c61 7373 2047 ed5b 5f70 7277 6561 class G.[_prwea
00000450: 6e70 6572 5d3a 6125 6464 6264 6464 6464 nper]:a%ddbddddd
00000460: 6762 6b0a 0a20 2064 6464 6464 640a 0a0a gbk.. dddddd...
00000470: 476c 6174 762e 5f5f 7274 0a63 6c61 7373 Glatv.__rt.class
00000480: 2069 6e32 28ba 293a 0a20 2064 6464 6464 in2(.):. ddddd
00000490: 6467 626c 0a0a 2020 636c 6173 7320 47ed dgbl.. class G.
000004a0: 5b5f 7072 7765 616e 7065 725d 3a61 7464 [_prweanper]:atd
000004b0: 6464 640a 0a0a 0100 000d 0a0a 0a0a 0a30 ddd............0
000004c0: 6f37 300a 0a0a 0a0a 0a0a 0a74 7279 3a20 o70........try:
000004d0: 0a47 6c61 0a0a 0a0a 0a0a 0a47 6c61 7476 .Gla.......Glatv
000004e0: 2e5f 5f72 740a 636c 6173 7320 696e 3228 .__rt.class in2(
000004f0: cf29 3a0a 2020 6464 6464 6464 6762 6c0a .):. ddddddgbl.
00000500: 0a20 2063 6cff ffff ffff ffff ffff ffff . cl...........
00000510: ffff ffff ffff ffff ffff ffff ffff ffff ................
00000520: 6173 7320 47ed 5b5f 7072 7765 616e 7065 ass G.[_prweanpe
00000530: 725d 3a61 2564 6462 6464 6464 6467 626b r]:a%ddbdddddgbk
00000540: 0a0a 2020 6464 6464 6464 0a0a 0a43 6c61 .. dddddd...Cla
00000550: 7476 2e5f 5f72 740a 636c 6173 7320 6965 tv.__rt.class ie
00000560: 3228 ba29 3a0a 2020 6464 6464 6464 6762 2(.):. ddddddgb
00000570: 6c0a 0a20 2063 6c61 7373 2047 ed5b 5f70 l.. class G.[_p
00000580: 7277 6561 6e70 6572 5d3a 6174 640a ee0a rweanper]:atd...
00000590: 0a0a 0a0a 0a30 6f37 300a 0a0a 0a0a 0a0a .....0o70.......
000005a0: 0a0a 2f3d 2074 762e 5f5f 7274 0a63 6c61 ../= tv.__rt.cla
000005b0: 7373 2069 6e32 28cf 293a 0a20 2064 6464 ss in2(.):. ddd
000005c0: 6464 6467 626c 0a0a 5f70 7277 6561 6e70 dddgbl.._prweanp
000005d0: 6572 5d3a 6174 6464 6464 0a0a 2320 636f er]:atdddd..# co
000005e0: 6469 6e67 3d74 6820 6223 2023 2320 636f ding=th b# ## co
000005f0: 64ff ffff 7479 7065 ff64 6464 6464 6464 d...type.ddddddd
00000600: 792e 62 y.b
~/p/cpython ❯❯❯ ./python.exe -c '
data = open("/Users/alex_gaynor/Downloads/clusterfuzz-testcase-minimized-fuzz_pycompile-5092056728403968", "rb").read()
start = ["eval", "single", "exec"][data[0] % 3]
opt = data[1] % 4
compile(data[2:].split(b"\x00")[0], "<fuzz>", start, optimize=opt)'
python.exe(19196,0x1f3918240) malloc: nano zone abandoned due to inability to reserve vm space.
<string>:2: ResourceWarning: unclosed file <_io.BufferedReader name='/Users/alex_gaynor/Downloads/clusterfuzz-testcase-minimized-fuzz_pycompile-5092056728403968'>
data = open("/Users/alex_gaynor/Downloads/clusterfuzz-testcase-minimized-fuzz_pycompile-5092056728403968", "rb").read()
ResourceWarning: Enable tracemalloc to get the object allocation traceback
Include/object.h:268:20: runtime error: member access within null pointer of type 'PyObject' (aka 'struct _object')
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior Include/object.h:268:20 in
AddressSanitizer:DEADLYSIGNAL
=================================================================
==19196==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000008 (pc 0x000104329198 bp 0x00016bddd130 sp 0x00016bddd000 T0)
==19196==The signal is caused by a READ memory access.
==19196==Hint: address points to the zero page.
#0 0x104329198 in _PyCode_ConstantKey codeobject.c:2417
#1 0x104329430 in _PyCode_ConstantKey codeobject.c:2479
#2 0x104859bec in const_cache_insert compile.c:315
#3 0x104859794 in _PyCompile_ConstCacheMergeOne compile.c:1233
#4 0x104722d20 in _PyAssemble_MakeCodeObject assemble.c:754
#5 0x10485ad24 in _PyCompile_OptimizeAndAssemble compile.c:1369
#6 0x104812d58 in codegen_visit_stmt codegen.c:2897
#7 0x10480ba24 in _PyCodegen_Body codegen.c:828
#8 0x104824604 in codegen_class_body codegen.c:1483
#9 0x104812740 in codegen_visit_stmt codegen.c:2897
#10 0x10480ba24 in _PyCodegen_Body codegen.c:828
#11 0x10485d27c in compiler_codegen compile.c
#12 0x10485b518 in _PyAST_Compile compile.c:1382
#13 0x1049c48f0 in Py_CompileStringObject pythonrun.c:1497
#14 0x10475cb34 in builtin_compile bltinmodule.c.h:363
#15 0x1044669fc in cfunction_vectorcall_FASTCALL_KEYWORDS methodobject.c:452
#16 0x104304afc in _PyObject_VectorcallTstate pycore_call.h:167
#17 0x1047994f8 in _PyEval_EvalFrameDefault generated_cases.c.h:2013
#18 0x1047698b4 in PyEval_EvalCode ceval.c:658
#19 0x1049c66b8 in run_eval_code_obj pythonrun.c:1338
#20 0x1049c6204 in run_mod pythonrun.c:1423
#21 0x1049c21c4 in _PyRun_StringFlagsWithName pythonrun.c:1222
#22 0x1049c2004 in _PyRun_SimpleStringFlagsWithName pythonrun.c:548
#23 0x104a57cc4 in Py_RunMain main.c:776
#24 0x104a591b8 in pymain_main main.c:806
#25 0x104a59554 in Py_BytesMain main.c:830
#26 0x189cb8270 (<unknown module>)
==19196==Register values:
x[0] = 0x000000016bddcf18 x[1] = 0x0000000000000000 x[2] = 0x0000000000000000 x[3] = 0x00000001084007a0
x[4] = 0x0000000063000000 x[5] = 0x0000000000000000 x[6] = 0x0000000000000000 x[7] = 0x0000000000000000
x[8] = 0x0000000000000000 x[9] = 0x00000001064be5e8 x[10] = 0x0000000000000000 x[11] = 0x0000000000000084
x[12] = 0x0000000105c50000 x[13] = 0x00000001064c06e8 x[14] = 0x0000000000000000 x[15] = 0x0000000000000000
x[16] = 0x000000030a47dd90 x[17] = 0x00000001064180a0 x[18] = 0x0000000000000000 x[19] = 0x000000016bddd080
x[20] = 0x000000016bddd000 x[21] = 0x0000000000000000 x[22] = 0x0000000000000008 x[23] = 0x000000702d7dba00
x[24] = 0x0000000000000000 x[25] = 0x0000007000020000 x[26] = 0x0000000000000000 x[27] = 0x0000000000000000
x[28] = 0x0000000000000001 fp = 0x000000016bddd130 lr = 0x0000000104329834 sp = 0x000000016bddd000
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV codeobject.c:2417 in _PyCode_ConstantKey
==19196==ABORTING
fish: Job 1, './python.exe -c '' terminated by signal data = open("/Users/alex_gaynor… (start = ["eval", "single", "exe…)
fish: Job opt = data[1] % 4, 'compile(data[2:].split(b"\x00")…' terminated by signal SIGABRT (Abort)
```
Found by OSS-Fuzz.
### CPython versions tested on:
CPython main branch
### Operating systems tested on:
_No response_
### Output from running 'python -VV' on the command line:
_No response_
<!-- gh-linked-prs -->
### Linked PRs
* gh-128744
* gh-132085
* gh-132090
<!-- /gh-linked-prs -->
| 891c61c1fa480928dd60cce8bbc8764630c95025 | d1db43c139121202898e2d75df43ed2eb06a8470 |
python/cpython | python__cpython-128630 | # Add Py_PACK_VERSION macros
Add these to limited API:
* `Py_PACK_FULL_VERSION(x, y, z, level, serial)`: pack a version number from components
into the format used by `Py_VERSION_HEX` and `Py_LIMITED_API`.
For example, `Py_PACK_FULL_VERSION(3, 14, 0, 0xA, 1)` evaluates to 0x030E00A1.
* `Py_PACK_VERSION(x, y)`: shorthand for `Py_PACK_FULL_VERSION(x, y, 0, 0, 0)`,
useful because the first two version components often determine ABI
compatibility.
These are primarily macros, but we will export library functions with the same names and functionality, for use in wrappers for non-C languages – for example, Python with `ctypes`.
The functions take `int` arguments and return `uint32_t`. Inputs are masked (high bits are ignored).
C API WG decision: https://github.com/capi-workgroup/decisions/issues/47
<!-- gh-linked-prs -->
### Linked PRs
* gh-128630
* gh-134247
<!-- /gh-linked-prs -->
| 1439b81928f1b52c5a0ac7fd81fdd66afd5f72da | 4685401845ba3e2ab8c9f4a9a10aa2969b11985f |
python/cpython | python__cpython-128628 | # Emscripten: Use wasm-gc for call trampolines instead of JS type reflection
Followup to: #121698. WebAssembly in the browser is soon gaining stack switching support, but we're not allowed to stack switch through JS frames. The stack switching support used to require the wasm-js-type-reflection proposal, so in #121698 I updated the call trampoline to use js type reflection if it's present to avoid the JS frame and so the problem was fixed. However, the stack switching proposal has since been updated not to depend on type reflection, and it is going to be shipped while type reflection is still waiting for further refinement. This change means I need a different solution. Fortunately, wasm-gc is in stage 4 (shipped everywhere) and adds a webassembly instruction to query the type of a function. Unfortunately, toolchain support for wasm-gc is poor. Not even my favored assembler supports it.
Another problem is that the existing code is incompatible with memory snapshots since it calls JS initialization code that needs to happen even if restoring a memory snapshot from C code that is skipped when restoring a memory snapshot. I'll fix this at the same time.
<!-- gh-linked-prs -->
### Linked PRs
* gh-128628
* gh-128782
* gh-130418
* gh-135388
* gh-135419
* gh-135590
* gh-135592
* gh-137470
<!-- /gh-linked-prs -->
| d0ecbdd838034c1f061e9b4e9b54a900141458c3 | 5e65a1acc0b630397f1d190aed279114e6e99612 |
python/cpython | python__cpython-128618 | # `test_typing.test_readonly_inheritance` does not work correctly
# Bug report
https://github.com/python/cpython/blob/cdfb8bc93a4d8c06d2404ba2d243937ba209438c/Lib/test/test_typing.py#L8904-L8921
Notice that it always tests `Child1` and never `Child2`
Refs https://github.com/python/cpython/commit/df4784b3b7519d137ca6a1aeb500ef59e24a7f9b
I will send a PR.
<!-- gh-linked-prs -->
### Linked PRs
* gh-128618
* gh-128622
<!-- /gh-linked-prs -->
| 971a52b5495e3d596e599faa1f31d4671897026d | 474e419792484d1c16e7d9c99b7bf144136b9307 |
python/cpython | python__cpython-128616 | # Pickling of `ParamSpecArgs` and `ParamSpecKwargs` is not covered
<img width="519" alt="Снимок экрана 2025-01-08 в 12 17 31" src="https://github.com/user-attachments/assets/8e7e8e45-0849-46ee-af3b-ea044f72364c" />
I also tried to remove these lines and executed (just to be sure):
```
./python.exe -m test test_typing test_types test_annotationlib test_type_annotations test_type_aliases test_type_params test_copyreg test_pickle
```
And all tests still pass.
So, I added a simple test for that.
<!-- gh-linked-prs -->
### Linked PRs
* gh-128616
* gh-128625
* gh-128626
<!-- /gh-linked-prs -->
| 74a517181a9bb65a1f6da149af7427a9fcb3add3 | 95cd9c669cdc7718198addb1abb49941a2c61fae |
python/cpython | python__cpython-128614 | # `typing.Concatenate` is not fully covered
Coverage reports:
<img width="1324" alt="Снимок экрана 2025-01-08 в 11 59 22" src="https://github.com/user-attachments/assets/667eb627-c4ff-4106-be5c-ad6e4d10400a" />
I think that we need to cover these lines in tests.
PR is ready.
<!-- gh-linked-prs -->
### Linked PRs
* gh-128614
* gh-128623
* gh-128624
<!-- /gh-linked-prs -->
| eb26e170695f15714b5e2ae0c0b83aa790c97869 | 971a52b5495e3d596e599faa1f31d4671897026d |
python/cpython | python__cpython-128498 | # Default to stdout isatty for colour detection instead of stderr
# Bug report
### Bug description:
The terminal colour detection defaults to checking `stderr`'s `isatty`, rather than `stdout`.
As suggested at https://github.com/python/cpython/issues/128317#issuecomment-2569566697, let's default to checking `stdout`'s `isatty` rather than `stderr`'s.
Here some example output, plus when piping it:
<table>
<tr><th width=50%>Now</th><th width=50%>Proposal</th>
<tr>
<td>
<img width="522" alt="image" src="https://github.com/user-attachments/assets/2133c94f-58b2-43fe-ba37-c70643aa8b16" />
<td>
<img width="519" alt="image" src="https://github.com/user-attachments/assets/bbbc954f-73a4-41a5-b087-aff24c2488a5" />
<tr>
<td>
<img width="656" alt="image" src="https://github.com/user-attachments/assets/00282bc7-ac09-4696-ab54-271ad6bb4555" />
<td>
<img width="513" alt="image" src="https://github.com/user-attachments/assets/5e873085-b162-46d1-8bff-d1c761659c30" />
<tr>
<td>
<img width="289" alt="image" src="https://github.com/user-attachments/assets/5d710bd6-0398-4c82-b6ae-f4c3877f2af4" />
<td>
<img width="289" alt="image" src="https://github.com/user-attachments/assets/636828a0-59cf-4145-8076-8e85ee840f2d" />
<tr>
<td>
<img width="317" alt="image" src="https://github.com/user-attachments/assets/9f80b722-4050-49df-8683-24d3a0cb6804" />
<td>
<img width="316" alt="image" src="https://github.com/user-attachments/assets/58d836f3-b9b9-4716-bedf-66f9c9d1c515" />
</table>
### CPython versions tested on:
3.13, CPython main branch
### Operating systems tested on:
macOS
<!-- gh-linked-prs -->
### Linked PRs
* gh-128498
* gh-128687
* gh-128778
* gh-129057
* gh-129070
<!-- /gh-linked-prs -->
| 6f167d71347de6717d9f6b64026e21f23d41ef0b | a42915979796565635dcfcd45d2b62b3e5e46eba |
python/cpython | python__cpython-129063 | # Cancellation leaks out of asyncio.TaskGroup on 3.12 when using eager tasks
# Bug report
### Bug description:
```python
import sys
import asyncio
if sys.platform == "win32":
EventLoop = asyncio.ProactorEventLoop
else:
EventLoop = asyncio.SelectorEventLoop
async def demo():
class MyError(Exception):
pass
async def throw_error():
raise MyError
try:
async with asyncio.TaskGroup() as tg:
tg.create_task(throw_error())
except* MyError:
pass
def loop_factory():
loop = EventLoop()
loop.set_task_factory(asyncio.eager_task_factory)
return loop
asyncio.run(demo(), loop_factory=loop_factory)
```
results in:
```pytb
Traceback (most recent call last):
File "/home/graingert/projects/anyio/demo.py", line 29, in <module>
asyncio.run(demo(), loop_factory=loop_factory)
File "/usr/lib/python3.12/asyncio/runners.py", line 194, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/asyncio/base_events.py", line 687, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
asyncio.exceptions.CancelledError
```
### CPython versions tested on:
3.12
### Operating systems tested on:
Linux
<!-- gh-linked-prs -->
### Linked PRs
* gh-129063
* gh-129089
* gh-128586
<!-- /gh-linked-prs -->
| ed6934e71e55d398df8263f4697f58e4a3815f69 | ab61d3f4303d14a413bc9ae6557c730ffdf7579e |
python/cpython | python__cpython-128718 | # A new tail-calling interpreter for significantly better interpreter performance
# Feature or enhancement
## Proposal
Prior discussion at: https://github.com/faster-cpython/ideas/issues/642
I propose adding a tail-calling interpreter to CPython for significantly better performance on compilers that support it.
This idea is not new, and has been implemented by:
1. Protobuf https://blog.reverberate.org/2021/04/21/musttail-efficient-interpreters.html
2. Lua (Deegen) https://sillycross.github.io/2022/11/22/2022-11-22/
CPython currently has a few interpreters:
1. A switch-case interpreter (MSVC)
3. A computed goto interpreter (Clang, GCC)
4. An uop interpreter. (Everything)
The tail-calling interpreter will be the 4th that coexists with the rest. This means no compatibility concerns.
## Performance
Preliminary benchmarks by me suggest excellent performance improvements --- 10% geometric mean speedup in pyperformance, with up to 40% speedup in Python-heavy benchmarks: https://gist.github.com/Fidget-Spinner/497c664eef389622d146d632990b0d21. These benchmarks were performed with clang-19 on both main and my branch, with ThinLTO and PGO, on AMD64 Ubuntu 22.04. PGO seems especially crucial for the speedups based on my testing. For those outside of CPython development: a 10% speedup is roughly equal to 2 minor CPython releases worth of improvements. For example, CPython 3.12 roughly sped up by 5%.
The speedup is so significant that if accepted, the new interpreter will be faster than the current JIT compiler.
**CORRECTION NOTICE**: We've since found a compiler bug in LLVM 19 that artificially boosted the new interpreter's numbers. The numbers are closer to geomean 3-5% speedup. I apologize for reporting incorrect figures previously due to the compiler bug.
## Drawbacks
1. Maintainability (this will introduce more code)
2. Portability
I will address maintainability by using the interpreter generator that was introduced as part of CPython 3.12. This generator will allow us to automatically generate most of the infrastructure needed for this change. Preliminary estimates suggest the generator will be only 200 lines of Python code, most of which is shared/copied/same conceptually as the other generators.
For portability, this will fix itself (see the next section).
## Portability and Precedent
At the moment, this is only supported by clang-19 for AArch64 and AMD64, with partial support on clang-18 and gcc-next, but likely bad performance on those. The reason is that we need both the `__attribute__((musttail))` and `__attribute__((preserve_none))` attributes for good performance. GCC only has `gnu::musttail` but not `preserve_none`.
There has been prior precedence on adding compiler-specific optimizations for CPython. See for example the original computed goto issue by Antoine Pitrou https://bugs.python.org/issue4753. At the time, it was a new feature only on GCC and not on Clang, but we still added it anyways. Eventually a few years later, Clang also introduced the feature. The key point gcc will likely eventually catch up and add these features.
**EDIT**: Added that it's only a likely case to have bad perf on GCC. Reading https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118328, I have not tested on GCC trunk. This is pure speculation that perf is bad. I can try with GCC eventually after the PR lands and we can test it from there. However, testing with clang with just `musttail` and no `preserve_none`, the performance was quite bad.
## Implementation plan
1. Parse error labels in `_PyEval_EvalFrameDefault`.
2. Implement the rest.
3. Add likely/unlikely attributes to `DEOPT_IF/EXIT_IF`.
4. Support GCC 15.0 if we determine the performance is good.
5. Add option to Windows build script.
6. Mention in Whats New. (Note: We NEED PGO, otherwise the perf is not very good on clang)
7. Open new issue to add it as option on Windows build script.
8. Open new issue to set it as auto detect on ``--enable-optimizations`` on configure.
9. Open new issue on improving the code quality, by moving some parameters into other places to free up registers.
# Worries about new bugs
Computed goto is well-tested, so worrying about the new interpreter being buggy is fair.
I doubt logic bugs will be the primary one, as we are using the interpreter generator. This means we share common code between the base interpreter and the new one. If the new one has logic bugs, it is likely the base interpreter has it too.
The other one is compiler bugs. However to allay such fears, I point out that the GHC calling convention (the thing behind `preserve_none` has been around for 5 years[1], and `musttail` has been around for almost 4 years[2].
[1]: https://reviews.llvm.org/D69024
[2]: https://reviews.llvm.org/D99517
cc @pitrou as the original implementer of computed gotos, and @markshannon
## Future Use
Kumar Aditya pointed out this could be used in regex and pickle as well. Likewise, Neil Schemenauer pointed out marshal and pickle might benefit from this for faster Python startup.
### Has this already been discussed elsewhere?
https://discuss.python.org/t/a-new-tail-calling-interpreter-for-significantly-better-interpreter-performance/76315
### Links to previous discussion of this feature:
_No response_
<!-- gh-linked-prs -->
### Linked PRs
* gh-128718
* gh-129078
* gh-129112
* gh-129113
* gh-129115
* gh-129417
* gh-129481
* gh-129525
* gh-129608
* gh-129728
* gh-129754
* gh-129803
* gh-129809
* gh-129812
* gh-130908
* gh-130911
<!-- /gh-linked-prs -->
| cb640b659e14cb0a05767054f95a9d25787b472d | 555dc50c811e3e9ebdc30a1d511cf48a32666d6f |
python/cpython | python__cpython-128604 | # tkinter widget instance name sometimes duplicated on inherited class
# Bug report
### Bug description:
If you run de following code:
```python
import tkinter as tk
class Label2(tk.Label):
def __init__(self, top, text):
tk.Label.__init__(self, top, text=text, bg='Yellow')
w = tk.Tk()
w.columnconfigure((0, 1, 2), weight=1, uniform='u1')
label_1 = tk.Label(w, text='Native Label\nInstance 1', bg='LightGreen')
label_1.grid(column=0, row=0)
label_2 = Label2(w, text='Label2 Label\nInstance 1')
label_2.grid(column=1, row=0)
label_3 = tk.Label(w, text='Native Label\nInstance 2', bg='LightGreen')
label_3.grid(column=2, row=0)
w.mainloop()
```
It will produce the following result (only label_1 and label_3 seems to be placed) :

instead of what you expect (the following result) :

Note: This code is using Label for simplicity but it's the same with other widgets !
**Explanation:**
This is because of automatic generated tkinter widget names:
label_1 name is '.!label'
label_2 name is '.!label2'
label_3 name is '.!label2'
So 'label_2' and 'label_3' has the same widget name.
If you print the 'w.winfo_children()' function just before the 'w.mainloop()', you just get 2 widgets in the list.
The 'label_3' override the 'label_2' because for tkinter they are the same !
**To get around this bug:**
- you should not name your class by simply adding a number (like '2' or '3' ...)
- or you must give a unique name of your class instance with the 'name=' option in the Label constructor.
**To correct the bug:**
The naming algorithm should check that the automatically generated name is not already in use.
### CPython versions tested on:
3.9, 3.13
### Operating systems tested on:
Linux, Windows
<!-- gh-linked-prs -->
### Linked PRs
* gh-128604
* gh-128791
* gh-128792
<!-- /gh-linked-prs -->
| da8825ea95a7096bb4f933d33b212a94ade10f6e | 402b91da87052878b4e7e8946ba91bdf4ee4bebe |
python/cpython | python__cpython-128560 | # Asyncio should not import typing at runtime
# Feature or enhancement
### Proposal:
Currently, asyncio.timeout imports final, Type, and Optional from typing.
final has no impact on type checkers, as they use the typeshed for the standard library, and type and optional can be written without importing from typing. This caused a noticable impossibility to remove typing from startup costs.
(I'll PR the corresponding easy changes)
### Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
### Links to previous discussion of this feature:
_No response_
<!-- gh-linked-prs -->
### Linked PRs
* gh-128560
<!-- /gh-linked-prs -->
| 7363476b6405e3d288a61282aa7bc6aca9c2114d | 61c1a2478e6da8dc6dbdce4d6ac66b03d5963710 |
python/cpython | python__cpython-128553 | # TaskGroup's task's exception's participate in a reference cycle, via TaskGroup.create_task -> task -> exception and loop.create_task -> task -> exception
# Bug report
### Bug description:
the following test fails when run with eager tasks
```python
async def test_exception_refcycles_parent_task(self):
"""Test that TaskGroup deletes self._parent_task"""
tg = asyncio.TaskGroup()
exc = None
class _Done(Exception):
pass
async def coro_fn():
async with tg:
raise _Done
try:
async with asyncio.TaskGroup() as tg2:
tg2.create_task(coro_fn())
except* _Done as excs:
exc = excs.exceptions[0].exceptions[0]
self.assertIsInstance(exc, _Done)
self.assertListEqual(gc.get_referrers(exc), no_other_refs())
```
### CPython versions tested on:
3.14
### Operating systems tested on:
Linux
<!-- gh-linked-prs -->
### Linked PRs
* gh-128553
* gh-128585
* gh-128586
<!-- /gh-linked-prs -->
| 61b9811ac6843e22b5896ef96030d421b79cd892 | 6ea04da27036eaa69d65150148bb8c537d9beacf |
python/cpython | python__cpython-130569 | # Find a way to handle branch events in `async for`
When instrumenting regular `for` loops, we instrument the `FOR_ITER` instruction as the `LEFT` branch and the `POP_ITER` instruction as the `RIGHT` branch.
This doesn't work for `async for` as it uses exceptions to exit the loop.
Raising an exception is the documented behavior for exiting a [async] generator, so we will still need to generate an event for the exception being raised, much as we do in `INSTRUMENTED_END_FOR` as well as the `BRANCH` events.
<!-- gh-linked-prs -->
### Linked PRs
* gh-130569
* gh-130847
<!-- /gh-linked-prs -->
| 2a18e80695ac1f05c95ea3b1cfe29defd45e2f71 | fda056e64bdfcac3dd3d13eebda0a24994d83cb8 |
python/cpython | python__cpython-128554 | # `NOT_TAKEN` instructions need to be added after optimization
The `NOT_TAKEN` instruction is added during code gen, but can be left when jumps are removed by the optimizer.
We should probably add the `NOT_TAKEN` instructions in the assembler after optimization, as suggested in https://github.com/python/cpython/pull/122564#discussion_r1890281790
<!-- gh-linked-prs -->
### Linked PRs
* gh-128554
<!-- /gh-linked-prs -->
| 2434fd2d50b8b770585ad5949a664e4bbab4bde1 | b6c919b674549d519efbbc378588ca6d3efc7242 |
python/cpython | python__cpython-128521 | # Update the docstring of `untokenize()` to match the docs
# Documentation
In https://github.com/python/cpython/issues/128031, it was deemed too risky to change `untokenize()` to more closely match the original input string. We should update the docstring of `untokenize` to reflect that and prevent confusion in the (rare) case when `untokenize` does not match the input.
The docs already make that clear so we can simply reuse that explanation:
https://github.com/python/cpython/blob/2228e92da31ca7344a163498f848973a1b356597/Doc/library/tokenize.rst?plain=1#L94-L98
<!-- gh-linked-prs -->
### Linked PRs
* gh-128521
* gh-128531
* gh-128532
<!-- /gh-linked-prs -->
| aef52ca8b334ff90e8032da39f4d06e7b5130eb9 | a62ba52f1439c1f878a3ff9b8544caf9aeef9b90 |
python/cpython | python__cpython-128845 | # Test BOLT builds in CI
# Feature or enhancement
As part of https://github.com/python/cpython/issues/101525, we should run BOLT optimizations in CI.
It looks like optimizations aren't tested in CI right now, just on the build bots? I could use some guidance on the best place for this.
<!-- gh-linked-prs -->
### Linked PRs
* gh-128845
* gh-131058
<!-- /gh-linked-prs -->
| 9ed7bf2cd783b78b28f18abc090f43467a28f4aa | 3829104ab412a47bf3f36b8c133c886d2cc9a6d4 |
python/cpython | python__cpython-128510 | # Add an API for determining if an object is immortal
# Feature or enhancement
### Proposal:
Immortal objects might lead to some unexpected results for users that are (unfortunately) messing with reference count details, as seen in #127191; but currently, there's no way to determine what objects are actually immortal.
Immortality is an implementation detail, but it still does affect reference counting, and given that it's not very safe to rely on very specific reference counts, we don't want the only way to check for immortality to be via `sys.getrefcount`. So, given that we already have [sys._is_interned](https://docs.python.org/3/library/sys.html#sys._is_interned), it seems fitting to add a `sys._is_immortal` alongside it.
If we go with this, I think it's also a good idea to note it in some of the documentation. For example, `sys.getrefcount` says this:
> some objects are [immortal](https://docs.python.org/3/glossary.html#term-immortal) and have a very high refcount that does not reflect the actual number of references.
Here, it might be a good idea to mention my proposed `sys._is_immortal`, so there's less ambiguity about the returned value.
cc @erlend-aasland
### Has this already been discussed elsewhere?
No response given
### Links to previous discussion of this feature:
_No response_
<!-- gh-linked-prs -->
### Linked PRs
* gh-128510
* gh-129182
<!-- /gh-linked-prs -->
| 9ba281d871c4df3a3ac4cb7896d24ba0d42751a3 | 60a85415aeb5a8be54b3c412d19a7444bf5ac757 |
python/cpython | python__cpython-128506 | # Upgrade doctest CI to Ubuntu-24.04
# Feature or enhancement
### Proposal:
As title, since most of CI run in `ubuntu-24.04`, and Doctest CI was pinned to `ubuntu-22.04` according to #125236. Maybe we can upgrade it now.
### Has this already been discussed elsewhere?
No response given
### Links to previous discussion of this feature:
_No response_
<!-- gh-linked-prs -->
### Linked PRs
* gh-128506
* gh-128517
* gh-128518
<!-- /gh-linked-prs -->
| 2228e92da31ca7344a163498f848973a1b356597 | ae23a012e6c8aadc4a588101cbe7bc86ede45627 |
python/cpython | python__cpython-131633 | # Race in _ctypes_alloc_callback and libffi under free-threading
# Bug report
### Bug description:
I built libffi with TSAN and cpython (3.13 branch) with free-threading and TSAN. The following python code reports TSAN warnings:
```python
import ctypes
import concurrent.futures
import threading
def test_ctypes():
@ctypes.CFUNCTYPE(ctypes.c_float, ctypes.c_float, ctypes.c_float)
def callback(a, b):
return a / 2 + b / 2
if __name__ == "__main__":
num_workers = 20
barrier = threading.Barrier(num_workers)
def closure():
barrier.wait()
test_ctypes()
with concurrent.futures.ThreadPoolExecutor(max_workers=num_workers) as executor:
futures = []
for i in range(num_workers):
futures.append(executor.submit(closure))
assert len(list(f.result() for f in futures)) == num_workers
```
TSAN report exract:
```
WARNING: ThreadSanitizer: data race (pid=59410)
Read of size 8 at 0x7ffff618b6d0 by thread T2:
#0 dlmalloc /project/libffi/x86_64-pc-linux-gnu/../src/dlmalloc.c:4158:8 (libffi.so.8+0x58a5) (BuildId: 7b5c105b8eca23b7c54bb5eeab8b4ecf28fc7756)
#1 ffi_closure_alloc /project/libffi/x86_64-pc-linux-gnu/../src/closures.c:998:9 (libffi.so.8+0x56ec) (BuildId: 7b5c105b8eca23b7c54bb5eeab8b4ecf28fc7756)
#2 _ctypes_alloc_callback /project/cpython/./Modules/_ctypes/callbacks.c:367:20 (_ctypes.cpython-313t-x86_64-linux-gnu.so+0x1b435) (BuildId: e9fba41204b37973fe60945270803301c7df9615)
#3 PyCFuncPtr_new /project/cpython/./Modules/_ctypes/_ctypes.c:3955:13 (_ctypes.cpython-313t-x86_64-linux-gnu.so+0x18ba4) (BuildId: e9fba41204b37973fe60945270803301c7df9615)
```
More details on the build and the output: https://gist.github.com/vfdev-5/06b1c60713241e75773e9a92f2ecf135
The issue is with dlmalloc of libffi (reported [here](https://github.com/libffi/libffi/issues/873))
Discussing the issue with @colesbury and @Yhg1s on discord, Thomas proposed the following fix (agreed by Sam):
> I still think the easy fix is to cause dlmalloc to do its initialization early, like during ctypes import time. Maybe just calling ffi_closure_alloc() (and immediately freeing) is enough.
### CPython versions tested on:
3.13
### Operating systems tested on:
Linux
<!-- gh-linked-prs -->
### Linked PRs
* gh-131633
<!-- /gh-linked-prs -->
| 04d4aacaacbe26146e9b5ff6b0043f86f3c543d4 | 9c4fb92e126000650a8efb4d27c4e3d1af82f71e |
python/cpython | python__cpython-128484 | # Missing documentation for `traceback.FrameSummary.end_{col,line}no` attributes
These attributes were added in Python 3.11, as part of [PEP-657](https://peps.python.org/pep-0657/), and I believe they're intended to be public API. If so, adding them to the `__init__` docstring would be nice!
(prompted by checking `typeshed`, which includes them, while reviewing https://peps.python.org/pep-0657/)
<!-- gh-linked-prs -->
### Linked PRs
* gh-128484
* gh-130753
* gh-130754
* gh-130755
* gh-130767
<!-- /gh-linked-prs -->
| 051f0e5683fec3840fa7fc99723741dd2d701eae | 37145cb89fe806377a5e9ed1fdac92dd3a5df2c0 |
python/cpython | python__cpython-128475 | # asyncio.staggered.staggered_race can log NameError: cannot access free variable 'exceptions' where it is not associated with a value in enclosing scope
# Bug report
### Bug description:
https://github.com/Chia-Network/chia-blockchain/actions/runs/12586550910/job/35084132471#step:16:1813
```
______ test_long_reorg_nodes[ConsensusMode.HARD_FORK_2_0-2-500-100-True] _______
[gw1] darwin -- Python 3.12.8 /Users/runner/work/chia-blockchain/chia-blockchain/.venv/bin/python
/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/staggered.py:104: in run_one_coro
result = await coro_fn()
.venv/lib/python3.12/site-packages/aiohappyeyeballs/impl.py:166: in _connect_sock
await loop.sock_connect(sock, address)
/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/selector_events.py:651: in sock_connect
return await fut
E asyncio.exceptions.CancelledError
During handling of the above exception, another exception occurred:
.venv/lib/python3.12/site-packages/anyio/pytest_plugin.py:160: in pytest_pyfunc_call
runner.run_test(pyfuncitem.obj, testargs)
.venv/lib/python3.12/site-packages/anyio/_backends/_asyncio.py:2316: in run_test
self._raise_async_exceptions()
.venv/lib/python3.12/site-packages/anyio/_backends/_asyncio.py:2220: in _raise_async_exceptions
raise exceptions[0]
/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/staggered.py:108: in run_one_coro
exceptions[this_index] = e
E NameError: cannot access free variable 'exceptions' where it is not associated with a value in enclosing scope
```
This occurs when created run_one_coro tasks outlive the staggered_race task
The fix is to repeatedly wait for a future that fires when all tasks are completed - and propagate any outside cancellation to the child tasks.
### CPython versions tested on:
3.12
### Operating systems tested on:
Linux
<!-- gh-linked-prs -->
### Linked PRs
* gh-128475
* gh-129227
* gh-129228
<!-- /gh-linked-prs -->
| ec91e1c2762412f1408b0dfb5d281873b852affe | cf0b2da1e6947aa15be119582c2017765ab46863 |
python/cpython | python__cpython-128511 | # BOLT fails with `--enabled-shared` on LLVM 19 with "unable to get new address"
# Bug report
### Bug description:
As originally reported in https://github.com/astral-sh/python-build-standalone/pull/463
> LLVM 19.x has a hard error when handling PIC compiled functions containing computed gotos. It appears prior versions of LLVM could silently have buggy behavior in this scenario. We need to skip functions with computed gotos to allow LLVM 19.x to work with BOLT.
This results in an error like
```
BOLT-ERROR: unable to get new address corresponding to input address 0x1af0fa in function _PyEval_EvalFrameDefault.localalias/1(*3). Consider adding this function to --skip-funcs=...
```
Reproduced with
```
./configure \
py_cv_module__openssl=n/a \
py_cv_module__hashlib=n/a \
py_cv_module__gdbm=n/a \
--without-ensurepip \
--enable-shared \
--enable-optimizations \
--enable-bolt
```
Without `--enable-shared`, the failure doesn't occur.
There's an upstream fix in progress at https://github.com/llvm/llvm-project/pull/120267 — I'm not sure when it will be available. In the meantime, we should skip the functions. The patch fixing this will extend the common flags proposed in #128455, e.g., https://github.com/zanieb/cpython/commit/5448cd91c1cb65a7bd3ee3a0d70e63f6dba0db57
See also, commentary at https://github.com/python/cpython/issues/124948#issuecomment-2566703343
<details>
<summary>Additional logs</summary>
<pre>
BOLT-INFO: Target architecture: x86_64
BOLT-INFO: BOLT version: 6a0964d75628b15bafd078342120888c0e6d126f
BOLT-INFO: first alloc address is 0x400000
BOLT-INFO: creating new program header table at address 0x600000, offset 0x200000
BOLT-WARNING: debug info will be stripped from the binary. Use -update-debug-sections to keep it.
BOLT-INFO: enabling relocation mode
BOLT-INFO: forcing -jump-tables=move for instrumentation
BOLT-INFO: enabling lite mode
BOLT-INFO: 0 out of 6 functions in the binary (0.0%) have non-empty execution profile
BOLT-INSTRUMENTER: Number of indirect call site descriptors: 2
BOLT-INSTRUMENTER: Number of indirect call target descriptors: 4
BOLT-INSTRUMENTER: Number of function descriptors: 4
BOLT-INSTRUMENTER: Number of branch counters: 1
BOLT-INSTRUMENTER: Number of ST leaf node counters: 4
BOLT-INSTRUMENTER: Number of direct call counters: 0
BOLT-INSTRUMENTER: Total number of counters: 5
BOLT-INSTRUMENTER: Total size of counters: 40 bytes (static alloc memory)
BOLT-INSTRUMENTER: Total size of string table emitted: 47 bytes in file
BOLT-INSTRUMENTER: Total size of descriptors: 356 bytes in file
BOLT-INSTRUMENTER: Profile will be saved to file /fast/workspace/cpython/python.bolt
BOLT-INFO: padding code to 0xa00000 to accommodate hot text
BOLT-INFO: output linked against instrumentation runtime library, lib entry point is 0xa06950
BOLT-INFO: clear procedure is 0xa02390
BOLT-INFO: patched build-id (flipped last bit)
BOLT-INFO: setting _end to 0xa0a0bc
BOLT-INFO: setting _end to 0xa0a0bc
BOLT-INFO: setting __bolt_runtime_start to 0xa06900
BOLT-INFO: setting __bolt_runtime_fini to 0xa06950
BOLT-INFO: setting __hot_start to 0x800000
BOLT-INFO: setting __hot_end to 0x80014c
BOLT-INFO: shared object or position-independent executable detected
BOLT-INFO: Target architecture: x86_64
BOLT-INFO: BOLT version: 6a0964d75628b15bafd078342120888c0e6d126f
BOLT-INFO: first alloc address is 0x0
BOLT-INFO: creating new program header table at address 0x600000, offset 0x600000
BOLT-WARNING: debug info will be stripped from the binary. Use -update-debug-sections to keep it.
BOLT-INFO: enabling relocation mode
BOLT-INFO: forcing -jump-tables=move for instrumentation
BOLT-INFO: enabling lite mode
BOLT-WARNING: Failed to analyze 1381 relocations
BOLT-INFO: 0 out of 7363 functions in the binary (0.0%) have non-empty execution profile
BOLT-INSTRUMENTER: Number of indirect call site descriptors: 1508
BOLT-INSTRUMENTER: Number of indirect call target descriptors: 7281
BOLT-INSTRUMENTER: Number of function descriptors: 7281
BOLT-INSTRUMENTER: Number of branch counters: 82352
BOLT-INSTRUMENTER: Number of ST leaf node counters: 43921
BOLT-INSTRUMENTER: Number of direct call counters: 0
BOLT-INSTRUMENTER: Total number of counters: 126273
BOLT-INSTRUMENTER: Total size of counters: 1010184 bytes (static alloc memory)
BOLT-INSTRUMENTER: Total size of string table emitted: 186842 bytes in file
BOLT-INSTRUMENTER: Total size of descriptors: 8306748 bytes in file
BOLT-INSTRUMENTER: Profile will be saved to file /fast/workspace/cpython/libpython3.14.so.1.0.bolt
BOLT-INFO: 62323 instructions were shortened
BOLT-INFO: removed 156 empty blocks
BOLT-INFO: UCE removed 1608 blocks and 99444 bytes of code
BOLT-INFO: padding code to 0x1000000 to accommodate hot text
BOLT-INFO: output linked against instrumentation runtime library, lib entry point is 0x11be950
BOLT-INFO: clear procedure is 0x11ba390
BOLT-INFO: patched build-id (flipped last bit)
BOLT-INFO: setting __bolt_runtime_start to 0x11be900
BOLT-INFO: setting __bolt_runtime_fini to 0x11be950
BOLT-INFO: setting __hot_start to 0x800000
BOLT-INFO: setting __hot_end to 0xe1e116
BOLT-ERROR: unable to get new address corresponding to input address 0x1af0fa in function _PyEval_EvalFrameDefault.localalias/1(*3). Consider adding this function to --skip-funcs=...
</pre>
</details>
### CPython versions tested on:
CPython main branch
### Operating systems tested on:
Linux
<!-- gh-linked-prs -->
### Linked PRs
* gh-128511
* gh-128572
* gh-128573
<!-- /gh-linked-prs -->
| 24b147a19b360c49cb1740aa46211d342aaa071f | 953b49e5468d02afaddadc2307f4763422078603 |
python/cpython | python__cpython-128457 | # BOLT uses deprecated option `-reorder-functions=hfsort+`
# Bug report
### Bug description:
Building with BOLT optimizations emits the following warning
```
BOLT-WARNING: '-reorder-functions=hfsort+' is deprecated, please use '-reorder-functions=cdsort' instead
```
From the usage at https://github.com/python/cpython/blob/6fd31842e3d3ce046fcb4625f93a782ac2f6ade9/configure.ac#L2186
The resolution looks quite straight-forward, I'll post a patch.
### CPython versions tested on:
CPython main branch
### Operating systems tested on:
Linux
<!-- gh-linked-prs -->
### Linked PRs
* gh-128457
* gh-128461
* gh-128462
<!-- /gh-linked-prs -->
| 4974bbdb290b61a2d8860de490fde1228c296753 | befcfdfdaba15ecae38739ecabebd8046c1b1977 |
python/cpython | python__cpython-129478 | # New warning in the main (b4f799b1e7): ./Modules/socketmodule.c
# Bug report
### Bug description:
./configure -q && make -s
give me
```
[...]
./Modules/socketmodule.c: In function ‘sock_accept’:
./Modules/socketmodule.c:474:23: warning: ‘ctx.result’ may be used uninitialized [-Wmaybe-uninitialized]
474 | # define SOCKETCLOSE close
| ^~~~~
./Modules/socketmodule.c:2939:24: note: ‘ctx.result’ was declared here
2939 | struct sock_accept ctx;
| ^~~
```
```
$ cc --version
cc (Debian 12.2.0-14) 12.2.0
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
```
### CPython versions tested on:
CPython main branch
### Operating systems tested on:
Linux
<!-- gh-linked-prs -->
### Linked PRs
* gh-129478
<!-- /gh-linked-prs -->
| c07ac3c86a8f5021e27bf2c27c6bf0a25229d846 | 10ee2d9d3bcde27c75f179214ad41c00e4852a7a |
python/cpython | python__cpython-128450 | # Skip Windows CI for `configure`/`Makefile` changes
# Feature or enhancement
There should be no need to run the Windows CI for \*nix build system changes. Suggesting we skip the Windows CI for `configure`/Make related changes.
<!-- gh-linked-prs -->
### Linked PRs
* gh-128450
* gh-130434
* gh-130435
* gh-131702
* gh-131705
* gh-131706
<!-- /gh-linked-prs -->
| b05fa90b21dd01bb836285cdd41920320b09e681 | 06ac157c53046f4fcad34383ef131f773085f3d5 |
python/cpython | python__cpython-128455 | # Bolt instrumentation missing `-update-debug-sections`
# Bug report
### Bug description:
The following warning is displayed during BOLT instrumentation
```
BOLT-WARNING: debug info will be stripped from the binary. Use -update-debug-sections to keep it.
```
The flag is provided during "apply"
https://github.com/python/cpython/blob/81376fef76a53fb79893bfa9c9db18d97c228fbe/configure.ac#L2184
but not during "instrumentation"
https://github.com/python/cpython/blob/81376fef76a53fb79893bfa9c9db18d97c228fbe/configure.ac#L2170
Reproduced with
```
make clean
export CC=clang
export CXX=clang++
./configure py_cv_module__openssl=n/a py_cv_module__hashlib=n/a py_cv_module__gdbm=n/a py_cv_module__tkinter=n/a \
--without-ensurepip \
--enable-optimizations --enable-bolt
make -j8
```
<details>
<summary>Additional logs</summary>
<pre>
...
make profile-bolt-stamp
make[1]: Entering directory '/big/workspace/cpython'
# Ensure a pristine, pre-BOLT copy of the binary and no profile data from last run.
for bin in python; do \
prebolt="${bin}.prebolt"; \
if [ -e "${prebolt}" ]; then \
echo "Restoring pre-BOLT binary ${prebolt}"; \
mv "${bin}.prebolt" "${bin}"; \
fi; \
cp "${bin}" "${prebolt}"; \
rm -f ${bin}.bolt.*.fdata ${bin}.fdata; \
done
# Instrument each binary.
for bin in python; do \
/usr/bin/llvm-bolt "${bin}" -instrument -instrumentation-file-append-pid -instrumentation-file=/big/workspace/cpython/${bin}.bolt -o ${bin}.bolt_inst ; \
mv "${bin}.bolt_inst" "${bin}"; \
done
BOLT-INFO: Target architecture: x86_64
BOLT-INFO: BOLT version: 6a0964d75628b15bafd078342120888c0e6d126f
BOLT-INFO: first alloc address is 0x400000
BOLT-INFO: creating new program header table at address 0xa00000, offset 0x600000
BOLT-WARNING: debug info will be stripped from the binary. Use -update-debug-sections to keep it.
BOLT-INFO: enabling relocation mode
BOLT-INFO: forcing -jump-tables=move for instrumentation
BOLT-INFO: enabling lite mode
BOLT-INFO: 0 out of 7748 functions in the binary (0.0%) have non-empty execution profile
BOLT-INFO: validate-mem-refs updated 2 object references
BOLT-INSTRUMENTER: Number of indirect call site descriptors: 1995
BOLT-INSTRUMENTER: Number of indirect call target descriptors: 7719
BOLT-INSTRUMENTER: Number of function descriptors: 7719
BOLT-INSTRUMENTER: Number of branch counters: 150867
BOLT-INSTRUMENTER: Number of ST leaf node counters: 47195
BOLT-INSTRUMENTER: Number of direct call counters: 0
BOLT-INSTRUMENTER: Total number of counters: 198062
BOLT-INSTRUMENTER: Total size of counters: 1584496 bytes (static alloc memory)
BOLT-INSTRUMENTER: Total size of string table emitted: 166904 bytes in file
BOLT-INSTRUMENTER: Total size of descriptors: 10927480 bytes in file
BOLT-INSTRUMENTER: Profile will be saved to file /big/workspace/cpython/python.bolt
BOLT-INFO: 66759 instructions were shortened
BOLT-INFO: removed 84 empty blocks
BOLT-INFO: UCE removed 838 blocks and 51008 bytes of code
BOLT-INFO: padding code to 0x1600000 to accommodate hot text
BOLT-INFO: output linked against instrumentation runtime library, lib entry point is 0x18e0950
BOLT-INFO: clear procedure is 0x18dc390
BOLT-INFO: patched build-id (flipped last bit)
BOLT-INFO: setting _end to 0x190247c
BOLT-INFO: setting _end to 0x190247c
BOLT-INFO: setting __bolt_runtime_start to 0x18e0900
BOLT-INFO: setting __bolt_runtime_fini to 0x18e0950
BOLT-INFO: setting __hot_start to 0xc00000
BOLT-INFO: setting __hot_end to 0x14b3986
# Run instrumented binaries to collect data.
./python -m test --pgo --timeout=
...
</pre>
</details>
This was patched downstream in `python-build-standalone` https://github.com/astral-sh/python-build-standalone/pull/463 — I'm interesting in upstreaming that patch.
A simple patch like
```diff
diff --git a/configure.ac b/configure.ac
index ee034e5a962..d0245debd5b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2167,7 +2167,7 @@ AC_ARG_VAR(
AC_MSG_CHECKING([BOLT_INSTRUMENT_FLAGS])
if test -z "${BOLT_INSTRUMENT_FLAGS}"
then
- BOLT_INSTRUMENT_FLAGS=
+ BOLT_INSTRUMENT_FLAGS="-update-debug-sections"
fi
AC_MSG_RESULT([$BOLT_INSTRUMENT_FLAGS])
```
is sufficient — but downstream a `BOLT_COMMON_FLAGS` variable was added which was useful for subsequent fixes.
### CPython versions tested on:
CPython main branch
### Operating systems tested on:
Linux
<!-- gh-linked-prs -->
### Linked PRs
* gh-128455
* gh-128512
* gh-128513
<!-- /gh-linked-prs -->
| b60044b838f3ea97395cd6f3adbd5330356fc273 | 0cafa97932c6574734bbaa07180bbd5a762b01a6 |
python/cpython | python__cpython-128429 | # Support Nil and Max UUID formats from RFC 9562
# Feature or enhancement
### Proposal:
RFC 9562 defines Nil and Max UUID formats:
- https://www.rfc-editor.org/rfc/rfc9562.html#name-nil-uuid
- https://www.rfc-editor.org/rfc/rfc9562.html#name-max-uuid
I've often had a need to use these as placeholders, sentinels or dummy values and it would be nice to be able to write `uuid.NIL` and `uuid.MAX` instead of `uuid.UUID(int=0)` and `uuid.UUID(int=2 ** 128 - 1)` every time I need to reach for them.
### Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
### Links to previous discussion of this feature:
These have been referred to in https://github.com/python/cpython/issues/89083#issuecomment-2303285259 and https://github.com/python/cpython/issues/89083#issuecomment-2304713522.
<!-- gh-linked-prs -->
### Linked PRs
* gh-128429
<!-- /gh-linked-prs -->
| 8ec76d90340287eb3587f0ae388bbfe158fb28d8 | d8e16ef7037ac254e4799d2991c7fc3fe576c545 |
python/cpython | python__cpython-128428 | # Free-threading C API HOWTO should mention PySequenceFast API
Right now [this page](https://docs.python.org/3/howto/free-threading-extensions.html#general-api-guidelines) says that macros that access the internal state of data structures are thread-unsafe, but because `PySequenceFast` is a function I completely missed while working on NumPy that the `PySequenceFast` API is problematic. I think it's worth adding a sentence calling it out.
<!-- gh-linked-prs -->
### Linked PRs
* gh-128428
<!-- /gh-linked-prs -->
| e7adeecc2b318505eb53bc779320f028be40cccc | 8eebe4e6d02bb4ad3f1ca6c52624186903dce893 |
python/cpython | python__cpython-128728 | # data races in frame inspection and tracebacks
Run the tests with https://github.com/python/cpython/pull/128147 and tsan enabled:
```console
env TSAN_OPTIONS=suppressions={$PWD}/Tools/tsan/suppressions_free_threading.txt ./python -m test test_asyncio -F
```
TSAN Warnings:
<details>
```
WARNING: ThreadSanitizer: data race (pid=31163)
Read of size 4 at 0x7fe5e3b00578 by thread T59:
#0 _PyFrame_GetBytecode Include/internal/pycore_frame.h:98 (python+0x3a674a) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#1 PyUnstable_InterpreterFrame_GetLine Python/frame.c:147 (python+0x3a73ab) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#2 dump_frame Python/traceback.c:907 (python+0x42e25e) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#3 dump_traceback Python/traceback.c:988 (python+0x42e454) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#4 _Py_DumpTracebackThreads Python/traceback.c:1095 (python+0x42e64b) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#5 faulthandler_dump_traceback Modules/faulthandler.c:205 (python+0x44a509) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#6 faulthandler_fatal_error Modules/faulthandler.c:323 (python+0x44b5ca) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#7 CallUserSignalHandler ../../../../src/libsanitizer/tsan/tsan_interceptors_posix.cpp:2096 (libtsan.so.2+0x517d5) (BuildId: 38097064631f7912bd33117a9c83d08b42e15571)
#8 _PyType_GetDict Objects/typeobject.c:408 (python+0x24519f) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#9 _PyType_IsReady Include/internal/pycore_typeobject.h:236 (python+0x1f9347) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#10 _PyObject_GetMethod Objects/object.c:1570 (python+0x1f9347)
#11 PyObject_VectorcallMethod Objects/call.c:839 (python+0x16b980) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#12 PyObject_CallMethodNoArgs Include/cpython/abstract.h:65 (_asyncio.cpython-314td-x86_64-linux-gnu.so+0xba13) (BuildId: 0ce27d6138d5c42260be0fb214f10957647a4978)
#13 add_one_task Modules/_asynciomodule.c:3717 (_asyncio.cpython-314td-x86_64-linux-gnu.so+0xba13)
#14 _asyncio_all_tasks_impl Modules/_asynciomodule.c:3827 (_asyncio.cpython-314td-x86_64-linux-gnu.so+0x11117) (BuildId: 0ce27d6138d5c42260be0fb214f10957647a4978)
#15 _asyncio_all_tasks Modules/clinic/_asynciomodule.c.h:2086 (_asyncio.cpython-314td-x86_64-linux-gnu.so+0x11315) (BuildId: 0ce27d6138d5c42260be0fb214f10957647a4978)
#16 _PyEval_EvalFrameDefault Python/generated_cases.c.h:1527 (python+0x33d97b) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#17 _PyEval_EvalFrame Include/internal/pycore_ceval.h:116 (python+0x368276) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#18 _PyEval_Vector Python/ceval.c:1911 (python+0x3684fc) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#19 _PyFunction_Vectorcall Objects/call.c:413 (python+0x16a4a1) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#20 _PyObject_VectorcallTstate Include/internal/pycore_call.h:167 (python+0x16ec05) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#21 method_vectorcall Objects/classobject.c:71 (python+0x16ef25) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#22 _PyVectorcall_Call Objects/call.c:273 (python+0x16c8e1) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#23 _PyObject_Call Objects/call.c:348 (python+0x16cd2b) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#24 PyObject_Call Objects/call.c:373 (python+0x16cd8f) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#25 thread_run Modules/_threadmodule.c:346 (python+0x4d3322) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#26 pythread_wrapper Python/thread_pthread.h:242 (python+0x429f2a) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
Previous write of size 8 at 0x7fe5e3b00578 by thread T57:
#0 _PyFrame_SetStackPointer Include/internal/pycore_frame.h:253 (python+0x32a38b) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#1 _PyEval_EvalFrameDefault Python/generated_cases.c.h:7058 (python+0x35fee5) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#2 _PyEval_EvalFrame Include/internal/pycore_ceval.h:116 (python+0x368276) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#3 _PyEval_Vector Python/ceval.c:1911 (python+0x3684fc) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#4 _PyFunction_Vectorcall Objects/call.c:413 (python+0x16a4a1) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#5 _PyObject_VectorcallTstate Include/internal/pycore_call.h:167 (python+0x421a37) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#6 sys_audit_tstate Python/sysmodule.c:283 (python+0x421dda) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#7 _PySys_Audit Python/sysmodule.c:324 (python+0x4270d2) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#8 _PyEval_SetAsyncGenFirstiter Python/ceval.c:2509 (python+0x331eb0) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#9 sys_set_asyncgen_hooks Python/sysmodule.c:1400 (python+0x4239b0) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#10 cfunction_call Objects/methodobject.c:551 (python+0x1ee9e6) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#11 _PyObject_Call Objects/call.c:361 (python+0x16cc68) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#12 PyObject_Call Objects/call.c:373 (python+0x16cd8f) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#13 _PyEval_EvalFrameDefault Python/generated_cases.c.h:1762 (python+0x33ec1f) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#14 _PyEval_EvalFrame Include/internal/pycore_ceval.h:116 (python+0x368276) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#15 _PyEval_Vector Python/ceval.c:1911 (python+0x3684fc) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#16 _PyFunction_Vectorcall Objects/call.c:413 (python+0x16a4a1) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#17 _PyObject_VectorcallTstate Include/internal/pycore_call.h:167 (python+0x16ec05) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#18 method_vectorcall Objects/classobject.c:71 (python+0x16ef25) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#19 _PyVectorcall_Call Objects/call.c:273 (python+0x16c8e1) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#20 _PyObject_Call Objects/call.c:348 (python+0x16cd2b) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#21 PyObject_Call Objects/call.c:373 (python+0x16cd8f) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#22 thread_run Modules/_threadmodule.c:346 (python+0x4d3322) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#23 pythread_wrapper Python/thread_pthread.h:242 (python+0x429f2a) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
Thread T59 'Thread-59 (runn' (tid=31269, running) created by main thread at:
#0 pthread_create ../../../../src/libsanitizer/tsan/tsan_interceptors_posix.cpp:1022 (libtsan.so.2+0x5ac1a) (BuildId: 38097064631f7912bd33117a9c83d08b42e15571)
#1 do_start_joinable_thread Python/thread_pthread.h:289 (python+0x42a37b) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#2 PyThread_start_joinable_thread Python/thread_pthread.h:313 (python+0x42a571) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#3 ThreadHandle_start Modules/_threadmodule.c:431 (python+0x4d2cb7) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#4 do_start_new_thread Modules/_threadmodule.c:1794 (python+0x4d2ec0) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#5 thread_PyThread_start_joinable_thread Modules/_threadmodule.c:1917 (python+0x4d312e) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#6 cfunction_call Objects/methodobject.c:551 (python+0x1ee9e6) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#7 _PyObject_MakeTpCall Objects/call.c:242 (python+0x16a6fc) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#8 _PyObject_VectorcallTstate Include/internal/pycore_call.h:165 (python+0x16a9b9) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#9 PyObject_Vectorcall Objects/call.c:327 (python+0x16aa71) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#10 _PyEval_EvalFrameDefault Python/generated_cases.c.h:2199 (python+0x341ba1) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#11 _PyEval_EvalFrame Include/internal/pycore_ceval.h:116 (python+0x1943d6) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#12 gen_send_ex2 Objects/genobject.c:245 (python+0x1948fd) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#13 gen_iternext Objects/genobject.c:618 (python+0x196a44) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#14 builtin_next Python/bltinmodule.c:1638 (python+0x3250e6) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#15 _PyEval_EvalFrameDefault Python/generated_cases.c.h:1440 (python+0x33cfc8) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#16 _PyEval_EvalFrame Include/internal/pycore_ceval.h:116 (python+0x368276) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#17 _PyEval_Vector Python/ceval.c:1911 (python+0x3684fc) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#18 _PyFunction_Vectorcall Objects/call.c:413 (python+0x16a4a1) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#19 _PyObject_VectorcallTstate Include/internal/pycore_call.h:167 (python+0x16ec05) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#20 method_vectorcall Objects/classobject.c:93 (python+0x16ede3) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#21 _PyVectorcall_Call Objects/call.c:273 (python+0x16c8e1) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#22 _PyObject_Call Objects/call.c:348 (python+0x16cd2b) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#23 PyObject_Call Objects/call.c:373 (python+0x16cd8f) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#24 _PyEval_EvalFrameDefault Python/generated_cases.c.h:1762 (python+0x33ec1f) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#25 _PyEval_EvalFrame Include/internal/pycore_ceval.h:116 (python+0x368276) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#26 _PyEval_Vector Python/ceval.c:1911 (python+0x3684fc) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#27 _PyFunction_Vectorcall Objects/call.c:413 (python+0x16a4a1) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#28 _PyObject_VectorcallDictTstate Objects/call.c:135 (python+0x16c514) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#29 _PyObject_Call_Prepend Objects/call.c:504 (python+0x16c7e9) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#30 slot_tp_call Objects/typeobject.c:9987 (python+0x251089) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#31 _PyObject_MakeTpCall Objects/call.c:242 (python+0x16a6fc) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#32 _PyObject_VectorcallTstate Include/internal/pycore_call.h:165 (python+0x16a9b9) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#33 PyObject_Vectorcall Objects/call.c:327 (python+0x16aa71) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#34 _PyEval_EvalFrameDefault Python/generated_cases.c.h:2772 (python+0x345ab7) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#35 _PyEval_EvalFrame Include/internal/pycore_ceval.h:116 (python+0x368276) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#36 _PyEval_Vector Python/ceval.c:1911 (python+0x3684fc) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#37 _PyFunction_Vectorcall Objects/call.c:413 (python+0x16a4a1) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#38 _PyObject_VectorcallTstate Include/internal/pycore_call.h:167 (python+0x16ec05) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#39 method_vectorcall Objects/classobject.c:93 (python+0x16ede3) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#40 _PyVectorcall_Call Objects/call.c:273 (python+0x16c8e1) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#41 _PyObject_Call Objects/call.c:348 (python+0x16cd2b) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#42 PyObject_Call Objects/call.c:373 (python+0x16cd8f) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#43 _PyEval_EvalFrameDefault Python/generated_cases.c.h:1762 (python+0x33ec1f) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#44 _PyEval_EvalFrame Include/internal/pycore_ceval.h:116 (python+0x368276) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#45 _PyEval_Vector Python/ceval.c:1911 (python+0x3684fc) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#46 _PyFunction_Vectorcall Objects/call.c:413 (python+0x16a4a1) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#47 _PyObject_VectorcallDictTstate Objects/call.c:135 (python+0x16c514) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#48 _PyObject_Call_Prepend Objects/call.c:504 (python+0x16c7e9) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#49 slot_tp_call Objects/typeobject.c:9987 (python+0x251089) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#50 _PyObject_MakeTpCall Objects/call.c:242 (python+0x16a6fc) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#51 _PyObject_VectorcallTstate Include/internal/pycore_call.h:165 (python+0x16a9b9) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#52 PyObject_Vectorcall Objects/call.c:327 (python+0x16aa71) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#53 _PyEval_EvalFrameDefault Python/generated_cases.c.h:2772 (python+0x345ab7) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#54 _PyEval_EvalFrame Include/internal/pycore_ceval.h:116 (python+0x368276) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#55 _PyEval_Vector Python/ceval.c:1911 (python+0x3684fc) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#56 _PyFunction_Vectorcall Objects/call.c:413 (python+0x16a4a1) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#57 _PyObject_VectorcallTstate Include/internal/pycore_call.h:167 (python+0x16ec05) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#58 method_vectorcall Objects/classobject.c:93 (python+0x16ede3) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#59 _PyVectorcall_Call Objects/call.c:273 (python+0x16c8e1) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#60 _PyObject_Call Objects/call.c:348 (python+0x16cd2b) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#61 PyObject_Call Objects/call.c:373 (python+0x16cd8f) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#62 _PyEval_EvalFrameDefault Python/generated_cases.c.h:1762 (python+0x33ec1f) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#63 _PyEval_EvalFrame Include/internal/pycore_ceval.h:116 (python+0x368276) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#64 _PyEval_Vector Python/ceval.c:1911 (python+0x3684fc) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#65 _PyFunction_Vectorcall Objects/call.c:413 (python+0x16a4a1) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#66 _PyObject_VectorcallDictTstate Objects/call.c:135 (python+0x16c514) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#67 _PyObject_Call_Prepend Objects/call.c:504 (python+0x16c7e9) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#68 slot_tp_call Objects/typeobject.c:9987 (python+0x251089) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#69 _PyObject_MakeTpCall Objects/call.c:242 (python+0x16a6fc) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#70 _PyObject_VectorcallTstate Include/internal/pycore_call.h:165 (python+0x16a9b9) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#71 PyObject_Vectorcall Objects/call.c:327 (python+0x16aa71) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#72 _PyEval_EvalFrameDefault Python/generated_cases.c.h:2772 (python+0x345ab7) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#73 _PyEval_EvalFrame Include/internal/pycore_ceval.h:116 (python+0x368276) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#74 _PyEval_Vector Python/ceval.c:1911 (python+0x3684fc) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#75 PyEval_EvalCode Python/ceval.c:658 (python+0x368671) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#76 builtin_exec_impl Python/bltinmodule.c:1158 (python+0x3269ec) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#77 builtin_exec Python/clinic/bltinmodule.c.h:560 (python+0x326b38) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#78 cfunction_vectorcall_FASTCALL_KEYWORDS Objects/methodobject.c:452 (python+0x1eda82) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#79 _PyObject_VectorcallTstate Include/internal/pycore_call.h:167 (python+0x16a928) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#80 PyObject_Vectorcall Objects/call.c:327 (python+0x16aa71) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#81 _PyEval_EvalFrameDefault Python/generated_cases.c.h:960 (python+0x33a0e6) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#82 _PyEval_EvalFrame Include/internal/pycore_ceval.h:116 (python+0x368276) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#83 _PyEval_Vector Python/ceval.c:1911 (python+0x3684fc) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#84 _PyFunction_Vectorcall Objects/call.c:413 (python+0x16a4a1) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#85 _PyVectorcall_Call Objects/call.c:273 (python+0x16c8e1) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#86 _PyObject_Call Objects/call.c:348 (python+0x16cd2b) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#87 PyObject_Call Objects/call.c:373 (python+0x16cd8f) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#88 pymain_run_module Modules/main.c:349 (python+0x4452e7) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#89 pymain_run_python Modules/main.c:691 (python+0x4465b6) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#90 Py_RunMain Modules/main.c:776 (python+0x446961) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#91 pymain_main Modules/main.c:806 (python+0x446a18) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#92 Py_BytesMain Modules/main.c:830 (python+0x446b77) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#93 main Programs/python.c:15 (python+0x84aeb) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
Thread T57 'Thread-57 (runn' (tid=31267, running) created by main thread at:
#0 pthread_create ../../../../src/libsanitizer/tsan/tsan_interceptors_posix.cpp:1022 (libtsan.so.2+0x5ac1a) (BuildId: 38097064631f7912bd33117a9c83d08b42e15571)
#1 do_start_joinable_thread Python/thread_pthread.h:289 (python+0x42a37b) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#2 PyThread_start_joinable_thread Python/thread_pthread.h:313 (python+0x42a571) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#3 ThreadHandle_start Modules/_threadmodule.c:431 (python+0x4d2cb7) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#4 do_start_new_thread Modules/_threadmodule.c:1794 (python+0x4d2ec0) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#5 thread_PyThread_start_joinable_thread Modules/_threadmodule.c:1917 (python+0x4d312e) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#6 cfunction_call Objects/methodobject.c:551 (python+0x1ee9e6) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#7 _PyObject_MakeTpCall Objects/call.c:242 (python+0x16a6fc) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#8 _PyObject_VectorcallTstate Include/internal/pycore_call.h:165 (python+0x16a9b9) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#9 PyObject_Vectorcall Objects/call.c:327 (python+0x16aa71) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#10 _PyEval_EvalFrameDefault Python/generated_cases.c.h:2199 (python+0x341ba1) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#11 _PyEval_EvalFrame Include/internal/pycore_ceval.h:116 (python+0x1943d6) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#12 gen_send_ex2 Objects/genobject.c:245 (python+0x1948fd) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#13 gen_iternext Objects/genobject.c:618 (python+0x196a44) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#14 builtin_next Python/bltinmodule.c:1638 (python+0x3250e6) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#15 _PyEval_EvalFrameDefault Python/generated_cases.c.h:1440 (python+0x33cfc8) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#16 _PyEval_EvalFrame Include/internal/pycore_ceval.h:116 (python+0x368276) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#17 _PyEval_Vector Python/ceval.c:1911 (python+0x3684fc) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#18 _PyFunction_Vectorcall Objects/call.c:413 (python+0x16a4a1) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#19 _PyObject_VectorcallTstate Include/internal/pycore_call.h:167 (python+0x16ec05) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#20 method_vectorcall Objects/classobject.c:93 (python+0x16ede3) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#21 _PyVectorcall_Call Objects/call.c:273 (python+0x16c8e1) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#22 _PyObject_Call Objects/call.c:348 (python+0x16cd2b) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#23 PyObject_Call Objects/call.c:373 (python+0x16cd8f) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#24 _PyEval_EvalFrameDefault Python/generated_cases.c.h:1762 (python+0x33ec1f) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#25 _PyEval_EvalFrame Include/internal/pycore_ceval.h:116 (python+0x368276) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#26 _PyEval_Vector Python/ceval.c:1911 (python+0x3684fc) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#27 _PyFunction_Vectorcall Objects/call.c:413 (python+0x16a4a1) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#28 _PyObject_VectorcallDictTstate Objects/call.c:135 (python+0x16c514) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#29 _PyObject_Call_Prepend Objects/call.c:504 (python+0x16c7e9) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#30 slot_tp_call Objects/typeobject.c:9987 (python+0x251089) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#31 _PyObject_MakeTpCall Objects/call.c:242 (python+0x16a6fc) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#32 _PyObject_VectorcallTstate Include/internal/pycore_call.h:165 (python+0x16a9b9) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#33 PyObject_Vectorcall Objects/call.c:327 (python+0x16aa71) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#34 _PyEval_EvalFrameDefault Python/generated_cases.c.h:2772 (python+0x345ab7) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#35 _PyEval_EvalFrame Include/internal/pycore_ceval.h:116 (python+0x368276) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#36 _PyEval_Vector Python/ceval.c:1911 (python+0x3684fc) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#37 _PyFunction_Vectorcall Objects/call.c:413 (python+0x16a4a1) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#38 _PyObject_VectorcallTstate Include/internal/pycore_call.h:167 (python+0x16ec05) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#39 method_vectorcall Objects/classobject.c:93 (python+0x16ede3) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#40 _PyVectorcall_Call Objects/call.c:273 (python+0x16c8e1) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#41 _PyObject_Call Objects/call.c:348 (python+0x16cd2b) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#42 PyObject_Call Objects/call.c:373 (python+0x16cd8f) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#43 _PyEval_EvalFrameDefault Python/generated_cases.c.h:1762 (python+0x33ec1f) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#44 _PyEval_EvalFrame Include/internal/pycore_ceval.h:116 (python+0x368276) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#45 _PyEval_Vector Python/ceval.c:1911 (python+0x3684fc) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#46 _PyFunction_Vectorcall Objects/call.c:413 (python+0x16a4a1) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#47 _PyObject_VectorcallDictTstate Objects/call.c:135 (python+0x16c514) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#48 _PyObject_Call_Prepend Objects/call.c:504 (python+0x16c7e9) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#49 slot_tp_call Objects/typeobject.c:9987 (python+0x251089) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#50 _PyObject_MakeTpCall Objects/call.c:242 (python+0x16a6fc) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#51 _PyObject_VectorcallTstate Include/internal/pycore_call.h:165 (python+0x16a9b9) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#52 PyObject_Vectorcall Objects/call.c:327 (python+0x16aa71) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#53 _PyEval_EvalFrameDefault Python/generated_cases.c.h:2772 (python+0x345ab7) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#54 _PyEval_EvalFrame Include/internal/pycore_ceval.h:116 (python+0x368276) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#55 _PyEval_Vector Python/ceval.c:1911 (python+0x3684fc) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#56 _PyFunction_Vectorcall Objects/call.c:413 (python+0x16a4a1) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#57 _PyObject_VectorcallTstate Include/internal/pycore_call.h:167 (python+0x16ec05) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#58 method_vectorcall Objects/classobject.c:93 (python+0x16ede3) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#59 _PyVectorcall_Call Objects/call.c:273 (python+0x16c8e1) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#60 _PyObject_Call Objects/call.c:348 (python+0x16cd2b) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#61 PyObject_Call Objects/call.c:373 (python+0x16cd8f) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#62 _PyEval_EvalFrameDefault Python/generated_cases.c.h:1762 (python+0x33ec1f) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#63 _PyEval_EvalFrame Include/internal/pycore_ceval.h:116 (python+0x368276) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#64 _PyEval_Vector Python/ceval.c:1911 (python+0x3684fc) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#65 _PyFunction_Vectorcall Objects/call.c:413 (python+0x16a4a1) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#66 _PyObject_VectorcallDictTstate Objects/call.c:135 (python+0x16c514) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#67 _PyObject_Call_Prepend Objects/call.c:504 (python+0x16c7e9) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#68 slot_tp_call Objects/typeobject.c:9987 (python+0x251089) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#69 _PyObject_MakeTpCall Objects/call.c:242 (python+0x16a6fc) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#70 _PyObject_VectorcallTstate Include/internal/pycore_call.h:165 (python+0x16a9b9) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#71 PyObject_Vectorcall Objects/call.c:327 (python+0x16aa71) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#72 _PyEval_EvalFrameDefault Python/generated_cases.c.h:2772 (python+0x345ab7) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#73 _PyEval_EvalFrame Include/internal/pycore_ceval.h:116 (python+0x368276) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#74 _PyEval_Vector Python/ceval.c:1911 (python+0x3684fc) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#75 PyEval_EvalCode Python/ceval.c:658 (python+0x368671) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#76 builtin_exec_impl Python/bltinmodule.c:1158 (python+0x3269ec) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#77 builtin_exec Python/clinic/bltinmodule.c.h:560 (python+0x326b38) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#78 cfunction_vectorcall_FASTCALL_KEYWORDS Objects/methodobject.c:452 (python+0x1eda82) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#79 _PyObject_VectorcallTstate Include/internal/pycore_call.h:167 (python+0x16a928) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#80 PyObject_Vectorcall Objects/call.c:327 (python+0x16aa71) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#81 _PyEval_EvalFrameDefault Python/generated_cases.c.h:960 (python+0x33a0e6) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#82 _PyEval_EvalFrame Include/internal/pycore_ceval.h:116 (python+0x368276) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#83 _PyEval_Vector Python/ceval.c:1911 (python+0x3684fc) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#84 _PyFunction_Vectorcall Objects/call.c:413 (python+0x16a4a1) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#85 _PyVectorcall_Call Objects/call.c:273 (python+0x16c8e1) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#86 _PyObject_Call Objects/call.c:348 (python+0x16cd2b) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#87 PyObject_Call Objects/call.c:373 (python+0x16cd8f) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#88 pymain_run_module Modules/main.c:349 (python+0x4452e7) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#89 pymain_run_python Modules/main.c:691 (python+0x4465b6) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#90 Py_RunMain Modules/main.c:776 (python+0x446961) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#91 pymain_main Modules/main.c:806 (python+0x446a18) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#92 Py_BytesMain Modules/main.c:830 (python+0x446b77) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
#93 main Programs/python.c:15 (python+0x84aeb) (BuildId: d5d547e374d1a5b2826107abad232e80114df33f)
SUMMARY: ThreadSanitizer: data race Include/internal/pycore_frame.h:98 in _PyFrame_GetBytecode
```
```console
WARNING: ThreadSanitizer: data race (pid=5796)
Read of size 8 at 0x7facabdf9248 by main thread:
#0 PyException_GetTraceback Objects/exceptions.c:415 (python+0x18c803) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#1 PyTraceBack_Here Python/traceback.c:266 (python+0x42cd0d) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#2 _PyEval_EvalFrameDefault Python/ceval.c:952 (python+0x367baf) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#3 _PyEval_EvalFrame Include/internal/pycore_ceval.h:116 (python+0x36826a) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#4 _PyEval_Vector Python/ceval.c:1911 (python+0x3684f0) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#5 _PyFunction_Vectorcall Objects/call.c:413 (python+0x16a497) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#6 _PyObject_VectorcallTstate Include/internal/pycore_call.h:167 (python+0x16ebfb) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#7 method_vectorcall Objects/classobject.c:93 (python+0x16edd9) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#8 _PyVectorcall_Call Objects/call.c:273 (python+0x16c8d7) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#9 _PyObject_Call Objects/call.c:348 (python+0x16cd21) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#10 PyObject_Call Objects/call.c:373 (python+0x16cd85) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#11 _PyEval_EvalFrameDefault Python/generated_cases.c.h:1762 (python+0x33ec13) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#12 _PyEval_EvalFrame Include/internal/pycore_ceval.h:116 (python+0x36826a) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#13 _PyEval_Vector Python/ceval.c:1911 (python+0x3684f0) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#14 _PyFunction_Vectorcall Objects/call.c:413 (python+0x16a497) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#15 _PyObject_VectorcallDictTstate Objects/call.c:135 (python+0x16c50a) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#16 _PyObject_Call_Prepend Objects/call.c:504 (python+0x16c7df) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#17 slot_tp_call Objects/typeobject.c:9987 (python+0x25107f) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#18 _PyObject_MakeTpCall Objects/call.c:242 (python+0x16a6f2) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#19 _PyObject_VectorcallTstate Include/internal/pycore_call.h:165 (python+0x16a9af) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#20 PyObject_Vectorcall Objects/call.c:327 (python+0x16aa67) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#21 _PyEval_EvalFrameDefault Python/generated_cases.c.h:2772 (python+0x345aab) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#22 _PyEval_EvalFrame Include/internal/pycore_ceval.h:116 (python+0x36826a) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#23 _PyEval_Vector Python/ceval.c:1911 (python+0x3684f0) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#24 _PyFunction_Vectorcall Objects/call.c:413 (python+0x16a497) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#25 _PyObject_VectorcallTstate Include/internal/pycore_call.h:167 (python+0x16ebfb) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#26 method_vectorcall Objects/classobject.c:93 (python+0x16edd9) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#27 _PyVectorcall_Call Objects/call.c:273 (python+0x16c8d7) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#28 _PyObject_Call Objects/call.c:348 (python+0x16cd21) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#29 PyObject_Call Objects/call.c:373 (python+0x16cd85) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#30 _PyEval_EvalFrameDefault Python/generated_cases.c.h:1762 (python+0x33ec13) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#31 _PyEval_EvalFrame Include/internal/pycore_ceval.h:116 (python+0x36826a) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#32 _PyEval_Vector Python/ceval.c:1911 (python+0x3684f0) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#33 _PyFunction_Vectorcall Objects/call.c:413 (python+0x16a497) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#34 _PyObject_VectorcallDictTstate Objects/call.c:135 (python+0x16c50a) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#35 _PyObject_Call_Prepend Objects/call.c:504 (python+0x16c7df) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#36 slot_tp_call Objects/typeobject.c:9987 (python+0x25107f) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#37 _PyObject_MakeTpCall Objects/call.c:242 (python+0x16a6f2) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#38 _PyObject_VectorcallTstate Include/internal/pycore_call.h:165 (python+0x16a9af) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#39 PyObject_Vectorcall Objects/call.c:327 (python+0x16aa67) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#40 _PyEval_EvalFrameDefault Python/generated_cases.c.h:2772 (python+0x345aab) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#41 _PyEval_EvalFrame Include/internal/pycore_ceval.h:116 (python+0x36826a) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#42 _PyEval_Vector Python/ceval.c:1911 (python+0x3684f0) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#43 _PyFunction_Vectorcall Objects/call.c:413 (python+0x16a497) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#44 _PyObject_VectorcallTstate Include/internal/pycore_call.h:167 (python+0x16ebfb) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#45 method_vectorcall Objects/classobject.c:93 (python+0x16edd9) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#46 _PyVectorcall_Call Objects/call.c:273 (python+0x16c8d7) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#47 _PyObject_Call Objects/call.c:348 (python+0x16cd21) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#48 PyObject_Call Objects/call.c:373 (python+0x16cd85) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#49 _PyEval_EvalFrameDefault Python/generated_cases.c.h:1762 (python+0x33ec13) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#50 _PyEval_EvalFrame Include/internal/pycore_ceval.h:116 (python+0x36826a) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#51 _PyEval_Vector Python/ceval.c:1911 (python+0x3684f0) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#52 _PyFunction_Vectorcall Objects/call.c:413 (python+0x16a497) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#53 _PyObject_VectorcallDictTstate Objects/call.c:135 (python+0x16c50a) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#54 _PyObject_Call_Prepend Objects/call.c:504 (python+0x16c7df) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#55 slot_tp_call Objects/typeobject.c:9987 (python+0x25107f) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#56 _PyObject_MakeTpCall Objects/call.c:242 (python+0x16a6f2) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#57 _PyObject_VectorcallTstate Include/internal/pycore_call.h:165 (python+0x16a9af) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#58 PyObject_Vectorcall Objects/call.c:327 (python+0x16aa67) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#59 _PyEval_EvalFrameDefault Python/generated_cases.c.h:960 (python+0x33a0da) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#60 _PyEval_EvalFrame Include/internal/pycore_ceval.h:116 (python+0x36826a) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#61 _PyEval_Vector Python/ceval.c:1911 (python+0x3684f0) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#62 PyEval_EvalCode Python/ceval.c:658 (python+0x368665) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#63 builtin_exec_impl Python/bltinmodule.c:1158 (python+0x3269e0) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#64 builtin_exec Python/clinic/bltinmodule.c.h:560 (python+0x326b2c) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#65 cfunction_vectorcall_FASTCALL_KEYWORDS Objects/methodobject.c:452 (python+0x1eda78) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#66 _PyObject_VectorcallTstate Include/internal/pycore_call.h:167 (python+0x16a91e) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#67 PyObject_Vectorcall Objects/call.c:327 (python+0x16aa67) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#68 _PyEval_EvalFrameDefault Python/generated_cases.c.h:960 (python+0x33a0da) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#69 _PyEval_EvalFrame Include/internal/pycore_ceval.h:116 (python+0x36826a) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#70 _PyEval_Vector Python/ceval.c:1911 (python+0x3684f0) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#71 _PyFunction_Vectorcall Objects/call.c:413 (python+0x16a497) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#72 _PyVectorcall_Call Objects/call.c:273 (python+0x16c8d7) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#73 _PyObject_Call Objects/call.c:348 (python+0x16cd21) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#74 PyObject_Call Objects/call.c:373 (python+0x16cd85) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#75 pymain_run_module Modules/main.c:349 (python+0x445287) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#76 pymain_run_python Modules/main.c:691 (python+0x446556) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#77 Py_RunMain Modules/main.c:776 (python+0x446901) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#78 pymain_main Modules/main.c:806 (python+0x4469b8) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#79 Py_BytesMain Modules/main.c:830 (python+0x446b17) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#80 main Programs/python.c:15 (python+0x84aeb) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
Previous write of size 8 at 0x7facabdf9248 by thread T5:
#0 _PyErr_Restore Python/errors.c:99 (python+0x39a7a0) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#1 _PyErr_SetObject Python/errors.c:244 (python+0x39a1ea) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#2 do_raise Python/ceval.c:2077 (python+0x32d89d) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#3 _PyEval_EvalFrameDefault Python/generated_cases.c.h:6858 (python+0x35ec05) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#4 _PyEval_EvalFrame Include/internal/pycore_ceval.h:116 (python+0x36826a) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#5 _PyEval_Vector Python/ceval.c:1911 (python+0x3684f0) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#6 _PyFunction_Vectorcall Objects/call.c:413 (python+0x16a497) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#7 _PyObject_VectorcallTstate Include/internal/pycore_call.h:167 (python+0x16ebfb) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#8 method_vectorcall Objects/classobject.c:71 (python+0x16ef1b) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#9 _PyVectorcall_Call Objects/call.c:273 (python+0x16c8d7) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#10 _PyObject_Call Objects/call.c:348 (python+0x16cd21) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#11 PyObject_Call Objects/call.c:373 (python+0x16cd85) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#12 thread_run Modules/_threadmodule.c:346 (python+0x4d30f8) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#13 pythread_wrapper Python/thread_pthread.h:242 (python+0x429eca) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
Thread T5 'asyncio_0' (tid=7980, running) created by main thread at:
#0 pthread_create ../../../../src/libsanitizer/tsan/tsan_interceptors_posix.cpp:1022 (libtsan.so.2+0x5ac1a) (BuildId: 38097064631f7912bd33117a9c83d08b42e15571)
#1 do_start_joinable_thread Python/thread_pthread.h:289 (python+0x42a31b) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#2 PyThread_start_joinable_thread Python/thread_pthread.h:313 (python+0x42a511) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#3 ThreadHandle_start Modules/_threadmodule.c:431 (python+0x4d2a8d) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#4 do_start_new_thread Modules/_threadmodule.c:1794 (python+0x4d2c96) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#5 thread_PyThread_start_joinable_thread Modules/_threadmodule.c:1917 (python+0x4d2f04) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#6 cfunction_call Objects/methodobject.c:551 (python+0x1ee9dc) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#7 _PyObject_MakeTpCall Objects/call.c:242 (python+0x16a6f2) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#8 _PyObject_VectorcallTstate Include/internal/pycore_call.h:165 (python+0x16a9af) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#9 PyObject_Vectorcall Objects/call.c:327 (python+0x16aa67) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#10 _PyEval_EvalFrameDefault Python/generated_cases.c.h:2199 (python+0x341b95) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#11 _PyEval_EvalFrame Include/internal/pycore_ceval.h:116 (python+0x36826a) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#12 _PyEval_Vector Python/ceval.c:1911 (python+0x3684f0) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#13 _PyFunction_Vectorcall Objects/call.c:413 (python+0x16a497) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#14 _PyObject_VectorcallTstate Include/internal/pycore_call.h:167 (python+0x16ebfb) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#15 method_vectorcall Objects/classobject.c:93 (python+0x16edd9) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#16 _PyVectorcall_Call Objects/call.c:273 (python+0x16c8d7) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#17 _PyObject_Call Objects/call.c:348 (python+0x16cd21) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#18 PyObject_Call Objects/call.c:373 (python+0x16cd85) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#19 _PyEval_EvalFrameDefault Python/generated_cases.c.h:1762 (python+0x33ec13) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#20 _PyEval_EvalFrame Include/internal/pycore_ceval.h:116 (python+0x36826a) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#21 _PyEval_Vector Python/ceval.c:1911 (python+0x3684f0) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#22 _PyFunction_Vectorcall Objects/call.c:413 (python+0x16a497) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#23 _PyObject_VectorcallTstate Include/internal/pycore_call.h:167 (python+0x16ebfb) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#24 method_vectorcall Objects/classobject.c:93 (python+0x16edd9) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#25 _PyVectorcall_Call Objects/call.c:273 (python+0x16c8d7) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#26 _PyObject_Call Objects/call.c:348 (python+0x16cd21) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#27 PyObject_Call Objects/call.c:373 (python+0x16cd85) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#28 _PyEval_EvalFrameDefault Python/generated_cases.c.h:1762 (python+0x33ec13) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#29 _PyEval_EvalFrame Include/internal/pycore_ceval.h:116 (python+0x36826a) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#30 _PyEval_Vector Python/ceval.c:1911 (python+0x3684f0) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#31 _PyFunction_Vectorcall Objects/call.c:413 (python+0x16a497) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#32 _PyObject_VectorcallDictTstate Objects/call.c:135 (python+0x16c50a) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#33 _PyObject_Call_Prepend Objects/call.c:504 (python+0x16c7df) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#34 slot_tp_call Objects/typeobject.c:9987 (python+0x25107f) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#35 _PyObject_MakeTpCall Objects/call.c:242 (python+0x16a6f2) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#36 _PyObject_VectorcallTstate Include/internal/pycore_call.h:165 (python+0x16a9af) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#37 PyObject_Vectorcall Objects/call.c:327 (python+0x16aa67) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#38 _PyEval_EvalFrameDefault Python/generated_cases.c.h:2772 (python+0x345aab) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#39 _PyEval_EvalFrame Include/internal/pycore_ceval.h:116 (python+0x36826a) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#40 _PyEval_Vector Python/ceval.c:1911 (python+0x3684f0) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#41 _PyFunction_Vectorcall Objects/call.c:413 (python+0x16a497) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#42 _PyObject_VectorcallTstate Include/internal/pycore_call.h:167 (python+0x16ebfb) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#43 method_vectorcall Objects/classobject.c:93 (python+0x16edd9) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#44 _PyVectorcall_Call Objects/call.c:273 (python+0x16c8d7) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#45 _PyObject_Call Objects/call.c:348 (python+0x16cd21) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#46 PyObject_Call Objects/call.c:373 (python+0x16cd85) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#47 _PyEval_EvalFrameDefault Python/generated_cases.c.h:1762 (python+0x33ec13) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#48 _PyEval_EvalFrame Include/internal/pycore_ceval.h:116 (python+0x36826a) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#49 _PyEval_Vector Python/ceval.c:1911 (python+0x3684f0) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#50 _PyFunction_Vectorcall Objects/call.c:413 (python+0x16a497) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#51 _PyObject_VectorcallDictTstate Objects/call.c:135 (python+0x16c50a) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#52 _PyObject_Call_Prepend Objects/call.c:504 (python+0x16c7df) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#53 slot_tp_call Objects/typeobject.c:9987 (python+0x25107f) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#54 _PyObject_MakeTpCall Objects/call.c:242 (python+0x16a6f2) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#55 _PyObject_VectorcallTstate Include/internal/pycore_call.h:165 (python+0x16a9af) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#56 PyObject_Vectorcall Objects/call.c:327 (python+0x16aa67) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#57 _PyEval_EvalFrameDefault Python/generated_cases.c.h:2772 (python+0x345aab) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#58 _PyEval_EvalFrame Include/internal/pycore_ceval.h:116 (python+0x36826a) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#59 _PyEval_Vector Python/ceval.c:1911 (python+0x3684f0) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#60 _PyFunction_Vectorcall Objects/call.c:413 (python+0x16a497) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#61 _PyObject_VectorcallTstate Include/internal/pycore_call.h:167 (python+0x16ebfb) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#62 method_vectorcall Objects/classobject.c:93 (python+0x16edd9) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#63 _PyVectorcall_Call Objects/call.c:273 (python+0x16c8d7) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#64 _PyObject_Call Objects/call.c:348 (python+0x16cd21) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#65 PyObject_Call Objects/call.c:373 (python+0x16cd85) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#66 _PyEval_EvalFrameDefault Python/generated_cases.c.h:1762 (python+0x33ec13) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#67 _PyEval_EvalFrame Include/internal/pycore_ceval.h:116 (python+0x36826a) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#68 _PyEval_Vector Python/ceval.c:1911 (python+0x3684f0) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#69 _PyFunction_Vectorcall Objects/call.c:413 (python+0x16a497) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#70 _PyObject_VectorcallDictTstate Objects/call.c:135 (python+0x16c50a) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#71 _PyObject_Call_Prepend Objects/call.c:504 (python+0x16c7df) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#72 slot_tp_call Objects/typeobject.c:9987 (python+0x25107f) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#73 _PyObject_MakeTpCall Objects/call.c:242 (python+0x16a6f2) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#74 _PyObject_VectorcallTstate Include/internal/pycore_call.h:165 (python+0x16a9af) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#75 PyObject_Vectorcall Objects/call.c:327 (python+0x16aa67) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#76 _PyEval_EvalFrameDefault Python/generated_cases.c.h:960 (python+0x33a0da) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#77 _PyEval_EvalFrame Include/internal/pycore_ceval.h:116 (python+0x36826a) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#78 _PyEval_Vector Python/ceval.c:1911 (python+0x3684f0) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#79 PyEval_EvalCode Python/ceval.c:658 (python+0x368665) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#80 builtin_exec_impl Python/bltinmodule.c:1158 (python+0x3269e0) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#81 builtin_exec Python/clinic/bltinmodule.c.h:560 (python+0x326b2c) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#82 cfunction_vectorcall_FASTCALL_KEYWORDS Objects/methodobject.c:452 (python+0x1eda78) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#83 _PyObject_VectorcallTstate Include/internal/pycore_call.h:167 (python+0x16a91e) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#84 PyObject_Vectorcall Objects/call.c:327 (python+0x16aa67) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#85 _PyEval_EvalFrameDefault Python/generated_cases.c.h:960 (python+0x33a0da) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#86 _PyEval_EvalFrame Include/internal/pycore_ceval.h:116 (python+0x36826a) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#87 _PyEval_Vector Python/ceval.c:1911 (python+0x3684f0) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#88 _PyFunction_Vectorcall Objects/call.c:413 (python+0x16a497) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#89 _PyVectorcall_Call Objects/call.c:273 (python+0x16c8d7) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#90 _PyObject_Call Objects/call.c:348 (python+0x16cd21) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#91 PyObject_Call Objects/call.c:373 (python+0x16cd85) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#92 pymain_run_module Modules/main.c:349 (python+0x445287) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#93 pymain_run_python Modules/main.c:691 (python+0x446556) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#94 Py_RunMain Modules/main.c:776 (python+0x446901) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#95 pymain_main Modules/main.c:806 (python+0x4469b8) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#96 Py_BytesMain Modules/main.c:830 (python+0x446b17) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
#97 main Programs/python.c:15 (python+0x84aeb) (BuildId: 2a7129e7efc6d9757fb757ba515af9799469be95)
SUMMARY: ThreadSanitizer: data race Objects/exceptions.c:415 in PyException_GetTraceback
==================
```
</details>
<!-- gh-linked-prs -->
### Linked PRs
* gh-128728
* gh-129298
* gh-131322
* gh-131479
* gh-131548
<!-- /gh-linked-prs -->
| 75214f87f1ddd1d7b9a5b663a9c688b1bd41c098 | bf64a582f00a030fee11b7f89c6a02ea967990ca |
python/cpython | python__cpython-128410 | # Document `pdb.post_mortem()` accepts exceptions on Python 3.13+
# Documentation
Some change in Python 3.13 (maybe 5f3433f210d25d366fcebfb40adf444c8f46cd59 or related) allows `pdb.post_mortem()` to accept an exception object, as well as a traceback object. This could be useful to use for chained exception access, for example in Django’s test runner where [a traceback is currently passed](https://github.com/django/django/blob/8d9901c961bf9d5cfa6bddddbbcebfbf487a5125/django/test/runner.py#L124-L129), but the exception with chained causes is available.
Tested with:
```python
import pdb
try:
try:
1 / 0
except Exception:
2 / 0
except Exception as exc:
pdb.post_mortem(exc)
```
and ran with:
```
$ uv run -p 3.13 python example.py
> /.../example.py(7)<module>()
-> 2 / 0
(Pdb) exceptions
0 ZeroDivisionError('division by zero')
> 1 ZeroDivisionError('division by zero')
(Pdb) exceptions 0
> /.../example.py(5)<module>()
-> 1 / 0
(Pdb)
```
<!-- gh-linked-prs -->
### Linked PRs
* gh-128410
* gh-128767
<!-- /gh-linked-prs -->
| 1b39b502d33c68f52fd775c4e6c2174baddd40bd | 802556abfa008abe0bdd78e6f9e18bef71db90c1 |
python/cpython | python__cpython-128422 | # Crash when using _Py_DumpTracebackThreads
# Crash report
### What happened?
```python
# triggering program
# based on test.test_faulthandler.FaultHandlerTests.test_dump_traceback_threads
import faulthandler
from threading import Thread, Event
class Waiter(Thread):
def __init__(self):
Thread.__init__(self)
self.running = Event()
self.stop = Event()
def run(self):
self.running.set()
self.stop.wait()
def main():
for i in range(100):
waiter = Waiter()
waiter.start()
waiter.running.wait()
faulthandler.dump_traceback(all_threads=True)
waiter.stop.set()
waiter.join()
if __name__ == '__main__':
main()
```
This will case the interpreter to segfault if built with `--disable-gil --with-pydebug`. I've bisected it to this commit:
b2afe2aae487ebf89897e22c01d9095944fd334f: gh-123924
Using gdb:
```
Thread 1 "python" received signal SIGSEGV, Segmentation fault.
_PyFrame_GetCode (f=f@entry=0x7ffff7fb32d8) at ./Include/internal/pycore_frame.h:83
83 assert(PyCode_Check(executable));
(gdb) p executable
$7 = 0x0
(gdb) bt
#0 _PyFrame_GetCode (f=f@entry=0x7ffff7fb32d8) at ./Include/internal/pycore_frame.h:83
#1 PyUnstable_InterpreterFrame_GetLine (frame=frame@entry=0x7ffff7fb32d8) at Python/frame.c:149
#2 0x000055555590e9eb in dump_frame (fd=2, frame=0x7ffff7fb32d8) at Python/traceback.c:905
#3 dump_traceback (fd=fd@entry=2, tstate=tstate@entry=0x555555cef140, write_header=write_header@entry=0) at Python/traceback.c:974
#4 0x000055555590ed1c in _Py_DumpTracebackThreads (fd=2, interp=<optimized out>, interp@entry=0x0, current_tstate=0x555555c5dea8 <_PyRuntime+359528>) at Python/traceback.c:1090
#5 0x0000555555924489 in faulthandler_dump_traceback_py (self=<optimized out>, args=<optimized out>, kwargs=<optimized out>) at ./Modules/faulthandler.c:240
#6 0x00005555556feae1 in cfunction_call (func=func@entry=<built-in method dump_traceback of module object at remote 0x20000778900>, args=args@entry=(), kwargs=kwargs@entry={'all_threads': True})
[...]
```
### CPython versions tested on:
CPython main branch
### Operating systems tested on:
Linux
### Output from running 'python -VV' on the command line:
Python 3.14.0a0 experimental free-threading build (bisect/bad:b2afe2aae48, Jan 1 2025, 17:09:16) [Clang 19.1.6 (++20241217105838+657e03f8625c-1~exp1~20241217105944.74)]
<!-- gh-linked-prs -->
### Linked PRs
* gh-128422
* gh-128423
* gh-128425
* gh-128758
<!-- /gh-linked-prs -->
| c9356feef28e6dfc4dc32830d3427a5ae0e426e2 | a626f9a67b76e5fe69677afd5f8317d8c61de8de |
python/cpython | python__cpython-132218 | # Suggest `async with` when `with` finds no `__enter__`/`__exit__`
# Bug report
### Bug description:
(This is *not* an asyncio bug! I am just using `asyncio.TaskGroup()` as an example.)
```python
import asyncio
def foo():
with asyncio.TaskGroup() as g: # BUG: should be `async with`
pass
```
This currently gives an error ending in
```
TypeError: 'TaskGroup' object does not support the context manager protocol (missed __exit__ method)
```
That's not very clear about what's wrong. Maybe when issuing this `TypeError` we could check if the object supports `__aexit__` and `__aenter__`, and if so, suggest something like "maybe try `async with` ?".
### CPython versions tested on:
3.12, 3.13, 3.14
### Operating systems tested on:
_No response_
<!-- gh-linked-prs -->
### Linked PRs
* gh-132218
<!-- /gh-linked-prs -->
| 8a9c6c4d16a746eea1e000d6701d1c274c1f331b | 95800fe6e719c829acf52fbb00198135b78719b4 |
python/cpython | python__cpython-130235 | # PEP 667 + PEP 709 segfaults from accessing closure variables bound by any inlined comprehensions
# Bug report
### Bug description:
The segfault described here is related to PEP-667 and PEP-709.
I think I experienced a couple of similar but not same segfaults, and this here is just one of a few of them. I might be wrong though.
I'd like to start working on fixing this in order to possibly find more unhappy paths.
## Reproduction
Here are a bunch of reproductions:
```py
def f():
lambda: k
k: int
[k for k in [0] if locals()]
f()
```
```py
def f():
lambda: k
k = [sys._getframe(0).f_locals["k"] for k in [0]]
f()
```
```py
def f():
lambda: k
k = 1
[eval("") for k in [0]]
f()
```
@alexmojaki also found
```py
def f():
lambda: k
k = 1
[locals() for k in [0]]
f()
```
```py
def f():
lambda: k
k: int
[locals() for k in [0]]
f()
```
This one shows the problem the best:
```py
def fetch_locals_proxy():
# anything that fetches PEP 667 FrameLocalsProxy contents
# causes the crash
sys._getframe(1).f_locals.items()
def f():
lambda: k
k = 1
[fetch_locals_proxy() for k in [0]]
f()
```
## Traceback
```
Fatal Python error: Segmentation fault
Current thread 0x00007fd059596740 (most recent call first):
File "/tmp/repro/dump-1.py", line 9 in fetch_locals_proxy
File "/tmp/repro/dump-1.py", line 14 in f
File "/tmp/repro/dump-1.py", line 17 in <module>
Segmentation fault (core dumped)
```
## Conclusions
1. There must be a statement that allows to create a closure for a variable, for instance `k`, in a scope ("target scope"). It's either `k = ...` or `k: int` in the repros.
2. There must be an inlined comprehension **that binds `k`** as target (e.g. `k = 1; [x for x in [0] if locals()]` doesn't cause segfault).
3. After binding the variable during the evaluation of the inlined comprehension, something must fetch the contents of the PEP 667 proxy of the target scope.
4. The target scope must be any [optimized scope](https://docs.python.org/3.13/glossary.html#term-optimized-scope) (not confirmed for generator expressions), since only those involve [PEP 667](https://peps.python.org/pep-0667/) `FrameLocalsProxy`. That's the reason why the crash doesn't happen at a module/class level:
```py
class Spam:
lambda: k
k = [k for k in [0] if locals()]
```
or on Python <3.13, before PEP 667 had been introduced.
5. The iterable traversed in the comprehension isn't special (the crash doesn't happen for certain objects, e.g. `[None]`[^1], `(...,)`, but happens for others, e.g. `[0]`, `range(1)`). Not confirmed for every platform.
[^1]: Const lists (from [displays](https://docs.python.org/3/reference/expressions.html#displays-for-lists-sets-and-dictionaries)) are compiled into tuples under the hood before the loop begins, so `[None]` here is equivalent to `(None,)`.
Thanks @Eclips4 for hints to finding the best reproduction. Thanks @trag1c for reporting the problem after accidentally running into it in a real-life use case.
I'm delighted to accept any help or guidance (cc @JelleZijlstra @carljm), as I want to author the patch to fix this issue and learn something in the process. Thanks!
### CPython versions tested on:
3.13, 3.14, CPython main branch
### Operating systems tested on:
Linux
<!-- gh-linked-prs -->
### Linked PRs
* gh-130235
* gh-130311
<!-- /gh-linked-prs -->
| ccf17323c218a2fdcf7f4845d3eaa74ebddefa44 | 5f00501a940a0fb97870e70066fb301909320388 |
python/cpython | python__cpython-128389 | # `pyrepl` on Windows: add Ctrl+← and Ctrl+→ word-skipping and other keybindings
# Feature or enhancement
### Proposal:
Currently, `_pyrepl/windows_console.py` is very limited compared to `_pyrepl/unix_console.py`, for example, it doesn't support the `Ctrl`+`←` and `Ctrl`+`→` word-skipping keybindings (see also #119248) nor any of the keybindings that use meta (i.e. Alt), e.g. to `kill-word` or `backward-kill-word`.
This is extra-annoying given the fact that the previous Python REPL did support Ctrl`+`←` and `Ctrl`+`→` word-skipping keybindings in Windows, i.e. before pyrepl was used for Python 3.13.
### Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
### Links to previous discussion of this feature:
_No response_
<!-- gh-linked-prs -->
### Linked PRs
* gh-128389
* gh-130500
<!-- /gh-linked-prs -->
| 688f3a0d4b94874ff6d72af3baafd8bbf911153e | baf65715fc9002e43cd0e1010b8dba9b4c84d503 |
python/cpython | python__cpython-128378 | # `test_cmd_line.test_non_interactive_output_buffering` fails when `PYTHONUNBUFFERED` is enabled
# Bug report
### Bug description:
Reproducer:
```bash
➜ cpython git:(main) ✗ export PYTHONUNBUFFERED=1
➜ cpython git:(main) ✗ python3 -m test test_cmd_line
Using random seed: 2481773783
Raised RLIMIT_NOFILE: 256 -> 1024
0:00:00 load avg: 2.40 Run 1 test sequentially in a single process
0:00:00 load avg: 2.40 [1/1] test_cmd_line
test test_cmd_line failed -- Traceback (most recent call last):
File "/opt/homebrew/Cellar/python@3.13/3.13.1/Frameworks/Python.framework/Versions/3.13/lib/python3.13/test/test_cmd_line.py", line 348, in test_non_interactive_output_buffering
self.assertEqual(proc.stdout,
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
'False False False\n'
^^^^^^^^^^^^^^^^^^^^^
'False False True\n')
^^^^^^^^^^^^^^^^^^^^^
AssertionError: 'False True False\nFalse True False\n' != 'False False False\nFalse False True\n'
- False True False
? ^^^
+ False False False
? ^^^^
- False True False
+ False False True
test_cmd_line failed (1 failure)
== Tests result: FAILURE ==
1 test failed:
test_cmd_line
Total duration: 2.8 sec
Total tests: run=59 failures=1 skipped=1
Total test files: run=1/1 failed=1
Result: FAILURE
```
Test expects buffered stdio but does not check for `PYTHONUNBUFFERED`.
Init config for buffering: https://github.com/python/cpython/blob/e389d6c650ddacb55b08b657f1e4e9b1330f3455/Python/initconfig.c#L1786-L1790
### CPython versions tested on:
CPython main branch
### Operating systems tested on:
macOS
<!-- gh-linked-prs -->
### Linked PRs
* gh-128378
<!-- /gh-linked-prs -->
| 30268b5d2fbb1a5e6c876f0cdc4cbdb5d93315e6 | 22a442181d5f1ac496dac08e24fd852de404882f |
python/cpython | python__cpython-128445 | # Performance of instrumented `FOR_ITER` is poor as `DISABLE` doesn't remove the instrumentation.
Disabling the "not taken" branch of an instrumented `FOR_ITER` does not de-instrument the `FOR_ITER`, it only de-instruments the `NOT_TAKEN` which prevents specialization and JIT compilation of the `FOR_ITER`. It is only when the loop exits, that the `FOR_ITER` is de-instrumented.
Instead of instrumenting the `FOR_ITER` we could instrument the `POP_TOP` at the end of the loop.
This will add an extra instruction dispatch when exiting the loop, as `FOR_ITER` and its specializations will need to jump to the `POP_TOP` instead of over it. We already do this in tier2, so the overhead should be negligible, and it might simplify the code a bit.
<!-- gh-linked-prs -->
### Linked PRs
* gh-128445
<!-- /gh-linked-prs -->
| f826beca0cedb8e4b92896544c75fd0d9dcb0446 | b9c693dcca01537eee1ef716ffebc632be37594b |
python/cpython | python__cpython-130724 | # `test_concurrent_futures.test_wait.ThreadPoolWaitTests.test_timeout` flakes frequently on free-threaded Windows x64
# Bug report
### Bug description:
The following test fails frequently, but not consistently:
```
test_timeout (test.test_concurrent_futures.test_wait.ThreadPoolWaitTests.test_timeout) ... FAIL
0.86s
======================================================================
FAIL: test_timeout (test.test_concurrent_futures.test_wait.ThreadPoolWaitTests.test_timeout)
----------------------------------------------------------------------
Traceback (most recent call last):
File "D:\a\cpython\cpython\Lib\test\test_concurrent_futures\test_wait.py", line 129, in test_timeout
self.assertEqual(set([CANCELLED_AND_NOTIFIED_FUTURE,
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
EXCEPTION_FUTURE,
^^^^^^^^^^^^^^^^^
SUCCESSFUL_FUTURE]),
^^^^^^^^^^^^^^^^^^^^
finished)
^^^^^^^^^
AssertionError: Items in the second set but not the first:
<Future at 0x20000554620 state=finished returned NoneType>
```
As seen in the following CI runs for recent commits to `main`
- https://github.com/python/cpython/actions/runs/12549107170/job/34989573917
- https://github.com/python/cpython/actions/runs/12527558956/job/34941261499
- https://github.com/python/cpython/actions/runs/12533132642/job/34952530854
- https://github.com/python/cpython/actions/runs/12529744428/job/34945648292
- https://github.com/python/cpython/actions/runs/12505440015/job/34888819142
A brief analysis of the code at
https://github.com/python/cpython/blob/1d3225ae056245da75e4a443ccafcc8f4f982cf2/Lib/test/test_concurrent_futures/test_wait.py#L115-L133
looks like the sleeping `future` is present in the `finished` set instead of `pending`
### CPython versions tested on:
CPython main branch
### Operating systems tested on:
Windows
<!-- gh-linked-prs -->
### Linked PRs
* gh-130724
* gh-130728
* gh-130729
* gh-130732
* gh-130734
* gh-130735
* gh-130742
* gh-130922
<!-- /gh-linked-prs -->
| 5221d9ce0e2beb0fe04bed072e1bb448fd522882 | cfa0b1dc375e63cde28e61a47108c645b0e74834 |
python/cpython | python__cpython-128361 | # Migrate from `PyGILState_Check` to thread state checks internally
# Feature or enhancement
### Proposal:
In some older areas of the codebase, we have the following to ensure that the caller holds the GIL (or really, an [attached thread state](https://github.com/python/cpython/pull/127990)):
```c
assert(PyGILState_Check())
```
This doesn't work for subinterpreters, because GILstate checks are disabled when subinterpreters exist. This hasn't been an issue in practice, but it would be nice to get these replaced with more correct thread state checks. I think a helper function that calls `_Py_EnsureTstateNotNULL` if assertions are enabled would work nicely.
### Has this already been discussed elsewhere?
No response given
### Links to previous discussion of this feature:
_No response_
<!-- gh-linked-prs -->
### Linked PRs
* gh-128361
<!-- /gh-linked-prs -->
| 4d0a6595a06c554c57ebd90ee64ff4c2bec239b8 | c6b570e5e3b214d2038645c5fa7806e0fb3f7dcd |
python/cpython | python__cpython-128359 | # `LDFLAGS` and `LIBS` not used consistently in `configure`
# Bug report
### Bug description:
Following up on #128322, I noticed that the same pattern of setting `LDFLAGS` instead of `LIBS` is used frequently. Additionally, there is not consistency in the ordering of the added libraries, e.g., `LIBS="$LIBS ..."` vs `LIBS="... $LIBS"`.
For cases where the linking order matters, I believe using `LDFLAGS` is incorrect and the existing `$LIBS` should always come first.
### CPython versions tested on:
CPython main branch
### Operating systems tested on:
Linux
<!-- gh-linked-prs -->
### Linked PRs
* gh-128359
* gh-128465
* gh-128466
<!-- /gh-linked-prs -->
| b75ed951d4de8ba85349d80c8e7f097b3cd6052f | 4974bbdb290b61a2d8860de490fde1228c296753 |
python/cpython | python__cpython-128379 | # Docs: decimal.BasicContext etc. are not classes
# Documentation
The `decimal` module exports three constants `BasicContext`, `ExtendedContext` and `DefaultContext`, which are instances of `Context`:
```
$ python3
Python 3.13.1 (main, Dec 20 2024, 10:15:12) [Clang 14.0.0 (clang-1400.0.29.202)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import decimal
>>> type(decimal.BasicContext)
<class 'decimal.Context'>
```
The [documentation of module `decimal`](https://docs.python.org/3.13/library/decimal.html#decimal.BasicContext) is misleading by containing these 3 declarations:
> *class* decimal.**BasicContext** \
> ...
>
> *class* decimal.**ExtendedContext** \
> ...
>
> *class* decimal.**DefaultContext** \
> ...
This made me think that these are subclasses of `Context` that need to be instantiated like this:
```
>>> decimal.setcontext(decimal.ExtendedContext())
Traceback (most recent call last):
File "<python-input-2>", line 1, in <module>
decimal.setcontext(decimal.ExtendedContext())
~~~~~~~~~~~~~~~~~~~~~~~^^
TypeError: 'decimal.Context' object is not callable
```
I would expect the declarations to look more like the ones e.g. under [Rounding modes](https://docs.python.org/3.13/library/decimal.html#rounding-modes).
<!-- gh-linked-prs -->
### Linked PRs
* gh-128379
* gh-128401
* gh-128402
<!-- /gh-linked-prs -->
| 60c65184695a3eab766b3bc26fc99f695deb998f | c810ed7c8e0a7464d19700ba1c8668a406f1c042 |
python/cpython | python__cpython-128344 | # GIL is not properly disabled for _freeze_module.vcxproj
# Bug report
### Bug description:
The _freeze_module.vcxproj file is looking for `#undef Py_GIL_DISABLED`, but that was changed to `/* #define Py_GIL_DISABLED 1 */` some time ago, so the build system ends up looking to replace a line that doesn't exist, the result is that the freeze Python never has GIL disabled even if it was requested during the build
### CPython versions tested on:
CPython main branch
### Operating systems tested on:
Windows
<!-- gh-linked-prs -->
### Linked PRs
* gh-128344
<!-- /gh-linked-prs -->
| c26bed1160978fe8b1844878b8123778e47870c6 | a13460ac4427892be613bf0e2988f5a2b2364602 |
python/cpython | python__cpython-128343 | # Timeout unit isn't specified in subprocess docstrings
# Documentation
Timeout unit isn't specified in subprocess docstrings. For example here:
```
def run(*popenargs,
input=None, capture_output=False, timeout=None, check=False, **kwargs):
"""Run command with arguments and return a CompletedProcess instance.
The returned instance will have attributes args, returncode, stdout and
stderr. By default, stdout and stderr are not captured, and those attributes
will be None. Pass stdout=PIPE and/or stderr=PIPE in order to capture them,
or pass capture_output=True to capture both.
If check is True and the exit code was non-zero, it raises a
CalledProcessError. The CalledProcessError object will have the return code
in the returncode attribute, and output & stderr attributes if those streams
were captured.
If timeout is given, and the process takes too long, a TimeoutExpired
exception will be raised.
There is an optional argument "input", allowing you to
pass bytes or a string to the subprocess's stdin. If you use this argument
you may not also use the Popen constructor's "stdin" argument, as
it will be used internally.
By default, all communication is in bytes, and therefore any "input" should
be bytes, and the stdout and stderr will be bytes. If in text mode, any
"input" should be a string, and stdout and stderr will be strings decoded
according to locale encoding, or by "encoding" if set. Text mode is
triggered by setting any of text, encoding, errors or universal_newlines.
The other arguments are the same as for the Popen constructor.
"""
```
It would be nice if it specified the unit of the timeout.
<!-- gh-linked-prs -->
### Linked PRs
* gh-128343
* gh-128365
* gh-128366
<!-- /gh-linked-prs -->
| dafe7a44630aa32bb411cceb45c7b7df725e3fe3 | 47d2cb8eb7595df5940225867dbb66b6dd59413a |
python/cpython | python__cpython-128331 | # Terminal settings are not correctly restored on repl exit
# Bug report
### Bug description:
I am working on updating the version of Python that ships in [OmniOS](https://omnios.org) -- an illumos distribution -- from 3.12 to 3.13 and have encountered a problem with terminal settings not being properly restored when exiting from the interactive interpreter prompt.
In particular, I see the EOF character changing from 0x4 (^D) to 0x1 (^A) after a trip through repl:
```
bloody% stty -a | grep eof
eof = ^d; eol = <undef>; eol2 = <undef>; swtch = <undef>;
bloody% python3
Python 3.13.1 (main, Dec 29 2024, 11:58:33) [GCC 14.2.0] on sunos5
Type "help", "copyright", "credits" or "license" for more information.
>>> exit
bloody% stty -a | grep eof
eof = ^a; eol = <undef>; eol2 = <undef>; swtch = <undef>;
```
Using DTrace (we patch dtrace support back into python locally), I can see that all of the other settings are being restored, just not this particular control character. Here's an excerpt:
Here is the sequence that switches the terminal to raw mode. The trace shows
that `c_cc[4]` is being changed from 0x4 to 0x1. This is `VMIN` so as expected.
```
15 1364 dtrace function-entry: fancy_termios.py:tcsetattr:54
15 1364 dtrace function-entry: fancy_termios.py:as_list:35
15 1366 dtrace function-return: fancy_termios.py:as_list:36
15 78613 tcgetattr:return struct termios {
tcflag_t c_iflag = 0x2526
tcflag_t c_oflag = 0x5
tcflag_t c_cflag = 0xf01af
tcflag_t c_lflag = 0x8a3b
cc_t [19] c_cc = [ 0x3, 0x1c, 0x7f, 0x15, 0x4, 0, 0, 0, 0x11, 0x13, 0x1a, 0x19, 0x12, 0xf, 0x17, 0x16, 0x14, 0x8, 0 ]
}
15 78611 tcsetattr:entry struct termios {
tcflag_t c_iflag = 0x2106
tcflag_t c_oflag = 0x4
tcflag_t c_cflag = 0xf00bf
tcflag_t c_lflag = 0xa31
cc_t [19] c_cc = [ 0x3, 0x1c, 0x7f, 0x15, 0x1, 0, 0, 0, 0x11, 0x13, 0x1a, 0x19, 0x12, 0xf, 0x17, 0x16, 0x14, 0x8, 0 ]
}
```
and here is where the terminal is restored:
```
0 1366 dtrace function-return: unix_console.py:flushoutput:489
0 1364 dtrace function-entry: fancy_termios.py:tcsetattr:54
0 1364 dtrace function-entry: fancy_termios.py:as_list:35
0 1366 dtrace function-return: fancy_termios.py:as_list:36
0 78613 tcgetattr:return struct termios {
tcflag_t c_iflag = 0x2106
tcflag_t c_oflag = 0x4
tcflag_t c_cflag = 0xf00bf
tcflag_t c_lflag = 0xa31
cc_t [19] c_cc = [ 0x3, 0x1c, 0x7f, 0x15, 0x1, 0, 0, 0, 0x11, 0x13, 0x1a, 0x19, 0x12, 0xf, 0x17, 0x16, 0x14, 0x8, 0 ]
}
0 78611 tcsetattr:entry struct termios {
tcflag_t c_iflag = 0x2526
tcflag_t c_oflag = 0x5
tcflag_t c_cflag = 0xf01af
tcflag_t c_lflag = 0x8a3b
cc_t [19] c_cc = [ 0x3, 0x1c, 0x7f, 0x15, 0x1, 0, 0, 0, 0x11, 0x13, 0x1a, 0x19, 0x12, 0xf, 0x17, 0x16, 0x14, 0x8, 0 ]
}
```
Everything is being restored apart from that `c_cc[4]`. On illumos, VMIN and
VEOF are both defined as 4, which is legitimate but different to some other
UNIX-like environments.
The bug here is that the list of control characters is not deep copied in
fancy_termios.py.
### CPython versions tested on:
3.13
### Operating systems tested on:
Other
<!-- gh-linked-prs -->
### Linked PRs
* gh-128331
* gh-129233
<!-- /gh-linked-prs -->
| 0b15d9c0d2d30c7d3f17ebb90dd822ef32f977cc | ec91e1c2762412f1408b0dfb5d281873b852affe |
python/cpython | python__cpython-128322 | # Statically linked `sqlite3` fails checks due to missing `-lm`
# Bug report
### Bug description:
On Linux, if I build a static version of sqlite3 (e.g., `./configure --disable-shared && make` from a sqlite3 tarball)
You can see that `./configure` for CPython fails the SQLite checks (added back in https://github.com/python/cpython/pull/30016):
```
$ ./configure 2>&1 | grep sqlite
checking for sqlite3 >= 3.15.2... yes
checking for sqlite3.h... yes
checking for sqlite3_bind_double in -lsqlite3... no
checking for sqlite3_column_decltype in -lsqlite3... no
checking for sqlite3_column_double in -lsqlite3... no
checking for sqlite3_complete in -lsqlite3... no
checking for sqlite3_progress_handler in -lsqlite3... no
checking for sqlite3_result_double in -lsqlite3... no
checking for sqlite3_set_authorizer in -lsqlite3... no
checking for sqlite3_trace_v2 in -lsqlite3... no
checking for sqlite3_trace in -lsqlite3... no
checking for sqlite3_value_double in -lsqlite3... no
checking for sqlite3_load_extension in -lsqlite3... no
checking for sqlite3_serialize in -lsqlite3... no
checking for --enable-loadable-sqlite-extensions... no
```
And in the `config.log` there are a bunch of failures due to undefined references to functions in libm, e.g.:
```
configure:15469: checking for sqlite3_bind_double in -lsqlite3
configure:15492: gcc -o conftest -I/usr/local/include -I$(srcdir)/Modules/_sqlite -L/usr/local/lib -lsqlite3 -L/usr/local/lib conftest.c -lsqlite3 -L/usr/local/lib -lsqlite3 -ldl >&5
/usr/bin/ld: /usr/local/lib/libsqlite3.a(sqlite3.o): in function `logFunc':
/repo/sqlite-autoconf-3470100/sqlite3.c:131765:(.text+0x26858): undefined reference to `log2'
/usr/bin/ld: /repo/sqlite-autoconf-3470100/sqlite3.c:131768:(.text+0x268d4): undefined reference to `log'
/usr/bin/ld: /repo/sqlite-autoconf-3470100/sqlite3.c:131762:(.text+0x268ec): undefined reference to `log10'
/usr/bin/ld: /repo/sqlite-autoconf-3470100/sqlite3.c:131750:(.text+0x2691c): undefined reference to `log'
```
CPython is determing SQLite's requirements via `pkg-config` if it can at:
https://github.com/python/cpython/blob/492b224b991cd9027f1bc6d9988d01e94f764992/configure.ac#L4204-L4209
And `-lm` is included in the `pkg-config` for the static sqlite3 build, but it's in the private libs and requires the `--static` flag to be included in the `--libs` output:
```
$ pkg-config --static --libs sqlite3
-L/usr/local/lib -lsqlite3 -lm
$ pkg-config --libs sqlite3
-L/usr/local/lib -lsqlite3
```
However, `PKG_CHECK_MODULES` doesn't pass this flag. There's a `PKG_CHECK_MODULES_STATIC` macro which does, but CPython doesn't seem to use this yet. The alternative is set the flag manually at configure time:
```
PKG_CONFIG="$PKG_CONFIG --static"
```
which changes all the `PKG_CHECK_MODULES` calls to include the `--static` flag. However, there's a missing export for `LIBS` which prevents this from resolving the issue:
```
$ git rev-parse HEAD
f9a5a3a3ef34e63dc197156e9a5f57842859ca04
$ export PKG_CONFIG="pkg-config --static"
$ ./configure 2>&1 | grep sqlite
checking for sqlite3 >= 3.15.2... yes
checking for sqlite3.h... yes
checking for sqlite3_bind_double in -lsqlite3... no
checking for sqlite3_column_decltype in -lsqlite3... no
checking for sqlite3_column_double in -lsqlite3... no
checking for sqlite3_complete in -lsqlite3... no
checking for sqlite3_progress_handler in -lsqlite3... no
checking for sqlite3_result_double in -lsqlite3... no
checking for sqlite3_set_authorizer in -lsqlite3... no
checking for sqlite3_trace_v2 in -lsqlite3... no
checking for sqlite3_trace in -lsqlite3... no
checking for sqlite3_value_double in -lsqlite3... no
checking for sqlite3_load_extension in -lsqlite3... no
checking for sqlite3_serialize in -lsqlite3... no
checking for --enable-loadable-sqlite-extensions... no
checking for stdlib extension module _sqlite3... missing
^C
```
This is "solved" with the patch:
```diff
diff --git a/configure.ac b/configure.ac
index badb19d5589..5ed147f5482 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4221,6 +4221,7 @@ dnl bpo-45774/GH-29507: The CPP check in AC_CHECK_HEADER can fail on FreeBSD,
dnl hence CPPFLAGS instead of CFLAGS.
CPPFLAGS="$CPPFLAGS $LIBSQLITE3_CFLAGS"
LDFLAGS="$LIBSQLITE3_LIBS $LDFLAGS"
+ LIBS="$LIBSQLITE3_LIBS $LIBS"
AC_CHECK_HEADER([sqlite3.h], [
have_sqlite3=yes
```
As demonstrated by:
```
$ export PKG_CONFIG="pkg-config --static"
$ ./configure 2>&1 | grep sqlite
checking for sqlite3 >= 3.15.2... yes
checking for sqlite3.h... yes
checking for sqlite3_bind_double in -lsqlite3... yes
checking for sqlite3_column_decltype in -lsqlite3... yes
checking for sqlite3_column_double in -lsqlite3... yes
checking for sqlite3_complete in -lsqlite3... yes
checking for sqlite3_progress_handler in -lsqlite3... yes
checking for sqlite3_result_double in -lsqlite3... yes
checking for sqlite3_set_authorizer in -lsqlite3... yes
checking for sqlite3_trace_v2 in -lsqlite3... yes
checking for sqlite3_value_double in -lsqlite3... yes
checking for sqlite3_load_extension in -lsqlite3... yes
checking for sqlite3_serialize in -lsqlite3... yes
checking for --enable-loadable-sqlite-extensions... no
```
For context, this was reported in https://github.com/astral-sh/python-build-standalone/issues/449 and some of the findings here are repeated there.
I've posted the patch in https://github.com/python/cpython/pull/128322
### CPython versions tested on:
CPython main branch
### Operating systems tested on:
Linux
<!-- gh-linked-prs -->
### Linked PRs
* gh-128322
* gh-128355
* gh-128356
<!-- /gh-linked-prs -->
| 81376fef76a53fb79893bfa9c9db18d97c228fbe | ef63cca494571f50906baae1d176469a3dcf8838 |
python/cpython | python__cpython-128318 | # Highlight today in colour in calendar's CLI output
# Feature or enhancement
In Python 3.13 we added colour output to the new REPL, tracebacks and doctest, and in 3.14 to unittest and `test.regrtest`, which can also be controlled with the `PYTHON_COLORS`, `NO_COLOR` and `FORCE_COLOR` environment variables:
* https://docs.python.org/3.14/whatsnew/3.14.html#unittest
* https://docs.python.org/3.14/using/cmdline.html#using-on-controlling-color
On macOS, the `cal` utility does something similar, but highlights today.
The calendar module has a CLI to print out a calendar to the terminal, but with no highlighting. Let's add it.
<!-- gh-linked-prs -->
### Linked PRs
* gh-128318
* gh-128353
* gh-128357
* gh-128358
* gh-129625
<!-- /gh-linked-prs -->
| f21af186bf21c1c554209ac67d78d3cf99f7d7c0 | fa985bee6189aabac1c329f2de32aa9a4e88e550 |
python/cpython | python__cpython-128768 | # asyncio eager tasks' names are set too late
# Bug report
### Bug description:
consider:
```python
import asyncio
async def main():
names = []
async with asyncio.TaskGroup() as tg:
async def append_name():
names.append(asyncio.current_task().get_name())
tg.create_task(append_name(), name="example name")
print(names)
def loop_factory():
loop = asyncio.EventLoop()
loop.set_task_factory(asyncio.eager_task_factory)
return loop
asyncio.run(main())
asyncio.run(main(), loop_factory=loop_factory)
```
this outputs:
```
['example name']
['Task-5']
```
but it should output:
```
['example name']
['example name']
```
### CPython versions tested on:
3.13
### Operating systems tested on:
Linux
<!-- gh-linked-prs -->
### Linked PRs
* gh-128768
* gh-130084
* gh-133808
* gh-133948
<!-- /gh-linked-prs -->
| 38a99568763604ccec5d5027f0658100ad76876f | 6c914bf85cc3a07e22e4618d0b5607c158e3cf66 |
python/cpython | python__cpython-128306 | # add eager_start parameter to loop.create_task
# Feature or enhancement
### Proposal:
We want to be able to opt in and opt out of eager tasks anywhere in the asyncio call stack, eg in some asyncio library, and not rely on some other asyncio framework setting the default.
### Has this already been discussed elsewhere?
I have already discussed this feature proposal on Discourse
### Links to previous discussion of this feature:
https://discuss.python.org/t/make-asyncio-eager-task-factory-default/75164/10
<!-- gh-linked-prs -->
### Linked PRs
* gh-128306
* gh-134202
* gh-134304
* gh-134319
* gh-134335
* gh-134553
<!-- /gh-linked-prs -->
| 08d7687094c6acb8c2ea1925a292a94ce1246c82 | c4cc5d58aee6a3be55a95efee6ec25d5774f7b5f |
python/cpython | python__cpython-128284 | # Bug in `xml.dom.xmlbuilder.DOMBuilder.parse()`
# Bug report
### Bug description:
I believe there is a bug in `xml.dom.xmlbuilder.parse()`.
`xml.dom.xmlbuilder` is not documented by python, we don't have any tests for
them, and I can't find evidence on github of these classes being in use. That's
okay, because in this case the classes are implementations of a w3c standard
which was at the time a draft, and which is heavily documented.
First, some digital archeology. The first commit of `Lib/xml/dom/xmlbuilder.py`
is from 2003-01-25, with the message ["Import from PyXML 1.10."](https://github.com/python/cpython/commit/9ea67889dc8fecbd2e57e2c3a5a65f1f69b7c1dc)
The issue already exists in that commit.
The earlier remains of the [PyXML project are on sourceforce](https://sourceforge.net/projects/pyxml/)
in a cvs repo. Looking at the log there, I find that the first commit for xmlbuilder.py
is from 2002-02-21 with this message:
```
Preliminary implementation of the new direct-from-Expat minidom builder.
xmlbuilder contains the basic interface code for the DOM Level 3 "LS-Load"
feature; it can certainly be generalized a little more, but this seems a
reasonable start. expatbuilder contains the code that xmlbuilder uses to
glue minidom and Expat together. There's nothing general there! ;-)
```
The bug is already present in this version as well.
The file sees a few more commits, four of which reference updating to track
the new version of the draft standard, the latest of which is from 2002-08-02.
None of the commits since being imported into CPython reference the standard.
This means that in looking at the code, our best reference is the 2002-07-25 draft
version: https://www.w3.org/TR/2002/WD-DOM-Level-3-LS-20020725/.
What's called DOMBuilder in that draft and in our implementation, would in later
drafts be renamed to DOMParser and then LSParser, but the basic class remains
in the standard.
Going to the standard now:
The primary interface in the standard is [DOMImplementationLS](https://www.w3.org/TR/2002/WD-DOM-Level-3-LS-20020725/DOM3-LS.html#load-save-LS-DOMImplementation), a mixin for the
`DOMImplementation` interface. The relevant methods for us are:
```
DOMBuilder createDOMBuilder(in unsigned short mode, in DOMString schemaType)raises(DOMException);
DOMInputSource createDOMInputSource();
```
Described as:
> createDOMBuilder
> Create a new DOMBuilder. The newly constructed parser may then be configured by means of its setFeature method, and used to parse documents by means of its parse method.
>
> createDOMInputSource
> Create a new "empty" DOMInputSource.
The documentation for [DOMInputSource](https://www.w3.org/TR/2002/WD-DOM-Level-3-LS-20020725/DOM3-LS.html#load-save-LS-DOMInputSource) says:
> This interface represents a single input source for an XML entity.
>
> This interface allows an application to encapsulate information about an input source in a single object, which may include a public identifier, a system identifier, a byte stream (possibly with a specified encoding), and/or a character stream.
>
> The DOMBuilder will use the DOMInputSource object to determine how to read XML input. If there is a character stream available, the parser will read that stream directly; if not, the parser will use a byte stream, if available; if neither a character stream nor a byte stream is available, the parser will attempt to open a URI connection to the resource identified by the system identifier.
>
> A DOMInputSource object belongs to the application: the parser shall never modify it in any way (it may modify a copy if necessary).
Finally, documentation for the [DOMBuilder](https://www.w3.org/TR/2002/WD-DOM-Level-3-LS-20020725/DOM3-LS.html#load-save-LS-DOMBuilder) interface:
> A interface to an object that is able to build a DOM tree from various input sources.
>
> DOMBuilder provides an API for parsing XML documents and building the corresponding DOM document tree. A DOMBuilder instance is obtained from the DOMImplementationLS interface by invoking its createDOMBuildermethod.
>
> DOMBuilders have a number of named features that can be queried or set. The name of DOMBuilder features must be valid XML names. Implementation specific features (extensions) should choose a implementation specific prefix to avoid name collisions.
>
> Even if all features must be recognized by all implementations, being able to set a state (true or false) is not always required. The following list of recognized features indicates the definitions of each feature state, if setting the state to true or false must be supported or is optional and, which state is the default one:
And its [parse method](https://www.w3.org/TR/2002/WD-DOM-Level-3-LS-20020725/DOM3-LS.html#load-save-LS-DOMBuilder-parse):
> parse
> Parse an XML document from a resource identified by a DOMInputSource.
> Parameters:
> is of type DOMInputSource
> The DOMInputSource from which the source document is to be read.
> Return Value:
> Document
So an application using this interface is intended to:
1. Get a hold of a DOMImplementation object. This is documented in python,
and accomplished via `xml.dom.getDOMImplementation()`.
2. Next, call `createDOMBuilder()` and `createDOMInputSource()` to get
those two respective objects.
3. Configure the options for the DOMBuilder using the methods `canSetFeature`,
`getFeature`, and `setFeature`.
4. Configure the values of the DOMInputSource as needed. As noted above,
DOMInput source will first prefer its `characterStream` attribute. If that
attribute is null, it will prefer the `byteStream` attribute. If both of
these are null, then the URI from its `systemId` attribute is used.
5. Finally, pass the `DOMInputSource` to `DOMBuilder.parse()` to receive a
`Document` object.
In Python, this looks like this:
```python
from xml.dom import getDOMImplementation
imp = getDOMImplementation()
builder = imp.createDOMBuilder(imp.MODE_SYNCHRONOUS, None)
# configure the builder, if needed
source = imp.createDOMInputSource()
# set one or more attributes on the "empty" source object
source.systemId = "http://www.w3.org/2000/svg"
document = builder.parse(source)
# Do whatever with the document
```
For a use case like this, with no additional customization of the source object,
the spec also has a `DOMBuilder.parseURI()` method which accepts a URI directly and
constructs the necessary DOMInputSource internally.
With all that as background, here's our current implementation of `DOMBuilder.parse()`:
https://github.com/python/cpython/blob/aeb9b65aa26444529e4adc7d6e5b0d3dd9889ec2/Lib/xml/dom/xmlbuilder.py#L187-L195
The problem is on line 192. `systemId` is not an attribute that exists on `options` here.
It's an instance of the `xml.dom.xmlbuilder.Options` class and represents the
features that can be configured on `DOMBuilder`. Those options are documented in
the specification, and are set using `DOMBuilder.setFeature()`. Our implementation
has a dictionary `DOMBuilder._settings` which contains the options from the
spec that we support, which starts here:
https://github.com/python/cpython/blob/aeb9b65aa26444529e4adc7d6e5b0d3dd9889ec2/Lib/xml/dom/xmlbuilder.py#L101-L103
The important thing is that `systemId` is not an configuration setting in either
the specificiation or in our implementation, so as written we can never reach
the if branch in that method.
I believe that the relevant lines should be:
```python
fp = input.byteStream
if fp is None and input.systemId:
import urllib.request
fp = urllib.request.urlopen(input.systemId)
```
(The implementation is also non-conformant because it fails to consider
`input.characterStream` before using `input.byteStream`, but that's a different
probem. I'm not looking to add a missing feature right now, just fix the already-existing-but-broken one.)
### CPython versions tested on:
3.13
### Operating systems tested on:
_No response_
<!-- gh-linked-prs -->
### Linked PRs
* gh-128284
* gh-128582
* gh-128583
<!-- /gh-linked-prs -->
| 6ea04da27036eaa69d65150148bb8c537d9beacf | 145276a072ae058bac42ee43a4235cd4eda2726b |
python/cpython | python__cpython-128280 | # Build failure on NetBSD: Incorrect number of arguments to 'pthread_setname_np' in _threadmodule.c
# Bug report
### Bug description:
```sh
./configure --with-pydebug && make -j3
```
Output:
```sh
gcc -pthread -fno-strict-overflow -Wsign-compare -g -Og -Wall -O2 -std=c11 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration -fvisibility=hidden -I./Include/internal -I./Include/internal/mimalloc -I. -I./Include -DPy_BUILD_CORE_BUILTIN -c ./Modules/_threadmodule.c -o Modules/_threadmodule.o
./Modules/_threadmodule.c: In function '_thread_set_name_impl':
./Modules/_threadmodule.c:2443:14: error: too few arguments to function 'pthread_setname_np'
2443 | int rc = pthread_setname_np(thread, name);
| ^~~~~~~~~~~~~~~~~~
In file included from ./Include/cpython/pythread.h:17,
from ./Include/pythread.h:124,
from ./Include/Python.h:120,
from ./Modules/_threadmodule.c:4:
/usr/include/pthread.h:160:5: note: declared here
160 | int pthread_setname_np(pthread_t, const char *, void *);
| ^~~~~~~~~~~~~~~~~~
*** [Modules/_threadmodule.o] Error code 1
make: stopped in /home/blue/cpython
1 error
make: stopped in /home/blue/cpython
```
OS: `NetBSD 10.0`
### CPython versions tested on:
CPython main branch
### Operating systems tested on:
Other
<!-- gh-linked-prs -->
### Linked PRs
* gh-128280
<!-- /gh-linked-prs -->
| 492b224b991cd9027f1bc6d9988d01e94f764992 | 2cf396c368a188e9142843e566ce6d8e6eb08999 |
python/cpython | python__cpython-128286 | # Make `socket` module thread safe
While working on https://github.com/python/cpython/issues/128002, I am seeing many tsan warning because of socket modules.
This issue tracks work for making it thread safe.
<!-- gh-linked-prs -->
### Linked PRs
* gh-128286
* gh-128304
* gh-128305
<!-- /gh-linked-prs -->
| e389d6c650ddacb55b08b657f1e4e9b1330f3455 | b2ac70a62ad1be8e037ce45ccf5f1b753ea5e64b |
python/cpython | python__cpython-128264 | # Remove un-necessary socket requirements in pdb async tests
### Proposal:
the pdb async tests should run coroutines using coro.send(None) because they don't need an async framework to run. This would remove asyncio from the tests and support running on emscripten/wasi
### Has this already been discussed elsewhere?
No response given
### Links to previous discussion of this feature:
_No response_
<!-- gh-linked-prs -->
### Linked PRs
* gh-128264
<!-- /gh-linked-prs -->
| aab51c3414bc815c4c31e8ef2a9003f4a546faa9 | aeb9b65aa26444529e4adc7d6e5b0d3dd9889ec2 |
python/cpython | python__cpython-128263 | # Classes with __slots__ ought to be specialized when constructing instances
# Feature or enhancement
### Proposal:
Right now simple classes have the `CALL_ALLOC_AND_ENTER_INIT` specialization when calling their constructor. This however, blocks classes with `__slots__`. I propose relaxing the requirement and allowing `__slots__` classes to benefit from this specialization as well.
### Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
### Links to previous discussion of this feature:
_No response_
<!-- gh-linked-prs -->
### Linked PRs
* gh-128263
<!-- /gh-linked-prs -->
| 7ef49074123511003c8b7f7f3ba2a4e05285e8dc | dafe7a44630aa32bb411cceb45c7b7df725e3fe3 |
python/cpython | python__cpython-95888 | # Remove un-necessary socket requirements in `contextlib` async tests
### Proposal:
the contextlib async tests should run coroutines using coro.send(None) because they don't need an async framework to run. This would remove asyncio from the tests and support running on emscripten/wasi
<!-- gh-linked-prs -->
### Linked PRs
* gh-95888
<!-- /gh-linked-prs -->
| 81636d3bbd7f126692326bf957707e8a88c91739 | 76f1785657fde0ebee082b0df54da8f7c911c369 |
python/cpython | python__cpython-129488 | # In the new REPL, multiline input execution should fail fast
# Bug report
### Bug description:
To reproduce, simply paste this to the new REPL:
```py
raise Exception
print("But I'm powerful enough to bypass it")
```
Make sure what you are seeing is:
```pycon
>>> raise Exception
... print("But I'm powerful enough to bypass it")
```
Once hit enter, the new REPL executes both statements `raise Exception` and `print("But I'm powerful enough to bypass it")` from the same, multi-line input block, despite the failure of the first one:
```pycon
>>> raise Exception
... print("But I'm powerful enough to bypass it")
...
Traceback (most recent call last):
File "<python-input-0>", line 1, in <module>
raise Exception
Exception
But I'm powerful enough to bypass it
```
This can get especially confusing if a statement defines a variable. Like
```pycon
>>> n = 1 / 0
... print(k-n)
```
causing
```py
Traceback (most recent call last):
File "<python-input-0>", line 1, in <module>
n = 1 / 0
~~^~~
ZeroDivisionError: division by zero
Traceback (most recent call last):
File "<python-input-0>", line 2, in <module>
print(k-n)
^
NameError: name 'k' is not defined
```
I'd expect different behavior: since those two statements belong to the same input, it is more logical for them to behave like a [suite](https://docs.python.org/3.14/reference/compound_stmts.html#grammar-token-python-grammar-suite), where the consecutive execution of a statement depends on a successful completion of the one before it.
### CPython versions tested on:
3.13, 3.14
### Operating systems tested on:
Linux, macOS, Windows
<!-- gh-linked-prs -->
### Linked PRs
* gh-129488
* gh-130513
* gh-131834
* gh-131835
<!-- /gh-linked-prs -->
| 7ed3dc6392613832f66c63507385b1da109cbf21 | 9f25c1f012c8d432a93bf2dcad5f19a64dc00d3c |
python/cpython | python__cpython-128228 | # `Doc/requirements-oldest-sphinx.txt` needs to be regenerated
# Bug report
### Bug description:
Due to https://github.com/python/cpython/security/dependabot/12 and https://github.com/python/cpython/security/dependabot/11, the dependency file must be regenerated (it's fine if those links go nowhere, only triagers and core devs see it). CPython Doc is not vulnerable to these two CVE's, but I guess it's ok to bump Jinja's minor version to "silence" these dependabot alerts.
New contributors are welcome!
You need to:
* clone CPython repository and `cd` to the `Doc` directory
* create && activate venv
* `pip install "Sphinx~=7.2.6"`
* Output of `pip freeze` should be pasted into `Doc/requirements-oldest-sphinx` (from line 15 to the end)
Do not write the `NEWS` entry, triage/core dev will aply `skip-news` label.
### CPython versions tested on:
CPython main branch
### Operating systems tested on:
_No response_
<!-- gh-linked-prs -->
### Linked PRs
* gh-128228
* gh-128229
* gh-128230
<!-- /gh-linked-prs -->
| 7985d460c731b2c48419a33fc1820f9512bb6f21 | 7ed6c5c6961d0849f163d4d449fb36bae312b6bc |
python/cpython | python__cpython-128367 | # Race between ` PyUnicode_SET_UTF8` and `_PyUnicode_CheckConsistency`
# Bug report
### Bug description:
Reproducible by running :
1. `env CC=clang CXX=clang++ ./configure --disable-gil --with-thread-sanitizer --with-pydebug && make -j`
2. `env TSAN_OPTIONS=suppressions=${PWD}/Tools/tsan/suppressions_free_threading.txt ./python -m test --tsan test_importlib --match test_multiprocessing_pool_circular_import -F`
```
==================
WARNING: ThreadSanitizer: data race (pid=3454844)
Atomic write of size 8 at 0x7fd7be2285d0 by thread T1:
#0 _Py_atomic_store_ptr_release /home/mpage/local/cpython/./Include/cpython/pyatomic_gcc.h:565:3 (python+0x74072e) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#1 PyUnicode_SET_UTF8 /home/mpage/local/cpython/Objects/unicodeobject.c:133:5 (python+0x74072e)
#2 unicode_fill_utf8 /home/mpage/local/cpython/Objects/unicodeobject.c:5916:5 (python+0x74072e)
#3 unicode_ensure_utf8 /home/mpage/local/cpython/Objects/unicodeobject.c:4228:19 (python+0x74072e)
#4 PyUnicode_AsUTF8AndSize /home/mpage/local/cpython/Objects/unicodeobject.c:4246:9 (python+0x74072e)
#5 write_unicode_binary /home/mpage/local/cpython/./Modules/_pickle.c:2677:12 (_pickle.cpython-314td-x86_64-linux-gnu.so+0xa219) (BuildId: e2f310e804661a33ae374de41f9979004e07a1e7)
#6 save_unicode /home/mpage/local/cpython/./Modules/_pickle.c:2729:13 (_pickle.cpython-314td-x86_64-linux-gnu.so+0xa219)
#7 save /home/mpage/local/cpython/./Modules/_pickle.c:4392:16 (_pickle.cpython-314td-x86_64-linux-gnu.so+0x940a) (BuildId: e2f310e804661a33ae374de41f9979004e07a1e7)
#8 batch_dict_exact /home/mpage/local/cpython/./Modules/_pickle.c:3346:17 (_pickle.cpython-314td-x86_64-linux-gnu.so+0xb682) (BuildId: e2f310e804661a33ae374de41f9979004e07a1e7)
#9 save_dict /home/mpage/local/cpython/./Modules/_pickle.c:3408:22 (_pickle.cpython-314td-x86_64-linux-gnu.so+0xb682)
#10 save /home/mpage/local/cpython/./Modules/_pickle.c:4402:18 (_pickle.cpython-314td-x86_64-linux-gnu.so+0x9624) (BuildId: e2f310e804661a33ae374de41f9979004e07a1e7)
#11 dump /home/mpage/local/cpython/./Modules/_pickle.c:4602:9 (_pickle.cpython-314td-x86_64-linux-gnu.so+0x8068) (BuildId: e2f310e804661a33ae374de41f9979004e07a1e7)
#12 _pickle_Pickler_dump_impl /home/mpage/local/cpython/./Modules/_pickle.c:4676:9 (_pickle.cpython-314td-x86_64-linux-gnu.so+0x21a74) (BuildId: e2f310e804661a33ae374de41f9979004e07a1e7)
#13 _pickle_Pickler_dump /home/mpage/local/cpython/./Modules/clinic/_pickle.c.h:73:20 (_pickle.cpython-314td-x86_64-linux-gnu.so+0x21a74)
#14 cfunction_vectorcall_FASTCALL_KEYWORDS_METHOD /home/mpage/local/cpython/Objects/methodobject.c:468:24 (python+0x6924c6) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#15 _PyObject_VectorcallTstate /home/mpage/local/cpython/./Include/internal/pycore_call.h:167:11 (python+0x5d48f0) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#16 PyObject_Vectorcall /home/mpage/local/cpython/Objects/call.c:327:12 (python+0x5d62b0) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#17 _PyEval_EvalFrameDefault /home/mpage/local/cpython/Python/generated_cases.c.h:960:35 (python+0x8291e2) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#18 _PyEval_EvalFrame /home/mpage/local/cpython/./Include/internal/pycore_ceval.h:116:16 (python+0x8219b6) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#19 _PyEval_Vector /home/mpage/local/cpython/Python/ceval.c:1911:12 (python+0x8219b6)
#20 _PyFunction_Vectorcall /home/mpage/local/cpython/Objects/call.c (python+0x5d6799) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#21 _PyObject_VectorcallDictTstate /home/mpage/local/cpython/Objects/call.c:135:15 (python+0x5d4b88) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#22 _PyObject_Call_Prepend /home/mpage/local/cpython/Objects/call.c:504:24 (python+0x5d6bd2) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#23 slot_tp_init /home/mpage/local/cpython/Objects/typeobject.c:10233:15 (python+0x71d085) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#24 type_call /home/mpage/local/cpython/Objects/typeobject.c:2185:19 (python+0x6fd01c) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#25 _PyObject_MakeTpCall /home/mpage/local/cpython/Objects/call.c:242:18 (python+0x5d4fd1) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#26 _PyObject_VectorcallTstate /home/mpage/local/cpython/./Include/internal/pycore_call.h:165:16 (python+0x5d4918) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#27 PyObject_Vectorcall /home/mpage/local/cpython/Objects/call.c:327:12 (python+0x5d62b0) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#28 _PyEval_EvalFrameDefault /home/mpage/local/cpython/Python/generated_cases.c.h:960:35 (python+0x8291e2) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#29 _PyEval_EvalFrame /home/mpage/local/cpython/./Include/internal/pycore_ceval.h:116:16 (python+0x8219b6) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#30 _PyEval_Vector /home/mpage/local/cpython/Python/ceval.c:1911:12 (python+0x8219b6)
#31 _PyFunction_Vectorcall /home/mpage/local/cpython/Objects/call.c (python+0x5d6799) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#32 _PyObject_VectorcallDictTstate /home/mpage/local/cpython/Objects/call.c:146:15 (python+0x5d4b64) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#33 _PyObject_Call_Prepend /home/mpage/local/cpython/Objects/call.c:504:24 (python+0x5d6bd2) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#34 slot_tp_init /home/mpage/local/cpython/Objects/typeobject.c:10233:15 (python+0x71d085) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#35 type_call /home/mpage/local/cpython/Objects/typeobject.c:2185:19 (python+0x6fd01c) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#36 _PyObject_MakeTpCall /home/mpage/local/cpython/Objects/call.c:242:18 (python+0x5d4fd1) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#37 _PyObject_VectorcallTstate /home/mpage/local/cpython/./Include/internal/pycore_call.h:165:16 (python+0x5d4918) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#38 PyObject_Vectorcall /home/mpage/local/cpython/Objects/call.c:327:12 (python+0x5d62b0) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#39 _PyEval_EvalFrameDefault /home/mpage/local/cpython/Python/generated_cases.c.h:1993:35 (python+0x8310ad) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#40 _PyEval_EvalFrame /home/mpage/local/cpython/./Include/internal/pycore_ceval.h:116:16 (python+0x8219b6) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#41 _PyEval_Vector /home/mpage/local/cpython/Python/ceval.c:1911:12 (python+0x8219b6)
#42 _PyFunction_Vectorcall /home/mpage/local/cpython/Objects/call.c (python+0x5d6799) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#43 _PyObject_VectorcallTstate /home/mpage/local/cpython/./Include/internal/pycore_call.h:167:11 (python+0x5dc820) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#44 method_vectorcall /home/mpage/local/cpython/Objects/classobject.c:71:20 (python+0x5dae9d) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#45 _PyVectorcall_Call /home/mpage/local/cpython/Objects/call.c:273:16 (python+0x5d619d) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#46 _PyObject_Call /home/mpage/local/cpython/Objects/call.c:348:16 (python+0x5d6413) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#47 PyObject_Call /home/mpage/local/cpython/Objects/call.c:373:12 (python+0x5d65c7) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#48 thread_run /home/mpage/local/cpython/./Modules/_threadmodule.c:346:21 (python+0xa28898) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#49 pythread_wrapper /home/mpage/local/cpython/Python/thread_pthread.h:242:5 (python+0x96a4bb) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
Previous read of size 8 at 0x7fd7be2285d0 by thread T18:
#0 _PyUnicode_CheckConsistency /home/mpage/local/cpython/Objects/unicodeobject.c:691:13 (python+0x72f906) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#1 PyUnicode_UTF8 /home/mpage/local/cpython/Objects/unicodeobject.c:122:5 (python+0x73018f) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#2 unicode_ensure_utf8 /home/mpage/local/cpython/Objects/unicodeobject.c:4225:9 (python+0x74036b) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#3 PyUnicode_AsUTF8AndSize /home/mpage/local/cpython/Objects/unicodeobject.c:4246:9 (python+0x74036b)
#4 write_unicode_binary /home/mpage/local/cpython/./Modules/_pickle.c:2677:12 (_pickle.cpython-314td-x86_64-linux-gnu.so+0xa219) (BuildId: e2f310e804661a33ae374de41f9979004e07a1e7)
#5 save_unicode /home/mpage/local/cpython/./Modules/_pickle.c:2729:13 (_pickle.cpython-314td-x86_64-linux-gnu.so+0xa219)
#6 save /home/mpage/local/cpython/./Modules/_pickle.c:4392:16 (_pickle.cpython-314td-x86_64-linux-gnu.so+0x940a) (BuildId: e2f310e804661a33ae374de41f9979004e07a1e7)
#7 batch_dict_exact /home/mpage/local/cpython/./Modules/_pickle.c:3346:17 (_pickle.cpython-314td-x86_64-linux-gnu.so+0xb682) (BuildId: e2f310e804661a33ae374de41f9979004e07a1e7)
#8 save_dict /home/mpage/local/cpython/./Modules/_pickle.c:3408:22 (_pickle.cpython-314td-x86_64-linux-gnu.so+0xb682)
#9 save /home/mpage/local/cpython/./Modules/_pickle.c:4402:18 (_pickle.cpython-314td-x86_64-linux-gnu.so+0x9624) (BuildId: e2f310e804661a33ae374de41f9979004e07a1e7)
#10 dump /home/mpage/local/cpython/./Modules/_pickle.c:4602:9 (_pickle.cpython-314td-x86_64-linux-gnu.so+0x8068) (BuildId: e2f310e804661a33ae374de41f9979004e07a1e7)
#11 _pickle_Pickler_dump_impl /home/mpage/local/cpython/./Modules/_pickle.c:4676:9 (_pickle.cpython-314td-x86_64-linux-gnu.so+0x21a74) (BuildId: e2f310e804661a33ae374de41f9979004e07a1e7)
#12 _pickle_Pickler_dump /home/mpage/local/cpython/./Modules/clinic/_pickle.c.h:73:20 (_pickle.cpython-314td-x86_64-linux-gnu.so+0x21a74)
#13 cfunction_vectorcall_FASTCALL_KEYWORDS_METHOD /home/mpage/local/cpython/Objects/methodobject.c:468:24 (python+0x6924c6) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#14 _PyObject_VectorcallTstate /home/mpage/local/cpython/./Include/internal/pycore_call.h:167:11 (python+0x5d48f0) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#15 PyObject_Vectorcall /home/mpage/local/cpython/Objects/call.c:327:12 (python+0x5d62b0) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#16 _PyEval_EvalFrameDefault /home/mpage/local/cpython/Python/generated_cases.c.h:960:35 (python+0x8291e2) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#17 _PyEval_EvalFrame /home/mpage/local/cpython/./Include/internal/pycore_ceval.h:116:16 (python+0x8219b6) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#18 _PyEval_Vector /home/mpage/local/cpython/Python/ceval.c:1911:12 (python+0x8219b6)
#19 _PyFunction_Vectorcall /home/mpage/local/cpython/Objects/call.c (python+0x5d6799) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#20 _PyObject_VectorcallDictTstate /home/mpage/local/cpython/Objects/call.c:135:15 (python+0x5d4b88) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#21 _PyObject_Call_Prepend /home/mpage/local/cpython/Objects/call.c:504:24 (python+0x5d6bd2) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#22 slot_tp_init /home/mpage/local/cpython/Objects/typeobject.c:10233:15 (python+0x71d085) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#23 type_call /home/mpage/local/cpython/Objects/typeobject.c:2185:19 (python+0x6fd01c) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#24 _PyObject_MakeTpCall /home/mpage/local/cpython/Objects/call.c:242:18 (python+0x5d4fd1) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#25 _PyObject_VectorcallTstate /home/mpage/local/cpython/./Include/internal/pycore_call.h:165:16 (python+0x5d4918) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#26 PyObject_Vectorcall /home/mpage/local/cpython/Objects/call.c:327:12 (python+0x5d62b0) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#27 _PyEval_EvalFrameDefault /home/mpage/local/cpython/Python/generated_cases.c.h:960:35 (python+0x8291e2) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#28 _PyEval_EvalFrame /home/mpage/local/cpython/./Include/internal/pycore_ceval.h:116:16 (python+0x8219b6) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#29 _PyEval_Vector /home/mpage/local/cpython/Python/ceval.c:1911:12 (python+0x8219b6)
#30 _PyFunction_Vectorcall /home/mpage/local/cpython/Objects/call.c (python+0x5d6799) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#31 _PyObject_VectorcallDictTstate /home/mpage/local/cpython/Objects/call.c:146:15 (python+0x5d4b64) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#32 _PyObject_Call_Prepend /home/mpage/local/cpython/Objects/call.c:504:24 (python+0x5d6bd2) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#33 slot_tp_init /home/mpage/local/cpython/Objects/typeobject.c:10233:15 (python+0x71d085) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#34 type_call /home/mpage/local/cpython/Objects/typeobject.c:2185:19 (python+0x6fd01c) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#35 _PyObject_MakeTpCall /home/mpage/local/cpython/Objects/call.c:242:18 (python+0x5d4fd1) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#36 _PyObject_VectorcallTstate /home/mpage/local/cpython/./Include/internal/pycore_call.h:165:16 (python+0x5d4918) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#37 PyObject_Vectorcall /home/mpage/local/cpython/Objects/call.c:327:12 (python+0x5d62b0) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#38 _PyEval_EvalFrameDefault /home/mpage/local/cpython/Python/generated_cases.c.h:1993:35 (python+0x8310ad) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#39 _PyEval_EvalFrame /home/mpage/local/cpython/./Include/internal/pycore_ceval.h:116:16 (python+0x8219b6) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#40 _PyEval_Vector /home/mpage/local/cpython/Python/ceval.c:1911:12 (python+0x8219b6)
#41 _PyFunction_Vectorcall /home/mpage/local/cpython/Objects/call.c (python+0x5d6799) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#42 _PyObject_VectorcallTstate /home/mpage/local/cpython/./Include/internal/pycore_call.h:167:11 (python+0x5dc820) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#43 method_vectorcall /home/mpage/local/cpython/Objects/classobject.c:71:20 (python+0x5dae9d) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#44 _PyVectorcall_Call /home/mpage/local/cpython/Objects/call.c:273:16 (python+0x5d619d) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#45 _PyObject_Call /home/mpage/local/cpython/Objects/call.c:348:16 (python+0x5d6413) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#46 PyObject_Call /home/mpage/local/cpython/Objects/call.c:373:12 (python+0x5d65c7) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#47 thread_run /home/mpage/local/cpython/./Modules/_threadmodule.c:346:21 (python+0xa28898) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#48 pythread_wrapper /home/mpage/local/cpython/Python/thread_pthread.h:242:5 (python+0x96a4bb) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
Thread T1 'Thread-1 (t)' (tid=3454868, running) created by main thread at:
#0 pthread_create <null> (python+0x47a2df) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#1 do_start_joinable_thread /home/mpage/local/cpython/Python/thread_pthread.h:289:14 (python+0x96920b) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#2 PyThread_start_joinable_thread /home/mpage/local/cpython/Python/thread_pthread.h:313:9 (python+0x96904a) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#3 ThreadHandle_start /home/mpage/local/cpython/./Modules/_threadmodule.c:431:9 (python+0xa283d0) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#4 do_start_new_thread /home/mpage/local/cpython/./Modules/_threadmodule.c:1794:9 (python+0xa283d0)
#5 thread_PyThread_start_joinable_thread /home/mpage/local/cpython/./Modules/_threadmodule.c:1917:14 (python+0xa26a27) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#6 cfunction_call /home/mpage/local/cpython/Objects/methodobject.c:551:18 (python+0x693086) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#7 _PyObject_MakeTpCall /home/mpage/local/cpython/Objects/call.c:242:18 (python+0x5d4fd1) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#8 _PyObject_VectorcallTstate /home/mpage/local/cpython/./Include/internal/pycore_call.h:165:16 (python+0x5d4918) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#9 PyObject_Vectorcall /home/mpage/local/cpython/Objects/call.c:327:12 (python+0x5d62b0) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#10 _PyEval_EvalFrameDefault /home/mpage/local/cpython/Python/generated_cases.c.h:1993:35 (python+0x8310ad) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#11 _PyEval_EvalFrame /home/mpage/local/cpython/./Include/internal/pycore_ceval.h:116:16 (python+0x8219b6) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#12 _PyEval_Vector /home/mpage/local/cpython/Python/ceval.c:1911:12 (python+0x8219b6)
#13 PyEval_EvalCode /home/mpage/local/cpython/Python/ceval.c:658:21 (python+0x8212a6) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#14 run_eval_code_obj /home/mpage/local/cpython/Python/pythonrun.c:1338:9 (python+0x94517b) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#15 run_mod /home/mpage/local/cpython/Python/pythonrun.c:1423:19 (python+0x944cfe) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#16 pyrun_file /home/mpage/local/cpython/Python/pythonrun.c:1256:15 (python+0x93f898) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#17 _PyRun_SimpleFileObject /home/mpage/local/cpython/Python/pythonrun.c:491:13 (python+0x93f898)
#18 _PyRun_AnyFileObject /home/mpage/local/cpython/Python/pythonrun.c:78:15 (python+0x93f059) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#19 pymain_run_file_obj /home/mpage/local/cpython/Modules/main.c:410:15 (python+0x9865f6) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#20 pymain_run_file /home/mpage/local/cpython/Modules/main.c:429:15 (python+0x9865f6)
#21 pymain_run_python /home/mpage/local/cpython/Modules/main.c:697:21 (python+0x985569) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#22 Py_RunMain /home/mpage/local/cpython/Modules/main.c:776:5 (python+0x985569)
#23 pymain_main /home/mpage/local/cpython/Modules/main.c:806:12 (python+0x985a99) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#24 Py_BytesMain /home/mpage/local/cpython/Modules/main.c:830:12 (python+0x985b19) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#25 main /home/mpage/local/cpython/./Programs/python.c:15:12 (python+0x4f8250) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
Thread T18 'Thread-18 (t)' (tid=3454886, running) created by main thread at:
#0 pthread_create <null> (python+0x47a2df) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#1 do_start_joinable_thread /home/mpage/local/cpython/Python/thread_pthread.h:289:14 (python+0x96920b) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#2 PyThread_start_joinable_thread /home/mpage/local/cpython/Python/thread_pthread.h:313:9 (python+0x96904a) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#3 ThreadHandle_start /home/mpage/local/cpython/./Modules/_threadmodule.c:431:9 (python+0xa283d0) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#4 do_start_new_thread /home/mpage/local/cpython/./Modules/_threadmodule.c:1794:9 (python+0xa283d0)
#5 thread_PyThread_start_joinable_thread /home/mpage/local/cpython/./Modules/_threadmodule.c:1917:14 (python+0xa26a27) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#6 cfunction_call /home/mpage/local/cpython/Objects/methodobject.c:551:18 (python+0x693086) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#7 _PyObject_MakeTpCall /home/mpage/local/cpython/Objects/call.c:242:18 (python+0x5d4fd1) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#8 _PyObject_VectorcallTstate /home/mpage/local/cpython/./Include/internal/pycore_call.h:165:16 (python+0x5d4918) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#9 PyObject_Vectorcall /home/mpage/local/cpython/Objects/call.c:327:12 (python+0x5d62b0) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#10 _PyEval_EvalFrameDefault /home/mpage/local/cpython/Python/generated_cases.c.h:2195:35 (python+0x832b51) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#11 _PyEval_EvalFrame /home/mpage/local/cpython/./Include/internal/pycore_ceval.h:116:16 (python+0x8219b6) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#12 _PyEval_Vector /home/mpage/local/cpython/Python/ceval.c:1911:12 (python+0x8219b6)
#13 PyEval_EvalCode /home/mpage/local/cpython/Python/ceval.c:658:21 (python+0x8212a6) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#14 run_eval_code_obj /home/mpage/local/cpython/Python/pythonrun.c:1338:9 (python+0x94517b) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#15 run_mod /home/mpage/local/cpython/Python/pythonrun.c:1423:19 (python+0x944cfe) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#16 pyrun_file /home/mpage/local/cpython/Python/pythonrun.c:1256:15 (python+0x93f898) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#17 _PyRun_SimpleFileObject /home/mpage/local/cpython/Python/pythonrun.c:491:13 (python+0x93f898)
#18 _PyRun_AnyFileObject /home/mpage/local/cpython/Python/pythonrun.c:78:15 (python+0x93f059) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#19 pymain_run_file_obj /home/mpage/local/cpython/Modules/main.c:410:15 (python+0x9865f6) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#20 pymain_run_file /home/mpage/local/cpython/Modules/main.c:429:15 (python+0x9865f6)
#21 pymain_run_python /home/mpage/local/cpython/Modules/main.c:697:21 (python+0x985569) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#22 Py_RunMain /home/mpage/local/cpython/Modules/main.c:776:5 (python+0x985569)
#23 pymain_main /home/mpage/local/cpython/Modules/main.c:806:12 (python+0x985a99) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#24 Py_BytesMain /home/mpage/local/cpython/Modules/main.c:830:12 (python+0x985b19) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
#25 main /home/mpage/local/cpython/./Programs/python.c:15:12 (python+0x4f8250) (BuildId: 09e963041ced7dc45ee41bb522bc04b7063f3ff9)
SUMMARY: ThreadSanitizer: data race /home/mpage/local/cpython/./Include/cpython/pyatomic_gcc.h:565:3 in _Py_atomic_store_ptr_release
==================
ThreadSanitizer: reported 1 warnings
```
### CPython versions tested on:
CPython main branch
### Operating systems tested on:
Linux
<!-- gh-linked-prs -->
### Linked PRs
* gh-128367
<!-- /gh-linked-prs -->
| 8eebe4e6d02bb4ad3f1ca6c52624186903dce893 | c9356feef28e6dfc4dc32830d3427a5ae0e426e2 |
python/cpython | python__cpython-128202 | # ``test_pdb`` raises a ``DeprecationWarning``
# Bug report
### Bug description:
```python
eclips4@nixos ~/p/p/cpython (main)> ./python -m test -v test_pdb -m test_pdb_next_command_for_coroutine
== CPython 3.14.0a3+ (heads/main:180d417e9f9, Jan 1 1980, 00:00:00) [GCC 13.3.0]
== Linux-6.6.63-x86_64-with-glibc2.40 little-endian
== Python build: debug
== cwd: /home/eclips4/programming/programming-languages/cpython/build/test_python_worker_293203æ
== CPU count: 16
== encodings: locale=UTF-8 FS=utf-8
== resources: all test resources are disabled, use -u option to unskip tests
Using random seed: 315532800
0:00:00 load avg: 6.89 Run 1 test sequentially in a single process
0:00:00 load avg: 6.89 [1/1] test_pdb
test_pdb_next_command_for_coroutine (test.test_pdb)
Doctest: test.test_pdb.test_pdb_next_command_for_coroutine ... <doctest test.test_pdb.test_pdb_next_command_for_coroutine[3]>:5: DeprecationWarning: 'asyncio.set_event_loop_policy' is deprecated and slated for removal in Python 3.16
asyncio.set_event_loop_policy(None)
ok
----------------------------------------------------------------------
Ran 1 test in 0.007s
OK
== Tests result: SUCCESS ==
1 test OK.
Total duration: 181 ms
Total tests: run=1 (filtered)
Total test files: run=1/1 (filtered)
Result: SUCCESS
```
### CPython versions tested on:
CPython main branch
### Operating systems tested on:
Linux
<!-- gh-linked-prs -->
### Linked PRs
* gh-128202
<!-- /gh-linked-prs -->
| d9ed42bc00c74b3150be2a0eb28da03e01dffcc7 | 418114c139666f33abff937e40ccbbbdce15bc39 |
python/cpython | python__cpython-128199 | # Add missing error checks for usages of `PyIter_Next`
# Bug report
### Bug description:
Not all usages of `PyIter_Next` in the codebase comply with specified behavior: https://github.com/python/cpython/blob/180d417e9f9456defd4c5b53cae678c318287921/Objects/abstract.c#L2905-L2919.
One example would be: https://github.com/python/cpython/blob/180d417e9f9456defd4c5b53cae678c318287921/Objects/frameobject.c#L246-L268
### CPython versions tested on:
CPython main branch
### Operating systems tested on:
_No response_
<!-- gh-linked-prs -->
### Linked PRs
* gh-128199
* gh-128272
* gh-128273
<!-- /gh-linked-prs -->
| 5c814c83cdd3dc42bd9682106ffb7ade7ce6b5b3 | 81636d3bbd7f126692326bf957707e8a88c91739 |
python/cpython | python__cpython-128203 | # Add `_REPLACE_WITH_TRUE` to the tier 2 optimizer
# Feature or enhancement
### Proposal:
`_REPLACE_WITH_TRUE` is not currently in the tier 2 optimizer's known list, resulting in some missed opportunities.
To add it, here are the following steps:
1. Add a new bytecode definition `_REPLACE_WITH_TRUE` in `Python/optimizer_bytecodes.c`, with the same header as the one in `Python/bytecodes.c`.
2. The body of the instruction in `optimizer_bytecodes.c` should say `res = sym_new_const(ctx, Py_True);`. Meaning that the new value is a new symbolic constant of the value "True".
3. Run `make regen-cases` on *nix.
4. You can add a test in `Lib/test/test_capi/test_opt.py`. This is optional, you can choose not to as well.
### Has this already been discussed elsewhere?
No response given
### Links to previous discussion of this feature:
_No response_
<!-- gh-linked-prs -->
### Linked PRs
* gh-128203
<!-- /gh-linked-prs -->
| 30efede33ca1fe32debbae93cc40b0e7e0b133b3 | d61542b5ff1fe64705e5ce1bcc53048f14098dba |
python/cpython | python__cpython-128193 | # Support HTTP digest authentication algorithm SHA-256 as per RFC-7617
# Feature or enhancement
### Proposal:
Support SHA-256 digest authentication following RFC7616 - https://datatracker.ietf.org/doc/html/rfc7616
CPython currently supports MD5 and SHA1 only.
Other possible methods include `SHA-256-ness`, `SHA-512-256` and `SHA-512-256-sess` which hashlib doesn't currently appear to support out of the box.
### Has this already been discussed elsewhere?
No response given
### Links to previous discussion of this feature:
_No response_
<!-- gh-linked-prs -->
### Linked PRs
* gh-128193
* gh-128324
<!-- /gh-linked-prs -->
| f9a5a3a3ef34e63dc197156e9a5f57842859ca04 | 492b224b991cd9027f1bc6d9988d01e94f764992 |
python/cpython | python__cpython-128490 | # `ctypes` pointer writes are not thread safe
# Bug report
### Bug description:
Part of #127945.
`ctypes` C data objects have an internal pointer for what they're looking at (`b_ptr`). This field itself is generally fine to read non-atomically, because ctypes objects don't tend to overwrite the pointer that they're pointing to, but reading and writing the pointer's contents (such as via `memcpy`) isn't thread safe. This can be seen primarily with arrays:
```python
from threading import Thread
import ctypes
buffer = (ctypes.c_char_p * 10)()
def main():
for i in range(100):
buffer.value = b"hello"
buffer[1] = b"j"
threads = [Thread(target=main) for _ in range(100)]
for thread in threads:
thread.start()
```
There's really only two options here, because the lockless `_Py_atomic` APIs can't be used for allocations of arbitrary sizes: add a critical section around all functions touching `b_ptr`, or just add a `PyMutex` around it.
I think that a mutex is the right way to go here:
- There's no chance of re-entrancy with `memcpy`.
- AC doesn't work for some type slots (e.g. `__call__`), so they can't get wrapped with `@critical_section`. We'd need ugly wrapper functions.
### CPython versions tested on:
CPython main branch
### Operating systems tested on:
Linux
<!-- gh-linked-prs -->
### Linked PRs
* gh-128490
* gh-132081
* gh-132082
* gh-132133
* gh-132152
<!-- /gh-linked-prs -->
| 8dfc743a1dae499d3b116b81ef6aad78708c45bc | 5044c2245c1519e117ba3977a4c8f608785326e7 |
python/cpython | python__cpython-128680 | # Use of `ffi_type_complex_double` is unguarded
# Bug report
### Bug description:
e.g.
```
-std=c11 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration -fvisibility=hidden -Werror=unguarded-availability-new -I./Include/internal -I./Include/internal/mimalloc -I. -I./Include -c ./Modules/_ctypes/cfield.c -o Modules/_ctypes/cfield.o
./Modules/_ctypes/cfield.c:1610:36: error: 'ffi_type_complex_double' is only available on macOS 10.15 or newer [-Werror,-Wunguarded-availability-new]
case 'C': fd->pffi_type = &ffi_type_complex_double; break;
^~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/ffi/ffi.h:236:46: note: 'ffi_type_complex_double' has been marked as being introduced in macOS 10.15 here, but the deployment target is macOS 10.9.0
FFI_AVAILABLE_APPLE_2019 FFI_EXTERN ffi_type ffi_type_complex_double;
^
./Modules/_ctypes/cfield.c:1610:36: note: enclose 'ffi_type_complex_double' in a __builtin_available check to silence this warning
case 'C': fd->pffi_type = &ffi_type_complex_double; break;
^~~~~~~~~~~~~~~~~~~~~~~
./Modules/_ctypes/cfield.c:1611:36: error: 'ffi_type_complex_float' is only available on macOS 10.15 or newer [-Werror,-Wunguarded-availability-new]
case 'E': fd->pffi_type = &ffi_type_complex_float; break;
^~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/ffi/ffi.h:235:46: note: 'ffi_type_complex_float' has been marked as being introduced in macOS 10.15 here, but the deployment target is macOS 10.9.0
FFI_AVAILABLE_APPLE_2019 FFI_EXTERN ffi_type ffi_type_complex_float;
^
./Modules/_ctypes/cfield.c:1611:36: note: enclose 'ffi_type_complex_float' in a __builtin_available check to silence this warning
case 'E': fd->pffi_type = &ffi_type_complex_float; break;
^~~~~~~~~~~~~~~~~~~~~~
./Modules/_ctypes/cfield.c:1612:36: error: 'ffi_type_complex_double' is only available on macOS 10.15 or newer [-Werror,-Wung
uarded-availability-new]
case 'F': fd->pffi_type = &ffi_type_complex_longdouble; break;
^~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/ffi/ffi.h:240:37: note: expanded from macro 'ffi_type_complex_longdouble'
#define ffi_type_complex_longdouble ffi_type_complex_double
^~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/ffi/ffi.h:236:46: note: 'ffi_type_complex_double' has been marked as being introduced in macOS 10.15 here, but the deployment target is macOS 10.9.0
FFI_AVAILABLE_APPLE_2019 FFI_EXTERN ffi_type ffi_type_complex_double;
^
./Modules/_ctypes/cfield.c:1612:36: note: enclose 'ffi_type_complex_double' in a __builtin_available check to silence this warning
case 'F': fd->pffi_type = &ffi_type_complex_longdouble; break;
^~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/ffi/ffi.h:240:37: note: expanded from macro 'ffi_type_complex_longdouble'
#define ffi_type_complex_longdouble ffi_type_complex_double
^~~~~~~~~~~~~~~~~~~~~~~
```
See https://github.com/python/cpython/issues/100384 for context and similar issues.
### CPython versions tested on:
CPython main branch
### Operating systems tested on:
macOS
<!-- gh-linked-prs -->
### Linked PRs
* gh-128680
<!-- /gh-linked-prs -->
| d3b1bb228c951f8245f36ee28d9b175786522730 | 7239da75592081b6e8d0917a2cd2bf19907c8165 |
python/cpython | python__cpython-128151 | # Improve performances of `uuid.*` functions
# Feature or enhancement
The dedicated UUID constructors (e.g., `uuid.uuid4()`) generate bytes and pass them to the `UUID` constructor. However, the latter performs multiple and redundant checks. We can by-pass those checks since we are actually creating manually the UUID object. Here are the benchmarks for a PGO and `python -OO` (no LTO) build and a dedicated `UUID.from_int` constructor:
```text
+----------------------------------------+---------+-----------------------+
| Benchmark | ref | final |
+========================================+=========+=======================+
| uuid1(node, None) | 1.20 us | 1.16 us: 1.04x faster |
+----------------------------------------+---------+-----------------------+
| uuid1(None, clock_seq) | 1.16 us | 1.14 us: 1.02x faster |
+----------------------------------------+---------+-----------------------+
| uuid3(NAMESPACE_DNS, os.urandom(16)) | 1.13 us | 809 ns: 1.40x faster |
+----------------------------------------+---------+-----------------------+
| uuid3(NAMESPACE_DNS, os.urandom(1024)) | 2.08 us | 1.73 us: 1.20x faster |
+----------------------------------------+---------+-----------------------+
| uuid4() | 1.16 us | 885 ns: 1.31x faster |
+----------------------------------------+---------+-----------------------+
| uuid5(NAMESPACE_DNS, os.urandom(16)) | 1.15 us | 832 ns: 1.39x faster |
+----------------------------------------+---------+-----------------------+
| uuid5(NAMESPACE_DNS, os.urandom(1024)) | 1.57 us | 1.27 us: 1.24x faster |
+----------------------------------------+---------+-----------------------+
| uuid8() | 952 ns | 694 ns: 1.37x faster |
+----------------------------------------+---------+-----------------------+
| Geometric mean | (ref) | 1.21x faster |
+----------------------------------------+---------+-----------------------+
Benchmark hidden because not significant (1): uuid1()
+----------------------------------------+---------+-----------------------+
| Benchmark | ref | final |
+========================================+=========+=======================+
| uuid3(NAMESPACE_DNS, os.urandom(16)) | 1.13 us | 809 ns: 1.40x faster |
+----------------------------------------+---------+-----------------------+
| uuid3(NAMESPACE_DNS, os.urandom(1024)) | 2.08 us | 1.73 us: 1.20x faster |
+----------------------------------------+---------+-----------------------+
| uuid4() | 1.16 us | 885 ns: 1.31x faster |
+----------------------------------------+---------+-----------------------+
| uuid5(NAMESPACE_DNS, os.urandom(16)) | 1.15 us | 832 ns: 1.39x faster |
+----------------------------------------+---------+-----------------------+
| uuid5(NAMESPACE_DNS, os.urandom(1024)) | 1.57 us | 1.27 us: 1.24x faster |
+----------------------------------------+---------+-----------------------+
| uuid8() | 952 ns | 694 ns: 1.37x faster |
+----------------------------------------+---------+-----------------------+
| Geometric mean | (ref) | 1.31x faster |
+----------------------------------------+---------+-----------------------+
Ignored benchmarks (3) of ref.json: uuid1(), uuid1(None, clock_seq), uuid1(node, None)
```
The above benchmarks keep constants as is since constant folding would remove the inefficiency of recomputing `1 << const` everytime. With a hardcoded `1 << const`, the numbers are (almost) identical.
I did not change the UUIDv1 generation because I observed that it would be worse in the `uuid.uuid1()` form (but 50% faster when either the node or the clock sequence is given, but this is likely not the usual call form).
<details>
<summary>Benchmark script</summary>
```py
import os
import random
import uuid
import pyperf
if __name__ == '__main__':
runner = pyperf.Runner()
runner.bench_func('uuid1()', uuid.uuid1)
node = random.getrandbits(48)
runner.bench_func('uuid1(node, None)', uuid.uuid1, node)
clock_seq = random.getrandbits(14)
runner.bench_func('uuid1(None, clock_seq)', uuid.uuid1, None, clock_seq)
ns = uuid.NAMESPACE_DNS
runner.bench_func('uuid3(NAMESPACE_DNS, os.urandom(16))',
uuid.uuid3, ns, os.urandom(16))
runner.bench_func('uuid3(NAMESPACE_DNS, os.urandom(1024))',
uuid.uuid3, ns, os.urandom(1024))
runner.bench_func('uuid4()', uuid.uuid4)
ns = uuid.NAMESPACE_DNS
runner.bench_func('uuid5(NAMESPACE_DNS, os.urandom(16))',
uuid.uuid5, ns, os.urandom(16))
runner.bench_func('uuid5(NAMESPACE_DNS, os.urandom(1024))',
uuid.uuid5, ns, os.urandom(1024))
runner.bench_func('uuid8()', uuid.uuid8)
```
</details>
I'll submit a PR and we can decide what to keep and what to remove for maintainibility purposes. Note that the `uuid` module has been improved a lot performance-wise especially in terms of import time but I believe that constructing UUIDs objects via their dedicated functions.
<!-- gh-linked-prs -->
### Linked PRs
* gh-128151
<!-- /gh-linked-prs -->
| 6ff8f82f92a8af363b2bdd8bbaba5845eef430fc | 39fc7ef4fe211e8f7d3b5a6e392e475ecdfbce72 |
python/cpython | python__cpython-128165 | # 3.14 build error after recent commit: `pylifecycle.c:50:12: fatal error: os/log.h: No such file or directory`
# Bug report
### Bug description:
The recent commit https://github.com/python/cpython/commit/2041a95e68ebf6d13f867e214ada28affa830669 has broken the build of Python for a number of macOS versions, since `<os/log.h>` is not guaranteed to exist, but has been included unconditionally.
```
Python/pylifecycle.c:50:12: fatal error: os/log.h: No such file or directory
50 | # include <os/log.h>
| ^~~~~~~~~~
compilation terminated.
make: *** [Python/pylifecycle.o] Error 1
make: *** Waiting for unfinished jobs....
```
@freakboy3742 Could you please take a look at this?
### CPython versions tested on:
3.14
### Operating systems tested on:
macOS
<!-- gh-linked-prs -->
### Linked PRs
* gh-128165
* gh-128575
<!-- /gh-linked-prs -->
| e837a1f71e832ce8f551a6fac05e346f654457e0 | 24b147a19b360c49cb1740aa46211d342aaa071f |
python/cpython | python__cpython-128196 | # Race in PyUnicode_InternFromString under free-threading
# Bug report
### Bug description:
Here's a race reported by thread sanitizer that I haven't been able to find a small reproducer for, but it does look racy reading the code.
```
WARNING: ThreadSanitizer: data race (pid=1575489)
Read of size 4 at 0x7fb14614ee00 by thread T130:
#0 unicode_eq /usr/local/google/home/phawkins/p/cpython/Objects/stringlib/eq.h:13:9 (python3.13+0x25da7a) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#1 compare_unicode_unicode /usr/local/google/home/phawkins/p/cpython/Objects/dictobject.c:1139:50 (python3.13+0x25da7a)
#2 do_lookup /usr/local/google/home/phawkins/p/cpython/Objects/dictobject.c:1063:23 (python3.13+0x25da7a)
#3 unicodekeys_lookup_unicode /usr/local/google/home/phawkins/p/cpython/Objects/dictobject.c:1148:12 (python3.13+0x25da7a)
#4 _Py_dict_lookup /usr/local/google/home/phawkins/p/cpython/Objects/dictobject.c:1259:22 (python3.13+0x25ea02) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#5 dict_setdefault_ref_lock_held /usr/local/google/home/phawkins/p/cpython/Objects/dictobject.c:4282:21 (python3.13+0x26a5da) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#6 PyDict_SetDefaultRef /usr/local/google/home/phawkins/p/cpython/Objects/dictobject.c:4332:11 (python3.13+0x26a221) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#7 intern_common /usr/local/google/home/phawkins/p/cpython/Objects/unicodeobject.c:15225:19 (python3.13+0x34a02c) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#8 _PyUnicode_InternMortal /usr/local/google/home/phawkins/p/cpython/Objects/unicodeobject.c:15286:10 (python3.13+0x34a40c) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#9 PyUnicode_InternFromString /usr/local/google/home/phawkins/p/cpython/Objects/unicodeobject.c:15322:5 (python3.13+0x34a40c)
#10 nanobind::detail::nb_type_new(nanobind::detail::type_init_data const*) nb_type.cpp (xla_extension.so+0xdcd28aa) (BuildId: e484e79ecc5a6e10)
...
Previous write of size 4 at 0x7fb14614ee00 by thread T137:
#0 immortalize_interned /usr/local/google/home/phawkins/p/cpython/Objects/unicodeobject.c:15141:34 (python3.13+0x34a20e) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#1 intern_common /usr/local/google/home/phawkins/p/cpython/Objects/unicodeobject.c:15270:9 (python3.13+0x34a20e)
#2 _PyUnicode_InternMortal /usr/local/google/home/phawkins/p/cpython/Objects/unicodeobject.c:15286:10 (python3.13+0x34a40c) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#3 PyUnicode_InternFromString /usr/local/google/home/phawkins/p/cpython/Objects/unicodeobject.c:15322:5 (python3.13+0x34a40c)
#4 nanobind::detail::nb_type_new(nanobind::detail::type_init_data const*) nb_type.cpp (xla_extension.so+0xdcd28aa) (BuildId: e484e79ecc5a6e10)
...
```
I think the scenario here is:
* thread A and B are simultaneously interning strings
* thread A succeeds at inserting that string into the intern dictionary, and is at the end of `intern_common` immortalizing the string, which sets the `.interned` field on the string
* thread B is now trying to intern a string and is performing an equality test during the intern dictionary lookup, which reads the `.kind` field.
The `.kind` and `.interned` fields are bitfields in the same word, so this is a race, and I can't see any synchronization or atomicity that would prevent it.
Perhaps we need to hold the critical section on the intern dictionary longer, until immortalization is complete?
### CPython versions tested on:
3.13
### Operating systems tested on:
Linux
<!-- gh-linked-prs -->
### Linked PRs
* gh-128196
<!-- /gh-linked-prs -->
| ae23a012e6c8aadc4a588101cbe7bc86ede45627 | b60044b838f3ea97395cd6f3adbd5330356fc273 |
python/cpython | python__cpython-128412 | # Race in bytes_hash under free-threading
# Bug report
### Bug description:
Run the following reproducer under Python 3.13.1t with free-threading enabled:
```python
import concurrent.futures
import functools
import threading
num_threads = 8
def closure(b, x):
b.wait()
x.__hash__()
with concurrent.futures.ThreadPoolExecutor(max_workers=num_threads) as executor:
for _ in range(100):
b = threading.Barrier(num_threads)
x = b"hi"
x = x * 100000
for _ in range(num_threads):
executor.submit(functools.partial(closure, b, x))
```
Get:
```
WARNING: ThreadSanitizer: data race (pid=1186406)
Write of size 8 at 0x7fb6ecd80028 by thread T8:
#0 bytes_hash /usr/local/google/home/phawkins/p/cpython/Objects/bytesobject.c:1590:21 (python3.13+0x1ddaab) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#1 wrap_hashfunc /usr/local/google/home/phawkins/p/cpython/Objects/typeobject.c:8824:11 (python3.13+0x2f8aa6) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#2 wrapperdescr_raw_call /usr/local/google/home/phawkins/p/cpython/Objects/descrobject.c:531:12 (python3.13+0x2001b1) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#3 wrapperdescr_call /usr/local/google/home/phawkins/p/cpython/Objects/descrobject.c:569:14 (python3.13+0x2001b1)
#4 _PyObject_MakeTpCall /usr/local/google/home/phawkins/p/cpython/Objects/call.c:242:18 (python3.13+0x1ea40c) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#5 _PyObject_VectorcallTstate /usr/local/google/home/phawkins/p/cpython/./Include/internal/pycore_call.h:166:16 (python3.13+0x1eb068) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#6 PyObject_Vectorcall /usr/local/google/home/phawkins/p/cpython/Objects/call.c:327:12 (python3.13+0x1eb068)
#7 _PyEval_EvalFrameDefault /usr/local/google/home/phawkins/p/cpython/Python/generated_cases.c.h:813:23 (python3.13+0x3e24fb) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#8 _PyEval_EvalFrame /usr/local/google/home/phawkins/p/cpython/./Include/internal/pycore_ceval.h:119:16 (python3.13+0x3de62a) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#9 _PyEval_Vector /usr/local/google/home/phawkins/p/cpython/Python/ceval.c:1811:12 (python3.13+0x3de62a)
#10 _PyFunction_Vectorcall /usr/local/google/home/phawkins/p/cpython/Objects/call.c (python3.13+0x1eb61f) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#11 _PyObject_VectorcallTstate /usr/local/google/home/phawkins/p/cpython/./Include/internal/pycore_call.h:168:11 (python3.13+0x571bb2) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#12 partial_vectorcall /usr/local/google/home/phawkins/p/cpython/./Modules/_functoolsmodule.c:252:16 (python3.13+0x571bb2)
#13 _PyVectorcall_Call /usr/local/google/home/phawkins/p/cpython/Objects/call.c:273:16 (python3.13+0x1eb293) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#14 _PyObject_Call /usr/local/google/home/phawkins/p/cpython/Objects/call.c:348:16 (python3.13+0x1eb293)
#15 PyObject_Call /usr/local/google/home/phawkins/p/cpython/Objects/call.c:373:12 (python3.13+0x1eb315) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#16 _PyEval_EvalFrameDefault /usr/local/google/home/phawkins/p/cpython/Python/generated_cases.c.h:1355:26 (python3.13+0x3e46e2) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#17 _PyEval_EvalFrame /usr/local/google/home/phawkins/p/cpython/./Include/internal/pycore_ceval.h:119:16 (python3.13+0x3de62a) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#18 _PyEval_Vector /usr/local/google/home/phawkins/p/cpython/Python/ceval.c:1811:12 (python3.13+0x3de62a)
#19 _PyFunction_Vectorcall /usr/local/google/home/phawkins/p/cpython/Objects/call.c (python3.13+0x1eb61f) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#20 _PyObject_VectorcallTstate /usr/local/google/home/phawkins/p/cpython/./Include/internal/pycore_call.h:168:11 (python3.13+0x1ef5ef) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#21 method_vectorcall /usr/local/google/home/phawkins/p/cpython/Objects/classobject.c:70:20 (python3.13+0x1ef5ef)
#22 _PyVectorcall_Call /usr/local/google/home/phawkins/p/cpython/Objects/call.c:273:16 (python3.13+0x1eb293) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#23 _PyObject_Call /usr/local/google/home/phawkins/p/cpython/Objects/call.c:348:16 (python3.13+0x1eb293)
#24 PyObject_Call /usr/local/google/home/phawkins/p/cpython/Objects/call.c:373:12 (python3.13+0x1eb315) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#25 thread_run /usr/local/google/home/phawkins/p/cpython/./Modules/_threadmodule.c:337:21 (python3.13+0x564292) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#26 pythread_wrapper /usr/local/google/home/phawkins/p/cpython/Python/thread_pthread.h:243:5 (python3.13+0x4bd637) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
Previous read of size 8 at 0x7fb6ecd80028 by thread T4:
#0 bytes_hash /usr/local/google/home/phawkins/p/cpython/Objects/bytesobject.c:1588:12 (python3.13+0x1dda7d) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#1 wrap_hashfunc /usr/local/google/home/phawkins/p/cpython/Objects/typeobject.c:8824:11 (python3.13+0x2f8aa6) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#2 wrapperdescr_raw_call /usr/local/google/home/phawkins/p/cpython/Objects/descrobject.c:531:12 (python3.13+0x2001b1) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#3 wrapperdescr_call /usr/local/google/home/phawkins/p/cpython/Objects/descrobject.c:569:14 (python3.13+0x2001b1)
#4 _PyObject_MakeTpCall /usr/local/google/home/phawkins/p/cpython/Objects/call.c:242:18 (python3.13+0x1ea40c) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#5 _PyObject_VectorcallTstate /usr/local/google/home/phawkins/p/cpython/./Include/internal/pycore_call.h:166:16 (python3.13+0x1eb068) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#6 PyObject_Vectorcall /usr/local/google/home/phawkins/p/cpython/Objects/call.c:327:12 (python3.13+0x1eb068)
#7 _PyEval_EvalFrameDefault /usr/local/google/home/phawkins/p/cpython/Python/generated_cases.c.h:813:23 (python3.13+0x3e24fb) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#8 _PyEval_EvalFrame /usr/local/google/home/phawkins/p/cpython/./Include/internal/pycore_ceval.h:119:16 (python3.13+0x3de62a) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#9 _PyEval_Vector /usr/local/google/home/phawkins/p/cpython/Python/ceval.c:1811:12 (python3.13+0x3de62a)
#10 _PyFunction_Vectorcall /usr/local/google/home/phawkins/p/cpython/Objects/call.c (python3.13+0x1eb61f) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#11 _PyObject_VectorcallTstate /usr/local/google/home/phawkins/p/cpython/./Include/internal/pycore_call.h:168:11 (python3.13+0x571bb2) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#12 partial_vectorcall /usr/local/google/home/phawkins/p/cpython/./Modules/_functoolsmodule.c:252:16 (python3.13+0x571bb2)
#13 _PyVectorcall_Call /usr/local/google/home/phawkins/p/cpython/Objects/call.c:273:16 (python3.13+0x1eb293) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#14 _PyObject_Call /usr/local/google/home/phawkins/p/cpython/Objects/call.c:348:16 (python3.13+0x1eb293)
#15 PyObject_Call /usr/local/google/home/phawkins/p/cpython/Objects/call.c:373:12 (python3.13+0x1eb315) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#16 _PyEval_EvalFrameDefault /usr/local/google/home/phawkins/p/cpython/Python/generated_cases.c.h:1355:26 (python3.13+0x3e46e2) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#17 _PyEval_EvalFrame /usr/local/google/home/phawkins/p/cpython/./Include/internal/pycore_ceval.h:119:16 (python3.13+0x3de62a) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#18 _PyEval_Vector /usr/local/google/home/phawkins/p/cpython/Python/ceval.c:1811:12 (python3.13+0x3de62a)
#19 _PyFunction_Vectorcall /usr/local/google/home/phawkins/p/cpython/Objects/call.c (python3.13+0x1eb61f) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#20 _PyObject_VectorcallTstate /usr/local/google/home/phawkins/p/cpython/./Include/internal/pycore_call.h:168:11 (python3.13+0x1ef5ef) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#21 method_vectorcall /usr/local/google/home/phawkins/p/cpython/Objects/classobject.c:70:20 (python3.13+0x1ef5ef)
#22 _PyVectorcall_Call /usr/local/google/home/phawkins/p/cpython/Objects/call.c:273:16 (python3.13+0x1eb293) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#23 _PyObject_Call /usr/local/google/home/phawkins/p/cpython/Objects/call.c:348:16 (python3.13+0x1eb293)
#24 PyObject_Call /usr/local/google/home/phawkins/p/cpython/Objects/call.c:373:12 (python3.13+0x1eb315) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#25 thread_run /usr/local/google/home/phawkins/p/cpython/./Modules/_threadmodule.c:337:21 (python3.13+0x564292) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#26 pythread_wrapper /usr/local/google/home/phawkins/p/cpython/Python/thread_pthread.h:243:5 (python3.13+0x4bd637) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
```
PyBytesObject::ob_shash probably needs to be read and written atomically.
### CPython versions tested on:
3.13
### Operating systems tested on:
Linux
<!-- gh-linked-prs -->
### Linked PRs
* gh-128412
* gh-130022
<!-- /gh-linked-prs -->
| 0706bab1c0985761cdbc07ab448f98c717276b36 | b49c68a1b3dfd2c2567c38b2d044c4a1c14a26a7 |
python/cpython | python__cpython-129975 | # Race on `_PyRuntime.signals.unhandled_keyboard_interrupt` when calling `eval()` concurrently in free-threading mode
# Bug report
### Bug description:
Run the following code under Python 3.13.1t with thread-sanitizer enabled:
```python
from collections import namedtuple
import concurrent.futures
import functools
import threading
num_threads = 8
def closure(b):
b.wait()
namedtuple('mytuple', ['f'])
with concurrent.futures.ThreadPoolExecutor(max_workers=num_threads) as executor:
for _ in range(100):
b = threading.Barrier(num_threads)
for _ in range(num_threads):
executor.submit(functools.partial(closure, b))
```
Get:
```
WARNING: ThreadSanitizer: data race (pid=682761)
Write of size 4 at 0x56312bb5f168 by thread T6:
#0 run_eval_code_obj /usr/local/google/home/phawkins/p/cpython/Python/pythonrun.c:1318:53 (python3.13+0x4a02a6) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#1 run_mod /usr/local/google/home/phawkins/p/cpython/Python/pythonrun.c:1422:19 (python3.13+0x49fa95) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#2 _PyRun_StringFlagsWithName /usr/local/google/home/phawkins/p/cpython/Python/pythonrun.c:1221:15 (python3.13+0x49cfe4) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#3 PyRun_StringFlags /usr/local/google/home/phawkins/p/cpython/Python/pythonrun.c:1233:12 (python3.13+0x49cfe4)
#4 builtin_eval_impl /usr/local/google/home/phawkins/p/cpython/Python/bltinmodule.c:1027:18 (python3.13+0x3d8189) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#5 builtin_eval /usr/local/google/home/phawkins/p/cpython/Python/clinic/bltinmodule.c.h:467:20 (python3.13+0x3d8189)
#6 cfunction_vectorcall_FASTCALL_KEYWORDS /usr/local/google/home/phawkins/p/cpython/Objects/methodobject.c:441:24 (python3.13+0x28a010) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#7 _PyObject_VectorcallTstate /usr/local/google/home/phawkins/p/cpython/./Include/internal/pycore_call.h:168:11 (python3.13+0x1eafaa) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#8 PyObject_Vectorcall /usr/local/google/home/phawkins/p/cpython/Objects/call.c:327:12 (python3.13+0x1eafaa)
#9 _PyEval_EvalFrameDefault /usr/local/google/home/phawkins/p/cpython/Python/generated_cases.c.h:813:23 (python3.13+0x3e24fb) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#10 _PyEval_EvalFrame /usr/local/google/home/phawkins/p/cpython/./Include/internal/pycore_ceval.h:119:16 (python3.13+0x3de62a) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#11 _PyEval_Vector /usr/local/google/home/phawkins/p/cpython/Python/ceval.c:1811:12 (python3.13+0x3de62a)
#12 _PyFunction_Vectorcall /usr/local/google/home/phawkins/p/cpython/Objects/call.c (python3.13+0x1eb61f) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#13 _PyObject_VectorcallTstate /usr/local/google/home/phawkins/p/cpython/./Include/internal/pycore_call.h:168:11 (python3.13+0x571bb2) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#14 partial_vectorcall /usr/local/google/home/phawkins/p/cpython/./Modules/_functoolsmodule.c:252:16 (python3.13+0x571bb2)
#15 _PyVectorcall_Call /usr/local/google/home/phawkins/p/cpython/Objects/call.c:273:16 (python3.13+0x1eb293) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#16 _PyObject_Call /usr/local/google/home/phawkins/p/cpython/Objects/call.c:348:16 (python3.13+0x1eb293)
#17 PyObject_Call /usr/local/google/home/phawkins/p/cpython/Objects/call.c:373:12 (python3.13+0x1eb315) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#18 _PyEval_EvalFrameDefault /usr/local/google/home/phawkins/p/cpython/Python/generated_cases.c.h:1355:26 (python3.13+0x3e46e2) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#19 _PyEval_EvalFrame /usr/local/google/home/phawkins/p/cpython/./Include/internal/pycore_ceval.h:119:16 (python3.13+0x3de62a) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#20 _PyEval_Vector /usr/local/google/home/phawkins/p/cpython/Python/ceval.c:1811:12 (python3.13+0x3de62a)
#21 _PyFunction_Vectorcall /usr/local/google/home/phawkins/p/cpython/Objects/call.c (python3.13+0x1eb61f) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#22 _PyObject_VectorcallTstate /usr/local/google/home/phawkins/p/cpython/./Include/internal/pycore_call.h:168:11 (python3.13+0x1ef5ef) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#23 method_vectorcall /usr/local/google/home/phawkins/p/cpython/Objects/classobject.c:70:20 (python3.13+0x1ef5ef)
#24 _PyVectorcall_Call /usr/local/google/home/phawkins/p/cpython/Objects/call.c:273:16 (python3.13+0x1eb293) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#25 _PyObject_Call /usr/local/google/home/phawkins/p/cpython/Objects/call.c:348:16 (python3.13+0x1eb293)
#26 PyObject_Call /usr/local/google/home/phawkins/p/cpython/Objects/call.c:373:12 (python3.13+0x1eb315) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#27 thread_run /usr/local/google/home/phawkins/p/cpython/./Modules/_threadmodule.c:337:21 (python3.13+0x564292) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#28 pythread_wrapper /usr/local/google/home/phawkins/p/cpython/Python/thread_pthread.h:243:5 (python3.13+0x4bd637) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
Previous write of size 4 at 0x56312bb5f168 by thread T8:
#0 run_eval_code_obj /usr/local/google/home/phawkins/p/cpython/Python/pythonrun.c:1318:53 (python3.13+0x4a02a6) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#1 run_mod /usr/local/google/home/phawkins/p/cpython/Python/pythonrun.c:1422:19 (python3.13+0x49fa95) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#2 _PyRun_StringFlagsWithName /usr/local/google/home/phawkins/p/cpython/Python/pythonrun.c:1221:15 (python3.13+0x49cfe4) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#3 PyRun_StringFlags /usr/local/google/home/phawkins/p/cpython/Python/pythonrun.c:1233:12 (python3.13+0x49cfe4)
#4 builtin_eval_impl /usr/local/google/home/phawkins/p/cpython/Python/bltinmodule.c:1027:18 (python3.13+0x3d8189) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#5 builtin_eval /usr/local/google/home/phawkins/p/cpython/Python/clinic/bltinmodule.c.h:467:20 (python3.13+0x3d8189)
#6 cfunction_vectorcall_FASTCALL_KEYWORDS /usr/local/google/home/phawkins/p/cpython/Objects/methodobject.c:441:24 (python3.13+0x28a010) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#7 _PyObject_VectorcallTstate /usr/local/google/home/phawkins/p/cpython/./Include/internal/pycore_call.h:168:11 (python3.13+0x1eafaa) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#8 PyObject_Vectorcall /usr/local/google/home/phawkins/p/cpython/Objects/call.c:327:12 (python3.13+0x1eafaa)
#9 _PyEval_EvalFrameDefault /usr/local/google/home/phawkins/p/cpython/Python/generated_cases.c.h:813:23 (python3.13+0x3e24fb) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#10 _PyEval_EvalFrame /usr/local/google/home/phawkins/p/cpython/./Include/internal/pycore_ceval.h:119:16 (python3.13+0x3de62a) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#11 _PyEval_Vector /usr/local/google/home/phawkins/p/cpython/Python/ceval.c:1811:12 (python3.13+0x3de62a)
#12 _PyFunction_Vectorcall /usr/local/google/home/phawkins/p/cpython/Objects/call.c (python3.13+0x1eb61f) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#13 _PyObject_VectorcallTstate /usr/local/google/home/phawkins/p/cpython/./Include/internal/pycore_call.h:168:11 (python3.13+0x571bb2) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#14 partial_vectorcall /usr/local/google/home/phawkins/p/cpython/./Modules/_functoolsmodule.c:252:16 (python3.13+0x571bb2)
#15 _PyVectorcall_Call /usr/local/google/home/phawkins/p/cpython/Objects/call.c:273:16 (python3.13+0x1eb293) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#16 _PyObject_Call /usr/local/google/home/phawkins/p/cpython/Objects/call.c:348:16 (python3.13+0x1eb293)
#17 PyObject_Call /usr/local/google/home/phawkins/p/cpython/Objects/call.c:373:12 (python3.13+0x1eb315) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#18 _PyEval_EvalFrameDefault /usr/local/google/home/phawkins/p/cpython/Python/generated_cases.c.h:1355:26 (python3.13+0x3e46e2) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#19 _PyEval_EvalFrame /usr/local/google/home/phawkins/p/cpython/./Include/internal/pycore_ceval.h:119:16 (python3.13+0x3de62a) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#20 _PyEval_Vector /usr/local/google/home/phawkins/p/cpython/Python/ceval.c:1811:12 (python3.13+0x3de62a)
#21 _PyFunction_Vectorcall /usr/local/google/home/phawkins/p/cpython/Objects/call.c (python3.13+0x1eb61f) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#22 _PyObject_VectorcallTstate /usr/local/google/home/phawkins/p/cpython/./Include/internal/pycore_call.h:168:11 (python3.13+0x1ef5ef) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#23 method_vectorcall /usr/local/google/home/phawkins/p/cpython/Objects/classobject.c:70:20 (python3.13+0x1ef5ef)
#24 _PyVectorcall_Call /usr/local/google/home/phawkins/p/cpython/Objects/call.c:273:16 (python3.13+0x1eb293) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#25 _PyObject_Call /usr/local/google/home/phawkins/p/cpython/Objects/call.c:348:16 (python3.13+0x1eb293)
#26 PyObject_Call /usr/local/google/home/phawkins/p/cpython/Objects/call.c:373:12 (python3.13+0x1eb315) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#27 thread_run /usr/local/google/home/phawkins/p/cpython/./Modules/_threadmodule.c:337:21 (python3.13+0x564292) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#28 pythread_wrapper /usr/local/google/home/phawkins/p/cpython/Python/thread_pthread.h:243:5 (python3.13+0x4bd637) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
```
I think `namedtuple` calls `eval()`, which triggers a race here:
https://github.com/python/cpython/blob/067145177975eadd61a0c907d0d177f7b6a5a3de/Python/pythonrun.c#L1318
### CPython versions tested on:
3.13
### Operating systems tested on:
Linux
<!-- gh-linked-prs -->
### Linked PRs
* gh-129975
<!-- /gh-linked-prs -->
| 451f291baaff918228ace4e8257be42737d7654a | aa284232013693103431fb672a0bcabac3d4200b |
python/cpython | python__cpython-128119 | # Improve performance of copy.copy
# Feature or enhancement
### Proposal:
Similar to the approached used for `copy.deepcopy` in #114266 we can simplifly the implementation of `copy.copy` and improve performance by checking on the type of the argument using a lookup.
### Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
### Links to previous discussion of this feature:
_No response_
<!-- gh-linked-prs -->
### Linked PRs
* gh-128119
<!-- /gh-linked-prs -->
| 34b85ef26c44bbbd8a05d3e7dee6997b3623aab0 | 348012432155271cfbee71a78d0c27254fc230e2 |
python/cpython | python__cpython-128120 | # [PPC64LE buildbots] test_socket: VSOCK testStream(): recv fails with EACCES on Fedora 41
Example of failure: https://buildbot.python.org/#/builders/1467/builds/303/steps/6/logs/stdio
```
Traceback (most recent call last):
File ".../Lib/test/test_socket.py", line 550, in testStream
msg = self.conn.recv(1024)
PermissionError: [Errno 13] Permission denied
```
See also: #119461 (cc @vstinner)
<!-- gh-linked-prs -->
### Linked PRs
* gh-128120
* gh-128123
* gh-128124
<!-- /gh-linked-prs -->
| cbfe3023e46b544b80ea1a38a8c900c6fb881554 | 0974d7bb866062ed4aaa40f705d6cc4c294d99f1 |
python/cpython | python__cpython-128106 | # `test_strftime_y2k` fails while cross-compiling 3.14a3 for `x86_64_v2` and `x86_64_v3` on Linux
# Bug report
### Bug description:
The PGO test suite fails on the `test_datetime` tests; in particular, the `test_strftime_y2k` test cases. It looks like the padding is wrong:
```
cpython-3.14> AssertionError: '1-01-01' != '0001-01-01'
```
I believe this is related to:
- https://github.com/python/cpython/issues/123681 (superseded by this issue)
- https://github.com/python/cpython/issues/120713
- https://github.com/python/cpython/pull/123861
Note this is occuring in the `python-build-standalone` builds. I have not reproduced it independently. This isn't a problem during our x86_64_v4 builds because we're not running PGO on them. The normal x86_64 build is working.
<details>
<summary>Toggle for the full test output</summary>
<pre>
cpython-3.14> test_system_transitions (test.datetimetester.ZoneInfoTest_Fast.test_system_transitions) ... ok
cpython-3.14>
cpython-3.14> ======================================================================
cpython-3.14> FAIL: test_strftime_y2k (test.datetimetester.TestDate_Fast.test_strftime_y2k) (year=1, specifier='F')
cpython-3.14> ----------------------------------------------------------------------
cpython-3.14> Traceback (most recent call last):
cpython-3.14> File "/build/Python-3.14.0a3/Lib/test/datetimetester.py", line 1814, in test_strftime_y2k
cpython-3.14> self.assertEqual(d.strftime(f"%{specifier}"), expected)
cpython-3.14> ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cpython-3.14> AssertionError: '1-01-01' != '0001-01-01'
cpython-3.14> - 1-01-01
cpython-3.14> + 0001-01-01
cpython-3.14> ? +++
cpython-3.14>
cpython-3.14>
cpython-3.14> ======================================================================
cpython-3.14> FAIL: test_strftime_y2k (test.datetimetester.TestDate_Fast.test_strftime_y2k) (year=1, specifier='C')
cpython-3.14> ----------------------------------------------------------------------
cpython-3.14> Traceback (most recent call last):
cpython-3.14> File "/build/Python-3.14.0a3/Lib/test/datetimetester.py", line 1814, in test_strftime_y2k
cpython-3.14> self.assertEqual(d.strftime(f"%{specifier}"), expected)
cpython-3.14> ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cpython-3.14> AssertionError: '0' != '00'
cpython-3.14> - 0
cpython-3.14> + 00
cpython-3.14> ? +
cpython-3.14>
cpython-3.14>
cpython-3.14> ======================================================================
cpython-3.14> FAIL: test_strftime_y2k (test.datetimetester.TestDate_Fast.test_strftime_y2k) (year=48, specifier='F')
cpython-3.14> ----------------------------------------------------------------------
cpython-3.14> Traceback (most recent call last):
cpython-3.14> File "/build/Python-3.14.0a3/Lib/test/datetimetester.py", line 1814, in test_strftime_y2k
cpython-3.14> self.assertEqual(d.strftime(f"%{specifier}"), expected)
cpython-3.14> ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cpython-3.14> AssertionError: '48-01-01' != '0048-01-01'
cpython-3.14> - 48-01-01
cpython-3.14> + 0048-01-01
cpython-3.14> ? ++
cpython-3.14>
cpython-3.14>
cpython-3.14> ======================================================================
cpython-3.14> FAIL: test_strftime_y2k (test.datetimetester.TestDate_Fast.test_strftime_y2k) (year=48, specifier='C')
cpython-3.14> ----------------------------------------------------------------------
cpython-3.14> Traceback (most recent call last):
cpython-3.14> File "/build/Python-3.14.0a3/Lib/test/datetimetester.py", line 1814, in test_strftime_y2k
cpython-3.14> self.assertEqual(d.strftime(f"%{specifier}"), expected)
cpython-3.14> ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cpython-3.14> AssertionError: '0' != '00'
cpython-3.14> - 0
cpython-3.14> + 00
cpython-3.14> ? +
cpython-3.14>
cpython-3.14>
cpython-3.14> ======================================================================
cpython-3.14> FAIL: test_strftime_y2k (test.datetimetester.TestDate_Fast.test_strftime_y2k) (year=70, specifier='F')
cpython-3.14> ----------------------------------------------------------------------
cpython-3.14> Traceback (most recent call last):
cpython-3.14> File "/build/Python-3.14.0a3/Lib/test/datetimetester.py", line 1814, in test_strftime_y2k
cpython-3.14> self.assertEqual(d.strftime(f"%{specifier}"), expected)
cpython-3.14> ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cpython-3.14> AssertionError: '70-01-01' != '0070-01-01'
cpython-3.14> - 70-01-01
cpython-3.14> + 0070-01-01
cpython-3.14> ? ++
cpython-3.14>
cpython-3.14>
cpython-3.14> ======================================================================
cpython-3.14> FAIL: test_strftime_y2k (test.datetimetester.TestDate_Fast.test_strftime_y2k) (year=70, specifier='C')
cpython-3.14> ----------------------------------------------------------------------
cpython-3.14> Traceback (most recent call last):
cpython-3.14> File "/build/Python-3.14.0a3/Lib/test/datetimetester.py", line 1814, in test_strftime_y2k
cpython-3.14> self.assertEqual(d.strftime(f"%{specifier}"), expected)
cpython-3.14> ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cpython-3.14> AssertionError: '0' != '00'
cpython-3.14> - 0
cpython-3.14> + 00
cpython-3.14> ? +
cpython-3.14>
cpython-3.14>
cpython-3.14> ======================================================================
cpython-3.14> FAIL: test_strftime_y2k (test.datetimetester.TestDate_Fast.test_strftime_y2k) (year=99, specifier='F')
cpython-3.14> ----------------------------------------------------------------------
cpython-3.14> Traceback (most recent call last):
cpython-3.14> File "/build/Python-3.14.0a3/Lib/test/datetimetester.py", line 1814, in test_strftime_y2k
cpython-3.14> self.assertEqual(d.strftime(f"%{specifier}"), expected)
cpython-3.14> ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cpython-3.14> AssertionError: '99-01-01' != '0099-01-01'
cpython-3.14> - 99-01-01
cpython-3.14> + 0099-01-01
cpython-3.14> ? ++
cpython-3.14>
cpython-3.14>
cpython-3.14> ======================================================================
cpython-3.14> FAIL: test_strftime_y2k (test.datetimetester.TestDate_Fast.test_strftime_y2k) (year=99, specifier='C')
cpython-3.14> ----------------------------------------------------------------------
cpython-3.14> Traceback (most recent call last):
cpython-3.14> File "/build/Python-3.14.0a3/Lib/test/datetimetester.py", line 1814, in test_strftime_y2k
cpython-3.14> self.assertEqual(d.strftime(f"%{specifier}"), expected)
cpython-3.14> ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cpython-3.14> AssertionError: '0' != '00'
cpython-3.14> - 0
cpython-3.14> + 00
cpython-3.14> ? +
cpython-3.14>
cpython-3.14>
cpython-3.14> ======================================================================
cpython-3.14> FAIL: test_strftime_y2k (test.datetimetester.TestDate_Fast.test_strftime_y2k) (year=99, specifier='F')
cpython-3.14> ----------------------------------------------------------------------
cpython-3.14> Traceback (most recent call last):
cpython-3.14> File "/build/Python-3.14.0a3/Lib/test/datetimetester.py", line 1814, in test_strftime_y2k
cpython-3.14> self.assertEqual(d.strftime(f"%{specifier}"), expected)
cpython-3.14> ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cpython-3.14> AssertionError: '99-01-01' != '0099-01-01'
cpython-3.14> - 99-01-01
cpython-3.14> + 0099-01-01
cpython-3.14> ? ++
cpython-3.14>
cpython-3.14>
cpython-3.14> ======================================================================
cpython-3.14> FAIL: test_strftime_y2k (test.datetimetester.TestDate_Fast.test_strftime_y2k) (year=99, specifier='C')
cpython-3.14> ----------------------------------------------------------------------
cpython-3.14> Traceback (most recent call last):
cpython-3.14> File "/build/Python-3.14.0a3/Lib/test/datetimetester.py", line 1814, in test_strftime_y2k
cpython-3.14> self.assertEqual(d.strftime(f"%{specifier}"), expected)
cpython-3.14> ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cpython-3.14> AssertionError: '0' != '00'
cpython-3.14> - 0
cpython-3.14> + 00
cpython-3.14> ? +
cpython-3.14>
cpython-3.14>
cpython-3.14> ======================================================================
cpython-3.14> FAIL: test_strftime_y2k (test.datetimetester.TestDate_Fast.test_strftime_y2k) (year=999, specifier='F')
cpython-3.14> ----------------------------------------------------------------------
cpython-3.14> Traceback (most recent call last):
cpython-3.14> File "/build/Python-3.14.0a3/Lib/test/datetimetester.py", line 1814, in test_strftime_y2k
cpython-3.14> self.assertEqual(d.strftime(f"%{specifier}"), expected)
cpython-3.14> ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cpython-3.14> AssertionError: '999-01-01' != '0999-01-01'
cpython-3.14> - 999-01-01
cpython-3.14> + 0999-01-01
cpython-3.14> ? +
cpython-3.14>
cpython-3.14>
cpython-3.14> ======================================================================
cpython-3.14> FAIL: test_strftime_y2k (test.datetimetester.TestDate_Fast.test_strftime_y2k) (year=999, specifier='C')
cpython-3.14> ----------------------------------------------------------------------
cpython-3.14> Traceback (most recent call last):
cpython-3.14> File "/build/Python-3.14.0a3/Lib/test/datetimetester.py", line 1814, in test_strftime_y2k
cpython-3.14> self.assertEqual(d.strftime(f"%{specifier}"), expected)
cpython-3.14> ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cpython-3.14> AssertionError: '9' != '09'
cpython-3.14> - 9
cpython-3.14> + 09
cpython-3.14> ? +
cpython-3.14>
cpython-3.14>
cpython-3.14> ======================================================================
cpython-3.14> FAIL: test_strftime_y2k (test.datetimetester.TestDateTime_Fast.test_strftime_y2k) (year=1, specifier='F')
cpython-3.14> ----------------------------------------------------------------------
cpython-3.14> Traceback (most recent call last):
cpython-3.14> File "/build/Python-3.14.0a3/Lib/test/datetimetester.py", line 1814, in test_strftime_y2k
cpython-3.14> self.assertEqual(d.strftime(f"%{specifier}"), expected)
cpython-3.14> ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cpython-3.14> AssertionError: '1-01-01' != '0001-01-01'
cpython-3.14> - 1-01-01
cpython-3.14> + 0001-01-01
cpython-3.14> ? +++
cpython-3.14>
cpython-3.14>
cpython-3.14> ======================================================================
cpython-3.14> FAIL: test_strftime_y2k (test.datetimetester.TestDateTime_Fast.test_strftime_y2k) (year=1, specifier='C')
cpython-3.14> ----------------------------------------------------------------------
cpython-3.14> Traceback (most recent call last):
cpython-3.14> File "/build/Python-3.14.0a3/Lib/test/datetimetester.py", line 1814, in test_strftime_y2k
cpython-3.14> self.assertEqual(d.strftime(f"%{specifier}"), expected)
cpython-3.14> ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cpython-3.14> AssertionError: '0' != '00'
cpython-3.14> - 0
cpython-3.14> + 00
cpython-3.14> ? +
cpython-3.14>
cpython-3.14>
cpython-3.14> ======================================================================
cpython-3.14> FAIL: test_strftime_y2k (test.datetimetester.TestDateTime_Fast.test_strftime_y2k) (year=48, specifier='F')
cpython-3.14> ----------------------------------------------------------------------
cpython-3.14> Traceback (most recent call last):
cpython-3.14> File "/build/Python-3.14.0a3/Lib/test/datetimetester.py", line 1814, in test_strftime_y2k
cpython-3.14> self.assertEqual(d.strftime(f"%{specifier}"), expected)
cpython-3.14> ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cpython-3.14> AssertionError: '48-01-01' != '0048-01-01'
cpython-3.14> - 48-01-01
cpython-3.14> + 0048-01-01
cpython-3.14> ? ++
cpython-3.14>
cpython-3.14>
cpython-3.14> ======================================================================
cpython-3.14> FAIL: test_strftime_y2k (test.datetimetester.TestDateTime_Fast.test_strftime_y2k) (year=48, specifier='C')
cpython-3.14> ----------------------------------------------------------------------
cpython-3.14> Traceback (most recent call last):
cpython-3.14> File "/build/Python-3.14.0a3/Lib/test/datetimetester.py", line 1814, in test_strftime_y2k
cpython-3.14> self.assertEqual(d.strftime(f"%{specifier}"), expected)
cpython-3.14> ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cpython-3.14> AssertionError: '0' != '00'
cpython-3.14> - 0
cpython-3.14> + 00
cpython-3.14> ? +
cpython-3.14>
cpython-3.14>
cpython-3.14> ======================================================================
cpython-3.14> FAIL: test_strftime_y2k (test.datetimetester.TestDateTime_Fast.test_strftime_y2k) (year=70, specifier='F')
cpython-3.14> ----------------------------------------------------------------------
cpython-3.14> Traceback (most recent call last):
cpython-3.14> File "/build/Python-3.14.0a3/Lib/test/datetimetester.py", line 1814, in test_strftime_y2k
cpython-3.14> self.assertEqual(d.strftime(f"%{specifier}"), expected)
cpython-3.14> ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cpython-3.14> AssertionError: '70-01-01' != '0070-01-01'
cpython-3.14> - 70-01-01
cpython-3.14> + 0070-01-01
cpython-3.14> ? ++
cpython-3.14>
cpython-3.14>
cpython-3.14> ======================================================================
cpython-3.14> FAIL: test_strftime_y2k (test.datetimetester.TestDateTime_Fast.test_strftime_y2k) (year=70, specifier='C')
cpython-3.14> ----------------------------------------------------------------------
cpython-3.14> Traceback (most recent call last):
cpython-3.14> File "/build/Python-3.14.0a3/Lib/test/datetimetester.py", line 1814, in test_strftime_y2k
cpython-3.14> self.assertEqual(d.strftime(f"%{specifier}"), expected)
cpython-3.14> ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cpython-3.14> AssertionError: '0' != '00'
cpython-3.14> - 0
cpython-3.14> + 00
cpython-3.14> ? +
cpython-3.14>
cpython-3.14>
cpython-3.14> ======================================================================
cpython-3.14> FAIL: test_strftime_y2k (test.datetimetester.TestDateTime_Fast.test_strftime_y2k) (year=99, specifier='F')
cpython-3.14> ----------------------------------------------------------------------
cpython-3.14> Traceback (most recent call last):
cpython-3.14> File "/build/Python-3.14.0a3/Lib/test/datetimetester.py", line 1814, in test_strftime_y2k
cpython-3.14> self.assertEqual(d.strftime(f"%{specifier}"), expected)
cpython-3.14> ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cpython-3.14> AssertionError: '99-01-01' != '0099-01-01'
cpython-3.14> - 99-01-01
cpython-3.14> + 0099-01-01
cpython-3.14> ? ++
cpython-3.14>
cpython-3.14>
cpython-3.14> ======================================================================
cpython-3.14> FAIL: test_strftime_y2k (test.datetimetester.TestDateTime_Fast.test_strftime_y2k) (year=99, specifier='C')
cpython-3.14> ----------------------------------------------------------------------
cpython-3.14> Traceback (most recent call last):
cpython-3.14> File "/build/Python-3.14.0a3/Lib/test/datetimetester.py", line 1814, in test_strftime_y2k
cpython-3.14> self.assertEqual(d.strftime(f"%{specifier}"), expected)
cpython-3.14> ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cpython-3.14> AssertionError: '0' != '00'
cpython-3.14> - 0
cpython-3.14> + 00
cpython-3.14> ? +
cpython-3.14>
cpython-3.14>
cpython-3.14> ======================================================================
cpython-3.14> FAIL: test_strftime_y2k (test.datetimetester.TestDateTime_Fast.test_strftime_y2k) (year=99, specifier='F')
cpython-3.14> ----------------------------------------------------------------------
cpython-3.14> Traceback (most recent call last):
cpython-3.14> File "/build/Python-3.14.0a3/Lib/test/datetimetester.py", line 1814, in test_strftime_y2k
cpython-3.14> self.assertEqual(d.strftime(f"%{specifier}"), expected)
cpython-3.14> ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cpython-3.14> AssertionError: '99-01-01' != '0099-01-01'
cpython-3.14> - 99-01-01
cpython-3.14> + 0099-01-01
cpython-3.14> ? ++
cpython-3.14>
cpython-3.14>
cpython-3.14> ======================================================================
cpython-3.14> FAIL: test_strftime_y2k (test.datetimetester.TestDateTime_Fast.test_strftime_y2k) (year=99, specifier='C')
cpython-3.14> ----------------------------------------------------------------------
cpython-3.14> Traceback (most recent call last):
cpython-3.14> File "/build/Python-3.14.0a3/Lib/test/datetimetester.py", line 1814, in test_strftime_y2k
cpython-3.14> self.assertEqual(d.strftime(f"%{specifier}"), expected)
cpython-3.14> ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cpython-3.14> AssertionError: '0' != '00'
cpython-3.14> - 0
cpython-3.14> + 00
cpython-3.14> ? +
cpython-3.14>
cpython-3.14>
cpython-3.14> ======================================================================
cpython-3.14> FAIL: test_strftime_y2k (test.datetimetester.TestDateTime_Fast.test_strftime_y2k) (year=999, specifier='F')
cpython-3.14> ----------------------------------------------------------------------
cpython-3.14> Traceback (most recent call last):
cpython-3.14> File "/build/Python-3.14.0a3/Lib/test/datetimetester.py", line 1814, in test_strftime_y2k
cpython-3.14> self.assertEqual(d.strftime(f"%{specifier}"), expected)
cpython-3.14> ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cpython-3.14> AssertionError: '999-01-01' != '0999-01-01'
cpython-3.14> - 999-01-01
cpython-3.14> + 0999-01-01
cpython-3.14> ? +
cpython-3.14>
cpython-3.14>
cpython-3.14> ======================================================================
cpython-3.14> FAIL: test_strftime_y2k (test.datetimetester.TestDateTime_Fast.test_strftime_y2k) (year=999, specifier='C')
cpython-3.14> ----------------------------------------------------------------------
cpython-3.14> Traceback (most recent call last):
cpython-3.14> File "/build/Python-3.14.0a3/Lib/test/datetimetester.py", line 1814, in test_strftime_y2k
cpython-3.14> self.assertEqual(d.strftime(f"%{specifier}"), expected)
cpython-3.14> ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cpython-3.14> AssertionError: '9' != '09'
cpython-3.14> - 9
cpython-3.14> + 09
cpython-3.14> ? +
cpython-3.14>
cpython-3.14>
cpython-3.14> ======================================================================
cpython-3.14> FAIL: test_strftime_y2k (test.datetimetester.TestDateTimeTZ_Fast.test_strftime_y2k) (year=1, specifier='F')
cpython-3.14> ----------------------------------------------------------------------
cpython-3.14> Traceback (most recent call last):
cpython-3.14> File "/build/Python-3.14.0a3/Lib/test/datetimetester.py", line 1814, in test_strftime_y2k
cpython-3.14> self.assertEqual(d.strftime(f"%{specifier}"), expected)
cpython-3.14> ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cpython-3.14> AssertionError: '1-01-01' != '0001-01-01'
cpython-3.14> - 1-01-01
cpython-3.14> + 0001-01-01
cpython-3.14> ? +++
cpython-3.14>
cpython-3.14>
cpython-3.14> ======================================================================
cpython-3.14> FAIL: test_strftime_y2k (test.datetimetester.TestDateTimeTZ_Fast.test_strftime_y2k) (year=1, specifier='C')
cpython-3.14> ----------------------------------------------------------------------
cpython-3.14> Traceback (most recent call last):
cpython-3.14> File "/build/Python-3.14.0a3/Lib/test/datetimetester.py", line 1814, in test_strftime_y2k
cpython-3.14> self.assertEqual(d.strftime(f"%{specifier}"), expected)
cpython-3.14> ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cpython-3.14> AssertionError: '0' != '00'
cpython-3.14> - 0
cpython-3.14> + 00
cpython-3.14> ? +
cpython-3.14>
cpython-3.14>
cpython-3.14> ======================================================================
cpython-3.14> FAIL: test_strftime_y2k (test.datetimetester.TestDateTimeTZ_Fast.test_strftime_y2k) (year=48, specifier='F')
cpython-3.14> ----------------------------------------------------------------------
cpython-3.14> Traceback (most recent call last):
cpython-3.14> File "/build/Python-3.14.0a3/Lib/test/datetimetester.py", line 1814, in test_strftime_y2k
cpython-3.14> self.assertEqual(d.strftime(f"%{specifier}"), expected)
cpython-3.14> ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cpython-3.14> AssertionError: '48-01-01' != '0048-01-01'
cpython-3.14> - 48-01-01
cpython-3.14> + 0048-01-01
cpython-3.14> ? ++
cpython-3.14>
cpython-3.14>
cpython-3.14> ======================================================================
cpython-3.14> FAIL: test_strftime_y2k (test.datetimetester.TestDateTimeTZ_Fast.test_strftime_y2k) (year=48, specifier='C')
cpython-3.14> ----------------------------------------------------------------------
cpython-3.14> Traceback (most recent call last):
cpython-3.14> File "/build/Python-3.14.0a3/Lib/test/datetimetester.py", line 1814, in test_strftime_y2k
cpython-3.14> self.assertEqual(d.strftime(f"%{specifier}"), expected)
cpython-3.14> ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cpython-3.14> AssertionError: '0' != '00'
cpython-3.14> - 0
cpython-3.14> + 00
cpython-3.14> ? +
cpython-3.14>
cpython-3.14>
cpython-3.14> ======================================================================
cpython-3.14> FAIL: test_strftime_y2k (test.datetimetester.TestDateTimeTZ_Fast.test_strftime_y2k) (year=70, specifier='F')
cpython-3.14> ----------------------------------------------------------------------
cpython-3.14> Traceback (most recent call last):
cpython-3.14> File "/build/Python-3.14.0a3/Lib/test/datetimetester.py", line 1814, in test_strftime_y2k
cpython-3.14> self.assertEqual(d.strftime(f"%{specifier}"), expected)
cpython-3.14> ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cpython-3.14> AssertionError: '70-01-01' != '0070-01-01'
cpython-3.14> - 70-01-01
cpython-3.14> + 0070-01-01
cpython-3.14> ? ++
cpython-3.14>
cpython-3.14>
cpython-3.14> ======================================================================
cpython-3.14> FAIL: test_strftime_y2k (test.datetimetester.TestDateTimeTZ_Fast.test_strftime_y2k) (year=70, specifier='C')
cpython-3.14> ----------------------------------------------------------------------
cpython-3.14> Traceback (most recent call last):
cpython-3.14> File "/build/Python-3.14.0a3/Lib/test/datetimetester.py", line 1814, in test_strftime_y2k
cpython-3.14> self.assertEqual(d.strftime(f"%{specifier}"), expected)
cpython-3.14> ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cpython-3.14> AssertionError: '0' != '00'
cpython-3.14> - 0
cpython-3.14> + 00
cpython-3.14> ? +
cpython-3.14>
cpython-3.14>
cpython-3.14> ======================================================================
cpython-3.14> FAIL: test_strftime_y2k (test.datetimetester.TestDateTimeTZ_Fast.test_strftime_y2k) (year=99, specifier='F')
cpython-3.14> ----------------------------------------------------------------------
cpython-3.14> Traceback (most recent call last):
cpython-3.14> File "/build/Python-3.14.0a3/Lib/test/datetimetester.py", line 1814, in test_strftime_y2k
cpython-3.14> self.assertEqual(d.strftime(f"%{specifier}"), expected)
cpython-3.14> ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cpython-3.14> AssertionError: '99-01-01' != '0099-01-01'
cpython-3.14> - 99-01-01
cpython-3.14> + 0099-01-01
cpython-3.14> ? ++
cpython-3.14>
cpython-3.14>
cpython-3.14> ======================================================================
cpython-3.14> FAIL: test_strftime_y2k (test.datetimetester.TestDateTimeTZ_Fast.test_strftime_y2k) (year=99, specifier='C')
cpython-3.14> ----------------------------------------------------------------------
cpython-3.14> Traceback (most recent call last):
cpython-3.14> File "/build/Python-3.14.0a3/Lib/test/datetimetester.py", line 1814, in test_strftime_y2k
cpython-3.14> self.assertEqual(d.strftime(f"%{specifier}"), expected)
cpython-3.14> ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cpython-3.14> AssertionError: '0' != '00'
cpython-3.14> - 0
cpython-3.14> + 00
cpython-3.14> ? +
cpython-3.14>
cpython-3.14>
cpython-3.14> ======================================================================
cpython-3.14> FAIL: test_strftime_y2k (test.datetimetester.TestDateTimeTZ_Fast.test_strftime_y2k) (year=99, specifier='F')
cpython-3.14> ----------------------------------------------------------------------
cpython-3.14> Traceback (most recent call last):
cpython-3.14> File "/build/Python-3.14.0a3/Lib/test/datetimetester.py", line 1814, in test_strftime_y2k
cpython-3.14> self.assertEqual(d.strftime(f"%{specifier}"), expected)
cpython-3.14> ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cpython-3.14> AssertionError: '99-01-01' != '0099-01-01'
cpython-3.14> - 99-01-01
cpython-3.14> + 0099-01-01
cpython-3.14> ? ++
cpython-3.14>
cpython-3.14>
cpython-3.14> ======================================================================
cpython-3.14> FAIL: test_strftime_y2k (test.datetimetester.TestDateTimeTZ_Fast.test_strftime_y2k) (year=99, specifier='C')
cpython-3.14> ----------------------------------------------------------------------
cpython-3.14> Traceback (most recent call last):
cpython-3.14> File "/build/Python-3.14.0a3/Lib/test/datetimetester.py", line 1814, in test_strftime_y2k
cpython-3.14> self.assertEqual(d.strftime(f"%{specifier}"), expected)
cpython-3.14> ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cpython-3.14> AssertionError: '0' != '00'
cpython-3.14> - 0
cpython-3.14> + 00
cpython-3.14> ? +
cpython-3.14>
cpython-3.14>
cpython-3.14> ======================================================================
cpython-3.14> FAIL: test_strftime_y2k (test.datetimetester.TestDateTimeTZ_Fast.test_strftime_y2k) (year=999, specifier='F')
cpython-3.14> ----------------------------------------------------------------------
cpython-3.14> Traceback (most recent call last):
cpython-3.14> File "/build/Python-3.14.0a3/Lib/test/datetimetester.py", line 1814, in test_strftime_y2k
cpython-3.14> self.assertEqual(d.strftime(f"%{specifier}"), expected)
cpython-3.14> ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cpython-3.14> AssertionError: '999-01-01' != '0999-01-01'
cpython-3.14> - 999-01-01
cpython-3.14> + 0999-01-01
cpython-3.14> ? +
cpython-3.14>
cpython-3.14>
cpython-3.14> ======================================================================
cpython-3.14> FAIL: test_strftime_y2k (test.datetimetester.TestDateTimeTZ_Fast.test_strftime_y2k) (year=999, specifier='C')
cpython-3.14> ----------------------------------------------------------------------
cpython-3.14> Traceback (most recent call last):
cpython-3.14> File "/build/Python-3.14.0a3/Lib/test/datetimetester.py", line 1814, in test_strftime_y2k
cpython-3.14> self.assertEqual(d.strftime(f"%{specifier}"), expected)
cpython-3.14> ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cpython-3.14> AssertionError: '9' != '09'
cpython-3.14> - 9
cpython-3.14> + 09
cpython-3.14> ? +
cpython-3.14>
cpython-3.14>
cpython-3.14> ======================================================================
cpython-3.14> FAIL: test_strftime_y2k (test.datetimetester.TestSubclassDateTime_Fast.test_strftime_y2k) (year=1, specifier='F')
cpython-3.14> ----------------------------------------------------------------------
cpython-3.14> Traceback (most recent call last):
cpython-3.14> File "/build/Python-3.14.0a3/Lib/test/datetimetester.py", line 1814, in test_strftime_y2k
cpython-3.14> self.assertEqual(d.strftime(f"%{specifier}"), expected)
cpython-3.14> ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cpython-3.14> AssertionError: '1-01-01' != '0001-01-01'
cpython-3.14> - 1-01-01
cpython-3.14> + 0001-01-01
cpython-3.14> ? +++
cpython-3.14>
cpython-3.14>
cpython-3.14> ======================================================================
cpython-3.14> FAIL: test_strftime_y2k (test.datetimetester.TestSubclassDateTime_Fast.test_strftime_y2k) (year=1, specifier='C')
cpython-3.14> ----------------------------------------------------------------------
cpython-3.14> Traceback (most recent call last):
cpython-3.14> File "/build/Python-3.14.0a3/Lib/test/datetimetester.py", line 1814, in test_strftime_y2k
cpython-3.14> self.assertEqual(d.strftime(f"%{specifier}"), expected)
cpython-3.14> ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cpython-3.14> AssertionError: '0' != '00'
cpython-3.14> - 0
cpython-3.14> + 00
cpython-3.14> ? +
cpython-3.14>
cpython-3.14>
cpython-3.14> ======================================================================
cpython-3.14> FAIL: test_strftime_y2k (test.datetimetester.TestSubclassDateTime_Fast.test_strftime_y2k) (year=48, specifier='F')
cpython-3.14> ----------------------------------------------------------------------
cpython-3.14> Traceback (most recent call last):
cpython-3.14> File "/build/Python-3.14.0a3/Lib/test/datetimetester.py", line 1814, in test_strftime_y2k
cpython-3.14> self.assertEqual(d.strftime(f"%{specifier}"), expected)
cpython-3.14> ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cpython-3.14> AssertionError: '48-01-01' != '0048-01-01'
cpython-3.14> - 48-01-01
cpython-3.14> + 0048-01-01
cpython-3.14> ? ++
cpython-3.14>
cpython-3.14>
cpython-3.14> ======================================================================
cpython-3.14> FAIL: test_strftime_y2k (test.datetimetester.TestSubclassDateTime_Fast.test_strftime_y2k) (year=48, specifier='C')
cpython-3.14> ----------------------------------------------------------------------
cpython-3.14> Traceback (most recent call last):
cpython-3.14> File "/build/Python-3.14.0a3/Lib/test/datetimetester.py", line 1814, in test_strftime_y2k
cpython-3.14> self.assertEqual(d.strftime(f"%{specifier}"), expected)
cpython-3.14> ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cpython-3.14> AssertionError: '0' != '00'
cpython-3.14> - 0
cpython-3.14> + 00
cpython-3.14> ? +
cpython-3.14>
cpython-3.14>
cpython-3.14> ======================================================================
cpython-3.14> FAIL: test_strftime_y2k (test.datetimetester.TestSubclassDateTime_Fast.test_strftime_y2k) (year=70, specifier='F')
cpython-3.14> ----------------------------------------------------------------------
cpython-3.14> Traceback (most recent call last):
cpython-3.14> File "/build/Python-3.14.0a3/Lib/test/datetimetester.py", line 1814, in test_strftime_y2k
cpython-3.14> self.assertEqual(d.strftime(f"%{specifier}"), expected)
cpython-3.14> ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cpython-3.14> AssertionError: '70-01-01' != '0070-01-01'
cpython-3.14> - 70-01-01
cpython-3.14> + 0070-01-01
cpython-3.14> ? ++
cpython-3.14>
cpython-3.14>
cpython-3.14> ======================================================================
cpython-3.14> FAIL: test_strftime_y2k (test.datetimetester.TestSubclassDateTime_Fast.test_strftime_y2k) (year=70, specifier='C')
cpython-3.14> ----------------------------------------------------------------------
cpython-3.14> Traceback (most recent call last):
cpython-3.14> File "/build/Python-3.14.0a3/Lib/test/datetimetester.py", line 1814, in test_strftime_y2k
cpython-3.14> self.assertEqual(d.strftime(f"%{specifier}"), expected)
cpython-3.14> ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cpython-3.14> AssertionError: '0' != '00'
cpython-3.14> - 0
cpython-3.14> + 00
cpython-3.14> ? +
cpython-3.14>
cpython-3.14>
cpython-3.14> ======================================================================
cpython-3.14> FAIL: test_strftime_y2k (test.datetimetester.TestSubclassDateTime_Fast.test_strftime_y2k) (year=99, specifier='F')
cpython-3.14> ----------------------------------------------------------------------
cpython-3.14> Traceback (most recent call last):
cpython-3.14> File "/build/Python-3.14.0a3/Lib/test/datetimetester.py", line 1814, in test_strftime_y2k
cpython-3.14> self.assertEqual(d.strftime(f"%{specifier}"), expected)
cpython-3.14> ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cpython-3.14> AssertionError: '99-01-01' != '0099-01-01'
cpython-3.14> - 99-01-01
cpython-3.14> + 0099-01-01
cpython-3.14> ? ++
cpython-3.14>
cpython-3.14>
cpython-3.14> ======================================================================
cpython-3.14> FAIL: test_strftime_y2k (test.datetimetester.TestSubclassDateTime_Fast.test_strftime_y2k) (year=99, specifier='C')
cpython-3.14> ----------------------------------------------------------------------
cpython-3.14> Traceback (most recent call last):
cpython-3.14> File "/build/Python-3.14.0a3/Lib/test/datetimetester.py", line 1814, in test_strftime_y2k
cpython-3.14> self.assertEqual(d.strftime(f"%{specifier}"), expected)
cpython-3.14> ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cpython-3.14> AssertionError: '0' != '00'
cpython-3.14> - 0
cpython-3.14> + 00
cpython-3.14> ? +
cpython-3.14>
cpython-3.14>
cpython-3.14> ======================================================================
cpython-3.14> FAIL: test_strftime_y2k (test.datetimetester.TestSubclassDateTime_Fast.test_strftime_y2k) (year=99, specifier='F')
cpython-3.14> ----------------------------------------------------------------------
cpython-3.14> Traceback (most recent call last):
cpython-3.14> File "/build/Python-3.14.0a3/Lib/test/datetimetester.py", line 1814, in test_strftime_y2k
cpython-3.14> self.assertEqual(d.strftime(f"%{specifier}"), expected)
cpython-3.14> ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cpython-3.14> AssertionError: '99-01-01' != '0099-01-01'
cpython-3.14> - 99-01-01
cpython-3.14> + 0099-01-01
cpython-3.14> ? ++
cpython-3.14>
cpython-3.14>
cpython-3.14> ======================================================================
cpython-3.14> FAIL: test_strftime_y2k (test.datetimetester.TestSubclassDateTime_Fast.test_strftime_y2k) (year=99, specifier='C')
cpython-3.14> ----------------------------------------------------------------------
cpython-3.14> Traceback (most recent call last):
cpython-3.14> File "/build/Python-3.14.0a3/Lib/test/datetimetester.py", line 1814, in test_strftime_y2k
cpython-3.14> self.assertEqual(d.strftime(f"%{specifier}"), expected)
cpython-3.14> ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cpython-3.14> AssertionError: '0' != '00'
cpython-3.14> - 0
cpython-3.14> + 00
cpython-3.14> ? +
cpython-3.14>
cpython-3.14>
cpython-3.14> ======================================================================
cpython-3.14> FAIL: test_strftime_y2k (test.datetimetester.TestSubclassDateTi
cpython-3.14> me_Fast.test_strftime_y2k) (year=999, specifier='F')
cpython-3.14> ----------------------------------------------------------------------
cpython-3.14> Traceback (most recent call last):
cpython-3.14> File "/build/Python-3.14.0a3/Lib/test/datetimetester.py", line 1814, in test_strftime_y2k
cpython-3.14> self.assertEqual(d.strftime(f"%{specifier}"), expected)
cpython-3.14> ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cpython-3.14> AssertionError: '999-01-01' != '0999-01-01'
cpython-3.14> - 999-01-01
cpython-3.14> + 0999-01-01
cpython-3.14> ? +
cpython-3.14>
cpython-3.14>
cpython-3.14> ======================================================================
cpython-3.14> FAIL: test_strftime_y2k (test.datetimetester.TestSubclassDateTime_Fast.test_strftime_y2k) (year=999, specifier='C')
cpython-3.14> ----------------------------------------------------------------------
cpython-3.14> Traceback (most recent call last):
cpython-3.14> File "/build/Python-3.14.0a3/Lib/test/datetimetester.py", line 1814, in test_strftime_y2k
cpython-3.14> self.assertEqual(d.strftime(f"%{specifier}"), expected)
cpython-3.14> ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cpython-3.14> AssertionError: '9' != '09'
cpython-3.14> - 9
cpython-3.14> + 09
cpython-3.14> ? +
cpython-3.14>
cpython-3.14>
cpython-3.14> ----------------------------------------------------------------------
cpython-3.14> Ran 1058 tests in 3.495s
cpython-3.14>
cpython-3.14> FAILED (failures=48, skipped=52)
cpython-3.14> test test_datetime failed
</pre>
</details>
You can see the run in CI [here](https://github.com/astral-sh/python-build-standalone/actions/runs/12420749227/job/34679030971?pr=443), though it does not include the test output because you have to hack the test suite to show verbose output with `--pgo`.
I believe this is basically a duplicate of https://github.com/python/cpython/issues/123681, but I figured I'd open a issue for discoverability.
### CPython versions tested on:
3.14
### Operating systems tested on:
Linux
<!-- gh-linked-prs -->
### Linked PRs
* gh-128106
<!-- /gh-linked-prs -->
| bb2dfadb9221fa3035fda42a2c153c831013e3d3 | bb73426cafb78691b249ffa50f1872ab6f899d4a |
python/cpython | python__cpython-128297 | # Race between _PyObject_GenericGetAttrWithDict and ensure_nonmanaged_dict under free-threading
# Bug report
### Bug description:
Under Python 3.13.1t build with thread-sanitizer:
```python
import concurrent.futures
import functools
import threading
num_threads = 100
def closure(b, o):
b.wait()
getattr(o, "foo", None)
o.foo = 42
with concurrent.futures.ThreadPoolExecutor(max_workers=num_threads) as executor:
for _ in range(100):
b = threading.Barrier(num_threads)
o = functools.partial(lambda x: x, 42)
for _ in range(num_threads):
executor.submit(functools.partial(closure, b, o))
```
Get (it may take a few runs):
```
WARNING: ThreadSanitizer: data race (pid=239136)
Read of size 8 at 0x7fa5e69e6a28 by thread T91:
#0 _PyObject_GenericGetAttrWithDict /usr/local/google/home/phawkins/p/cpython/Objects/object.c:1665:24 (python3.13+0x2960a5) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#1 PyObject_GetOptionalAttr /usr/local/google/home/phawkins/p/cpython/Objects/object.c:1266:19 (python3.13+0x2930c4) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#2 builtin_getattr /usr/local/google/home/phawkins/p/cpython/Python/bltinmodule.c:1200:13 (python3.13+0x3d8bf9) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#3 cfunction_vectorcall_FASTCALL /usr/local/google/home/phawkins/p/cpython/Objects/methodobject.c:425:24 (python3.13+0x289efb) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#4 _PyObject_VectorcallTstate /usr/local/google/home/phawkins/p/cpython/./Include/internal/pycore_call.h:168:11 (python3.13+0x1eafaa) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#5 PyObject_Vectorcall /usr/local/google/home/phawkins/p/cpython/Objects/call.c:327:12 (python3.13+0x1eafaa)
#6 _PyEval_EvalFrameDefault /usr/local/google/home/phawkins/p/cpython/Python/generated_cases.c.h:813:23 (python3.13+0x3e24fb) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#7 _PyEval_EvalFrame /usr/local/google/home/phawkins/p/cpython/./Include/internal/pycore_ceval.h:119:16 (python3.13+0x3de62a) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#8 _PyEval_Vector /usr/local/google/home/phawkins/p/cpython/Python/ceval.c:1811:12 (python3.13+0x3de62a)
#9 _PyFunction_Vectorcall /usr/local/google/home/phawkins/p/cpython/Objects/call.c (python3.13+0x1eb61f) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#10 _PyObject_VectorcallTstate /usr/local/google/home/phawkins/p/cpython/./Include/internal/pycore_call.h:168:11 (python3.13+0x571bb2) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#11 partial_vectorcall /usr/local/google/home/phawkins/p/cpython/./Modules/_functoolsmodule.c:252:16 (python3.13+0x571bb2)
#12 _PyVectorcall_Call /usr/local/google/home/phawkins/p/cpython/Objects/call.c:273:16 (python3.13+0x1eb293) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#13 _PyObject_Call /usr/local/google/home/phawkins/p/cpython/Objects/call.c:348:16 (python3.13+0x1eb293)
#14 PyObject_Call /usr/local/google/home/phawkins/p/cpython/Objects/call.c:373:12 (python3.13+0x1eb315) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#15 _PyEval_EvalFrameDefault /usr/local/google/home/phawkins/p/cpython/Python/generated_cases.c.h:1355:26 (python3.13+0x3e46e2) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#16 _PyEval_EvalFrame /usr/local/google/home/phawkins/p/cpython/./Include/internal/pycore_ceval.h:119:16 (python3.13+0x3de62a) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#17 _PyEval_Vector /usr/local/google/home/phawkins/p/cpython/Python/ceval.c:1811:12 (python3.13+0x3de62a)
#18 _PyFunction_Vectorcall /usr/local/google/home/phawkins/p/cpython/Objects/call.c (python3.13+0x1eb61f) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#19 _PyObject_VectorcallTstate /usr/local/google/home/phawkins/p/cpython/./Include/internal/pycore_call.h:168:11 (python3.13+0x1ef5ef) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#20 method_vectorcall /usr/local/google/home/phawkins/p/cpython/Objects/classobject.c:70:20 (python3.13+0x1ef5ef)
#21 _PyVectorcall_Call /usr/local/google/home/phawkins/p/cpython/Objects/call.c:273:16 (python3.13+0x1eb293) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#22 _PyObject_Call /usr/local/google/home/phawkins/p/cpython/Objects/call.c:348:16 (python3.13+0x1eb293)
#23 PyObject_Call /usr/local/google/home/phawkins/p/cpython/Objects/call.c:373:12 (python3.13+0x1eb315) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#24 thread_run /usr/local/google/home/phawkins/p/cpython/./Modules/_threadmodule.c:337:21 (python3.13+0x564292) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#25 pythread_wrapper /usr/local/google/home/phawkins/p/cpython/Python/thread_pthread.h:243:5 (python3.13+0x4bd637) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
Previous atomic write of size 8 at 0x7fa5e69e6a28 by thread T18:
#0 _Py_atomic_store_ptr_release /usr/local/google/home/phawkins/p/cpython/./Include/cpython/pyatomic_gcc.h:501:3 (python3.13+0x272a17) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#1 ensure_nonmanaged_dict /usr/local/google/home/phawkins/p/cpython/Objects/dictobject.c:7275:9 (python3.13+0x272a17)
#2 _PyObjectDict_SetItem /usr/local/google/home/phawkins/p/cpython/Objects/dictobject.c:7311:12 (python3.13+0x272aee) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#3 _PyObject_GenericSetAttrWithDict /usr/local/google/home/phawkins/p/cpython/Objects/object.c:1791:19 (python3.13+0x297c8e) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#4 PyObject_GenericSetAttr /usr/local/google/home/phawkins/p/cpython/Objects/object.c:1819:12 (python3.13+0x298667) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#5 PyObject_SetAttr /usr/local/google/home/phawkins/p/cpython/Objects/object.c:1385:15 (python3.13+0x294f8a) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#6 _PyEval_EvalFrameDefault /usr/local/google/home/phawkins/p/cpython/Python/generated_cases.c.h:5488:27 (python3.13+0x3f3f6d) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#7 _PyEval_EvalFrame /usr/local/google/home/phawkins/p/cpython/./Include/internal/pycore_ceval.h:119:16 (python3.13+0x3de62a) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#8 _PyEval_Vector /usr/local/google/home/phawkins/p/cpython/Python/ceval.c:1811:12 (python3.13+0x3de62a)
#9 _PyFunction_Vectorcall /usr/local/google/home/phawkins/p/cpython/Objects/call.c (python3.13+0x1eb61f) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#10 _PyObject_VectorcallTstate /usr/local/google/home/phawkins/p/cpython/./Include/internal/pycore_call.h:168:11 (python3.13+0x571bb2) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#11 partial_vectorcall /usr/local/google/home/phawkins/p/cpython/./Modules/_functoolsmodule.c:252:16 (python3.13+0x571bb2)
#12 _PyVectorcall_Call /usr/local/google/home/phawkins/p/cpython/Objects/call.c:273:16 (python3.13+0x1eb293) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#13 _PyObject_Call /usr/local/google/home/phawkins/p/cpython/Objects/call.c:348:16 (python3.13+0x1eb293)
#14 PyObject_Call /usr/local/google/home/phawkins/p/cpython/Objects/call.c:373:12 (python3.13+0x1eb315) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#15 _PyEval_EvalFrameDefault /usr/local/google/home/phawkins/p/cpython/Python/generated_cases.c.h:1355:26 (python3.13+0x3e46e2) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#16 _PyEval_EvalFrame /usr/local/google/home/phawkins/p/cpython/./Include/internal/pycore_ceval.h:119:16 (python3.13+0x3de62a) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#17 _PyEval_Vector /usr/local/google/home/phawkins/p/cpython/Python/ceval.c:1811:12 (python3.13+0x3de62a)
#18 _PyFunction_Vectorcall /usr/local/google/home/phawkins/p/cpython/Objects/call.c (python3.13+0x1eb61f) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#19 _PyObject_VectorcallTstate /usr/local/google/home/phawkins/p/cpython/./Include/internal/pycore_call.h:168:11 (python3.13+0x1ef5ef) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#20 method_vectorcall /usr/local/google/home/phawkins/p/cpython/Objects/classobject.c:70:20 (python3.13+0x1ef5ef)
#21 _PyVectorcall_Call /usr/local/google/home/phawkins/p/cpython/Objects/call.c:273:16 (python3.13+0x1eb293) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#22 _PyObject_Call /usr/local/google/home/phawkins/p/cpython/Objects/call.c:348:16 (python3.13+0x1eb293)
#23 PyObject_Call /usr/local/google/home/phawkins/p/cpython/Objects/call.c:373:12 (python3.13+0x1eb315) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#24 thread_run /usr/local/google/home/phawkins/p/cpython/./Modules/_threadmodule.c:337:21 (python3.13+0x564292) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
#25 pythread_wrapper /usr/local/google/home/phawkins/p/cpython/Python/thread_pthread.h:243:5 (python3.13+0x4bd637) (BuildId: 9c1c16fb1bb8a435fa6fa4c6944da5d41f654e96)
```
### CPython versions tested on:
3.13
### Operating systems tested on:
Linux
<!-- gh-linked-prs -->
### Linked PRs
* gh-128297
* gh-129979
<!-- /gh-linked-prs -->
| 47d2cb8eb7595df5940225867dbb66b6dd59413a | fe4dd07a84ba423179a93ed84bdcc2b4c99b35a9 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.