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-100740 | # Mock spec not respected for attributes prefixed with assert
# Bug report
Example:
```python
from unittest.mock import Mock
class Foo:
def assert_something(self):
pass
m = Mock(spec=Foo)
m.assert_something()
```
An exception is raised:
```pytb
Traceback (most recent call last):
... | 7f1eefc6f4843f0fca60308f557a71af11d18a53 | 52017dbe1681a7cd4fe0e8d6fbbf81fd711a0506 |
python/cpython | python__cpython-114657 | # `Doc/whatsnew/3.{9,10,11}.rst` are out of sync on various branches
# Documentation
There are various inconsistencies between the whatsnew documents for 3.9, 3.10, and 3.11 on the `3.9`, `3.10`, `3.11`, and `main` branches. Most of the inconsistencies are trivial, but some will require some research to determine ... | 3bb6912d8832e6e0a98c74de360dc1b23906c4b3 | d00fbed68ffcd5823acbb32a0e47e2e5f9732ff7 |
python/cpython | python__cpython-100722 | # Add _PyFrame_NumSlotsForCodeObject()
The calculation of how many slots need to be in the frame of a given code object is repeated in a number of places in the codebase, which makes it error prone to try and change the frame layout. It should be refactored into a single place.
(lessons learnt from the register ma... | c31e356a10aa60b5967b9aaf80b9984059e46461 | 5fb1c08e15b864d8ea9353a0e013166e2e0e2160 |
python/cpython | python__cpython-100721 | # Code objects, function objects and generator object contain quite a lot of redundant information
There is a quite a lot of redundancy in code, function and generator objects.
### Intra-object redundancy
1. Code objects have four fields ,`co_nlocalsplus`, `co_nplaincellvars`, `co_nlocals`, `co_nfreevars`. Any o... | 15aecf8dd70f82eb507d74fae9662072a377bdc8 | c31e356a10aa60b5967b9aaf80b9984059e46461 |
python/cpython | python__cpython-100713 | # Make it possible to disable specialization (for debugging).
<!-- gh-linked-prs -->
### Linked PRs
* gh-100713
<!-- /gh-linked-prs -->
| e9ccfe4a636d5fe33f65cea2605c3621ffa55f19 | a1e051a23736fdf3da812363bcaf32e53a294f03 |
python/cpython | python__cpython-100728 | # "What's New In Python X.YZ" Pages Show Incorrect Release Information
# Documentation
From this page https://docs.python.org/release/3.11.1/whatsnew/index.html, if you click on 3.11 or 3.10, you see the release information. It appears incorrect on 3.10, 3.9. Earlier releases are inconsistent (missing that same hea... | e196d8c10a669e1996140a0e594489aa9421a38b | e6d44407827490a5345e8393fbdc78fd6c14f5b1 |
python/cpython | python__cpython-100691 | # Prevent prefix "called_" for methods on mock objects in safe mode
# Prevent prefix "called_" for methods on mock objects in safe mode
# Pitch
In safe mode, there's already support for catching typos for accessing the assertion methods:
> By default, accessing any attribute whose name starts with assert, ass... | 1d4d677d1c90fcf4886ded0bf04b8f9d5b60b909 | 9ffbc58f5cb6d2b002f8785886588d646af517db |
python/cpython | python__cpython-100745 | # Crash in _elementtree.c after #24061
<!--
Use this template for hard crashes of the interpreter, segmentation faults, failed C-level assertions, and similar.
Do not submit this form if you encounter an exception being unexpectedly raised from a Python function.
Most of the time, these should be filed as bug... | b034fd3e5926c63a681a211087b4c666834c7525 | 53455a319f3f2e5609fca2a313ea356fba318665 |
python/cpython | python__cpython-100678 | # Improve description for `venv --upgrade-deps`
The current description comes out as `Upgrade core dependencies: pip setuptools to the latest version in PyPI`. The lack of comma between "pip" and "setuptools" reads slightly odd to me. I think it's because `" ".join()` is used instead of `", ".join()`.
https://githu... | 9dee9731663d670652586c929190f227ab56bd8f | 7feb6d2f85d69fbabfc0598d8947124883167f12 |
python/cpython | python__cpython-100701 | # typing.get_type_hints documentation claims it no longer includes base class type hints.
# Documentation
The `typing.get_type_hints` documentation currently says
> Changed in version 3.10: Calling get_type_hints() on a class no longer returns the annotations of its base classes.
This is incorrect. No such ch... | deaf090699a7312cccb0637409f44de3f382389b | 7116030a25f7dd2140ef3e889f3f5471334d6d0b |
python/cpython | python__cpython-100960 | # Clarify how sqlite3 maps parameters onto placeholders
> agree; you might want to clarify though that the use of "qmark" or "named" is detected automatically on a per-statement basis (provided my understanding of that is correct).
Yes, we should definitely clarify how parameters are interpreted and mapped to the p... | 206f05a46b426eb374f724f8e7cd42f2f9643bb8 | 124af17b6e49f0f22fbe646fb57800393235d704 |
python/cpython | python__cpython-100650 | # The `native_thread_id` field of `PyThreadState` is not updated after fork
# Bug report
The `native_thread_id` field of the `PyThreadState` object is not updated after a fork on Linux (at least). This means that child processes spawned by the main thread of the parent process will have a main thread with the paren... | d52d4942cfdd52a50f88b87b1ff2a67375dbcf47 | e83f88a455261ed53530a960f1514ab7af7d2e82 |
python/cpython | python__cpython-100663 | # `__sizeof__` incorrectly ignores the size 1 array in PyVarObjects (bool, int, tuple) when ob_size is 0
# Bug report
`tuple.__sizeof__`, `int.__sizeof__`, and `bool.__sizeof__` incorrectly returns a size using an algorithm that assumes the `ob_item` / `ob_digit` array is size 0 when `ob_size` is 0, when this is no... | d7e7f79ca7c2029e46a06d21a7a5abea631b5d13 | 9dee9731663d670652586c929190f227ab56bd8f |
python/cpython | python__cpython-100638 | # [tutorial/classes.html] odds and ends dataclasses sample code typo dataclasses
# Documentation
Open https://docs.python.org/3.12/tutorial/classes.html#odds-and-ends
There is a typo in the sample code. `import dataclasses` should be `import dataclass`.
```python
from dataclasses import dataclasses
@datacla... | 98308dbeb110198ebe28bdb7720d3671b3e7f57b | 636e9dd23f88c701eecf91156835fe0fc8b1feb6 |
python/cpython | python__cpython-24961 | # Document 'attr' parameter for window.vline() in curses module
# Documentation
Function [window.vline](https://docs.python.org/3/library/curses.html#curses.window.vline) is missing the `attr` parameter, which defaults to `A_NORMAL` (this is already documented).
<!-- gh-linked-prs -->
### Linked PRs
* gh-24961
* g... | 9ddc388527477afdae17252628d63138631072ba | 42f7a00ae8b6b3fa09115e24b9512216c6c8978e |
python/cpython | python__cpython-100601 | # Test `test_bpo_45813_2` in `test_coroutines` generates a "coroutine was never awaited" warning
While playing around with https://github.com/python/cpython/pull/100582 and looking at build/test logs, I've noticed that there's this warning:
```
» ./python.exe -m test -v test_coroutines -m test_bpo_45813_2
== CPyt... | 76856366d3ece34c3e738f7167329e97bbf52b34 | f10f503b24a35a43910a632ee50c7568bedd6664 |
python/cpython | python__cpython-100586 | # importlib.resources.as_file is leaving temporary file pointers open
# Bug report
importlib.resources.as_file is leaving temporary file pointers open after writing their contents
see `_write_contents` function in importlib/resources/_common.py
Easy to repeat, just run the test case below with `-We`
`Lib.test.... | f10f503b24a35a43910a632ee50c7568bedd6664 | cf1c09818032df3080c2cd9e7edb5f657213dc83 |
python/cpython | python__cpython-100590 | # replace pydoc with pydoc3
# Documentation
The [3.11 docs](https://docs.python.org/3.11/library/pydoc.html) and [3.10 docs](https://docs.python.org/3.10/library/pydoc.html) state that pydoc can be invoked as a script, giving as example`pydoc sys`. However, there's no such command after installing those versions on... | 7223d50b9785bc7b0cd76dcc68d97dabcbade4b6 | 76856366d3ece34c3e738f7167329e97bbf52b34 |
python/cpython | python__cpython-100579 | # Replace `assert(0)` with `Py_UNREACHABLE` in `Python/symtable.c`
While looking at https://github.com/python/cpython/issues/87447 I've noticed that there are three places in `cpython` where `assert(0)` is used instead of `Py_UNREACHABLE` macro:
https://github.com/python/cpython/blob/984894a9a25c0f8298565b0c0c2e1f4... | 5e1adb4f8861f2a5969952d24c8ad0ce8ec0a8ec | 457c1f4a19a096a52d6553687c7c4cee415818dc |
python/cpython | python__cpython-100575 | # Add `strptime`/`strftime` format code examples
Currently the docs for [`datetime.strptime`](https://docs.python.org/3/library/datetime.html#datetime.datetime.strptime) and [`datetime.strftime`](https://docs.python.org/3/library/datetime.html#datetime.date.strftime) don't include an example but have a link to the [ta... | 3310b94d3db2f477cf2b8789c30ac0f22f82d2dd | 1e9dfdacefa2c8c27762ba6491b0f570147ee355 |
python/cpython | python__cpython-100959 | # Calling os.stat() on a named pipe used by asyncio.ProactorEventLoop.start_serving_pipe() will raise OSError
# Bug report
On Windows, several calls to `os.stat()` on the named pipe used by `asyncio.ProactorEventLoop.start_serving_pipe()` will result in an `OSError`. At this time, the first call to `os.stat()` will... | 1bc7a736837272b15ad3a7aa472977bc720d1033 | c00eb1eae6af3ee5b7e314add4606da4521bb8c5 |
python/cpython | python__cpython-100563 | # Improve performance of pathlib.Path.absolute()
The current implementation of `pathlib.Path.absolute()` calls `self.cwd()` rather than `os.getcwd()`, and so constructs _two_ `Path` objects rather than one. As path objects are [slow to construct](https://github.com/faster-cpython/ideas/discussions/194), this has a per... | 7fba99eadb3349a6d49d02f13b1fddf44c674393 | af5149f30b652737ef3b495b303819d985f439b1 |
python/cpython | python__cpython-100589 | # Better `or` doc wording
# Documentation
`x or y` is [documented](https://docs.python.org/3/library/stdtypes.html#boolean-operations-and-or-not) as:
> if x is false, then y, else x
That looks unnatural/backwards/negated to me. It's not how I think of it. I suggest:
> if x is true, then x, else y
<!-- gh-... | b40dd71241f092d90c192ebff5d58cbd7e84dc52 | 350ba7c07f8983537883e093c5c623287a2a22e5 |
python/cpython | python__cpython-123332 | # Support setting `tp_vectorcall` for heap types
# Feature or enhancement
The `tp_vectorcall` slot can be used with static types to define a more efficient implementation of `__new__` / `__init__`. This slot does not have a typedef in typeslots.h, so it cannot currently be set for `PyType_FromSpec` or read using `P... | 74330d992be26829dba65ab83d698d42b2f2a2ee | bbb36c0934b7644a9f8b67d3cae78aa6240e005a |
python/cpython | python__cpython-100555 | # Improve `test_sqlite3.test_sqlite_row_iter`
While working on #100457 I've noticed that `test_sqlite_row_iter` can be improved. Right now it is defined as:
```python
def test_sqlite_row_iter(self):
"""Checks if the row object is iterable"""
self.con.row_factory = sqlite.Row
row = se... | 3dc48dabd48864039951715816e07986a4828d80 | b0ea28913e3bf684ef847a71afcdfa8224bab63d |
python/cpython | python__cpython-100547 | # eval() documentation is wrong about keyword arguments
# Documentation
[The docs for `eval()`](https://docs.python.org/3/library/functions.html#eval) say it takes keyword arguments, which is incorrect:
```
eval(expression, /, globals=None, locals=None)
```
For example:
```
>>> eval('a', locals={'a': 0})
... | 71159a8e078bda0c9a39c6cd0980b7ba238dc582 | 1f6c87ca7b9351b2e5c5363504796fce0554c9b8 |
python/cpython | python__cpython-100541 | # Clean up `_ctypes`/`libffi` build, particularly on macOS
bpo-28491/gh-72677 was closed after bpo-41100/gh-85272, but [`Modules/_ctypes/libffi_osx`](https://github.com/python/cpython/tree/3.11/Modules/_ctypes/libffi_osx) wasn't actually removed, just made inaccessible to any build. In the course of figuring out whet... | 2df82db48506e5a2044a28f147fdb42f662d37b9 | 7223d50b9785bc7b0cd76dcc68d97dabcbade4b6 |
python/cpython | python__cpython-103576 | # Confusing error message when attempting to pass a newtype as a match pattern
```python
from typing import NewType
T = NewType('T', str)
match 'test':
case T(): ...
```
fails with:
```
Traceback (most recent call last):
File "/tmp/foo.py", line 6, in <module>
case T(): ...
^^^
T... | 07804ce24c3103ee1bb141af31b9a1a0f92f5e43 | 78cac520c34b133ba32665e601adbc794282f4b7 |
python/cpython | python__cpython-100523 | # Resolve TODO comments in `test_concurrent_futures.py`
# Feature or enhancement
There are 3 TODO comments that should be resolved in the `test_concurrent_futures.py` file[0]
1.
https://github.com/python/cpython/blob/e16d4ed59072839b49bda4b447f260201aae7e39/Lib/test/test_concurrent_futures.py#L714
2. https://... | a2262789abccb68a61bb4047743fbcbd9a64b13c | 73245d084e383b5bc3affedc9444e6b6c881c546 |
python/cpython | python__cpython-100524 | # Docstrings in configparser are invalid reStructuredText
In the `configparser` module, the docstrings are not valid rst. I stumbled onto this issue in the [backport](/jaraco/configparser) when I started validating documentation. Here's what the sphinx output looks like when trying to render the docs for that module:
... | 199507b81a302ea19f93593965b1e5088195a6c5 | 3ccc98fc24b278e0f8195686f3651c7c9fabeb59 |
python/cpython | python__cpython-99588 | # Simplify eff_request_host in cookiejar.py
The existing code can be made more idiomatic and to match the RFC wording better.
Mainly creating this issue since I think https://github.com/python/cpython/pull/99588 should have a news entry
<!-- gh-linked-prs -->
### Linked PRs
* gh-99588
<!-- /gh-linked-prs -->
| b9aa14a484f653cb6a3a242776df9ac5fe161bfc | 046cbc2080360b0b0bbe6ea7554045a6bbbd94bd |
python/cpython | python__cpython-100521 | # `ast.NodeTransformer` is not tested
There are no tests for `ast.NodeTransformer`:
```
» ag NodeTransformer
Misc/NEWS.d/3.9.0a3.rst
817:In the :mod:`ast` module documentation, fix a misleading ``NodeTransformer``
Lib/inspect.py
2230: class RewriteSymbolics(ast.NodeTransformer):
Lib/ast.py
411: tra... | c1c5882359a2899b74c1685a0d4e61d6e232161f | f63f525e161204970418ebc132efc542daaa24ed |
python/cpython | python__cpython-106533 | # Support for detecting the flavour of pathlib subclasses
# Feature or enhancement
Provide a way of checking whether a user subclass of `pathlib.PurePath` and `Path` uses POSIX or Windows semantics
# The Problem
Now that #68320 is resolved, users can subclass `pathlib.PurePath` and `Path` directly:
```pyth... | c6c5665ee0c0a5ddc96da255c9a62daa332c32b3 | a1a3193990cd6658c1fe859b88a2bc03971a16df |
python/cpython | python__cpython-100489 | # Add `is_integer` to fractions.Fraction
Requested by @mdickinson in https://github.com/python/cpython/issues/100268#issuecomment-1363885807
The case for:
- Improves duck type compatibility between Fraction and float (and now int)
- Simple to implement; hopefully low maintenance cost
The case against:
- Not a... | e83f88a455261ed53530a960f1514ab7af7d2e82 | 71159a8e078bda0c9a39c6cd0980b7ba238dc582 |
python/cpython | python__cpython-100677 | # Consider adding sumproduct() or dotproduct() to the math module
I was reviewing the itertools recipes to see whether some were worth promoting to be builtin tools. The `dotproduct()` recipe was the best candidate. To non-matrix people this is known as [sumproduct()](https://support.microsoft.com/en-us/office/sumpr... | 47b9f83a83db288c652e43567c7b0f74d87a29be | deaf090699a7312cccb0637409f44de3f382389b |
python/cpython | python__cpython-100475 | # http.server directories named index.html break directory listings
<!--
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.p... | 46e6a28308def2c3a71c679a6fa4ed7d520802b9 | 00afa5066bd45348ed82a38d3442763b2ed1a068 |
python/cpython | python__cpython-100473 | # compileall's stripdir, prependdir and limit_sl_dest cannot be bytes
This is a follow-up to https://github.com/python/cpython/issues/84627
The docs claim:
> The stripdir, prependdir and limit_sl_dest arguments correspond to the -s, -p and -e options described above. They may be specified as str, bytes or [os.Path... | 046cbc2080360b0b0bbe6ea7554045a6bbbd94bd | efccd04b9efc1752a845b377399d2068b06d04e7 |
python/cpython | python__cpython-100460 | # Errors in specialisation stats for STORE_ATTR
There seem to be some copy-paste errors in specialize.c, which cause failures for STORE_ATTR to be attributed to LOAD_ATTR:
```
@@ -860,7 +860,7 @@ _Py_Specialize_StoreAttr(PyObject *owner, _Py_CODEUNIT *instr, PyObject *name)
// We *might* not really need ... | 2659036c757a11235c4abd21f02c3a548a344fe7 | 84bc6a4f25fcf467813ee12b74118f7b1b54e285 |
python/cpython | python__cpython-100387 | # Enum with `str` or `int` Mixin Breaking Change in Python 3.11
<!--
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.pytho... | e665563f8301d0db5cb0847d75fc879f074aa100 | 3ed8c882902a6982fd67e898a5b8a2d619fb5ddf |
python/cpython | python__cpython-100456 | # Start running SSL tests with OpenSSL 3.1.0-beta1
# Feature or enhancement
SSL tests are run with OpenSSL 1.1.1s and 3.0.7 at the moment.
https://github.com/python/cpython/blob/84bc6a4f25fcf467813ee12b74118f7b1b54e285/.github/workflows/build.yml#L238
Let's add a fresh [3.1.0-beta1](https://www.openssl.org/blog... | a23cb72ac82372fac05ba36ce08923840ca0de06 | 7ca45e5ddd493411e61706d07679ea54b954e41b |
python/cpython | python__cpython-100446 | # Improve error message for unterminated strings with escapes
Inspired by #55688 and #94768.
Currently, this code raises the following error:
```
>>> "asdf\"
File "<stdin>", line 1
"asdf\"
^
SyntaxError: unterminated string literal (detected at line 1)
```
Maybe there's room to make this error m... | 3156d193b81f7fefbafa1a5299bc9588a6768956 | baefbb21d91db2d950706737a6ebee9b2eff5c2d |
python/cpython | python__cpython-100436 | # Float documentation doesn't allow int-like strings as valid arguments for float
[The documentation for `float`](https://docs.python.org/3/library/functions.html#float) doesn't explicitly allow int-like strings, although it does give one as an example. E.g. although `float('10')` works and returns a float, the docume... | 69bc86cb1aed49db27afc0095e0f4bcd8f1f3983 | 74a2b79c6265c92ef381b5ff0dc63903bf0178ac |
python/cpython | python__cpython-100426 | # Improve accuracy of builtin sum() for float inputs
Currently `sum()` makes no efforts to improve accuracy over a simple running total. We do have `math.fsum()` that makes extreme efforts to be almost perfect; however, that function isn't well known, it runs 10x slower than regular `sum()`, and it always coerces to ... | 5d84966cce6c596da22922a07f49bde959ff5201 | 1ecfd1ebf1f53ef6ac82085b25ed09952b470d4e |
python/cpython | python__cpython-114481 | # Add sqlite3 as another possible backing store for the dbm module
Right now we support `ndbm` and `gnu.dbm` which might or might not be part of a given build. The fallback is the super slow `dumbdbm`. Not the sqlite3 is part of the standard build, we can do better.
The module docstring says:
> Future version... | dd5e4d90789b3a065290e264122629f31cb0b547 | 57e4c81ae1cd605efa173885574aedc3fded4b8b |
python/cpython | python__cpython-100409 | # Fix a traceback in multiprocessing example
The `multiprocessing` module documentation contains the following example:
```
>>> from multiprocessing import Pool
>>> p = Pool(5)
>>> def f(x):
... return x*x
...
>>> with p:
... p.map(f, [1,2,3])
Process Pool... | a28d4edb23b7150942f1eceb9e97c6f53aa4de42 | 3246688918a428738b61c4adb5fbc6525eae96f9 |
python/cpython | python__cpython-128155 | # Consider adding `-Werror=unguarded-availability-new` to compiler flags for Apple platforms
# Feature or enhancement
Runtime crashes like #97897 could be prevented by turning clang's `unguaded-availability-new` warning into a fatal compile error. This can be done by adding `-Werror=unguarded-availability-new` to c... | 9d3a8f494985e8bbef698c467099370e233fcbd4 | f420bdd29fbc1a97ad20d88075c38c937c1f8479 |
python/cpython | python__cpython-100375 | # Incorrect returns caused by improper address filter in socket.getfqdn
# Bug report
When getfqdn called with name "::", instead of returning gethostname(), it will call gethostbyaddr("::").
This will raise an exception "socket.herror: [Errno 1] Unknown host", which will cause a 30 seconds(timeout) delay and retur... | 12be23cf3c1301be2c6b8fd4cb2cd35a567d2ea2 | a7715ccfba5b86ab09f86ec56ac3755c93b46b48 |
python/cpython | python__cpython-100373 | # SSLContext.load_verify_locations accepts some cases of trailing data in DER
# Bug report
`SSLContext.load_verify_locations` detects EOF by looking for `PEM_R_NO_START_LINE` and `ASN1_R_HEADER_TOO_LONG` in PEM and DER, respectively. The former is correct. PEM allows arbitrary trailing data before and after and the... | acfe02f3b05436658d92add6b168538b30f357f0 | 6a1c49a7176f29435e71a326866d952b686bceb3 |
python/cpython | python__cpython-103902 | # sqlite3.Connection.blobopen() can fail with OverflowError on large rowids
<!--
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... | a05bad3254e2ae5fdf558dfdb65899a2298d8ded | cab1298a6022ddf12ddcdadd74bb8741650d8e9f |
python/cpython | python__cpython-100364 | # Optimize `asyncio.get_running_loop`
`asyncio.get_running_loop` is one of the most performance critical functions in `asyncio`. With https://github.com/python/cpython/issues/66285 the running loop can be reset in the fork handler thereby avoiding the need for the `getpid` checks. The whole running loop holder object... | 4994f2488f8a436ebda3510c779cbfe292bb21a0 | 79311cbfe718f17c89bab67d7f89da3931bfa2ac |
python/cpython | python__cpython-100358 | # Convert more functions in `bltinsmodule.c` to Argument Clinic
# Feature or enhancement
There are several functions that are still not coverted to argument clinic (while they even say `AC: cannot convert yet, as needs PEP 457 group support in inspect`). I've found:
- `vars`
- `getattr`
- `dir`
- `next`
- `ite... | bdfb6943861431a79e63f0da2e6b3fe163c12bc7 | 0769f957514300a75be51fc6d1b963c8e359208b |
python/cpython | python__cpython-100349 | # asyncio._SelectorSocketTransport: help garbage collector
# Feature or enhancement
Debugging an asyncio application I've found that many _SelectorSocketTransport objects end up listed in gc.garbage instead of being released as soon as possible.
# Pitch
We could release resources as soon as possible, and avoi... | a6331b605e8044a205a113e1db87d2b0a53d0222 | 39dfbb2d5dc47635f332bc13ca667293de6989ab |
python/cpython | python__cpython-100345 | # Provide C implementation for asyncio.current_task
# Feature or enhancement
By providing a C implementation for `asyncio.current_task`, its performance can be improved.
# Pitch
Performance improvement.
From Instagram profiling data, we've found that this function is called frequently, and a C implementati... | 4cc63e0d4e4cf3299dcc0ea81616ba072ae5589d | aa878f086b7ba8bdd7006d9d509c671167a5fb1e |
python/cpython | python__cpython-100343 | # Missing NULL check in AC *args tuple parsing
`__clinic_args` is currently not checked for NULL and can crash the interpreter. The fix is to check for NULL and exit early.
<!-- gh-linked-prs -->
### Linked PRs
* gh-100343
* gh-100568
<!-- /gh-linked-prs -->
| 7cf164ad5e3c8c6af5ae8813ad6a784448605418 | e97afefda54b818b140b3cc905642b69d9d65f0c |
python/cpython | python__cpython-100341 | # Build failure on wasm-sdk-17
<!--
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/
- posting in... | 75c8133efec035ec1083ebd8e7d43ef340c2e581 | 1f0d0a432cf431882b432eeba8315f84f818da6b |
python/cpython | python__cpython-100947 | # Python 3.11.0 -> 3.11.1 : ...\Python311\DLLs not added to sys.path in embedded startup on Windows
# Bug report
When updating Python 3.11.0 -> 3.11.1 (or reverse to reverse the issue), the `...\Python311\DLLs` folder is suddenly not added anymore to sys.path in embedded startup due to somehow impaired searc... | df10571a130c46d67756239e76ad69a3d730a990 | 7b14c2ef194b6eed79670aa9d7e29ab8e2256a56 |
python/cpython | python__cpython-102621 | # Clarification in the `__slots__` documentation
# Documentation
https://docs.python.org/3/reference/datamodel.html#notes-on-using-slots
One of the bulletpoints:
> * Nonempty __slots__ does not work for classes derived from “variable-length” built-in types such as [int](https://docs.python.org/3/library/funct... | 88c262c086077377b40dfae5e46f597e28ffe3c9 | 3d872a74c8c16d4a077c2223f678b1f8f7e0e988 |
python/cpython | python__cpython-100289 | # Finish up LOAD_ATTR specialisation
We should target the following specialisation failures:
- [X] has managed dict
- [ ] not in dict (how does this even happen??)
With these two we can hit >90% specialisation successes.
If we're feeling really ambitious, we could aim for "not managed dict" failure too. But we d... | 36d358348de8efad75ebcf55dad8ed4a4f6dcda9 | c3c7848a48b74a321632202e4bdcf2f465fb1cc6 |
python/cpython | python__cpython-100496 | # unittest.mock.seal doesn't work as expected with AsyncMock
I noticed this while reviewing https://github.com/python/cpython/pull/100252#discussion_r1050456588
I believe the following test case should pass, but it doesn't on main
```python
import unittest
from unittest.mock import Mock, seal
class AsyncCla... | e4b43ebb3afbd231a4e5630e7e358aa3093f8677 | 46e6a28308def2c3a71c679a6fa4ed7d520802b9 |
python/cpython | python__cpython-100273 | # JSON does not preserve the order of OrderedDict
#95385 caused a regression in JSON serialization of OrderedDict when use the C implementation.
```pycon
>>> import collections, json
>>> od = collections.OrderedDict(a=1, b=2)
>>> od.move_to_end('a')
>>> od
OrderedDict([('b', 2), ('a', 1)])
>>> json.dumps(od)
... | 0fe61d0838218b18bcff4bf434beba3e8dbcc42b | 2b38a9aa747785f6d540e95e6846d6510de6b306 |
python/cpython | python__cpython-100439 | # Improve duck type compatibility of int with float
# Feature or enhancement
Function arguments and variables annotated with `float` should not allow value of type `int.`
# Pitch
[PEP484](https://peps.python.org/pep-0484/) suggested that `when an argument is annotated as having type float, an argument of type... | 3e46f9fe05b40ee42009878620f448d3a4b44cb5 | a23cb72ac82372fac05ba36ce08923840ca0de06 |
python/cpython | python__cpython-122047 | # Ensurepip fails ungracefully when mimetype is missing from Windows registry
# Bug report
A "WinError 5 Access is denied" error occurs when ensurepip (for python 3.10 and above) is run and there are missing/inaccessible mimetypes in the Windows registry. Because ensurepip is used in the Python installer, it also ... | 0bd93755f37e6b8beb597787fce39eb141179965 | c25898d51e4ec84319b7113d5bf453c6e6519d9c |
python/cpython | python__cpython-100249 | # Possibly missing parameters in the documentation of asyncio functions
The functions _asyncio_.**open_connection**/**start_server**/**open_unix_connection**/**start_unix_server** call their "counterparts" in *loop*.
_asyncio_.**open_connection** calls _loop_.**create_connection**.
_asyncio_.**start_server** calls... | 96638538002fc6e209755c06f613b0a59eb91166 | 5693f45b19de47f8cb2f08d3baf43e626d3fbdf3 |
python/cpython | python__cpython-100944 | # py.exe launcher ignores [commands] from py.ini
# Bug report
This is a regression between Python 3.11.0 and 3.11.1. Since 46a3cf4fe3380b5d4560589cce8f602ba949832d (88297e2a8a75898228360ee369628a4a6111e2ee, #98692), py.exe no longer observes the [“custom commands”](https://peps.python.org/pep-0397/#customized-comma... | 468c3bf79890ef614764b4e7543608876c792794 | b5d4347950399800c6703736d716f08761b29245 |
python/cpython | python__cpython-100244 | # performance shortcut in functools.partial behaves differently in C and in Python version
## Bug
`functools.partial` is implemented in `functools.py` and in `_functoolsmodule.c`. The former is almost never used, so libraries come to depend on the quirks and corner cases of the C implementation. This is a [problem ... | 5a0209fc23de113747058858a4d2e5fc8213711e | 8e36cb7bb2a6057445975d46169f23a719909917 |
python/cpython | python__cpython-100235 | # Set default lamb to 1.0 in random.expovariate()
Give this function a meaningful and useful default value.
Note, Numpy has already made the same decision.
<!-- gh-linked-prs -->
### Linked PRs
* gh-100235
<!-- /gh-linked-prs -->
| b430399d41fa88e9040cd055e55cf9211bf63c61 | 8356c14b4f81f4d0010afb61610edacf4068b804 |
python/cpython | python__cpython-100229 | # raise a Warning when os.fork() is called and the process has multiple threads
os.fork() in a multi-threaded application is a likely source of deadlocks on many platforms. We should raise a warning when people call os.fork() from a process that we know has other threads running.
This came from discussion in https:... | 894f2c3c161933bd820ad322b3b678d89bc2377c | 2df82db48506e5a2044a28f147fdb42f662d37b9 |
python/cpython | python__cpython-101807 | # `asyncio.StreamReader.read` does what exactly?
# Documentation
https://docs.python.org/3/library/asyncio-stream.html#asyncio.StreamReader.read
It remains unclear what exactly that method does. It will give me no more than *n* bytes from the stream. That's a pretty vague contract. Will it sit there until so man... | 77d95c83733722ada35eb1ef89ae5b84a51ddd32 | a1723caabfcdca5d675c4cb04554fb04c7edf601 |
python/cpython | python__cpython-100223 | # Use a correct and transparent definition of "code unit" in C code
We should define `_Py_CODEUNIT` properly without the need for type punning.
Currently `_Py_CODEUNIT` is define as `typedef uint16_t _Py_CODEUNIT;` but it really an 8 bit opcode followed a bit operand aligned to 16 bits. Which means we need to reso... | bdd86741bebd3efb51e540d5148e658cb34fd3ce | ae83c782155ffe86830c3255e338f366e331ad30 |
python/cpython | python__cpython-100329 | # `make sharedinstall` does not create lib-dynload in DESTDIR if lib-dynload exists in system already
# Bug report
The `Makefile.pre.in` rule for creating directories is specified as:
```
$(DESTSHARED):
@for i in $(DESTDIRS); \
do \
if test ! -d $(DESTDIR)$$i; then \
echo "Creating directory $$i"... | 2a8bf2580441147f1a15e61229d669abc0ab86ee | 35dd55005ee9aea2843eff7f514ee689a0995df8 |
python/cpython | python__cpython-100328 | # `make sharedinstall` does not return failure if install commands fail
# Bug report
If `make sharedinstall` fails to install some Python extensions, the make target wrongly succeeds. For example, I'm seeing:
```
/usr/bin/install -c -m 755 Modules/array.cpython-312-x86_64-linux-gnu.so /usr/lib/python3.12/lib-dy... | a90863c993157ae65e040476cf46abd73ae54b4a | 2667452945eb0a3b8993bb4298ca8da54dc0155a |
python/cpython | python__cpython-100212 | # Link in code comment no longer relevant for HTML unescaping
# Documentation
The link in https://github.com/python/cpython/blob/0e081a089ec969c9a34f5ff25886205616ef4dd3/Lib/html/__init__.py#L28 is not longer relevant and should be replace:
- current link <http://www.w3.org/TR/html5/syntax.html#tokenizing-charac... | 9a07eff628c1cd88b7cdda88a8fd0db3fe7ea552 | 072935951f7cd44b40ee37fe561478b2e431c2fb |
python/cpython | python__cpython-100207 | # `sysconfig.get_default_scheme` `versionadded` vs `versionchanged`
# Documentation
`get_default_scheme` used to be private and called `_get_default_scheme`, but in GH-24644, it was made public. That PR uses the `versionchanged` directive to document this, but this is confusing to users, I believe the correct direc... | d3ea82aaf940167482df1e08d6482de8f2dd8526 | 0e081a089ec969c9a34f5ff25886205616ef4dd3 |
python/cpython | python__cpython-100416 | # Bare yield's behaviour undocumented
```
def g():
yield
print(next(g()))
```
That prints `None`, but the [Yield expressions](https://docs.python.org/3/reference/expressions.html#yield-expressions) documentation doesn't say so. It only talks about *"returning the value of `expression_list` to the generator’... | 1aab269d4acbf0b29573ad0a21c54fddee233243 | 1d1480fefc6ae77d14d6eff007b180ff5d1cd5d4 |
python/cpython | python__cpython-100194 | # Add more tests for `asyncio` subprocess
As evident from https://github.com/python/cpython/issues/100133, we need more functional tests for subprocess. Currently there are only two tests for shell and others don't tests all combinations.
<!-- gh-linked-prs -->
### Linked PRs
* gh-100194
* gh-100569
<!-- /gh-linked-... | e97afefda54b818b140b3cc905642b69d9d65f0c | 08e5594cf3d42391a48e0311f6b9393ec2e00e1e |
python/cpython | python__cpython-100189 | # Too many misses in BINARY_SUBSCR_LIST_INT
The expression `my_list[-1]` [gets specialized](https://github.com/python/cpython/blob/70be5e42f6e288de32e0df3c77ac22a9ddf1a74b/Python/specialize.c#L1263-L1267) to `BINARY_SUBSCR_LIST_INT` every time, then it [gets deoptimized every time](https://github.com/python/cpython/bl... | c18d83118881333b9a0afd0add83afb2ba7300f7 | 44892d45b038f919b0378590a776580a9d73b291 |
python/cpython | python__cpython-100901 | # Upgrade OpenSSL bundled with windows to 1.1.1s
# Enhancement
The version of OpenSSL used in [get_externals.bat](https://github.com/python/cpython/blob/c0859743d9ad3bbd4c021200f4162cfeadc0c17a/PCbuild/get_externals.bat#L80) is 1.1.1q, where 1.1.1s has been released. This in turn pulls from https://github.com/pytho... | d7ab7149f83e4f194cf0e3a438fb6ca177832c99 | e098137cd3250af05f19380590b8dec79dc5942f |
python/cpython | python__cpython-100177 | # Meta issue: clean up redundant compat code
<!--
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/
... | 3192c00a3cf136e06592d9a14d4d7b82412da4de | 6997e77bdf2297375962aaf82876da4e7ecdd61a |
python/cpython | python__cpython-100178 | # Enum Docs does MultiplesOfThree instead of PowersOfThree
# Documentation
Current:
The example includes a class `PowersOfThree`. Inside the function `_generate_next_value_()`, it executes `return (count + 1) * 3` (Line 5), which is multiples of three instead of powers of three.
Expected:
Line 5 should be upda... | 868bab0fdc514cfa70ce97e484a689aee8cb5a36 | 2e279e85fece187b6058718ac7e82d1692461e26 |
python/cpython | python__cpython-100410 | # DeprecationWarning scope expanded in asyncio.events
As discovered in https://github.com/prompt-toolkit/python-prompt-toolkit/issues/1696, it appears that the DeprecationWarning introduced in Python 3.10 has expanded its scope, now with 3.11.1 and 3.10.9 emitting during get_event_loop_policy() where it did not before... | e5bd5ad70d9e549eeb80aadb4f3ccb0f2f23266d | 468c3bf79890ef614764b4e7543608876c792794 |
python/cpython | python__cpython-100147 | # BUILD_LIST should steal references, similar to BUILD_TUPLE
Currently, the `BUILD_LIST` opcode adjusts the stack multiple times while items are popped one by one from the stack, rather than employing the more efficient method used by `BUILD_TUPLE` (that steals the references from the stack).
<!-- gh-linked-prs -->... | e6d44407827490a5345e8393fbdc78fd6c14f5b1 | b3722ca058f6a6d6505cf2ea9ffabaf7fb6b6e19 |
python/cpython | python__cpython-100144 | # Make it possible to collect pystats of parts of runs
The `--enable-pystats` system has a couple of important shortcomings:
- When stats is turned off, stats aren't dumped (on quit or explicitly). Therefore, it's impossible to put `sys._stats_on`/`sys._stats_off` calls around tested code and get the results out.
... | 1583c6e326a8454d3c806763620e1329bf6b7cbe | e4ea33b17807d99ed737f800d9b0006957c008d2 |
python/cpython | python__cpython-100154 | # asyncio subprocess stdout occasionally lost (3.11.0 → 3.11.1 regression)
<!--
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:/... | a7715ccfba5b86ab09f86ec56ac3755c93b46b48 | 4994f2488f8a436ebda3510c779cbfe292bb21a0 |
python/cpython | python__cpython-100132 | # Allow `delete=False` for tempfile.TemporaryDirectory()
# Feature or enhancement
If you use `tempfile.TemporaryDirectory()`, the directory is automagically deleted, what is the whole purpose of this class. But sometimes you may want to take a look at it for debugging reasons, so it would be nice to have a `delete=... | 64cb1a4f0f0bc733a33ad7a6520e749ca1cdd43f | ded9a7fc194a1d5c0e38f475a45f8f77dbe9c6bc |
python/cpython | python__cpython-100613 | # Shim frames can be accessed during frame teardown (via `tstate->cframe->current_frame`)
# Crash report
In jaraco/jaraco.net#5, I've captured a failure that's emerged as Github updated Python 3.12 from a2 to a3 on Linux. The [calling code](https://github.com/jaraco/jaraco.net/blob/e0d1db9d0c8d91579e26f5bcae9c61270... | 61762b93871419b34f02d83cee5ca0d94d4a2903 | 2e80c2a976c13dcb69a654b386164dca362295a3 |
python/cpython | python__cpython-100447 | # code.co_positions behaviour does not match documentation
The [documentation of co_positions()](https://docs.python.org/3.12/reference/datamodel.html#codeobject.co_positions) says:
`The iterator returns tuples containing the (start_line, end_line, start_column, end_column). The i-th tuple corresponds to the positi... | f07daaf4f7a637f9f9324e7c8bf78e8a3faae7e0 | b2f7b2ef0b5421e01efb8c7bee2ef95d3bab77eb |
python/cpython | python__cpython-100114 | # Remove `yield from` usage from asyncio tests
Support for `yield from` was deprecated and removed so it should be removed.
See https://github.com/python/cpython/blob/cd67c1bb30eccd0c6fd1386405df225aed4c91a9/Lib/test/test_asyncio/test_tasks.py#L2093-L2100
<!-- gh-linked-prs -->
### Linked PRs
* gh-100114
<!-- /gh... | 0448deac70be94792616c0fb0c9cb524de9a09b8 | 286e3c76a9cb8f1adc2a915f0d246a1e2e408733 |
python/cpython | python__cpython-100128 | # Avoid using iterable coroutines in `asyncio` internally
`asyncio` currently uses iterable coroutine directly to wrap awaitables with `__await__` methods. This leads to unnecessary special casing and is confusing as `asyncio` does not supports using `yield from` now so it should not be used internally too. This will ... | a44553ea9f7745a1119148082edb1fb0372ac0e2 | 1c9f3391b916939e5ad18213e553f8d6bfbec25e |
python/cpython | python__cpython-100109 | # Specialize FOR_ITER for tuples
Same as FOR_ITER_LIST.
<!-- gh-linked-prs -->
### Linked PRs
* gh-100109
<!-- /gh-linked-prs -->
| 748c6c0921ee02a19e01a35f03ce5f4d9cfde5a6 | 0448deac70be94792616c0fb0c9cb524de9a09b8 |
python/cpython | python__cpython-114358 | # Script containing a "shebang" would not start under Windows
# Bug report
This Python script **hello.pyw** does not start on my PC when I double click it in Windows Explorer.
```
#!/usr/bin/env python3
from tkinter import messagebox
messagebox.showinfo(message='hello, world')
```
Instead, a console windo... | d5c21c12c17b6e4db2378755af8e3699516da187 | 6888cccac0776d965cc38a7240e1bdbacb952b91 |
python/cpython | python__cpython-100103 | # Unclear documentation of `zip()`'s `strict` option
In version 3.10, `zip()` has gained the `strict` option, which causes a `ValueError` to be raised when the iterables have different lengths (cf. #84816). [The documentation](https://docs.python.org/3/library/functions.html#zip) describes this as follows:
> Unlike... | cf1c09818032df3080c2cd9e7edb5f657213dc83 | c4c5790120beabed83ce5855f18d209ab8324434 |
python/cpython | python__cpython-100099 | # 3.11.1 Regression: namedtuple Enum values are cast to tuple
# Bug report
Between 3.11.0 and 3.11.1, Enums whose values are namedtuple objects have their values converted to tuple, which drops the field names we expect to be able to use, causing AttributeErrors. Test cases below create a namedtuple and an enum who... | ded02ca54d7bfa32c8eab0871d56e4547cd356eb | cce836296016463032495c6ca739ab469ed13d3c |
python/cpython | python__cpython-100078 | # test_code.test_invalid_bytecode is a bit cryptic and flaky
This test checks what happens when we try to execute a function with invalid bytecode. It hand-crafts the function's code, which is hard to read and maintain as bytecode changes. It also assumes that 238 is an invalid opcode, which it should at least assert.... | f3e97c90ed6f82fce67b0e8757eec54908ba49ce | 68e41295b8611a990de68f15c89f1eb3dea51867 |
python/cpython | python__cpython-100074 | # Netlify builds happen for PRs that do not change docs
<!--
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/... | d92407ed497e3fc5acacb0294ab6095013e600f4 | f3e97c90ed6f82fce67b0e8757eec54908ba49ce |
python/cpython | python__cpython-100063 | # Error code tables in _ssl and err_name_to_codes are no longer used
(Filing this for a PR I'll upload shortly.)
Prior to https://github.com/python/cpython/pull/25300, the make_ssl_data.py script used various tables, exposed in `_ssl`, to update the error list. After that PR, these are no longer used and we can tri... | 02f9920900551fd0281c8989d65521d4fce4ead1 | 5ffc1e5a21de9a30566095386236db44695d184a |
python/cpython | python__cpython-102612 | # Extra characters erroneously matched when using possessive quantifier with negative lookahead
# Bug report
Regular expressions that combine a possessive quantifier with a negative lookahead match extra erroneous characters in re module 2.2.1 of Python 3.11. (The test was run on Windows 10 using the official distr... | abd9cc52d94b8e2835322b62c29f09bb0e6fcfe9 | a86df298df5b02e2d69ea6879e9ed10a7adb85d0 |
python/cpython | python__cpython-100065 | # C assertion error from the runtime while expecting a SyntaxError
<!--
Use this template for hard crashes of the interpreter, segmentation faults, failed C-level assertions, and similar.
Do not submit this form if you encounter an exception being unexpectedly raised from a Python function.
Most of the time, ... | 97e7004cfe48305bcd642c653b406dc7470e196d | abbe4482ab914d6da8b1678ad46174cb875ed7f6 |
python/cpython | python__cpython-100052 | # Dictionary view objects (dictview) - incorrect example
# Documentation
Link to the doc:
[Dictionary view objects](https://docs.python.org/3/library/stdtypes.html#dictionary-view-objects)
Look at the examples. The output for `values.mapping` (near the end) now is:
```
mappingproxy({'eggs': 2, 'sausage': 1, '... | 7c0fb71fbfa8682f56c15832e2c793a6180f2ec0 | 7a0f3c1d92ef0768e082ace19d970b0ef12e7346 |
python/cpython | python__cpython-100168 | # [Enum] `__text_signature__` of `EnumType.__call__` and derivatives
`EnumType.__call__` is a dual-purpose method:
- create a new enum class (functional API, and only valid if the parent enum has no members)
- look up an existing member (only valid if enum has members)
Enhancement: Have the appropriate `__text_... | eafd14fbe0fd464b9d700f6d00137415193aa143 | b2a7272408593355c4c8e1d2ce9018cf96691bea |
python/cpython | python__cpython-100027 | # Include number of raw stats files in summarize_stats.py output
Mostly for confirmation / debugging purposes, the output of `summarize_stats.py` should include the number of raw input files in `/tmp/py_stats`.
<!-- gh-linked-prs -->
### Linked PRs
* gh-100027
<!-- /gh-linked-prs -->
| 9dc787ea96916552695e79397588fdfa68f22024 | 5c19050546e3e37a8889a0baa2954e1444e803d3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.