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-117989 | # docs (easy): Add reference to the Python docs theme gh repo
The paragraph should be added in bugs.html
```
If you find a bug in the theme (HTML / CSS / JavaScript) of the
documentation, please submit a bug report on the `python-doc-theme bug
tracker <https://github.com/python/python-docs-theme>`_.
```
_Origi... | 468b9aeb922470c26275ce7dda1e6d570a3323f3 | 17ed54bc96f0ae2420aa380bab004baa5a18d4d1 |
python/cpython | python__cpython-117988 | # tarfile.py: TarFile.addfile not adding all files
# Bug report
### Bug description:
I would expect both files `A` and `B` to be stored in the tar file. However, only `A` is archived.
```sh
# creating the test directory
!rm -rf test1.tar test1
!mkdir test1
!echo thisisa >test1/A
!echo thisisb >test1/B
```
```Pytho... | 15b3555e4a47ec925c965778a415dc11f0f981fd | 3e7d990a09f0928050b2b0c85f724c2bce13fcbb |
python/cpython | python__cpython-116918 | # Why do we have two counters for function versions?
In the interpreter state there are two separate counters that are used to generate unique versions for code and function objects. Both counters share the following properties:
- The counter is an unsigned 32-bit int initialized to `1`
- When a new version is neede... | 7e1f38f2de8f93de362433203faa5605a0c47f0e | 76d086890790f1bfbe05d12e02cadb539db5b0b1 |
python/cpython | python__cpython-116934 | # ``test_capi`` leaks references
# Bug report
### Bug description:
```python
./python -m test -R 3:3 test_capi
Using random seed: 2023738098
0:00:00 load avg: 1.04 Run 1 test sequentially
0:00:00 load avg: 1.04 [1/1] test_capi
beginning 6 repetitions. Showing number of leaks (. for 0 or less, X for 10 or more)
123:4... | b3f0c1591a85d335c89dc38a177d116d2017502d | 2982bdb936f76518b29cf7de356eb5fafd22d112 |
python/cpython | python__cpython-117044 | # TSan: data race in pending calls
# Bug report
### Bug description:
Running test_capi with TSan enabled and the GIL enabled yields the following race condition:
```
test_isolated_subinterpreter (test.test_capi.test_misc.TestPendingCalls.test_isolated_subinterpreter) ...
==================
WARNING: ThreadSa... | 9221ef2d8cb7f4cf37592eb650d4c8f972033000 | fc4599800778f9b130d5e336deadbdeb5bd3e5ee |
python/cpython | python__cpython-116903 | # Deprecate support of false values in urllib.parse.parse_qsl()
`urllib.parse.parse_qsl()` returns `[]` for any false value. There were no tests for this, so it was broken by accident in #115771 and restored in #116764.
Historically, the special case was needed to circumvent the fact that `''.split('&')` returns `[... | 7577307ebdaeef6702b639e22a896080e81aae4e | 03924b5deeb766fabd53ced28ba707e4dd08fb60 |
python/cpython | python__cpython-117018 | # CIFuzz build failures - _freeze_module segfaults during the build, fuzz testing doesn't start.
PR authors and core devs have been seeing CIFuzz failures on PRs not related to their changes of late. These are non-blocking, but confusing.
The CIFuzz build step is failing, it seems that _freeze_module crashes:
`... | 2cedd25c14d3acfdcb5e8ee55132ce3e334ab8fe | eefff682f09394fe4f18b7d7c6ac4c635caadd02 |
python/cpython | python__cpython-116885 | # NULL in lexical analysis of f-string
# Documentation
This is somewhat related to #116580. There are two references to NULL in the description of f-strings that don't have a clear meaning.
```
format_spec ::= (literal_char | NULL | replacement_field)*
literal_char ::= <any code point except "{", ... | 4e45c6c54a9457b1ca5b4cf3aa2843b7218d4414 | 3a99f5c5f34dc7b67597ca7230da355d92927c71 |
python/cpython | python__cpython-116880 | # pystats: New optimizer stats for _Py_uop_analyze_and_optimize are missing from the table
# Bug report
### Bug description:
The new stats added in #115085 were not added to the summarize_stats.py script so are therefore missing from the tables.
### CPython versions tested on:
CPython main branch
### Operating sy... | 1a33513f99bf4a9e5122b9cd82945879e73ff44c | bee7e290cdedb17e06f473a2f318c720ba766852 |
python/cpython | python__cpython-116878 | # Update `wheel` to `0.43.0` in `Lib/test/wheeldata`
# Feature or enhancement
The `test_cppext` test is currently disabled in `--disable-gil` builds because the bundled version of `wheel` did not support the "t" flag in the ABI.
This is now fixed and released upstream in wheel 0.43.0.
Let's update the bundled wheel... | c80d2d3263b3caf579777fd2a98399aeb3497f23 | 52ef4430a9b3e212fe9200675cddede77b90785b |
python/cpython | python__cpython-116930 | # Improve name suggestions for NameError/AttributeError by respecting underscore conventions
# Feature or enhancement
### Proposal:
## Problem description
In more recent versions of Python, for uncaught `NameError`s and `AttributeErrors`, the system tries to suggest names that might have been typoed:
```pyth... | 0085c3ae8f067abd4f6540d0f6dd2fb13107618e | d6fa1d4beef2bf9d83048469667e0ba5f2b41068 |
python/cpython | python__cpython-116950 | # Python 3.12.2 headers contain non-C90-compliant code
# Bug report
### Bug description:
When compiling a program that links against the Python libraries (and uses their headerfiles) with the `-Werror=declaration-after-statement` compiler flag enabled, the following error occurs:
```
/usr/include/python3.12/object.... | a9c304cf020e2fa3ae78fd88359dfc808c9dd639 | 590a26010d5d7f27890f89820645580bb8f28547 |
python/cpython | python__cpython-116829 | # Free-threaded builds can experience heavy contention on `PyType_IsSubtype`
# Bug report
### Bug description:
`PyType_IsSubtype` takes the type lock to ensure that MRO is being accessed in a thread-safe manner as it needs to read and incref it. This can result in heavy contention in some pretty common scenarios (e... | 280de3661b42af9b3fe792764d0b09f403df5223 | ebf29b3a02d5b42a747e271e9cfc4dd73c01ebe6 |
python/cpython | python__cpython-116861 | # `test_parserhack` in `test_future` is outdated
# Bug report
This test is written for python2.6, which is long gone. It tests some implementation detail with is also long gone:
https://github.com/python/cpython/blob/2cf18a44303b6d84faa8ecffaecc427b53ae121e/Lib/test/test_future_stmt/test_future.py#L174-L192
We have... | 669175bf8edc2c02d48401bac0e4c7d99a33f15b | b313cc68d50de5fb5f43acffd402c5c4da6516fc |
python/cpython | python__cpython-116859 | # Mark some tests `test_cmd_line` as `cpython_only`
# Bug report
There are different tests that are skipped due to various reasons (like exact `--help` output matches or `malloc` usages, frozen imports, etc) on other implementations. For example, RustPython: https://github.com/RustPython/RustPython/blob/92c8b371ae5db... | a1c4923d65a3e4cea917745e7f6bc2e377cde5c5 | 0c7dc494f2a32494f8971a236ba59c0c35f48d94 |
python/cpython | python__cpython-116852 | # The documentation for ctypes may be ambiguous.
# Documentation

In this picture, after "from ctypes import *" then use the "libc.printf" may misleading the reader that libc from ctypes.
i think should remove "from c... | 744c0777952f1e535d1192ee15b286aa67b61533 | 33da0e844c922b3dcded75fbb9b7be67cb013a17 |
python/cpython | python__cpython-124667 | # argparse: parse_args with a subparser + namespace tries to setdefault on a mappingproxy object
# Bug report
### Bug description:
I was using the namespace argument in parse_args and found that argparse tries to setdefault on a mapping proxy when parsing unknown extra attributes:
```python
import argparse
parser... | 95e92ef6c74e973ea13d15180190d0fa2af82fbf | f1a2417b9e2993e584610851ac004c8b0599b323 |
python/cpython | python__cpython-116846 | # Itertools recipes improvements
# roundrobin
https://github.com/python/cpython/blob/5f52d20a93908196f74271db8437cc1ba7e1e262/Doc/library/itertools.rst?plain=1#L1570-L1571
That looks weird. Round-robin with a single iterable? And the ranges aren't iterated? I suspect this was intended:
```python
collections.... | 41e844a4acbd5070f675e034e31c988b4849dec9 | 1904f0a2245f500aa85fba347b260620350efc78 |
python/cpython | python__cpython-116775 | # Make `sys.settrace`, `sys.setprofile`, and `sys.monitoring` thread safe in `--disable-gil` builds
# Feature or enhancement
### Proposal:
These need to work properly when called with multiple threads running.
https://github.com/colesbury/nogil-3.12/commit/82800d8ec8
### Has this already been discussed elsewhere?
... | 07525c9a85e7fa04db565c6e6e6605ff6099dcb7 | b45af00bad3449b85c8f54ba7a9474ca1f52de69 |
python/cpython | python__cpython-116812 | # PathFinder.invalidate_caches should include MetadataPathFinder.invalidate_caches
`MetadataPathFinder.invalidate_caches` should be called from `PathFinder.invalidate_caches`, as that will match the behavior that would happen if MetadataPathFinder were on `sys.meta_path`.
_Originally posted by @jaraco in https://gi... | 5f52d20a93908196f74271db8437cc1ba7e1e262 | be59aaf3abec37b27bdb31fadf433665e5471a46 |
python/cpython | python__cpython-123249 | # getting ssl.SSLSocket.session brings to memory leak
# Bug report
### Bug description:
Ubuntu 22.04
python 3.12, python3.11
```python
import ssl
import socket
import time
host = '192.168.16.66' # some server we can connect with https as example
port = 443
session = None
context = ssl._create_unverified_context(pro... | 7e7223e18f58ec48fb36a68fb75b5c5b7a45042a | 1c0bd8bd00287d3bd6830aca87bb14e047192008 |
python/cpython | python__cpython-116827 | # pystats: optimized_trace_length histogram includes exits
# Bug report
### Bug description:
With the addition of cold exits, the "optimized trace length" histogram now includes [the exit count + the optimized trace length](https://github.com/python/cpython/blob/main/Python/optimizer.c#L880).
While this is a useful... | 0f278012e88fa9607d85bc6c7265fd394f0ac163 | 5405e9e5b51f3bd883aee5c1a52a39a56e2fb2b4 |
python/cpython | python__cpython-116787 | # Direct invocation of `test_inspect/test_inspect.py` fails
# Bug report
```pytb
» ./python.exe Lib/test/test_inspect/test_inspect.py
/Users/sobolev/Desktop/cpython2/Lib/test/test_inspect/test_inspect.py:43: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__
... | 66fb613d90fe3dea32130a5937963a9362c8a59e | d4028724f2c8c674202615b772913765423c69fd |
python/cpython | python__cpython-116783 | # `inspect.getmember` docs do not mention `__type_params__` for functions and classes
# Bug report
Docs do not mention `__type_params__` key returned value for classes and functions: https://github.com/python/cpython/blob/a18c9854e8c255981f07c0a1c1503253f85b7540/Doc/library/inspect.rst#L47-L58 https://github.com/pyth... | 16349868d396cc1bff5188de3638321e87fe0293 | 8da83f3386da603605358dc9ec68796daa5ef455 |
python/cpython | python__cpython-116788 | # Test `test_inspect` fails with `-OO`
# Bug report
```
======================================================================
FAIL: test_class_inside_conditional (test.test_inspect.test_inspect.TestBuggyCases.test_class_inside_conditional)
----------------------------------------------------------------------
Traceb... | f20dfb7569a769da50cd75f4932b9abe78e55d75 | 19ac28bd08fdb16795e6f82ea7bfac73e8f3791b |
python/cpython | python__cpython-116774 | # Windows: ProactorEventLoop: possible memory corruption leading to crashes
# Crash report
### What happened?
Also falls under: `RuntimeError: <_overlapped.Overlapped object at 0x<address>> still has pending operation at deallocation, the process may crash`.
We have an application that embeds Python and needs to ti... | fc4599800778f9b130d5e336deadbdeb5bd3e5ee | 519b2ae22b54760475bbf62b9558d453c703f9c6 |
python/cpython | python__cpython-118348 | # Python/flowgraph.c:701: basicblock *push_except_block(struct _PyCfgExceptStack *, cfg_instr *): Assertion `stack->depth <= CO_MAXBLOCKS' failed
# Crash report
### What happened?
Minimal reproducer
```python
async def t():
async with h,t,t,o,f,y,o,t,r,o,f,t,f,r,t,m,r,o,t,l:n
```
```shell
~/p/cpython ❯❯❯ ./python.... | c1bf4874c1e9db2beda1d62c8c241229783c789b | f6fab21721c8aedc5dca97dbeb6292a067c19bf1 |
python/cpython | python__cpython-116801 | # Regression in `urllib.parse.parse_qsl(None)` behavior
# Bug report
### Bug description:
https://github.com/python/cpython/pull/115771 introduced a change in some currently working behavior. Previously:
```python
import urllib.parse
>>> urllib.parse.parse_qsl(None)
[]
```
but now it raises `TypeError: cannot conver... | 1069a462f611f0b70b6eec0bba603d618a0378f3 | 269051d20e65eda30734cbbbdb07d21df61978d6 |
python/cpython | python__cpython-116761 | # pystats: More traces created than optimizations attempted
# Bug report
### Bug description:
In the pystats for many benchmarks, such as hexiom, the number of traces created exceeds the number of optimization attempts. This doesn't make sense because a trace shouldn't ever be created unless we tried to create one ... | cef0ec1a3ca40db69b56bcd736c1b3bb05a1cf48 | 8c6db45ce34df7081d7497e638daf3e130303295 |
python/cpython | python__cpython-124568 | # Provide a mechanism to "unload" the monitoring tool
# Feature or enhancement
### Proposal:
As mentioned in #111963, we don't have a way to fully unload the monitoring tool and this is a bad experience for users. Debuggers have to track code objects of their breakpoints if they want to do it with local events. I th... | 5e0abb47886bc665eefdcc19fde985f803e49d4c | b48253852341c01309b0598852841cd89bc28afd |
python/cpython | python__cpython-116746 | # BLD: not all @LIBPYTHON@ changed to @MODULE_LDFLAGS@
# Bug report
### Bug description:
Attempting to build numpy fails with the errors that look like:
```
FAILED: numpy/_core/_struct_ufunc_tests.cpython-313-x86_64-linux-gnu.so
cc -o numpy/_core/_struct_ufunc_tests.cpython-313-x86_64-linux-gnu.so numpy/_core/_str... | c4bf58a14f162557038a1535ca22c52b49d81d7b | 3ec57307e70ee6f42410e844d3399bbd598917ba |
python/cpython | python__cpython-117296 | # Please upgrade bundled Expat to 2.6.2 (e.g. for the fix to CVE-2024-28757)
# Bug report
### Bug description:
Hi! :wave:
Please upgrade bundled Expat to 2.6.2 (e.g. for the fix to CVE-2024-28757).
- GitHub release: https://github.com/libexpat/libexpat/releases/tag/R_2_6_2
- Change log: https://github.com/libex... | c9829eec0883a8991ea4d319d965e123a3cf6c20 | 1b85b3424c081835406592868123fe898ee029ad |
python/cpython | python__cpython-116737 | # `INSTRUMENTED_FUNCTION_CALL_EX` should set `arg0` to `MISSING` instead of `None` if argument is absent
# Bug report
### Bug description:
I should've caught this in #116626 but somehow I missed it. `INSTRUMENTED_FUNCTION_CALL_EX` sets `arg0` to `None` now, instead of `MISSING`, when there's no argument.
```python
... | 59e30f41ed6f2388a99ac0a8aebf0a12f7460a4a | d180b507c4929be399395bfd7946948f98ffc4f7 |
python/cpython | python__cpython-117407 | # Nested TaskGroup can silently swallow cancellation request from parent TaskGroup
# Bug report
### Bug description:
In the following code snippet, I start an `asyncio.TaskGroup` called `outer_tg` then start another one within it called `inner_tg`. The inner task group is wrapped in an `except*` block to catch a... | fa58e75a8605146a89ef72b58b4529669ac48366 | 22b25d1ebaab7b8c4833a8c120c8b4699a830f40 |
python/cpython | python__cpython-116715 | # Handle error correctly in `PyFloat_GetInfo`
# Bug report
`floatobject` contains this code: https://github.com/python/cpython/blob/ba82a241ac7ddee7cad18e9994f8dd560c68df02/Objects/floatobject.c#L101-L123
It only shows the last error and swallows any others.
I propose to change the error handling with the smallest... | fcd49b4f47f1edd9a2717f6619da7e7af8ea73cf | aa7bcf284f006434b07839d82f325618f7a5c06c |
python/cpython | python__cpython-116683 | # test_concurrent_futures/test_shutdown.py: test_cancel_futures_wait_false flaky
The test looks like:
https://github.com/python/cpython/blob/bb66600558cb8d5dd9a56f562bd9531eb1e1685f/Lib/test/test_concurrent_futures/test_shutdown.py#L243-L250
The problem is that if the worker thread starts executing after the `sh... | 7d1abe9502641a3602e9773aebc29ee56d8f40ae | 3f54d1cfe78f7c88fb0ecdbc250d9f8be092ec5a |
python/cpython | python__cpython-130888 | # docs: `token` is not defined, but mentioned
The `token` term is not being explained (even by means of reference), but mentioned in the chapters [8](https://docs.python.org/3/tutorial/errors.html) and [14](https://docs.python.org/3/tutorial/interactive.html) of the tutorial, maybe it can be a good point to add a refe... | 30d52058493e07fd1d3efea960482f4001bd2f86 | 863d54cbaf6c0b45fff691ab275515c1483ad68d |
python/cpython | python__cpython-116768 | # Make `_warnings.c` thread-safe in free-threaded build
# Feature or enhancement
The `warnings` implementation is split between Python (`warnings.py`) and C (`_warnings.c`). There are a few bits of code in the C module that are not thread-safe without the GIL:
The `Py_SETREF` calls are not thread-safe if concurrent ... | 762f489b31afe0f0589aa784bf99c752044e7f30 | 4e45c6c54a9457b1ca5b4cf3aa2843b7218d4414 |
python/cpython | python__cpython-116658 | # test_capi.test_misc fails with `-u all`
# Bug report
### Bug description:
In current `main`, test_capi.test_misc fails when run with `-uall`.
```
centurion:/tmp/testbuild/Python-3.13.0a5 > ./python -m test -uall test_capi.test_misc
Using random seed: 468383501
0:00:00 load avg: 7.27 Run 1 test sequentially
0:00:... | f6e7a6ce651b43c6e060608a4bb20685f39e9eaa | 5d72b753889977fa6d2d015499de03f94e16b035 |
python/cpython | python__cpython-116790 | # Python 3.13 regression: Recursive dataclasses fail to ==: RecursionError: maximum recursion depth exceeded
# Bug report
### Bug description:
There is a regression in comparing recursive dataclasses for equality in Python 3.13.0 from the first alpha until at least a4.
### Python 3.12
```pycon
>>> from da... | 75935746be0cbd32b9d710b93db9bd49c8d634ba | 3cac2af5ecfa9e2a47bfdd15e114b65780836b9d |
python/cpython | python__cpython-116670 | # Race condition in `test_queue.test_shutdown_immediate_put_join`
There is a race condition in `test_shutdown_immediate_put_join` that leads to `ValueError: task_done() called too many times`. This happens frequently in the free-threaded build. It may also happen in the default build depending on when the GIL is relea... | 98ab21cce6d4c7bd2b5a0a1521b50b1ce2566a44 | 25684e71310642ffd20b45eea9b5226a1fa809a5 |
python/cpython | python__cpython-116627 | # Inconsistent behavior for `sys.monitoring.events.CALL`
# Bug report
### Bug description:
According to the docs, `CALL` event should be emitted as long as there's a function call in Python code. However, `CALL_FUNCTION_EX` does it differently - it only emits the event when it's a call to C function. So monitoring t... | 8332e85b2f079e8b9334666084d1f8495cff25c1 | ba82a241ac7ddee7cad18e9994f8dd560c68df02 |
python/cpython | python__cpython-116758 | # Add support for Android as a target platform
I am now working on [PEP 738](https://peps.python.org/pep-0738/), which proposes adding Android as a Tier 3 supported platform for Python 3.13. I'll use this page to track all the issues related to this work.
This was previously managed at #71052, but most of that issu... | 22b25d1ebaab7b8c4833a8c120c8b4699a830f40 | f2132fcd2a6da7b2b86e80189fa009ce1d2c753b |
python/cpython | python__cpython-116657 | # `list(set)` should be atomic in the free-threaded build
We have code that constructs a list from a set, while the set may be concurrently updated. For example:
https://github.com/python/cpython/blob/44f9a84b67c97c94f0d581ffd63b24b73fb79610/Lib/multiprocessing/process.py#L61-L65
This is a fairly common pattern ... | 3325699ffa3c633084f3e3fd94c4f3843066db85 | 126186674ed3d6abd0f87e817100b5ec7290e146 |
python/cpython | python__cpython-116623 | # socketmodule.c: use atomics to access `defaulttimeout` in free-threaded build
# Feature or enhancement
The `defaulttimeout` in `socketmodule.c` is shared, mutable state:
https://github.com/python/cpython/blob/9f983e00ec55b87a098a4c8229fe5bb9acb9f3ac/Modules/socketmodule.c#L551
In the free-threaded build, we shou... | 3b7fe117fab91371f6b621e9efd02f3925f5d53b | 02918aa96117781261cb1a564e37a861b01eb883 |
python/cpython | python__cpython-116628 | # C API: `PyGC_Disable()` not respected
# Bug report
### Bug description:
The Python C API provides the function [PyGC_Disable()](https://docs.python.org/3/c-api/gcsupport.html#c.PyGC_Disable) to temporarily disable garbage collection. Calling it causes `PyGC_Collect()` to become a no-op. So far so good.
Unfo... | 02918aa96117781261cb1a564e37a861b01eb883 | eb947cdc1374842a32fa82249ba3c688abf252dc |
python/cpython | python__cpython-116615 | # Pydoc fails for test.test_enum
# Bug report
```
$ ./python -m pydoc test.test_enum
Traceback (most recent call last):
File "/home/serhiy/py/cpython/Lib/runpy.py", line 198, in _run_module_as_main
return _run_code(code, main_globals, None,
~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
"__... | 06e29a224fac9edeba55422d2e60f2fbb88dddce | 3e45030076bf2cfab41c4456c73fb212b7322c60 |
python/cpython | python__cpython-116597 | # Too many tier 2 micro-ops are marked as escaping
# Bug report
### Bug description:
There are too many `_SET_IP` and `_CHECK_VALIDITY` micro-ops being inserted into tier 2 code.
There are two causes of this:
1. Too many micro-ops are marked as escaping
2. Python call uops do not technically escape but must be prec... | b6ae6da1bd987506b599a30e37fb452f909b5cbe | 6c4fc209e1941958164509204cdc3505130c1820 |
python/cpython | python__cpython-116591 | # Warning "unused function 'current_thread_holds_gil'" in `ceval_gil.c`
# Bug report
https://buildbot.python.org/all/#/builders/350/builds/5582 has this warning:
```
Python/ceval_gil.c:421:1: warning: unused function 'current_thread_holds_gil' [-Wunused-function]
1 warning generated.
```
`current_thread_ho... | 817fe33a1da747c57b467f73a47b701c0b0eb911 | ffd79bea0f032df5a2e7f75e8c823a09cdc7c7a2 |
python/cpython | python__cpython-116577 | # `sortperf.py` is broken
# Bug report
### Bug description:
It's supposed to measure sort speed for different kinds of data, from best to worst case. But currently it shows about the same speed for all kinds, because the same list object is sorted a thousand times. Which means all but the first sort are just sor... | 4704e55a71c859c5d17cc2747ba62f49da58ea2d | 2339e7cff745271f0e4a919573a347ab2bc1c2e9 |
python/cpython | python__cpython-116569 | # Docs: incorrect error message
# Documentation
[Part 8](https://docs.python.org/3/tutorial/errors.html#syntax-errors) of the Python tutorial contains the following example:
```python
>>> while True print('Hello world')
File "<stdin>", line 1
while True print('Hello world')
^
SyntaxEr... | 3e45030076bf2cfab41c4456c73fb212b7322c60 | 44f9a84b67c97c94f0d581ffd63b24b73fb79610 |
python/cpython | python__cpython-116561 | # Consider adding public PyLong_GetSign() function
# Feature or enhancement
### Proposal:
Currently there is no way to determine the sign of the PyLongObject value and CPython extensions use private macroses like ``_PyLong_IsNegative()``: https://github.com/aleaxit/gmpy/blob/eb8dfcbd84abcfcb36b4adcb0d5c6d050731dd75/... | 61d3ab32da92e70bb97a544d76ef2b837501024f | 367adc91fb9834eb35b168048fd54705621c3f21 |
python/cpython | python__cpython-116578 | # Relax list.sort()'s notion of "descending" runs
# Feature or enhancement
### Bug description:
A question on StackOverflow got me thinking about "the other end" of `list.sort()`: the start, with `count_run()`.
https://stackoverflow.com/questions/78108792/
That descending runs have to be strictly descending was al... | bf121d6a694bea4fe9864a19879fe0c70c4e0656 | 7d1abe9502641a3602e9773aebc29ee56d8f40ae |
python/cpython | python__cpython-116548 | # Multiple things wrong with `mkpwent` in `pwdmodule`
# Bug report
Here's what's wrong:
- https://github.com/python/cpython/blob/b9cb855621c0813846421e4ced97260a32e57063/Modules/pwdmodule.c#L71-L73 is not checked to be `NULL`, while it is possible
- All errors here can overwrite each other: https://github.com/pyt... | ffd79bea0f032df5a2e7f75e8c823a09cdc7c7a2 | 1cc02ca063f50b8c527fbdde9957b03c145c1575 |
python/cpython | python__cpython-116542 | # Handle errors correctly in `_pystatvfs_fromstructstatvfs` in `posixmodule`
# Bug report
Here the first possible error will be overwritten by the following ones:
https://github.com/python/cpython/blob/b4b4e764a798bab60324871074ce4cdebb9d01bb/Modules/posixmodule.c#L12969-L13014
<!-- gh-linked-prs -->
### Linked PRs... | f8147d01da44da2434496d868c86c2785f7244cd | d308d33e098d8e176f1e5169225d3cf800ed6aa1 |
python/cpython | python__cpython-116607 | # Use stop-the-world to make fork and interpreter shutdown thread-safe
# Feature or enhancement
In the free-threaded build, we should use a stop-the-world call to make `fork()` [^1] and shutdown (i.e, [`Py_FinalizeEx`](https://github.com/python/cpython/blob/c951e25c24910064a4c8b7959e2f0f7c0d4d0a63/Python/pylifecycl... | e728303532168efab7694c55c82ea19b18bf8385 | 1f8b24ef69896680d6ba6005e75e1cc79a744f9e |
python/cpython | python__cpython-116521 | # Handle errors correctly in `os_get_terminal_size_impl` in `posixmodule.c`
# Bug report
Here the first possible error will be overwritten by the second one:
https://github.com/python/cpython/blob/3cdfdc07a9dd39bcd6855b8c104584f9c34624f2/Modules/posixmodule.c#L14981-L14990
<!-- gh-linked-prs -->
### Linked PRs
* gh... | b4b4e764a798bab60324871074ce4cdebb9d01bb | 03f86b1b626ac5b0df1cc74d8f80ea11117aec8c |
python/cpython | python__cpython-116517 | # Ensure current thread state is cleared before deleting it in _PyThreadState_DeleteCurrent
# Feature or enhancement
In general, when `_PyThreadState_GET()` is non-NULL then the current thread is "attached", but there is a small window during `PyThreadState_DeleteCurrent()` where that's not true: tstate_delete_common... | 9f983e00ec55b87a098a4c8229fe5bb9acb9f3ac | 05070f40bbc3384c36c8b3dab76345ba92098d42 |
python/cpython | python__cpython-116494 | # Do not try to import `_winreg` in `platform` module
# Bug report
`_winreg` was renamed to `winreg` during Python2 -> Python3 migration. Right now, there's no `_winreg` module.
Somehow this code got in 5 years ago in https://github.com/python/cpython/issues/80101 and https://github.com/python/cpython/commit/62dfd7d... | 7cee276d551a41d9271daf2a6bcd7def55555973 | fdb2d90a274158aee23b526d972172bf41bd4b7e |
python/cpython | python__cpython-116506 | # Improve `test_win32_ver` in `test_platform`
# Bug report
Right now it looks like this:
https://github.com/python/cpython/blob/0b647141d587065c5b82bd658485adca8823a943/Lib/test/test_platform.py#L329-L330
Looks like this test was added as a part of this commit: https://github.com/python/cpython/commit/c69d1c498f3896... | ee0dbbc04504e0e0f1455e2bab8801ce0a682afd | 27df81d5643f32be6ae84a00c5cf84b58e849b21 |
python/cpython | python__cpython-116486 | # Typo in documentation in the collections library.
# Documentation
It seems like there is a typo on line 634 [here](https://github.com/python/cpython/blob/a8e814db96ebfeb1f58bc471edffde2176c0ae05/Lib/collections/__init__.py#L634)?
Instead of `in the some of original`, it should be `in some of the original`?
... | 4d952737e62b833d6782e0180ee89088fe601317 | d864b0094f9875c5613cbb0b7f7f3ca8f1c6b606 |
python/cpython | python__cpython-116495 | # tkinter breaks when mixing tk.Checkbutton and ttk.Checkbutton
# Bug report
### Bug description:
When mixing tk.Checkbutton and ttk.Checkbutton (and maybe custom class Checkbutton)
tkinter behaves weirdly (calling method of one object changes the other too).
It is because of **name collision**.
```python
imp... | c61cb507c10c5b597928284e087a9a384ab267d0 | 1069a462f611f0b70b6eec0bba603d618a0378f3 |
python/cpython | python__cpython-116473 | # PCbuild/regen.targets contains invalid newlines in XML attribute
# Bug report
### Bug description:
`PCbuild/regen.targets` encodes a multi-line batch script in an XML attribute using literal newlines:
https://github.com/python/cpython/blob/b2d74cdbcd0b47bc938200969bb31e5b37dc11e1/PCbuild/regen.targets#L153-L156 ... | 5d0cdfe519e6f35ccae1a1adca1ffd7fac10cee0 | 13ffd4bd9f529b6a5fe33741fbd57f14b4b80137 |
python/cpython | python__cpython-116469 | # Use explicit constants in stack effects when known.
We use `oparg` for stack effects even when `oparg` is a constant for a particular specialization.
For example `UNPACK_SEQUENCE_TUPLE` is defined as:
```
inst(UNPACK_SEQUENCE_TWO_TUPLE, (unused/1, seq -- values[oparg]))
```
resulting in slightly inefficient cod... | 4e5df2013fc29ed8bdb71572f1d12ff36e7028d5 | 8d7fde655fbb57e393831b9f30ebba80d6da366f |
python/cpython | python__cpython-116449 | # Handle errors correctly in `os_waitid_impl` in `posixmodule`
# Bug report
Any possible first errors will be overwritten by following ones:
https://github.com/python/cpython/blob/40b79efae7f8e1e0d4fd50c13f8b7514203bc6da/Modules/posixmodule.c#L9731-L9745
I propose to use our custom macro for this as well.
<!-- gh-... | 882fcede83af783a834b759e4643130dc1307ee3 | 808a77612fb89b125d25efac2788522a100e8a6d |
python/cpython | python__cpython-116459 | # Possible undefined behavior in `arraymodule` and `getargs`
# Bug report
## Problem
Recently I got contacted by a team of static analysis enthusiasts, who analyze CPython's internals for bugs.
They have found this:

`PyDict_Pop()` can be used in two cases:
* If the `PyDict_Get*` call is followed by the `PyDict_Del*` call.
* If the `PyDict_Del*` call is followed by the code that handles KeyError.
In both cases the use of `PyDict_Pop()` can make the code clearer.
<!-- gh-linked-prs -->
### Linked PRs
* gh... | 72d3cc94cd8cae1925e7a14f297b06ac6184f916 | 882fcede83af783a834b759e4643130dc1307ee3 |
python/cpython | python__cpython-116813 | # Split hot and cold parts of the templates.
<!-- gh-linked-prs -->
### Linked PRs
* gh-116813
* gh-116817
* gh-116832
<!-- /gh-linked-prs -->
| bf82f77957a31c3731b4ec470c406f5708ca9ba3 | 61599a48f52e951d8813877ee311d2a830ba2cd8 |
python/cpython | python__cpython-116466 | # Warning: "variable ‘right’ set but not used" in `optimizer_cases.c.h`
# Bug report
<img width="983" alt="Снимок экрана 2024-03-06 в 19 36 37" src="https://github.com/python/cpython/assets/4660275/64916f6b-93bb-4723-9c62-9e86d57048bf">
CC @Fidget-Spinner
<!-- gh-linked-prs -->
### Linked PRs
* gh-116466
<!-- /gh-... | 4298d69d4b2f7d0e9d93ad325238930bd6235dbf | 68157446aa39dedf7c90d85a7b0924beda004e76 |
python/cpython | python__cpython-116419 | # C API: Move limited C API tests from _testcapi to a new _testlimitedcapi extension
Currently, the `_testcapi` C extension is partially built with the limited C API and partially with the non-limited C API. It can lead to some confusion: which API is being tested?
I proposed to create a new `_testlimitedcapi` exte... | d9bcdda39c62a8c37637ecd5f82f83f6e8828243 | d9ccde28c4321ffc0d3f8b18c6346d075b784c40 |
python/cpython | python__cpython-116405 | # Handle errors correctly in `wait_helper` in `posixmodule.c`
# Bug report
There are several issues in this function:
1. Our traditional case, when all errors are overwritten in a sequence preparation: https://github.com/python/cpython/blob/d2f1b0eb4956b4923f111c7c740ba7ab25f3312d/Modules/posixmodule.c#L9584-L9609
2.... | 22ccf13b332902142fe0c52c593f9efc152c7761 | d2f1b0eb4956b4923f111c7c740ba7ab25f3312d |
python/cpython | python__cpython-122447 | # [macOS] ``test_builtin.PtyTests.test_input_tty`` hangs if ``rlcompleter`` is imported
# Bug report
### Bug description:
```python
./python.exe -m test
...many lines
0:05:14 load avg: 4.04 [ 87/472] test_bool
0:05:14 load avg: 4.04 [ 88/472] test_buffer
0:05:15 load avg: 3.80 [ 89/472] test_bufio
0:05:16 load avg: ... | 1d8e45390733d3eb29164799ea10f8406f53e830 | 8fb88b22b7a932ff16002dd19e904f9cafd59e9f |
python/cpython | python__cpython-116421 | # shutil.rmtree() gets stuck on opening named pipe
# Bug report
### Bug description:
When the target is a named pipe, shutil.rmtree() gets stuck on opening it.
```python
# Create a named pipe
import os, tempfile
filename = os.path.join(tempfile.mkdtemp())
filename = os.path.join(tempfile.mkdtemp(), "named... | aa7bcf284f006434b07839d82f325618f7a5c06c | 8332e85b2f079e8b9334666084d1f8495cff25c1 |
python/cpython | python__cpython-116414 | # _PyGC_ClearAllFreeLists called while other threads may be running
# Bug report
In the free-threaded GC, we currently call `_PyGC_ClearAllFreeLists()` after other threads are resumed. That's not safe because the other threads may be using their own freelists at that point.
https://github.com/python/cpython/blob/d2f... | 2d4955fcf2a54d7ffc06a48774863ff65ba250d2 | 68b8ffff8c4b20d2f46b708b1a7906377ecc255f |
python/cpython | python__cpython-116398 | # Stop the world doesn't set paused threads states to `_Py_THREAD_SUSPENDED`
# Bug report
The `detach_thread` function should set the state to the `detached_state` argument, but currently that argument is unused.
https://github.com/python/cpython/blob/d2f1b0eb4956b4923f111c7c740ba7ab25f3312d/Python/pystate.c#L1925-L... | 834bf57eb79e9bf383a7173fccda032f4c53f69b | d9bcdda39c62a8c37637ecd5f82f83f6e8828243 |
python/cpython | python__cpython-116387 | # Warning: "'fprintf' : format string '%ld' requires an argument of type 'long', but variadic argument 1 has type 'int64_t'"
# Bug report
<img width="1297" alt="Снимок экрана 2024-03-06 в 00 54 29" src="https://github.com/python/cpython/assets/4660275/92f67751-1bba-438d-8a4a-f15e405c31fb">
Happens in `Modules/_xxint... | 40b79efae7f8e1e0d4fd50c13f8b7514203bc6da | b33980a2e3f195c63e3aadeeebd8e50eb41ad70c |
python/cpython | python__cpython-116385 | # Specialize `CONTAINS_OP`
# Feature or enhancement
### Proposal:
I'll work on the following specializations:
* `list`
* `dict`
* `tuple`
* `set`
* `str`
### Has this already been discussed elsewhere?
No response given
### Links to previous discussion of this feature:
_No response_
<!-- gh-link... | 7114cf20c015b99123b32c1ba4f5475b7a6c3a13 | 73807eb634315f70a464a18feaae33d9e065de09 |
python/cpython | python__cpython-116378 | # `glob.translate()` rejects non-recursive pattern segments that include "**"
# Bug report
### Bug description:
`glob.translate(recursive=True)` (new in 3.13) rejects any pattern with a segment that includes `**`, unless `**` is the entire segment. For example, `translate('**a')` is rejected but not `translate('... | 0634201f5391242524dbb5225de37f81a2cc1826 | 1cf03010865c66c2c3286ffdafd55e7ce2d97444 |
python/cpython | python__cpython-116471 | # Consider deprecating `platform.java_ver` because it is only helpful for Jython
# Feature or enhancement
What do you think about deprecating `platform.java_ver`? It is never used on CPython, it is a helper for `Jython` only, which is basically stuck on 2.7 for the last 10 years.
I think that we should deprecate an... | 0b647141d587065c5b82bd658485adca8823a943 | 4d952737e62b833d6782e0180ee89088fe601317 |
python/cpython | python__cpython-116334 | # Relax error string text expectations in SSL-related tests
# Feature or enhancement
### Proposal:
This Issue is a follow-up to [prior discussion](https://discuss.python.org/t/support-building-ssl-and-hashlib-modules-against-aws-lc/44505) on the python Ideas discussion board. Please see that page for background ... | c85d84166a84a5cb2d724012726bad34229ad24e | 1f72fb5447ef3f8892b4a7a6213522579c618e8e |
python/cpython | python__cpython-116339 | # `sys_getwindowsversion_impl` might potentially swallow errors in `sysmodule.c`
# Bug report
While merging https://github.com/python/cpython/pull/115321 I've noticed a similar issue to https://github.com/python/cpython/issues/115320:
https://github.com/python/cpython/blob/207030f5527d405940b79c10c1413c1e8ff696c1/Py... | c91bdf86ef1cf9365b61a46aa2e51e5d1932b00a | cbf3d38cbeb6e640d5959549169ec45cdedc1a71 |
python/cpython | python__cpython-116341 | # Unexpected IndexError in typing.List['']
# Bug report
### Bug description:
Calling `typing.List['']` produces an unexpected `IndexError`.
```python
>>> import typing
>>> typing.List['']
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.11/typing.py", lin... | a29998a06bf75264c3faaeeec4584a5f75b45a1f | ffcc450a9b8b6927549b501eff7ac14abc238448 |
python/cpython | python__cpython-116882 | # Allow C extensions to declare compatibility with free-threading
# Feature or enhancement
There are a few pieces to this:
1. Add a `Py_mod_gil` slot, as [described in PEP 703](https://peps.python.org/pep-0703/#py-mod-gil-slot), that multi-phase init modules can use to indicate that they support free-threading.
2... | c2627d6eea924daf80f374c18a5fd73ef61283fa | 3e818afb9b7c557aa633aeb3d5c4959750feeab0 |
python/cpython | python__cpython-116317 | # Typo in `UNARY_FUNC(PyNumber_Positive)`
# Bug report
### Bug description:
https://github.com/python/cpython/blob/ea1b1c579f600cc85d145c60862b2e6b98701b24/Objects/abstract.c#L1393
There's should be a `__pos__` instead of `__pow__`
### CPython versions tested on:
CPython main branch
### Operating systems tested ... | 8a84eb75a94ead1cc0dcdde635096e58910d9356 | 60743a9a7ee3c3c16a61ff6715e8d170237b5458 |
python/cpython | python__cpython-116445 | # Update `Tools/wasm/README.md` to link to the devguide for building for WASI
Update https://github.com/python/cpython/blob/main/Tools/wasm/README.md to point to https://devguide.python.org/getting-started/setup-building/#wasi .
<!-- gh-linked-prs -->
### Linked PRs
* gh-116445
<!-- /gh-linked-prs -->
| bc708c76d2b3ad7bbfd6577a4444e1e47db60fd6 | 2d4955fcf2a54d7ffc06a48774863ff65ba250d2 |
python/cpython | python__cpython-116327 | # Get tests passing under wasmtime 18 using preview2 / WASI 0.2 primitives
This is a tracking issue for getting `wasmtime --wasi preview2` working for wasmtime 18+ (older versions had bugs we needed fixed).
- [x] `main`
- [x] `3.12`
- [x] `3.11`
<!-- gh-linked-prs -->
### Linked PRs
* gh-116327
* gh-116373
* gh-... | 7af063d1d85f965da06a65eca800f4c537d55fa5 | 6cddc731fb59edb66b64b7a8dbd9e281309a8384 |
python/cpython | python__cpython-116307 | # Tests fail if `--disable-test-modules` is supplied
# Bug report
### Bug description:
I compiled python 3.12 on a Debian system with `--enable-optimizations` and `--disable-test-modules`, and during the profile-guided optimization tests, multiple tests failed (see below).
Compiling python without `--disable-... | a2548077614f81f25a2c3465dabb7a0a3885c40c | bb66600558cb8d5dd9a56f562bd9531eb1e1685f |
python/cpython | python__cpython-116297 | # Refleak in `reduce_newobj` in typeobject.c
_Originally posted by @brandtbucher in https://github.com/python/cpython/issues/115874#issuecomment-1965775536_:
> I also think I found an unrelated refleak while chasing this down:
>
> ```diff
> diff --git a/Objects/typeobject.c b/Objects/typeobject.c
> index fe3b7b... | 17c4849981905fb1c9bfbb2b963b6ee12e3efb2c | 1dce0073da2e48f3cd387f4d57b14d6813bb8a85 |
python/cpython | python__cpython-116282 | # Some functions/methods include '\*' in the docs
# Documentation
I've found some doc issues similar to the one in https://github.com/python/cpython/issues/114811. I searched `::.*\\\*` by regex to find them out, and I hope that's everything (please refer to the PR).
<!-- gh-linked-prs -->
### Linked PRs
* gh-11... | 4859ecb8609b51e2f6b8fb1b295e9ee0f83e1be6 | 4d3ee77aef7c3f739b3f8d4dc46dd946c2a80627 |
python/cpython | python__cpython-116283 | # Docs: clarify object assignments intuition in the tutorial section
# Documentation
In the Tutorial section of the Python Documentation, 2 parts ([introduction](https://docs.python.org/3/tutorial/introduction.html#lists) and [datastructures](https://docs.python.org/3/tutorial/datastructures.html#more-on-lists)) ar... | 45a92436c5c42ca100f3ea0de9e7d37f1a97439b | eda2963378a3c292cf6bb202bb00e94e46ee6d90 |
python/cpython | python__cpython-116284 | # The README of c-analyzer needs update
# Documentation
https://github.com/python/cpython/blob/87faec28c78f6fa8eaaebbd1ababf687c7508e71/Tools/c-analyzer/README#L14
It is mentioned in the README about an `ignored-globals.txt` file, which was removed in #22841.
<!-- gh-linked-prs -->
### Linked PRs
* gh-116284
* ... | 88b5c665ee1624af1bc5097d3eb2af090b9cabed | eb22e2b251002b65f3b93e67c990c21e1151b25d |
python/cpython | python__cpython-122788 | # RotatingFileHandler can create empty backups
# Bug report
In the following example the rotating file handler writes the message in file "test.log" and creates an empty backup file "test.log.1".
```python
import logging.handlers
fh = logging.handlers.RotatingFileHandler('test.log', maxBytes=100, backupCount=1)
fh.em... | 6094c6fc2fc30eb9ee7c2f9f1088a851f71bf1b9 | 3f76b6b8ac706be46de0b23c3fd582ec4bd176d5 |
python/cpython | python__cpython-116227 | # Compiling `Modules/_testexternalinspection.c` failing due to `PTHREADS_KEYS_MAX` not being defined
# Bug report
### Bug description:
On my local machine, I'm getting this compile error:
```
In file included from ../../Modules/_testexternalinspection.c:47:
In file included from ../../Include/internal/pycor... | 90a1e9880fb0c03a82df6eaa9c7430b03e86531c | 9e88173d363fb22c2c7bf3da3a266817db6bf24b |
python/cpython | python__cpython-116256 | # Availbility of resource constants not properly documented
# Documentation
In the [docs for the 'resource' module](https://docs.python.org/3.11/library/resource.html), RLIMIT_VMEM does not have any availability notes, however, on my system (Python 3.11.7 on ArchLinux virtualized under WSL) RLIMIT_VMEM is not defin... | 03f86b1b626ac5b0df1cc74d8f80ea11117aec8c | c951e25c24910064a4c8b7959e2f0f7c0d4d0a63 |
python/cpython | python__cpython-121260 | # Remove `Py_BUILD_CORE_MODULE` and `Py_BUILD_CORE_MODULE` in `rotatingtree.c`
# Feature or enhancement
### Proposal:
Currently, we require `Py_Mutex` to isolate the states of pseudo random generator in `rotatingtree.c`, thus the `Py_BUILD_CORE_MODULE` was introduced in #115301, but we should refrain from using ... | 705a123898f1394b62076c00ab6008c18fd8e115 | ff5806c78edda1feed61254ac55193772dc9ec48 |
python/cpython | python__cpython-116172 | # Argument Clinic: overriding the return converter of `__init__` functions generates incorrect code
# Bug report
Instead of trying to fix this, let's just disallow this like we do for PyGetSet methods.
<!-- gh-linked-prs -->
### Linked PRs
* gh-116172
<!-- /gh-linked-prs -->
| cc6f807760300b575195bb8e678b82c10e24231c | 41baa03d30bc6b8a439ccca42b656d2c50392896 |
python/cpython | python__cpython-117242 | # Tier2 peephole optimization: remove extraneous _CHECK_STACK_SPACE ops
Implement a new peephole optimization for the tier2 optimizer that removes _CHECK_STACK_SPACE if we see that this check is already present
<!-- gh-linked-prs -->
### Linked PRs
* gh-117242
<!-- /gh-linked-prs -->
| 1c434688866db79082def4f9ef572b85d85908c8 | 976bcb2379709da57073a9e07b518ff51daa617a |
python/cpython | python__cpython-116338 | # Add a mechanism to disable the GIL
# Feature or enhancement
### Proposal:
`PYTHON_GIL=0 python ...` or `python -Xgil=0 ...` should disable the GIL at runtime, in `Py_GIL_DISABLED` builds. This will be similar in spirit to colesbury/nogil-3.12@f546dbf16a.
### Has this already been discussed elsewhere?
I h... | 2731913dd5234ff5ab630a3b7f1c98ad79d4d9df | 546eb7a3be241c5abd8a83cebbbab8c71107edcf |
python/cpython | python__cpython-116162 | # argparse is slow when parsing large number of optional flags
# Bug report
### Bug description:
When parsing positional vs optional arguments, the use of min with a
list comprehension inside of a loop [1][] results in quadratic time based
on the number of optional arguments given. When combined with use of
p... | 4a630980328b67f0aba6a04c3950aa9dbd532895 | 7b4794319c56b6b00e852c745af50fd95bd1a550 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.