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-101523 | # Make it easier to override externals on Windows
Currently, it's very easy to build with the exact set of external dependencies that we use upstream. However, sometimes downstream builders need to use alternate builds of these dependencies, and possibly alternate versions (within compatibility allowances).
Make th... | f6c53b80a16f63825479c5ca0f8a5e2829c3f505 | 433fb3ef08c71b97a0d08e522df56e0afaf3747a |
python/cpython | python__cpython-104508 | # Isolate the tracemalloc Module Between Interpreters
(See https://github.com/python/cpython/issues/100227.)
Currently the tracemalloc module has some state in `_PyRuntimeState`, including objects, which is shared by all interpreters. Interpreters should be isolated from each other, for a variety of reasons (inclu... | f7df17394906f2af51afef3c8ccaaab3847b059c | 26931944dd8abd6554249239344fa62b789b9028 |
python/cpython | python__cpython-101499 | # Improper call to `asyncio.Timeout.expired`
# Documentation
In [this example](https://docs.python.org/3/library/asyncio-task.html#asyncio.Timeout) for using `asyncio.Timeout`, `expired` is accessed as an attribute, but it should be called as a method.
I.e. the example should read as:
```python
async def mai... | 95fb0e02582b5673eff49694eb0dce1d7df52301 | 62251c3da06eb4662502295697f39730565b1717 |
python/cpython | python__cpython-101477 | # Add internal API for fast module access from heap type methods
See [topic on Discourse](https://discuss.python.org/t/a-fast-variant-of-pytype-getmodule/23377?u=erlendaasland).
For CPython internal usage, we've got `_PyModule_GetState`, which is a fast variant of `PyModule_GetState`, the module check in the latter... | ccd98a3146d66343499d04a44e038223a1a09e80 | d43c2652d4b1ca4d0afa468e58c4f50052f4bfa2 |
python/cpython | python__cpython-101470 | # Optimise `get_io_state()`
The `_io` extension module is required to bootstrap Python, so we can safely use internal C APIs. We should use static inlined `_PyModule_GetState` instead of the slower `PyModule_GetState`.
<!-- gh-linked-prs -->
### Linked PRs
* gh-101470
<!-- /gh-linked-prs -->
| f80db6cef075186f888a85258ccf2164bf148921 | 20c11f2e600e1c0bf42de4d6f2fb3ce5ccc2587c |
python/cpython | python__cpython-101468 | # Python launcher does not filter when only one runtime is installed
If the launcher only finds a single runtime, it skips all filtering, which means if you request a mismatched version you will still get the installed one.
e.g. a user (let's call them "Guido") installs Python 3.11. They then run `py -3.12` and ins... | eda60916bc88f8af736790ffd52381e8bb83ae83 | b91b42d236c81bd7cbe402b322c82bfcd0d883a1 |
python/cpython | python__cpython-101455 | # Documentation of END_ASYNC_FOR is out of date and incorrect
[Documentation of END_ASYNC_FOR](https://docs.python.org/3.12/library/dis.html#opcode-END_ASYNC_FOR) is both out of date and incorrect:
``
Terminates an [async for](https://docs.python.org/3.12/reference/compound_stmts.html#async-for) loop. Handles an e... | 62251c3da06eb4662502295697f39730565b1717 | 2b3e02a705907d0db2ce5266f06ad88a6b6160db |
python/cpython | python__cpython-101661 | # OrderedDict dict/list representation
I know that for historical purposes, `OrderedDict.__repr__` displays key-value pairs in the format of `[(key, value), ...]`, since the `{key: value, ...}` representation did not respect the ordering that `OrderedDict` needs. However, this was only in the past and it has become a ... | 790ff6bc6a56b4bd6e403aa43a984b99f7171dd7 | b2b85b5db9cfdb24f966b61757536a898abc3830 |
python/cpython | python__cpython-101439 | # extra comma (,) in the json snippet in Doc/howto/logging-cookbook.rst
# Documentation
There is an extra comma (,) in the json snippet in Doc/howto/logging-cookbook.rst as follows.
```diff
Suppose you configure logging with the following JSON:
.. code-block:: json
...
"class": "logging.Stre... | 20c11f2e600e1c0bf42de4d6f2fb3ce5ccc2587c | df0068ce4827471cc2962631ee64f6f38e818ec4 |
python/cpython | python__cpython-114269 | # ElementTree.iterparse "leaks" file descriptor when not exhausted
The PR https://github.com/python/cpython/pull/31696 attempts to fix the "leak" of file descriptors when the iterator is not exhausted. That PR fixes the warning, but not the underlying issue that the files aren't closed until the next tracing garbage c... | 66f95ea6a65deff547cab0d312b8c8c8a4cf8beb | b7688ef71eddcaf14f71b1c22ff2f164f34b2c74 |
python/cpython | python__cpython-101745 | # _tracemalloc__get_object_traceback doesn't handle objects with pre-headers correctly
In the main branch, the function `_tracemalloc__get_object_traceback` doesn't account for objects with preheaders:
https://github.com/python/cpython/blob/ea232716d3de1675478db3a302629ba43194c967/Modules/_tracemalloc.c#L1406-L1414... | 5b946d371979a772120e6ee7d37f9b735769d433 | f1f3af7b8245e61a2e0abef03b2c6c5902ed7df8 |
python/cpython | python__cpython-101424 | # tarfile.errorlevel is 1, not 0
# Documentation
[TarFile](https://docs.python.org/3/library/tarfile.html#tarfile.TarFile)'s docs say `errorlevel=0`, but the actual default is 1.
It is that way in Python 2 and I assume it hasn't changed in py3, so for docs purposes, it's always been that way. No need for a “change... | ea232716d3de1675478db3a302629ba43194c967 | c1b1f51cd1632f0b77dacd43092fb44ed5e053a9 |
python/cpython | python__cpython-101411 | # Argument clinic: improve generated code for self converter type checks
# Feature or enhancement
Currently, typically for `__new__` and `__init__` methods, Argument Clinic will spell out the `self` type check as such:
```python
if kind == METHOD_NEW:
type_check = ('({0} == {1} ||\n '
... | 2753cf2ed6eb329bdc34b8f67228801182b82160 | 0062f538d937de55cf3b66b4a8d527b1fe9d5182 |
python/cpython | python__cpython-101741 | # PyObject_GC_Resize doesn't check preheader size
The `PyObject_GC_Resize` implementation in the main branch doesn't check if the object has a preheader:
https://github.com/python/cpython/blob/0ef92d979311ba82d4c41b22ef38e12e1b08b13d/Modules/gcmodule.c#L2357-L2358
The only internal use I see is by `_PyTuple_Resi... | 9c3442c0938127788fa59e4ceb80ae78b86fad1d | 0056701aa370553636b676cc99e327137d1688c6 |
python/cpython | python__cpython-101413 | # Negative line number in stacktrace exception
The following code snippet generates a stacktrace exception pointing to a invalid line number (-1):
```python
with object() as obj:
break
```
Example:
```bash
$ echo 'with object() as obj:\n\tbreak' > main.py
$ python main.py
File "/home/kartz/main.py", line -1
Synt... | e867c1b753424d8d3f9c9ba0b431d007fd958c80 | 28db978d7f134edf6c86f21c42e15003511e7e9b |
python/cpython | python__cpython-101391 | # Possible small mistake in the documentation of importlib.util.LazyLoader.factory
The <u>documentation</u> of _LoazyLoader_.**factory** in the module _importlib.util_ says:
> **classmethod** factory(loader)
>
> A **static method** which returns a callable that creates a lazy loader. This is meant to be used in s... | 17143e2c30ae5e51945e04eeaec7ebb0e1f07fb5 | 61f2be08661949e2f6dfc94143436297e60d47de |
python/cpython | python__cpython-101387 | # typos found by codespell
# Documentation
Found the following typos by codespell (https://github.com/codespell-project/codespell):
```
./c-api/init_config.rst:842: varable ==> variable
./c-api/init_config.rst:1585: calculatin ==> calculate
./howto/logging-cookbook.rst:3631: detault ==> default
./howto/logging... | db757f0e440d2b3fd3a04dd771907838e0c2241c | 052f53d65d9f65c7c3223a383857ad07a182c2d7 |
python/cpython | python__cpython-101418 | # Unit test test.test_socket.ThreadedVSOCKSocketStreamTest.testStream hangs on WSL2 ubuntu
# Bug report
unit test test.test_socket.ThreadedVSOCKSocketStreamTest.testStream hangs on WSL2 ubuntu.
I added some print and it seems vsock does not work on WSL though /dev/vsock exists, HAVE_SOCKET_VSOCK() == True.
``... | 31f5550fbecef45378a0cabf76ead1b39250d9bc | 7740a0109679b3dc0b258b2121f0fbfa554bd1ea |
python/cpython | python__cpython-101378 | # Improve test_locale_calendar_formatweekday of calendar
It seems that `test_locale_calendar_formatweekday` of calendar misses some important inputs:
https://github.com/python/cpython/blob/main/Lib/test/test_calendar.py#L567-L578
Specifically, it does not cover a day under different lengths, ie, several common c... | 5e0865f22eed9f3f3f0e912c4ada196effbd8ce0 | e94edab727d07bef851e0e1a345e18a453be863d |
python/cpython | python__cpython-101399 | # Bytecode interpreter generator should support composing instructions from parts.
I.e. [this](https://github.com/python/cpython/commit/5a9af9c85c0cc9105472b435ec63acc6d4385719) should work as expected.
```
inst(BINARY_OP_ADD_FLOAT) = _BINARY_OP_ADD_FLOAT_CHECK + _BINARY_OP_ADD_FLOAT_ACTION;
```
The suggested so... | 7a3752338a2bfea023fcb119c842750fe799262f | e11fc032a75d067d2167a21037722a770b9dfb51 |
python/cpython | python__cpython-101363 | # pathlib.PureWindowsPath.match() mishandles path anchors
`pathlib.PurePath.match()` doesn't use `fnmatch()` to match path anchors, contrary to the documentation. Instead, it considers the drive and root of the pattern separately; if either (or both) is specified in the pattern, it must *exactly* match the correspondi... | d401b20630965c0e1d2a5a0d60d5fc51aa5a8d80 | 775f8819e319127f9bfb046773b74bcc62c68b6a |
python/cpython | python__cpython-101342 | # Remove unncessary enum._power_of_two function
https://github.com/python/cpython/blob/dfad678d7024ab86d265d84ed45999e031a03691/Lib/enum.py#L1568-L1571
This function looks like be defined by mistake.
<!-- gh-linked-prs -->
### Linked PRs
* gh-101342
<!-- /gh-linked-prs -->
| 8cef9c0f92720f6810be1c74e00f611acb4b8b1e | b5c4d6064cc2ae7042d2dc7b533d74f6c4176a38 |
python/cpython | python__cpython-112485 | # Add TCP keepalive option for `asyncio.start_server()`
By default, this `asyncio.start_server()` method will create a list of socket objects usually for both IPv4 and IPv6 (if possible) and do not set keepalive option. if I want I can create a socket object by myself and set keepalive option for it, then pass it in `... | 3aea6c4823e90172c9bc36cd20dc51b295d8a3c4 | a3a1cb48456c809f7b1ab6a6ffe83e8b3f69be0f |
python/cpython | python__cpython-101572 | # tarfile cannot handle high UIDs such as 734_380_696 (or at least the test fails)
Run `test_tarfile` on a posix system as a user with a high userid such as 734380696 and `test_add_dir_getmember` will fail with:
```
ERROR: test_add_dir_getmember (test.test_tarfile.Bz2UstarReadTest.test_add_dir_getmember) ... | ffcb8220d7a8c8ca169b467d9e4a752874f68af2 | f7e9fbacb250ad9df95d0024161b40dfdc9cc39e |
python/cpython | python__cpython-101327 | # Regression in Python 3.11 when explicitly passing None to FutureIter.throw
Reported and commit identified by @alicederyn in https://github.com/python/typeshed/issues/9586
Regression caused by https://github.com/python/cpython/pull/31973. Doesn't contain a news entry, so probably not intentional.
```
λ cat xxx... | a178ba82bfe2f2fb6f6ff0e67cb734fd7c4321e3 | 952a1d9cc970508b280af475c0be1809692f0c76 |
python/cpython | python__cpython-101323 | # ZlibDecompressor not tested
The test does not inherit from unittest.TestCase. An oversight.
<!-- gh-linked-prs -->
### Linked PRs
* gh-101323
<!-- /gh-linked-prs -->
| a89e6713c4de99d4be5a1304b134e57a24ab10ac | 144aaa74bbd77aee822ee92344744dbb05aa2f30 |
python/cpython | python__cpython-101335 | # Please add the `ssl_shutdown_timeout` parameter for `StreamWriter.start_tls()` in asyncio
Seems that `StreamWriter.start_tls()` method should have a `ssl_shutdown_timeout` parameter like other relevant methods.
<!-- gh-linked-prs -->
### Linked PRs
* gh-101335
<!-- /gh-linked-prs -->
| cc407b9de645ab7c137df8ea2409a005369169a5 | 75227fba1dd1683289d90ada7abba237bff55d14 |
python/cpython | python__cpython-101374 | # webbrowser CLI has no --help?
```
python -m webbrowser --help
option --help not recognized
Usage: /usr/lib64/python3.11/webbrowser.py [-n | -t] url
-n: open new window
-t: open new tab
```
I would expect any command to provide a `-h / --help` option. OK, the effect is about the same, but "option --h... | 3d7eb66c963c0c86021738271483bef27c425b17 | 420bbb783b43216cc897dc8914851899db37a31d |
python/cpython | python__cpython-101286 | # Undocumented risky behaviour in subprocess module
# Bug report - Undocumented risky behaviour in subprocess module
When using `subprocess.Popen` with `shell=True` on Windows and without a `COMSPEC` environment variable, a `cmd.exe` is launched. The problem is the `cmd.exe` full path is not written, Windows will s... | 23751ed826ee63fb486e874ec25934ea87dd8519 | de3669ebcb33ca8e3373fbbaed646c5f287979b8 |
python/cpython | python__cpython-101557 | # Enhance the BOLT build process
From @indygreg 's https://github.com/python/cpython/pull/101093
TODO
- [x] Optional `-fno-reorder-blocks-and-partition`
- [x] Drop `-gdwarf-4`
- [x] Run BOLT instrumented binary with `$(RUNSHARED)``
- [x] Enable BOLT optimization of libpython
<!-- gh-linked-prs -->
### Link... | 144aaa74bbd77aee822ee92344744dbb05aa2f30 | cef9de62b8bf5e2d11d5a074012dfa81dc4ea935 |
python/cpython | python__cpython-101280 | # Drop -gdwarf-4 flag from the BOLT build.
Sidenote: BOLT now supports DWARF5, so there's no need to force `-gdwarf-4`
https://github.com/python/cpython/blob/main/configure.ac#L1950-1952
_Originally posted by @aaupov in https://github.com/python/cpython/issues/101093#issuecomment-1386296142_
... | a958e7d35af191c354a3e89a1236e830b1e46029 | 8c183cddd3d0031c6d397738f73c20ee6bf61ce8 |
python/cpython | python__cpython-101302 | # Isolate the itertools extension module
# Feature or enhancement
Following https://github.com/ericsnowcurrently/multi-core-python/wiki/0-The-Plan we need to convert the `itertools` extension module to use module state.
There are multiple static global type objects:
https://github.com/python/cpython/blob/e244... | 2b3e02a705907d0db2ce5266f06ad88a6b6160db | cc407b9de645ab7c137df8ea2409a005369169a5 |
python/cpython | python__cpython-101274 | # Expand on enum limitations
# Documentation
Encountered the python/mypy#14494 issue and it was suggested that we include it on the docs. This issue is an atttempt to expand on the documentation for this particular issue.
<!-- gh-linked-prs -->
### Linked PRs
* gh-101274
<!-- /gh-linked-prs -->
| 037b3ee44e7de00b4653d73d4808c0f679a909a7 | 7109b287cf84cebdfa99b2b0a657d55f6e481be7 |
python/cpython | python__cpython-101394 | # `int` and `set` subclass `__sizeof__` under-reports the instance dictionary pointer
# Bug report
Most built-in types, when subclassed, will have a `__sizeof__` that is 8 (pointer size) larger than the parent object, due to having an instance dictionary.
```python
class UserFloat(float): pass
assert UserFloat... | 39017e04b55d4c110787551dc9a0cb753f27d700 | 9b60ee976a6b66fe96c2d39051612999c26561e5 |
python/cpython | python__cpython-101262 | # Add test for function with > 255 args
I made a change that broke functions with > 255 args, and the only test that failed was a namedtuple test (with a namedtuple with many fields). We need also a test for a plain function call (it makes it easier to see what broke).
<!-- gh-linked-prs -->
### Linked PRs
* gh-10... | bd7903967cd2a19ebc842dd1cce75f60a18aef02 | 7b20a0f55a16b3e2d274cc478e4d04bd8a836a9f |
python/cpython | python__cpython-101230 | # Aliases for imported names is not tested in `test_ast.py`
Such cases as `from bar import y as z` and `import bar as foo` is not tested.
I think, it should be tested =)
<!-- gh-linked-prs -->
### Linked PRs
* gh-101230
* gh-101433
* gh-101434
<!-- /gh-linked-prs -->
| 28db978d7f134edf6c86f21c42e15003511e7e9b | 7a3752338a2bfea023fcb119c842750fe799262f |
python/cpython | python__cpython-101227 | # There is a typo in docstring for read method of _io.TextIOWrapper class
# Documentation
The docstring of the read method of `_io.TextIOWrapper` class has a typo.
The argument name `size `is not used in the explanation.
```
>>> file = open("/tmp/junk")
>>> help(file.read)
read(size=-1, /) method of _io.Text... | f1f3af7b8245e61a2e0abef03b2c6c5902ed7df8 | 272da55affe6f2b3b73ff5474e1246089517d051 |
python/cpython | python__cpython-113567 | # Bug in multiprocessing + Pipes on macOS
<!--
If you're new to Python and you're not sure whether what you're experiencing is a bug, the CPython issue tracker is not
the right place to seek help. Consider the following options instead:
- reading the Python tutorial: https://docs.python.org/3/tutorial/
-... | c7d59bd8cfa053e77ae3446c82afff1fd38a4886 | 21f83efd106a19f1d26e049c06678a6729a721f0 |
python/cpython | python__cpython-101222 | # Possibly missing options in the documentation of timeit
The "Command-Line Interface" part of the documentation of _timeit_ says:
> python -m timeit [-n N] [-r N] [-u U] [-s S] [-h] [statement ...]
But actually the command can take additional two options, **-p** and **-v**, as the next part of the documentation... | 9b60ee976a6b66fe96c2d39051612999c26561e5 | 6e4a521c2ab84c082ad71e540b045699f0dbbc11 |
python/cpython | python__cpython-101324 | # Add optimized versions of isdir / isfile on Windows
I went down this rabbit hole when someone mentioned that `isfile`/`isdir`/`exists` all make a rather expensive `os.stat` call on Windows (which is actually a long wrapper around a number of system calls on Windows), rather than the simpler and more direct call to `... | 86ebd5c3fa9ac0fba3b651f1d4abfca79614af5f | 3a88de7a0af00872d9d57e1d98bc2f035cb15a1c |
python/cpython | python__cpython-101188 | # New warning on GitHub: "unused variable ‘runtime’ in `pystate.c`"
All PRs right now show this warning:
<img width="919" alt="Снимок экрана 2023-01-20 в 10 55 11" src="https://user-images.githubusercontent.com/4660275/213645037-f66d6b42-eca2-4b56-953f-30b514bbc5d7.png">
However, it looks like a false-positive, be... | 8be6992620db18bea31c7f75a33c7dcc3782e95a | 3847a6c64b96bb2cb93be394a590d4df2c35e876 |
python/cpython | python__cpython-101170 | # minor optimization in the implementation of except*
The except* bytecode was implemented before we switched to SWAP/COPY, and the move to them resulted in bytecode that contains one more instruction than necessary:
```
COPY 1
BUILD_LIST
SWAP 2
```
can be written as
```
BUILD_LIST
COPY 2
```
<!-- g... | 9ec9b203eaa219ed13ad9deb21740924bd22b10d | 6036c3e856f033bf13e929536e7bf127fdd921c9 |
python/cpython | python__cpython-101171 | # New deprecation warning in some tests due to a new decorator in test.support
DeprecationWarning: It is deprecated to return a value that is not None from a test case (<bound method _id of <test.test_dis.DisTests testMethod=test_binary_specialize>>)
Shows up in test_dis, test_compile and test_embed, for tests th... | 0c5db2a60701a939288eb4c7704382631a598398 | 9ec9b203eaa219ed13ad9deb21740924bd22b10d |
python/cpython | python__cpython-103369 | # issubclass() is inconsistent with generic aliases
Instances of `types.GenericAlias` are accepted as the first argument of `issubclass()`:
```pycon
>>> issubclass(list[int], object)
True
>>> issubclass(list[int], type)
False
```
while instances of `typing.GenericAlias` are not:
```pycon
>>> issubclass(ty... | d93b4ac2ff7bce07fb1c8805f43838818598191c | 666b68e8f252e3c6238d6eed1fc82937a774316f |
python/cpython | python__cpython-101193 | # PEP 699: Implementation
We can either follow what was outlined here https://github.com/python/peps/pull/2927.
Or https://discuss.python.org/t/pep-699-remove-private-dict-version-field-added-in-pep-509/19724/14
<!-- gh-linked-prs -->
### Linked PRs
* gh-101193
<!-- /gh-linked-prs -->
| 7f95ec3e7405ea5f44adc3584e297a3191118f32 | e244401ce508ad391295beb636e499fcc6797a2a |
python/cpython | python__cpython-101145 | # `zipfile.Path.read_text` & `.open` methods with a positional `encoding` arg causes a TypeError
This is a regression from 3.9 behavior seen in Python 3.10.
zipfile.Path.read_text passes *args and **kwargs to it's own `open()` method, but in 3.10+ is also blindly sets `kwargs["encodings"]` to a value. So code that ... | 5927013e47a8c63b70e104152351f3447baa819c | 9e025d305f159aebf01775ad1dc2817679f01aa9 |
python/cpython | python__cpython-101197 | # asyncio.base_events.BaseEventLoop._add_callback references TimerHandle but never uses them
<!--
If you're new to Python and you're not sure whether what you're experiencing is a bug, the CPython issue tracker is not
the right place to seek help. Consider the following options instead:
- reading the Python... | 9e947675ae3dc32f5863e5ed3022301cf7fd79b4 | c22a55c8b4f142ff679880ec954691d5920b7845 |
python/cpython | python__cpython-118593 | # Add .rst to mimetypes
``` python
>>> import mimetypes
>>> mimetypes.guess_type("README.rst", strict=False)
(None, None)
```
In the `python:3.11` Docker image, we get [a vanity type](https://www.iana.org/assignments/media-types/text/prs.fallenstein.rst):
``` python
>>> mimetypes.guess_type("README.rst", strict... | 1511bc95c4bc95bd35599dc9c88111c9aac44c0d | b6f0ab5b1cb6d779efe4867d83a60e8d66c48dee |
python/cpython | python__cpython-101138 | # Windows py launcher: older 32-bit versions not supported in some cases
# Bug report
On 64-bit Windows, if both Python 2.7 32-bit and Python 2.7 64-bit are installed, these two installs are considered equivalent and only the 64-bit version is considered, both when running `py -2-32` (which fails) and `py -0` (whic... | daec3a463c747c852d7ee91e82770fb1763d7d31 | fee7a995a18589001a432cea365fd04bf8efb7c1 |
python/cpython | python__cpython-101124 | # invalid signature for math.hypot
```python
>>> import math
>>> import inspect
>>> inspect.signature(math.hypot)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/sk/src/cpython/Lib/inspect.py", line 3295, in signature
return Signature.from_callable(obj, follow_wrapped... | 9f904398179bcbab4bf21b2500aa14aec01fbdb3 | b562bc672bff106f1cbf2aad7770b654bfe374ec |
python/cpython | python__cpython-104287 | # SQLite rowcount is corrupted when combining UPDATE RETURNING w/ id IN (?)
# Bug report
The rowcount from an sqlite UPDATE RETURNING query with WHERE id IN (?) used (but not == ?) will be 0.
The reproduction case from #93421 runs successfully. The modified reproduction case below errors with:
```
Traceback... | 7470321f8171dce96a604ba2c24176837f999ca0 | 4abfe6a14b5be5decbaa3142d9e2549cf2d86c34 |
python/cpython | python__cpython-101132 | # `Path.rglob` -> documentation does not specify what `pattern` is
# Documentation
Today I came across `Path.rglob` in our codebase.
I went to https://docs.python.org/3/library/pathlib.html#pathlib.Path.rglob and tried to find out what `pattern` actually is. While the current documentation links to `Path.glob()`... | 61f338a005aa9f36b2a0a8d6924857e703bb6140 | f1d0711dd33bdd6485082116ddaca004c225b62f |
python/cpython | python__cpython-101121 | # `optparse` -> information about `store_const` is a bit vague
# Documentation
For context - new `optparse` user here.
After I have seen `store_const` in our code base, I had a bit of a hard time to figure out the difference between `store` and `store_const`.
The [Other actions](https://docs.python.org/3/lib... | 9a155138c58cad409e28e34359ba87ec0025b6b7 | 61f338a005aa9f36b2a0a8d6924857e703bb6140 |
python/cpython | python__cpython-101119 | # Typo in python random.random documentation
There is a typo in documentation [here](https://docs.python.org/3/library/random.html#random.random) regarding random.random()
`the next random floating point number in the range [0.0, 1.0).`
It can be corrected by replacing ")" with "]"
<!-- gh-linked-prs -->
### L... | 8bcd4a6ec7f951d952c174c6a8d937cc62444738 | 3e09f3152e518cdc8779b52943b86812114ce071 |
python/cpython | python__cpython-101127 | # 3.11 regression: default arguments in PyEval_EvalCodeEx
# Bug report
3.11 Started using `_PyFunction_FromConstructor` inside PyEval_EvalCodeEx. #92173 reported that this caused issues when closures were involved because `_PyFunction_FromConstructor` discarded the closure found in `PyFrameConstructor`. This was fi... | 79903240480429a6e545177416a7b782b0e5b9bd | ae62bddaf81176a7e55f95f18d55621c9c46c23d |
python/cpython | python__cpython-101061 | # Configure should conditionally add `-fno-reorder-blocks-and-partition`
# Bug report
`--enable-bolt` currently unconditionally adds `-fno-reorder-blocks-and-partition`. This flag isn't implemented on Clang and breaks the build in this configuration.
PR forthcoming.
<!-- gh-linked-prs -->
### Linked PRs
* gh-1... | 7589d713a14a1efbb0cbb7caa9fdbad2b081cf18 | 7f95ec3e7405ea5f44adc3584e297a3191118f32 |
python/cpython | python__cpython-101057 | # Potential memory leak in Objects/bytesobject.c
<!--
If you're new to Python and you're not sure whether what you're experiencing is a bug, the CPython issue tracker is not
the right place to seek help. Consider the following options instead:
- reading the Python tutorial: https://docs.python.org/3/tutoria... | b1a74a182d8762bda51838401ac92b6ebad9632a | b82049993f74185da71adf2eb8d6c8f15db063e1 |
python/cpython | python__cpython-101048 | # Remove LIBTOOL_CRUFT from configure
# Feature or enhancement
Per summary.
<!-- gh-linked-prs -->
### Linked PRs
* gh-101048
<!-- /gh-linked-prs -->
| 79af40a40384ff57238185017970c3f60e351ee1 | 4db64529aea775aa23b24f35d08611f427ec2f6f |
python/cpython | python__cpython-101042 | # `utcfromtimetuple` is mentioned in documentation, which isn't a thing. The 'from' part is erroneous
# Documentation
In datetime module documentation [here](https://docs.python.org/3/library/datetime.html#datetime.datetime.utctimetuple)
in "Warning" block instead of `utctimetuple` there's `utcfromtimetuple`.
... | 8e9d08b062bbabfe439bc73f82e3d7bb3800189e | 5e9df888dd5ab0e59d1cebc30c998a17aa65a3e2 |
python/cpython | python__cpython-101038 | # long_subtype_new underallocates for zero
When creating `int` instances, we [always allocate](https://github.com/python/cpython/blob/ef633e5000222a3dba74473c49d6a81fca0a44ec/Objects/longobject.c#L157) space for and initialise at least one digit, since the `medium_value` function that's used for fast paths [assumes th... | 401fdf9c851eb61229250ebffa942adca99b36d1 | 9e947675ae3dc32f5863e5ed3022301cf7fd79b4 |
python/cpython | python__cpython-101024 | # The docs for email.mime types incorrectly identify bytes as strings
# Documentation
For example:
> _imagedata is a string containing the raw image data. ([image.py](https://github.com/python/cpython/blob/main/Lib/email/mime/image.py#L20))
or
> _audiodata is a string containing the raw audio data. ([audio.p... | 49cae39ef020eaf242607bb2d2d193760b9855a6 | ef633e5000222a3dba74473c49d6a81fca0a44ec |
python/cpython | python__cpython-101031 | # [typing: PEP 646]: `*tuple[int, int]` is improperly evaluated by `get_type_hints`
# Bug report
Unpack information of `typing.GenericAlias` is not transferred from string annotations to interpreted annotations. `typing.Unpacked` works as expected.
A fix could be to add `if getattr(t, "__unpacked__", False): ret... | 807d6b576fa37f3ab7eb951297cb365c0c198595 | d717be04dc7876696cb21ce7901bda0214c4b2e0 |
python/cpython | python__cpython-101007 | # Improve error handling when read marshal data
There are several issues in error handling in the marshal module:
1. EOFError can override other errors such as MemoryError or OSError at the start of the object.
2. When the NULL object occurs as a code object component, the error message can be misleading (like "N... | 8bf6904b229583033035d91a3800da5604dcaad4 | 3fb7c608e5764559a718ce8cb81350d7a3df0356 |
python/cpython | python__cpython-101002 | # Add os.path.splitroot() function
# Feature or enhancement
Add a function that splits a path into a `(drive, root, tail)` triad:
1. The _drive_ part has the same meaning as in `splitdrive()`
2. The _root_ part is one of: the empty string, a forward slash, a backward slash (Windows only), or two forward slashes... | e5b08ddddf1099f04bf65e63017de840bd4b5980 | 37f15a5efab847b8aca47981ab596e9c36445bf7 |
python/cpython | python__cpython-100998 | # Implement Multi-Phase Init for the _testinternalcapi Module
See PEP 630 and PEP 687. This is an internal test module so the bar isn't as high as for regular stdlib modules.
<!-- gh-linked-prs -->
### Linked PRs
* gh-100998
* gh-101058
<!-- /gh-linked-prs -->
| b511d3512ba334475201baf4d9db7c4d28f0a9ad | 005e69403d638f9ff8f71e59960c600016e101a4 |
python/cpython | python__cpython-100990 | # Accommodate Sphinx option by changing docstring return type of "integer" to "int".
# Bug report
When `collections.deque` is subclassed and the resulting class is documented with Sphinx using the option `:inherited-members:`, the following error appears:
```
WARNING: py:class reference target not found: integer ... | c74073657e32b8872f91b3bbe1efa9af20adbea9 | c24f1f1e874c283bb11d8b9fbd661536ade19fe9 |
python/cpython | python__cpython-100986 | # HTTPSConnection double wrapping IPv6 address during CONNECT
# Bug report
when http.client.HTTPSConnection is used with IPv6 addresses and a proxy results in the "Host:" Header being
wrapped in square brackets twice. (e.g. Host: [[fd2e:6f44:5dd8:c956::15]]:5050 )
```
$ cat /tmp/proxy_test.py
import http.cli... | 465db27cb983084e718a1fd9519b2726c96935cb | 4dff48d1f454096efa2e1e7b4596bc56c6f68c20 |
python/cpython | python__cpython-100983 | # Specialization of some instructions does not conform to PEP 659, and prevents PEP 669
As written, PEP 659 says that individual specializations are restricted to a single instruction.
PEP 669 relies on this, as it also wants to replace instructions at runtime, and it would break if specialization occurs across multi... | 7b14c2ef194b6eed79670aa9d7e29ab8e2256a56 | b1a74a182d8762bda51838401ac92b6ebad9632a |
python/cpython | python__cpython-124292 | # ctypes Stucture._fields_ cannot be set when Structure has been subclassed
# Bug report
Currently the method for defining Structure fields that cannot be defined within the class, is to define the class with `pass` and then set `_fields_` outside. But `ctypes.Structure` incorrectly raises `AttributeError`, even wh... | be76e3f26e0b907f711497d006b8b83bff04c036 | e256a7590a0149feadfef161ed000991376dc0e8 |
python/cpython | python__cpython-100936 | # Change "char *str" to "const char *str" in KeywordToken because it is an immutable string.
<!--
If you're new to Python and you're not sure whether what you're experiencing is a bug, the CPython issue tracker is not
the right place to seek help. Consider the following options instead:
- reading the Python... | a1e051a23736fdf3da812363bcaf32e53a294f03 | 75c8133efec035ec1083ebd8e7d43ef340c2e581 |
python/cpython | python__cpython-100934 | # Remove `check_string` and `check_mapping` from `test_xml_etree`
Right now one test in `test_xml_etree` contains two helpers called `check_mapping` and `check_string`:
https://github.com/python/cpython/blob/8dd2766d99f8f51ad62dc0fde8282483590c6cd0/Lib/test/test_xml_etree.py#L206-L241
It originates from very old... | eb49d32b9af0b3b01a5588626179187f11d145c9 | feec49c40736fc05626a183a8d14c4ebbea5ae28 |
python/cpython | python__cpython-100932 | # Improve `pickle` protocols coverage in `test_slice`
While working on https://github.com/python/cpython/issues/100817 I've noticed that `slice` is only tested with 3 `pickle` protocols. See https://github.com/python/cpython/blob/8dd2766d99f8f51ad62dc0fde8282483590c6cd0/Lib/test/test_slice.py#L237-L243 I don't think ... | 8795ad1bd0d6ee031543fcaf5a86a60b37950714 | 8dd2766d99f8f51ad62dc0fde8282483590c6cd0 |
python/cpython | python__cpython-92650 | # Reuse code objects for similar `dataclass` definitions
A little over a year ago, @dabeaz came up with a cool way of speeding up `dataclass` creation by avoiding unnecessary `exec` calls. Essentially, his proof-of-concept `dataklasses` module caches code objects for methods of "similarly-shaped" dataclasses, and patc... | 3dbca81c9b7903e8d808089a6a76dc97807b3df3 | 4f6f34fb0b7c1048b238062015f3fef7372a911f |
python/cpython | python__cpython-131282 | # ctypes infinite pointer cache
# Bug(ish?) report
The following function has a cache. If you are using a factory to call ctypes.POINTER in a loop, the memory usage is unbounded and unable to be reclaimed.
https://docs.python.org/3/library/ctypes.html#ctypes.POINTER
The documentation should mention that ... | a0bc0c462ff55b4112be49d1839635ac3a4a9878 | 7e7e49be78e26d0a3b861a04bbec1635aabb71b9 |
python/cpython | python__cpython-100924 | # The "mask" stored in the cache of `COMPARE_OP` could be stored in the oparg.
The "when to branch mask" used by specializations of `COMPARE_OP` takes 4 bits, the comparison operator take 3 bits.
Since the mask can be computed at compile time, it should be stored in the oparg along with the comparison operator.
This... | 6e4e14d98fe0868981f29701496d57a8223c5407 | 61f12b8ff7073064040ff0e6220150408d24829b |
python/cpython | python__cpython-101514 | # asyncio Streams wait_closed
# Documentation
https://docs.python.org/3/library/asyncio-stream.html - assuming that `await stream.wait_closed()` should be called after all uses of `.close()` - which both the `close()` and `wait_closed()` methods both heavily suggest should be the case - then all examples on this pa... | 5c39daf50b7f388f9b24bb2d6ef415955440bebf | 5dcae3f0c3e9072251217e814a9438670e5f1e40 |
python/cpython | python__cpython-100917 | # Convert argument to appropriate type
# Documentation
https://docs.python.org/3/howto/logging-cookbook.html#use-of-contextvars
The argument `count` should be converted to integer type if user passes value to `main.py`.
```bash
$ python3 main.py --count 100
Traceback (most recent call last):
File "/hom... | b2f7b2ef0b5421e01efb8c7bee2ef95d3bab77eb | 35650f25383efce83b62d5273110ab8dcdbcc254 |
python/cpython | python__cpython-100913 | # Update documentation for `sys.winver` to not say it's "normally the first three characters of version"
# Documentation
https://docs.python.org/3/library/sys.html#sys.winver says:
> The value is normally the first three characters of [version](https://docs.python.org/3/library/sys.html#sys.version).
That has... | d9dff4c8b5ab41c47af002ad7fb083c953e75f31 | 02a72f080dc89b037c304a85a0f96509de9ae688 |
python/cpython | python__cpython-100905 | # Mac Readme doc mentions bpo
# Documentation
In: https://github.com/python/cpython/blob/main/Mac/README.rst#L351
It says
```
configure: WARNING: ## Report this to https://bugs.python.org/ ##
```
Since we no longer use b.p.o, this link is not correct.
<!-- gh-linked-prs -->
### Linked PRs... | be23a202426385ad99dcb2611152783780c7bc42 | 3f3c78e32fc67766232ee4ddf17b560c9836a2d1 |
python/cpython | python__cpython-100922 | # Possible race condition between `threading.local()` and GIL acquisition on Linux
# Bug report
TSAN reports a race condition from a Python program that both uses `threading.local()` and also a native extension that attempts to acquire the GIL in a separate, native thread.
To reproduce, build both the Python int... | 762745a124cbc297cf2fe6f3ec9ca1840bb2e873 | 847d7708ba8739a5d5d31f22d71497527a7d8241 |
python/cpython | python__cpython-100885 | # email: address list folding encodes list-separator comma
# Bug report
When during address list folding a separating comma ends up on a folded line containing that is to be unicode-encoded than the separator itself is also unicode encoded. Instead the comma should still a plain comma.
This is rejected by some ... | 09fab93c3d857496c0bd162797fab816c311ee48 | 465db27cb983084e718a1fd9519b2726c96935cb |
python/cpython | python__cpython-100883 | # Improve `test_pickling` in `test_ast`
Here's how it is defined right now: https://github.com/python/cpython/blob/837ba052672d1a5f85a46c1b6d4b6e7d192af6f3/Lib/test/test_ast.py#L640-L655
I see two major problems here:
1. `cPickle` does not exist anymore (since 3.0), so it always fails with `ImportError`. If we wan... | 2e80c2a976c13dcb69a654b386164dca362295a3 | f08209874e58d0adbb08bd1dba4f58ba63f571c5 |
python/cpython | python__cpython-100881 | # Warning: "‘lo’ may be used uninitialized in this function" in `math_fsum` in `mathmodule.c`
Looks like that after https://github.com/python/cpython/commit/87d3bd0e02cddc415a42573052110eb9301d2c3d we got a new warning:
<img width="918" alt="Снимок экрана 2023-01-09 в 10 40 53" src="https://user-images.githubusercont... | 36f2329367f3608d15562f1c9e89c50a1bd07b0b | 837ba052672d1a5f85a46c1b6d4b6e7d192af6f3 |
python/cpython | python__cpython-100872 | # Improve tests of `copy` module
After working on https://github.com/python/cpython/issues/100817 I've noticed that there are multiple things that can be improved in terms of `copy` module tests:
1. First of all, I had submitted some broken code in https://github.com/python/cpython/pull/100818 but, our test cases wer... | 729ab9b622957fef0e9b494af9a71ab02986c741 | 762745a124cbc297cf2fe6f3ec9ca1840bb2e873 |
python/cpython | python__cpython-100845 | # Has the volatile declaration in fsum() outlived its usefulness?
This bit of defensive programming is costly. Removing the `volatile` declaration reduces the running time of `fsum()` for a hundred floats from `2.26 usec per loop` to `1.42 usec per loop`.
I'm thinking the x87 issues have mostly faded. If we do ne... | 87d3bd0e02cddc415a42573052110eb9301d2c3d | b139bcd8922b47bf77c75d5f6704cc9147852546 |
python/cpython | python__cpython-100825 | # Possible typo in the documentation of unittest.TestLoader.testNamePatterns
The documentation for _TestLoader_.**testNamePatterns** in the module _unittest_ says:
> List of Unix shell-style wildcard test name patterns that test methods have to match to be included in test suites (see **-v** option).
> ...
> Note... | 6d3bc4a795e7a60f665e41b2d4b6803f3844fc48 | a2141882f259e21bb09fa0b7cba8142147b9e3d7 |
python/cpython | python__cpython-100816 | # Normalize `types` module usage in `copy` module
Right now there are two minor problems with it:
1. Here `CodeType` is assumed to be missing for some reason: https://github.com/python/cpython/blob/26ff43625ed7bf09542ad8f149cb6af710b41e15/Lib/copy.py#L109 But here, it is just used as it should be: https://github.com/... | 951303fd855838d47765dcd05471e14311dc9fdd | 6746135b0722a5359ce6346554c847afba603b5a |
python/cpython | python__cpython-107692 | # Missing method tkinter.Image._register
# Bug report
When `tkinter` get's a keyword argument, it tries to convert it to a string that tcl/tk can handle. The problem is that when a callable object is passed in as the value for a keyword argument, `tkinter` usually calls an internal `_register` method but it's missi... | 50e3cc9748eb2103eb7ed6cc5a74d177df3cfb13 | 835e38891535649321230f94121410244c583966 |
python/cpython | python__cpython-10294 | # Add IPv4 socket option constant IP_PKTINFO as socket module attribute.
# Feature or enhancement
Add IPv4 socket option constant IP_PKTINFO as socket module attribute.
# Pitch
The socket option IP_PKTINFO is defined on Linux and OSX.
I would think we would want all the socket option constants defined in sys... | 2cdc5189a6bc3157fddd814662bde99ecfd77529 | 30a306c2ade6c2af3c0b1d988a17dae3916e0d27 |
python/cpython | python__cpython-100812 | # pathlib.Path.absolute() mishandles drive-relative Windows paths
Windows has one current directory *per drive*, and supports drive-relative paths like 'X:' and 'X:foo.txt'. This makes a conversion from relative to absolute paths more complicated than simply prepending a (single) current directory.
It's correctly... | 072011b3c38f871cdc3ab62630ea2234d09456d1 | d401b20630965c0e1d2a5a0d60d5fc51aa5a8d80 |
python/cpython | python__cpython-100830 | # random.choice fails on numpy arrays
# Bug report
In a project of mine I use random.choice on a numpy array (at multiple point in the code) which worked fine until recently. After upgrading to Python 3.11, my code crashes with:
`ValueError: The truth value of an array with more than one element is ambiguous. Use ... | 9a68ff12c3e647a4f8dd935919ae296593770a6b | 87d3bd0e02cddc415a42573052110eb9301d2c3d |
python/cpython | python__cpython-101010 | # segfault in a docker container on host with ipv6 disabled when using getaddrinfo from socket.py
# Bug report
I did open an issue with fail2ban, but apparently the issue is in python itself.
https://github.com/fail2ban/fail2ban/issues/3438
fail2ban-python -c 'from fail2ban.server.ipdns import DNSUtils; print(... | f267b623f3634d8ef246de55970132d28854b22f | ea7c7af10b72ec4f3c5ad2bb6beb1d3667ff978e |
python/cpython | python__cpython-100793 | # Make `email.message.Message.__contains__` faster
Right now the implementation of `Message.__contains__` looks like this: https://github.com/python/cpython/blob/2f2fa03ff3d566b675020787e23de8fb4ca78e99/Lib/email/message.py#L450-L451
There are several problems here:
1. We build intermediate structure (`list` in th... | 6746135b0722a5359ce6346554c847afba603b5a | 47b9f83a83db288c652e43567c7b0f74d87a29be |
python/cpython | python__cpython-100811 | # Clarify os.path.join documentation
https://docs.python.org/3/library/os.path.html#os.path.join
> On Windows, the drive letter is not reset when an absolute path component (e.g., r'\foo') is encountered. If a component contains a drive letter, all previous components are thrown away and the drive letter is reset. ... | 909a6746939ea1d09fab21f26b558cfd7e3e29a0 | ef09bf63d22b2efe5c0e9a2b9f25a9bec2ba1db0 |
python/cpython | python__cpython-100788 | # Incorrect documentation for `input` parameter
The documentation for `input` when using `help(...)` shows this:
```python
>>> help(input)
Help on built-in function input in module builtins:
input(prompt=None, /)
Read a string from standard input. The trailing newline is stripped.
The prompt strin... | a2141882f259e21bb09fa0b7cba8142147b9e3d7 | df3851fe4ab8c9013aeb5dfd75d6e8edf2ece9a8 |
python/cpython | python__cpython-100765 | # Include/internal/pycore_frame.h is missing from PYTHON_HEADERS in makefile
This means that in development, changes to `pycore_frame.h` won't result in re-compilation of any compilation units.
<!-- gh-linked-prs -->
### Linked PRs
* gh-100765
<!-- /gh-linked-prs -->
| 0cd597fef10d30a100fa4d5e132b3d385a5ac0a4 | 7a50d6b5b09a88e915891757fdd6d371310d2e96 |
python/cpython | python__cpython-100759 | # Refactor initialisation of frame headers into a single function
There are 3 places in the code where we prepare a frame for execution:
1. _PyFrame_PushUnchecked in pycore_frame.h
2. init_frame in frameobject.c
3. _PyEvalFramePushAndInit in ceval.c
All of these call the function _PyFrame_InitializeSpecials to... | 15c44789bb125b93e96815a336ec73423c47508e | 78068126a1f2172ff61a0871ba43d8530bc73905 |
python/cpython | python__cpython-100751 | # PEP 597: platform from_subprocess missing encoding kwarg
<!--
If you're new to Python and you're not sure whether what you're experiencing is a bug, the CPython issue tracker is not
the right place to seek help. Consider the following options instead:
- reading the Python tutorial: https://docs.python.org... | 6b3993c556eb3bb36d1754a17643cddd3f6ade92 | 01093b82037fbae83623581294a0f1cf5b4a44b0 |
python/cpython | python__cpython-100748 | # Some compiler macros use c instead of C to access the compiler
This is "harmless" at the moment because in all usage sites c is passed in for C, but it's wrong.
```diff
diff --git a/Python/compile.c b/Python/compile.c
index cbbdfb9e94..f2deada47a 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -1626,... | 52017dbe1681a7cd4fe0e8d6fbbf81fd711a0506 | 15aecf8dd70f82eb507d74fae9662072a377bdc8 |
python/cpython | python__cpython-116713 | # Dict comprehensions are not tested at all in `test_named_expressions.py`
While working on https://github.com/python/cpython/pull/100581 I've noticed that we do not test `dict` comprehensions at all there.
I think that this needs to be improved.
I will add test case for them soon, PR is in the works.
<!-- gh-lin... | 25684e71310642ffd20b45eea9b5226a1fa809a5 | 7f418fb111dec325b5c9fe6f6e96076049322f02 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.