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-106921 | # Forgot to add error check?
#106411 adds the `_PyCompile_CleanDoc` function.
there's a call to `PyMem_Malloc`, but we don't check if it returns `NULL` value:
https://github.com/python/cpython/blob/009e8f084c4cbb1f43d40b24b7f71fb189bbe36b/Python/compile.c#L8055-L8063
Is there a need to check for a `NULL` value?... | 85ed1d24427bf3e000467aab7ee1b0322b0a9013 | a31dea1feb61793e48fa9aa5014f358352205c1d |
python/cpython | python__cpython-106910 | # Use role :const: for referencing module constants
While technically Python modules are mutable and every name can be overridden, some names are not intended to be changed. Sphinx has a special directive for this: `:const:`. I think that it is better to use semantically more specific `:const:` instead of general `:d... | 4b9948617f91175783609769aa6160e5b49b9ccc | d036db728ea3d54509cbad06df74e2d9a31fbec8 |
python/cpython | python__cpython-106906 | # Error in AST recursion depth tracking change of gh-95185
# Bug report
The change in https://github.com/python/cpython/commit/00474472944944b346d8409cfded84bb299f601a seems to miss the recusrion depth adjustment in case of an error. As an example for some of the generated code:
```
PyObject*
ast2obj_mod(struc... | 1447af797048e62049d00bbd96d8daee3929f527 | 1c7ed7e9ebc53290c831d7b610219fa737153a1b |
python/cpython | python__cpython-107347 | # Add mechanism for getting active exception in a sys.monitoring PY_UNWIND callback (3.12)
I couldn't figure out a way get the active exception from a PY_UNWIND event callback -- I was hoping the exception would be passed to the callback but it isn't. This was an issue with the old tracer function debugger / profiler ... | ac7a0f858a8d0c6ca2e64bb880fca40e229d267a | 9a7204b86bdb3e26c2a62aeaafb875275500b9f7 |
python/cpython | python__cpython-107291 | # No sys.monitoring RAISE event emitted when exception is re-raised (3.12b4)
It looks like no RAISE event is emitted for a bare raise in an except: clause or at the end of a finally: clause that implicitly reraises an exception. I don't know whether this a problem with the implementation or it should simply be documen... | 766d2518ae8384c6bd7f82727defeb86847ccf64 | f84d77b4e07aeb6241c1ff9932627d3ba059efa8 |
python/cpython | python__cpython-107337 | # Returning DISABLE from a sys.monitoring callback can trigger an assert in a debug build in (3.12b4)
Returning DISABLE from a sys.monitoring callback for an event >= PY_MONITORING_INSTRUMENTED_EVENTS triggers an assert in a debug build. It would probably be better to just ignore a DISABLE return value since anything... | c6539b36c163efff3d6ed02b938a6151325f4db7 | d77d973335835bd744be8106010061cb338b0ae1 |
python/cpython | python__cpython-106894 | # Use roles :data: and :const: for module-level variables and constants
Role `:data:` is purposed for marking a module-level variable. [1] But role `:attr:` is often used instead in cases like `sys.modules`. While technically any module-level variable is accessible as an attribute, I think that it would be better to ... | d036db728ea3d54509cbad06df74e2d9a31fbec8 | 8d397ee8259fa0f81598a452438fc335267ca260 |
python/cpython | python__cpython-106901 | # asyncio.base_events.Server is not exposed as Asyncio.Server in early versions of 3.9 and 3.10 and all previous versions
# Documentation:
The documentation for python shows `asyncio.base_events.Server` as `asyncio.Server` in all python versions, [Offending Page](https://docs.python.org/3.8/library/asyncio-eventloop.... | 1e1f4e91a905bab3103250a3ceadac0693b926d9 | c6c5665ee0c0a5ddc96da255c9a62daa332c32b3 |
python/cpython | python__cpython-107397 | # Include of `linux/limits.h` breaks build on Linux <5.1
# Bug report
#101857 / #101858 added an `#include <linux/limits.h>` on Linux in `Modules/posixmodule.c`.
If my Linux Git history sleuthing is accurate (`git log -- include/linux/limits.h`), `linux/limits.h` only exists in Linux <3.10 and >5.1. (Yes, the fi... | 11c055f5ff1a353de6d2e77f2af24aaa782878ba | cf63df88d38ec3e6ebd44ed184312df9f07f9782 |
python/cpython | python__cpython-106871 | # Upgrade CPython to the new PyMemberDef API: names starting with Py_ prefix (Py_T_INT instead of T_INT)
The CPython code base was written for the old "structmember.h" API with names like READONLY and T_INT. I propose to upgrade the code base to new public names like Py_READONLY and Py_T_INT.
``#include "structmemb... | 1a3faba9f15e0c03c6cc0d225d377b8910b5379f | ed082383272c2c238e364e9cc83229234aee23cc |
python/cpython | python__cpython-108975 | # Unix-only pages should each say "Availability: Unix"
# Documentation
This section of the docs has a number of pages: https://docs.python.org/3/library/unix.html . Each is only available on Unix, but the pages themselves don't say this. For example, if you search for the `resource` module, you get to here: https... | cf3dbe4c3df40e2d4d572c62623207ce29a9365b | 52a5b5d276abb3f3101c0b75b67c1c3f8ee483fe |
python/cpython | python__cpython-106854 | # The table of sys.flags doesn't have warn_default_encoding attribute.
https://docs.python.org/3/library/sys.html?highlight=sys%20flags#sys.flags
PEP 597 – Add optional EncodingWarning https://peps.python.org/pep-0597/
 not found; fall... | ece3b9d12a2f47da8b144f185dfba9b2b725fc82 | 1e36ca63f9f5e0399efe13a80499cef290314c2a |
python/cpython | python__cpython-106832 | # Unreachable code in `Modules/_ssl.c`
Looks like code in this check cannot ever be reached:
https://github.com/python/cpython/blob/2b94a05a0e45e4aae030a28b716a038ef529f8ef/Modules/_ssl.c#L2824-L2827
At this point `session` cannot be `NULL`, because it is checked right above: https://github.com/python/cpython/bl... | ebf2c56b33553a448da8f60fcd89a622f071b5f4 | 8e9a1a032233f06ce0f1acdf5f983d614c8745a5 |
python/cpython | python__cpython-107564 | # Code generator: support variable stack effects in macros
Currently you can't split e.g.
```
inst(CALL_PY_EXACT_ARGS, (unused/1, func_version/2, method, callable, args[oparg] -- unused))
{ ... }
```
into two micro-ops
```
op(_CHECK_PY_FUNCTION, (func_version/2, method, callable, args[oparg] -- method, callable... | 85e5b1f5b806289744ef9a5a13dabfb23044f713 | 4e6fac7fcc31fc6198fcddc612688b0a05ff7ae4 |
python/cpython | python__cpython-106798 | # Python/generated_cases.c.h emits compiler warnings
````
In file included from Python/ceval.c:770:
Python/generated_cases.c.h:3463:51: warning: code will never be executed [-Wunreachable-code]
if (1) { stack_pointer[-(1 + (1 ? 1 : 0))] = res2; }
^
P... | 1e36ca63f9f5e0399efe13a80499cef290314c2a | 00e52acebd2beb2663202bfc4be0ce79ba77361e |
python/cpython | python__cpython-106790 | # sysconfig imports pprint which imports the world
sysconfig imports pprint in order to print the config dict to a file. But this dict contains only strings and ints, so pprint is overkill.
The problem with importing pprint is that it imports dataclasses, which imports inspect, which imports dis which imports opcod... | 5ecedbd26692b9fbdd7aad81b991869bf650f929 | 7aa89e505d893cd5e6f33b84d66e5fa769089931 |
python/cpython | python__cpython-106784 | # docs.python.org | 4.6. match Statements
# Documentation
https://docs.python.org/3/tutorial/controlflow.html
I fixed the code as follows since points is not defined, still it does not work:
```python
class Point:
def __init__(self, x, y):
self.x = x
self.y = y
points = [Point(0,7),... | 7aa89e505d893cd5e6f33b84d66e5fa769089931 | babb22da5a25c18a2d203bf72ba35e7861ca60ee |
python/cpython | python__cpython-106775 | # Upgrade the bundled version of pip to 23.2.1
# Feature or enhancement
This is the latest pip release.
# Pitch
This ensures that users who install newest release of Python get the newest version of pip.
<!-- gh-linked-prs -->
### Linked PRs
* gh-106775
* gh-107222
* gh-107223
<!-- /gh-linked-prs -->
| f443b54a2f14e386a91fe4b09f41a265445008b8 | d9e34db993ebc4340459ac5cb3a66c1b83451a66 |
python/cpython | python__cpython-110566 | # [3.11] [3.12] Building python 3.11.4 installer FAILS, launcher.wixproj cannot detect v143 buildtools
# Bug report
I tried to build Python 3.11.4 with Visual Studio 2022 (v143) and I get following error at the end of compilation.
Rest of the project binaries are built using v143 successfully.
```
Project "D:\... | 0050670d76193ea529f51d0526256cb7a769d61b | ea7b53ff67764a2abf1f27d4c95d032d2dbb02f9 |
python/cpython | python__cpython-107466 | # [3.12] `EnumMeta.__getattr__` removed without deprecation
# Bug report
```python
>>> from enum import Enum
>>> class Color(Enum):
... RED = "red"
...
```
**3.11**
```python
>>> Color.__getattr__("RED")
<Color.RED: 'red'>
```
**3.12b4**
```py
>>> Color.__getattr__("RED")
Traceback (most recent c... | de51dede5b48ef23d7d33d92f3616824e23fd205 | 5eb80a61f582802c3f1caa3bf4dc754847bf1e75 |
python/cpython | python__cpython-106753 | # Several bugfixes for zipfile.Path
The [3.16.2 release of zipp](https://zipp.readthedocs.io/en/latest/history.html#v3-16-2) saw several bug fixes. Let's apply those to CPython.
<!-- gh-linked-prs -->
### Linked PRs
* gh-106753
* gh-106755
* gh-106757
* gh-106777
* gh-106778
<!-- /gh-linked-prs -->
| 03185f0c150ebc52d41dd5ea6f369c7b5ba9fc16 | fb32f35c0585b1dbb87b6f254818e1f485a50f65 |
python/cpython | python__cpython-106754 | # Optimize XXXSelector for many iterations of the event loop
split out from https://github.com/python/cpython/pull/106555#issuecomment-1632025959
The current `EpollSelector` can be sped up a bit. This makes quite a difference when there are 100000+ iterations of the event loop per minute (the use case being receivi... | aecf6aca515a203a823a87c711f15cbb82097c8b | 4cb0b9c0a9f6a4154238c98013d2679229b1f794 |
python/cpython | python__cpython-106748 | # Use type for deprecated aliases of typing instead of removing them
# Enhancement
> This module (typing) defines several deprecated aliases to pre-existing standard library classes. ...
> the aliases became redundant in Python 3.9 when the corresponding pre-existing classes were enhanced to support []. ...
> The... | 89ec0e952965b6a1be40e26c3ddc4131599e5ee9 | aeef8591e41b68341af308e56a744396c66879cc |
python/cpython | python__cpython-106740 | # Add `rtype_cache` to `warnings.warn` message when leaked objects found
# Feature or enhancement
Add the `rtype_cache` (which is a `set` that includes all leaked objects of a particular type) to the `warnings.warn` message in `Lib/multiprocessing/resource_tracker.py` when any leaked objects are found to make debug... | fabcbe9c12688eb9a902a5c89cb720ed373625c5 | 188000ae4b486cfffaeaa0a06902e4844d1b2bbc |
python/cpython | python__cpython-106735 | # Disable tab completion in multiline mode of pdb
# Bug report
`pdb` has multiline mode now where you can input more than one line of code in pdb prompt. However, when entering multiline mode, we should disable tab completion - when the users hit tab in multiline mode, they mean "insert tab here", not try to give m... | 391f3e3ca904449a50b2dd5956684357fdce690b | b88d9e75f68f102aca45fa62e2b0e2e2ff46d810 |
python/cpython | python__cpython-106815 | # `inspect.getsource` (`findsource`) not working as expected when duplicate class is used
<!--
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 tu... | 663854d73b35feeb004ae0970e45b53ca27774a1 | 505eede38d141d43e40e246319b157e3c77211d3 |
python/cpython | python__cpython-106724 | # Multiprocessing not propagating -Xfrozen_modules=off
# Bug report
After python3.11 changes around frozen imports, when using multiprocessing contexts other than `fork`, the newly added `-Xfrozen_modules=off` isn't passed to spawned process interpreters.
Simple snippet demonstrating the issue:
```python
"""... | 3dcac785810df4d9db50abe90847eaf03bbdaaf4 | 76c26eaca4147ba7e3e8d7379c5a828f0b512a46 |
python/cpython | python__cpython-106720 | # Fix __annotations__ getters and setters in type and module
There are several issues in the code of `__annotations__` getters and setters in `type` and `module` types.
* `PyDict_Contains()` returns -1 on error. The code interprets it as a positive answer.
* Calling `PyDict_Contains()` is not needed in all these c... | e1c295e3da9ff5a3eb6b009a1f821d80e564ac87 | ece3b9d12a2f47da8b144f185dfba9b2b725fc82 |
python/cpython | python__cpython-108730 | # `PyConfig.stdlib_dir` does not affect `sys._stdlib_dir`
In Python 3.11, PyConfig gained a `stdlib_dir` attribute which is, as far as I can tell, supposed to override `sys._stdlib_dir` (which is used by importlib). No matter what I set it to or what else I set, however, it seems to be ignored. For example:
```test... | 834b7c18d74da3b30fdca66cc7da6b9e1db3ce6c | 821a7ac493120b6d5065598cfa835ab3f25965cb |
python/cpython | python__cpython-107007 | # test_capi crash and produce core dumps on FreeBSD 13
Examples:
```
[vstinner@freebsd ~/python/main]$ ./python -m test test_capi -m test_no_FatalError_infinite_loop -v
...
Warning -- files was modified by test_capi
Warning -- Before: []
Warning -- After: ['python.core']
```
and
```
[vstinner@fre... | 4a1026d7647c084b0dc80dd49163d16ba12a2e55 | 6dbffaed17d59079d6a2788d686009f762a3278f |
python/cpython | python__cpython-106716 | # Streamline family syntax in Tools/cases_generator
The syntax to designate a family currently looks like this:
```
family(store_subscr, INLINE_CACHE_ENTRIES_STORE_SUBSCR) = {
STORE_SUBSCR,
STORE_SUBSCR_DICT,
STORE_SUBSCR_LIST_INT,
};
```
Here the `store_subs... | 1e36ca63f9f5e0399efe13a80499cef290314c2a | 00e52acebd2beb2663202bfc4be0ce79ba77361e |
python/cpython | python__cpython-106702 | # Move Tier 2 interpreter (`_PyUopExecute`) to a new file
It currently lives in ceval.c, but I'm noticing serious increases in compile time, possibly because the file is so large. Splitting it up should make this more bearable (esp. when using `make -j`).
It's not completely trivial, since there are a number of sta... | e6e0ea0113748db1e9fe675be6db9041cd5cce1f | 2f3ee02c22c4b42bf6075a75104c3cfbb4eb4c86 |
python/cpython | python__cpython-8150 | # Add a .coveragerc file to the CPython repository
Check branches both ways and ignore code that should be excluded from coverage. This includes some special directives for IDLE.
This file is used by the coverage package. It can be used where it is, in the repository directory, or copied elsewhere, depending on h... | 6ff8f82f92a8af363b2bdd8bbaba5845eef430fc | 39fc7ef4fe211e8f7d3b5a6e392e475ecdfbce72 |
python/cpython | python__cpython-106700 | # New warning in `ssl.c`: conversion from 'uint64_t' to 'long', possible loss of data
See https://github.com/python/cpython/pull/106678/files#diff-89879be484d86da4e77c90d5408b2e10190ee27cc86337cd0f8efc3520d60621
<img width="1064" alt="Снимок экрана 2023-07-12 в 21 12 39" src="https://github.com/python/cpython/asset... | ad95c7253a70e559e7d3f25d53f4772f28bb8b44 | 036bb7365607ab7e5cf901f1ac4256f9ae1be82c |
python/cpython | python__cpython-107650 | # asyncio: potential leak of TLS connections
# Bug report
## Synopsis
Forgetting to close TLS connections manually with `asyncio.open_connection()` will lead to a leak of TCP connection when the writer/reader get out of scope
Note: the reference is properly released when the remote side closes the connection
... | 41178e41995992bbe417f94bce158de93f9e3188 | 5e2746d6e2fb0da29225ead7135f078c5f087b57 |
python/cpython | python__cpython-106674 | # C API: Report ignored exception in C API functions which ignore all errors
Some C API functions, like `PyDict_GetItem()` and `PyObject_HasAttr()` (see capi-workgroup/problems#51 for full list), clears all errors which occurred during execution of these functions. The user has no way to distinguish the normal negativ... | f55cb44359821e71c29903f2152b4658509dac0d | a077b2fbb88f5192bb47e514334f760bf08d0295 |
python/cpython | python__cpython-106676 | # Support to jump between chained exception in Pdb
# Feature or enhancement
I believe it would be useful to allow to move between chained exception in Pdb.
That is to say if you have
```
try:
function_that_raises()
except Exception as e:
raise ... from e # Pdb says this is the bottom frame.
```
... | f75cefd402c4c830228d85ca3442377ebaf09454 | 242bef459bfbd0ec5e45e6d47df2709093cfefa7 |
python/cpython | python__cpython-106733 | # email.utils.getaddresses() rejects email addresses with "," in name
# Bug report
`email.utils.getaddresses()` returns `('', '')` for email addresses with `,` in a real name, e.g.
```pycon
>>> from email.utils import getaddresses
>>> getaddresses(('"Sürname, Firstname" <to@example.com>',))
[('', '')]
```
R... | a31dea1feb61793e48fa9aa5014f358352205c1d | d81b4f8ff84311fa737e62f2883442ec06d7d5d8 |
python/cpython | python__cpython-106665 | # Adding selectors has two KeyError exceptions in the success path
Similar to https://github.com/python/cpython/issues/106527, adding a new asyncio reader has to hit `_SelectorMapping.__getitem__` which is expected to raise and catch KeyError twice since the reader will not yet be in the map.
When connections are c... | 8d2f3c36caf9ecdee1176314b18388aef6e7f2c2 | e6e0ea0113748db1e9fe675be6db9041cd5cce1f |
python/cpython | python__cpython-108010 | # Test `test_embed` fails on Windows 11, Python 3.13.0a0
# Bug report
The test `test_embed` fails on my Windows machine, using master branch (commit d0972c77aa1cd5fe27618e82c10141a2bf157476).
```
python.bat -m test test_embed
```
Full output -
```
C:\Code\cpython>python.bat -m test test_embed
Running Deb... | e35c722d22cae605b485e75a69238dc44aab4c96 | 57a20b0960f5c087a476b34c72f608580746cab5 |
python/cpython | python__cpython-106657 | # Let's not generate #line directives in generated_cases.c.h
The cases generator has the ability (`-l`, `--emit-line-directives`) to emit C preprocessor [`#line` directives](https://learn.microsoft.com/en-us/cpp/preprocessor/hash-line-directive-c-cpp?view=msvc-170) so that the generated code is attributed to the prope... | 7f55f58b6c97306da350f5b441d26f859e9d8f16 | b03755a2347325a89a48b08fc158419000513bcb |
python/cpython | python__cpython-106671 | # Minor documentation issues in asyncio BaseEventLoop
Firstly:
https://github.com/python/cpython/blob/a2d54d4e8ab12f967a220be88bde8ac8227c5ab3/Lib/asyncio/events.py#L620
I think the `AbstractEventLoopPolicy`'s `get_event_loop` function should not say:
> Returns an event loop object implementing the BaseEventL... | 4b4a5b70aa8d47b1e2a0582b741c31b786da762a | 7e6ce48872fa3de98c986057764f35e1b2f4b936 |
python/cpython | python__cpython-106629 | # Possible performance improvement in email parsing
PyPy received the following performance bug today: https://foss.heptapod.net/pypy/pypy/-/issues/3961
Somebody who was trying to process a lot of emails from an mbox file was complaining about terrible performance on PyPy. The problem turned out to be fact that `em... | 7e6ce48872fa3de98c986057764f35e1b2f4b936 | af51bd7cda9c0cba149b882c1e501765595e5fc3 |
python/cpython | python__cpython-106623 | # Error when executing the sample in chapter 4.6
# Documentation
This is a pull request for the [sample code in section 4.6](https://docs.python.org/ja/3/tutorial/controlflow.html#match-statements).
I ran the following based on the sample code and got an error.
The sample code in the tutorial may be an excerpt ... | d0b7e18262e69dd4b8252e804e4f98fc9533bcd6 | 945d3cbf2e8e756ed16c3ec51106e6157abb2698 |
python/cpython | python__cpython-106794 | # Change uop instruction format to (opcode, oparg, operand)
See https://github.com/python/cpython/issues/106581#issuecomment-1629381464.
<!-- gh-linked-prs -->
### Linked PRs
* gh-106794
<!-- /gh-linked-prs -->
| 8e9a1a032233f06ce0f1acdf5f983d614c8745a5 | 7e96370a946a2ca0f2f25af4ce5b3b59f020721b |
python/cpython | python__cpython-106666 | # [Enum] add __deepcopy__ method to Enum
<!-- gh-linked-prs -->
### Linked PRs
* gh-106666
* gh-106694
* gh-106695
<!-- /gh-linked-prs -->
| 357e9e9da3929cb9d55ea31896e66f488e44e8f2 | e4b88c1e4ac129b36f99a534387d64f7b8cda8ef |
python/cpython | python__cpython-106598 | # Add a collection of offsets to facilitate the work of out-of-process debuggers
Some of the relevant fields in the interpreter state and the frame state in 3.12 are very challenging to fetch from out-of-process tools because they are in offsets that depend on compilation or platform variables that are different in di... | b444bfb0a325dea8c29f7b1828233b00fbf4a1cb | 579aa89e68a6607398317a50586af781981e89fb |
python/cpython | python__cpython-106588 | # Return the correct exit code if all tests have been skipped in `unittest`
# Bug report
In Python 3.12, a new exit code (`5`, instead of `0`) was [added](https://docs.python.org/3.12/library/unittest.html#unittest.main) if all tests were skipped in `unittest`. But in some cases it still returns `0`. See code examp... | ecabff98c41453f15ecd26ac255d531b571b9bc1 | ca715e56a13feabc15c368898df6511613d18987 |
python/cpython | python__cpython-106707 | # Call design for Tier 2 (uops) interpreter
(Maybe this is tentative enough that it still belongs in the faster-cpython/ideas tracker, but I hope we're close enough that we can hash it out here. CC @markshannon, @brandtbucher)
(This is a WIP until I have looked a bit deeper into this.)
First order of business is... | 2b94a05a0e45e4aae030a28b716a038ef529f8ef | b2b261ab2a2d4ff000c6248dbc52247c78cfa5ab |
python/cpython | python__cpython-106567 | # Optimize (?!) in regular expressions
Some regular expression engines support `(*FAIL)` as a pattern which fails to match anything. `(?!)` is an idiomatic way to write this in engines which do not support `(*FAIL)`.
It works pretty well, but it can be optimized. Instead of compiling it as ASSERT_NOT opcode
```
>... | ed64204716035db58c7e11b78182596aa2d97176 | 50e3cc9748eb2103eb7ed6cc5a74d177df3cfb13 |
python/cpython | python__cpython-112611 | # Python 3.12 introduces redundant decls warning
# Bug report
Python 3.12 introduce a `-Wredundant-decls` warning.
```c
// test.c
#include <Python.h>
int main(void) {}
```
```sh
$ gcc test.c -o test $(pkg-config --cflags python-3.12) -Wredundant-decls
In file included from /usr/include/python3.12/Pyth... | 1f2a676785d48ed9ac01e60cc56a82e44b725474 | 29e6c7b68acac628b084a82670708008be262379 |
python/cpython | python__cpython-106559 | # multiprocessing Manager exceptions create cyclic references
<!--
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.... | 5f7d4ecf301ef12eb1d1d347add054f4fcd8fc5c | caa41a4f1db0112690cf610bab7d9c6dce9ff1ce |
python/cpython | python__cpython-106555 | # selector `_BaseSelectorImpl._key_from_fd` reimplements `.get()`
selector `_BaseSelectorImpl._key_from_fd` reimplements `.get()`
https://github.com/python/cpython/blob/da98ed0aa040791ef08b24befab697038c8c9fd5/Lib/selectors.py#L275
This internal method isn't documented https://docs.python.org/3/library/selectors... | aeef8591e41b68341af308e56a744396c66879cc | 6a70edf24ca217c5ed4a556d0df5748fc775c762 |
python/cpython | python__cpython-112613 | # GCC conversion warnings from internal header files
# Bug report
Compiling Cython-generated code with GCC `-Wconversion` produces a bunch of warnings within inline function defined in internal CPython header files.
```
/usr/include/python3.12/internal/pycore_code.h: In function ‘write_varint’:
/usr/include/py... | a74902a14cdc0952abf7bfabcf529c9b132c5cce | dee7beeb4f9d28fec945c8c495027cc22a512328 |
python/cpython | python__cpython-106536 | # Document PEP 387 Soft Deprecation
# Documentation
Document https://peps.python.org/pep-0387/#soft-deprecation
<!-- gh-linked-prs -->
### Linked PRs
* gh-106536
* gh-105735
* gh-106859
<!-- /gh-linked-prs -->
| d524b6f61f0b9fe4c359373185bf08bab423a218 | 1fb9bd222bfe96cdf8a82701a3192e45d0811555 |
python/cpython | python__cpython-106532 | # Refresh importlib.resources
This issue tracks the updates to importlib.resources from [importlib_resources](/python/importlib_resources) for Python 3.13.
<!-- gh-linked-prs -->
### Linked PRs
* gh-106532
* gh-116835
* gh-117054
* gh-120014
<!-- /gh-linked-prs -->
| 243fdcb40ebeb177ce723911c1f7fad8a1fdf6cb | 7c95345e4f93f4a2475418f17df5aae39dea861f |
python/cpython | python__cpython-106528 | # Reduce overhead to add/remove asyncio readers and writers
# Pitch
The current code path for adding and removing asyncio readers and writers always has to do a `try` `except KeyError` to add a new reader/writer
https://github.com/python/cpython/blob/b3648f036e502db7e7da951ec4eb1f205cb3d74e/Lib/asyncio/selector_... | b7dc795dfd175c0d25a479cfaf94a13c368a5a7b | ee15844db88fab3a282d14325662bcfd026272ac |
python/cpython | python__cpython-106525 | # `_sre.template` crashes in case of negative or non-integer group index
`_sre.template` crashes if `template` argument contains group index that is negative or not an `int` instance.
Examples:
```python3
>>> import _sre
>>> _sre.template("", ["", -1, ""])
Segmentation fault (core dumped)
```
```python3
>>> _s... | 2ef1dc37f02b08536b677dd23ec51541a60effd7 | 1c9e4934621627fbbfeada8d9dd87ecba4e446b0 |
python/cpython | python__cpython-106522 | # C API: Add PyObject_GetOptionalAttr() function
It is a new name of former `_PyObject_LookupAttr()` added in #76752.
```c
int PyObject_GetOptionalAttr(PyObject *obj, PyObject *attr_name, PyObject **result);
```
Discussion about making it public and naming: https://discuss.python.org/t/make-pyobject-lookupattr... | 579aa89e68a6607398317a50586af781981e89fb | cabd6e8a107127ff02f0b514148f648fb2472a58 |
python/cpython | python__cpython-106511 | # Fix DEBUG output for atomic group
It missed my attention that DEBUG output is not specialized for atomic groups (added in #34627). For example:
```
>>> re.compile('(?>ab?)', re.DEBUG)
ATOMIC_GROUP [(LITERAL, 97), (MAX_REPEAT, (0, 1, [(LITERAL, 98)]))]
...
```
The correct output should show the decoded stru... | 74ec02e9490d8aa086aa9ad9d1d34d2ad999b5af | ec7180bd1b3c156d4484e8e6babc5ecb707420e3 |
python/cpython | python__cpython-106509 | # Improve debugging of the _sre module
If macro VERBOSE is defined during compiling the `_sre` module, debugging prints are added which help to debug internals of the regular expression engine. Unfortunately, it is a global option which affects evaluation of every regular expression. Since some Python code which uses ... | b305c69d1085c9e6c6875559109f73b827cb6fe0 | 74ec02e9490d8aa086aa9ad9d1d34d2ad999b5af |
python/cpython | python__cpython-106504 | # asyncio._SelectorSocketTransport cyclic ref leak is back as `._write_ready.__self__`
<!--
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 tutor... | 3e5ce7968f5ab715f649e296e1f6b499621b8091 | 24fb627ea7a4d57cf479b7516bafdb6c253a1645 |
python/cpython | python__cpython-106488 | # Allow `str.replace`'s 'count' to be a keyword argument
# Feature or enhancement
Allow the *count* argument of `str.replace` to be a keyword to better describe its use.
# Pitch
`str.replace` takes `old` and `new` strings as parameters, and an optional `count` parameter:
https://docs.python.org/3/library/... | 34c14147a2c52930b8b471905074509639e82d5b | dac1e364901d3668742e6eecc2ce63586330c11f |
python/cpython | python__cpython-106480 | # Typo in __cplusplus macro
There is a typo in `_testcppext.cpp` https://github.com/python/cpython/blob/99b00efd5edfd5b26bf9e2a35cbfc96277fdcbb1/Lib/test/_testcppext.cpp#L89-L93 causing the `if` to never evaluate as true.
<!-- gh-linked-prs -->
### Linked PRs
* gh-106480
* gh-106493
<!-- /gh-linked-prs -->
| 67a798888dcde13bbb1e17cfcc3c742c94e67a07 | 5548097925b9924ebf761376d632c5198d01ebd5 |
python/cpython | python__cpython-106462 | # Missing Deprecation Notice for typing.Callable Alias in the Deprecated Aliases section
# Documentation
typing.Callable is not listed as a deprecated alias under https://docs.python.org/3/library/typing.html#deprecated-aliases.
However, it IS listed here: https://docs.python.org/3/library/typing.html#typing.Ca... | ca8b55c7f54b38e264056148075a8061a7082013 | ee46cb6aa959d891b0a480fea29f1eb991e0fad8 |
python/cpython | python__cpython-106366 | # `test_unittest` failing due to `test/test_unittest/testmock/testthreadingmock` assuming threading exists
https://github.com/python/cpython/commit/d65b783b6966d233467a48ef633afb4aff9d5df8 via https://github.com/python/cpython/pull/16094 the culprit.
<!-- gh-linked-prs -->
### Linked PRs
* gh-106366
<!-- /gh-linked-p... | 56353b10023ff12c7c8d6288ae4bf7bdcd5d4b6c | e7cd55753b00d6f7e5c8998bae73ebaa9e86398d |
python/cpython | python__cpython-106447 | # Doctest fails in `stdtypes.rst`
# Documentation
When some codes are modified, the doc and doctests are not updated synchronously.
**Local doctest:**
```shell
./python -m doctest ./Doc/library/stdtypes.rst
```
<details><summary>Details</summary>
<p>
```shell
********************************************... | 89867d2491c0c3ef77bc237899b2f0762f43c03c | 21d98be42289369ccfbdcc38574cb9ab50ce1c02 |
python/cpython | python__cpython-106408 | # New warning: "'_Py_IsInterpreterFinalizing' undefined; assuming extern returning in"
<img width="993" alt="Снимок экрана 2023-07-04 в 13 49 29" src="https://github.com/python/cpython/assets/4660275/72849196-4368-4368-a77b-d8584c8444db">
Looks like the reason for this is https://github.com/python/cpython/commit/... | 80f1c6c49b4cd2bf698eb2bc3d2f3da904880dd2 | dfe4de203881e8d068e6fc5b8e31075841a86d25 |
python/cpython | python__cpython-106418 | # 3.12 regression: cannot create weak reference to 'typing.TypeVar' object
This works in Python 3.11, but fails in 3.12b3:
```python
import weakref
import typing
weakref.ref(typing.TypeVar('T'))
```
I'm assuming it's an unintentional side effect of the PEP-695 implementation? Unfortunately I don't have time to... | 945d3cbf2e8e756ed16c3ec51106e6157abb2698 | a2d54d4e8ab12f967a220be88bde8ac8227c5ab3 |
python/cpython | python__cpython-106401 | # `f'"{var:}"'` adds redundant empty string literal in AST in 3.12
3.11:
```python
>>> import ast
>>> print(ast.dump(ast.parse("""f'"{var:}"'"""), indent=2))
Module(
body=[
Expr(
value=JoinedStr(
values=[
Constant(value='"'),
FormattedValue(
value=Name(i... | dfe4de203881e8d068e6fc5b8e31075841a86d25 | 8f6df5e9cbc3a1689601714192aa6ecbb23e1927 |
python/cpython | python__cpython-106369 | # Increase Argument Clinic test coverage
The Argument Clinic test suite consists of three parts:
- Lib/test/test_clinic.py: mostly parser tests
- Lib/test/clinic.test: generated code, checked by test_clinic.py (`ClinicExternalTest`)
- Modules/_testclinic.c: mostly converter tests (thanks, @colorfulappl!)
Test ... | 7f4c8121db62a9f72f00f2d9f73381e82f289581 | bf06c6825cadeda54a9c0848fa51463a0e0b2cf8 |
python/cpython | python__cpython-106422 | # Add basic introspection, like `str()` for executors.
We should (at least via the unstable C api) be able to get an executor and introspect it.
This will be useful for testing and debugging.
<!-- gh-linked-prs -->
### Linked PRs
* gh-106422
* gh-106622
<!-- /gh-linked-prs -->
| 318ea2c72e9aed7ac92457c28747eda9424c8327 | 80f1c6c49b4cd2bf698eb2bc3d2f3da904880dd2 |
python/cpython | python__cpython-106361 | # Argument Clinic: DSLParser.parse_converter() can return an incorrect kwargs dict
_Originally posted by @AlexWaygood in https://github.com/python/cpython/issues/106354#issuecomment-1617797726_:
```
Tools/clinic/clinic.py:5039: error: Incompatible return value type (got
"tuple[str, bool, dict[str | None, Any]]", ... | 0da4c883cf4185efe27b711c3e0a1e6e94397610 | 60e41a0cbbe1a43e504b50a454efe653aba78a1a |
python/cpython | python__cpython-106351 | # Tkinter: return value of `mp_init()` should not be ignored
An `mp_int` structure is usable only if `mp_init()` returns `MP_OKAY`; `mp_init()` may return `MP_MEM` if it fails to allocate memory (see https://github.com/libtom/libtommath/blob/v1.2.0/bn_mp_init.c#L12).
`mp_init()` must be checked to avoid a warning w... | b5ae7c498438657a6ba0bf4cc216b9c2c93a06c7 | 2b1a81e2cfa740609d48ad82627ae251262e6470 |
python/cpython | python__cpython-106331 | # `pathlib.PurePath.match()` can incorrectly match empty path
```python
>>> from pathlib import PurePath
>>> PurePath().match('*')
True
```
This should be false, because a `*` segment always consumes exactly one path component, but empty paths have 0 components.
<!-- gh-linked-prs -->
### Linked PRs
* gh-1063... | b4efdf8cda8fbbd0ca53b457d5f6e46a59348caf | e5862113dde7a66b08f1ece542a3cfaf0a3d9080 |
python/cpython | python__cpython-106321 | # C API: Remove private C API functions (move them to the internal C API)
Over the years, we accumulated many private functions as part of the public C API header files. I propose to remove them: move them to the internal C API.
If many C extensions are affected by these removals, it's a sign that we should conside... | 18b1fdebe0cd5e601aa341227c13ec9d89bdf32c | 0530f4f64629ff97f3feb7524da0833b9535e8b6 |
python/cpython | python__cpython-106317 | # Remove Include/cpython/pytime.h header file
Remove Include/cpython/pytime.h header file: it only contains private functions and so far no one asked to expose public functions for this API.
I propose to move these functions to the internal pycore_time.h header file.
<!-- gh-linked-prs -->
### Linked PRs
* gh-1063... | 46d77610fc77088bceac720a13d9f2df3a50f29e | 822db860eada721742f878653d7ac9364ed8df59 |
python/cpython | python__cpython-106311 | # __signature__ in the inspect module
# Documentation
The `__signature__` attribute is treated by inspect.signature (and inspect.Signature.from_callable) as an override which is returned instead of computing the signature through the ordinary process. `__text_signature__` serves a similar purpose but containing a s... | b07f23259d30e61fd7cc975b8b0e3b2e846fed8f | 5dfa71769f547fffa893a89b0b04d963a41b2441 |
python/cpython | python__cpython-106312 | # Deprecate typing.no_type_check_decorator
# Feature or enhancement
We should deprecate `typing.no_type_check_decorator`, with a view to removing it in Python 3.15.
# Pitch
The typing documentation describes `typing.no_type_check_decorator` like this:
> Decorator to give another decorator the [no_type_chec... | 32718f908cc92c474fd968912368b8a4500bd055 | 4b4a5b70aa8d47b1e2a0582b741c31b786da762a |
python/cpython | python__cpython-106308 | # Add PyMapping_GetOptionalItem()
`PyObject_GetItem()` raises a KeyError if the key is not found in a mapping. In some cases it should be treated as any other error, but in other cases it should be caught and suppressed. The repeating pattern of `PyObject_GetItem()` followed by `PyErr_ExceptionMatches(PyExc_KeyError)`... | 4bf43710d1e1f19cc46b116b5d8524f6c75dabfa | b444bfb0a325dea8c29f7b1828233b00fbf4a1cb |
python/cpython | python__cpython-106304 | # Use _PyObject_LookupAttr() instead of PyObject_GetAttr()
`PyObject_GetAttr()` followed by `PyErr_ExceptionMatches(PyExc_AttributeError)` and `PyErr_Clear()` can be replaced with `_PyObject_LookupAttr()`. It is faster, because it avoids raising the AttributeError exception which later be caught and dropped at first p... | 93d292c2b3f8e85ef562c37f59678c639b9b8fcb | d137c2cae28b79555433079d917c3e0614bdcd61 |
python/cpython | python__cpython-106302 | # `assertRaises(Regex)?(Exception)` is problematic
`assertRaises(Exception)` is problematic, because it does not really test anything.
For example, here's the test code from `test_mailbox.py`:
```python
def raiser(*args, **kw):
raise Exception("a fake error")
support.patch(self, email.generator.BytesGenerat... | 6e6a4cd52332017b10c8d88fbbbfe015948093f4 | 80b9b3a51757ebb1e3547afc349a229706eadfde |
python/cpython | python__cpython-106294 | # Typos, Grammar mistakes in object_layout.md
Found multiple typos, and grammar mistakes which can be improved in `Objects/object_layout.md`
<!-- gh-linked-prs -->
### Linked PRs
* gh-106294
* gh-114158
<!-- /gh-linked-prs -->
| 60ca37fdee52cc4ff318b6e9ddbb260e8583b33b | 45e527dfb553a5687aad828260cda85f02b9b6f8 |
python/cpython | python__cpython-106380 | # cached_property no longer works as a data descriptor in Python 3.12
# Bug report
In Python 3.11 and below, when `cached_property` was inherited from, the `__get__` method would always check for the attribute in the cache.
In Python 3.12.0b3 (since #101890 it seems) the `__get__` method no longer checks the cache... | 838406b4fc044c0b2f397c23275c69f16a76205b | 217f47d6e5e56bca78b8556e910cd00890f6f84a |
python/cpython | python__cpython-106319 | # Line numbers for errors off in traces
When a uop encounters an error, the line number is set to -1 or to the wrong place.
@markshannon
---
Repro (on latest main):
```
a = 1
def func():
global a
i = 20
while i > 0:
del a
i -= 1
if i >= 3:
a = 2
f... | 2028a4f6d996d2a46cbc33d0b65fdae284ee71fc | 58906213cc5d8f2be311664766b4923ef29dae1f |
python/cpython | python__cpython-106285 | # Python/ceval.c -Wunreachable-code warn from apple-clang
````
Python/ceval.c:2849:17: warning: code will never be executed [-Wunreachable-code]
for (;;) {}
^~~~~~~~~~~
Python/ceval.c:2848:17: warning: code will never be executed [-Wunreachable-code]
abort(); // ... | 02ce3d56e6d230768853757109e7ca6425a6a600 | a8ae73965b02302b7661ea07a6e4f955a961aca9 |
python/cpython | python__cpython-106289 | # Warning in `Python/executor_cases.c.h`
```c
'initializing': conversion from 'uint64_t' to 'uint32_t', possible loss of data (compiling source file ..\Python\ceval.c)
[D:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]
```
Appears in #106262.
<!-- gh-linked-prs -->
### Linked PRs
* gh-106289
<!-- /gh-linked-... | 2062e115017d8c33e74ba14adef2a255c344f747 | 02ce3d56e6d230768853757109e7ca6425a6a600 |
python/cpython | python__cpython-106270 | # Segmentation fault when instantiating `decimal.SignalDictMixin` type
<!--
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 ti... | 3979150a0d406707f6d253d7c15fb32c1e005a77 | 5113ed7a2b92e8beabebe5fe2f6e856c52fbe1a0 |
python/cpython | python__cpython-106260 | # Add trivial "help" target to Makefile.pre.in
The main Makefile could use a "help" target akin to that in Doc/Makefile.
<!-- gh-linked-prs -->
### Linked PRs
* gh-106260
<!-- /gh-linked-prs -->
| d9ccde28c4321ffc0d3f8b18c6346d075b784c40 | 41457c7fdb04819d04a528b8dfa72c1aa5745cc9 |
python/cpython | python__cpython-106252 | # The `cases_generator` handles some instructions incorrectly
I triggered this `assert`...
```py
Traceback (most recent call last):
File "/home/brandtbucher/cpython/./Tools/cases_generator/generate_cases.py", line 1609, in <module>
main()
File "/home/brandtbucher/cpython/./Tools/cases_generator/generate... | 6e9f83d9aee34192de5d0ef7285be23514911ccd | 8bff940ad69ce176dcd2b8e91d0b30ddd09945f1 |
python/cpython | python__cpython-106816 | # os.path.normpath truncates input on null bytes in 3.11, but not 3.10
# Bug report
Looks like `posix._path_normpath` has slightly different behaviour to the python implementation of `normpath` defined in `posixpath`, as such `os.path.normpath` behaves differently on Python 3.11 (where `posix._path_normpath` is use... | 09322724319d4c23195300b222a1c0ea720af56b | 607f18c89456cdc9064e27f86a7505e011209757 |
python/cpython | python__cpython-106239 | # Handle KeyboardInterrupt during logging._acquireLock()
We've come across a concurrency bug in `logging/__init__.py` which involves the handling of asynchronous exceptions, such as `KeyboardInterrupt`, during the execution of `logging._acquireLock()`.
In the current implementation, when `threading.RLock.acquire()`... | 99b00efd5edfd5b26bf9e2a35cbfc96277fdcbb1 | 38aa89a52ed5194f70bbf07d699a2dd3720e2efd |
python/cpython | python__cpython-106237 | # `_DummyThread`s can be joined in `-OO` mode
Right now `_DummyThread` claims to not allow `join`: https://github.com/python/cpython/blob/fb0d9b9ac1ec3ea13fae8b8ef6a4f0a5a80482b3/Lib/threading.py#L1453-L1458
But, it can be easily changed with `python -OO` mode, which strips `assert` statements.
The easiest way t... | e4b88c1e4ac129b36f99a534387d64f7b8cda8ef | dd1884dc5dc1a540c60e98ea1bc482a51d996564 |
python/cpython | python__cpython-126921 | # Argparse: improve parse_known_args() doc
# Bug report
When the `ArgumentParser.parse_known_args()` method is used to parse a parameter with `action='append'` set, the parameter will be parsed in the whole argument list, including arguments in the unknown section.
## Example code showing the issue
```
import ... | a4251411a97304ab001721c6231d86ddf4eac3f0 | cb8a72b301f47e76d93a7fe5b259e9a5758792e1 |
python/cpython | python__cpython-106234 | # Improve `InvalidTZPathWarning` warning with a stacklevel
Given this code:
```python
# ex.py
import zoneinfo
print(zoneinfo.TZPATH)
```
And this command to run it: `PYTHONTZPATH=ex.py ./python.exe ex.py`
Output will be:
```
» PYTHONTZPATH=ex.py ./python.exe ex.py
/Users/sobolev/Desktop/cpython/Lib... | d7334e2c2012defaf7aae920d6a56689464509d1 | 1a10437a14b13100bdf41cbdab819c33258deb65 |
python/cpython | python__cpython-106296 | # timeit basic examples are not compatible for Windows (CMD/ PowerShell)
# Documentation
on this page
https://docs.python.org/3/library/timeit.html
the example
`python3 -m timeit '"-".join(str(n) for n in range(100))'`
should be
`python3 -m timeit "'-'.join(str(n) for n in range(100))"`
because CMD a... | 04dfc6fa9018e92a5b51c29fc0ff45419c596bc3 | eb7d6e7ad844955f9af88707d296e003c7ce4394 |
python/cpython | python__cpython-106166 | # Fix `test_opcache` to skip threaded tests on WebAssembly platforms
https://buildbot.python.org/all/#/builders/1056/builds/2355
https://buildbot.python.org/all/#/builders/1046/builds/2338
/cc @brandtbucher
<!-- gh-linked-prs -->
### Linked PRs
* gh-106166
<!-- /gh-linked-prs -->
| 4bde89462a95e5962e1467cfc1af5a6094c0c858 | 11731434df2d7d29b4260e5ad65b993cea775c36 |
python/cpython | python__cpython-106219 | # Emscripten JS trampolines do not interact well with wasm stack switching
There is a WIP proposal to enable webassembly stack switching which have been implemented in v8.
https://github.com/WebAssembly/js-promise-integration
It is not possible to switch stacks that contain JS frames so the Emscripten JS trampolines... | 3086b86cfda829e23a71569908edbfbcdc16327f | 04130b290b545e64625c07dc8fa2709d17e70880 |
python/cpython | python__cpython-110757 | # C-analyzer (make check-c-globals) only works with GCC?
From #106173 I understand that the C-analyzer (Tools/c-analyzer, our tool that looks for mutable static globals in C code) only works with GCC. When I run it on macOS (i.e. in clang land) I get a long message that doesn't explain this, plus a traceback. Maybe it... | 898f531996f2c5399b13811682c578c4fd08afaa | b7f9661bc12fdfec98684c89f03177ae5d3d74c1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.