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-106211 | # Emscripten import trampoline is not needed
As far as I know the import isn't actually needed. It was originally added to work around typos in the CPython test suite, but those typos have since been fixed and I am unaware of any user code that requires the trampoline.
<!-- gh-linked-prs -->
### Linked PRs
* gh-106211
<!-- /gh-linked-prs -->
| e7bc8d16364bde54487eab349a29d58345e35f28 | cea9d4ea82abcb2c6f1d83a2fe819859da4bbda4 |
python/cpython | python__cpython-106201 | # Multiple unused imports in the source code
Found by https://github.com/python/core-workflow/issues/505
Affected:
```
Lib/poplib.py:454:5: F811 redefinition of unused 'sys' from line 19
Lib/test/test_capi/test_misc.py:1826:9: F811 redefinition of unused 'json' from line 9
Lib/test/test_capi/test_misc.py:1905:9: F811 redefinition of unused 'json' from line 9
Lib/test/test_tokenize.py:12:1: F811 redefinition of unused 'os_helper' from line 9
Tools/cases_generator/lexer.py:253:5: F811 redefinition of unused 'sys' from line 6
```
PR is ready.
<!-- gh-linked-prs -->
### Linked PRs
* gh-106201
<!-- /gh-linked-prs -->
| d830c4a944bcdcc8fe729a60f438fc762965eec1 | 6c60684bf5d34fae27a2f6a142ff794b38cefe1b |
python/cpython | python__cpython-106198 | # `test_multiple_inheritance_buffer_last` is duplicated in `test_buffer`
Based on https://github.com/python/core-workflow/issues/505
Source: https://github.com/python/cpython/blob/bbf722dcd39c66418e45991dcf1cdf140c2ce20e/Lib/test/test_buffer.py#L4697-L4754
There are two different tests with the same name. One must be renamed.
Before: `Ran 89 tests in 3.824s`
After: `Ran 90 tests in 4.576s`
CC @JelleZijlstra
<!-- gh-linked-prs -->
### Linked PRs
* gh-106198
* gh-106206
<!-- /gh-linked-prs -->
| c283a0cff5603540f06d9017e484b3602cc62e7c | 18f51f91e24402a24a0daa53fcbc81a5a2e9af94 |
python/cpython | python__cpython-106196 | # `test_curses` has duplicated tests
From https://github.com/python/core-workflow/issues/505
```
Lib/test/test_curses.py:1371:5: F811 redefinition of unused 'test_move_left' from line 1362
```
Source: https://github.com/python/cpython/blob/bbf722dcd39c66418e45991dcf1cdf140c2ce20e/Lib/test/test_curses.py#L1362-L1376
Based on a context, I think they should be renamed to `test_move_left` and `test_move_right`.
<!-- gh-linked-prs -->
### Linked PRs
* gh-106196
* gh-106216
<!-- /gh-linked-prs -->
| 3fb7c608e5764559a718ce8cb81350d7a3df0356 | 4bde89462a95e5962e1467cfc1af5a6094c0c858 |
python/cpython | python__cpython-109139 | # `test_monitoring` has duplicated tests
Based on https://github.com/python/core-workflow/issues/505 by @hugovk
```
Lib/test/test_monitoring.py:973:5: F811 redefinition of unused 'test_line_then_instruction' from line 950
Lib/test/test_monitoring.py:978:5: F811 redefinition of unused 'test_instruction_then_line' from line 955
```
Before rename: `Ran 49 tests in 0.014s`
After rename:
```
======================================================================
ERROR: test_instruction_then_line (test.test_monitoring.TestInstallIncrementallly.test_instruction_then_line)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/sobolev/Desktop/cpython/Lib/test/test_monitoring.py", line 956, in test_instruction_then_line
recorders = [ InstructionRecorder, LineRecorderLowNoise ]
^^^^^^^^^^^^^^^^^^^^
NameError: name 'LineRecorderLowNoise' is not defined
======================================================================
ERROR: test_line_then_instruction (test.test_monitoring.TestInstallIncrementallly.test_line_then_instruction)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/sobolev/Desktop/cpython/Lib/test/test_monitoring.py", line 953, in test_line_then_instruction
recorders = recorders, must_include = self.EXPECTED_LI)
^^^^^^^^^^^^^^^^
AttributeError: 'TestInstallIncrementallly' object has no attribute 'EXPECTED_LI'
----------------------------------------------------------------------
Ran 51 tests in 0.045s
FAILED (errors=2)
test test_monitoring failed
test_monitoring failed (2 errors)
== Tests result: FAILURE ==
1 test failed:
test_monitoring
Total duration: 94 ms
Tests result: FAILURE
```
Based on the missing runtime parts in these tests, we can just remove the first two ones, I guess.
Both of these tests were introduced in https://github.com/python/cpython/commit/411b1692811b2ecac59cb0df0f920861c7cf179a by @markshannon
<!-- gh-linked-prs -->
### Linked PRs
* gh-109139
* gh-110897
<!-- /gh-linked-prs -->
| ea530f2f9ae63e81c22a1818bec0a650ccf758d2 | 17d65547df55eaefe077c45242a7f2d175961dfd |
python/cpython | python__cpython-107016 | # email.parser header-only parsing records MultipartInvariantViolationDefect for valid multipart emails
# Bug report
A valid multipart email message, when parsed with `email.parser.HeaderParser(policy=email.policy.default)` will record a `email.errors.MultipartInvariantViolationDefect`.
If the parser isn't going to attempt to parse the message body, it shouldn't report that as a defect.
Simple test script:
```python3
import email.parser
import email.policy
email_str = '''\
Date: 01 Jan 2001 00:01+0000
From: arthur@example.example
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary=autocracy
--autocracy
Content-Type: text/plain
By hanging on to outdated imperialist dogma which perpetuates the economic and
social differences in our society.
--autocracy
Content-Type: text/html
<html><body><p>By hanging on to outdated imperialist dogma which perpetuates
the economic and social differences in our society.</p></body></html>
--autocracy--
'''
full_parser = email.parser.Parser(policy=email.policy.default)
parsed_email_full = full_parser.parsestr(email_str)
print(parsed_email_full.defects) # Prints [] as expected
header_parser = email.parser.HeaderParser(policy=email.policy.default)
parsed_email_headers_only = header_parser.parsestr(email_str)
print(parsed_email_headers_only.defects) # Prints [MultipartInvariantViolationDefect()]
```
# Your environment
- Debian 12
- Raspberry Pi 4 (arm64)
- Python 3.11.2 (Debian package 3.11.2-1+b1)
<!-- gh-linked-prs -->
### Linked PRs
* gh-107016
* gh-107111
* gh-107112
<!-- /gh-linked-prs -->
| c65592c4d6d7552fb6284442906a96a6874cb266 | 54632528eeba841e4a8cc95ecbd84c9aca8eef57 |
python/cpython | python__cpython-106187 | # `test_traceback` does not run one set of `CPythonTracebackErrorCaretTests`
Based on @hugovk work in https://github.com/python/core-workflow/issues/505 I found that we have two duplicated class `CPythonTracebackErrorCaretTests` here: https://github.com/python/cpython/blob/a3dd8cce58fe2b27eea4eed572d086dc8a7e1bb8/Lib/test/test_traceback.py#L908-L928
So, first tests are not executed.
We need to rename on of them.
Before: `Ran 236 tests in 2.453s`
After: `Ran 259 tests in 2.481s`
<!-- gh-linked-prs -->
### Linked PRs
* gh-106187
* gh-107268
<!-- /gh-linked-prs -->
| 7c89f1189229c5c67a3766e24ecf00cde658b7fd | 233b8782886939176982a90f563d552757cbf34e |
python/cpython | python__cpython-106183 | # `sys.getfilesystemencoding()` should return interned string
# Feature or enhancement
Intern `sys.getfilesystemencoding()` output.
# Pitch
fsencoding string may be cached and reused.
(After `sys._enablelegacywindowslegacyfsencoding()` is removed, we can cache fsencoding object.)
<!-- gh-linked-prs -->
### Linked PRs
* gh-106183
<!-- /gh-linked-prs -->
| f1034ba7f67400e7ed7e299dc8b22521c4e43246 | 77ddc9a7b1b28c8b8aee6cc97e483185a56819a6 |
python/cpython | python__cpython-106164 | # C API: Check in PyTuple_SET_ITEM() and PyList_SET_ITEM()
The PyTuple_SET_ITEM() and PyList_SET_ITEM() functions don't check that the index is valid. It should be checked with an assertion.
<!-- gh-linked-prs -->
### Linked PRs
* gh-106164
* gh-111480
* gh-111618
* gh-111683
<!-- /gh-linked-prs -->
| 3f8483cad2f3b94600c3ecf3f0bb220bb1e61d7d | 161012fc25910a47423bae8012398bf519a88140 |
python/cpython | python__cpython-106181 | # test_array modifies `warnings.filter`
```
$ ./python -m test test_array --fail-env-changed -m test.test_array.ArrayReconstructorTest.test_error
0:00:00 load avg: 17.75 Run tests sequentially
0:00:00 load avg: 17.75 [1/1] test_array
Warning -- warnings.filters was modified by test_array
Warning -- Before: (140159909806320, [], [])
Warning -- After: (140159909806320, [], [('ignore', re.compile("The 'u' type code is deprecated and will be removed in Python 3.16", re.IGNORECASE), <class 'DeprecationWarning'>, None, 0)])
test_array failed (env changed)
== Tests result: ENV CHANGED ==
1 test altered the execution environment:
test_array
Total duration: 321 ms
Tests result: ENV CHANGED
```
cc @methane @hugovk
<!-- gh-linked-prs -->
### Linked PRs
* gh-106181
* gh-106404
<!-- /gh-linked-prs -->
| a3dd8cce58fe2b27eea4eed572d086dc8a7e1bb8 | 541a10f9ed193a79aeea5e244bca6f6485d0689f |
python/cpython | python__cpython-106167 | # Fix `test_gzip` failure under WASI
https://github.com/python/cpython/commit/1858db7cbdbf41aa600c954c15224307bf81a258 introduced a dependency on `zlib` in `test_gzip` (see https://buildbot.python.org/all/#/builders/1046/builds/2315 for the first failure), but `zlib` is not guaranteed to exist.
/cc @Yhg1s
<!-- gh-linked-prs -->
### Linked PRs
* gh-106167
* gh-106170
<!-- /gh-linked-prs -->
| 161012fc25910a47423bae8012398bf519a88140 | 84caa3324aaefb900895de2f946607cfdbe1be70 |
python/cpython | python__cpython-106161 | # [3.12] cProfile counts 0 primitive calls for builtins.exec in certain scenario
# Bug report
In 3.12, cProfile can count 0 primitive calls and miscalculate cumulative time in the following scenario.
For this layout:
```
script.py
project/
typing.py
```
And the file contents:
script.py
```python
import project.typing
```
project/typing.py
```python
from typing import Protocol
class A(Protocol): ...
```
I observe this behavior difference with `python3 -m cProfile script.py`:
**3.11.2**
```
697 function calls (693 primitive calls) in 0.001 seconds
Ordered by: cumulative time
ncalls tottime percall cumtime percall filename:lineno(function)
2/1 0.000 0.000 0.001 0.001 {built-in method builtins.exec}
1 0.000 0.000 0.001 0.001 script.py:1(<module>)
```
***3.12.0b3***
```
635 function calls (630 primitive calls) in 0.001 seconds
Ordered by: cumulative time
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.000 0.000 0.001 0.001 script.py:1(<module>)
...
1/0 0.000 0.000 0.000 {built-in method builtins.exec}
```
Notice the division by zero causing a missing `percall` stat for exec.
***
This means that in more substantial examples, the profiler will omit a significant portion of the relevant cumulative time. See this output for a 14.286 second script, I only have access to a cumtime for 0.800:
```
45856453 function calls (31647888 primitive calls) in 14.286 seconds
Ordered by: cumulative time
ncalls tottime percall cumtime percall filename:lineno(function)
4054 0.005 0.000 0.800 0.000 modutils.py:620(_spec_from_modpath)
...
```
# Your environment
- CPython versions tested on: Python 3.12.0b3
- Operating system and architecture: MacOS 13.4.1
<!-- gh-linked-prs -->
### Linked PRs
* gh-106161
* gh-106256
<!-- /gh-linked-prs -->
| cea9d4ea82abcb2c6f1d83a2fe819859da4bbda4 | 7b2d94d87513967b357c658c6e7e1b8c8d02487d |
python/cpython | python__cpython-106150 | # tidy up the division of work between compile.c and flowgraph.c
Following the split of the compiler into 3 parts in #87092, the resolution of jump targets is still in the optimizer, but it should move to the assembler.
There are also a few operations in compile.c that could move into the optimizer.
<!-- gh-linked-prs -->
### Linked PRs
* gh-106150
* gh-106291
* gh-107180
* gh-107255
* gh-107321
* gh-107639
<!-- /gh-linked-prs -->
| 529088100952b31797a29ef7e0f5716613b32d66 | eaa1eae55ea66d74c5303924320185dac74d4eb1 |
python/cpython | python__cpython-106224 | # AST nodes for PEP 695 type param syntax do not require `end_lineno` nor `end_col_offset`
# Bug report
Unlike AST nodes for 3.10 match syntax, AST nodes for 3.12 type param syntax (PEP 695) do not require `end_lineno` nor `end_col_offset`.
For 3.10 match syntax, this question was discussed [here](https://github.com/python/cpython/issues/88058#issuecomment-1093911564), and it was decided to require them.
Context: see end_lineno and end_col_offset creation in 3.8 by #11605.
https://github.com/python/cpython/blob/bb578a0c304dffe43bb28b36b2b1c9153c78b659/Parser/Python.asdl#L148-L151
# Your environment
Python 3.12.0b3
<!-- gh-linked-prs -->
### Linked PRs
* gh-106224
* gh-106295
<!-- /gh-linked-prs -->
| 46c1097868745eeb47abbc8af8c34e8fcb80ff1d | 904aef994262383ae916545908f0578c2d53cf31 |
python/cpython | python__cpython-106143 | # Reorder some fields to facilitate out-of-process inspection
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 different platforms. Not only that but they require the tools to copy **a huge** amount of intermediate structures making the whole thing very verbose.
As an example, this is the list of stuff that needs to be copied so out-of-process debuggers can fetch the interpreters, runtime state and thread list:
https://gist.github.com/godlygeek/271951b20bb4c3783c2dd7c80908b116
With a simple reordering, that would shrink this to
https://gist.github.com/godlygeek/341ce879a638c0fece9d0081d63e5ad9
For the interpreter state is also quite bad. Here is the things that need to be copied:
https://gist.github.com/godlygeek/2468ff3d0f648a1aca7a8305bad7f825
Not only that, but this depends on the compile-time value of all of this:
```
int PYSTACK_SIZEOF_VOID_P = sizeof(void*);
int ALIGNMENT = PYSTACK_SIZEOF_VOID_P > 4 ? 16 : 8;
int SMALL_REQUEST_THRESHOLD = 512;
int NB_SMALL_SIZE_CLASSES = (SMALL_REQUEST_THRESHOLD / ALIGNMENT);
int OBMALLOC_USED_POOLS_SIZE = (2 * ((NB_SMALL_SIZE_CLASSES + 7) / 8) * 8);
int USE_LARGE_ARENAS = PYSTACK_SIZEOF_VOID_P > 4;
int ARENA_BITS = USE_LARGE_ARENAS ? 20 : 18;
int ARENA_SIZE = 1 << ARENA_BITS;
int ARENA_SIZE_MASK = ARENA_SIZE - 1;
int POINTER_BITS = 8 * PYSTACK_SIZEOF_VOID_P;
int IGNORE_BITS = 0;
int USE_INTERIOR_NODES = PYSTACK_SIZEOF_VOID_P > 4;
int ADDRESS_BITS = (POINTER_BITS - IGNORE_BITS);
int INTERIOR_BITS = USE_INTERIOR_NODES ? ((ADDRESS_BITS - ARENA_BITS + 2) / 3) : 0;
int MAP_TOP_BITS = INTERIOR_BITS;
int MAP_TOP_LENGTH = (1 << MAP_TOP_BITS);
int MAP_TOP_MASK = (MAP_TOP_LENGTH - 1);
int MAP_MID_BITS = INTERIOR_BITS;
int MAP_MID_LENGTH = (1 << MAP_MID_BITS);
int MAP_BOT_BITS = (ADDRESS_BITS - ARENA_BITS - 2 * INTERIOR_BITS);
int MAP_BOT_LENGTH = (1 << MAP_BOT_BITS);
int WITH_PYMALLOC_RADIX_TREE = 1;
int USE_LARGE_POOLS = USE_LARGE_ARENAS ? WITH_PYMALLOC_RADIX_TREE : 0;
int POOL_BITS = USE_LARGE_POOLS ? 14 : 12;
int POOL_SIZE = (1 << POOL_BITS);
int MAX_POOLS_IN_ARENA = (ARENA_SIZE / POOL_SIZE);
```
If the user changes any of these (like `WITH_PYMALLOC_RADIX_TREE`) when compiling Python, then the tools won't be able to work correctly.
We can easily reorder these two structures because they are not in the hot path of anything (unlike frames and code objects).
<!-- gh-linked-prs -->
### Linked PRs
* gh-106143
* gh-106147
* gh-106148
* gh-106155
<!-- /gh-linked-prs -->
| 2d5a1c281161d037148ffb5983decc6d31c2557d | bb578a0c304dffe43bb28b36b2b1c9153c78b659 |
python/cpython | python__cpython-106271 | # Add more cases to `test_patma`
While anwsering https://github.com/python/cpython/issues/106133 I've noticed that `test_patma` does not have tests for some corner-cases:
1. Case `case [x] | x: ...` is mentined in https://peps.python.org/pep-0634/#capture-patterns but is never tested, the closest we have to it is `case [z] | [1, (0 | 1 as z)] | [z]:`, which is not the same
2. Guards can have side effects according to https://peps.python.org/pep-0634/#guards but it is never tested
3. Guards are never tested with: mapping patterns, dotted value patterns
4. In [`ClassPattern` section](https://peps.python.org/pep-0634/#class-patterns) PEP says: `If name_or_attr is not an instance of the builtin type, TypeError is raised.` It is never tested in `TestTypeErrors`
5. [`LiteralPattern`](https://peps.python.org/pep-0634/#literal-patterns) might have some more expected `SyntaxError` cases, like using `*` and `/`, using three numbers like `0 + 0j + 0`
6. `LiteralPattern` says: `The singleton literals None, True and False are compared using the is operator.`, but only `None` is checked
I would like to send a PR with the new test cases.
<!-- gh-linked-prs -->
### Linked PRs
* gh-106271
<!-- /gh-linked-prs -->
| 904aef994262383ae916545908f0578c2d53cf31 | 2062e115017d8c33e74ba14adef2a255c344f747 |
python/cpython | python__cpython-106124 | # Modules/_sha3 is created by configure, but no longer an actual source directory
# Bug report
I noticed that `make distclean` didn't compare correctly with a fresh clone (after accounting for files I expected it wouldn't be expected to clean up). It left an empty `Modules/_sha3` directory which used to hold files, but which is simply created by `configure`, then ignored.
# Your environment
- `main` branch
- MacOS Ventura 13.4.1, Apple M1
<!-- gh-linked-prs -->
### Linked PRs
* gh-106124
* gh-106127
<!-- /gh-linked-prs -->
| 0345b0c2bbf251a0f475cf53e0fb04c79a220e52 | 51fc72511733353de15bc633a3d7b6da366842e4 |
python/cpython | python__cpython-106120 | # 3.12.0b3 build issue: 'O_CLOEXEC' undeclared in sysmodule.c
I am building Python 3.12.0b3 (3.11.X builds fine) on CentOS 5 using glibc-2.5 and gcc-4.8.5 and I encounter this build error:
gcc-4.8 -std=gnu11 -pthread -c -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O3 -Wall -std=c11 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration -fvisibility=hidden -I./Include/internal -I. -I./Include -fPIC -DPy_BUILD_CORE \
-DABIFLAGS='""' \
-DMULTIARCH=\"x86_64-linux-gnu\" \
-o Python/sysmodule.o ./Python/sysmodule.c
./Python/sysmodule.c: In function 'PyUnstable_PerfMapState_Init':
./Python/sysmodule.c:2280:62: error: 'O_CLOEXEC' undeclared (first use in this function)
int flags = O_WRONLY | O_CREAT | O_APPEND | O_NOFOLLOW | O_CLOEXEC;
^
./Python/sysmodule.c:2280:62: note: each undeclared identifier is reported only once for each function it appears in
make: *** [Python/sysmodule.o] Error 1
Perhaps there is a missing #ifdef O_CLOEXEC in ./Python/sysmodule.c?
Thanks
<!-- gh-linked-prs -->
### Linked PRs
* gh-106120
* gh-106199
<!-- /gh-linked-prs -->
| 6c60684bf5d34fae27a2f6a142ff794b38cefe1b | bbf722dcd39c66418e45991dcf1cdf140c2ce20e |
python/cpython | python__cpython-106112 | # The zipapp module documentation includes out of date notes on creating a Windows executable
# Documentation
As noted in #72434, the zipapp documentation contains a section covering "How to create a Windows executable". This section was never entirely complete, and is now inaccurate as the `distutils` library is no longer in the stdlib. As a result, it should be removed.
<!-- gh-linked-prs -->
### Linked PRs
* gh-106112
* gh-106114
<!-- /gh-linked-prs -->
| 5d4dbf0e309255e5bce9e31d805a8f950ebf9161 | 1a2bc94fc2bbdf5f810b441ebbbd8fec95a3207c |
python/cpython | python__cpython-106109 | # Docs: dataclasses: wrong error documented
# Documentation
[Data Classes - Mutable default values](https://docs.python.org/3/library/dataclasses.html#mutable-default-values) says in the second blockquote
> x: list = [] # This code raises **ValueError**
but in the explanantion (two paragraphs down) it notes:
> Instead, the dataclass decorator will raise a **TypeError** if it detects an unhashable default parameter.
This is inconsistent, in fact a **ValueError** is raised, cf. https://github.com/python/cpython/blob/e8e59ee474869e7c02e7cae3815c9c2183671b21/Lib/dataclasses.py#L848C1-L853C1
<!-- gh-linked-prs -->
### Linked PRs
* gh-106109
* gh-106115
* gh-106116
<!-- /gh-linked-prs -->
| 512f299e557f4ab60768d36cee9968bd92116367 | 219effa876785408a87bd6acb37c07ee0d25f3f9 |
python/cpython | python__cpython-106875 | # Segmentation fault in 3.11.4, 3.12.0b3; _PyInterpreterFrame ownership issue
# Crash report
This test case (minimized from a crash in the Zulip test suite) causes a segmentation fault in Python 3.11.4 and 3.12.0b3.
https://github.com/andersk/python-segfault
```console
$ git clone https://github.com/andersk/python-segfault.git
$ cd python-segfault
$ pip install -r requirements.txt
…
Successfully installed Django-4.2.2 asgiref-3.7.2 coverage-7.2.7 sqlparse-0.4.4
$ python -m django migrate --settings=myapp.settings
…
$ python -m coverage run --timid -m django test --settings=myapp.settings
Found 1 test(s).
System check identified no issues (0 silenced).
150
151
…
199
200
Fatal Python error: Segmentation fault
```
Based on the tracebacks below, this looks like a `_PyInterpreterFrame` ownership issue similar to #99729 and #100126. The crash is here:
https://github.com/python/cpython/blob/1bbf60dc311443dfc7cd3c587745db0768bfe5dc/Objects/frameobject.c#L854
where the `_PyInterpreterFrame` at `*f->f_frame` has already been freed.
# Error messages
<details>
<summary>Full output with Python traceback</summary>
```console
$ python -m coverage run --timid -m django test --settings=myapp.settings
Found 1 test(s).
System check identified no issues (0 silenced).
150
151
…
199
200
Fatal Python error: Segmentation fault
Current thread 0x00007f4abeab1740 (most recent call first):
Garbage-collecting
File "/home/anders/zulip/test/python-segfault/venv/lib/python3.11/site-packages/django/utils/functional.py", line 295 in __getattribute__
File "/home/anders/zulip/test/python-segfault/venv/lib/python3.11/site-packages/django/db/models/fields/__init__.py", line 1587 in get_prep_value
File "/home/anders/zulip/test/python-segfault/venv/lib/python3.11/site-packages/django/db/models/lookups.py", line 85 in get_prep_lookup
File "/home/anders/zulip/test/python-segfault/venv/lib/python3.11/site-packages/django/db/models/lookups.py", line 27 in __init__
File "/home/anders/zulip/test/python-segfault/venv/lib/python3.11/site-packages/django/db/models/sql/query.py", line 1307 in build_lookup
File "/home/anders/zulip/test/python-segfault/venv/lib/python3.11/site-packages/django/db/models/sql/query.py", line 1480 in build_filter
File "/home/anders/zulip/test/python-segfault/venv/lib/python3.11/site-packages/django/db/models/sql/query.py", line 1565 in _add_q
File "/home/anders/zulip/test/python-segfault/venv/lib/python3.11/site-packages/django/db/models/sql/query.py", line 1534 in add_q
File "/home/anders/zulip/test/python-segfault/venv/lib/python3.11/site-packages/django/db/models/query.py", line 1461 in _filter_or_exclude_inplace
File "/home/anders/zulip/test/python-segfault/venv/lib/python3.11/site-packages/django/db/models/query.py", line 1454 in _filter_or_exclude
File "/home/anders/zulip/test/python-segfault/venv/lib/python3.11/site-packages/django/db/models/query.py", line 1436 in filter
File "/home/anders/zulip/test/python-segfault/venv/lib/python3.11/site-packages/django/db/models/query.py", line 623 in get
File "/home/anders/zulip/test/python-segfault/venv/lib/python3.11/site-packages/django/db/models/manager.py", line 87 in manager_method
File "/home/anders/zulip/test/python-segfault/venv/lib/python3.11/site-packages/django/contrib/sessions/backends/db.py", line 32 in _get_session_from_db
File "/home/anders/zulip/test/python-segfault/venv/lib/python3.11/site-packages/django/contrib/sessions/backends/db.py", line 42 in load
File "/home/anders/zulip/test/python-segfault/venv/lib/python3.11/site-packages/django/contrib/sessions/backends/base.py", line 192 in _get_session
File "/home/anders/zulip/test/python-segfault/venv/lib/python3.11/site-packages/django/contrib/sessions/backends/base.py", line 53 in __getitem__
File "/home/anders/zulip/test/python-segfault/venv/lib/python3.11/site-packages/django/contrib/auth/__init__.py", line 60 in _get_user_session_key
File "/home/anders/zulip/test/python-segfault/venv/lib/python3.11/site-packages/django/contrib/auth/__init__.py", line 191 in get_user
File "/home/anders/zulip/test/python-segfault/venv/lib/python3.11/site-packages/django/contrib/auth/middleware.py", line 11 in get_user
File "/home/anders/zulip/test/python-segfault/venv/lib/python3.11/site-packages/django/contrib/auth/middleware.py", line 25 in <lambda>
File "/home/anders/zulip/test/python-segfault/venv/lib/python3.11/site-packages/django/utils/functional.py", line 419 in _setup
File "/home/anders/zulip/test/python-segfault/venv/lib/python3.11/site-packages/django/utils/functional.py", line 266 in inner
File "/home/anders/zulip/test/python-segfault/myapp/urls.py", line 21 in foo
File "/home/anders/zulip/test/python-segfault/myapp/urls.py", line 8 in <lambda>
File "/home/anders/zulip/test/python-segfault/myapp/urls.py", line 8 in <lambda>
File "/home/anders/zulip/test/python-segfault/myapp/urls.py", line 34 in me
File "/home/anders/zulip/test/python-segfault/venv/lib/python3.11/site-packages/django/utils/decorators.py", line 134 in _wrapper_view
File "/home/anders/zulip/test/python-segfault/myapp/urls.py", line 8 in <lambda>
File "/home/anders/zulip/test/python-segfault/myapp/urls.py", line 8 in <lambda>
File "/home/anders/zulip/test/python-segfault/myapp/urls.py", line 8 in <lambda>
File "/home/anders/zulip/test/python-segfault/myapp/urls.py", line 8 in <lambda>
File "/home/anders/zulip/test/python-segfault/venv/lib/python3.11/site-packages/django/core/handlers/base.py", line 197 in _get_response
File "/home/anders/zulip/test/python-segfault/venv/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55 in inner
File "/home/anders/zulip/test/python-segfault/venv/lib/python3.11/site-packages/django/utils/deprecation.py", line 134 in __call__
File "/home/anders/zulip/test/python-segfault/venv/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55 in inner
File "/home/anders/zulip/test/python-segfault/venv/lib/python3.11/site-packages/django/utils/deprecation.py", line 134 in __call__
File "/home/anders/zulip/test/python-segfault/venv/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55 in inner
File "/home/anders/zulip/test/python-segfault/venv/lib/python3.11/site-packages/django/utils/deprecation.py", line 134 in __call__
File "/home/anders/zulip/test/python-segfault/venv/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55 in inner
File "/home/anders/zulip/test/python-segfault/venv/lib/python3.11/site-packages/django/utils/deprecation.py", line 134 in __call__
File "/home/anders/zulip/test/python-segfault/venv/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55 in inner
File "/home/anders/zulip/test/python-segfault/venv/lib/python3.11/site-packages/django/utils/deprecation.py", line 134 in __call__
File "/home/anders/zulip/test/python-segfault/venv/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55 in inner
File "/home/anders/zulip/test/python-segfault/venv/lib/python3.11/site-packages/django/utils/deprecation.py", line 134 in __call__
File "/home/anders/zulip/test/python-segfault/venv/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55 in inner
File "/home/anders/zulip/test/python-segfault/venv/lib/python3.11/site-packages/django/utils/deprecation.py", line 134 in __call__
File "/home/anders/zulip/test/python-segfault/venv/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55 in inner
File "/home/anders/zulip/test/python-segfault/venv/lib/python3.11/site-packages/django/utils/deprecation.py", line 134 in __call__
File "/home/anders/zulip/test/python-segfault/venv/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55 in inner
File "/home/anders/zulip/test/python-segfault/venv/lib/python3.11/site-packages/django/utils/deprecation.py", line 134 in __call__
File "/home/anders/zulip/test/python-segfault/venv/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55 in inner
File "/home/anders/zulip/test/python-segfault/venv/lib/python3.11/site-packages/django/utils/deprecation.py", line 134 in __call__
File "/home/anders/zulip/test/python-segfault/venv/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55 in inner
File "/home/anders/zulip/test/python-segfault/venv/lib/python3.11/site-packages/django/utils/deprecation.py", line 134 in __call__
File "/home/anders/zulip/test/python-segfault/venv/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55 in inner
File "/home/anders/zulip/test/python-segfault/venv/lib/python3.11/site-packages/django/utils/deprecation.py", line 134 in __call__
File "/home/anders/zulip/test/python-segfault/venv/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55 in inner
File "/home/anders/zulip/test/python-segfault/venv/lib/python3.11/site-packages/django/utils/deprecation.py", line 134 in __call__
File "/home/anders/zulip/test/python-segfault/venv/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55 in inner
File "/home/anders/zulip/test/python-segfault/venv/lib/python3.11/site-packages/django/utils/deprecation.py", line 134 in __call__
File "/home/anders/zulip/test/python-segfault/venv/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55 in inner
File "/home/anders/zulip/test/python-segfault/venv/lib/python3.11/site-packages/django/utils/deprecation.py", line 134 in __call__
File "/home/anders/zulip/test/python-segfault/venv/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55 in inner
File "/home/anders/zulip/test/python-segfault/venv/lib/python3.11/site-packages/django/utils/deprecation.py", line 134 in __call__
File "/home/anders/zulip/test/python-segfault/venv/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55 in inner
File "/home/anders/zulip/test/python-segfault/venv/lib/python3.11/site-packages/django/utils/deprecation.py", line 134 in __call__
File "/home/anders/zulip/test/python-segfault/venv/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55 in inner
File "/home/anders/zulip/test/python-segfault/venv/lib/python3.11/site-packages/django/core/handlers/base.py", line 140 in get_response
File "/home/anders/zulip/test/python-segfault/venv/lib/python3.11/site-packages/django/test/client.py", line 176 in __call__
File "/home/anders/zulip/test/python-segfault/venv/lib/python3.11/site-packages/django/test/client.py", line 886 in request
File "/home/anders/zulip/test/python-segfault/venv/lib/python3.11/site-packages/django/test/client.py", line 609 in generic
File "/home/anders/zulip/test/python-segfault/venv/lib/python3.11/site-packages/django/test/client.py", line 482 in post
File "/home/anders/zulip/test/python-segfault/venv/lib/python3.11/site-packages/django/test/client.py", line 948 in post
File "/home/anders/zulip/test/python-segfault/myapp/test_me.py", line 35 in test_me
File "/home/anders/zulip/test/python-segfault/myapp/test_me.py", line 10 in <lambda>
File "/home/anders/zulip/test/python-segfault/myapp/test_me.py", line 10 in <lambda>
File "/home/anders/zulip/test/python-segfault/myapp/test_me.py", line 10 in <lambda>
File "/home/anders/zulip/test/python-segfault/myapp/test_me.py", line 10 in <lambda>
File "/home/anders/zulip/test/python-segfault/myapp/test_me.py", line 10 in <lambda>
File "/home/anders/zulip/test/python-segfault/myapp/test_me.py", line 10 in <lambda>
File "/home/anders/zulip/test/python-segfault/myapp/test_me.py", line 10 in <lambda>
File "/home/anders/zulip/test/python-segfault/myapp/test_me.py", line 10 in <lambda>
File "/home/anders/zulip/test/python-segfault/myapp/test_me.py", line 10 in <lambda>
File "/nix/store/cxsw4x1189ppmsydhwsmssr0x65nygj7-python3-3.11.4/lib/python3.11/unittest/case.py", line 579 in _callTestMethod
File "/nix/store/cxsw4x1189ppmsydhwsmssr0x65nygj7-python3-3.11.4/lib/python3.11/unittest/case.py", line 623 in run
File "/nix/store/cxsw4x1189ppmsydhwsmssr0x65nygj7-python3-3.11.4/lib/python3.11/unittest/case.py", line 678 in __call__
File "/nix/store/cxsw4x1189ppmsydhwsmssr0x65nygj7-python3-3.11.4/lib/python3.11/unittest/suite.py", line 122 in run
File "/nix/store/cxsw4x1189ppmsydhwsmssr0x65nygj7-python3-3.11.4/lib/python3.11/unittest/suite.py", line 84 in __call__
File "/nix/store/cxsw4x1189ppmsydhwsmssr0x65nygj7-python3-3.11.4/lib/python3.11/unittest/runner.py", line 217 in run
File "/home/anders/zulip/test/python-segfault/venv/lib/python3.11/site-packages/django/test/runner.py", line 983 in run_suite
File "/home/anders/zulip/test/python-segfault/venv/lib/python3.11/site-packages/django/test/runner.py", line 1061 in run_tests
File "/home/anders/zulip/test/python-segfault/venv/lib/python3.11/site-packages/django/core/management/commands/test.py", line 68 in handle
File "/home/anders/zulip/test/python-segfault/venv/lib/python3.11/site-packages/django/core/management/base.py", line 458 in execute
File "/home/anders/zulip/test/python-segfault/venv/lib/python3.11/site-packages/django/core/management/base.py", line 412 in run_from_argv
File "/home/anders/zulip/test/python-segfault/venv/lib/python3.11/site-packages/django/core/management/commands/test.py", line 24 in run_from_argv
File "/home/anders/zulip/test/python-segfault/venv/lib/python3.11/site-packages/django/core/management/__init__.py", line 436 in execute
File "/home/anders/zulip/test/python-segfault/venv/lib/python3.11/site-packages/django/core/management/__init__.py", line 442 in execute_from_command_line
File "/home/anders/zulip/test/python-segfault/venv/lib/python3.11/site-packages/django/__main__.py", line 9 in <module>
File "/home/anders/zulip/test/python-segfault/venv/lib/python3.11/site-packages/coverage/execfile.py", line 211 in run
...
Segmentation fault (core dumped)
```
</details>
<details>
<summary>AddressSanitizer traceback</summary>
This is from the current `3.11` branch, commit 1bbf60dc311443dfc7cd3c587745db0768bfe5dc.
```console
$ python -m coverage run --timid -m django test --settings=myapp.settings
/home/vagrant/python-segfault/venv/lib/python3.11/site-packages/django/conf/__init__.py:241: RemovedInDjango50Warning: The default value of USE_TZ will change from False to True in Django 5.0. Set USE_TZ to False in your project settings if you want to keep the current default behavior.
warnings.warn(
Found 1 test(s).
System check identified no issues (0 silenced).
150
151
…
199
200
=================================================================
==4327==ERROR: AddressSanitizer: heap-use-after-free on address 0x62900558c25d at pc 0x55fd433dca1a bp 0x7fff5dc37490 sp 0x7fff5dc37488
READ of size 1 at 0x62900558c25d thread T0
#0 0x55fd433dca19 in frame_dealloc /srv/zulip/anders/cpython/Objects/frameobject.c:854:5
#1 0x55fd434fcfd9 in _PyTrash_thread_destroy_chain /srv/zulip/anders/cpython/Objects/object.c:2276:9
#2 0x55fd434fcfd9 in _PyTrash_end /srv/zulip/anders/cpython/Objects/object.c:2302:9
#3 0x55fd43a02ece in tb_dealloc /srv/zulip/anders/cpython/Python/traceback.c:176:5
#4 0x55fd434fd7de in _Py_Dealloc /srv/zulip/anders/cpython/Objects/object.c:2390:5
#5 0x55fd43385e52 in Py_DECREF /srv/zulip/anders/cpython/./Include/object.h:527:9
#6 0x55fd4338f02e in BaseException_clear /srv/zulip/anders/cpython/Objects/exceptions.c:88:5
#7 0x55fd43582b66 in subtype_clear /srv/zulip/anders/cpython/Objects/typeobject.c:1297:16
#8 0x55fd43a48c0f in delete_garbage /srv/zulip/anders/cpython/Modules/gcmodule.c:1013:24
#9 0x55fd43a48c0f in gc_collect_main /srv/zulip/anders/cpython/Modules/gcmodule.c:1287:5
#10 0x55fd43a45b8f in gc_collect_with_callback /srv/zulip/anders/cpython/Modules/gcmodule.c:1400:14
#11 0x55fd43a4ce31 in gc_collect_generations /srv/zulip/anders/cpython/Modules/gcmodule.c:1455:17
#12 0x55fd43a4ce31 in _PyObject_GC_Link /srv/zulip/anders/cpython/Modules/gcmodule.c:2270:9
#13 0x55fd43a4d79d in gc_alloc /srv/zulip/anders/cpython/Modules/gcmodule.c:2290:5
#14 0x55fd43a4d615 in _PyObject_GC_New /srv/zulip/anders/cpython/Modules/gcmodule.c:2298:20
#15 0x55fd433750e3 in PyWrapper_New /srv/zulip/anders/cpython/Objects/descrobject.c:1460:10
#16 0x55fd43371a6c in wrapperdescr_get /srv/zulip/anders/cpython/Objects/descrobject.c:220:12
#17 0x55fd43564a44 in super_getattro /srv/zulip/anders/cpython/Objects/typeobject.c:8869:24
#18 0x55fd434f511c in PyObject_GetAttr /srv/zulip/anders/cpython/Objects/object.c:916:18
#19 0x55fd434f8901 in _PyObject_GetMethod /srv/zulip/anders/cpython/Objects/object.c:1164:19
#20 0x55fd437db452 in _PyEval_EvalFrameDefault /srv/zulip/anders/cpython/Python/ceval.c:4492:30
#21 0x55fd437b8af6 in _PyEval_EvalFrame /srv/zulip/anders/cpython/./Include/internal/pycore_ceval.h:73:16
#22 0x55fd437b83f1 in _PyEval_Vector /srv/zulip/anders/cpython/Python/ceval.c:6439:24
#23 0x55fd433379fb in _PyFunction_Vectorcall /srv/zulip/anders/cpython/Objects/call.c
#24 0x55fd43342c6e in _PyObject_VectorcallTstate /srv/zulip/anders/cpython/./Include/internal/pycore_call.h:92:11
#25 0x55fd4333f514 in method_vectorcall /srv/zulip/anders/cpython/Objects/classobject.c:59:18
#26 0x55fd433377d4 in _PyObject_VectorcallTstate /srv/zulip/anders/cpython/./Include/internal/pycore_call.h:92:11
#27 0x55fd433377d4 in PyObject_CallOneArg /srv/zulip/anders/cpython/Objects/call.c:376:12
#28 0x55fd435c571a in call_attribute /srv/zulip/anders/cpython/Objects/typeobject.c:7673:11
#29 0x55fd435ad736 in slot_tp_getattr_hook /srv/zulip/anders/cpython/Objects/typeobject.c:7709:15
#30 0x55fd434f511c in PyObject_GetAttr /srv/zulip/anders/cpython/Objects/object.c:916:18
#31 0x55fd437dae27 in _PyEval_EvalFrameDefault /srv/zulip/anders/cpython/Python/ceval.c:3466:29
#32 0x55fd437b8af6 in _PyEval_EvalFrame /srv/zulip/anders/cpython/./Include/internal/pycore_ceval.h:73:16
#33 0x55fd437b83f1 in _PyEval_Vector /srv/zulip/anders/cpython/Python/ceval.c:6439:24
#34 0x55fd433379fb in _PyFunction_Vectorcall /srv/zulip/anders/cpython/Objects/call.c
#35 0x55fd43333966 in _PyObject_FastCallDictTstate /srv/zulip/anders/cpython/Objects/call.c:141:15
#36 0x55fd43338483 in _PyObject_Call_Prepend /srv/zulip/anders/cpython/Objects/call.c:482:24
#37 0x55fd435afad0 in slot_tp_init /srv/zulip/anders/cpython/Objects/typeobject.c:7863:15
#38 0x55fd4355cce0 in type_call /srv/zulip/anders/cpython/Objects/typeobject.c:1112:19
#39 0x55fd43334063 in _PyObject_MakeTpCall /srv/zulip/anders/cpython/Objects/call.c:214:18
#40 0x55fd43336d3a in _PyObject_VectorcallTstate /srv/zulip/anders/cpython/./Include/internal/pycore_call.h:90:16
#41 0x55fd43336c2e in PyObject_Vectorcall /srv/zulip/anders/cpython/Objects/call.c:299:12
#42 0x55fd437e1005 in _PyEval_EvalFrameDefault /srv/zulip/anders/cpython/Python/ceval.c
#43 0x55fd437b8af6 in _PyEval_EvalFrame /srv/zulip/anders/cpython/./Include/internal/pycore_ceval.h:73:16
#44 0x55fd437b83f1 in _PyEval_Vector /srv/zulip/anders/cpython/Python/ceval.c:6439:24
#45 0x55fd433379fb in _PyFunction_Vectorcall /srv/zulip/anders/cpython/Objects/call.c
#46 0x55fd43342c6e in _PyObject_VectorcallTstate /srv/zulip/anders/cpython/./Include/internal/pycore_call.h:92:11
#47 0x55fd4333f514 in method_vectorcall /srv/zulip/anders/cpython/Objects/classobject.c:59:18
#48 0x55fd43336802 in _PyVectorcall_Call /srv/zulip/anders/cpython/Objects/call.c:257:24
#49 0x55fd433370b5 in _PyObject_Call /srv/zulip/anders/cpython/Objects/call.c:328:16
#50 0x55fd4333765b in PyObject_Call /srv/zulip/anders/cpython/Objects/call.c:355:12
#51 0x55fd437e68c3 in do_call_core /srv/zulip/anders/cpython/Python/ceval.c
#52 0x55fd437e68c3 in _PyEval_EvalFrameDefault /srv/zulip/anders/cpython/Python/ceval.c:5381:22
#53 0x55fd437b8af6 in _PyEval_EvalFrame /srv/zulip/anders/cpython/./Include/internal/pycore_ceval.h:73:16
#54 0x55fd437b83f1 in _PyEval_Vector /srv/zulip/anders/cpython/Python/ceval.c:6439:24
#55 0x55fd433379fb in _PyFunction_Vectorcall /srv/zulip/anders/cpython/Objects/call.c
#56 0x55fd43342c6e in _PyObject_VectorcallTstate /srv/zulip/anders/cpython/./Include/internal/pycore_call.h:92:11
#57 0x55fd4333f514 in method_vectorcall /srv/zulip/anders/cpython/Objects/classobject.c:59:18
#58 0x55fd43336802 in _PyVectorcall_Call /srv/zulip/anders/cpython/Objects/call.c:257:24
#59 0x55fd433370b5 in _PyObject_Call /srv/zulip/anders/cpython/Objects/call.c:328:16
#60 0x55fd4333765b in PyObject_Call /srv/zulip/anders/cpython/Objects/call.c:355:12
#61 0x55fd437e68c3 in do_call_core /srv/zulip/anders/cpython/Python/ceval.c
#62 0x55fd437e68c3 in _PyEval_EvalFrameDefault /srv/zulip/anders/cpython/Python/ceval.c:5381:22
#63 0x55fd437b8af6 in _PyEval_EvalFrame /srv/zulip/anders/cpython/./Include/internal/pycore_ceval.h:73:16
#64 0x55fd437b83f1 in _PyEval_Vector /srv/zulip/anders/cpython/Python/ceval.c:6439:24
#65 0x55fd433379fb in _PyFunction_Vectorcall /srv/zulip/anders/cpython/Objects/call.c
#66 0x55fd433377d4 in _PyObject_VectorcallTstate /srv/zulip/anders/cpython/./Include/internal/pycore_call.h:92:11
#67 0x55fd433377d4 in PyObject_CallOneArg /srv/zulip/anders/cpython/Objects/call.c:376:12
#68 0x55fd433768f5 in property_descr_get /srv/zulip/anders/cpython/Objects/descrobject.c:1630:12
#69 0x55fd434f6db1 in _PyObject_GenericGetAttrWithDict /srv/zulip/anders/cpython/Objects/object.c:1278:19
#70 0x55fd434f6a3c in PyObject_GenericGetAttr /srv/zulip/anders/cpython/Objects/object.c:1368:12
#71 0x55fd434f511c in PyObject_GetAttr /srv/zulip/anders/cpython/Objects/object.c:916:18
#72 0x55fd437dae27 in _PyEval_EvalFrameDefault /srv/zulip/anders/cpython/Python/ceval.c:3466:29
#73 0x55fd437b8af6 in _PyEval_EvalFrame /srv/zulip/anders/cpython/./Include/internal/pycore_ceval.h:73:16
#74 0x55fd437b83f1 in _PyEval_Vector /srv/zulip/anders/cpython/Python/ceval.c:6439:24
#75 0x55fd433379fb in _PyFunction_Vectorcall /srv/zulip/anders/cpython/Objects/call.c
#76 0x55fd4357a005 in _PyObject_VectorcallTstate /srv/zulip/anders/cpython/./Include/internal/pycore_call.h:92:11
#77 0x55fd435c53ec in vectorcall_unbound /srv/zulip/anders/cpython/Objects/typeobject.c:1650:12
#78 0x55fd435c53ec in vectorcall_method /srv/zulip/anders/cpython/Objects/typeobject.c:1681:24
#79 0x55fd435c3663 in slot_mp_subscript /srv/zulip/anders/cpython/Objects/typeobject.c:7404:1
#80 0x55fd432b37d7 in PyObject_GetItem /srv/zulip/anders/cpython/Objects/abstract.c:157:26
#81 0x55fd437da9d9 in _PyEval_EvalFrameDefault /srv/zulip/anders/cpython/Python/ceval.c:2137:29
#82 0x55fd437b8af6 in _PyEval_EvalFrame /srv/zulip/anders/cpython/./Include/internal/pycore_ceval.h:73:16
#83 0x55fd437b83f1 in _PyEval_Vector /srv/zulip/anders/cpython/Python/ceval.c:6439:24
#84 0x55fd433379fb in _PyFunction_Vectorcall /srv/zulip/anders/cpython/Objects/call.c
#85 0x55fd43342c6e in _PyObject_VectorcallTstate /srv/zulip/anders/cpython/./Include/internal/pycore_call.h:92:11
#86 0x55fd4333f514 in method_vectorcall /srv/zulip/anders/cpython/Objects/classobject.c:59:18
#87 0x55fd433377d4 in _PyObject_VectorcallTstate /srv/zulip/anders/cpython/./Include/internal/pycore_call.h:92:11
#88 0x55fd433377d4 in PyObject_CallOneArg /srv/zulip/anders/cpython/Objects/call.c:376:12
#89 0x55fd435c571a in call_attribute /srv/zulip/anders/cpython/Objects/typeobject.c:7673:11
#90 0x55fd435ad7fc in slot_tp_getattr_hook /srv/zulip/anders/cpython/Objects/typeobject.c:7714:15
#91 0x55fd434f511c in PyObject_GetAttr /srv/zulip/anders/cpython/Objects/object.c:916:18
#92 0x55fd437dae27 in _PyEval_EvalFrameDefault /srv/zulip/anders/cpython/Python/ceval.c:3466:29
#93 0x55fd437b8af6 in _PyEval_EvalFrame /srv/zulip/anders/cpython/./Include/internal/pycore_ceval.h:73:16
#94 0x55fd437b83f1 in _PyEval_Vector /srv/zulip/anders/cpython/Python/ceval.c:6439:24
#95 0x55fd433379fb in _PyFunction_Vectorcall /srv/zulip/anders/cpython/Objects/call.c
#96 0x55fd433368db in _PyVectorcall_Call /srv/zulip/anders/cpython/Objects/call.c:245:16
#97 0x55fd433370b5 in _PyObject_Call /srv/zulip/anders/cpython/Objects/call.c:328:16
#98 0x55fd4333765b in PyObject_Call /srv/zulip/anders/cpython/Objects/call.c:355:12
#99 0x55fd437e68c3 in do_call_core /srv/zulip/anders/cpython/Python/ceval.c
#100 0x55fd437e68c3 in _PyEval_EvalFrameDefault /srv/zulip/anders/cpython/Python/ceval.c:5381:22
#101 0x55fd437b8af6 in _PyEval_EvalFrame /srv/zulip/anders/cpython/./Include/internal/pycore_ceval.h:73:16
#102 0x55fd437b83f1 in _PyEval_Vector /srv/zulip/anders/cpython/Python/ceval.c:6439:24
#103 0x55fd433379fb in _PyFunction_Vectorcall /srv/zulip/anders/cpython/Objects/call.c
#104 0x55fd433368db in _PyVectorcall_Call /srv/zulip/anders/cpython/Objects/call.c:245:16
#105 0x55fd433370b5 in _PyObject_Call /srv/zulip/anders/cpython/Objects/call.c:328:16
#106 0x55fd4333765b in PyObject_Call /srv/zulip/anders/cpython/Objects/call.c:355:12
#107 0x55fd437e68c3 in do_call_core /srv/zulip/anders/cpython/Python/ceval.c
#108 0x55fd437e68c3 in _PyEval_EvalFrameDefault /srv/zulip/anders/cpython/Python/ceval.c:5381:22
#109 0x55fd437b8af6 in _PyEval_EvalFrame /srv/zulip/anders/cpython/./Include/internal/pycore_ceval.h:73:16
#110 0x55fd437b83f1 in _PyEval_Vector /srv/zulip/anders/cpython/Python/ceval.c:6439:24
#111 0x55fd433379fb in _PyFunction_Vectorcall /srv/zulip/anders/cpython/Objects/call.c
#112 0x55fd433368db in _PyVectorcall_Call /srv/zulip/anders/cpython/Objects/call.c:245:16
#113 0x55fd433370b5 in _PyObject_Call /srv/zulip/anders/cpython/Objects/call.c:328:16
#114 0x55fd4333765b in PyObject_Call /srv/zulip/anders/cpython/Objects/call.c:355:12
#115 0x55fd437e68c3 in do_call_core /srv/zulip/anders/cpython/Python/ceval.c
#116 0x55fd437e68c3 in _PyEval_EvalFrameDefault /srv/zulip/anders/cpython/Python/ceval.c:5381:22
#117 0x55fd437b8af6 in _PyEval_EvalFrame /srv/zulip/anders/cpython/./Include/internal/pycore_ceval.h:73:16
#118 0x55fd437b83f1 in _PyEval_Vector /srv/zulip/anders/cpython/Python/ceval.c:6439:24
#119 0x55fd433379fb in _PyFunction_Vectorcall /srv/zulip/anders/cpython/Objects/call.c
#120 0x55fd433368db in _PyVectorcall_Call /srv/zulip/anders/cpython/Objects/call.c:245:16
#121 0x55fd433370b5 in _PyObject_Call /srv/zulip/anders/cpython/Objects/call.c:328:16
#122 0x55fd4333765b in PyObject_Call /srv/zulip/anders/cpython/Objects/call.c:355:12
#123 0x55fd437e68c3 in do_call_core /srv/zulip/anders/cpython/Python/ceval.c
#124 0x55fd437e68c3 in _PyEval_EvalFrameDefault /srv/zulip/anders/cpython/Python/ceval.c:5381:22
#125 0x55fd437b8af6 in _PyEval_EvalFrame /srv/zulip/anders/cpython/./Include/internal/pycore_ceval.h:73:16
#126 0x55fd437b83f1 in _PyEval_Vector /srv/zulip/anders/cpython/Python/ceval.c:6439:24
#127 0x55fd433379fb in _PyFunction_Vectorcall /srv/zulip/anders/cpython/Objects/call.c
#128 0x55fd433368db in _PyVectorcall_Call /srv/zulip/anders/cpython/Objects/call.c:245:16
#129 0x55fd433370b5 in _PyObject_Call /srv/zulip/anders/cpython/Objects/call.c:328:16
#130 0x55fd4333765b in PyObject_Call /srv/zulip/anders/cpython/Objects/call.c:355:12
#131 0x55fd437e68c3 in do_call_core /srv/zulip/anders/cpython/Python/ceval.c
#132 0x55fd437e68c3 in _PyEval_EvalFrameDefault /srv/zulip/anders/cpython/Python/ceval.c:5381:22
#133 0x55fd437b8af6 in _PyEval_EvalFrame /srv/zulip/anders/cpython/./Include/internal/pycore_ceval.h:73:16
#134 0x55fd437b83f1 in _PyEval_Vector /srv/zulip/anders/cpython/Python/ceval.c:6439:24
#135 0x55fd433379fb in _PyFunction_Vectorcall /srv/zulip/anders/cpython/Objects/call.c
#136 0x55fd433368db in _PyVectorcall_Call /srv/zulip/anders/cpython/Objects/call.c:245:16
#137 0x55fd433370b5 in _PyObject_Call /srv/zulip/anders/cpython/Objects/call.c:328:16
#138 0x55fd4333765b in PyObject_Call /srv/zulip/anders/cpython/Objects/call.c:355:12
#139 0x55fd437e68c3 in do_call_core /srv/zulip/anders/cpython/Python/ceval.c
#140 0x55fd437e68c3 in _PyEval_EvalFrameDefault /srv/zulip/anders/cpython/Python/ceval.c:5381:22
#141 0x55fd437b8af6 in _PyEval_EvalFrame /srv/zulip/anders/cpython/./Include/internal/pycore_ceval.h:73:16
#142 0x55fd437b83f1 in _PyEval_Vector /srv/zulip/anders/cpython/Python/ceval.c:6439:24
#143 0x55fd433379fb in _PyFunction_Vectorcall /srv/zulip/anders/cpython/Objects/call.c
#144 0x55fd433368db in _PyVectorcall_Call /srv/zulip/anders/cpython/Objects/call.c:245:16
#145 0x55fd433370b5 in _PyObject_Call /srv/zulip/anders/cpython/Objects/call.c:328:16
#146 0x55fd4333765b in PyObject_Call /srv/zulip/anders/cpython/Objects/call.c:355:12
#147 0x55fd437e68c3 in do_call_core /srv/zulip/anders/cpython/Python/ceval.c
#148 0x55fd437e68c3 in _PyEval_EvalFrameDefault /srv/zulip/anders/cpython/Python/ceval.c:5381:22
#149 0x55fd437b8af6 in _PyEval_EvalFrame /srv/zulip/anders/cpython/./Include/internal/pycore_ceval.h:73:16
#150 0x55fd437b83f1 in _PyEval_Vector /srv/zulip/anders/cpython/Python/ceval.c:6439:24
#151 0x55fd433379fb in _PyFunction_Vectorcall /srv/zulip/anders/cpython/Objects/call.c
#152 0x55fd433368db in _PyVectorcall_Call /srv/zulip/anders/cpython/Objects/call.c:245:16
#153 0x55fd433370b5 in _PyObject_Call /srv/zulip/anders/cpython/Objects/call.c:328:16
#154 0x55fd4333765b in PyObject_Call /srv/zulip/anders/cpython/Objects/call.c:355:12
#155 0x55fd437e68c3 in do_call_core /srv/zulip/anders/cpython/Python/ceval.c
#156 0x55fd437e68c3 in _PyEval_EvalFrameDefault /srv/zulip/anders/cpython/Python/ceval.c:5381:22
#157 0x55fd437b8af6 in _PyEval_EvalFrame /srv/zulip/anders/cpython/./Include/internal/pycore_ceval.h:73:16
#158 0x55fd437b83f1 in _PyEval_Vector /srv/zulip/anders/cpython/Python/ceval.c:6439:24
#159 0x55fd433379fb in _PyFunction_Vectorcall /srv/zulip/anders/cpython/Objects/call.c
#160 0x55fd43333966 in _PyObject_FastCallDictTstate /srv/zulip/anders/cpython/Objects/call.c:141:15
#161 0x55fd43338483 in _PyObject_Call_Prepend /srv/zulip/anders/cpython/Objects/call.c:482:24
#162 0x55fd435ad2f1 in slot_tp_call /srv/zulip/anders/cpython/Objects/typeobject.c:7632:15
#163 0x55fd43334063 in _PyObject_MakeTpCall /srv/zulip/anders/cpython/Objects/call.c:214:18
#164 0x55fd43336d3a in _PyObject_VectorcallTstate /srv/zulip/anders/cpython/./Include/internal/pycore_call.h:90:16
#165 0x55fd43336c2e in PyObject_Vectorcall /srv/zulip/anders/cpython/Objects/call.c:299:12
#166 0x55fd437e1005 in _PyEval_EvalFrameDefault /srv/zulip/anders/cpython/Python/ceval.c
#167 0x55fd437b8af6 in _PyEval_EvalFrame /srv/zulip/anders/cpython/./Include/internal/pycore_ceval.h:73:16
#168 0x55fd437b83f1 in _PyEval_Vector /srv/zulip/anders/cpython/Python/ceval.c:6439:24
#169 0x55fd433379fb in _PyFunction_Vectorcall /srv/zulip/anders/cpython/Objects/call.c
#170 0x55fd43333966 in _PyObject_FastCallDictTstate /srv/zulip/anders/cpython/Objects/call.c:141:15
#171 0x55fd43338483 in _PyObject_Call_Prepend /srv/zulip/anders/cpython/Objects/call.c:482:24
#172 0x55fd435ad2f1 in slot_tp_call /srv/zulip/anders/cpython/Objects/typeobject.c:7632:15
#173 0x55fd43334063 in _PyObject_MakeTpCall /srv/zulip/anders/cpython/Objects/call.c:214:18
#174 0x55fd43336d3a in _PyObject_VectorcallTstate /srv/zulip/anders/cpython/./Include/internal/pycore_call.h:90:16
#175 0x55fd43336c2e in PyObject_Vectorcall /srv/zulip/anders/cpython/Objects/call.c:299:12
#176 0x55fd437e1005 in _PyEval_EvalFrameDefault /srv/zulip/anders/cpython/Python/ceval.c
#177 0x55fd437b8af6 in _PyEval_EvalFrame /srv/zulip/anders/cpython/./Include/internal/pycore_ceval.h:73:16
#178 0x55fd437b83f1 in _PyEval_Vector /srv/zulip/anders/cpython/Python/ceval.c:6439:24
#179 0x55fd433379fb in _PyFunction_Vectorcall /srv/zulip/anders/cpython/Objects/call.c
#180 0x55fd43333966 in _PyObject_FastCallDictTstate /srv/zulip/anders/cpython/Objects/call.c:141:15
#181 0x55fd43338483 in _PyObject_Call_Prepend /srv/zulip/anders/cpython/Objects/call.c:482:24
#182 0x55fd435ad2f1 in slot_tp_call /srv/zulip/anders/cpython/Objects/typeobject.c:7632:15
#183 0x55fd43334063 in _PyObject_MakeTpCall /srv/zulip/anders/cpython/Objects/call.c:214:18
#184 0x55fd43336d3a in _PyObject_VectorcallTstate /srv/zulip/anders/cpython/./Include/internal/pycore_call.h:90:16
#185 0x55fd43336c2e in PyObject_Vectorcall /srv/zulip/anders/cpython/Objects/call.c:299:12
#186 0x55fd437e1005 in _PyEval_EvalFrameDefault /srv/zulip/anders/cpython/Python/ceval.c
#187 0x55fd437b8af6 in _PyEval_EvalFrame /srv/zulip/anders/cpython/./Include/internal/pycore_ceval.h:73:16
#188 0x55fd437b83f1 in _PyEval_Vector /srv/zulip/anders/cpython/Python/ceval.c:6439:24
#189 0x55fd433379fb in _PyFunction_Vectorcall /srv/zulip/anders/cpython/Objects/call.c
#190 0x55fd43333966 in _PyObject_FastCallDictTstate /srv/zulip/anders/cpython/Objects/call.c:141:15
#191 0x55fd43338483 in _PyObject_Call_Prepend /srv/zulip/anders/cpython/Objects/call.c:482:24
#192 0x55fd435ad2f1 in slot_tp_call /srv/zulip/anders/cpython/Objects/typeobject.c:7632:15
#193 0x55fd43334063 in _PyObject_MakeTpCall /srv/zulip/anders/cpython/Objects/call.c:214:18
#194 0x55fd43336d3a in _PyObject_VectorcallTstate /srv/zulip/anders/cpython/./Include/internal/pycore_call.h:90:16
#195 0x55fd43336c2e in PyObject_Vectorcall /srv/zulip/anders/cpython/Objects/call.c:299:12
#196 0x55fd437e1005 in _PyEval_EvalFrameDefault /srv/zulip/anders/cpython/Python/ceval.c
#197 0x55fd437b8af6 in _PyEval_EvalFrame /srv/zulip/anders/cpython/./Include/internal/pycore_ceval.h:73:16
#198 0x55fd437b83f1 in _PyEval_Vector /srv/zulip/anders/cpython/Python/ceval.c:6439:24
#199 0x55fd433379fb in _PyFunction_Vectorcall /srv/zulip/anders/cpython/Objects/call.c
#200 0x55fd43333966 in _PyObject_FastCallDictTstate /srv/zulip/anders/cpython/Objects/call.c:141:15
#201 0x55fd43338483 in _PyObject_Call_Prepend /srv/zulip/anders/cpython/Objects/call.c:482:24
#202 0x55fd435ad2f1 in slot_tp_call /srv/zulip/anders/cpython/Objects/typeobject.c:7632:15
#203 0x55fd43334063 in _PyObject_MakeTpCall /srv/zulip/anders/cpython/Objects/call.c:214:18
#204 0x55fd43336d3a in _PyObject_VectorcallTstate /srv/zulip/anders/cpython/./Include/internal/pycore_call.h:90:16
#205 0x55fd43336c2e in PyObject_Vectorcall /srv/zulip/anders/cpython/Objects/call.c:299:12
#206 0x55fd437e1005 in _PyEval_EvalFrameDefault /srv/zulip/anders/cpython/Python/ceval.c
#207 0x55fd437b8af6 in _PyEval_EvalFrame /srv/zulip/anders/cpython/./Include/internal/pycore_ceval.h:73:16
#208 0x55fd437b83f1 in _PyEval_Vector /srv/zulip/anders/cpython/Python/ceval.c:6439:24
#209 0x55fd433379fb in _PyFunction_Vectorcall /srv/zulip/anders/cpython/Objects/call.c
#210 0x55fd43333966 in _PyObject_FastCallDictTstate /srv/zulip/anders/cpython/Objects/call.c:141:15
#211 0x55fd43338483 in _PyObject_Call_Prepend /srv/zulip/anders/cpython/Objects/call.c:482:24
#212 0x55fd435ad2f1 in slot_tp_call /srv/zulip/anders/cpython/Objects/typeobject.c:7632:15
#213 0x55fd43334063 in _PyObject_MakeTpCall /srv/zulip/anders/cpython/Objects/call.c:214:18
#214 0x55fd43336d3a in _PyObject_VectorcallTstate /srv/zulip/anders/cpython/./Include/internal/pycore_call.h:90:16
#215 0x55fd43336c2e in PyObject_Vectorcall /srv/zulip/anders/cpython/Objects/call.c:299:12
#216 0x55fd437e1005 in _PyEval_EvalFrameDefault /srv/zulip/anders/cpython/Python/ceval.c
#217 0x55fd437b8af6 in _PyEval_EvalFrame /srv/zulip/anders/cpython/./Include/internal/pycore_ceval.h:73:16
#218 0x55fd437b83f1 in _PyEval_Vector /srv/zulip/anders/cpython/Python/ceval.c:6439:24
#219 0x55fd433379fb in _PyFunction_Vectorcall /srv/zulip/anders/cpython/Objects/call.c
#220 0x55fd43333966 in _PyObject_FastCallDictTstate /srv/zulip/anders/cpython/Objects/call.c:141:15
#221 0x55fd43338483 in _PyObject_Call_Prepend /srv/zulip/anders/cpython/Objects/call.c:482:24
#222 0x55fd435ad2f1 in slot_tp_call /srv/zulip/anders/cpython/Objects/typeobject.c:7632:15
#223 0x55fd43334063 in _PyObject_MakeTpCall /srv/zulip/anders/cpython/Objects/call.c:214:18
#224 0x55fd43336d3a in _PyObject_VectorcallTstate /srv/zulip/anders/cpython/./Include/internal/pycore_call.h:90:16
#225 0x55fd43336c2e in PyObject_Vectorcall /srv/zulip/anders/cpython/Objects/call.c:299:12
#226 0x55fd437e1005 in _PyEval_EvalFrameDefault /srv/zulip/anders/cpython/Python/ceval.c
#227 0x55fd437b8af6 in _PyEval_EvalFrame /srv/zulip/anders/cpython/./Include/internal/pycore_ceval.h:73:16
#228 0x55fd437b83f1 in _PyEval_Vector /srv/zulip/anders/cpython/Python/ceval.c:6439:24
#229 0x55fd433379fb in _PyFunction_Vectorcall /srv/zulip/anders/cpython/Objects/call.c
#230 0x55fd43333966 in _PyObject_FastCallDictTstate /srv/zulip/anders/cpython/Objects/call.c:141:15
#231 0x55fd43338483 in _PyObject_Call_Prepend /srv/zulip/anders/cpython/Objects/call.c:482:24
#232 0x55fd435ad2f1 in slot_tp_call /srv/zulip/anders/cpython/Objects/typeobject.c:7632:15
#233 0x55fd43334063 in _PyObject_MakeTpCall /srv/zulip/anders/cpython/Objects/call.c:214:18
#234 0x55fd43336d3a in _PyObject_VectorcallTstate /srv/zulip/anders/cpython/./Include/internal/pycore_call.h:90:16
#235 0x55fd43336c2e in PyObject_Vectorcall /srv/zulip/anders/cpython/Objects/call.c:299:12
#236 0x55fd437e1005 in _PyEval_EvalFrameDefault /srv/zulip/anders/cpython/Python/ceval.c
#237 0x55fd437b8af6 in _PyEval_EvalFrame /srv/zulip/anders/cpython/./Include/internal/pycore_ceval.h:73:16
#238 0x55fd437b83f1 in _PyEval_Vector /srv/zulip/anders/cpython/Python/ceval.c:6439:24
#239 0x55fd433379fb in _PyFunction_Vectorcall /srv/zulip/anders/cpython/Objects/call.c
#240 0x55fd43333966 in _PyObject_FastCallDictTstate /srv/zulip/anders/cpython/Objects/call.c:141:15
#241 0x55fd43338483 in _PyObject_Call_Prepend /srv/zulip/anders/cpython/Objects/call.c:482:24
#242 0x55fd435ad2f1 in slot_tp_call /srv/zulip/anders/cpython/Objects/typeobject.c:7632:15
#243 0x55fd43334063 in _PyObject_MakeTpCall /srv/zulip/anders/cpython/Objects/call.c:214:18
#244 0x55fd43336d3a in _PyObject_VectorcallTstate /srv/zulip/anders/cpython/./Include/internal/pycore_call.h:90:16
#245 0x55fd43336c2e in PyObject_Vectorcall /srv/zulip/anders/cpython/Objects/call.c:299:12
#246 0x55fd437e1005 in _PyEval_EvalFrameDefault /srv/zulip/anders/cpython/Python/ceval.c
#247 0x55fd437b8af6 in _PyEval_EvalFrame /srv/zulip/anders/cpython/./Include/internal/pycore_ceval.h:73:16
#248 0x55fd437b83f1 in _PyEval_Vector /srv/zulip/anders/cpython/Python/ceval.c:6439:24
#249 0x55fd433379fb in _PyFunction_Vectorcall /srv/zulip/anders/cpython/Objects/call.c
#250 0x55fd43333966 in _PyObject_FastCallDictTstate /srv/zulip/anders/cpython/Objects/call.c:141:15
#251 0x55fd43338483 in _PyObject_Call_Prepend /srv/zulip/anders/cpython/Objects/call.c:482:24
#252 0x55fd435ad2f1 in slot_tp_call /srv/zulip/anders/cpython/Objects/typeobject.c:7632:15
#253 0x55fd43334063 in _PyObject_MakeTpCall /srv/zulip/anders/cpython/Objects/call.c:214:18
#254 0x55fd43336d3a in _PyObject_VectorcallTstate /srv/zulip/anders/cpython/./Include/internal/pycore_call.h:90:16
#255 0x55fd43336c2e in PyObject_Vectorcall /srv/zulip/anders/cpython/Objects/call.c:299:12
#256 0x55fd437e1005 in _PyEval_EvalFrameDefault /srv/zulip/anders/cpython/Python/ceval.c
#257 0x55fd437b8af6 in _PyEval_EvalFrame /srv/zulip/anders/cpython/./Include/internal/pycore_ceval.h:73:16
#258 0x55fd437b83f1 in _PyEval_Vector /srv/zulip/anders/cpython/Python/ceval.c:6439:24
#259 0x55fd433379fb in _PyFunction_Vectorcall /srv/zulip/anders/cpython/Objects/call.c
#260 0x55fd43333966 in _PyObject_FastCallDictTstate /srv/zulip/anders/cpython/Objects/call.c:141:15
#261 0x55fd43338483 in _PyObject_Call_Prepend /srv/zulip/anders/cpython/Objects/call.c:482:24
#262 0x55fd435ad2f1 in slot_tp_call /srv/zulip/anders/cpython/Objects/typeobject.c:7632:15
#263 0x55fd43334063 in _PyObject_MakeTpCall /srv/zulip/anders/cpython/Objects/call.c:214:18
#264 0x55fd43336d3a in _PyObject_VectorcallTstate /srv/zulip/anders/cpython/./Include/internal/pycore_call.h:90:16
0x62900558c25d is located 93 bytes inside of 16384-byte region [0x62900558c200,0x629005590200)
freed by thread T0 here:
#0 0x55fd42f60bc2 in free (/srv/zulip/anders/cpython/python+0xa0dbc2) (BuildId: 2805b43d8a9ad47b1cbf8f8d1e83c8be78721c21)
#1 0x55fd435005fb in _PyObject_ArenaFree /srv/zulip/anders/cpython/Objects/obmalloc.c:176:5
#2 0x55fd434ffa86 in _PyObject_VirtualFree /srv/zulip/anders/cpython/Objects/obmalloc.c:566:5
#3 0x55fd439a6efc in _PyThreadState_PopFrame /srv/zulip/anders/cpython/Python/pystate.c:2229:9
#4 0x55fd43829cbc in _PyEvalFrameClearAndPop /srv/zulip/anders/cpython/Python/ceval.c:6413:5
#5 0x55fd437b84f9 in _PyEval_Vector /srv/zulip/anders/cpython/Python/ceval.c:6444:5
#6 0x55fd433379fb in _PyFunction_Vectorcall /srv/zulip/anders/cpython/Objects/call.c
#7 0x55fd43342c6e in _PyObject_VectorcallTstate /srv/zulip/anders/cpython/./Include/internal/pycore_call.h:92:11
#8 0x55fd4333f839 in method_vectorcall /srv/zulip/anders/cpython/Objects/classobject.c:67:20
#9 0x55fd433368db in _PyVectorcall_Call /srv/zulip/anders/cpython/Objects/call.c:245:16
#10 0x55fd433370b5 in _PyObject_Call /srv/zulip/anders/cpython/Objects/call.c:328:16
#11 0x55fd4333765b in PyObject_Call /srv/zulip/anders/cpython/Objects/call.c:355:12
#12 0x55fd437e68c3 in do_call_core /srv/zulip/anders/cpython/Python/ceval.c
#13 0x55fd437e68c3 in _PyEval_EvalFrameDefault /srv/zulip/anders/cpython/Python/ceval.c:5381:22
#14 0x55fd437b8af6 in _PyEval_EvalFrame /srv/zulip/anders/cpython/./Include/internal/pycore_ceval.h:73:16
#15 0x55fd437b83f1 in _PyEval_Vector /srv/zulip/anders/cpython/Python/ceval.c:6439:24
#16 0x55fd433379fb in _PyFunction_Vectorcall /srv/zulip/anders/cpython/Objects/call.c
#17 0x55fd43333966 in _PyObject_FastCallDictTstate /srv/zulip/anders/cpython/Objects/call.c:141:15
#18 0x55fd43338483 in _PyObject_Call_Prepend /srv/zulip/anders/cpython/Objects/call.c:482:24
#19 0x55fd435ad2f1 in slot_tp_call /srv/zulip/anders/cpython/Objects/typeobject.c:7632:15
#20 0x55fd43334063 in _PyObject_MakeTpCall /srv/zulip/anders/cpython/Objects/call.c:214:18
#21 0x55fd433377ff in _PyObject_VectorcallTstate /srv/zulip/anders/cpython/./Include/internal/pycore_call.h:90:16
#22 0x55fd433377ff in PyObject_CallOneArg /srv/zulip/anders/cpython/Objects/call.c:376:12
#23 0x55fd436bf2b3 in handle_callback /srv/zulip/anders/cpython/Objects/weakrefobject.c:928:26
#24 0x55fd436be4cc in PyObject_ClearWeakRefs /srv/zulip/anders/cpython/Objects/weakrefobject.c:974:21
#25 0x55fd43c380ee in partial_dealloc /srv/zulip/anders/cpython/./Modules/_functoolsmodule.c:179:9
#26 0x55fd434fd7de in _Py_Dealloc /srv/zulip/anders/cpython/Objects/object.c:2390:5
#27 0x55fd433e0972 in Py_DECREF /srv/zulip/anders/cpython/./Include/object.h:527:9
#28 0x55fd433dc796 in frame_dealloc /srv/zulip/anders/cpython/Objects/frameobject.c:875:13
#29 0x55fd434fd7de in _Py_Dealloc /srv/zulip/anders/cpython/Objects/object.c:2390:5
#30 0x55fd433e0972 in Py_DECREF /srv/zulip/anders/cpython/./Include/object.h:527:9
#31 0x55fd433dc950 in frame_dealloc /srv/zulip/anders/cpython/Objects/frameobject.c:878:5
previously allocated by thread T0 here:
#0 0x55fd42f60e6e in __interceptor_malloc (/srv/zulip/anders/cpython/python+0xa0de6e) (BuildId: 2805b43d8a9ad47b1cbf8f8d1e83c8be78721c21)
#1 0x55fd435005eb in _PyObject_ArenaMalloc /srv/zulip/anders/cpython/Objects/obmalloc.c:170:12
#2 0x55fd434ffa63 in _PyObject_VirtualAlloc /srv/zulip/anders/cpython/Objects/obmalloc.c:560:12
#3 0x55fd439a5f54 in allocate_chunk /srv/zulip/anders/cpython/Python/pystate.c:731:26
#4 0x55fd439a5f54 in push_chunk /srv/zulip/anders/cpython/Python/pystate.c:2184:26
#5 0x55fd439a5f54 in _PyThreadState_BumpFramePointerSlow /srv/zulip/anders/cpython/Python/pystate.c:2214:35
#6 0x55fd4382819a in _PyThreadState_BumpFramePointer /srv/zulip/anders/cpython/./Include/internal/pycore_frame.h:218:12
#7 0x55fd4382d907 in _PyEvalFramePushAndInit /srv/zulip/anders/cpython/Python/ceval.c:6371:34
#8 0x55fd437b83d8 in _PyEval_Vector /srv/zulip/anders/cpython/Python/ceval.c:6434:34
#9 0x55fd433379fb in _PyFunction_Vectorcall /srv/zulip/anders/cpython/Objects/call.c
#10 0x55fd43342c6e in _PyObject_VectorcallTstate /srv/zulip/anders/cpython/./Include/internal/pycore_call.h:92:11
#11 0x55fd4333f839 in method_vectorcall /srv/zulip/anders/cpython/Objects/classobject.c:67:20
#12 0x55fd433368db in _PyVectorcall_Call /srv/zulip/anders/cpython/Objects/call.c:245:16
#13 0x55fd433370b5 in _PyObject_Call /srv/zulip/anders/cpython/Objects/call.c:328:16
#14 0x55fd4333765b in PyObject_Call /srv/zulip/anders/cpython/Objects/call.c:355:12
#15 0x55fd437e68c3 in do_call_core /srv/zulip/anders/cpython/Python/ceval.c
#16 0x55fd437e68c3 in _PyEval_EvalFrameDefault /srv/zulip/anders/cpython/Python/ceval.c:5381:22
#17 0x55fd437b8af6 in _PyEval_EvalFrame /srv/zulip/anders/cpython/./Include/internal/pycore_ceval.h:73:16
#18 0x55fd437b83f1 in _PyEval_Vector /srv/zulip/anders/cpython/Python/ceval.c:6439:24
#19 0x55fd433379fb in _PyFunction_Vectorcall /srv/zulip/anders/cpython/Objects/call.c
#20 0x55fd43333966 in _PyObject_FastCallDictTstate /srv/zulip/anders/cpython/Objects/call.c:141:15
#21 0x55fd43338483 in _PyObject_Call_Prepend /srv/zulip/anders/cpython/Objects/call.c:482:24
#22 0x55fd435ad2f1 in slot_tp_call /srv/zulip/anders/cpython/Objects/typeobject.c:7632:15
#23 0x55fd43334063 in _PyObject_MakeTpCall /srv/zulip/anders/cpython/Objects/call.c:214:18
#24 0x55fd433377ff in _PyObject_VectorcallTstate /srv/zulip/anders/cpython/./Include/internal/pycore_call.h:90:16
#25 0x55fd433377ff in PyObject_CallOneArg /srv/zulip/anders/cpython/Objects/call.c:376:12
#26 0x55fd436bf2b3 in handle_callback /srv/zulip/anders/cpython/Objects/weakrefobject.c:928:26
#27 0x55fd436be4cc in PyObject_ClearWeakRefs /srv/zulip/anders/cpython/Objects/weakrefobject.c:974:21
#28 0x55fd43c380ee in partial_dealloc /srv/zulip/anders/cpython/./Modules/_functoolsmodule.c:179:9
#29 0x55fd434fd7de in _Py_Dealloc /srv/zulip/anders/cpython/Objects/object.c:2390:5
#30 0x55fd433e0972 in Py_DECREF /srv/zulip/anders/cpython/./Include/object.h:527:9
#31 0x55fd433dc796 in frame_dealloc /srv/zulip/anders/cpython/Objects/frameobject.c:875:13
#32 0x55fd434fd7de in _Py_Dealloc /srv/zulip/anders/cpython/Objects/object.c:2390:5
#33 0x55fd433e0972 in Py_DECREF /srv/zulip/anders/cpython/./Include/object.h:527:9
SUMMARY: AddressSanitizer: heap-use-after-free /srv/zulip/anders/cpython/Objects/frameobject.c:854:5 in frame_dealloc
Shadow bytes around the buggy address:
0x0c5280aa97f0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c5280aa9800: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c5280aa9810: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c5280aa9820: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c5280aa9830: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
=>0x0c5280aa9840: fd fd fd fd fd fd fd fd fd fd fd[fd]fd fd fd fd
0x0c5280aa9850: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c5280aa9860: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c5280aa9870: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c5280aa9880: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c5280aa9890: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
Left alloca redzone: ca
Right alloca redzone: cb
==4327==ABORTING
```
</details>
# Your environment
- CPython versions tested on: 3.11.4, 3.12.0b3
- Operating system and architecture: NixOS 23.11 x86_64, Debian 12 x86_64
<!-- gh-linked-prs -->
### Linked PRs
* gh-106875
* gh-107532
* gh-107533
<!-- /gh-linked-prs -->
| 557b05c7a5334de5da3dc94c108c0121f10b9191 | 052a0d1106fa3ee0c955a3b7ba48e82c49424e20 |
python/cpython | python__cpython-106085 | # C API: Remove private functions from abstract.h
Over the years, we accumulated many private functions as part of the public C API in abstract.h header file. I propose to remove them: move them to the internal C API.
<!-- gh-linked-prs -->
### Linked PRs
* gh-106085
* gh-106088
* gh-106103
* gh-106106
* gh-106159
<!-- /gh-linked-prs -->
| 00e75a33728cdad7c10088acc36bc55b2f4a0efe | 93a970ffbce58657cc99305be69e460a11371730 |
python/cpython | python__cpython-106079 | # Isolate the `_decimal` extension module
This issue is used to track the PRs split from [gh-103092](https://github.com/python/cpython/pull/103381). Isolate the `_decimal` extension module by:
* Establish a global module state and convert static types to heap types
* Move other global static variables to the global module state(possibly multiple PRs)
- [x] DecimalException
- [x] basic_context_template
- [x] tls_context_key
- [x] cached_context
- [x] current_context_var
- [x] default_context_template
- [x] extended_context_template
- [x] round_map
- [x] Rational
- [x] SignalTuple
- [x] External C-API functions
* Convert the global module state to true module state
- [x] signal_map
- [x] cond_map
- [x] convert global state to module state
See original issue [Isolate Stdlib Extension Modules](https://github.com/python/cpython/issues/103092) and [PEP-687](https://peps.python.org/pep-0687/) for details.
<!-- gh-linked-prs -->
### Linked PRs
* gh-106079
* gh-106301
* gh-106346
* gh-106395
* gh-106475
* gh-106616
* gh-106880
* gh-107287
* gh-107524
<!-- /gh-linked-prs -->
| fb0d9b9ac1ec3ea13fae8b8ef6a4f0a5a80482b3 | 0e24499129f3917b199a6d46fa33eeedd2c447fc |
python/cpython | python__cpython-106090 | # `asyncio.__init__` does not include `asyncio.taskgroups` in its `__all__`
I'm not sure if I should file this as a bug or a feature...I just noticed it in [a discussion](https://discuss.python.org/t/add-the-export-keyword-to-python/28444/13), and thought I'd raise the issue. It's possible this is intended behavior.
`asyncio.__init__` imports everything from all of its submodules and puts almost everything into `__all__`, I assume so people can `from asyncio import *`. It looks like `asyncio.taskgroups` was omitted from this, I am guessing by accident (the lists are not in the same order).
I guess people usually don't use that pattern, or not enough have done so and found the last of `TaskGroup` annoying, so it went under the radar. But very easy to fix, happy to open a PR if desired.
<!-- gh-linked-prs -->
### Linked PRs
* gh-106090
* gh-106098
<!-- /gh-linked-prs -->
| a12e8ffb49e05a1d1874389318911ce9685db232 | 3eeb8c89063d5ac22c0b1d26e4ae2fd12c149650 |
python/cpython | python__cpython-106108 | # Memory leak in AST parsing (OSS-Fuzz #60074)
# Bug report
Reported by OSS-Fuzz (issue [60074](https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=60074)).
Build cpython with:
```sh
CC=clang CFLAGS="-fsanitize=address" LDFLAGS="-fsanitize=address" ./configure --prefix=<prefix>
ASAN_OPTIONS=detect_leaks=0 make -j$(nproc)
ASAN_OPTIONS=detect_leaks=0 make install
```
(Setting `ASAN_OPTIONS=detect_leaks=0` during build is necessary because memory leaks occur in the build phase itself, see https://github.com/python/cpython/issues/104791).
Then run the following reproducer:
```python
import ast
ast.unparse(ast.parse(bytes([
0x77, 0x69, 0x74, 0x68, 0x28, 0x29, 0x3a, 0x0a, 0x09, 0x2d, 0x2d, 0x2d,
0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d,
0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d,
0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d,
0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d,
0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d,
0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d,
0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d,
0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d,
0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x7e, 0x7e, 0x7e, 0x7e,
0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e,
0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e,
0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e,
0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e,
0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e,
0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e,
0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e,
0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e,
0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e,
0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e,
0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e,
0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e,
0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e,
0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e,
0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e,
0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e,
0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e,
0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x66, 0x27,
0x7b, 0x22, 0x02, 0x22, 0x7d, 0x65, 0x27, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d,
0x2d, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e,
0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e,
0x7e, 0x7e, 0x2d, 0x76, 0x66, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d,
0x2d, 0x69])))
```
AddressSanitizer stack trace:
```
==178428==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 87170 byte(s) in 64 object(s) allocated from:
#0 0x559384eecb9e in __interceptor_malloc (/home/jhg/oss-fuzz-60074/cpython-install/bin/python3.13+0x2e3b9e) (BuildId: ea5a593a9a755c28cb82600d1aa85c16131c0c4f)
#1 0x559385123406 in PyMem_RawMalloc /home/jhg/oss-fuzz-60074/cpython/Objects/obmalloc.c:662:12
#2 0x559385123406 in _PyObject_Malloc /home/jhg/oss-fuzz-60074/cpython/Objects/obmalloc.c:1569:11
Direct leak of 29192 byte(s) in 30 object(s) allocated from:
#0 0x559384eecb9e in __interceptor_malloc (/home/jhg/oss-fuzz-60074/cpython-install/bin/python3.13+0x2e3b9e) (BuildId: ea5a593a9a755c28cb82600d1aa85c16131c0c4f)
#1 0x559385123406 in PyMem_RawMalloc /home/jhg/oss-fuzz-60074/cpython/Objects/obmalloc.c:662:12
#2 0x559385123406 in _PyObject_Malloc /home/jhg/oss-fuzz-60074/cpython/Objects/obmalloc.c:1569:11
#3 0x5593853e03b3 in r_object /home/jhg/oss-fuzz-60074/cpython/Python/marshal.c:1449:29
#4 0x5593853df60c in r_object /home/jhg/oss-fuzz-60074/cpython/Python/marshal.c:1220:18
#5 0x5593853e007e in r_object /home/jhg/oss-fuzz-60074/cpython/Python/marshal.c:1389:22
#6 0x5593853df60c in r_object /home/jhg/oss-fuzz-60074/cpython/Python/marshal.c:1220:18
#7 0x5593853e007e in r_object /home/jhg/oss-fuzz-60074/cpython/Python/marshal.c:1389:22
#8 0x5593853d95cd in read_object /home/jhg/oss-fuzz-60074/cpython/Python/marshal.c:1515:9
#9 0x5593852ec552 in _PyEval_EvalFrameDefault /home/jhg/oss-fuzz-60074/cpython/Python/bytecodes.c:3012:19
#10 0x559385038307 in _PyObject_VectorcallTstate /home/jhg/oss-fuzz-60074/cpython/./Include/internal/pycore_call.h:92:11
#11 0x559385038307 in object_vacall /home/jhg/oss-fuzz-60074/cpython/Objects/call.c:824:14
#12 0x559385037c3a in PyObject_CallMethodObjArgs /home/jhg/oss-fuzz-60074/cpython/Objects/call.c:885:24
#13 0x5593853aa0a3 in import_find_and_load /home/jhg/oss-fuzz-60074/cpython/Python/import.c:2767:11
#14 0x5593853aa0a3 in PyImport_ImportModuleLevelObject /home/jhg/oss-fuzz-60074/cpython/Python/import.c:2847:15
#15 0x5593852d6e32 in import_name /home/jhg/oss-fuzz-60074/cpython/Python/ceval.c:2458:15
#16 0x5593852d6e32 in _PyEval_EvalFrameDefault /home/jhg/oss-fuzz-60074/cpython/Python/bytecodes.c:2132:19
#17 0x5593852d2a65 in _PyEval_EvalFrame /home/jhg/oss-fuzz-60074/cpython/./Include/internal/pycore_ceval.h:88:16
#18 0x5593852d2a65 in _PyEval_Vector /home/jhg/oss-fuzz-60074/cpython/Python/ceval.c:1683:12
#19 0x5593852d2a65 in PyEval_EvalCode /home/jhg/oss-fuzz-60074/cpython/Python/ceval.c:579:21
#20 0x5593852cccf3 in builtin_exec_impl /home/jhg/oss-fuzz-60074/cpython/Python/bltinmodule.c:1079:17
#21 0x5593852cccf3 in builtin_exec /home/jhg/oss-fuzz-60074/cpython/Python/clinic/bltinmodule.c.h:583:20
#22 0x559385110c96 in cfunction_vectorcall_FASTCALL_KEYWORDS /home/jhg/oss-fuzz-60074/cpython/Objects/methodobject.c:438:24
Direct leak of 28216 byte(s) in 39 object(s) allocated from:
#0 0x559384eecb9e in __interceptor_malloc (/home/jhg/oss-fuzz-60074/cpython-install/bin/python3.13+0x2e3b9e) (BuildId: ea5a593a9a755c28cb82600d1aa85c16131c0c4f)
#1 0x559385123406 in PyMem_RawMalloc /home/jhg/oss-fuzz-60074/cpython/Objects/obmalloc.c:662:12
#2 0x559385123406 in _PyObject_Malloc /home/jhg/oss-fuzz-60074/cpython/Objects/obmalloc.c:1569:11
#3 0x5593853e03b3 in r_object /home/jhg/oss-fuzz-60074/cpython/Python/marshal.c:1449:29
#4 0x5593853df60c in r_object /home/jhg/oss-fuzz-60074/cpython/Python/marshal.c:1220:18
#5 0x5593853e007e in r_object /home/jhg/oss-fuzz-60074/cpython/Python/marshal.c:1389:22
#6 0x5593853df60c in r_object /home/jhg/oss-fuzz-60074/cpython/Python/marshal.c:1220:18
#7 0x5593853e007e in r_object /home/jhg/oss-fuzz-60074/cpython/Python/marshal.c:1389:22
#8 0x5593853d95cd in read_object /home/jhg/oss-fuzz-60074/cpython/Python/marshal.c:1515:9
#9 0x5593852ec552 in _PyEval_EvalFrameDefault /home/jhg/oss-fuzz-60074/cpython/Python/bytecodes.c:3012:19
#10 0x559385038307 in _PyObject_VectorcallTstate /home/jhg/oss-fuzz-60074/cpython/./Include/internal/pycore_call.h:92:11
#11 0x559385038307 in object_vacall /home/jhg/oss-fuzz-60074/cpython/Objects/call.c:824:14
#12 0x559385037c3a in PyObject_CallMethodObjArgs /home/jhg/oss-fuzz-60074/cpython/Objects/call.c:885:24
#13 0x5593853aa0a3 in import_find_and_load /home/jhg/oss-fuzz-60074/cpython/Python/import.c:2767:11
#14 0x5593853aa0a3 in PyImport_ImportModuleLevelObject /home/jhg/oss-fuzz-60074/cpython/Python/import.c:2847:15
#15 0x5593852d6e32 in import_name /home/jhg/oss-fuzz-60074/cpython/Python/ceval.c:2458:15
#16 0x5593852d6e32 in _PyEval_EvalFrameDefault /home/jhg/oss-fuzz-60074/cpython/Python/bytecodes.c:2132:19
#17 0x5593852d2a65 in _PyEval_EvalFrame /home/jhg/oss-fuzz-60074/cpython/./Include/internal/pycore_ceval.h:88:16
#18 0x5593852d2a65 in _PyEval_Vector /home/jhg/oss-fuzz-60074/cpython/Python/ceval.c:1683:12
#19 0x5593852d2a65 in PyEval_EvalCode /home/jhg/oss-fuzz-60074/cpython/Python/ceval.c:579:21
#20 0x55938540cc09 in run_eval_code_obj /home/jhg/oss-fuzz-60074/cpython/Python/pythonrun.c:1727:9
#21 0x55938540cc09 in run_mod /home/jhg/oss-fuzz-60074/cpython/Python/pythonrun.c:1748:19
Direct leak of 8720 byte(s) in 8 object(s) allocated from:
#0 0x559384eecb9e in __interceptor_malloc (/home/jhg/oss-fuzz-60074/cpython-install/bin/python3.13+0x2e3b9e) (BuildId: ea5a593a9a755c28cb82600d1aa85c16131c0c4f)
#1 0x559385123406 in PyMem_RawMalloc /home/jhg/oss-fuzz-60074/cpython/Objects/obmalloc.c:662:12
#2 0x559385123406 in _PyObject_Malloc /home/jhg/oss-fuzz-60074/cpython/Objects/obmalloc.c:1569:11
#3 0x5593853e03b3 in r_object /home/jhg/oss-fuzz-60074/cpython/Python/marshal.c:1449:29
#4 0x5593853df60c in r_object /home/jhg/oss-fuzz-60074/cpython/Python/marshal.c:1220:18
#5 0x5593853e007e in r_object /home/jhg/oss-fuzz-60074/cpython/Python/marshal.c:1389:22
#6 0x5593853d95cd in read_object /home/jhg/oss-fuzz-60074/cpython/Python/marshal.c:1515:9
#7 0x5593852ec552 in _PyEval_EvalFrameDefault /home/jhg/oss-fuzz-60074/cpython/Python/bytecodes.c:3012:19
#8 0x559385038307 in _PyObject_VectorcallTstate /home/jhg/oss-fuzz-60074/cpython/./Include/internal/pycore_call.h:92:11
#9 0x559385038307 in object_vacall /home/jhg/oss-fuzz-60074/cpython/Objects/call.c:824:14
#10 0x559385037c3a in PyObject_CallMethodObjArgs /home/jhg/oss-fuzz-60074/cpython/Objects/call.c:885:24
#11 0x5593853aa0a3 in import_find_and_load /home/jhg/oss-fuzz-60074/cpython/Python/import.c:2767:11
#12 0x5593853aa0a3 in PyImport_ImportModuleLevelObject /home/jhg/oss-fuzz-60074/cpython/Python/import.c:2847:15
#13 0x5593852d6e32 in import_name /home/jhg/oss-fuzz-60074/cpython/Python/ceval.c:2458:15
#14 0x5593852d6e32 in _PyEval_EvalFrameDefault /home/jhg/oss-fuzz-60074/cpython/Python/bytecodes.c:2132:19
#15 0x5593852d2a65 in _PyEval_EvalFrame /home/jhg/oss-fuzz-60074/cpython/./Include/internal/pycore_ceval.h:88:16
#16 0x5593852d2a65 in _PyEval_Vector /home/jhg/oss-fuzz-60074/cpython/Python/ceval.c:1683:12
#17 0x5593852d2a65 in PyEval_EvalCode /home/jhg/oss-fuzz-60074/cpython/Python/ceval.c:579:21
#18 0x5593852cccf3 in builtin_exec_impl /home/jhg/oss-fuzz-60074/cpython/Python/bltinmodule.c:1079:17
#19 0x5593852cccf3 in builtin_exec /home/jhg/oss-fuzz-60074/cpython/Python/clinic/bltinmodule.c.h:583:20
#20 0x559385110c96 in cfunction_vectorcall_FASTCALL_KEYWORDS /home/jhg/oss-fuzz-60074/cpython/Objects/methodobject.c:438:24
Direct leak of 2888 byte(s) in 4 object(s) allocated from:
#0 0x559384eecb9e in __interceptor_malloc (/home/jhg/oss-fuzz-60074/cpython-install/bin/python3.13+0x2e3b9e) (BuildId: ea5a593a9a755c28cb82600d1aa85c16131c0c4f)
#1 0x559385123406 in PyMem_RawMalloc /home/jhg/oss-fuzz-60074/cpython/Objects/obmalloc.c:662:12
#2 0x559385123406 in _PyObject_Malloc /home/jhg/oss-fuzz-60074/cpython/Objects/obmalloc.c:1569:11
#3 0x5593853e03b3 in r_object /home/jhg/oss-fuzz-60074/cpython/Python/marshal.c:1449:29
#4 0x5593853df60c in r_object /home/jhg/oss-fuzz-60074/cpython/Python/marshal.c:1220:18
#5 0x5593853e007e in r_object /home/jhg/oss-fuzz-60074/cpython/Python/marshal.c:1389:22
#6 0x5593853d95cd in read_object /home/jhg/oss-fuzz-60074/cpython/Python/marshal.c:1515:9
#7 0x5593852ec552 in _PyEval_EvalFrameDefault /home/jhg/oss-fuzz-60074/cpython/Python/bytecodes.c:3012:19
#8 0x559385038307 in _PyObject_VectorcallTstate /home/jhg/oss-fuzz-60074/cpython/./Include/internal/pycore_call.h:92:11
#9 0x559385038307 in object_vacall /home/jhg/oss-fuzz-60074/cpython/Objects/call.c:824:14
#10 0x559385037c3a in PyObject_CallMethodObjArgs /home/jhg/oss-fuzz-60074/cpython/Objects/call.c:885:24
#11 0x5593853aa0a3 in import_find_and_load /home/jhg/oss-fuzz-60074/cpython/Python/import.c:2767:11
#12 0x5593853aa0a3 in PyImport_ImportModuleLevelObject /home/jhg/oss-fuzz-60074/cpython/Python/import.c:2847:15
#13 0x5593852d6e32 in import_name /home/jhg/oss-fuzz-60074/cpython/Python/ceval.c:2458:15
#14 0x5593852d6e32 in _PyEval_EvalFrameDefault /home/jhg/oss-fuzz-60074/cpython/Python/bytecodes.c:2132:19
#15 0x5593852d2a65 in _PyEval_EvalFrame /home/jhg/oss-fuzz-60074/cpython/./Include/internal/pycore_ceval.h:88:16
#16 0x5593852d2a65 in _PyEval_Vector /home/jhg/oss-fuzz-60074/cpython/Python/ceval.c:1683:12
#17 0x5593852d2a65 in PyEval_EvalCode /home/jhg/oss-fuzz-60074/cpython/Python/ceval.c:579:21
#18 0x55938540cc09 in run_eval_code_obj /home/jhg/oss-fuzz-60074/cpython/Python/pythonrun.c:1727:9
#19 0x55938540cc09 in run_mod /home/jhg/oss-fuzz-60074/cpython/Python/pythonrun.c:1748:19
Direct leak of 2816 byte(s) in 1 object(s) allocated from:
#0 0x559384eecfc6 in __interceptor_realloc (/home/jhg/oss-fuzz-60074/cpython-install/bin/python3.13+0x2e3fc6) (BuildId: ea5a593a9a755c28cb82600d1aa85c16131c0c4f)
#1 0x55938509d353 in list_resize /home/jhg/oss-fuzz-60074/cpython/Objects/listobject.c:82:30
#2 0x55938509d353 in list_extend /home/jhg/oss-fuzz-60074/cpython/Objects/listobject.c:892:18
Direct leak of 2048 byte(s) in 1 object(s) allocated from:
#0 0x559384eecb9e in __interceptor_malloc (/home/jhg/oss-fuzz-60074/cpython-install/bin/python3.13+0x2e3b9e) (BuildId: ea5a593a9a755c28cb82600d1aa85c16131c0c4f)
#1 0x559385123406 in PyMem_RawMalloc /home/jhg/oss-fuzz-60074/cpython/Objects/obmalloc.c:662:12
#2 0x559385123406 in _PyObject_Malloc /home/jhg/oss-fuzz-60074/cpython/Objects/obmalloc.c:1569:11
#3 0x559385132dcf in set_add_key /home/jhg/oss-fuzz-60074/cpython/Objects/setobject.c:354:12
#4 0x559385132dcf in set_update_internal /home/jhg/oss-fuzz-60074/cpython/Objects/setobject.c:913:13
#5 0x55938513c0ff in make_new_set /home/jhg/oss-fuzz-60074/cpython/Objects/setobject.c:967:13
#6 0x55938513c0ff in make_new_frozenset /home/jhg/oss-fuzz-60074/cpython/Objects/setobject.c:999:12
#7 0x5593852d2a65 in _PyEval_EvalFrame /home/jhg/oss-fuzz-60074/cpython/./Include/internal/pycore_ceval.h:88:16
#8 0x5593852d2a65 in _PyEval_Vector /home/jhg/oss-fuzz-60074/cpython/Python/ceval.c:1683:12
#9 0x5593852d2a65 in PyEval_EvalCode /home/jhg/oss-fuzz-60074/cpython/Python/ceval.c:579:21
#10 0x5593852cccf3 in builtin_exec_impl /home/jhg/oss-fuzz-60074/cpython/Python/bltinmodule.c:1079:17
#11 0x5593852cccf3 in builtin_exec /home/jhg/oss-fuzz-60074/cpython/Python/clinic/bltinmodule.c.h:583:20
#12 0x559385110c96 in cfunction_vectorcall_FASTCALL_KEYWORDS /home/jhg/oss-fuzz-60074/cpython/Objects/methodobject.c:438:24
Indirect leak of 300119 byte(s) in 316 object(s) allocated from:
#0 0x559384eecb9e in __interceptor_malloc (/home/jhg/oss-fuzz-60074/cpython-install/bin/python3.13+0x2e3b9e) (BuildId: ea5a593a9a755c28cb82600d1aa85c16131c0c4f)
#1 0x559385123406 in PyMem_RawMalloc /home/jhg/oss-fuzz-60074/cpython/Objects/obmalloc.c:662:12
#2 0x559385123406 in _PyObject_Malloc /home/jhg/oss-fuzz-60074/cpython/Objects/obmalloc.c:1569:11
Indirect leak of 9623 byte(s) in 8 object(s) allocated from:
#0 0x559384eecb9e in __interceptor_malloc (/home/jhg/oss-fuzz-60074/cpython-install/bin/python3.13+0x2e3b9e) (BuildId: ea5a593a9a755c28cb82600d1aa85c16131c0c4f)
#1 0x559385123406 in PyMem_RawMalloc /home/jhg/oss-fuzz-60074/cpython/Objects/obmalloc.c:662:12
#2 0x559385123406 in _PyObject_Malloc /home/jhg/oss-fuzz-60074/cpython/Objects/obmalloc.c:1569:11
#3 0x559385151d0f in type_call /home/jhg/oss-fuzz-60074/cpython/Objects/typeobject.c:1663:11
Indirect leak of 6357 byte(s) in 6 object(s) allocated from:
#0 0x559384eecb9e in __interceptor_malloc (/home/jhg/oss-fuzz-60074/cpython-install/bin/python3.13+0x2e3b9e) (BuildId: ea5a593a9a755c28cb82600d1aa85c16131c0c4f)
#1 0x559385123406 in PyMem_RawMalloc /home/jhg/oss-fuzz-60074/cpython/Objects/obmalloc.c:662:12
#2 0x559385123406 in _PyObject_Malloc /home/jhg/oss-fuzz-60074/cpython/Objects/obmalloc.c:1569:11
#3 0x5593853e0131 in r_object /home/jhg/oss-fuzz-60074/cpython/Python/marshal.c:1413:25
#4 0x5593853df60c in r_object /home/jhg/oss-fuzz-60074/cpython/Python/marshal.c:1220:18
#5 0x5593853e007e in r_object /home/jhg/oss-fuzz-60074/cpython/Python/marshal.c:1389:22
#6 0x5593853df60c in r_object /home/jhg/oss-fuzz-60074/cpython/Python/marshal.c:1220:18
#7 0x5593853e007e in r_object /home/jhg/oss-fuzz-60074/cpython/Python/marshal.c:1389:22
#8 0x5593853d95cd in read_object /home/jhg/oss-fuzz-60074/cpython/Python/marshal.c:1515:9
#9 0x5593852ec552 in _PyEval_EvalFrameDefault /home/jhg/oss-fuzz-60074/cpython/Python/bytecodes.c:3012:19
#10 0x559385038307 in _PyObject_VectorcallTstate /home/jhg/oss-fuzz-60074/cpython/./Include/internal/pycore_call.h:92:11
#11 0x559385038307 in object_vacall /home/jhg/oss-fuzz-60074/cpython/Objects/call.c:824:14
#12 0x559385037c3a in PyObject_CallMethodObjArgs /home/jhg/oss-fuzz-60074/cpython/Objects/call.c:885:24
#13 0x5593853aa0a3 in import_find_and_load /home/jhg/oss-fuzz-60074/cpython/Python/import.c:2767:11
#14 0x5593853aa0a3 in PyImport_ImportModuleLevelObject /home/jhg/oss-fuzz-60074/cpython/Python/import.c:2847:15
#15 0x5593852d6e32 in import_name /home/jhg/oss-fuzz-60074/cpython/Python/ceval.c:2458:15
#16 0x5593852d6e32 in _PyEval_EvalFrameDefault /home/jhg/oss-fuzz-60074/cpython/Python/bytecodes.c:2132:19
#17 0x5593852d2a65 in _PyEval_EvalFrame /home/jhg/oss-fuzz-60074/cpython/./Include/internal/pycore_ceval.h:88:16
#18 0x5593852d2a65 in _PyEval_Vector /home/jhg/oss-fuzz-60074/cpython/Python/ceval.c:1683:12
#19 0x5593852d2a65 in PyEval_EvalCode /home/jhg/oss-fuzz-60074/cpython/Python/ceval.c:579:21
#20 0x5593852cccf3 in builtin_exec_impl /home/jhg/oss-fuzz-60074/cpython/Python/bltinmodule.c:1079:17
#21 0x5593852cccf3 in builtin_exec /home/jhg/oss-fuzz-60074/cpython/Python/clinic/bltinmodule.c.h:583:20
#22 0x559385110c96 in cfunction_vectorcall_FASTCALL_KEYWORDS /home/jhg/oss-fuzz-60074/cpython/Objects/methodobject.c:438:24
Indirect leak of 2195 byte(s) in 2 object(s) allocated from:
#0 0x559384eecb9e in __interceptor_malloc (/home/jhg/oss-fuzz-60074/cpython-install/bin/python3.13+0x2e3b9e) (BuildId: ea5a593a9a755c28cb82600d1aa85c16131c0c4f)
#1 0x559385123406 in PyMem_RawMalloc /home/jhg/oss-fuzz-60074/cpython/Objects/obmalloc.c:662:12
#2 0x559385123406 in _PyObject_Malloc /home/jhg/oss-fuzz-60074/cpython/Objects/obmalloc.c:1569:11
#3 0x5593853e0131 in r_object /home/jhg/oss-fuzz-60074/cpython/Python/marshal.c:1413:25
#4 0x5593853df60c in r_object /home/jhg/oss-fuzz-60074/cpython/Python/marshal.c:1220:18
#5 0x5593853e007e in r_object /home/jhg/oss-fuzz-60074/cpython/Python/marshal.c:1389:22
#6 0x5593853d95cd in read_object /home/jhg/oss-fuzz-60074/cpython/Python/marshal.c:1515:9
#7 0x5593852ec552 in _PyEval_EvalFrameDefault /home/jhg/oss-fuzz-60074/cpython/Python/bytecodes.c:3012:19
#8 0x559385038307 in _PyObject_VectorcallTstate /home/jhg/oss-fuzz-60074/cpython/./Include/internal/pycore_call.h:92:11
#9 0x559385038307 in object_vacall /home/jhg/oss-fuzz-60074/cpython/Objects/call.c:824:14
#10 0x559385037c3a in PyObject_CallMethodObjArgs /home/jhg/oss-fuzz-60074/cpython/Objects/call.c:885:24
#11 0x5593853aa0a3 in import_find_and_load /home/jhg/oss-fuzz-60074/cpython/Python/import.c:2767:11
#12 0x5593853aa0a3 in PyImport_ImportModuleLevelObject /home/jhg/oss-fuzz-60074/cpython/Python/import.c:2847:15
#13 0x5593852d6e32 in import_name /home/jhg/oss-fuzz-60074/cpython/Python/ceval.c:2458:15
#14 0x5593852d6e32 in _PyEval_EvalFrameDefault /home/jhg/oss-fuzz-60074/cpython/Python/bytecodes.c:2132:19
#15 0x5593852d2a65 in _PyEval_EvalFrame /home/jhg/oss-fuzz-60074/cpython/./Include/internal/pycore_ceval.h:88:16
#16 0x5593852d2a65 in _PyEval_Vector /home/jhg/oss-fuzz-60074/cpython/Python/ceval.c:1683:12
#17 0x5593852d2a65 in PyEval_EvalCode /home/jhg/oss-fuzz-60074/cpython/Python/ceval.c:579:21
#18 0x5593852cccf3 in builtin_exec_impl /home/jhg/oss-fuzz-60074/cpython/Python/bltinmodule.c:1079:17
#19 0x5593852cccf3 in builtin_exec /home/jhg/oss-fuzz-60074/cpython/Python/clinic/bltinmodule.c.h:583:20
#20 0x559385110c96 in cfunction_vectorcall_FASTCALL_KEYWORDS /home/jhg/oss-fuzz-60074/cpython/Objects/methodobject.c:438:24
Indirect leak of 1103 byte(s) in 2 object(s) allocated from:
#0 0x559384eecb9e in __interceptor_malloc (/home/jhg/oss-fuzz-60074/cpython-install/bin/python3.13+0x2e3b9e) (BuildId: ea5a593a9a755c28cb82600d1aa85c16131c0c4f)
#1 0x559385123406 in PyMem_RawMalloc /home/jhg/oss-fuzz-60074/cpython/Objects/obmalloc.c:662:12
#2 0x559385123406 in _PyObject_Malloc /home/jhg/oss-fuzz-60074/cpython/Objects/obmalloc.c:1569:11
#3 0x5593853e0131 in r_object /home/jhg/oss-fuzz-60074/cpython/Python/marshal.c:1413:25
#4 0x5593853df60c in r_object /home/jhg/oss-fuzz-60074/cpython/Python/marshal.c:1220:18
#5 0x5593853e007e in r_object /home/jhg/oss-fuzz-60074/cpython/Python/marshal.c:1389:22
#6 0x5593853df60c in r_object /home/jhg/oss-fuzz-60074/cpython/Python/marshal.c:1220:18
#7 0x5593853e007e in r_object /home/jhg/oss-fuzz-60074/cpython/Python/marshal.c:1389:22
#8 0x5593853d95cd in read_object /home/jhg/oss-fuzz-60074/cpython/Python/marshal.c:1515:9
#9 0x5593852ec552 in _PyEval_EvalFrameDefault /home/jhg/oss-fuzz-60074/cpython/Python/bytecodes.c:3012:19
#10 0x559385038307 in _PyObject_VectorcallTstate /home/jhg/oss-fuzz-60074/cpython/./Include/internal/pycore_call.h:92:11
#11 0x559385038307 in object_vacall /home/jhg/oss-fuzz-60074/cpython/Objects/call.c:824:14
#12 0x559385037c3a in PyObject_CallMethodObjArgs /home/jhg/oss-fuzz-60074/cpython/Objects/call.c:885:24
#13 0x5593853aa0a3 in import_find_and_load /home/jhg/oss-fuzz-60074/cpython/Python/import.c:2767:11
#14 0x5593853aa0a3 in PyImport_ImportModuleLevelObject /home/jhg/oss-fuzz-60074/cpython/Python/import.c:2847:15
#15 0x5593852d6e32 in import_name /home/jhg/oss-fuzz-60074/cpython/Python/ceval.c:2458:15
#16 0x5593852d6e32 in _PyEval_EvalFrameDefault /home/jhg/oss-fuzz-60074/cpython/Python/bytecodes.c:2132:19
#17 0x5593852d2a65 in _PyEval_EvalFrame /home/jhg/oss-fuzz-60074/cpython/./Include/internal/pycore_ceval.h:88:16
#18 0x5593852d2a65 in _PyEval_Vector /home/jhg/oss-fuzz-60074/cpython/Python/ceval.c:1683:12
#19 0x5593852d2a65 in PyEval_EvalCode /home/jhg/oss-fuzz-60074/cpython/Python/ceval.c:579:21
#20 0x55938540cc09 in run_eval_code_obj /home/jhg/oss-fuzz-60074/cpython/Python/pythonrun.c:1727:9
#21 0x55938540cc09 in run_mod /home/jhg/oss-fuzz-60074/cpython/Python/pythonrun.c:1748:19
Indirect leak of 690 byte(s) in 1 object(s) allocated from:
#0 0x559384eecb9e in __interceptor_malloc (/home/jhg/oss-fuzz-60074/cpython-install/bin/python3.13+0x2e3b9e) (BuildId: ea5a593a9a755c28cb82600d1aa85c16131c0c4f)
#1 0x559385123406 in PyMem_RawMalloc /home/jhg/oss-fuzz-60074/cpython/Objects/obmalloc.c:662:12
#2 0x559385123406 in _PyObject_Malloc /home/jhg/oss-fuzz-60074/cpython/Objects/obmalloc.c:1569:11
#3 0x559385170810 in tp_new_wrapper /home/jhg/oss-fuzz-60074/cpython/Objects/typeobject.c:8325:11
SUMMARY: AddressSanitizer: 481137 byte(s) leaked in 482 allocation(s).
```
Bug was introduced in 04492cbc9aa45ac2c12d22083c406a0364c39f5b @markshannon
# Your environment
Linux x64, latest cpython main branch checkout.
<!-- gh-linked-prs -->
### Linked PRs
* gh-106108
<!-- /gh-linked-prs -->
| 24fb627ea7a4d57cf479b7516bafdb6c253a1645 | e1d45b8ed43e1590862319fec33539f8adbc0849 |
python/cpython | python__cpython-106515 | # Possessive quantifier matches where an ordinary quantifier doesn't
```python
>>> import re
>>> re.fullmatch('(?:ab?c)*', 'a')
>>> re.fullmatch('(?:ab?c)*+', 'a')
<re.Match object; span=(0, 1), match='a'>
>>>
```
I'm not sure that I completely understand the behavior of the possessive quantifiers, but I think that if `R*` doesn't match a string then `R*+` shouldn't match it, where `R` is any regex.
Versions tested:
3.12.0b3 (tags/v3.12.0b3:f992a60, Jun 20 2023, 12:25:40) [MSC v.1936 64 bit (AMD64)]
3.11.4 (tags/v3.11.4:d2340ef, Jun 7 2023, 05:45:37) [MSC v.1934 64 bit (AMD64)]
3.11.4 (tags/v3.11.4:d2340ef, Jun 7 2023, 05:30:09) [MSC v.1934 32 bit (Intel)]
3.11.4 (main, Jun 14 2023, 18:33:43) [GCC 10.2.1 20210110]
<!-- gh-linked-prs -->
### Linked PRs
* gh-106515
* gh-107795
* gh-107796
<!-- /gh-linked-prs -->
| 7b6e34e5baeb4162815ffa4d943b09a58e3f6580 | 73507382ac184a72b59ebb0c2f85e8b1d2dfa58e |
python/cpython | python__cpython-106082 | # Improve error message from `os.fspath` if `__fspath__` is set to `None`
# Feature or enhancement
A common Python idiom is to set a magic method to `None` in a subclass if you want to disable the behaviour that the magic method enables. If you do so, a nice error message will be given if a user tries to "call" the magic method that's been set to `None`. For example:
```pycon
>>> class Foo(list):
... __iter__ = None
...
>>> iter(Foo())
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'Foo' object is not iterable
>>> class Bar(int):
... __hash__ = None
...
>>> hash(Bar(42))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: unhashable type: 'Bar'
```
However, Python doesn't currently do the same thing for `__fspath__`. If a subclass of an `os.PathLike` sets `__fspath__` to `None`, Python gives a bad error message when `os.fspath` is called on instances of that subclass:
```pycon
>>> from pathlib import Path
>>> import os
>>> class Baz(Path):
... __fspath__ = None
...
>>> os.fspath(Baz())
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'NoneType' object is not callable
```
# Pitch
It would be nice if Python handled `__fspath__` being set to `None` the same way it handles magic methods such as `__iter__` or `__hash__` being set to `None`. The error message in such cases should be the `expected str, bytes or os.PathLike object, not Baz` error message that the interpreter gives when `os.fspath` is called on an object that has no `__fspath__` method at all.
<!-- gh-linked-prs -->
### Linked PRs
* gh-106082
<!-- /gh-linked-prs -->
| 93a970ffbce58657cc99305be69e460a11371730 | 8c24a837371439b8e922ff47275085b581f510c5 |
python/cpython | python__cpython-106034 | # PyDict_GetItem and PyObject_HasAttr should not be used
These functions are broken by design, because they discard any exceptions raised inside, including MemoryError and KeyboardInterrupt. There were several rounds of getting rid of them in past (for example 567eba1852ed89e5cf93dbce33f7e2ca73e8f05d, #11112, #75753), but they occur in new code.
<!-- gh-linked-prs -->
### Linked PRs
* gh-106034
* gh-106040
* gh-106041
* gh-106044
* gh-106047
* gh-106070
* gh-106071
* gh-106228
<!-- /gh-linked-prs -->
| 1d33d5378058671bfabb6f4d4b5bfd4726973ff9 | 41ad4dfc04c201728ce9fa12b1a96922dd15a368 |
python/cpython | python__cpython-106031 | # Miscellaneous fixes in Python/suggestions.c
* PyDict_GetItem() and PyObject_HasAttr() suppress arbitrary errors and
should not be used.
* PyUnicode_CompareWithASCIIString() only works if the second argument
is ASCII string.
* Refleak in get_suggestions_for_name_error.
* Use of borrowed pointer after possible freeing (self).
* Add some missing error checks.
<!-- gh-linked-prs -->
### Linked PRs
* gh-106031
* gh-106036
* gh-106039
<!-- /gh-linked-prs -->
| c8c162ef5294cddb7ac75fe93ab918e5661c68ee | 9499b0f138cc53b9a2590350d0b545d2f69ee126 |
python/cpython | python__cpython-106257 | # C API: What's the status of the half-private FASTCALL calling convention?
Hi,
In 2017, I added a new experimental FASTCALL calling convention. See my articles about it: [The start of the FASTCALL project](https://vstinner.github.io/start-fastcall-project.html) and [FASTCALL microbenchmarks](https://vstinner.github.io/fastcall-microbenchmarks.html). It avoids the need to create a temporary **tuple** to pass positional arguments and the need to create a temporary **dictionary** to pass keyword arguments. I did my best to keep this API private. I added functions prefixed with ``_Py``: ``_PyObject_Fastcall()``. Cython is eager to always use the fastest code and quickly adopted this new ``METH_FASTCALL`` calling convention... oops, I forgot to add a ``_Py`` prefix since these ``METH`` constants don't start with ``Py``.
In 2019, this calling convention was extended to support also method calls (pass the ``self`` argument): [PEP 590 – Vectorcall: a fast calling protocol for CPython](https://peps.python.org/pep-0590/). This new API is public and standardized. For example, it added public ``PyVectorcall_Function()`` and ``PyObject_Vectorcall()`` functions.
In 2023, the FASTCALL API is still around in the public C API:
* METH_FASTCALL
* _PyObject_FastCall()
* _PyObject_FastCallTstate()
* _PyObject_FastCallDict()
* _PyObject_FastCallDictTstate()
* _PyStack_AsDict()
* _PY_FASTCALL_SMALL_STACK
Can it be deprecated? Removed? I suppose that if we are in the unknown, the safe option is to start by deprecating it in Python 3.13 and plan its removal in Python 3.15.
cc @encukou
Victor
<!-- gh-linked-prs -->
### Linked PRs
* gh-106257
* gh-106258
* gh-106264
* gh-106265
* gh-106273
* gh-117633
* gh-117676
<!-- /gh-linked-prs -->
| 8c5f74fc89e35827c52753fe620b32207d537319 | e7bc8d16364bde54487eab349a29d58345e35f28 |
python/cpython | python__cpython-106017 | # Crash in test_import: Assertion error about monitoring version.
This
`./python -m test -j1 -R 3:3 test_import -v -m test_concurrency -m test___cached___legacy_pyc -m test_package___cached___from_pyc`
Crashes with `Assertion `code->_co_instrumentation_version == tstate->interp->monitoring_version' failed.`
<!-- gh-linked-prs -->
### Linked PRs
* gh-106017
<!-- /gh-linked-prs -->
| 9339d70ac2d45743507e320e81e68acf77e366af | a72683ba8e0337650cc490dbe593a5e46aba60cb |
python/cpython | python__cpython-106003 | # Make implicit boolean conversions explicit
...as discussed in https://github.com/faster-cpython/ideas/issues/568.
By adding a dedicated instruction for converting values to bool, we can easily specialize the conditions of all remaining branches in the bytecode while keeping the branches themselves as "dumb" and simple as possible.
This is one of the few remaining common cases where a little specilization will give us a lot of useful information (such as "this branch won't execute arbitrary code") for higher tiers of optimization. Plus, the most common specializations (such as for `bool` or `None`) will be effectively no-ops.
<!-- gh-linked-prs -->
### Linked PRs
* gh-106003
* gh-106367
<!-- /gh-linked-prs -->
| 7b2d94d87513967b357c658c6e7e1b8c8d02487d | 6e9f83d9aee34192de5d0ef7285be23514911ccd |
python/cpython | python__cpython-106005 | # C API: Add PyDict_GetItemRef() function
The PyDict C API has a bad history. PyDict_GetItem() ignores all exception: error on hash(), error on "key == key2", KeyboardInterrupt, etc. PyDict_GetItemWithError() was added to fix this design. Moreover, Python 3.9 and older allowed to call PyDict_GetItem() with the GIL released.
PyDict_GetItem() returns a borrowed reference which is usually safe since the dictionary still contains a strong reference to the request value. But in general, borrowed references are error prone and can likely lead to complex race conditions causing crashes:
* "Functions must not return borrowed references" says https://devguide.python.org/developer-workflow/c-api/index.html
* https://github.com/capi-workgroup/problems/issues/5
While ``PyDict_GetItem()`` calls can be quite easily replaced with ``PyObject_GetItem()`` which has a better API (return a new stong reference), developers usually prefer to still use the specialized PyDict API for best performance: avoid the minor overhead of type dispatching, ``Py_TYPE(obj)->tp_as_mapping->mp_subscript``.
I propose adding ``PyDict_GetItemRef()`` and ``PyDict_GetItemStringRef()`` functions to the limited C API (version 3.13): replacements for ``PyDict_GetItem()``, ``PyDict_GetItemWithError()`` and ``PyDict_GetItemString()``.
API:
```
int PyDict_GetItemRef(PyObject *mp, PyObject *key, PyObject **pvalue);
int PyDict_GetItemStringRef(PyObject *mp, const char *key, PyObject **pvalue);
```
``PyDict_GetItemWithError()`` has another API issue: when it returns NULL, it can mean two things. It returns NULL if the key is missing, but it also returns NULL on error. The caller has to check ``PyErr_Occurred()`` to distinguish the two cases (to write correct code). See https://github.com/capi-workgroup/problems/issues/1 Proposed API avoids this by returning an ``int``: return -1 on error, or return 0 otherwise (present or missing key). Checking ``PyErr_Occurred()`` is no longer needed.
By the way, the public C API has no PyDict_GetItem**String**WithError() function: using ``PyDict_GetItemWithError()`` with a ``char*`` key is not convenient. The ``_PyDict_GetItemStringWithError()`` function exists but it's a private C API.
<!-- gh-linked-prs -->
### Linked PRs
* gh-106005
* gh-107229
<!-- /gh-linked-prs -->
| 41ca16455188db806bfc7037058e8ecff2755e6c | 0ba07b2108d4763273f3fb85544dde34c5acd40a |
python/cpython | python__cpython-105995 | # asyncio.EventLoop.start_tls() returns None
# Bug report
The documentation says the function should return a transport:
https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.loop.start_tls
But, in some cases it actually returns None. It looks like this may happen when it receives a closing transport:
https://github.com/aio-libs/aiohttp/issues/3355#issuecomment-1597689576
I suspect this is because connection_lost() gets called during the start_tls() call, which ends up setting it to None:
https://github.com/python/cpython/blob/dba72175116373c1d15e25d84c88b516daf9f5c4/Lib/asyncio/sslproto.py#L412
Should this be allowed to return None, or should there be an exception occurring here?
A simple change could be to check for None and raise an exception, but I'm not too familiar with how this part of the code is expected to work.
<!-- gh-linked-prs -->
### Linked PRs
* gh-105995
* gh-106188
* gh-106189
* gh-106190
<!-- /gh-linked-prs -->
| 6b52a581c151914e59c8c367a03bc7309713a73b | a3dd8cce58fe2b27eea4eed572d086dc8a7e1bb8 |
python/cpython | python__cpython-105989 | # Crash in `_asyncio._swap_current_task` due to improper reference counting
First appeared in a474e04388c2ef6aca75c26cb70a1b6200235feb, where given function was introduced.
Repro:
```python
import _asyncio
class DummyLoop:
pass
class DummyTask:
pass
l = DummyLoop()
_asyncio._swap_current_task(l, DummyTask())
t = _asyncio._swap_current_task(l, None)
```
Output:
```
Modules/gcmodule.c:461: visit_decref: Assertion "!_PyObject_IsFreed(op)" failed
Enable tracemalloc to get the memory block allocation traceback
object address : 0x7fedad081130
object refcount : 1
object type : 0x55f665a81fe0
object type name: dict
object repr : Segmentation fault (core dumped)
```
I'm working on a fix.
<!-- gh-linked-prs -->
### Linked PRs
* gh-105989
* gh-106099
<!-- /gh-linked-prs -->
| d2cbb6e918d9ea39f0dd44acb53270f2dac07454 | 4849a80dd1cbbc5010e8749ba60eb91a541ae4e7 |
python/cpython | python__cpython-105980 | # Assertion failure in `_imp.get_frozen_object` if data object contains bad marshal data
Repro:
```python
import _imp
>>> _imp.get_frozen_object('x', b"6\'\xd5Cu\x12")
```
Output:
```
python: Objects/object.c:541: PyObject_Repr: Assertion `!_PyErr_Occurred(tstate)' failed.
Aborted (core dumped)
```
I'll submit a PR.
<!-- gh-linked-prs -->
### Linked PRs
* gh-105980
* gh-106055
* gh-106100
<!-- /gh-linked-prs -->
| cd5280367a3a7065d13b8f7234474f7a2e9a18fd | 46a3190fcf8580f322047395408cd60feba67041 |
python/cpython | python__cpython-105976 | # Behaviour change in py312 for protocols with non-callable members and custom `__subclasshook__` methods
# Bug report
On Python 3.11:
```pycon
>>> from typing import *
>>> @runtime_checkable
... class Foo(Protocol):
... x = 1
... @classmethod
... def __subclasshook__(cls, other):
... return hasattr(other, 'x')
...
>>> issubclass(object, Foo)
False
```
On Python 3.12:
```pycon
>>> from typing import *
>>> @runtime_checkable
... class Foo(Protocol):
... x = 1
... @classmethod
... def __subclasshook__(cls, other):
... return hsattr(cls, 'x')
...
>>> issubclass(object, Foo)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\alexw\coding\cpython\Lib\typing.py", line 1829, in __subclasscheck__
raise TypeError(
TypeError: Protocols with non-method members don't support issubclass()
```
I think I prefer the Python 3.11 behaviour here, since the whole point of allowing protocols to define custom `__subclasshook__` methods is so that users can customise how `issubclass()` works on user-defined protocols.
<!-- gh-linked-prs -->
### Linked PRs
* gh-105976
* gh-106032
<!-- /gh-linked-prs -->
| 9499b0f138cc53b9a2590350d0b545d2f69ee126 | 968435ddb1c1af9333befb26f7970cded8a5c710 |
python/cpython | python__cpython-112615 | # crc32 function outputs wrong result for large data on the macOS arm64 platform
# Bug report
The functions zlib.crc32 and binascii.crc32 share the problematic behavior. When computing the CRC for data >= 2GB macOS arm64 binaries result in different values than all other platforms such as macOS x64, Windows x64, Linux x64. Consequently, problems arise e.g. when using the zipfile module.
A clear and concise description of what the bug is.
Reproduction:
```python
import random
random.seed(0)
import zlib
import binascii
def chunks(list, n):
for i in range(0, len(list), n):
yield list[i:i + n]
random_megabyte = random.randbytes(1024*1024)
random_1_gigabyte = random_megabyte * 1024 * 1
random_4_gigabyte = random_megabyte * 1024 * 4
crc_1_gigabyte_zlib = zlib.crc32(random_1_gigabyte, 0)
crc_1_gigabyte_binascii = binascii.crc32(random_1_gigabyte, 0)
crc_4_gigabyte_zlib = zlib.crc32(random_4_gigabyte, 0)
crc_4_gigabyte_binascii = binascii.crc32(random_4_gigabyte, 0)
# incremental computation in chunks < 2 GB fixes macOS arm64
chunked_crc_4_gigabyte_zlib = 0
chunked_crc_4_gigabyte_binascii = 0
for chunk in chunks(random_4_gigabyte, 1024 * 1024 * 1024 *1):
chunked_crc_4_gigabyte_zlib = zlib.crc32(chunk, chunked_crc_4_gigabyte_zlib)
chunked_crc_4_gigabyte_binascii = binascii.crc32(chunk, chunked_crc_4_gigabyte_binascii)
print("crc_1_gigabyte_zlib".ljust(32), "expected: 0xe28bc234 computed:", hex(crc_1_gigabyte_zlib))
print("crc_1_gigabyte_binascii".ljust(32), "expected: 0xe28bc234 computed:", hex(crc_1_gigabyte_binascii))
print("crc_4_gigabyte_zlib".ljust(32), "expected: 0x278432d6 computed:", hex(crc_4_gigabyte_zlib))
print("crc_4_gigabyte_binascii".ljust(32), "expected: 0x278432d6 computed:", hex(crc_4_gigabyte_binascii))
print("chunked_crc_4_gigabyte_zlib".ljust(32), "expected: 0x278432d6 computed:", hex(chunked_crc_4_gigabyte_zlib))
print("chunked_crc_4_gigabyte_binascii".ljust(32), "expected: 0x278432d6 computed:", hex(chunked_crc_4_gigabyte_binascii))
```
Output on macOS arm64:
```
mac-arm64:crc_bug dev_admin$ /opt/homebrew/bin/python3 crc_bug_report.py
crc_1_gigabyte_zlib expected: 0xe28bc234 computed: 0xe28bc234
crc_1_gigabyte_binascii expected: 0xe28bc234 computed: 0xe28bc234
crc_4_gigabyte_zlib expected: 0x278432d6 computed: 0x6b54c6be
crc_4_gigabyte_binascii expected: 0x278432d6 computed: 0x6b54c6be
chunked_crc_4_gigabyte_zlib expected: 0x278432d6 computed: 0x278432d6
chunked_crc_4_gigabyte_binascii expected: 0x278432d6 computed: 0x278432d6
```
# Your environment
<!-- Include as many relevant details as possible about the environment you experienced the bug in -->
- CPython versions tested on: Python 3.9.6 Python 3.11.4
- Operating system and architecture: macOS arm64, macOS x64, Windows x64, Linux x64
<!-- gh-linked-prs -->
### Linked PRs
* gh-112615
* gh-112724
* gh-112725
<!-- /gh-linked-prs -->
| 4eddb4c9d9452482c9af7fa9eec223d12b5a9f33 | a1551b48eebb4a68fda031b5ee9e5cbde8d924dd |
python/cpython | python__cpython-105939 | # DeprecationWarning when escaping curly braces in an f-string
# Bug report
A `DeprecationWarning` is emitted when escaping a curly brace in an f-string. The correct warning is a `SyntaxWarning` as of Python 3.12.
```python3
cpython on test-fstring-syntaxwarnings [$] via C v14.0.3-clang via 🐍 pyenv 3.11.3 took 15s
❯ ./python.exe
Python 3.13.0a0 (heads/main:155577de1b, Jun 20 2023, 13:50:50) [Clang 14.0.3 (clang-1403.0.22.14.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> '\h'
<stdin>:1: SyntaxWarning: invalid escape sequence '\h'
'\\h'
>>> f'\h'
<stdin>:1: SyntaxWarning: invalid escape sequence '\h'
'\\h'
>>> '\{'
<stdin>:1: SyntaxWarning: invalid escape sequence '\{'
'\\{'
>>> f'\{{'
<stdin>:1: DeprecationWarning: invalid escape sequence '\{'
<stdin>:1: SyntaxWarning: invalid escape sequence '\{'
'\\{'
```
<!-- gh-linked-prs -->
### Linked PRs
* gh-105939
* gh-105941
<!-- /gh-linked-prs -->
| 6586cee27f32f0354fe4e77c7b8c6e399329b5e2 | 155577de1b6a7f4404b2bf90bcc1a588201550da |
python/cpython | python__cpython-108671 | # Surprising behaviour with compileall -s STRIPDIR parameter
The '-s' stripdir parameter to compileall has very unusual semantics that could lead to unexpected and potentially confusing outcomes.
For example, when run like this: `python -m compileall -s/path/to/build/dst -p /lib /path/to/build/src/file.py`
The source file path written to the compiled file will be: `/lib/src/file.py`. In other words the source file path is partially stripped even though the strip prefix doesn't fully match the source file path. Since this was introduced in #16012 I'd like to get @frenzymadness to comment if this was intentional, because it seems that it could be a source of really confusing bugs for end users who accidentally misspell something in their invocation and get a partially stripped result.
It gets weirder than that however, when run like this: `python -m compileall -s/path/to/another/src -p /lib /path/to/build/src/file.py`
The source file path written to the compiled file will be: `/lib/build/file.py`. The matching directories are removed around the non-matching ones. Even if there was some reason for the first behaviour it seems this second one is absolutely not a good idea.
I'm happy to fix this once it is confirmed this behaviour is unintentional.
<!-- gh-linked-prs -->
### Linked PRs
* gh-108671
<!-- /gh-linked-prs -->
| 3726cb0f146cb229a5e9db8d41c713b023dcd474 | 52e902ccf0178d7a3f26de4bba7922b01c0d4d3c |
python/cpython | python__cpython-105928 | # C API: Add PyWeakref_GetRef() function
PyWeakref_GET_OBJECT() and PyWeakref_GetObject() return a borrowed reference to the object, or a borrowed reference to None if the object has been finalized. This API is error-prone and not easy to use.
This API was discussed in 2016: https://mail.python.org/archives/list/python-dev@python.org/thread/6BIPI4MCMAZFLJNIZB4JLTBW2COCACQQ/
I propose adding a new PyWeakref_GetRef() C API function which returns a new strong reference to the object, or NULL if the object has been finalized.
<!-- gh-linked-prs -->
### Linked PRs
* gh-105928
* gh-105929
* gh-105932
* gh-105961
* gh-105963
* gh-105964
* gh-105965
* gh-105966
* gh-105971
* gh-105992
* gh-105997
* gh-106001
* gh-106002
* gh-106006
* gh-106007
* gh-106561
* gh-117091
<!-- /gh-linked-prs -->
| 7f97c8e367869e2aebe9f28bc5f8d4ce36448878 | a5c2ad0c3d23d2b1e61ab8e0d7ee64f7e1288547 |
python/cpython | python__cpython-105923 | # C API: Add PyImport_AddModuleRef() function
The C API [PyImport_AddModule()](https://docs.python.org/dev/c-api/import.html#c.PyImport_AddModule) returns a borrowed reference using a special dance added by commit https://github.com/python/cpython/commit/4db8988420e0a122d617df741381b0c385af032c of issue #86160:
```c
PyObject *ref = PyWeakref_NewRef(mod, NULL);
Py_DECREF(mod);
if (ref == NULL) {
return NULL;
}
mod = PyWeakref_GetObject(ref);
Py_DECREF(ref);
```
Borrowed references are bad:
* "Functions must not return borrowed references" says https://devguide.python.org/developer-workflow/c-api/index.html
* https://github.com/capi-workgroup/problems/issues/5
I proposed to:
* Add a new ``PyImport_AddModuleRef(const char *name)`` function, similar to ``PyImport_AddModule()`` but return a **strong reference**
* Deprecate ``PyImport_AddModule()`` and ``PyImport_AddModuleObject()``
<!-- gh-linked-prs -->
### Linked PRs
* gh-105923
* gh-105925
* gh-105998
* gh-105999
<!-- /gh-linked-prs -->
| 03f1a132eeb34c738812161947ef171b21d58c25 | 7f97c8e367869e2aebe9f28bc5f8d4ce36448878 |
python/cpython | python__cpython-105940 | # SyntaxWarnings in `test_fstring`
# Bug report
Running `python -m test test_fstring` on `main` results in several `SyntaxWarnings` being emitted.
If I just run `python -m test test_fstring` locally, I get this:
```pytb
C:\Users\alexw\coding\cpython>python -m test test_fstring
Running Release|x64 interpreter...
0:00:00 Run tests sequentially
0:00:00 [1/1] test_fstring
C:\Users\alexw\coding\cpython\Lib\test\test_fstring.py:775: SyntaxWarning: invalid escape sequence '\_'
exec('f"{F():¯\_(ツ)_/¯}"', {'F': CustomFormat})
== Tests result: SUCCESS ==
1 test OK.
Total duration: 14.5 sec
Tests result: SUCCESS
```
If I run `python -We -m test test_fstring -vv`, I get a different selection of SyntaxWarnings:
```pytb
======================================================================
ERROR: test_fstring_backslash_before_double_bracket (test.test_fstring.TestCase.test_fstring_backslash_before_double_bracket) (case="f'\\{{\\}}'", expected_result='\\{\\}')
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\alexw\coding\cpython\Lib\test\test_fstring.py", line 1041, in test_fstring_backslash_before_double_bracket
result = eval(case)
^^^^^^^^^^
File "<string>", line 1
f'\{{\}}'
^
SyntaxError: invalid escape sequence '\{'
======================================================================
ERROR: test_fstring_backslash_before_double_bracket (test.test_fstring.TestCase.test_fstring_backslash_before_double_bracket) (case="f'\\{{'", expected_result='\\{')
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\alexw\coding\cpython\Lib\test\test_fstring.py", line 1041, in test_fstring_backslash_before_double_bracket
result = eval(case)
^^^^^^^^^^
File "<string>", line 1
f'\{{'
^
SyntaxError: invalid escape sequence '\{'
======================================================================
ERROR: test_fstring_backslash_before_double_bracket (test.test_fstring.TestCase.test_fstring_backslash_before_double_bracket) (case="f'\\{{{1+1}'", expected_result='\\{2')
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\alexw\coding\cpython\Lib\test\test_fstring.py", line 1041, in test_fstring_backslash_before_double_bracket
result = eval(case)
^^^^^^^^^^
File "<string>", line 1
f'\{{{1+1}'
^
SyntaxError: invalid escape sequence '\{'
======================================================================
ERROR: test_fstring_backslash_before_double_bracket (test.test_fstring.TestCase.test_fstring_backslash_before_double_bracket) (case="f'\\}}{1+1}'", expected_result='\\}2')
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\alexw\coding\cpython\Lib\test\test_fstring.py", line 1041, in test_fstring_backslash_before_double_bracket
result = eval(case)
^^^^^^^^^^
File "<string>", line 1
f'\}}{1+1}'
^
SyntaxError: invalid escape sequence '\}'
======================================================================
ERROR: test_fstring_backslash_before_double_bracket (test.test_fstring.TestCase.test_fstring_backslash_before_double_bracket) (case="f'{1+1}\\}}'", expected_result='2\\}')
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\alexw\coding\cpython\Lib\test\test_fstring.py", line 1041, in test_fstring_backslash_before_double_bracket
result = eval(case)
^^^^^^^^^^
File "<string>", line 1
f'{1+1}\}}'
^
SyntaxError: invalid escape sequence '\}'
----------------------------------------------------------------------
Ran 80 tests in 14.399s
FAILED (errors=5)
test test_fstring failed
test_fstring failed (5 errors)
== Tests result: FAILURE ==
1 test failed:
test_fstring
Total duration: 14.6 sec
Tests result: FAILURE
```
# Your environment
```
Python 3.13.0a0 (heads/main:ab3823a97b, Jun 19 2023, 14:46:42) [MSC v.1932 64 bit (AMD64)] on win32
```
<!-- gh-linked-prs -->
### Linked PRs
* gh-105940
* gh-105942
* gh-105943
* gh-105945
<!-- /gh-linked-prs -->
| 4b431d2e90bf5760a57aa40af2dd78e7bbf0b1ae | 6586cee27f32f0354fe4e77c7b8c6e399329b5e2 |
python/cpython | python__cpython-112871 | # Crash in urllib/request.py proxy_bypass_macosx_sysconf
<!--
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 bugs, rather than crashes.
The CPython interpreter is itself written in a different programming language, C.
For CPython, a "crash" is when Python itself fails, leading to a traceback in the C stack.
-->
# Crash report
Python process crashes with a SIGABRT signal at the OS level (showing the standard software crash prompt of macOS, most of the time), and a python fatal error other times (the latter being shown here).
Unfortunately I don't have a minimal reproducer on hand.
However it looks exceptionally like a return of https://github.com/python/cpython/issues/72529 in the offending cause, as well as the workaround (setting the environment variable `no_proxy` to `*` fixes it too).
Which might share the same root cause (here: https://bugs.python.org/issue31818) at first glance.
# Error messages
```
objc[79432]: +[__NSCFConstantString initialize] may have been in progress in another thread when fork() was called.
objc[79432]: +[__NSCFConstantString initialize] may have been in progress in another thread when fork() was called. We cannot safely call it or ignore it in the fork() child process. Crashing instead. Set a breakpoint on objc_initializeAfterForkError to debug.
Fatal Python error: Aborted
Current thread 0x00000001f66e1e00 (most recent call first):
File "/opt/homebrew/Cellar/python@3.11/3.11.4/Frameworks/Python.framework/Versions/3.11/lib/python3.11/urllib/request.py", line 2636 in proxy_bypass_macosx_sysconf
File "/opt/homebrew/Cellar/python@3.11/3.11.4/Frameworks/Python.framework/Versions/3.11/lib/python3.11/urllib/request.py", line 2660 in proxy_bypass
File "/Users/tristan/.local/share/virtualenvs/baz-8Eg-uX1t/lib/python3.11/site-packages/requests/utils.py", line 814 in should_bypass_proxies
File "/Users/tristan/.local/share/virtualenvs/baz-8Eg-uX1t/lib/python3.11/site-packages/requests/utils.py", line 830 in get_environ_proxies
File "/Users/tristan/.local/share/virtualenvs/baz-8Eg-uX1t/lib/python3.11/site-packages/requests/sessions.py", line 761 in merge_environment_settings
File "/Users/tristan/.local/share/virtualenvs/baz-8Eg-uX1t/lib/python3.11/site-packages/requests/sessions.py", line 579 in request
File "/Users/tristan/.local/share/virtualenvs/baz-8Eg-uX1t/lib/python3.11/site-packages/hvac/adapters.py", line 331 in request
File "/Users/tristan/.local/share/virtualenvs/baz-8Eg-uX1t/lib/python3.11/site-packages/hvac/adapters.py", line 372 in request
File "/Users/tristan/.local/share/virtualenvs/baz-8Eg-uX1t/lib/python3.11/site-packages/hvac/adapters.py", line 110 in get
File "/Users/tristan/.local/share/virtualenvs/baz-8Eg-uX1t/lib/python3.11/site-packages/hvac/api/auth_methods/token.py", line 278 in lookup_self
File "/Users/tristan/.ansible/collections/ansible_collections/community/hashi_vault/plugins/module_utils/_auth_method_token.py", line 104 in authenticate
File "/Users/tristan/.ansible/collections/ansible_collections/community/hashi_vault/plugins/module_utils/_authenticator.py", line 95 in authenticate
File "/Users/tristan/.ansible/collections/ansible_collections/community/hashi_vault/plugins/lookup/hashi_vault.py", line 273 in run
File "/Users/tristan/.local/share/virtualenvs/baz-8Eg-uX1t/lib/python3.11/site-packages/ansible/template/__init__.py", line 1032 in _lookup
File "/Users/tristan/.local/share/virtualenvs/baz-8Eg-uX1t/lib/python3.11/site-packages/jinja2/runtime.py", line 290 in call
File "<template>", line 13 in root
File "/Users/tristan/.local/share/virtualenvs/baz-8Eg-uX1t/lib/python3.11/site-packages/ansible/template/__init__.py", line 1156 in do_template
File "/Users/tristan/.local/share/virtualenvs/baz-8Eg-uX1t/lib/python3.11/site-packages/ansible/template/__init__.py", line 886 in template
File "/Users/tristan/.local/share/virtualenvs/baz-8Eg-uX1t/lib/python3.11/site-packages/ansible/template/__init__.py", line 930 in template
File "/Users/tristan/.local/share/virtualenvs/baz-8Eg-uX1t/lib/python3.11/site-packages/ansible/playbook/base.py", line 650 in post_validate
File "/Users/tristan/.local/share/virtualenvs/baz-8Eg-uX1t/lib/python3.11/site-packages/ansible/playbook/task.py", line 285 in post_validate
File "/Users/tristan/.local/share/virtualenvs/baz-8Eg-uX1t/lib/python3.11/site-packages/ansible/executor/task_executor.py", line 515 in _execute
File "/Users/tristan/.local/share/virtualenvs/baz-8Eg-uX1t/lib/python3.11/site-packages/ansible/executor/task_executor.py", line 158 in run
File "/Users/tristan/.local/share/virtualenvs/baz-8Eg-uX1t/lib/python3.11/site-packages/ansible/executor/process/worker.py", line 163 in _run
File "/Users/tristan/.local/share/virtualenvs/baz-8Eg-uX1t/lib/python3.11/site-packages/ansible/executor/process/worker.py", line 124 in run
File "/Users/tristan/foo/bar/ansible/mitogen/ansible_mitogen/strategy.py", line 149 in <lambda>
File "/Users/tristan/foo/bar/ansible/mitogen/mitogen/core.py", line 647 in _profile_hook
File "/Users/tristan/foo/bar/ansible/mitogen/ansible_mitogen/strategy.py", line 148 in wrap_worker__run
File "/opt/homebrew/Cellar/python@3.11/3.11.4/Frameworks/Python.framework/Versions/3.11/lib/python3.11/multiprocessing/process.py", line 314 in _bootstrap
File "/opt/homebrew/Cellar/python@3.11/3.11.4/Frameworks/Python.framework/Versions/3.11/lib/python3.11/multiprocessing/popen_fork.py", line 71 in _launch
File "/opt/homebrew/Cellar/python@3.11/3.11.4/Frameworks/Python.framework/Versions/3.11/lib/python3.11/multiprocessing/popen_fork.py", line 19 in __init__
File "/opt/homebrew/Cellar/python@3.11/3.11.4/Frameworks/Python.framework/Versions/3.11/lib/python3.11/multiprocessing/context.py", line 281 in _Popen
File "/opt/homebrew/Cellar/python@3.11/3.11.4/Frameworks/Python.framework/Versions/3.11/lib/python3.11/multiprocessing/process.py", line 121 in start
File "/Users/tristan/.local/share/virtualenvs/baz-8Eg-uX1t/lib/python3.11/site-packages/ansible/executor/process/worker.py", line 91 in start
File "/Users/tristan/.local/share/virtualenvs/baz-8Eg-uX1t/lib/python3.11/site-packages/ansible/plugins/strategy/__init__.py", line 393 in _queue_task
File "/Users/tristan/foo/bar/ansible/mitogen/ansible_mitogen/strategy.py", line 291 in _queue_task
File "/Users/tristan/.local/share/virtualenvs/baz-8Eg-uX1t/lib/python3.11/site-packages/ansible/plugins/strategy/linear.py", line 315 in run
File "/Users/tristan/foo/bar/ansible/mitogen/ansible_mitogen/strategy.py", line 321 in <lambda>
File "/Users/tristan/foo/bar/ansible/mitogen/mitogen/core.py", line 647 in _profile_hook
File "/Users/tristan/foo/bar/ansible/mitogen/ansible_mitogen/strategy.py", line 320 in run
File "/Users/tristan/.local/share/virtualenvs/baz-8Eg-uX1t/lib/python3.11/site-packages/ansible/executor/task_queue_manager.py", line 321 in run
File "/Users/tristan/.local/share/virtualenvs/baz-8Eg-uX1t/lib/python3.11/site-packages/ansible/executor/playbook_executor.py", line 190 in run
File "/Users/tristan/.local/share/virtualenvs/baz-8Eg-uX1t/lib/python3.11/site-packages/ansible/cli/playbook.py", line 137 in run
File "/Users/tristan/.local/share/virtualenvs/baz-8Eg-uX1t/bin/ansible-playbook", line 128 in <module>
Extension modules: markupsafe._speedups, yaml._yaml, _cffi_backend, charset_normalizer.md (total: 4)
ERROR! A worker was found in a dead state
```
# Your environment
```
$ python -VV
Python 3.11.4 (main, Jun 7 2023, 00:34:59) [Clang 14.0.3 (clang-1403.0.22.14.1)]
```
on macOS 13.4 on arm (M1)
Note that I had the same issue on 3.10.12 and on some version (that I can't recall) of 3.9 before; long meant to report the bug but hadn't yet bothered
<!-- gh-linked-prs -->
### Linked PRs
* gh-112871
* gh-113133
* gh-113135
<!-- /gh-linked-prs -->
| 22511f77c2818a138a252e6ddae89725d082f8b0 | a723a13bf135306cdc5999a959596bfb487e8f4f |
python/cpython | python__cpython-105909 | # syntactical `__future__` import `barry_as_FLUFL` does not work in the REPL anymore
<!--
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 the "Users" category on discuss.python.org: https://discuss.python.org/c/users/7
- emailing the Python-list mailing list: https://mail.python.org/mailman/listinfo/python-list
- searching our issue tracker (https://github.com/python/cpython/issues) to see if
your problem has already been reported
-->
# Bug report
`from __future__ import barry_as_FLUFL` stops working in the REPL like before. Suspected issue comes from gh-99111.
Before problematic commit:
```py
>>> from __future__ import barry_as_FLUFL
>>> 2<>3
True
```
After problematic commit:
```py
>>> from __future__ import barry_as_FLUFL
>>> 2<>3
File "<stdin>", line 1
2<>3
^^
SyntaxError: invalid syntax
```
# Your environment
<!-- Include as many relevant details as possible about the environment you experienced the bug in -->
- CPython versions tested on: 3.12.0a7+, 3.13.0a0
- Operating system and architecture: 64-bit Win10
<!--
You can freely edit this text. Remove any lines you believe are unnecessary.
-->
<!-- gh-linked-prs -->
### Linked PRs
* gh-105909
* gh-105930
<!-- /gh-linked-prs -->
| 28187a9c4f95affe50fd37e0db0db177e2b9c2e9 | 1858db7cbdbf41aa600c954c15224307bf81a258 |
python/cpython | python__cpython-114035 | # Documentation for pathlib.Path.symlink_to is incorrectly constrained
# Documentation
The docs for `symlink_to` state:
> _target_is_directory_ must be true (default `False`) if the link’s target is a directory.
That's not precisely correct. I experimented and `symlink_to` seems to follow the same behavior as [os.symlink](https://docs.python.org/3/library/os.html#os.symlink), which provides the correct (though more complicated) guidance:
> If the target is present, the type of the symlink will be created to match. Otherwise, the symlink will be created as a directory if _target_is_directory_ is `True` or a file symlink (the default) otherwise.
That is, both calls will infer the type of the target if it's present. The caller need not pass _target_is_directory_ if the target is an extant directory. The `symlink_to` documentation is misleading and incorrect.
<!-- gh-linked-prs -->
### Linked PRs
* gh-114035
* gh-114464
* gh-114465
<!-- /gh-linked-prs -->
| b822b85ac11e73bbe4417bf03ee770ab116bb42d | 32c227470aa6f72950b76206ffc529c258b4b8fa |
python/cpython | python__cpython-105885 | # Allow eval and exec to take keyword arguments
# Feature or enhancement
Allow for `globals` and `locals` to be passed in as keyword arguments to `exec` and `eval`.
# Pitch
`exec` and `eval` both can take `globals` and `locals` as positional arguments.
The built-in functions documentation shows the argument defaults, and _every time_ I have the documentation open and am writing these, I default to keyword arguments, and it fails because the arguments are positional-only.
For functions like this that might only be present in a handful of places, kwargs give a good way to document what parameters each argument is referring to. I don't think that in a universe in which we were introducing `eval`/`exec` now that we would explicitly disallow kwargs.
# Previous discussion
I sent [this email](https://mail.python.org/archives/list/python-ideas@python.org/thread/AD37KVC4CP4HQD4D7VUJTCWSP4LKEZYB/) to `python-ideas`
# Extra Links
[Here is an implementation](https://github.com/rtpg/cpython/commit/c4368ef213a64297954fbca4f5308d69409d6a4b), which just consists in changing the argument clinic config and rerunning. I set up some very basic kwarg tests mostly to test the case of "locals provided but globals not provided", but fortunately the existing implementations already handled this cleanly!
<!-- gh-linked-prs -->
### Linked PRs
* gh-105885
* gh-121831
* gh-121852
<!-- /gh-linked-prs -->
| 2770d5caca42d48102f8e18210132a964c34af7c | 72867c962cc59c6d56805f86530696bea6beb039 |
python/cpython | python__cpython-105876 | # Bump required SQLite version to 3.15.2
(Also [posted on Discord](https://discuss.python.org/t/bump-sqlite-minimum-version-requirement/27999?u=erlendaasland).)
In January 2021 (mid 3.10 development), Sergey Fodoseev and I raised the compile time (and runtime) SQLite version requirements for the sqlite3 standard library extension module to SQLite [3.7.15](https://sqlite.org/releaselog/3_7_15.html) (2012-12-12) or newer (commit cf0b23908cc902ac38cd83dd7ca5afdf89e1543b). That enabled us to clean up the code by getting rid of a lot of preprocessor conditionals and other version specific workarounds.
For Python 3.13 (to be released October 2024), I'll raise the version requirements to either SQLite [3.8.11.1](https://sqlite.org/releaselog/3_8_11_1.html) (2015-07-29), [3.14.2](https://sqlite.org/releaselog/3_14_2.html) (2016-09-12), or [3.15.2](https://sqlite.org/releaselog/3_15_2.html) (2016-11-28). Preferably the latter.
AFAICS on [DistroWatch](https://distrowatch.com/dwres.php?resource=package-in-distro&pkg=sqlite), we should be fine with any of those SQLite versions, for all major distros[^1].
Major clean-ups:
- For SQlite 3.8.11.1, I can remove a lot of conditional code related to CTEs and deterministic functions.
- For SQLite 3.14.2 I no longer need to implement two different variants of the trace callback.
- For SQLite 3.15.2, I can remove special handling for legacy deterministic user function behaviour.
[^1]: RHEL-7.9 ships with SQLite 3.7.17 but is EOL in June 2024.
<!-- gh-linked-prs -->
### Linked PRs
* gh-105876
* gh-129599
* gh-129602
<!-- /gh-linked-prs -->
| 6849acb3feacda63ee43f1dc9be28fac1075ca7d | bc07c8f096791d678ca5c1e3486cb9648f7a027b |
python/cpython | python__cpython-105874 | # `_xxsubinterpreters`: the name of shared exception type is `str(exc_type)`, not `exc_type.__name__`
Example:
```python
>> import _xxsubinterpreters
>> i = _xxsubinterpreters.create()
>> _xxsubinterpreters.run_string(i, "(")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
_xxsubinterpreters.RunFailedError: <class 'SyntaxError'>: '(' was never closed (<string>, line 1)
```
It happens because in `_sharedexception_bind` %S format specifier is used and exception type is passed to `PyUnicode_FromFormat`, i. e. `PyObject_Str` is called on exception type in order to get its name:
https://github.com/python/cpython/blob/34e93d3998bab8acd651c50724eb1977f4860a08/Modules/_xxsubinterpretersmodule.c#L272
I'll send a PR soon.
<!-- gh-linked-prs -->
### Linked PRs
* gh-105874
<!-- /gh-linked-prs -->
| 69a39bd9ad52241ca0e9a1926b4536c73017d067 | 2ef1dc37f02b08536b677dd23ec51541a60effd7 |
python/cpython | python__cpython-105870 | # dataclasses: implicitly defined __dict__ and __weakref__ slots of inherited classes are ignored.
# Bug report
The __weakref__ slot is redefined when inherited from a class which didn't specify slots at all (and thus has a __dict__ and __weakref__ slots).
```
from dataclasses import dataclass
class A:
pass
@dataclass(slots=True, weakref_slot=True)
class B(A):
pass
```
gives the following error:
```
TypeError: __weakref__ slot disallowed: either we already got one, or __itemsize__ != 0
```
<!-- gh-linked-prs -->
### Linked PRs
* gh-105870
* gh-116978
* gh-116979
<!-- /gh-linked-prs -->
| a22d05f04c074dbb4f71e7837f54c0bb693db75d | 1d82a41235ac5619d36ac7e289fcbb686c1d9350 |
python/cpython | python__cpython-105880 | # Improve the constructors of AST nodes
Currently, the constructors for AST nodes accept arbitrary keyword arguments and don't enforce any value:
```pycon
>>> node=ast.FunctionDef(what="is this")
>>> node.what
'is this'
>>> node.name
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'FunctionDef' object has no attribute 'name'
```
Problems with the current situation:
- To make a correct AST node, you have to pass *every* attribute, including ones that could sensibly default to an empty list
- You cannot rely on attributes like `name` being present
- It's possible to create useless, broken AST nodes like the above
- Introspection tools can't easily tell what the signature of the constructor is supposed to be
- Adding new fields to an AST node causes various compatibility issues (#104799)
Proposed solution for 3.13:
- Default all fields to some sensible value if they are not provided to the constructor: an empty list for list fields, and None for other fields.
- Emit a DeprecationWarning if the constructor is passed arguments that it doesn't recognize (e.g., `what` above). In 3.15, this will raise an error.
- Add a `__text_signature__` to the AST classes indicating the expected signature.
<!-- gh-linked-prs -->
### Linked PRs
* gh-105880
* gh-116025
<!-- /gh-linked-prs -->
| d53560deb2c9ae12147201003fe63b266654ee21 | e72576c48b8be1e4f22c2f387f9769efa073c5be |
python/cpython | python__cpython-107986 | # asyncio subprocess stdin/out/err can be filehandles, but this is undocumented
# Documentation
I was trying to write some asyncio subprocess code to pipe from one process to another, struggled until I found examples with os.pipe(). But going back to the docs I was confused because passing a filehandle isn't mentioned as an option. Looking at the underlying code, I see it definitely _is_ supported, there's a check for the parameter being an integer and the handle is used directly.
The incorrect documentation is here https://github.com/python/cpython/blob/101d5ec7d7fe122fa81a377c8ab8b562d1add9ee/Doc/library/asyncio-eventloop.rst?plain=1#L1439-L1469
So instead of
```
* *stdin* can be any of these:
* a file-like object
* the :const:`subprocess.PIPE` constant (default) which will create a new
pipe and connect it,...
```
I'd suggest:
```
* *stdin* can be any of these:
* a file-like object
* an existing file descriptor (a positive integer), for example those created with :meth:`os.pipe()`,
* the :const:`subprocess.PIPE` constant (default) which will create a new
pipe and connect it,...
```
(and similarly for stdout and stderr)
<!-- gh-linked-prs -->
### Linked PRs
* gh-107986
* gh-108332
<!-- /gh-linked-prs -->
| 13966da71b693b1fae1a8ef66e34e2f0a90ec6c0 | 39de79b345f925ce3bbb79b33534872fe0c90877 |
python/cpython | python__cpython-105851 | # Clarify definition of "minor" vs "major" release
# Documentation
I noticed this in a discussion but it was off-topic there. Either I'm misreading things, but it seems like the definition of major and minor release is inconsistent in the documentation. See [this page](https://discuss.python.org/t/a-fast-free-threading-python/27903/10) (bold mine):
> Python’s C API is covered by the Backwards Compatibility Policy, [PEP 387](https://peps.python.org/pep-0387/). While the C API will change with every **minor release** (e.g. from 3.9 to 3.10), most changes will be source-compatible, typically by only adding new API. Changing existing API or removing API is only done after a deprecation period or to fix serious issues.
>
> CPython’s Application Binary Interface (ABI) is forward- and backwards-compatible across a **minor release** (if these are compiled the same way; see [Platform Considerations](https://docs.python.org/3/c-api/stable.html#stable-abi-platform) below). So, code compiled for Python 3.10.0 will work on 3.10.8 and vice versa, but will need to be compiled separately for 3.9.x and 3.10.x.
Here, the `11` in `3.11` is referred to as a minor release: the API can change when that changes, but within such a release it should be stable.
In other parts of Python documentation, most notably [python.org](https://www.python.org/downloads/release/python-3114/), 3.11 (or 3.10, etc) is referred to as a "major release".
The [FAQ](https://docs.python.org/3/faq/general.html#how-does-the-python-version-numbering-scheme-work) is less than clear on this (again bold mine):
> [How does the Python version numbering scheme work?](https://docs.python.org/3/faq/general.html#id9)[¶](https://docs.python.org/3/faq/general.html#how-does-the-python-version-numbering-scheme-work)
> Python versions are numbered “A.B.C” or “A.B”:
>
> * A is the major version number – it is only incremented for really major changes in the language.
> * B is the **minor version** number – it is incremented for less earth-shattering changes.
> * C is the micro version number – it is incremented for each bugfix release.
>
> See [PEP 6](https://peps.python.org/pep-0006/) for more information about bugfix releases.
>
> Not all releases are bugfix releases. In the run-up to a new **major release**, a series of development releases are made, denoted as alpha, beta, or release candidate. Alphas are early releases in which interfaces aren’t yet finalized; it’s not unexpected to see an interface change between two alpha releases. Betas are more stable, preserving existing interfaces but possibly adding new modules, and release candidates are frozen, making no changes except as needed to fix critical bugs.
Most of the time this is not a big concern but particularly for statements about long-term compatibility (like the C API page above) I think this is rather confusing.
<!-- gh-linked-prs -->
### Linked PRs
* gh-105851
* gh-105852
* gh-105853
* gh-105882
* gh-105892
* gh-105893
<!-- /gh-linked-prs -->
| 0bffe1acd78069ea21f6b1347bec9cc9747342cb | 0d0963737a0f4b7cadedfae7e8fd33ed18269289 |
python/cpython | python__cpython-105847 | # Assertion failure when specializing functions with too many `__defaults__`
When specializing some Python calls, we assert that we don't have more defaults than we have arguments. This isn't always true, though:
```py
>>> def f():
... pass
...
>>> f.__defaults__ = (None,)
>>> for _ in range(2):
... f()
...
python: Python/specialize.c:1650: specialize_py_call: Assertion `defcount <= argcount' failed.
Aborted
```
<!-- gh-linked-prs -->
### Linked PRs
* gh-105847
* gh-105863
* gh-105864
<!-- /gh-linked-prs -->
| 2beab5bdef5fa2a00a59371e6137f769586b7404 | b356a4749acb3e6f8c50e8abeb7b2d2b267738d7 |
python/cpython | python__cpython-105835 | # Untested code in `typing.py`
# Bug report
If you apply this diff to `typing.py`, all tests continue to pass:
```diff
diff --git a/Lib/typing.py b/Lib/typing.py
index 1dd9398344..98e19644a2 100644
--- a/Lib/typing.py
+++ b/Lib/typing.py
@@ -1931,6 +1931,7 @@ def _proto_hook(other):
if (isinstance(annotations, collections.abc.Mapping) and
attr in annotations and
issubclass(other, Generic) and getattr(other, '_is_protocol', False)):
+ 1/0
break
```
The `break` on line 1934 here is unreachable; thus, this whole block of code is pointless:
https://github.com/python/cpython/blob/3af2dc7588614c65e9d1178ad9b4a11a19c14dde/Lib/typing.py#L1929-L1934
I think we can say for sure that the `break` here is unreachable. This is the `__subclasshook__` method that is monkey-patched onto all subclasses of `typing.Protocol` that do not define their own `__subclasshook__` methods. This block of code in the `__subclasshook__` method is inspecting the `__annotations__` dictionary of `other` to see if it can find any protocol members in that dictionary. _But_ we know that there can't be any protocol members in the `__annotations__` dictionary, because if there were, that would make `other` a protocol with at least one non-callable member. If it's a protocol that has at least one non-callable member, the `__subclasshook__` method is never called at all during `isinstance()` or `issubclass()` checks, because we raise `TypeError` in `_ProtocolMeta.__subclasscheck__`, short-circuiting the call to `abc.ABCMeta.__subclasscheck__` that would call `Protocol.__subclasshook__`:
https://github.com/python/cpython/blob/3af2dc7588614c65e9d1178ad9b4a11a19c14dde/Lib/typing.py#L1828-L1831
I believe that this block of code can therefore be safely deleted.
<!-- gh-linked-prs -->
### Linked PRs
* gh-105835
* gh-105859
* gh-105860
<!-- /gh-linked-prs -->
| 70c075c194d3739ae10ce76265f05fa82ed46487 | 101d5ec7d7fe122fa81a377c8ab8b562d1add9ee |
python/cpython | python__cpython-105833 | # F-string debug mode does not print correctly when in last line of file
Where there's an f-string that has a debug expression in the last line of a file, the debug expression buffer is one character too short. For example:
```python3
```python3
cpython on main via C v14.0.3-clang via 🐍 pyenv 3.11.3 took 15s
❯ cat tmp/t.py
print(f'''{
3
=}''')%
cpython on main via C v14.0.3-clang via 🐍 pyenv 3.11.3
❯ ./python.exe tmp/t.py
3
3
```
A fix is already up as part of gh-105828, so just opening this to track the issue.
<!-- gh-linked-prs -->
### Linked PRs
* gh-105833
<!-- /gh-linked-prs -->
| 3af2dc7588614c65e9d1178ad9b4a11a19c14dde | d382ad49157b3802fc5619f68d96810def517869 |
python/cpython | python__cpython-108513 | # `concurrent.futures.ProcessPoolExecutor` pool deadlocks when submitting many tasks
# Bug report
Submitting many tasks to a `concurrent.futures.ProcessPoolExecutor` pool
deadlocks with all three start methods.
When running the same example with `multiprocessing.pool.Pool` we have NOT been
able to cause a deadlock.
Different set of parameters affect how likely it is to get a deadlock
1. All start methods `spawn`, `fork`, and `forkserver` exhibit the deadlock
(the examples below are with `spawn` method)
1. It's possible to get a deadlock with num_processes 1-24
1. As long as NUM_TASKS is high, TASK_DATA and TASK_SIZE can be low/removed and
still cause a hang. (see example script)
1. Set `DO_PRINT = False` for higher probability of hanging.
## Example stack trace excerpts in hanged scenarios
1. reading the queue:
* 1 thread stuck at:
```
read (libpthread-2.27.so)
recv_bytes (multiprocessing/connection.py:221)
get (multiprocessing/queues.py:103)
```
* other threads stuck at:
```
do_futex_wait.constprop.1 (libpthread-2.27.so)
_multiprocessing_SemLock_acquire_impl (semaphore.c:355)
get (multiprocessing/queues.py:102)
```
2. writing the queue:
* 1 thread stuck at:
```
write (libpthread-2.27.so)
send_bytes (multiprocessing/connection.py:205)
put (multiprocessing/queues.py:377)
```
* other threads stuck at:
```
do_futex_wait.constprop.1 (libpthread-2.27.so)
_multiprocessing_SemLock_acquire_impl (semaphore.c:355)
put (multiprocessing/queues.py:376)
```
# Example script exhibiting deadlock behavior
```py
#!/usr/bin/env python3
""" Example that hangs with concurrent.futures.ProcessPoolExecutor """
import multiprocessing
import concurrent.futures
# Tweaking parameters
NUM_TASKS = 500000
TASK_DATA = 1
TASK_SIZE = 1
DO_PRINT = True # Set to false for almost guaranteed hang
START_METHOD = "spawn" # Does not seem to matter
NUM_PROCESSES = 4 # multiprocessing.cpu_count()
def main():
print("Starting pool")
ctx = multiprocessing.get_context(START_METHOD)
with concurrent.futures.ProcessPoolExecutor(max_workers=NUM_PROCESSES,
mp_context=ctx) as pool:
future_results = submit_to_pool(pool)
print("Collecting results")
assert False # Never reached
collect_results(future_results)
def collect_results(future_results):
return [r.result() for r in future_results]
def submit_to_pool(pool):
future_results = []
for task_idx in range(NUM_TASKS):
if DO_PRINT and task_idx % 20000 == 0:
# Too much printing here makes the hang to go away!!!
print("\nsubmit", task_idx)
task_name = f"task{task_idx}" * TASK_DATA
future_results.append(pool.submit(task, task_idx, task_name))
return future_results
def task(task_idx, task_name):
""" Do some dummy work """
s = ""
for i in range(TASK_SIZE):
s += str(i)
if DO_PRINT:
# Too much printing here makes the hang to go away!!!
print(".", end="", flush=True)
if __name__ == "__main__":
main()
```
# Environment
* My environment:
* Ubuntu 18.04.6 LTS (bionic)
* Python 3.10.5
* My colleagues environment:
* Ubuntu 22.04.2 LTS (jammy)
* Either:
* Python 3.10.5
* Python 3.11.0rc1
# Details
Detailed stack traces in comments.
<!-- gh-linked-prs -->
### Linked PRs
* gh-108513
* gh-109783
* gh-109784
* gh-110129
<!-- /gh-linked-prs -->
| 405b06375a8a4cdb08ff53afade09a8b66ec23d5 | e94a2232eac07eb526ec93ef01699513cf9b0fa3 |
python/cpython | python__cpython-105822 | # `test___all__.AllTest.test_all` is failing on every PR
# Bug report
Following https://github.com/python/cpython/pull/105801, `test___all__.AllTest.test_all` is failing on every non-docs PR on the "Hypothesis tests on Ubuntu" CI job.
The traceback is:
```pytb
======================================================================
FAIL: test_all (test.test___all__.AllTest.test_all)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/test/test___all__.py", line 129, in test_all
self.check_all(modname)
File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/test/test___all__.py", line 43, in check_all
with warnings_helper.check_warnings(
File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/contextlib.py", line 144, in __exit__
next(self.gen)
File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/test/support/warnings_helper.py", line 185, in _filterwarnings
raise AssertionError("unhandled warning %s" % reraise[0])
AssertionError: unhandled warning {message : SyntaxWarning("invalid escape sequence '\\?'"), category : 'SyntaxWarning', filename : '/home/runner/work/cpython/cpython-ro-srcdir/Lib/test/test_httpservers.py', lineno : 445, line : None}
```
Example failures:
- https://github.com/python/cpython/actions/runs/5277208289/jobs/9544938249
- https://github.com/python/cpython/actions/runs/5274715744/jobs/9539462432?pr=105794
- https://github.com/python/cpython/actions/runs/5272447172/jobs/9534727485
This failure was visible in the CI for https://github.com/python/cpython/pull/105801 FYI
<!-- gh-linked-prs -->
### Linked PRs
* gh-105822
* gh-105824
* gh-108576
* gh-115519
<!-- /gh-linked-prs -->
| 09ce8c3b48f940eb8865330f029b8069854c3106 | c5111aec2bac464b6643e21fe0844c9b8c4c661a |
python/cpython | python__cpython-105828 | # `patchcheck.py` raises `SystemError` on `main`
# Bug report
Following #105801, running `python Tools/patchcheck/patchcheck.py` now results in `SystemError` being raised.
# To reproduce
1. Make any change to a `.py` file, e.g.:
```diff
--- a/Lib/test/test_fstring.py
+++ b/Lib/test/test_fstring.py
@@ -19,6 +19,7 @@
a_global = 'global variable'
+
```
2. Run `python Tools/patchcheck/patchcheck.py`:
```
C:\Users\alexw\coding\cpython>python Tools/patchcheck/patchcheck.py
Running Release|x64 interpreter...
Getting base branch for PR ... upstream/main
Getting the list of files that have been added/changed ... 1 file
Fixing Python file whitespace ... Traceback (most recent call last):
File "C:\Users\alexw\coding\cpython\Tools\patchcheck\patchcheck.py", line 325, in <module>
main()
File "C:\Users\alexw\coding\cpython\Tools\patchcheck\patchcheck.py", line 293, in main
normalize_whitespace(python_files)
File "C:\Users\alexw\coding\cpython\Tools\patchcheck\patchcheck.py", line 35, in call_fxn
result = fxn(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^
File "C:\Users\alexw\coding\cpython\Tools\patchcheck\patchcheck.py", line 188, in normalize_whitespace
and reindent.check(os.path.join(SRCDIR, path))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\alexw\coding\cpython\Tools\patchcheck\reindent.py", line 138, in check
if r.run():
^^^^^^^
File "C:\Users\alexw\coding\cpython\Tools\patchcheck\reindent.py", line 203, in run
for _token in tokens:
File "C:\Users\alexw\coding\cpython\Lib\tokenize.py", line 537, in _generate_tokens_from_c_tokenizer
for info in it:
SystemError: Negative size passed to PyUnicode_New
```
This failure was visible on the Azure Pipelines job on the PR FYI: https://dev.azure.com/Python/cpython/_build/results?buildId=130389&view=logs&j=256d7e09-002a-52d7-8661-29ee3960640e&t=3d7276d3-4e8d-5309-55ad-fb0b172d9925
# Your environment
```
Python 3.13.0a0 (heads/main:c5111aec2b, Jun 15 2023, 10:53:37) [MSC v.1932 64 bit (AMD64)] on win32
```
<!-- gh-linked-prs -->
### Linked PRs
* gh-105828
* gh-105832
<!-- /gh-linked-prs -->
| 3af2dc7588614c65e9d1178ad9b4a11a19c14dde | d382ad49157b3802fc5619f68d96810def517869 |
python/cpython | python__cpython-105910 | # GzipFile.flush doesn't flush compressor in 3.12 beta
<!--
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 the "Users" category on discuss.python.org: https://discuss.python.org/c/users/7
- emailing the Python-list mailing list: https://mail.python.org/mailman/listinfo/python-list
- searching our issue tracker (https://github.com/python/cpython/issues) to see if
your problem has already been reported
-->
# Bug report
The change to add buffering to `GzipFile.write` (gh-89550, #101251) broke the `GzipFile.flush` method. The flush method previously called `self.compress.flush`, but now it only flushes the IO objects and not the compressor (as a side effect, the zlib_mode argument is now ignored, although in my case I only use the default). Flushing the compressor is necessary to create synchronization points that can be used to decompress part of the stream.
Here is a test script, reduced from Tornado's use of GzipFile (see tornadoweb/tornado#3278 for the way this manifests in Tornado's test suite):
```python
import io
import gzip
import zlib
# Write two chunks to the same compressed stream. In real usage
# I send these chunks as two separate network messages, but in this
# test I just save them to two local variables.
data = io.BytesIO()
gzip_file = gzip.GzipFile(fileobj=data, mode="wb")
gzip_file.write(b"Hello World")
gzip_file.flush()
message1 = data.getvalue()
data.truncate(0)
data.seek(0)
gzip_file.write(b"Goodbye World")
gzip_file.close()
message2 = data.getvalue()
# Decode the two messages. Each one should decode separately,
# but in Python 3.12b2 the compressor was not flushed with
# Z_SYNC_FLUSH so the second message produces no output on its own
# and both messages are emitted when the second message is added
# to the decompressor's input.
#
# This results in the error
# AssertionError: [b'', b'Hello WorldGoodbye World']
decompressor = zlib.decompressobj(16 + zlib.MAX_WBITS)
messages = [decompressor.decompress(message1), decompressor.decompress(message2)]
assert messages == [b"Hello World", b"Goodbye World"], messages
```
# Your environment
<!-- Include as many relevant details as possible about the environment you experienced the bug in -->
- CPython versions tested on: The bug is present in 3.12b2; the above script passes on 3.11 and earlier
- Operating system and architecture: macOS and Linux
<!--
You can freely edit this text. Remove any lines you believe are unnecessary.
-->
<!-- gh-linked-prs -->
### Linked PRs
* gh-105910
* gh-105920
<!-- /gh-linked-prs -->
| 1858db7cbdbf41aa600c954c15224307bf81a258 | 7a56a4148c521969d64164d2776641f19e3ca9e8 |
python/cpython | python__cpython-105801 | # f-strings do not show warnings about invalid escapes
In 3.12 and 3.13, f-strings are not warning about invalid escapes that get warnings in real strings. This seems like a bug.
```
>>> f'\?'
'\\?'
>>> len(f'\?')
2
>>> '\?'
<stdin>:1: SyntaxWarning: invalid escape sequence '\?'
'\\?'
_Originally posted by @terryjreedy in https://github.com/python/cpython/issues/105784#issuecomment-1591828755_
<!-- gh-linked-prs -->
### Linked PRs
* gh-105801
* gh-105806
<!-- /gh-linked-prs -->
| 12b6d844d8819955508bd86db106f17516be3f77 | 698a0da7d440856a90b45964e9082b5a55387b80 |
python/cpython | python__cpython-105794 | # Support for not following symlinks in pathlib.Path.is_dir()
# Feature or enhancement
Add a *follow_symlinks* argument to [`pathlib.Path.is_dir()`](https://docs.python.org/3/library/pathlib.html#pathlib.Path.is_dir), defaulting to `True`
# Pitch
Pathlib's `walk()` and `glob()` implementations are built upon `os.scandir()`, which yields `os.DirEntry` objects. The interface for `os.DirEntry` is a rough subset of `pathlib.Path`, including the [`name`](https://docs.python.org/3/library/os.html#os.DirEntry.name) attribute and [`is_dir()`](https://docs.python.org/3/library/os.html#os.DirEntry.is_dir) method.
Pathlib only ever calls `os.scandir()` via a private `pathlib.Path._scandir()` method, currently defined as follows:
```python
def _scandir(self):
return os.scandir(self)
```
In future I'd like to add a `pathlib.AbstractPath` class with abstract `stat()`, `iterdir()` and `open()` methods.
The default implementation of `AbstractPath._scandir()` would use `iterdir()`:
```python
def _scandir(self):
return contextlib.nullcontext(list(self.iterdir()))
```
Note how it returns `AbstractPath` objects, and not `DirEntry` objects. This exploits the similarities of the `Path` and `DirEntry` APIs.
... but there's a problem!
The `os.DirEntry.is_dir()` method accepts a keyword-only `follow_symlinks` argument. Our globbing implementation requires us to set this argument. But the `Path.is_dir()` method does not accept this argument!
If we add a keyword-only *follow_symlinks* argument to `Path.is_dir()`, we make it compatible with `os.DirEntry.is_dir()`, which in turn allows us to build a `glob()` implementation upon user-defined `stat()` and `iterdir()` methods in a future `AbstractPath` class.
# Previous discussion
General discussion of `AbstractPath`: https://discuss.python.org/t/make-pathlib-extensible/3428
We added a *follow_symlinks* argument to `Path.exists()` in #89769 / #29655.
<!-- gh-linked-prs -->
### Linked PRs
* gh-105794
<!-- /gh-linked-prs -->
| 219effa876785408a87bd6acb37c07ee0d25f3f9 | 5d4dbf0e309255e5bce9e31d805a8f950ebf9161 |
python/cpython | python__cpython-108343 | # Python 3.11.4: Running "make test" fails under gcc 4.8.5 because both -std=gnu11 and -std=c++11 are specified when compiling _testcpp11ext
In Python 3.11.4, running "make test" fails under gcc 4.8.5 because both -std=gnu11 and -std=c++11 are specified when compiling _testcpp11ext.
Run the following:
```shell
./configure
make
make test EXTRATESTOPTS=test_cppext
```
Output:
```pytb
0:00:12 load avg: 0.92 [1/1/1] test_cppext failed (2 failures)
test test_cppext failed -- multiple errors occurred; run in verbose mode for details
running build_ext
building '_testcpp03ext' extension
creating build
creating build/temp.linux-x86_64-cpython-311
creating build/temp.linux-x86_64-cpython-311/home
creating build/temp.linux-x86_64-cpython-311/home/httpd
creating build/temp.linux-x86_64-cpython-311/home/httpd/wgvd-net
creating build/temp.linux-x86_64-cpython-311/home/httpd/wgvd-net/delme
creating build/temp.linux-x86_64-cpython-311/home/httpd/wgvd-net/delme/Python-3.11.4
creating build/temp.linux-x86_64-cpython-311/home/httpd/wgvd-net/delme/Python-3.11.4/Lib
creating build/temp.linux-x86_64-cpython-311/home/httpd/wgvd-net/delme/Python-3.11.4/Lib/test
gcc -std=gnu11 -pthread -Wsign-compare -DNDEBUG -g -O3 -Wall -fPIC -I/home/httpd/wgvd-net/delme/Python-3.11.4/build/test_python_130531æ/test_python_worker_130534æ/tempcwd/env/include -I/home/httpd/wgvd-net/delme/Python-3.11.4/Include -I/home/httpd/wgvd-net/delme/Python-3.11.4 -c /home/httpd/wgvd-net/delme/Python-3.11.4/Lib/test/_testcppext.cpp -o build/temp.linux-x86_64-cpython-311/home/httpd/wgvd-net/delme/Python-3.11.4/Lib/test/_testcppext.o -Werror -std=c++03
cc1plus: error: command line option ‘-std=gnu11’ is valid for C/ObjC but not for C++ [-Werror]
cc1plus: all warnings being treated as errors
error: command '/usr/bin/gcc' failed with exit code 1
running build_ext
building '_testcpp11ext' extension
creating build
creating build/temp.linux-x86_64-cpython-311
creating build/temp.linux-x86_64-cpython-311/home
creating build/temp.linux-x86_64-cpython-311/home/httpd
creating build/temp.linux-x86_64-cpython-311/home/httpd/wgvd-net
creating build/temp.linux-x86_64-cpython-311/home/httpd/wgvd-net/delme
creating build/temp.linux-x86_64-cpython-311/home/httpd/wgvd-net/delme/Python-3.11.4
creating build/temp.linux-x86_64-cpython-311/home/httpd/wgvd-net/delme/Python-3.11.4/Lib
creating build/temp.linux-x86_64-cpython-311/home/httpd/wgvd-net/delme/Python-3.11.4/Lib/test
gcc -std=gnu11 -pthread -Wsign-compare -DNDEBUG -g -O3 -Wall -fPIC -I/home/httpd/wgvd-net/delme/Python-3.11.4/build/test_python_130531æ/test_python_worker_130534æ/tempcwd/env/include -I/home/httpd/wgvd-net/delme/Python-3.11.4/Include -I/home/httpd/wgvd-net/delme/Python-3.11.4 -c /home/httpd/wgvd-net/delme/Python-3.11.4/Lib/test/_testcppext.cpp -o build/temp.linux-x86_64-cpython-311/home/httpd/wgvd-net/delme/Python-3.11.4/Lib/test/_testcppext.o -Werror -std=c++11
cc1plus: error: command line option ‘-std=gnu11’ is valid for C/ObjC but not for C++ [-Werror]
cc1plus: all warnings being treated as errors
error: command '/usr/bin/gcc' failed with exit code 1
== Tests result: FAILURE ==
1 test failed:
test_cppext
0:00:12 load avg: 0.92
0:00:12 load avg: 0.92 Re-running failed tests in verbose mode
0:00:12 load avg: 0.92 Re-running test_cppext in verbose mode (matching: test_build_cpp03, test_build_cpp11)
test_build_cpp03 (test.test_cppext.TestCPPExt.test_build_cpp03) ...
Run: /home/httpd/wgvd-net/delme/Python-3.11.4/python -X dev -m venv env
Run: env/bin/python -X dev /home/httpd/wgvd-net/delme/Python-3.11.4/Lib/test/setup_testcppext.py build_ext --verbose -std=c++03
running build_ext
building '_testcpp03ext' extension
creating build
creating build/temp.linux-x86_64-cpython-311
creating build/temp.linux-x86_64-cpython-311/home
creating build/temp.linux-x86_64-cpython-311/home/httpd
creating build/temp.linux-x86_64-cpython-311/home/httpd/wgvd-net
creating build/temp.linux-x86_64-cpython-311/home/httpd/wgvd-net/delme
creating build/temp.linux-x86_64-cpython-311/home/httpd/wgvd-net/delme/Python-3.11.4
creating build/temp.linux-x86_64-cpython-311/home/httpd/wgvd-net/delme/Python-3.11.4/Lib
creating build/temp.linux-x86_64-cpython-311/home/httpd/wgvd-net/delme/Python-3.11.4/Lib/test
gcc -std=gnu11 -pthread -Wsign-compare -DNDEBUG -g -O3 -Wall -fPIC -I/home/httpd/wgvd-net/delme/Python-3.11.4/build/test_python_130531æ/tempcwd/env/include -I/home/httpd/wgvd-net/delme/Python-3.11.4/Include -I/home/httpd/wgvd-net/delme/Python-3.11.4 -c /home/httpd/wgvd-net/delme/Python-3.11.4/Lib/test/_testcppext.cpp -o build/temp.linux-x86_64-cpython-311/home/httpd/wgvd-net/delme/Python-3.11.4/Lib/test/_testcppext.o -Werror -std=c++03
cc1plus: error: command line option ‘-std=gnu11’ is valid for C/ObjC but not for C++ [-Werror]
cc1plus: all warnings being treated as errors
error: command '/usr/bin/gcc' failed with exit code 1
ERROR
test_build_cpp11 (test.test_cppext.TestCPPExt.test_build_cpp11) ...
Run: /home/httpd/wgvd-net/delme/Python-3.11.4/python -X dev -m venv env
Run: env/bin/python -X dev /home/httpd/wgvd-net/delme/Python-3.11.4/Lib/test/setup_testcppext.py build_ext --verbose
running build_ext
building '_testcpp11ext' extension
creating build
creating build/temp.linux-x86_64-cpython-311
creating build/temp.linux-x86_64-cpython-311/home
creating build/temp.linux-x86_64-cpython-311/home/httpd
creating build/temp.linux-x86_64-cpython-311/home/httpd/wgvd-net
creating build/temp.linux-x86_64-cpython-311/home/httpd/wgvd-net/delme
creating build/temp.linux-x86_64-cpython-311/home/httpd/wgvd-net/delme/Python-3.11.4
creating build/temp.linux-x86_64-cpython-311/home/httpd/wgvd-net/delme/Python-3.11.4/Lib
creating build/temp.linux-x86_64-cpython-311/home/httpd/wgvd-net/delme/Python-3.11.4/Lib/test
gcc -std=gnu11 -pthread -Wsign-compare -DNDEBUG -g -O3 -Wall -fPIC -I/home/httpd/wgvd-net/delme/Python-3.11.4/build/test_python_130531æ/tempcwd/env/include -I/home/httpd/wgvd-net/delme/Python-3.11.4/Include -I/home/httpd/wgvd-net/delme/Python-3.11.4 -c /home/httpd/wgvd-net/delme/Python-3.11.4/Lib/test/_testcppext.cpp -o build/temp.linux-x86_64-cpython-311/home/httpd/wgvd-net/delme/Python-3.11.4/Lib/test/_testcppext.o -Werror -std=c++11
cc1plus: error: command line option ‘-std=gnu11’ is valid for C/ObjC but not for C++ [-Werror]
cc1plus: all warnings being treated as errors
error: command '/usr/bin/gcc' failed with exit code 1
ERROR
======================================================================
ERROR: test_build_cpp03 (test.test_cppext.TestCPPExt.test_build_cpp03)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/httpd/wgvd-net/delme/Python-3.11.4/Lib/test/test_cppext.py", line 24, in test_build_cpp03
self.check_build(True, '_testcpp03ext')
File "/home/httpd/wgvd-net/delme/Python-3.11.4/Lib/test/test_cppext.py", line 39, in check_build
self._check_build(std_cpp03, extension_name)
File "/home/httpd/wgvd-net/delme/Python-3.11.4/Lib/test/test_cppext.py", line 80, in _check_build
run_cmd('Build', cmd)
File "/home/httpd/wgvd-net/delme/Python-3.11.4/Lib/test/test_cppext.py", line 64, in run_cmd
subprocess.run(cmd, check=True)
File "/home/httpd/wgvd-net/delme/Python-3.11.4/Lib/subprocess.py", line 571, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['env/bin/python', '-X', 'dev', '/home/httpd/wgvd-net/delme/Python-3.11.4/Lib/test/setup_testcppext.py', 'build_ext', '--verbose', '-std=c++03']' returned non-zero exit status 1.
======================================================================
ERROR: test_build_cpp11 (test.test_cppext.TestCPPExt.test_build_cpp11)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/httpd/wgvd-net/delme/Python-3.11.4/Lib/test/test_cppext.py", line 21, in test_build_cpp11
self.check_build(False, '_testcpp11ext')
File "/home/httpd/wgvd-net/delme/Python-3.11.4/Lib/test/test_cppext.py", line 39, in check_build
self._check_build(std_cpp03, extension_name)
File "/home/httpd/wgvd-net/delme/Python-3.11.4/Lib/test/test_cppext.py", line 80, in _check_build
run_cmd('Build', cmd)
File "/home/httpd/wgvd-net/delme/Python-3.11.4/Lib/test/test_cppext.py", line 64, in run_cmd
subprocess.run(cmd, check=True)
File "/home/httpd/wgvd-net/delme/Python-3.11.4/Lib/subprocess.py", line 571, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['env/bin/python', '-X', 'dev', '/home/httpd/wgvd-net/delme/Python-3.11.4/Lib/test/setup_testcppext.py', 'build_ext', '--verbose']' returned non-zero exit status 1.
----------------------------------------------------------------------
```
# Your environment
```
Python 3.11.4
CentOS Linux release 7.9.2009 (Core)
gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)
```
<!-- gh-linked-prs -->
### Linked PRs
* gh-108343
* gh-108345
* gh-108347
<!-- /gh-linked-prs -->
| 9173b2bbe13aeccc075b571da05c653a2a91de1b | 3a1ac87f8f89d3206b46a0df4908afae629d669d |
python/cpython | python__cpython-106059 | # Remove `LOAD_CLOSURE`
`LOAD_CLOSURE` is identical to `LOAD_FAST_CHECK` in every way except its name and number.
The justification for its existence is that "We keep LOAD_CLOSURE so that the bytecode stays more readable.".
Which is insufficient justification to keep it given that it:
* Uses an instruction, a limited resource which adds bulk to the interpreter
* Prevents superinstruction formation.
* Prevents removal of checks for uninitialized variables.
<!-- gh-linked-prs -->
### Linked PRs
* gh-106059
<!-- /gh-linked-prs -->
| 8bff940ad69ce176dcd2b8e91d0b30ddd09945f1 | 3c70d467c148875f2ce17bacab8909ecc3e9fc1d |
python/cpython | python__cpython-106093 | # normalize() method of Decimal class does not always preserve value
I have encountered unexpected behavior while using the ```normalize()``` method of the ```Decimal``` class. I performed the following test using Python 3.10.10 and 3.11.4.
```python
from decimal import Decimal
v1 = Decimal("0.99999999999999999999999999999")
v2 = v1.normalize()
print(v1) # Output: 0.99999999999999999999999999999
print(v2) # Output: 1
assert(v1 == v2) # trigger AssertionError
```
Based on my understanding, the normalize() method is intended to produce a canonical representation of a decimal number. However, in this case, the values of v1 and v2 are not matching, leading to an AssertionError.
<!-- gh-linked-prs -->
### Linked PRs
* gh-106093
* gh-106128
* gh-106129
<!-- /gh-linked-prs -->
| a8210b6df1ed2793c484b3380182ba56c4254a4e | 0345b0c2bbf251a0f475cf53e0fb04c79a220e52 |
python/cpython | python__cpython-107519 | # "mem" and "object" Allocators are No Longer Protected by the GIL
Once we moved to per-interpreter GIL, the promises in [the docs](https://docs.python.org/3.12/c-api/memory.html#allocator-domains) no longer hold:
```
...where the allocation must be performed with the GIL held.
```
It's still fine for pymalloc, but any custom, non-wrapping "mem"/"object" allocators would need to be updated to be thread-safe or per-interpreter.
I have a PR up that does an okay job of adapting such allocators: gh-105619. However, it penalizes use of such an allocator in subinterpreters that have their own GIL.
Honestly, I'm leaning toward documenting that such allocators must be thread-safe or per-interpreter. From what I understand, the documented guarantees (in the docs and in PEP 445) are more about representing what pymalloc needs than what custom allocators need.
Perhaps the biggest question is: what projects would be impacted? I haven't had a chance yet to search for projects that use custom mem/object allocators that aren't thread-safe. I suspect there aren't more than two or three.
<!-- gh-linked-prs -->
### Linked PRs
* gh-107519
* gh-107522
* gh-109035
<!-- /gh-linked-prs -->
| db361a340af3970c279908c8746a6b9ed45f47b8 | fb344e99aa0da5bef9318684ade69978585fe060 |
python/cpython | python__cpython-105758 | # Rework test_ctypes
The ctypes module was first maintained outside Python, then moved into Python stdlib. Its test suite wasn't cleaned recently. I create this issue to track work on this topic.
<!-- gh-linked-prs -->
### Linked PRs
* gh-105758
* gh-105762
* gh-105768
* gh-105797
* gh-105798
* gh-105803
* gh-105814
* gh-105817
* gh-105818
* gh-105819
* gh-105826
* gh-107483
* gh-107484
* gh-107460
* gh-107501
* gh-107502
<!-- /gh-linked-prs -->
| ac7b551bde7a362bc77d2cb84accf755ac30eb09 | b87d2882754a7c273e2695c33384383eba380d7d |
python/cpython | python__cpython-105746 | # `webbrowsers.Konqueror` is broken
`webbrowsers.Konqueror` is broken after https://github.com/python/cpython/pull/102872#issuecomment-1589958849
It looks like `def open` was not removed from `Grail` and was moved to `Konqueror`.
Originially discovered by @vstinner in https://github.com/python/cpython/pull/102872#issuecomment-1589958849
<!-- gh-linked-prs -->
### Linked PRs
* gh-105746
* gh-105777
<!-- /gh-linked-prs -->
| e5d45b7444733861153d6e8959c34323fd361322 | 67f69dba0a2adc68c631bad5d970bdd22fc05d91 |
python/cpython | python__cpython-105734 | # ctypes: Deprecate SetPointerType() and ARRAY() functions
The ctypes module has two undocumented functions: SetPointerType() and ARRAY(). These functions are marked as ``XXX Deprecated``, but only in comments.
I propose to deprecate ``ctypes.SetPointerType()`` and ``ctypes.ARRAY()`` by emitting a DeprecationWarning warning.
These functions are not documented and not used in Python, but there are tested.
<!-- gh-linked-prs -->
### Linked PRs
* gh-105734
* gh-106576
* gh-122281
* gh-122440
<!-- /gh-linked-prs -->
| 2211454fe210637ed7fabda12690dac6cc9a8149 | b97e14a806477af4225777d215ac38c0d9b845f0 |
python/cpython | python__cpython-106035 | # More callables should be usable as Exception Group predicates
# Bug report
If a bound method is used as the condition for BaseExceptionGroup.split the following exception is raised:
> TypeError: expected a function, exception type or tuple of exception types
Consider the following example:
```python
class HandleError:
def __enter__(self):
pass
def __exit__(self, exc_type, exc_inst, exc_tb):
if exc_type is None:
return False
if isinstance(exc_inst, ExceptionGroup):
match, rest = exc_inst.split(self._log_and_ignore_error)
if match is None:
return False
elif rest is None:
return True
raise rest
else:
return self._log_and_ignore_error(exc_inst)
def _log_and_ignore_error(self, e: BaseException) -> bool:
...
return True
with HandleError():
raise ExceptionGroup('foo', [ValueError('bar')])
```
If we replace the bound method with a lambda (`lambda e: self._log_and_ignore_error(e)`) then no exception is raised.
I think it would be useful to accept any callable here. I guess the code update would be simple too, just replace **PyFunction_Check** with **PyCallable_Check** in
```c
if (PyFunction_Check(value)) {
*type = EXCEPTION_GROUP_MATCH_BY_PREDICATE;
return 0;
}
```
Update the exception message to allow callables, and change the assert in
```c
case EXCEPTION_GROUP_MATCH_BY_PREDICATE: {
assert(PyFunction_Check(matcher_value));
PyObject *exc_matches = PyObject_CallOneArg(matcher_value, exc);
```
to call **PyCallable_Check** again.
# Your environment
- CPython versions tested on: 3.11.2
The c code snippets are from origin/main.
<!-- gh-linked-prs -->
### Linked PRs
* gh-106035
<!-- /gh-linked-prs -->
| d8ca5a11bc55e2a69cab4f8795d0a5aa6932a41b | 1d33d5378058671bfabb6f4d4b5bfd4726973ff9 |
python/cpython | python__cpython-106771 | # `contextlib.ContextManager` doesn't contain `__slots__ = ()`
Python's ABCs should have `__slots__` attributes to not interfere with slotting in derived classes (especially when the class has no members). However, it is not the case for `contextlib.ContextManager` (as for other `contextlib` ABCs):
```python
from typing import ContextManager
class A(ContextManager[int]):
__slots__ = ()
__enter__ = __exit__ = lambda *args: None
A().a = 1 # No exception
```
Changing `ContextManager` to `MutableMapping`, for example (and setting relevant dunders), does raise an exception.
Observed on Ubuntu 20.04 and Python 3.9.16.
<!-- gh-linked-prs -->
### Linked PRs
* gh-106771
<!-- /gh-linked-prs -->
| 55408f86d78259f18c56c5e1ea51e0f8dcdbeb67 | cc25ca16ee406db936dfbd2337cbd14b12ccc4b7 |
python/cpython | python__cpython-105728 | # 3.12+: segfault tokenizing multiline fstring placeholder
# Bug report
```python
f'{
hello
}:{world}'
```
output:
```console
$ python3.12 -m tokenize t.py
free(): invalid pointer
Aborted (core dumped)
```
here's a backtrace:
```
(gdb) bt
#0 __pthread_kill_implementation (no_tid=0, signo=6, threadid=140737352824640)
at ./nptl/pthread_kill.c:44
#1 __pthread_kill_internal (signo=6, threadid=140737352824640)
at ./nptl/pthread_kill.c:78
#2 __GI___pthread_kill (threadid=140737352824640, signo=signo@entry=6)
at ./nptl/pthread_kill.c:89
#3 0x00007ffff7c42476 in __GI_raise (sig=sig@entry=6)
at ../sysdeps/posix/raise.c:26
#4 0x00007ffff7c287f3 in __GI_abort () at ./stdlib/abort.c:79
#5 0x00007ffff7c896f6 in __libc_message (action=action@entry=do_abort,
fmt=fmt@entry=0x7ffff7ddbb8c "%s\n") at ../sysdeps/posix/libc_fatal.c:155
#6 0x00007ffff7ca0d7c in malloc_printerr (
str=str@entry=0x7ffff7dd9764 "free(): invalid pointer")
at ./malloc/malloc.c:5664
#7 0x00007ffff7ca2ac4 in _int_free (av=<optimized out>, p=<optimized out>,
have_lock=0) at ./malloc/malloc.c:4439
#8 0x00007ffff7ca54d3 in __GI___libc_free (mem=<optimized out>)
at ./malloc/malloc.c:3391
#9 0x000055555572430d in PyMem_RawFree (ptr=<optimized out>)
at Objects/obmalloc.c:685
#10 _PyObject_Free (ctx=<optimized out>, p=<optimized out>)
at Objects/obmalloc.c:1853
#11 _PyObject_Free (ctx=<optimized out>, p=<optimized out>)
at Objects/obmalloc.c:1843
#12 0x000055555569540c in _PyTokenizer_Free (tok=0x555555d113a0)
at Parser/tokenizer.c:1007
#13 0x00005555557cddeb in tokenizeriter_dealloc (it=0x7ffff7427f10)
at Python/Python-tokenize.c:280
#14 0x00005555558065aa in Py_DECREF (op=<optimized out>)
at ./Include/object.h:692
#15 Py_XDECREF (op=<optimized out>) at ./Include/object.h:788
#16 _PyFrame_ClearExceptCode (frame=0x7ffff74b38d8) at Python/frame.c:140
#17 0x00005555557de92f in clear_gen_frame (frame=0x7ffff74b38d8,
tstate=0x555555c17c68 <_PyRuntime+459432>) at Python/ceval.c:1492
#18 _PyEvalFrameClearAndPop (frame=0x7ffff74b38d8,
tstate=0x555555c17c68 <_PyRuntime+459432>) at Python/ceval.c:1504
#19 _PyEvalFrameClearAndPop (tstate=0x555555c17c68 <_PyRuntime+459432>,
frame=0x7ffff74b38d8) at Python/ceval.c:1498
#20 0x0000555555655e4f in _PyEval_EvalFrameDefault (tstate=<optimized out>,
--Type <RET> for more, q to quit, c to continue without paging--c
frame=0x7ffff74c2c88, throwflag=<optimized out>) at Python/bytecodes.c:724
#21 0x00005555556dabfd in _PyEval_EvalFrame (throwflag=0, frame=0x7ffff74c2c88, tstate=<optimized out>) at ./Include/internal/pycore_ceval.h:87
#22 gen_send_ex2 (closing=0, exc=0, presult=<synthetic pointer>, arg=0x0, gen=0x7ffff74c2c40) at Objects/genobject.c:230
#23 gen_iternext (gen=0x7ffff74c2c40) at Objects/genobject.c:608
#24 0x00005555556f08e9 in list_extend (self=self@entry=0x7ffff7313400, iterable=iterable@entry=0x7ffff74c2c40) at Objects/listobject.c:944
#25 0x00005555556f0f68 in list___init___impl (iterable=0x7ffff74c2c40, self=0x7ffff7313400) at Objects/listobject.c:2792
#26 list___init___impl (iterable=0x7ffff74c2c40, self=0x7ffff7313400) at Objects/listobject.c:2778
#27 list_vectorcall (type=<optimized out>, args=<optimized out>, nargsf=<optimized out>, kwnames=<optimized out>) at Objects/listobject.c:2817
#28 0x00005555556bcce3 in _PyObject_VectorcallTstate (kwnames=<optimized out>, nargsf=<optimized out>, args=0x7ffff74c7b40, callable=0x555555abe780 <PyList_Type>, tstate=0x555555c17c68 <_PyRuntime+459432>) at ./Include/internal/pycore_call.h:92
#29 PyObject_Vectorcall (callable=callable@entry=0x555555abe780 <PyList_Type>, args=args@entry=0x7ffff7fb0318, nargsf=<optimized out>, kwnames=<optimized out>) at Objects/call.c:325
#30 0x0000555555657503 in _PyEval_EvalFrameDefault (tstate=<optimized out>, frame=0x7ffff7fb0248, throwflag=<optimized out>) at Python/bytecodes.c:2744
#31 0x00005555557def2f in _PyEval_EvalFrame (throwflag=0, frame=0x7ffff7fb01b8, tstate=0x555555c17c68 <_PyRuntime+459432>) at ./Include/internal/pycore_ceval.h:87
#32 _PyEval_Vector (args=0x0, argcount=0, kwnames=0x0, locals=0x7ffff75fd4c0, func=0x7ffff75a04a0, tstate=0x555555c17c68 <_PyRuntime+459432>) at Python/ceval.c:1610
#33 PyEval_EvalCode (co=co@entry=0x555555ca11f0, globals=globals@entry=0x7ffff75fd4c0, locals=locals@entry=0x7ffff75fd4c0) at Python/ceval.c:567
#34 0x00005555557dc5b0 in builtin_exec_impl (module=<optimized out>, closure=<optimized out>, locals=0x7ffff75fd4c0, globals=0x7ffff75fd4c0, source=0x555555ca11f0) at Python/bltinmodule.c:1079
#35 builtin_exec (module=<optimized out>, args=<optimized out>, nargs=<optimized out>, kwnames=<optimized out>) at Python/clinic/bltinmodule.c.h:583
#36 0x000055555571a943 in cfunction_vectorcall_FASTCALL_KEYWORDS (func=0x7ffff7595d00, args=0x7ffff7fb0180, nargsf=<optimized out>, kwnames=<optimized out>) at Objects/methodobject.c:438
#37 0x00005555556bcce3 in _PyObject_VectorcallTstate (kwnames=<optimized out>, nargsf=<optimized out>, args=0x7ffff75fd4c0, callable=0x7ffff7595d00, tstate=0x555555c17c68 <_PyRuntime+459432>) at ./Include/internal/pycore_call.h:92
#38 PyObject_Vectorcall (callable=callable@entry=0x7ffff7595d00, args=args@entry=0x7ffff7fb0180, nargsf=<optimized out>, kwnames=<optimized out>) at Objects/call.c:325
#39 0x0000555555657503 in _PyEval_EvalFrameDefault (tstate=<optimized out>, frame=0x7ffff7fb00d8, throwflag=<optimized out>) at Python/bytecodes.c:2744
#40 0x0000555555866e39 in pymain_run_module (modname=<optimized out>, set_argv0=set_argv0@entry=1) at Modules/main.c:300
#41 0x00005555558674a7 in pymain_run_python (exitcode=0x7fffffffde40) at Modules/main.c:604
#42 0x0000555555867f70 in Py_RunMain () at Modules/main.c:688
#43 pymain_main (args=0x7fffffffde00) at Modules/main.c:718
#44 Py_BytesMain (argc=<optimized out>, argv=<optimized out>) at Modules/main.c:742
#45 0x00007ffff7c29d90 in __libc_start_call_main (main=main@entry=0x5555556519e0 <main>, argc=argc@entry=4, argv=argv@entry=0x7fffffffdf88) at ../sysdeps/nptl/libc_start_call_main.h:58
#46 0x00007ffff7c29e40 in __libc_start_main_impl (main=0x5555556519e0 <main>, argc=4, argv=0x7fffffffdf88, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffdf78) at ../csu/libc-start.c:392
#47 0x000055555565e585 in _start ()
```
# Your environment
<!-- Include as many relevant details as possible about the environment you experienced the bug in -->
- CPython versions tested on: 8da9d1b16319f4a6bd78435016ef1f4bef6e2b41
- Operating system and architecture: ubuntu 22.04 x86_64
<!--
You can freely edit this text. Remove any lines you believe are unnecessary.
-->
<!-- gh-linked-prs -->
### Linked PRs
* gh-105728
* gh-105729
<!-- /gh-linked-prs -->
| abfbab6415fb029e7dca19ecc8d29a13da37bf71 | d0f1afd9425e28409fbf535bb7d43472bfcffcef |
python/cpython | python__cpython-109921 | # _xxsubinterpreters.run_string() doesn't allow subthreads to be running still
Currently `_xxsubinterpreters.run_string()` fails if the interpreter has other threads running, e.g. subthreads created by a previous `run_string()` call. This should be fixed to allow other threads to be running.
<!-- gh-linked-prs -->
### Linked PRs
* gh-109921
* gh-110707
* gh-112500
* gh-117049
* gh-117140
<!-- /gh-linked-prs -->
| 5a76d1be8ef371b75ca65166726923c249b5f615 | bbee57fa8c318cb26d6c8651254927a1972c9738 |
python/cpython | python__cpython-105723 | # 3.12+: tokenize of mixed tabs and spaces now produces an error
I read the parts in [here](https://docs.python.org/3.12/whatsnew/3.12.html#changes-in-the-python-api) and it does mention that some `ERRORTOKEN`s will be converted to exceptions but it doesn't seem to cover this case.
this breaks the `E101` check in `pycodestyle` (or I guess more specifically turns it into a syntax error)
this is probably fine? but should be called out in the documentation ?
# Bug report
```python
if True:
print(1) # indented with spaces
print(2) # indented with tab
```
```console
$ python3.11 -m tokenize t.py
0,0-0,0: ENCODING 'utf-8'
1,0-1,2: NAME 'if'
1,3-1,7: NAME 'True'
1,7-1,8: OP ':'
1,8-1,9: NEWLINE '\n'
2,0-2,4: INDENT ' '
2,4-2,9: NAME 'print'
2,9-2,10: OP '('
2,10-2,11: NUMBER '1'
2,11-2,12: OP ')'
2,12-2,13: NEWLINE '\n'
3,0-3,1: INDENT '\t'
3,1-3,6: NAME 'print'
3,6-3,7: OP '('
3,7-3,8: NUMBER '2'
3,8-3,9: OP ')'
3,9-3,10: NEWLINE '\n'
4,0-4,0: DEDENT ''
4,0-4,0: DEDENT ''
4,0-4,0: ENDMARKER ''
$ python3.12 -m tokenize t.py
t.py:3:10: error: inconsistent use of tabs and spaces in indentation
```
# Your environment
- CPython versions tested on: d310fc776e
- Operating system and architecture: ubuntu 22.04 x86_64
<!--
You can freely edit this text. Remove any lines you believe are unnecessary.
-->
<!-- gh-linked-prs -->
### Linked PRs
* gh-105723
* gh-105725
<!-- /gh-linked-prs -->
| ed8217b493e19cea0f3f539e55b592c09ceb9323 | c3d2d64b4c53203719466b32df60ea76f7312891 |
python/cpython | python__cpython-105740 | # Crash During Subinterpreter Finalization
There's an isolation leak somewhere. It may be just in the _xxsubinterpreters module, but I suspect it's not.
See https://github.com/python/cpython/pull/99114#issuecomment-1520952650.
Reproducers:
* https://gist.github.com/tonybaloney/262986212e1061b97908657a53a605d6
* https://gist.github.com/tonybaloney/504be6d1541610f50963c32a3f1c379d
FYI, I see crashes on this fairly infrequently.
<!-- gh-linked-prs -->
### Linked PRs
* gh-105740
* gh-105765
* gh-106899
* gh-106923
* gh-106930
* gh-106963
* gh-106964
* gh-106966
* gh-106974
* gh-107012
* gh-107354
* gh-107357
* gh-107412
* gh-107572
* gh-107783
* gh-112483
<!-- /gh-linked-prs -->
| b87d2882754a7c273e2695c33384383eba380d7d | fcf0647cf2a78de2c2b603af2709d58c8567df67 |
python/cpython | python__cpython-105688 | # Remove deprecated `re.template`, `re.T`, `re.TEMPLATE`
# Feature or enhancement
It is time to remove deprecated stuff from `re` module.
The 3.11 says:
> The :func:`re.template` function and the corresponding :const:`re.TEMPLATE`
and :const:`re.T` flags are deprecated, as they were undocumented and
lacked an obvious purpose. They will be removed in Python 3.13.
# Pitch
I think that now there are no things that stop us from doing so, all issues were settled in https://github.com/python/cpython/issues/92728
# Previous discussion
Previous discussion: https://github.com/python/cpython/issues/92728
Initial removal: https://github.com/python/cpython/commit/b09184bf05b07b77c5ecfedd4daa846be3cbf0a9
Revert of the removal + deprecation: https://github.com/python/cpython/commit/16a7e4a0b75080275bf12cfb71d54b01d85099b2
PR is on its way.
<!-- gh-linked-prs -->
### Linked PRs
* gh-105688
<!-- /gh-linked-prs -->
| 67f69dba0a2adc68c631bad5d970bdd22fc05d91 | fb655e0c4581ca4bed80db0a083884b29fe142d2 |
python/cpython | python__cpython-105685 | # Get rid of _set_task_name in asyncio
It is already deprecated to have a task which doesn't not supports the name, its time to get rid of this old workaround.
<!-- gh-linked-prs -->
### Linked PRs
* gh-105685
<!-- /gh-linked-prs -->
| 840d02f3f0cd341207db6d918ce7f0987be9952e | 829ac13b69a2b53153e1b40670e6ef82f05130c1 |
python/cpython | python__cpython-105680 | # Remove irregular stack effects
As we move towards generating more components from the instruction definition file (bytecodes.c), it helps if the instructions have regular formats and stack effects.
Currently the stack effects can be simple, variable, conditional or complex.
* Simple: Does not depend on the operand (`oparg`)
* Variable: Either pops or pushes `oparg * k` items.
* Conditional: Pushes a value conditional on `oparg & 1`
* Complex: The stack effect depends on a set of flags embedded in `oparg`.
We can easily get rid of the complex case. There are only two cases, `MAKE_FUNCTION` and `FORMAT_VALUE`. Both can easily broken down into simple (and faster) parts.
We might want to get rid of condition stack effects, as it would simplify things, but performance may suffer as both `LOAD_GLOBAL` and `LOAD_ATTR` are conditional and they are performance critical.
<!-- gh-linked-prs -->
### Linked PRs
* gh-105680
* gh-105843
<!-- /gh-linked-prs -->
| 09ffa69e2e84950751739ab500f820725e00a3dd | 217589d4f3246d67c6ef0eb0be2b1c33987cf260 |
python/cpython | python__cpython-105674 | # New warning: `‘value’ may be used uninitialized in this function [-Wmaybe-uninitialized]`
<img width="981" alt="Снимок экрана 2023-06-12 в 09 10 49" src="https://github.com/python/cpython/assets/4660275/84a2242a-d8d3-4777-9886-ae64c67d79f2">
I am working on a fix already.
<!-- gh-linked-prs -->
### Linked PRs
* gh-105674
* gh-105675
* gh-105676
<!-- /gh-linked-prs -->
| a8d69fe92c65d636fc454cfb1825c357eb2e6325 | 58f5227d7cdff803609a0bda6882997b3a5ec4bf |
python/cpython | python__cpython-109384 | # 3.12 tracing regression: a conditional in a finally block will revisit the condition before exiting the block.
Python 3.12 introduced a change in tracing behavior. Now a conditional in a finally block will revisit the condition before exiting the block.
Here is test.py:
```python
import sys
print(sys.version)
def example(raise_exc: bool, enter_finally_cond: bool):
try:
if raise_exc:
print("raising exception")
raise Exception
print("not raising exception")
finally:
if enter_finally_cond:
print("in finally conditional")
print("after finally")
try:
example(raise_exc=True, enter_finally_cond=True)
except:
pass
```
When traced under 3.11:
```
% python3.11 -m trace --trace test.py
--- modulename: test, funcname: <module>
test.py(1): import sys
test.py(2): print(sys.version)
3.11.4 (main, Jun 7 2023, 08:42:37) [Clang 14.0.3 (clang-1403.0.22.14.1)]
test.py(4): def example(raise_exc: bool, enter_finally_cond: bool):
test.py(16): try:
test.py(17): example(raise_exc=True, enter_finally_cond=True)
--- modulename: test, funcname: example
test.py(5): try:
test.py(6): if raise_exc:
test.py(7): print("raising exception")
raising exception
test.py(8): raise Exception
test.py(11): if enter_finally_cond:
test.py(12): print("in finally conditional")
in finally conditional
test.py(18): except:
test.py(19): pass
```
When traced under 3.12:
```
% python3.12 -m trace --trace test.py
--- modulename: test, funcname: <module>
test.py(1): import sys
test.py(2): print(sys.version)
3.12.0b2 (main, Jun 7 2023, 08:47:18) [Clang 14.0.3 (clang-1403.0.22.14.1)]
test.py(4): def example(raise_exc: bool, enter_finally_cond: bool):
test.py(16): try:
test.py(17): example(raise_exc=True, enter_finally_cond=True)
--- modulename: test, funcname: example
test.py(5): try:
test.py(6): if raise_exc:
test.py(7): print("raising exception")
raising exception
test.py(8): raise Exception
test.py(11): if enter_finally_cond:
test.py(12): print("in finally conditional")
in finally conditional
test.py(11): if enter_finally_cond: # <******
test.py(18): except:
test.py(19): pass
```
The extra line is marked with `<******`. There's no reason for the if statement to be traced again.
<!-- gh-linked-prs -->
### Linked PRs
* gh-109384
* gh-109411
<!-- /gh-linked-prs -->
| 4a54074a0f5579d417445ec28427cd0ed5aa01f4 | 1ce9ea0453f7dc69dd41684f3bc9310259513de8 |
python/cpython | python__cpython-105628 | # Change the default return value of `HTTPConnection.get_proxy_response_headers` from `{}` to `None`
See my reasoning here: https://github.com/python/cpython/pull/104248#issuecomment-1585579473
<!-- gh-linked-prs -->
### Linked PRs
* gh-105628
* gh-106738
<!-- /gh-linked-prs -->
| 490295d651d04ec3b3eff2a2cda7501191bad78a | 025995feadaeebeef5d808f2564f0fd65b704ea5 |
python/cpython | python__cpython-105887 | # Poor performance on logging.RotatingFileHandler due to fix to #89564
The fix to #89564 produced a significant performance degradation when logs are on an NFS filesystem. The fix for #89564 was for a bug found with the TimedRotatingFileHandler but an fix was added to the sized base file rotator too.
Here is the RotatingFileHandler.shouldRollover() function. The os.path.exists() and os.path.isfile() are very slow on NFS filesystems. On Linux systems, if os.path.isfile() returns False, the self.stream.seek(0,2) will always return 0 because the file is not seekable so non-isfile() files will never be rotated unless the rotation size is smaller than the message size.
Since, the rollover could be triggered with a very large msg and small maxBytes. Moving the exists() and isfile() check to inside the `if self.stream.tell()...` would cover that case and not run the expensive status operations with a correctly configured logger except when the rotation is needed. That is similar to the fix made to the TimedRotatingFileHandler in #96159.
```
def shouldRollover(self, record):
"""
Determine if rollover should occur.
Basically, see if the supplied record would cause the file to exceed
the size limit we have.
"""
# See bpo-45401: Never rollover anything other than regular files
if os.path.exists(self.baseFilename) and not os.path.isfile(self.baseFilename):
return False
if self.stream is None: # delay was set...
self.stream = self._open()
if self.maxBytes > 0: # are we rolling over?
msg = "%s\n" % self.format(record)
self.stream.seek(0, 2) #due to non-posix-compliant Windows feature
if self.stream.tell() + len(msg) >= self.maxBytes:
return True
return False
```
<!-- gh-linked-prs -->
### Linked PRs
* gh-105887
* gh-121116
* gh-121117
<!-- /gh-linked-prs -->
| e9b4ec614b66d11623b80471409c16a109f888d5 | 0890ad7c024ccf29614849b6ffadcb92c0e91ce7 |
python/cpython | python__cpython-105620 | # Rename "own_gil" Field of PyInterpreterConfig to "gil"
We've added the `PyInterpreterConfig` struct in 3.12. For PEP 684 (per-interpreter GIL), likewise 3.12, we added a new int-boolean field, "own_gil", to indicate if `PyInterpreterState.ceval.gil` should point to the interpreter's own GIL.
Having finally just read through PEP 703 (no-gil), I realized that it would probably be useful to change that field to support a number of different values, rather than just a binary situation. Consequently, I'm proposing we change the field as follows (more or less):
```C
#define PyInterpreterConfig_SHARED_GIL 1 /* shared with main interpreter, so PyInterpreterConfig_MAIN_GIL? */
#define PyInterpreterConfig_OWN_GIL 2
typedef struct {
...
int gil;
...
} PyInterpreterConfig;
```
That would give us more flexibility for other possible future scenarios (e.g. no-gil), where "own_gil" wouldn't make sense.
----
Changing this in 3.12, even though we're past feature freeze, would be good so we don't have to live with a deprecated field in the struct. I'd be surprised if anyone was really using `PyInterpreterConfig` yet, and the change will be very focused, so we should be okay to make this change so late in the game.
CC @Yhg1s
<!-- gh-linked-prs -->
### Linked PRs
* gh-105620
* gh-105731
<!-- /gh-linked-prs -->
| b97e14a806477af4225777d215ac38c0d9b845f0 | abfbab6415fb029e7dca19ecc8d29a13da37bf71 |
python/cpython | python__cpython-105589 | # Some object-to-AST conversions are missing error checks
The generated code in `Python-ast.c` is missing error checks following the construction of C-level `alias`, `arg`, `comprehension`, `keyword`, `match_item`, and `withitem` nodes from their Python object counterparts. This means it's possible to crash the interpreter by attempting to compile an AST where a required member of these nodes is replaced with `None`:
```py
>>> import ast
>>> tree = ast.parse("""
... match ...:
... case THIS:
... ...
... """)
>>> tree.body[0].cases[0].pattern = None
>>> compile(tree, "<crash>", "exec")
Segmentation fault
```
I'll have a PR up in a minute with the one-line fix.
<!-- gh-linked-prs -->
### Linked PRs
* gh-105589
* gh-105838
* gh-105839
<!-- /gh-linked-prs -->
| a4056c8f9c2d9970d39e3cb6bffb255cd4b8a42c | 3af2dc7588614c65e9d1178ad9b4a11a19c14dde |
python/cpython | python__cpython-105638 | # 3.12.0b2: "Assertion failed: immortal object has less refcnt than expected _Py_IMMORTAL_REFCNT"
# Crash report
When I run [my project](https://qutebrowser.org/) with Python 3.12, sometimes on exit I get the error below.
~~Given the circumstances, it seems almost impossible to construct a minimal example with this. I'd appreciate more information on how to best track the source of this down...~~ See comments below for a simpler reproducer.
If you want to try reproducing as is, getting a `--with-pydebug` Python 3.12.0b2 and then installing `requirements.txt` and `misc/requirements/requirements-pyqt-6.txt` followed by a `python3 -m qutebrowser --temp-basedir --debug ":later 2000 quit"` should do the trick.
Note that sometimes it segfaults on exit instead, which seems to be a different issue: https://www.riverbankcomputing.com/pipermail/pyqt/2023-June/045331.html
# Error messages
```
./Include/internal/pycore_global_objects_fini_generated.h:15: _PyStaticObject_CheckRefcnt: Assertion failed: immortal object has less refcnt than expected _Py_IMMORTAL_REFCNT
Enable tracemalloc to get the memory block allocation traceback
object address : 0x55e98b6cb508
object refcount : 4294967294
object type : 0x55e98b5cb6c0
object type name: bytes
object repr : b'x'
Fatal Python error: _PyObject_AssertFailed: _PyObject_AssertFailed
Python runtime state: finalizing (tstate=0x000055e98b737490)
Current thread 0x00007fca714f5740 (most recent call first):
<no Python frame>
```
This is already with `-X tracemalloc`, I also tried `PYTHONTRACEMALLOC=25` instead. It seems I can't get more information about what's happening there. Happy to go dig into this more e.g. via gdb if someone can tell me what to look for.
# Your environment
- CPython versions tested on: 3.12.0b2 with `--with-pydebug`
- Operating system and architecture: Archlinux, amd64
<!-- gh-linked-prs -->
### Linked PRs
* gh-105638
* gh-105769
<!-- /gh-linked-prs -->
| 6199fe3b3236748033a7ce2559aeddb5a91bbbd9 | dab5a3ebe8063e7ad39c9ba04421d8fe11927d43 |
python/cpython | python__cpython-105780 | # Deprecate unusual ways of creating empty TypedDicts
# Feature or enhancement
I propose that we deprecate the following two ways of creating empty `TypedDict`s:
```py
from typing import TypedDict
T = TypedDict("T")
T2 = TypedDict("T2", None)
```
# Pitch
Users currently have four distinct options if they want to create an empty `TypedDict` with no fields:
```py
T = TypedDict("T")
T2 = TypedDict("T2", None)
T3 = TypedDict("T3", {})
class T4(TypedDict): ...
```
Of these four options, only `T3` and `T4` are supported by type checkers. `typing.TypedDict` has been around for a while now, so if `T1` and `T2` are still unsupported by type checkers, they probably never will be supported.
Deprecating, and eventually removing, the first two ways of constructing empty TypedDicts will allow us to simplify the code at runtime. It will also be less confusing for users. Every way in which the runtime and type checkers differ in behaviour is a potential point of confusion for users; in general, we should work to keep these points of difference to a minimum.
I also don't think these methods of constructing empty TypedDicts are particularly common.
# Previous discussion
For very similar reasons, we previously deprecated and removed the keyword-argument syntax for creating TypedDicts. This was deprecated in 3.11, and removed in 3.13:
- https://github.com/python/cpython/issues/90224
- https://github.com/python/cpython/issues/104786
In retrospect, we should really have deprecated these ways of creating empty TypedDicts at the same time. But there's no way of changing that now.
<!-- gh-linked-prs -->
### Linked PRs
* gh-105780
<!-- /gh-linked-prs -->
| 7b1f0f204a785485de1daf9d26828a81953537e4 | d32e8d6070057eb7ad0eb2f9d9f1efab38b2cff4 |
python/cpython | python__cpython-105609 | # Deprecate unusual ways of creating `typing.NamedTuple` classes
# Feature or enhancement
I propose that we deprecate in Python 3.13 the following unusual ways of constructing a `typing.NamedTuple`:
```py
from typing import NamedTuple
Foo = NamedTuple("Foo", x=int, y=int) # NamedTuple with "x" and "y" fields
Bar = NamedTuple("Bar") # empty NamedTuple
Baz = NamedTuple("Baz", None) # empty NamedTuple
Eggs = NamedTuple("Eggs", fields=None) # empty NamedTuple
```
# Pitch
`typing.NamedTuple` has been around for quite a while now, but none of the above methods of constructing `NamedTuple`s are supported by type checkers. If they're still unsupported by type checkers after all this time, they're unlikely to ever be supported by type checkers.
Deprecating, and eventually removing, these ways of constructing `NamedTuple`s will allow us to simplify the code at runtime. It will also be less confusing for users. Every way in which the runtime and type checkers differ in behaviour is a potential point of confusion for users; in general, we should work to keep these points of difference to a minimum.
These methods of constructing `NamedTuple`s are not commonly seen in the wild. They're also pretty redundant -- if you want to construct a `NamedTuple` in one line, in a single function call, you can do it like this, which is supported by type checkers:
```py
Foo = NamedTuple("Foo", [("x", int), ("y", int)])
```
If you want to construct an empty `NamedTuple`, meanwhile, you can do it in one of the following two ways, which are both supported by type checkers:
```py
Bar = NamedTuple("Bar", [])
class Baz(NamedTuple): ...
```
# Previous discussion
For very similar reasons, we previously deprecated and removed the keyword-argument syntax for creating TypedDicts. This was deprecated in 3.11, and removed in 3.13:
- #90224
- #104786
<!-- gh-linked-prs -->
### Linked PRs
* gh-105609
<!-- /gh-linked-prs -->
| ad56340b665c5d8ac1f318964f71697bba41acb7 | fc8037d84c5f886849a05ec993dd0f79a356d372 |
python/cpython | python__cpython-105565 | # Artificial newlines show in the "line" attribute of tokens in the tokenizer module
Example:
```
from tokenize import generate_tokens
from io import StringIO
import pprint
pprint.pprint(list(generate_tokens(StringIO('a').readline)))
```
prints:
```
[TokenInfo(type=1 (NAME), string='a', start=(1, 0), end=(1, 1), line='a\n'),
TokenInfo(type=4 (NEWLINE), string='', start=(1, 1), end=(1, 2), line='a'),
TokenInfo(type=0 (ENDMARKER), string='', start=(2, 0), end=(2, 0), line='')]
```
<!-- gh-linked-prs -->
### Linked PRs
* gh-105565
* gh-105579
<!-- /gh-linked-prs -->
| d7f46bcd989580340675bf0a9fdbfa1505a37e81 | 1dd267af642ed6df05a1c106e9dafb8252d826e6 |
python/cpython | python__cpython-105946 | # Recommend DateType in the datetime documentation
# Documentation
At the PyCon US 2023 sprints, I spent some time with @glyph, @hauntsaninja, @AlexWaygood and others trying to put together a plan to make the type stubs for `datetime` distinguish between naïve and aware datetimes (even if the runtime types don't reflect this). Unfortunately, we came to the conclusion that there's no way to do it in a backwards-compatible way that accounts for subclasses without the use of higher-kinded types (this is not the first time we came to that conclusion, and unfortunately in neither case did we write down the exact reason this is a problem as far as I know, so, uh... let's remember to do that next time we tilt at this particular windmill).
Some time ago, however, @glyph did come up with a set of `Protocol` classes that basically solves the problem for anyone who is willing to opt in to it, since that frees him from certain backwards compatibility concerns. The upshot of the conversation was that the best we can do from the CPython side is probably to add a link to [`DateType`](https://github.com/glyph/DateType) into the [`datetime`](https://docs.python.org/3/library/datetime.html) documentation, presumably in the "See also" infobox, along with a recommendation that it can be used to improve type checking of naïve vs. aware datetimes.
I realized that we didn't get around to this in the sprints and we never made an issue to track the progress, so when this recently came up in [this issue](https://github.com/python/cpython/issues/105544), it reminded me to open this issue.
CC: @abalkin
<!-- gh-linked-prs -->
### Linked PRs
* gh-105946
* gh-108789
* gh-108790
<!-- /gh-linked-prs -->
| 8f9ea43ee805f98391f857397daac9df7ffa71cd | 6f97eeec222f81bd7ae836c149872a40b079e2a6 |
python/cpython | python__cpython-105558 | # test_sqlite3.test_userfunctions redefines test_func_return_too_large_int() method
Lib/test/test_sqlite3/test_userfunctions.py defines to methods called test_func_return_too_large_int() in the same class, so the first one is never called.
cc @erlend-aasland
<!-- gh-linked-prs -->
### Linked PRs
* gh-105558
* gh-105561
* gh-105562
<!-- /gh-linked-prs -->
| b8fa7bda4f286503447dc12327b789bbfc836458 | 9bf8d825a66ea2a76169b917c12c237a6af2ed75 |
python/cpython | python__cpython-105555 | # `generate_tokens` starts to give `SyntaxError`
<!--
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 the "Users" category on discuss.python.org: https://discuss.python.org/c/users/7
- emailing the Python-list mailing list: https://mail.python.org/mailman/listinfo/python-list
- searching our issue tracker (https://github.com/python/cpython/issues) to see if
your problem has already been reported
-->
# Bug report
`generate_tokens` gives error in python 3.12
```python
from tokenize import generate_tokens
from io import StringIO
list(generate_tokens(StringIO('01234').readline))
```
```
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/sylee957/.pyenv/versions/3.12.0b1/lib/python3.12/tokenize.py", line 451, in _tokenize
for token in _generate_tokens_from_c_tokenizer(source, extra_tokens=True):
File "/home/sylee957/.pyenv/versions/3.12.0b1/lib/python3.12/tokenize.py", line 542, in _generate_tokens_from_c_tokenizer
for info in c_tokenizer.TokenizerIter(source, extra_tokens=extra_tokens):
File "<string>", line 1
01234
^
SyntaxError: leading zeros in decimal integer literals are not permitted; use an 0o prefix for octal integers
```
While in Python 3.11, it successfully returns some result
```
[TokenInfo(type=2 (NUMBER), string='0', start=(1, 0), end=(1, 1), line='01234'), TokenInfo(type=2 (NUMBER), string='1234', start=(1, 1), end=(1, 5), line='01234'), TokenInfo(type=4 (NEWLINE), string='', start=(1, 5), end=(1, 6), line=''), TokenInfo(type=0 (ENDMARKER), string='', start=(2, 0), end=(2, 0), line='')]
```
This is related to some issues in SymPy
https://github.com/sympy/sympy/issues/25185
# Your environment
- CPython versions tested on: 3.12.0b1
- Operating system and architecture: Ubuntu 22.04.2 LTS
<!-- gh-linked-prs -->
### Linked PRs
* gh-105555
* gh-105602
<!-- /gh-linked-prs -->
| b047fa5e56ba725362c64ca3d6fccbdcf51d0cab | 00b599ab5a76023fa0083d7cc5d3c569342a5191 |
python/cpython | python__cpython-105546 | # Remove deprecated `MacOSXOSAScript._name` attribute
# Feature or enhancement
It was deprecated in 3.11: https://github.com/python/cpython/blob/3.11/Lib/webbrowser.py#L676-L688
It is time to remove it.
My PR from 2 years ago: https://github.com/python/cpython/pull/30241
CC @corona10 as the original PR reviewer.
# Pitch
1. It is not used directly in a general use-case
2. It was a mistake in the first place, all other browsers do have `.name` and not `._name`, which was fixed in 3.11
3. Top 5000 packages on PyPI do not use it (we only have results from mypy / typeshed):
```
» python cpython/search_pypi_top.py -q . "MacOSXOSAScript"
./jedi-0.18.2.tar.gz: jedi-0.18.2/jedi/third_party/typeshed/stdlib/2and3/webbrowser.pyi: class MacOSXOSAScript(BaseBrowser):
./hexbytes-0.3.0.tar.gz: hexbytes-0.3.0/.tox/lint/lib/python3.9/site-packages/mypy/typeshed/stdlib/@python2/webbrowser.pyi: class MacOSXOSAScript(BaseBrowser):
./hexbytes-0.3.0.tar.gz: hexbytes-0.3.0/.tox/lint/lib/python3.9/site-packages/mypy/typeshed/stdlib/webbrowser.pyi: class MacOSXOSAScript(BaseBrowser): # In runtime this class does not have `name` and `basename`
./hexbytes-0.3.0.tar.gz: hexbytes-0.3.0/.tox/py39-lint/lib/python3.9/site-packages/mypy/typeshed/stdlib/@python2/webbrowser.pyi: class MacOSXOSAScript(BaseBrowser):
./hexbytes-0.3.0.tar.gz: hexbytes-0.3.0/.tox/py39-lint/lib/python3.9/site-packages/mypy/typeshed/stdlib/webbrowser.pyi: class MacOSXOSAScript(BaseBrowser): # In runtime this class does not have `name` and `basename`
./eth_abi-4.0.0.tar.gz: eth_abi-4.0.0/.tox/lint/lib/python3.10/site-packages/mypy/typeshed/stdlib/webbrowser.pyi: class MacOSXOSAScript(BaseBrowser):
./typeshed_client-2.3.0.tar.gz: typeshed_client-2.3.0/typeshed_client/typeshed/webbrowser.pyi: class MacOSXOSAScript(BaseBrowser): # In runtime this class does not have `name` and `basename`
./eth-hash-0.5.1.tar.gz: eth-hash-0.5.1/.tox/lint/lib/python3.9/site-packages/mypy/typeshed/stdlib/@python2/webbrowser.pyi: class MacOSXOSAScript(BaseBrowser):
./eth-hash-0.5.1.tar.gz: eth-hash-0.5.1/.tox/lint/lib/python3.9/site-packages/mypy/typeshed/stdlib/webbrowser.pyi: class MacOSXOSAScript(BaseBrowser): # In runtime this class does not have `name` and `basename`
./eth-utils-2.1.0.tar.gz: eth-utils-2.1.0/.tox/lint/lib/python3.9/site-packages/mypy/typeshed/stdlib/webbrowser.pyi: class MacOSXOSAScript(BaseBrowser):
./mypy-1.3.0.tar.gz: mypy-1.3.0/mypy/typeshed/stdlib/webbrowser.pyi: class MacOSXOSAScript(BaseBrowser): # In runtime this class does not have `name` and `basename`
./eth-rlp-0.3.0.tar.gz: eth-rlp-0.3.0/.tox/lint/lib/python3.9/site-packages/mypy/typeshed/stdlib/2and3/webbrowser.pyi: class MacOSXOSAScript(BaseBrowser):
./eth-rlp-0.3.0.tar.gz: eth-rlp-0.3.0/venv-erlp/lib/python3.9/site-packages/jedi/third_party/typeshed/stdlib/2and3/webbrowser.pyi: class MacOSXOSAScript(BaseBrowser):
./eth-rlp-0.3.0.tar.gz: eth-rlp-0.3.0/venv-erlp/lib/python3.9/site-packages/mypy/typeshed/stdlib/2and3/webbrowser.pyi: class MacOSXOSAScript(BaseBrowser):
./eth-account-0.8.0.tar.gz: eth-account-0.8.0/.tox/lint/lib/python3.10/site-packages/mypy/typeshed/stdlib/webbrowser.pyi: class MacOSXOSAScript(BaseBrowser):
./eth-account-0.8.0.tar.gz: eth-account-0.8.0/.tox/py310-lint/lib/python3.10/site-packages/mypy/typeshed/stdlib/webbrowser.pyi: class MacOSXOSAScript(BaseBrowser):
./pytype-2023.6.2.tar.gz: pytype-2023.6.2/pytype/typeshed/stdlib/webbrowser.pyi: class MacOSXOSAScript(BaseBrowser): # In runtime this class does not have `name` and `basename`
```
I will send a PR.
<!-- gh-linked-prs -->
### Linked PRs
* gh-105546
<!-- /gh-linked-prs -->
| 947ec7ab02e7673956eb7f235c330a49f11e157a | 3e525d22128cf040b3fd164f52cc6ae20ca58455 |
python/cpython | python__cpython-105707 | # cases_generator tests aren't run by CI, and are broken
There are some tests for the cases generator in Tools/cases_generator/test_generator.py, but several things are wrong with these:
- [x] They are currently broken
- [x] They depend on pytest
- [x] They aren't run in CI
- [ ] They are incomplete
Let's fix that (in that order).
<!-- gh-linked-prs -->
### Linked PRs
* gh-105707
* gh-106713
* gh-106927
* gh-106942
<!-- /gh-linked-prs -->
| 8da9d1b16319f4a6bd78435016ef1f4bef6e2b41 | ca3cc4b95d66f7527ebe0ba4cdb1907082d9bfc8 |
python/cpython | python__cpython-108015 | # Emit resource warning if sqlite3 fails to close the database
_See https://github.com/python/cpython/issues/103837#issuecomment-1541808307 and https://github.com/python/cpython/issues/103837#issuecomment-1543936079_:
EAA:
> I still think we should consider changing the underlying API so we can emit a resource warning if close failed.
VS:
> IMO sqlite3 should be modified to emit a ResourceWarning.
>
> Currently, no ResourceWarning is emitted when a connection is not closed explicitly:
<!-- gh-linked-prs -->
### Linked PRs
* gh-108015
* gh-108017
* gh-108360
* gh-108565
<!-- /gh-linked-prs -->
| 1a1bfc28912a39b500c578e9f10a8a222638d411 | 86617518c4ac824e2b6dc20691ba5a08df04f285 |
python/cpython | python__cpython-107119 | # Document that enums with unhashable members are created non-performantly
# Documentation
#28907 fixes enum creation taking quadratic time relative to the number of members, but _only_ for members whose values are hashable. If not fixed, ideally this would be documented somewhere as it could potentially be a big performance trap
<!-- gh-linked-prs -->
### Linked PRs
* gh-107119
* gh-116511
* gh-116512
<!-- /gh-linked-prs -->
| 601f3a7b3391e9d219a8ec44a6c56d00ce584d2a | 735fc2cbbcf875c359021b5b2af7f4c29f4cf66d |
python/cpython | python__cpython-105523 | # Modernize `test_enum` by removing unused exception handling
Right now there are places in `test_enum` that for some reason contain code like https://github.com/python/cpython/blob/4ff5690e591b7d11cf11e34bf61004e2ea58ab3c/Lib/test/test_enum.py#L53-L76
For some reason we try to catch exceptions that won't ever happen (at least, they never *should* happen).
But, there are also regular `Enum`s that are defined without any exceptions: https://github.com/python/cpython/blob/4ff5690e591b7d11cf11e34bf61004e2ea58ab3c/Lib/test/test_enum.py#L78-L101
This is an artifact of 10+ age: https://github.com/python/cpython/commit/6b3d64ab5d7a448535a10811234d4ef99ddb54b0#diff-8467f9fbbff81abf26d87a8dbbf0e0c866157971948010e48cc73539251a9e4cR14
I propose to remove this and backport this PR to all supported Python versions.
PR will be available quite soon :)
<!-- gh-linked-prs -->
### Linked PRs
* gh-105523
<!-- /gh-linked-prs -->
| 199438b7cc2ef669b8d005d38797477a18b610cb | fce93c80ae2d792b8ca443b044e28abbf28bb89a |
python/cpython | python__cpython-105510 | # Simplify the implementation of `typing.Annotated`
# Feature or enhancement
`typing.Annotated` is currently implemented as a class, but doesn't need to be. All other objects like it in the `typing` module are implemented as instances of `typing._SpecialForm`, and we can do the same here. This simplifies the code a lot (making it easier to maintain in the future), and should also be _slightly_ more performant.
<!-- gh-linked-prs -->
### Linked PRs
* gh-105510
<!-- /gh-linked-prs -->
| a1cbace91b624681dd7bb8eb82ba187bda55d785 | 8f9ea43ee805f98391f857397daac9df7ffa71cd |
python/cpython | python__cpython-105511 | # Merge `typing.Union` and `types.UnionType`
Currently, unions created through `typing.Union[A, B]` and through the PEP-604 syntax `A | B` are at runtime instances of completely different types, and they differ in exactly what elements they accept. This is confusing and makes it harder for users to detect unions at runtime.
I propose to proceed in two steps:
1. Make `typing.Union` an alias for `types.UnionType` and make it so `types.UnionType[A, B]` works, accepting the same types `Union` accepts now.
2. Loosen the rules for what the `|` operator accepts to accept more types that are commonly used in unions.
<!-- gh-linked-prs -->
### Linked PRs
* gh-105511
* gh-132061
<!-- /gh-linked-prs -->
| 0f511d8b44dd9993474402411af8c83f4964bc95 | 9127b4602e4e0e110eab7f2f6a8ac54fe66b0a72 |
python/cpython | python__cpython-105542 | # 3.11.4: ValueError when inverting enum.Flag member with mask member
With code such as:
```python
import enum
class Flag(enum.Flag):
A = 0x01
B = 0x02
Mask = 0xff
print(~Flag.A)
```
Python 3.10.11 prints `Flag.B`, and so does Python 3.11.3. However, with Python 3.11.4, this happens instead:
```pytb
Traceback (most recent call last):
File "/home/florian/tmp/f.py", line 9, in <module>
print(~Flag.A)
^^^^^^^
File "/usr/lib/python3.11/enum.py", line 1542, in __invert__
self._inverted_ = self.__class__(self._flag_mask_ ^ self._value_)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/enum.py", line 711, in __call__
return cls.__new__(cls, value)
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/enum.py", line 1136, in __new__
raise exc
File "/usr/lib/python3.11/enum.py", line 1113, in __new__
result = cls._missing_(value)
^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/enum.py", line 1454, in _missing_
raise ValueError('%r: no members with value %r' % (cls, unknown))
ValueError: <flag 'Flag'>: no members with value 252
```
As a workaround, a detour via `.value` works in this case:
```python
>>> Flag((Flag.A | Flag.B).value & ~Flag.A.value)
<Flag.B: 2>
```
This causes issues with PyQt, which has the following flags ([as bindings from C++](https://github.com/qt/qtbase/blob/v6.5.1/src/corelib/global/qnamespace.h#L1047-L1057)):
```python
>>> from PyQt6.QtCore import Qt
>>> for e in Qt.KeyboardModifier:
... print(f"{e.name} = {hex(e.value)}")
...
NoModifier = 0x0
ShiftModifier = 0x2000000
ControlModifier = 0x4000000
AltModifier = 0x8000000
MetaModifier = 0x10000000
KeypadModifier = 0x20000000
GroupSwitchModifier = 0x40000000
KeyboardModifierMask = 0xfe000000
```
(Output from Python 3.10 - with Python 3.11, `KeyboardModifierMask` goes missing in the output, and so does `Flag.Mask` above, but that seems like a different issue?)
With my project, I'm [trying to remove a modifier](https://github.com/qutebrowser/qutebrowser/issues/7735) from the given flags. With Python 3.10.11 and 3.11.3:
```python
>>> (Qt.KeyboardModifier.ShiftModifier | Qt.KeyboardModifier.ControlModifier) & ~Qt.KeyboardModifier.ControlModifier
<KeyboardModifier.ShiftModifier: 33554432>
```
But with Python 3.11.4, same issue as above:
```pytb
>>> from PyQt6.QtCore import Qt
>>> (Qt.KeyboardModifier.ShiftModifier | Qt.KeyboardModifier.ControlModifier) & ~Qt.KeyboardModifier.ControlModifier
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.11/enum.py", line 1542, in __invert__
self._inverted_ = self.__class__(self._flag_mask_ ^ self._value_)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/enum.py", line 711, in __call__
return cls.__new__(cls, value)
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/enum.py", line 1136, in __new__
raise exc
File "/usr/lib/python3.11/enum.py", line 1113, in __new__
result = cls._missing_(value)
^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/enum.py", line 1454, in _missing_
raise ValueError('%r: no members with value %r' % (cls, unknown))
ValueError: <flag 'KeyboardModifier'>: no members with value 2147483648
```
As a culprit, I suspect:
- #103365
- #103494
- #103513
cc @ethanfurman @benburrill
<!-- gh-linked-prs -->
### Linked PRs
* gh-105542
* gh-105571
* gh-105572
* gh-106468
* gh-106620
* gh-106621
<!-- /gh-linked-prs -->
| 59f009e5898a006cdc8f5249be589de6edfe5cd0 | 8e755923c97d689ba7c7fe8deb50c1b169263264 |
python/cpython | python__cpython-105488 | # `types.GenericAlias` has extra `__copy__` and `__deepcopy__` in `__dir__`
Repro:
```python
>>> type A[X] = list[X]
>>> dir(A[int])
[..., '__copy__', '__deepcopy__', ...]
```
We can access all other attributes, but not `__copy__` and `__deepcopy__`:
```pytb
>>> A[int].__copy__
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'types.GenericAlias' object has no attribute '__copy__'. Did you mean: '__doc__'?
>>> A[int].__deepcopy__
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'types.GenericAlias' object has no attribute '__deepcopy__'
```
I am not quite sure what is the right thing to do here 🤔
<!-- gh-linked-prs -->
### Linked PRs
* gh-105488
<!-- /gh-linked-prs -->
| eb7d6e7ad844955f9af88707d296e003c7ce4394 | e212618bafaa4f775502e3442de0affb80205b5e |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.