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-118957 | # `jit.c` may be built with an incomplete `jit_stencils.h`
# Bug report
### Bug description:
As discussed in https://discuss.python.org/t/pep-744-jit-compilation/50756/42 and further with @brandtbucher, I've tried to change the Fedora's Python 3.13 package to utilize `--enable-experimental-jit=yes-off`.
As a starting point, I took the 3.13.0b1-1 package from:
https://src.fedoraproject.org/rpms/python3.13/blob/1c24374362/f/python3.13.spec
And I changed:
```diff
diff --git a/python3.13.spec b/python3.13.spec
index 4bfe050..68b357d 100644
--- a/python3.13.spec
+++ b/python3.13.spec
@@ -304,6 +304,9 @@ BuildRequires: tcl-devel
BuildRequires: tk-devel
BuildRequires: tzdata
+BuildRequires: clang >= 18
+BuildRequires: llvm >= 18
+
%if %{with valgrind}
BuildRequires: valgrind-devel
%endif
@@ -920,12 +923,12 @@ BuildPython() {
# option produces too many warnings when compiling at the O0 optimization level.
# See also: https://bugzilla.redhat.com/show_bug.cgi?id=1818857
BuildPython debug \
- "--without-ensurepip --with-pydebug" \
+ "--without-ensurepip --with-pydebug --enable-experimental-jit=yes-off" \
"%{optflags_debug}"
%endif # with debug_build
BuildPython optimized \
- "--without-ensurepip %{optimizations_flag}" \
+ "--without-ensurepip --enable-experimental-jit=yes-off %{optimizations_flag}" \
"%{optflags_optimized}"
%if %{with freethreading_build} && %{with debug_build}
```
That means I added `--enable-experimental-jit=yes-off` to the debug and optimized non-free-threaded builds and some extra build dependencies.
Running the build in Fedora Rawhide (41) chroot resulted in this error during the debug build (which happens first):
```
python3.13 /builddir/build/BUILD/Python-3.13.0b1/Tools/jit/build.py x86_64-redhat-linux-gnu --debug
==============================================================
JIT support for x86_64-redhat-linux-gnu is still experimental!
Please report any issues you encounter.
==============================================================
python3.13 /builddir/build/BUILD/Python-3.13.0b1/Tools/jit/build.py x86_64-redhat-linux-gnu --debug
==============================================================
JIT support for x86_64-redhat-linux-gnu is still experimental!
Please report any issues you encounter.
==============================================================
gcc -c -fno-strict-overflow -Wsign-compare -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -DDYNAMIC_ANNOTATIONS_ENABLED=1 -fcf-protection -fexceptions -fcf-protection -fexceptions -fcf-protection -fexceptions -O0 -Wno-cpp -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wno-complain-wrong-lang -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -D_GNU_SOURCE -fPIC -fwrapv -D_Py_TIER2=3 -D_Py_JIT -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -std=c11 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration -fvisibility=hidden -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wno-complain-wrong-lang -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -D_GNU_SOURCE -fPIC -fwrapv -O0 -Wno-cpp -I/builddir/build/BUILD/Python-3.13.0b1/Include/internal -I/builddir/build/BUILD/Python-3.13.0b1/Include/internal/mimalloc -IObjects -IInclude -IPython -I. -I/builddir/build/BUILD/Python-3.13.0b1/Include -fPIC -DPy_BUILD_CORE -o Python/jit.o /builddir/build/BUILD/Python-3.13.0b1/Python/jit.c
/builddir/build/BUILD/Python-3.13.0b1/Python/jit.c: In function ‘emit__MATCH_MAPPING’:
/builddir/build/BUILD/Python-3.13.0b1/Python/jit.c:395:1: error: expected expression before ‘int’
395 | int
| ^~~
/builddir/build/BUILD/Python-3.13.0b1/Python/jit.c:479:1: error: expected declaration or statement at end of input
479 | }
| ^
In file included from /builddir/build/BUILD/Python-3.13.0b1/Python/jit.c:392:
./jit_stencils.h:30254:25: warning: unused variable ‘data_body’ [-Wunused-variable]
30254 | const unsigned char data_body[24] = {
| ^~~~~~~~~
./jit_stencils.h:30241:25: warning: unused variable ‘code_body’ [-Wunused-variable]
30241 | const unsigned char code_body[53] = {
| ^~~~~~~~~
/builddir/build/BUILD/Python-3.13.0b1/Python/jit.c: At top level:
/builddir/build/BUILD/Python-3.13.0b1/Python/jit.c:87:1: warning: ‘mark_executable’ defined but not used [-Wunused-function]
87 | mark_executable(unsigned char *memory, size_t size)
| ^~~~~~~~~~~~~~~
/builddir/build/BUILD/Python-3.13.0b1/Python/jit.c:70:1: warning: ‘jit_free’ defined but not used [-Wunused-function]
70 | jit_free(unsigned char *memory, size_t size)
| ^~~~~~~~
/builddir/build/BUILD/Python-3.13.0b1/Python/jit.c:49:1: warning: ‘jit_alloc’ defined but not used [-Wunused-function]
49 | jit_alloc(size_t size)
| ^~~~~~~~~
make: *** [Makefile:3018: Python/jit.o] Error 1
make: *** Waiting for unfinished jobs....
```
Full logs:
- [installed_pkgs.log](https://github.com/python/cpython/files/15282290/installed_pkgs.log.txt)
- [build.log](https://github.com/python/cpython/files/15282292/build.log.txt)
@brandtbucher suggested that "perhaps several builds are happening at once for some reason. If so, they could be stepping on each other and maybe truncating the generated file."
Anyway, here is the generated [jit_stencils.h](https://github.com/python/cpython/files/15282301/jit_stencils.h.txt) file as it was present after the failure.
### CPython versions tested on:
3.13
### Operating systems tested on:
Linux
<!-- gh-linked-prs -->
### Linked PRs
* gh-118957
* gh-119101
* gh-120690
* gh-122602
* gh-122709
* gh-122840
<!-- /gh-linked-prs -->
| 4702b7b5bdc07d046576b4126cf4e4f5f7145abb | ab73bcdf73fed5a23f2e2e37a63d6992f29479a9 |
python/cpython | python__cpython-119769 | # `PyEval_GetLocals()` leaks locals
# Bug report
`PyEval_GetLocals()` is documented as returning a [borrowed reference](https://docs.python.org/3/c-api/reflection.html#c.PyEval_GetLocals). It now returns a new reference, which causes callers to leak the local variables:
https://github.com/python/cpython/blob/35c436186b849f8f2f9fb866c59015c9d034d448/Python/ceval.c#L2478-L2479
cc @gaogaotiantian @markshannon
<!-- gh-linked-prs -->
### Linked PRs
* gh-119769
* gh-119932
* gh-119934
* gh-121869
<!-- /gh-linked-prs -->
| e65cb4c6f01a687f451ad9db1600525e1c5832c4 | 162b41f57757c1df40eb377985e2e877fb0f0ea3 |
python/cpython | python__cpython-118946 | # ChainMap.__contains__ and .get performance improvement.
# Feature or enhancement
### Proposal:
```python
import collections as coll
class ChainMap2(coll.ChainMap):
def __contains__(self, key):
for mapping in self.maps:
if key in mapping:
return True
return False
def get(self, key, default=None):
for mapping in self.maps:
if key in mapping:
return mapping[key]
return default
maps = [dict(a=1), dict(a=2, b=2), dict(a=3, b=2, c=3)]
cm = coll.ChainMap(*maps)
cm2 = ChainMap2(*maps)
%timeit 'a' in cm # 615 ns
%timeit 'c' in cm # 752 ns
%timeit cm.get('a') # 776 ns
%timeit cm.get('c') # 1.46 µs
%timeit 'a' in cm2 # 140 ns
%timeit 'c' in cm2 # 198 ns
%timeit cm2.get('a') # 147 ns
%timeit cm2.get('c') # 208 ns
```
### Has this already been discussed elsewhere?
I have already discussed this feature proposal on Discourse
### Links to previous discussion of this feature:
https://discuss.python.org/t/collections-chainmap-get-performance/41925
<!-- gh-linked-prs -->
### Linked PRs
* gh-118946
<!-- /gh-linked-prs -->
| cd4cfa6ed2fd5f866c7be339f1d3cf56aa4d2bad | 7e894c2f38f64aed9b259c8fd31880f1142a259d |
python/cpython | python__cpython-118929 | # sqlite3: disallow using a sequence of params with named placeholders
# Feature or enhancement
Follow-up of...:
- #101693:
> Based on the discussion in the above linked Discourse topic, I propose to now issue a deprecation warning if sequences are used with named placeholders. The deprecation warning should inform that from Python 3.14 and onward, sqlite3.ProgrammingError will be raised instead.
3.14 dev is now opened, so let's convert the deprecation warning to a programming error sooner than later.
<!-- gh-linked-prs -->
### Linked PRs
* gh-118929
* gh-119197
* gh-119208
* gh-135163
* gh-135342
<!-- /gh-linked-prs -->
| d8e0e009195b2388fb53012c1f0fa786426dc05f | 7a97ee570f361af27c59eb883b53425fef11c739 |
python/cpython | python__cpython-118925 | # Remove `sqlite3.version` and `sqlite3.version_info`
They were deprecated in 3.12 and set for removal in 3.14.
* https://github.com/python/cpython/issues/93370
* https://github.com/python/cpython/pull/93482
<!-- gh-linked-prs -->
### Linked PRs
* gh-118925
<!-- /gh-linked-prs -->
| a0193479475a047b223f64130867a63b672c8dc2 | b309c8ebff011f27012367b046ff92eecbdd68a5 |
python/cpython | python__cpython-118923 | # Make `frame.f_locals.copy()` return a snapshot dict of `f_locals`
# Feature or enhancement
### Proposal:
Per PEP 667, `frame.f_locals` is now a write-through proxy (`FrameLocalsProxy`) for underlying fast local variables. In the beginning we did not implement the `copy()` method because we think `dict(frame.f_locals)` is a more explicit way to achieve the snapshot. However, there are existing code that's using `frame.f_locals.copy()` to take a snapshot. Moreover, `types.MappingProxyType({}).copy()` returns the copy of the underlying mapping so it's not unprecedented for a `proxy.copy()` to return a dict.
Thus, we should implement `copy()` method for `FrameLocalsProxy` and make it return a dict of snapshot of the current local variables.
### Has this already been discussed elsewhere?
I have already discussed this feature proposal on Discourse
### Links to previous discussion of this feature:
https://discuss.python.org/t/pep-667-consistent-views-of-namespaces/46631/26
<!-- gh-linked-prs -->
### Linked PRs
* gh-118923
* gh-118933
<!-- /gh-linked-prs -->
| 35c436186b849f8f2f9fb866c59015c9d034d448 | b88889e9ffd7b2d2bdac75aecbf14e37fd68e337 |
python/cpython | python__cpython-119232 | # Inappropriateness in unittest documentation with actual behavior
# Documentation
https://docs.python.org/3/library/unittest.mock.html#auto-speccing
https://github.com/python/cpython/blob/c444362c6e0b6c01f49c3bee864100f52bd3b640/Doc/library/unittest.mock.rst#L2615
```python
mock = Mock(name='Thing', return_value=None)
mock(1, 2, 3)
mock.assret_called_once_with(4, 5, 6) # Intentional typo!
```
> Your tests can pass silently and incorrectly because of the typo.
----------------------------
Expected that tests will pass as written in doc.
But actually script fails with raising error.
```pytb
raise AttributeError(
AttributeError: 'assret_called_once_with' is not a valid assertion. Use a spec for the mock if 'assret_called_once_with' is meant to be an attribute.. Did you mean: 'assert_called_once_with'?
```
Am i missing something? I have tested this in Python3.11 and Python 3.12.
Looks like documentation must be updated or script must work as said in documenation.
Thanks for attention
<!-- gh-linked-prs -->
### Linked PRs
* gh-119232
* gh-119283
* gh-119284
<!-- /gh-linked-prs -->
| 7e57640c7ec6b7b5ce9b5eac465f6b771fd6ae69 | a443e542811cd8242d6f42e817b0f0af0dd2fd92 |
python/cpython | python__cpython-119355 | # Editing the last line in a block in the new REPL is buggy
# Bug report
### Bug description:
When editing the last line in a function in the new REPL, hitting Enter doesn't end the block if the last line has indentation on it.

[Demo of the bug](https://asciinema.org/a/658451), [demo of what IPython does](https://asciinema.org/a/658452)
_Originally posted in https://github.com/python/cpython/issues/111201#issuecomment-2101869843_
Here are the noticeable differences in how IPython handles this situation:
1. When hitting the up arrow key to edit the block, the final blank line isn't included (the default cursor position is at the end of the last non-empty line.

2. In IPython I tried purposely adding extra whitespace-only lines (not fully blank but instead containing 4 spaces) by hitting Enter, up arrow, End, Enter, up arrow, End, repeatedly. If I then hit Enter on the first line-followed-by-whitespace-only-lines it ends the block.

3. Hitting up arrow again, will strip whitespace from the end of the block (maybe this is how 1 above is implemented)

Implementing the behavior of 1 (or 3) above might be enough, though 2 seems like it would be even better.
### CPython versions tested on:
3.13
### Operating systems tested on:
Linux
<!-- gh-linked-prs -->
### Linked PRs
* gh-119355
* gh-119404
<!-- /gh-linked-prs -->
| 5091c4400c9ea2a2d1e4d89a28c9d0de2651fa6d | e6572e8f98d33994d2d0dd3afa92a2a72ee642a9 |
python/cpython | python__cpython-118913 | # The tier 2 optimizer specification contains too much boilerplate
The tier 2 optimizer specification (optimizer_bytecodes.c) contains lots of boilerplate for handling contradictions and running out of space in the optimizer's data structures.
These can be handled but setting flags on the optimizer context and checking those in the abstract interpreter loop.
For example
`OUT_OF_SPACE_IF_NULL(res = sym_new_unknown(ctx));` can be replaced with `res = sym_new_unknown(ctx)`
and
```C
if (!sym_set_type(right, &PyUnicode_Type)) {
goto hit_bottom;
}
```
can be replaced with `sym_set_type(left, &PyUnicode_Type);`
Hopefully this will make the optimizer a bit more approachable and maintainable
<!-- gh-linked-prs -->
### Linked PRs
* gh-118913
<!-- /gh-linked-prs -->
| f5c6b9977a561fcf9c2a803fb08652fd39b13d3b | 941eea0a27de6e5c02d3c80924235a7a07bd095a |
python/cpython | python__cpython-118902 | # `NotImplemented` is never tested with attribute assignment
# Bug report
This issue adds tests for `NoDefault` and attribute assignment: https://github.com/python/cpython/issues/118895
But, we never had tests for the same thing of `NotImplemented`. I will add a test case for that.
<!-- gh-linked-prs -->
### Linked PRs
* gh-118902
* gh-118968
* gh-118969
<!-- /gh-linked-prs -->
| ec1398e117fb142cc830495503dbdbb1ddafe941 | 5b941e57c71d7d0ab983d81a169f892662cfe446 |
python/cpython | python__cpython-118897 | # Assigning attributes to `typing.NoDefault` raises `TypeError`, but should raise `AttributeError`
# Bug report
### Bug description:
Most sentinels in Python raise `AttributeError` if you try to assign attributes to them, but `typing.NoDefault` raises `TypeError` instead. I think this should be `AttributeError`, for consistency with other similar objects:
```pycon
(main) % ./python.exe ~/dev/cpython
Python 3.14.0a0 (heads/main:66f8bb76a1, May 8 2024, 17:00:15) [Clang 15.0.0 (clang-1500.3.9.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> None.foo = 'bar'
Traceback (most recent call last):
File "<python-input-0>", line 1, in <module>
None.foo = 'bar'
^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'foo' and no __dict__ for setting new attributes
>>> NotImplemented.foo = 'bar'
Traceback (most recent call last):
File "<python-input-1>", line 1, in <module>
NotImplemented.foo = 'bar'
^^^^^^^^^^^^^^^^^^
AttributeError: 'NotImplementedType' object has no attribute 'foo' and no __dict__ for setting new attributes
>>> from typing import NoDefault
>>> NoDefault.foo = 'bar'
Traceback (most recent call last):
File "<python-input-3>", line 1, in <module>
NoDefault.foo = 'bar'
^^^^^^^^^^^^^
TypeError: 'NoDefaultType' object has no attributes (assign to .foo)
```
### CPython versions tested on:
CPython main branch
### Operating systems tested on:
macOS
<!-- gh-linked-prs -->
### Linked PRs
* gh-118897
* gh-118914
<!-- /gh-linked-prs -->
| 13d7cf997bc9c22cf67c42fd799413e8325e0039 | c444362c6e0b6c01f49c3bee864100f52bd3b640 |
python/cpython | python__cpython-119433 | # Add support for new REPL in `python -m asyncio`
# Feature or enhancement
They are different now:

Hm, right now I don't see any simple way of merging these two together:
https://github.com/python/cpython/blob/c68acb1384a51eb745f572687eaf677371b9e765/Lib/asyncio/__main__.py#L15-L21
and
https://github.com/python/cpython/blob/c68acb1384a51eb745f572687eaf677371b9e765/Lib/_pyrepl/simple_interact.py#L81-L83
I think that this would require some API change. Not sure which one, though :(
Refs https://github.com/python/cpython/issues/111201
<!-- gh-linked-prs -->
### Linked PRs
* gh-119433
* gh-119884
<!-- /gh-linked-prs -->
| 2237946af0981c46dc7d3886477e425ccfb37f28 | f9d47fed9fbbe9313404838050f6dfe1c7fe6340 |
python/cpython | python__cpython-119318 | # "Paste mode" in the new REPL does not display the result of evaluated expressions
We've discovered that if you manually type out a condition that evaluates to `False` in the new REPL, `False` is printed as the result, as expected...
```pycon
>>> (3, 13, 0, "final") < (3, 13, 0, "beta")
False
```
...but that if you copy and paste this condition into the REPL, nothing is printed (implying that the condition evaluates to `None`:
```pycon
>>> (3, 13, 0, "final") < (3, 13, 0, "beta")
>>>
```
Thanks @Eclips4 for realising that the difference in behaviour here was due to copying-and-pasting the condition rather than typing it out!
_Originally posted by @AlexWaygood in https://github.com/python/cpython/issues/111201#issuecomment-2102541362_
<!-- gh-linked-prs -->
### Linked PRs
* gh-119318
* gh-119408
<!-- /gh-linked-prs -->
| a3e4fec8734a304d654e4ae24a4aa2f41a7b0640 | 9fa206aaeccc979a4bd03852ba38c045294a3d6f |
python/cpython | python__cpython-119893 | # Python 3.13.0b1: exec() does not populate locals()
# Bug report
### Bug description:
### x.py
```python
xxx = 118888
```
### readx.py
```python
def f():
with open("x.py", encoding="utf-8") as f:
exec(compile(f.read(), "x.py", "exec"))
return locals()["xxx"]
print(f())
```
### shell
```pytb
$ python3.12 readx.py
118888
$ python3.13 readx.py
Traceback (most recent call last):
File ".../readx.py", line 6, in <module>
print(f())
~^^
File ".../readx.py", line 4, in f
return locals()["xxx"]
~~~~~~~~^^^^^^^
KeyError: 'xxx'
```
This breaks e.g. pillow 10.3.0 which has:
```python
def get_version():
version_file = "src/PIL/_version.py"
with open(version_file, encoding="utf-8") as f:
exec(compile(f.read(), version_file, "exec"))
return locals()["__version__"]
```
In https://github.com/python-pillow/Pillow/blob/10.3.0/setup.py#L23
### CPython versions tested on:
3.13
### Operating systems tested on:
Linux
<!-- gh-linked-prs -->
### Linked PRs
* gh-119893
* gh-119894
<!-- /gh-linked-prs -->
| 2180991ea3d50f56595edae241cc92dd4e7de642 | 3859e09e3d92d004978dd838f0511364e7edfb94 |
python/cpython | python__cpython-118939 | # Tab completion behaviour in new REPL
# Bug report
### Bug description:
I've been playing a bit with the new REPL, it's so awesome! (thanks to @pablogsal and @ambv for the core.py episode :love_letter: )
I noticed a strange behaviour of the tab completion, whereas upon pressing the tab twice to show available options, the `>>>` prompt jumps down and the options are displayed above it. Please tell me this is a bug and not a feature. :sweat_smile:
### After a single TAB

### After the second TAB

This is on Fedora 39, built with `./configure --with-readline`, in Terminator terminal.
Apologies if I missed something, happy to provide more info.
### CPython versions tested on:
3.13
### Operating systems tested on:
Linux
<!-- gh-linked-prs -->
### Linked PRs
* gh-118939
* gh-129161
<!-- /gh-linked-prs -->
| 29caec62ee0650493c83c778ee2ea50b0501bc41 | 5a9afe23620aadea30013076d64686be8bf66f7e |
python/cpython | python__cpython-118936 | # `AssertionError` occurs using 3.130b1 interactive mode when pressed tab and up arrow
# Bug report
### Bug description:
Hi dear core developers,
I was playing with the newest REPL v3.130b1 on my M2 MacBook Pro with macOS 14.3. I built the python binary from the source at commit `b62cb5234b`. It's really impressive and exciting to see how much the standard REPL has evolved in this version.
However the bug occurred while I was playing with the auto-completion on the command. Says I want to see what operations are there under `datetime` module, type `datetime.` and press `Tab` twice, the suggestions show up correctly. But when I try to surf the suggestions with arrow keys pressed several times, I got the `AssertionError`:
```python
Python 3.13.0b1+ (heads/3.13:b62cb5234b, May 10 2024, 10:17:59) [Clang 15.0.0 (clang-1500.1.0.2.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import datetime
datetime.MAXYEAR datetime.date( datetime.time( datetime.tzinfo(
datetime.MINYEAR datetime.datetime( datetime.timedelta(
Traceback (most recent call last):atetime_CAPI datetime.timezone(
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "/Users/thmac-02/cpython/Lib/_pyrepl/__main__.py", line 47, in <module>
interactive_console()
~~~~~~~~~~~~~~~~~~~^^
File "/Users/thmac-02/cpython/Lib/_pyrepl/__main__.py", line 44, in interactive_console
return run_interactive(mainmodule)
File "/Users/thmac-02/cpython/Lib/_pyrepl/simple_interact.py", line 138, in run_multiline_interactive_console
statement, contains_pasted_code = multiline_input(more_lines, ps1, ps2)
~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
File "/Users/thmac-02/cpython/Lib/_pyrepl/readline.py", line 301, in multiline_input
return reader.readline(), reader.was_paste_mode_activated
~~~~~~~~~~~~~~~^^
File "/Users/thmac-02/cpython/Lib/_pyrepl/reader.py", line 652, in readline
self.handle1()
~~~~~~~~~~~~^^
File "/Users/thmac-02/cpython/Lib/_pyrepl/reader.py", line 635, in handle1
self.do_cmd(cmd)
~~~~~~~~~~~^^^^^
File "/Users/thmac-02/cpython/Lib/_pyrepl/reader.py", line 589, in do_cmd
self.update_cursor()
~~~~~~~~~~~~~~~~~~^^
File "/Users/thmac-02/cpython/Lib/_pyrepl/reader.py", line 499, in update_cursor
self.cxy = self.pos2xy()
~~~~~~~~~~~^^
File "/Users/thmac-02/cpython/Lib/_pyrepl/reader.py", line 471, in pos2xy
assert 0 <= pos <= len(self.buffer)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError
```
Not sure if this is the intended behavior of using the new REPL, but I still hope this could be solved as this can largely improve the user experience of using the new auto-completion feature.
Thanks for all your hard works, the new python features are really awesome. Can't wait to see the final release ^^ It's my first issue sending to cpython, and sorry if there is any missing information I did not provide.
### CPython versions tested on:
3.13
### Operating systems tested on:
macOS
<!-- gh-linked-prs -->
### Linked PRs
* gh-118936
* gh-119363
<!-- /gh-linked-prs -->
| c0d81b256604a1079349d82d136db43eefcb3df1 | 7e1a130b8ff1ed8b3a5f00fe0f06d3916b852216 |
python/cpython | python__cpython-118880 | # "AttributeError: 'NoneType' object has no attribute 'is_absolute' " occurs when building 3.13.0 beta 1 from source on Windows
# Bug report
### Bug description:
The above error occurs when building python 3.13 beta 1 from source on Windows. Have determined that ns.temp not being defined before its is_absolute() method is invoked. Below is the full trace of the AttributeError. Will submit a PR with a patch that is working for me.
```pytb
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "C:\builds\sources\1\Python-3.13.0b1\PC\layout\__main__.py", line 14, in <module>
sys.exit(int(main() or 0))
~~~~^^
File "C:\builds\sources\1\Python-3.13.0b1\PC\layout\main.py", line 606, in main
if not ns.temp.is_absolute():
^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'is_absolute'
```
### CPython versions tested on:
3.13
### Operating systems tested on:
Windows
<!-- gh-linked-prs -->
### Linked PRs
* gh-118880
* gh-118994
* gh-118995
<!-- /gh-linked-prs -->
| d8a82cca12e12a6b22bfe6691e9b222f6d276f0a | b4ca389281849e849fb58fecf9b31e2e2f5a39c1 |
python/cpython | python__cpython-118869 | # kwargs are no longer passed to logging QueueHandler in 3.12
# Bug report
### Bug description:
kwargs are no longer passed to logging QueueHandler in 3.12
```python
import logging
import logging.config
import logging.handlers
import queue
class TestQueueHandler(logging.handlers.QueueHandler):
def __init__(self, *args, **kwargs):
super().__init__(queue.Queue())
print('test' in kwargs)
# True in 3.11
# False in 3.12
def main():
config = {
'version': 1,
'handlers': {
'default': {
'class': TestQueueHandler,
'test': '123'
},
},
'loggers': {
'a': {
'handlers': ['default'],
},
}
}
logging.config.dictConfig(config)
if __name__ == '__main__':
main()
```
### CPython versions tested on:
3.11, 3.12
### Operating systems tested on:
Linux
<!-- gh-linked-prs -->
### Linked PRs
* gh-118869
* gh-120031
* gh-120032
<!-- /gh-linked-prs -->
| dce14bb2dce7887df40ae5c13b0d13e0dafceff7 | 9e052619a6d32051394444c24d3185db1735a893 |
python/cpython | python__cpython-118854 | # Default expr_context parameters in ast to Load()
# Feature or enhancement
### Proposal:
In #105858, we changed the AST node constructors to raise a DeprecationWarning when any required fields are omitted. Optional fields default to None and list fields default to an empty list. In real-world usage, it emerges that it's often also useful to omit the `ctx` argument to various classes (Attribute, Subscript, Starred, Name, List, Tuple); its value often does not matter, and it's convenient to have it default to `ast.Load()`.
I'd like to backport this to 3.13 since it helps undo a noisy DeprecationWarning.
### Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
### Links to previous discussion of this feature:
https://github.com/python/typeshed/pull/11880#discussion_r1595399126
<!-- gh-linked-prs -->
### Linked PRs
* gh-118854
* gh-118871
<!-- /gh-linked-prs -->
| 68fbc00dc870f6a8dcbecd2ec19298e21015867f | 98ff3f65c0232f31df89ebb52b244625ec9e3eb6 |
python/cpython | python__cpython-118850 | # code will never be executed warning in `dictobject.c`
# Bug report
Here's how this code looks right now:
https://github.com/python/cpython/blob/c3643a121401d111bebd3e26d6f362ade2ed2a83/Objects/dictobject.c#L5489-L5500
```
gcc -c -fno-strict-overflow -Wsign-compare -Wunreachable-code -DNDEBUG -g -O3 -Wall -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -D_Py_TIER2=1 -D_Py_JIT -std=c11 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration -fvisibility=hidden -I./Include/internal -I./Include/internal/mimalloc -I. -I./Include -I/opt/homebrew/opt/openssl/include -I/opt/homebrew/opt/openssl/include -DPy_BUILD_CORE -o Objects/dictobject.o Objects/dictobject.c
Objects/dictobject.c:5494:5: warning: code will never be executed [-Wunreachable-code]
int res;
^~~~~~~~
1 warning generated.
```
I have a PR ready.
<!-- gh-linked-prs -->
### Linked PRs
* gh-118850
* gh-118859
<!-- /gh-linked-prs -->
| 82abe75e77129bebb3c13d807e8040f6924194f6 | 8af84b503d0b62a3db0d806d39f42c1e08746079 |
python/cpython | python__cpython-118862 | # Freethreading build fails -m test --pgo: test_ordered_dict and test_struct failed
# Bug report
### Bug description:
When we build Python 3.13.0b1 in Fedora with `--disable-gil --enable-optimizations`, the PGO task fails. I was able to reproduce this from the 3.13 branch by:
```
$ ./configure --config-cache --without-ensurepip --disable-gil --enable-optimizations
$ make
...
# Next, run the profile task to generate the profile information.
./python -m test --pgo --timeout=
Using random seed: 754312824
0:00:00 load avg: 8.58 Run 44 tests sequentially
0:00:00 load avg: 8.58 [ 1/44] test_array
0:00:01 load avg: 8.58 [ 2/44] test_base64
0:00:01 load avg: 8.58 [ 3/44] test_binascii
0:00:01 load avg: 8.58 [ 4/44] test_binop
0:00:01 load avg: 8.58 [ 5/44] test_bisect
0:00:01 load avg: 8.58 [ 6/44] test_bytes
0:00:07 load avg: 8.13 [ 7/44] test_bz2
0:00:08 load avg: 7.88 [ 8/44] test_cmath
0:00:08 load avg: 7.88 [ 9/44] test_codecs
0:00:10 load avg: 7.88 [10/44] test_collections
0:00:12 load avg: 7.88 [11/44] test_complex
0:00:12 load avg: 7.88 [12/44] test_dataclasses
0:00:13 load avg: 7.57 [13/44] test_datetime
0:00:19 load avg: 7.04 [14/44] test_decimal
0:00:24 load avg: 6.56 [15/44] test_difflib
0:00:25 load avg: 6.56 [16/44] test_embed
0:00:31 load avg: 6.11 [17/44] test_float
0:00:31 load avg: 6.11 [18/44] test_fstring
0:00:33 load avg: 6.10 [19/44] test_functools
0:00:35 load avg: 6.10 [20/44] test_generators
0:00:37 load avg: 6.10 [21/44] test_hashlib
0:00:38 load avg: 6.10 [22/44] test_heapq
0:00:39 load avg: 5.77 [23/44] test_int
0:00:40 load avg: 5.77 [24/44] test_itertools
0:00:48 load avg: 5.04 [25/44] test_json
0:00:54 load avg: 4.80 [26/44] test_long
0:00:59 load avg: 4.65 [27/44] test_lzma
0:01:00 load avg: 4.65 [28/44] test_math
0:01:06 load avg: 4.84 [29/44] test_memoryview
0:01:08 load avg: 4.77 [30/44] test_operator
0:01:08 load avg: 4.77 [31/44] test_ordered_dict
test test_ordered_dict failed
0:01:12 load avg: 4.77 [32/44] test_patma -- test_ordered_dict failed (4 failures)
0:01:12 load avg: 4.77 [33/44] test_pickle
0:01:21 load avg: 4.50 [34/44] test_pprint
0:01:22 load avg: 4.50 [35/44] test_re
0:01:23 load avg: 4.38 [36/44] test_set
0:01:33 load avg: 3.94 [37/44] test_sqlite3
0:01:34 load avg: 3.94 [38/44] test_statistics -- test_sqlite3 skipped
0:01:48 load avg: 3.58 [39/44] test_str
0:01:57 load avg: 3.53 [40/44] test_struct
test test_struct failed
0:02:01 load avg: 3.57 [41/44] test_tabnanny -- test_struct failed (1 failure)
0:02:05 load avg: 3.36 [42/44] test_time
0:02:09 load avg: 3.33 [43/44] test_xml_etree
0:02:20 load avg: 3.21 [44/44] test_xml_etree_c
Total duration: 2 min 29 sec
Total tests: run=8,756 failures=5 skipped=187
Total test files: run=44/44 failed=2 skipped=1
Result: FAILURE
```
Interestingly, the tests pass when run individually:
```
$ ./python -m test --pgo test_ordered_dict
Using random seed: 1047184953
0:00:00 load avg: 2.98 Run 1 test sequentially
0:00:00 load avg: 2.98 [1/1] test_ordered_dict
Total duration: 769 ms
Total tests: run=283
Total test files: run=1/1
Result: SUCCESS
$ ./python -m test --pgo test_struct
Using random seed: 2588757208
0:00:00 load avg: 2.98 Run 1 test sequentially
0:00:00 load avg: 2.98 [1/1] test_struct
Total duration: 567 ms
Total tests: run=39
Total test files: run=1/1
Result: SUCCESS
```
But not when all of them run:
```
$ ./python -m test --pgo
Using random seed: 3047572841
0:00:00 load avg: 2.98 Run 44 tests sequentially
0:00:00 load avg: 2.98 [ 1/44] test_array
0:00:00 load avg: 2.98 [ 2/44] test_base64
0:00:01 load avg: 2.98 [ 3/44] test_binascii
0:00:01 load avg: 2.98 [ 4/44] test_binop
0:00:01 load avg: 2.98 [ 5/44] test_bisect
0:00:01 load avg: 2.98 [ 6/44] test_bytes
0:00:05 load avg: 2.98 [ 7/44] test_bz2
0:00:06 load avg: 2.98 [ 8/44] test_cmath
0:00:06 load avg: 2.98 [ 9/44] test_codecs
0:00:08 load avg: 2.82 [10/44] test_collections
0:00:10 load avg: 2.82 [11/44] test_complex
0:00:10 load avg: 2.82 [12/44] test_dataclasses
0:00:11 load avg: 2.82 [13/44] test_datetime
0:00:16 load avg: 3.16 [14/44] test_decimal
0:00:21 load avg: 3.14 [15/44] test_difflib
0:00:22 load avg: 3.14 [16/44] test_embed
0:00:33 load avg: 3.19 [17/44] test_float
0:00:34 load avg: 3.19 [18/44] test_fstring
0:00:36 load avg: 3.19 [19/44] test_functools
0:00:38 load avg: 3.18 [20/44] test_generators
0:00:39 load avg: 3.18 [21/44] test_hashlib
0:00:40 load avg: 3.18 [22/44] test_heapq
0:00:42 load avg: 3.18 [23/44] test_int
0:00:44 load avg: 3.24 [24/44] test_itertools
0:00:54 load avg: 3.28 [25/44] test_json
0:00:59 load avg: 3.34 [26/44] test_long
0:01:03 load avg: 3.39 [27/44] test_lzma
0:01:03 load avg: 3.39 [28/44] test_math
0:01:07 load avg: 3.39 [29/44] test_memoryview
0:01:08 load avg: 3.36 [30/44] test_operator
0:01:09 load avg: 3.36 [31/44] test_ordered_dict
test test_ordered_dict failed
0:01:12 load avg: 3.25 [32/44] test_patma -- test_ordered_dict failed (4 failures)
0:01:13 load avg: 3.25 [33/44] test_pickle
0:01:21 load avg: 3.23 [34/44] test_pprint
0:01:21 load avg: 3.23 [35/44] test_re
0:01:23 load avg: 3.45 [36/44] test_set
0:01:33 load avg: 3.15 [37/44] test_sqlite3
0:01:35 load avg: 3.15 [38/44] test_statistics -- test_sqlite3 skipped
0:02:00 load avg: 4.33 [39/44] test_str
0:02:07 load avg: 4.30 [40/44] test_struct
test test_struct failed
0:02:10 load avg: 4.28 [41/44] test_tabnanny -- test_struct failed (1 failure)
0:02:12 load avg: 4.10 [42/44] test_time
0:02:16 load avg: 4.10 [43/44] test_xml_etree
0:02:23 load avg: 3.93 [44/44] test_xml_etree_c
Total duration: 2 min 33 sec
Total tests: run=8,756 failures=5 skipped=187
Total test files: run=44/44 failed=2 skipped=1
Result: FAILURE
```
I don't know what the failure is, as using `-v` is not possible:
```
$ ./python -m test --pgo -v
usage: python -m test [options] [test_name1 [test_name2 ...]]
python path/to/Lib/test/regrtest.py [options] [test_name1 [test_name2 ...]]
regrtest.py: error: --pgo/-v don't go together!
Pass -h or --help for complete help.
```
I can however run the pgo tests manually like this:
```
$ ./python -m test -W test_array test_base64 test_binascii test_binop test_bisect test_bytes test_bz2 test_cmath test_codecs test_collections test_complex test_dataclasses test_datetime test_decimal test_difflib test_embed test_float test_fstring test_functools test_generators test_hashlib test_heapq test_int test_itertools test_json test_long test_lzma test_math test_memoryview test_operator test_ordered_dict test_patma test_pickle test_pprint test_re test_set test_sqlite3 test_statistics test_str test_struct test_tabnanny test_time test_xml_etree test_xml_etree_c
Using random seed: 2816723097
0:00:00 load avg: 2.57 Run 44 tests sequentially
0:00:00 load avg: 2.57 [ 1/44] test_array
0:00:02 load avg: 2.57 [ 2/44] test_base64
0:00:02 load avg: 2.57 [ 3/44] test_binascii
0:00:02 load avg: 2.57 [ 4/44] test_binop
0:00:02 load avg: 2.57 [ 5/44] test_bisect
0:00:02 load avg: 2.57 [ 6/44] test_bytes
0:00:07 load avg: 2.44 [ 7/44] test_bz2
0:00:08 load avg: 2.41 [ 8/44] test_cmath
0:00:08 load avg: 2.41 [ 9/44] test_codecs
0:00:10 load avg: 2.41 [10/44] test_collections
0:00:12 load avg: 2.41 [11/44] test_complex
0:00:12 load avg: 2.41 [12/44] test_dataclasses
0:00:13 load avg: 2.93 [13/44] test_datetime
0:00:19 load avg: 3.18 [14/44] test_decimal
0:00:24 load avg: 3.25 [15/44] test_difflib
0:00:26 load avg: 3.25 [16/44] test_embed
0:00:33 load avg: 3.37 [17/44] test_float
0:00:33 load avg: 3.37 [18/44] test_fstring
0:00:34 load avg: 3.37 [19/44] test_functools
0:00:36 load avg: 3.37 [20/44] test_generators
0:00:36 load avg: 3.37 [21/44] test_hashlib
0:00:37 load avg: 3.37 [22/44] test_heapq
0:00:38 load avg: 3.26 [23/44] test_int
0:00:39 load avg: 3.26 [24/44] test_itertools
0:00:49 load avg: 3.54 [25/44] test_json
0:00:58 load avg: 3.68 [26/44] test_long
0:01:05 load avg: 3.78 [27/44] test_lzma
0:01:06 load avg: 3.78 [28/44] test_math
0:01:14 load avg: 3.97 [29/44] test_memoryview
0:01:16 load avg: 3.97 [30/44] test_operator
0:01:17 load avg: 3.97 [31/44] test_ordered_dict
test_abc (test.test_ordered_dict.CPythonBuiltinDictTests.test_abc) ... ok
test_clear (test.test_ordered_dict.CPythonBuiltinDictTests.test_clear) ... ok
test_delitem (test.test_ordered_dict.CPythonBuiltinDictTests.test_delitem) ... ok
test_delitem_hash_collision (test.test_ordered_dict.CPythonBuiltinDictTests.test_delitem_hash_collision) ... ok
test_detect_deletion_during_iteration (test.test_ordered_dict.CPythonBuiltinDictTests.test_detect_deletion_during_iteration) ... ok
test_highly_nested (test.test_ordered_dict.CPythonBuiltinDictTests.test_highly_nested) ... ok
test_highly_nested_subclass (test.test_ordered_dict.CPythonBuiltinDictTests.test_highly_nested_subclass) ... ok
test_init (test.test_ordered_dict.CPythonBuiltinDictTests.test_init) ... ok
test_override_update (test.test_ordered_dict.CPythonBuiltinDictTests.test_override_update) ... ok
test_popitem (test.test_ordered_dict.CPythonBuiltinDictTests.test_popitem) ... ok
test_reinsert (test.test_ordered_dict.CPythonBuiltinDictTests.test_reinsert) ... ok
test_setitem (test.test_ordered_dict.CPythonBuiltinDictTests.test_setitem) ... ok
test_update (test.test_ordered_dict.CPythonBuiltinDictTests.test_update) ... ok
test_bool (test.test_ordered_dict.CPythonGeneralMappingTests.test_bool) ... ok
test_constructor (test.test_ordered_dict.CPythonGeneralMappingTests.test_constructor) ... ok
test_get (test.test_ordered_dict.CPythonGeneralMappingTests.test_get) ... ok
test_getitem (test.test_ordered_dict.CPythonGeneralMappingTests.test_getitem) ... ok
test_items (test.test_ordered_dict.CPythonGeneralMappingTests.test_items) ... ok
test_keys (test.test_ordered_dict.CPythonGeneralMappingTests.test_keys) ... ok
test_len (test.test_ordered_dict.CPythonGeneralMappingTests.test_len) ... ok
test_pop (test.test_ordered_dict.CPythonGeneralMappingTests.test_pop) ... ok
test_popitem (test.test_ordered_dict.CPythonGeneralMappingTests.test_popitem) ... ok
test_read (test.test_ordered_dict.CPythonGeneralMappingTests.test_read) ... ok
test_setdefault (test.test_ordered_dict.CPythonGeneralMappingTests.test_setdefault) ... ok
test_update (test.test_ordered_dict.CPythonGeneralMappingTests.test_update) ... ok
test_values (test.test_ordered_dict.CPythonGeneralMappingTests.test_values) ... ok
test_write (test.test_ordered_dict.CPythonGeneralMappingTests.test_write) ... ok
test_468 (test.test_ordered_dict.CPythonOrderedDictSubclassTests.test_468) ... ok
test_abc (test.test_ordered_dict.CPythonOrderedDictSubclassTests.test_abc) ... ok
test_clear (test.test_ordered_dict.CPythonOrderedDictSubclassTests.test_clear) ... ok
test_copying (test.test_ordered_dict.CPythonOrderedDictSubclassTests.test_copying) ... ok
test_delitem (test.test_ordered_dict.CPythonOrderedDictSubclassTests.test_delitem) ... ok
test_delitem_hash_collision (test.test_ordered_dict.CPythonOrderedDictSubclassTests.test_delitem_hash_collision) ... ok
test_detect_deletion_during_iteration (test.test_ordered_dict.CPythonOrderedDictSubclassTests.test_detect_deletion_during_iteration) ... ok
test_dict_clear (test.test_ordered_dict.CPythonOrderedDictSubclassTests.test_dict_clear) ... ok
test_dict_delitem (test.test_ordered_dict.CPythonOrderedDictSubclassTests.test_dict_delitem) ... ok
test_dict_pop (test.test_ordered_dict.CPythonOrderedDictSubclassTests.test_dict_pop) ... ok
test_dict_popitem (test.test_ordered_dict.CPythonOrderedDictSubclassTests.test_dict_popitem) ... ok
test_dict_setdefault (test.test_ordered_dict.CPythonOrderedDictSubclassTests.test_dict_setdefault) ... ok
test_dict_setitem (test.test_ordered_dict.CPythonOrderedDictSubclassTests.test_dict_setitem) ... ok
test_dict_update (test.test_ordered_dict.CPythonOrderedDictSubclassTests.test_dict_update) ... ok
test_equality (test.test_ordered_dict.CPythonOrderedDictSubclassTests.test_equality) ... ok
test_free_after_iterating (test.test_ordered_dict.CPythonOrderedDictSubclassTests.test_free_after_iterating) ... ok
test_fromkeys (test.test_ordered_dict.CPythonOrderedDictSubclassTests.test_fromkeys) ... ok
test_highly_nested (test.test_ordered_dict.CPythonOrderedDictSubclassTests.test_highly_nested) ... ok
test_highly_nested_subclass (test.test_ordered_dict.CPythonOrderedDictSubclassTests.test_highly_nested_subclass) ... ok
test_init (test.test_ordered_dict.CPythonOrderedDictSubclassTests.test_init) ... ok
test_init_calls (test.test_ordered_dict.CPythonOrderedDictSubclassTests.test_init_calls) ... ok
test_issue24347 (test.test_ordered_dict.CPythonOrderedDictSubclassTests.test_issue24347) ... ok
test_issue24348 (test.test_ordered_dict.CPythonOrderedDictSubclassTests.test_issue24348) ... ok
test_issue24667 (test.test_ordered_dict.CPythonOrderedDictSubclassTests.test_issue24667)
dict resizes after a certain number of insertion operations, ... ok
test_iterators (test.test_ordered_dict.CPythonOrderedDictSubclassTests.test_iterators) ... ok
test_iterators_empty (test.test_ordered_dict.CPythonOrderedDictSubclassTests.test_iterators_empty) ... ok
test_iterators_pickling (test.test_ordered_dict.CPythonOrderedDictSubclassTests.test_iterators_pickling) ... ok
test_key_change_during_iteration (test.test_ordered_dict.CPythonOrderedDictSubclassTests.test_key_change_during_iteration) ... ok
test_merge_operator (test.test_ordered_dict.CPythonOrderedDictSubclassTests.test_merge_operator) ... ok
test_move_to_end (test.test_ordered_dict.CPythonOrderedDictSubclassTests.test_move_to_end) ... ok
test_move_to_end_issue25406 (test.test_ordered_dict.CPythonOrderedDictSubclassTests.test_move_to_end_issue25406) ... ok
test_ordered_dict_items_result_gc (test.test_ordered_dict.CPythonOrderedDictSubclassTests.test_ordered_dict_items_result_gc) ... ok
test_overridden_init (test.test_ordered_dict.CPythonOrderedDictSubclassTests.test_overridden_init) ... ok
test_override_update (test.test_ordered_dict.CPythonOrderedDictSubclassTests.test_override_update) ... ok
test_pickle_recursive (test.test_ordered_dict.CPythonOrderedDictSubclassTests.test_pickle_recursive) ... ok
test_pop (test.test_ordered_dict.CPythonOrderedDictSubclassTests.test_pop) ... ok
test_popitem (test.test_ordered_dict.CPythonOrderedDictSubclassTests.test_popitem) ... ok
test_popitem_last (test.test_ordered_dict.CPythonOrderedDictSubclassTests.test_popitem_last) ... ok
test_reduce_not_too_fat (test.test_ordered_dict.CPythonOrderedDictSubclassTests.test_reduce_not_too_fat) ... ok
test_reference_loop (test.test_ordered_dict.CPythonOrderedDictSubclassTests.test_reference_loop) ... FAIL
test_reinsert (test.test_ordered_dict.CPythonOrderedDictSubclassTests.test_reinsert) ... ok
test_repr (test.test_ordered_dict.CPythonOrderedDictSubclassTests.test_repr) ... ok
test_repr_recursive (test.test_ordered_dict.CPythonOrderedDictSubclassTests.test_repr_recursive) ... ok
test_repr_recursive_values (test.test_ordered_dict.CPythonOrderedDictSubclassTests.test_repr_recursive_values) ... ok
test_setdefault (test.test_ordered_dict.CPythonOrderedDictSubclassTests.test_setdefault) ... ok
test_setitem (test.test_ordered_dict.CPythonOrderedDictSubclassTests.test_setitem) ... ok
test_sizeof (test.test_ordered_dict.CPythonOrderedDictSubclassTests.test_sizeof) ... ok
test_sizeof_exact (test.test_ordered_dict.CPythonOrderedDictSubclassTests.test_sizeof_exact) ... ok
test_sorted_iterators (test.test_ordered_dict.CPythonOrderedDictSubclassTests.test_sorted_iterators) ... ok
test_update (test.test_ordered_dict.CPythonOrderedDictSubclassTests.test_update) ... ok
test_views (test.test_ordered_dict.CPythonOrderedDictSubclassTests.test_views) ... ok
test_weakref_list_is_not_traversed (test.test_ordered_dict.CPythonOrderedDictSubclassTests.test_weakref_list_is_not_traversed) ... ok
test_yaml_linkage (test.test_ordered_dict.CPythonOrderedDictSubclassTests.test_yaml_linkage) ... ok
test_468 (test.test_ordered_dict.CPythonOrderedDictTests.test_468) ... ok
test_abc (test.test_ordered_dict.CPythonOrderedDictTests.test_abc) ... ok
test_clear (test.test_ordered_dict.CPythonOrderedDictTests.test_clear) ... ok
test_copying (test.test_ordered_dict.CPythonOrderedDictTests.test_copying) ... ok
test_delitem (test.test_ordered_dict.CPythonOrderedDictTests.test_delitem) ... ok
test_delitem_hash_collision (test.test_ordered_dict.CPythonOrderedDictTests.test_delitem_hash_collision) ... ok
test_detect_deletion_during_iteration (test.test_ordered_dict.CPythonOrderedDictTests.test_detect_deletion_during_iteration) ... ok
test_dict_clear (test.test_ordered_dict.CPythonOrderedDictTests.test_dict_clear) ... ok
test_dict_delitem (test.test_ordered_dict.CPythonOrderedDictTests.test_dict_delitem) ... ok
test_dict_pop (test.test_ordered_dict.CPythonOrderedDictTests.test_dict_pop) ... ok
test_dict_popitem (test.test_ordered_dict.CPythonOrderedDictTests.test_dict_popitem) ... ok
test_dict_setdefault (test.test_ordered_dict.CPythonOrderedDictTests.test_dict_setdefault) ... ok
test_dict_setitem (test.test_ordered_dict.CPythonOrderedDictTests.test_dict_setitem) ... ok
test_dict_update (test.test_ordered_dict.CPythonOrderedDictTests.test_dict_update) ... ok
test_equality (test.test_ordered_dict.CPythonOrderedDictTests.test_equality) ... ok
test_free_after_iterating (test.test_ordered_dict.CPythonOrderedDictTests.test_free_after_iterating) ... ok
test_fromkeys (test.test_ordered_dict.CPythonOrderedDictTests.test_fromkeys) ... ok
test_highly_nested (test.test_ordered_dict.CPythonOrderedDictTests.test_highly_nested) ... ok
test_highly_nested_subclass (test.test_ordered_dict.CPythonOrderedDictTests.test_highly_nested_subclass) ... ok
test_init (test.test_ordered_dict.CPythonOrderedDictTests.test_init) ... ok
test_init_calls (test.test_ordered_dict.CPythonOrderedDictTests.test_init_calls) ... ok
test_issue24347 (test.test_ordered_dict.CPythonOrderedDictTests.test_issue24347) ... ok
test_issue24348 (test.test_ordered_dict.CPythonOrderedDictTests.test_issue24348) ... ok
test_issue24667 (test.test_ordered_dict.CPythonOrderedDictTests.test_issue24667)
dict resizes after a certain number of insertion operations, ... ok
test_iterators (test.test_ordered_dict.CPythonOrderedDictTests.test_iterators) ... ok
test_iterators_empty (test.test_ordered_dict.CPythonOrderedDictTests.test_iterators_empty) ... ok
test_iterators_pickling (test.test_ordered_dict.CPythonOrderedDictTests.test_iterators_pickling) ... ok
test_key_change_during_iteration (test.test_ordered_dict.CPythonOrderedDictTests.test_key_change_during_iteration) ... ok
test_merge_operator (test.test_ordered_dict.CPythonOrderedDictTests.test_merge_operator) ... ok
test_move_to_end (test.test_ordered_dict.CPythonOrderedDictTests.test_move_to_end) ... ok
test_move_to_end_issue25406 (test.test_ordered_dict.CPythonOrderedDictTests.test_move_to_end_issue25406) ... ok
test_ordered_dict_items_result_gc (test.test_ordered_dict.CPythonOrderedDictTests.test_ordered_dict_items_result_gc) ... ok
test_overridden_init (test.test_ordered_dict.CPythonOrderedDictTests.test_overridden_init) ... ok
test_override_update (test.test_ordered_dict.CPythonOrderedDictTests.test_override_update) ... ok
test_pickle_recursive (test.test_ordered_dict.CPythonOrderedDictTests.test_pickle_recursive) ... ok
test_pop (test.test_ordered_dict.CPythonOrderedDictTests.test_pop) ... ok
test_popitem (test.test_ordered_dict.CPythonOrderedDictTests.test_popitem) ... ok
test_popitem_last (test.test_ordered_dict.CPythonOrderedDictTests.test_popitem_last) ... ok
test_reduce_not_too_fat (test.test_ordered_dict.CPythonOrderedDictTests.test_reduce_not_too_fat) ... ok
test_reference_loop (test.test_ordered_dict.CPythonOrderedDictTests.test_reference_loop) ... FAIL
test_reinsert (test.test_ordered_dict.CPythonOrderedDictTests.test_reinsert) ... ok
test_repr (test.test_ordered_dict.CPythonOrderedDictTests.test_repr) ... ok
test_repr_recursive (test.test_ordered_dict.CPythonOrderedDictTests.test_repr_recursive) ... ok
test_repr_recursive_values (test.test_ordered_dict.CPythonOrderedDictTests.test_repr_recursive_values) ... ok
test_setdefault (test.test_ordered_dict.CPythonOrderedDictTests.test_setdefault) ... ok
test_setitem (test.test_ordered_dict.CPythonOrderedDictTests.test_setitem) ... ok
test_sizeof (test.test_ordered_dict.CPythonOrderedDictTests.test_sizeof) ... ok
test_sizeof_exact (test.test_ordered_dict.CPythonOrderedDictTests.test_sizeof_exact) ... ok
test_sorted_iterators (test.test_ordered_dict.CPythonOrderedDictTests.test_sorted_iterators) ... ok
test_update (test.test_ordered_dict.CPythonOrderedDictTests.test_update) ... ok
test_views (test.test_ordered_dict.CPythonOrderedDictTests.test_views) ... ok
test_weakref_list_is_not_traversed (test.test_ordered_dict.CPythonOrderedDictTests.test_weakref_list_is_not_traversed) ... ok
test_yaml_linkage (test.test_ordered_dict.CPythonOrderedDictTests.test_yaml_linkage) ... ok
test_copying (test.test_ordered_dict.CPythonOrderedDictWithSlotsCopyingTests.test_copying) ... ok
test_bool (test.test_ordered_dict.CPythonSubclassMappingTests.test_bool) ... ok
test_constructor (test.test_ordered_dict.CPythonSubclassMappingTests.test_constructor) ... ok
test_get (test.test_ordered_dict.CPythonSubclassMappingTests.test_get) ... ok
test_getitem (test.test_ordered_dict.CPythonSubclassMappingTests.test_getitem) ... ok
test_items (test.test_ordered_dict.CPythonSubclassMappingTests.test_items) ... ok
test_keys (test.test_ordered_dict.CPythonSubclassMappingTests.test_keys) ... ok
test_len (test.test_ordered_dict.CPythonSubclassMappingTests.test_len) ... ok
test_pop (test.test_ordered_dict.CPythonSubclassMappingTests.test_pop) ... ok
test_popitem (test.test_ordered_dict.CPythonSubclassMappingTests.test_popitem) ... ok
test_read (test.test_ordered_dict.CPythonSubclassMappingTests.test_read) ... ok
test_setdefault (test.test_ordered_dict.CPythonSubclassMappingTests.test_setdefault) ... ok
test_update (test.test_ordered_dict.CPythonSubclassMappingTests.test_update) ... ok
test_values (test.test_ordered_dict.CPythonSubclassMappingTests.test_values) ... ok
test_write (test.test_ordered_dict.CPythonSubclassMappingTests.test_write) ... ok
test_add_after_full (test.test_ordered_dict.CSimpleLRUCacheTests.test_add_after_full) ... ok
test_change_order_on_get (test.test_ordered_dict.CSimpleLRUCacheTests.test_change_order_on_get) ... ok
test_pop (test.test_ordered_dict.CSimpleLRUCacheTests.test_pop) ... ok
test_popitem (test.test_ordered_dict.CSimpleLRUCacheTests.test_popitem) ... ok
test_bool (test.test_ordered_dict.PurePythonGeneralMappingTests.test_bool) ... ok
test_constructor (test.test_ordered_dict.PurePythonGeneralMappingTests.test_constructor) ... ok
test_get (test.test_ordered_dict.PurePythonGeneralMappingTests.test_get) ... ok
test_getitem (test.test_ordered_dict.PurePythonGeneralMappingTests.test_getitem) ... ok
test_items (test.test_ordered_dict.PurePythonGeneralMappingTests.test_items) ... ok
test_keys (test.test_ordered_dict.PurePythonGeneralMappingTests.test_keys) ... ok
test_len (test.test_ordered_dict.PurePythonGeneralMappingTests.test_len) ... ok
test_pop (test.test_ordered_dict.PurePythonGeneralMappingTests.test_pop) ... ok
test_popitem (test.test_ordered_dict.PurePythonGeneralMappingTests.test_popitem) ... ok
test_read (test.test_ordered_dict.PurePythonGeneralMappingTests.test_read) ... ok
test_setdefault (test.test_ordered_dict.PurePythonGeneralMappingTests.test_setdefault) ... ok
test_update (test.test_ordered_dict.PurePythonGeneralMappingTests.test_update) ... ok
test_values (test.test_ordered_dict.PurePythonGeneralMappingTests.test_values) ... ok
test_write (test.test_ordered_dict.PurePythonGeneralMappingTests.test_write) ... ok
test_468 (test.test_ordered_dict.PurePythonOrderedDictSubclassTests.test_468) ... ok
test_abc (test.test_ordered_dict.PurePythonOrderedDictSubclassTests.test_abc) ... ok
test_clear (test.test_ordered_dict.PurePythonOrderedDictSubclassTests.test_clear) ... ok
test_copying (test.test_ordered_dict.PurePythonOrderedDictSubclassTests.test_copying) ... ok
test_delitem (test.test_ordered_dict.PurePythonOrderedDictSubclassTests.test_delitem) ... ok
test_delitem_hash_collision (test.test_ordered_dict.PurePythonOrderedDictSubclassTests.test_delitem_hash_collision) ... ok
test_detect_deletion_during_iteration (test.test_ordered_dict.PurePythonOrderedDictSubclassTests.test_detect_deletion_during_iteration) ... ok
test_dict_clear (test.test_ordered_dict.PurePythonOrderedDictSubclassTests.test_dict_clear) ... ok
test_dict_delitem (test.test_ordered_dict.PurePythonOrderedDictSubclassTests.test_dict_delitem) ... ok
test_dict_pop (test.test_ordered_dict.PurePythonOrderedDictSubclassTests.test_dict_pop) ... ok
test_dict_popitem (test.test_ordered_dict.PurePythonOrderedDictSubclassTests.test_dict_popitem) ... ok
test_dict_setdefault (test.test_ordered_dict.PurePythonOrderedDictSubclassTests.test_dict_setdefault) ... ok
test_dict_setitem (test.test_ordered_dict.PurePythonOrderedDictSubclassTests.test_dict_setitem) ... ok
test_dict_update (test.test_ordered_dict.PurePythonOrderedDictSubclassTests.test_dict_update) ... ok
test_equality (test.test_ordered_dict.PurePythonOrderedDictSubclassTests.test_equality) ... ok
test_free_after_iterating (test.test_ordered_dict.PurePythonOrderedDictSubclassTests.test_free_after_iterating) ... ok
test_fromkeys (test.test_ordered_dict.PurePythonOrderedDictSubclassTests.test_fromkeys) ... ok
test_highly_nested (test.test_ordered_dict.PurePythonOrderedDictSubclassTests.test_highly_nested) ... ok
test_highly_nested_subclass (test.test_ordered_dict.PurePythonOrderedDictSubclassTests.test_highly_nested_subclass) ... ok
test_init (test.test_ordered_dict.PurePythonOrderedDictSubclassTests.test_init) ... ok
test_init_calls (test.test_ordered_dict.PurePythonOrderedDictSubclassTests.test_init_calls) ... ok
test_issue24347 (test.test_ordered_dict.PurePythonOrderedDictSubclassTests.test_issue24347) ... ok
test_issue24348 (test.test_ordered_dict.PurePythonOrderedDictSubclassTests.test_issue24348) ... ok
test_issue24667 (test.test_ordered_dict.PurePythonOrderedDictSubclassTests.test_issue24667)
dict resizes after a certain number of insertion operations, ... ok
test_iterators (test.test_ordered_dict.PurePythonOrderedDictSubclassTests.test_iterators) ... ok
test_iterators_empty (test.test_ordered_dict.PurePythonOrderedDictSubclassTests.test_iterators_empty) ... ok
test_merge_operator (test.test_ordered_dict.PurePythonOrderedDictSubclassTests.test_merge_operator) ... ok
test_move_to_end (test.test_ordered_dict.PurePythonOrderedDictSubclassTests.test_move_to_end) ... ok
test_move_to_end_issue25406 (test.test_ordered_dict.PurePythonOrderedDictSubclassTests.test_move_to_end_issue25406) ... ok
test_ordered_dict_items_result_gc (test.test_ordered_dict.PurePythonOrderedDictSubclassTests.test_ordered_dict_items_result_gc) ... ok
test_overridden_init (test.test_ordered_dict.PurePythonOrderedDictSubclassTests.test_overridden_init) ... ok
test_override_update (test.test_ordered_dict.PurePythonOrderedDictSubclassTests.test_override_update) ... ok
test_pickle_recursive (test.test_ordered_dict.PurePythonOrderedDictSubclassTests.test_pickle_recursive) ... ok
test_pop (test.test_ordered_dict.PurePythonOrderedDictSubclassTests.test_pop) ... ok
test_popitem (test.test_ordered_dict.PurePythonOrderedDictSubclassTests.test_popitem) ... ok
test_popitem_last (test.test_ordered_dict.PurePythonOrderedDictSubclassTests.test_popitem_last) ... ok
test_reduce_not_too_fat (test.test_ordered_dict.PurePythonOrderedDictSubclassTests.test_reduce_not_too_fat) ... ok
test_reference_loop (test.test_ordered_dict.PurePythonOrderedDictSubclassTests.test_reference_loop) ... FAIL
test_reinsert (test.test_ordered_dict.PurePythonOrderedDictSubclassTests.test_reinsert) ... ok
test_repr (test.test_ordered_dict.PurePythonOrderedDictSubclassTests.test_repr) ... ok
test_repr_recursive (test.test_ordered_dict.PurePythonOrderedDictSubclassTests.test_repr_recursive) ... ok
test_repr_recursive_values (test.test_ordered_dict.PurePythonOrderedDictSubclassTests.test_repr_recursive_values) ... ok
test_setdefault (test.test_ordered_dict.PurePythonOrderedDictSubclassTests.test_setdefault) ... ok
test_setitem (test.test_ordered_dict.PurePythonOrderedDictSubclassTests.test_setitem) ... ok
test_sizeof (test.test_ordered_dict.PurePythonOrderedDictSubclassTests.test_sizeof) ... ok
test_sorted_iterators (test.test_ordered_dict.PurePythonOrderedDictSubclassTests.test_sorted_iterators) ... ok
test_update (test.test_ordered_dict.PurePythonOrderedDictSubclassTests.test_update) ... ok
test_views (test.test_ordered_dict.PurePythonOrderedDictSubclassTests.test_views) ... ok
test_yaml_linkage (test.test_ordered_dict.PurePythonOrderedDictSubclassTests.test_yaml_linkage) ... ok
test_468 (test.test_ordered_dict.PurePythonOrderedDictTests.test_468) ... ok
test_abc (test.test_ordered_dict.PurePythonOrderedDictTests.test_abc) ... ok
test_clear (test.test_ordered_dict.PurePythonOrderedDictTests.test_clear) ... ok
test_copying (test.test_ordered_dict.PurePythonOrderedDictTests.test_copying) ... ok
test_delitem (test.test_ordered_dict.PurePythonOrderedDictTests.test_delitem) ... ok
test_delitem_hash_collision (test.test_ordered_dict.PurePythonOrderedDictTests.test_delitem_hash_collision) ... ok
test_detect_deletion_during_iteration (test.test_ordered_dict.PurePythonOrderedDictTests.test_detect_deletion_during_iteration) ... ok
test_dict_clear (test.test_ordered_dict.PurePythonOrderedDictTests.test_dict_clear) ... ok
test_dict_delitem (test.test_ordered_dict.PurePythonOrderedDictTests.test_dict_delitem) ... ok
test_dict_pop (test.test_ordered_dict.PurePythonOrderedDictTests.test_dict_pop) ... ok
test_dict_popitem (test.test_ordered_dict.PurePythonOrderedDictTests.test_dict_popitem) ... ok
test_dict_setdefault (test.test_ordered_dict.PurePythonOrderedDictTests.test_dict_setdefault) ... ok
test_dict_setitem (test.test_ordered_dict.PurePythonOrderedDictTests.test_dict_setitem) ... ok
test_dict_update (test.test_ordered_dict.PurePythonOrderedDictTests.test_dict_update) ... ok
test_equality (test.test_ordered_dict.PurePythonOrderedDictTests.test_equality) ... ok
test_free_after_iterating (test.test_ordered_dict.PurePythonOrderedDictTests.test_free_after_iterating) ... ok
test_fromkeys (test.test_ordered_dict.PurePythonOrderedDictTests.test_fromkeys) ... ok
test_highly_nested (test.test_ordered_dict.PurePythonOrderedDictTests.test_highly_nested) ... ok
test_highly_nested_subclass (test.test_ordered_dict.PurePythonOrderedDictTests.test_highly_nested_subclass) ... ok
test_init (test.test_ordered_dict.PurePythonOrderedDictTests.test_init) ... ok
test_init_calls (test.test_ordered_dict.PurePythonOrderedDictTests.test_init_calls) ... ok
test_issue24347 (test.test_ordered_dict.PurePythonOrderedDictTests.test_issue24347) ... ok
test_issue24348 (test.test_ordered_dict.PurePythonOrderedDictTests.test_issue24348) ... ok
test_issue24667 (test.test_ordered_dict.PurePythonOrderedDictTests.test_issue24667)
dict resizes after a certain number of insertion operations, ... ok
test_iterators (test.test_ordered_dict.PurePythonOrderedDictTests.test_iterators) ... ok
test_iterators_empty (test.test_ordered_dict.PurePythonOrderedDictTests.test_iterators_empty) ... ok
test_merge_operator (test.test_ordered_dict.PurePythonOrderedDictTests.test_merge_operator) ... ok
test_move_to_end (test.test_ordered_dict.PurePythonOrderedDictTests.test_move_to_end) ... ok
test_move_to_end_issue25406 (test.test_ordered_dict.PurePythonOrderedDictTests.test_move_to_end_issue25406) ... ok
test_ordered_dict_items_result_gc (test.test_ordered_dict.PurePythonOrderedDictTests.test_ordered_dict_items_result_gc) ... ok
test_overridden_init (test.test_ordered_dict.PurePythonOrderedDictTests.test_overridden_init) ... ok
test_override_update (test.test_ordered_dict.PurePythonOrderedDictTests.test_override_update) ... ok
test_pickle_recursive (test.test_ordered_dict.PurePythonOrderedDictTests.test_pickle_recursive) ... ok
test_pop (test.test_ordered_dict.PurePythonOrderedDictTests.test_pop) ... ok
test_popitem (test.test_ordered_dict.PurePythonOrderedDictTests.test_popitem) ... ok
test_popitem_last (test.test_ordered_dict.PurePythonOrderedDictTests.test_popitem_last) ... ok
test_reduce_not_too_fat (test.test_ordered_dict.PurePythonOrderedDictTests.test_reduce_not_too_fat) ... ok
test_reference_loop (test.test_ordered_dict.PurePythonOrderedDictTests.test_reference_loop) ... FAIL
test_reinsert (test.test_ordered_dict.PurePythonOrderedDictTests.test_reinsert) ... ok
test_repr (test.test_ordered_dict.PurePythonOrderedDictTests.test_repr) ... ok
test_repr_recursive (test.test_ordered_dict.PurePythonOrderedDictTests.test_repr_recursive) ... ok
test_repr_recursive_values (test.test_ordered_dict.PurePythonOrderedDictTests.test_repr_recursive_values) ... ok
test_setdefault (test.test_ordered_dict.PurePythonOrderedDictTests.test_setdefault) ... ok
test_setitem (test.test_ordered_dict.PurePythonOrderedDictTests.test_setitem) ... ok
test_sizeof (test.test_ordered_dict.PurePythonOrderedDictTests.test_sizeof) ... ok
test_sorted_iterators (test.test_ordered_dict.PurePythonOrderedDictTests.test_sorted_iterators) ... ok
test_update (test.test_ordered_dict.PurePythonOrderedDictTests.test_update) ... ok
test_views (test.test_ordered_dict.PurePythonOrderedDictTests.test_views) ... ok
test_yaml_linkage (test.test_ordered_dict.PurePythonOrderedDictTests.test_yaml_linkage) ... ok
test_copying (test.test_ordered_dict.PurePythonOrderedDictWithSlotsCopyingTests.test_copying) ... ok
test_bool (test.test_ordered_dict.PurePythonSubclassMappingTests.test_bool) ... ok
test_constructor (test.test_ordered_dict.PurePythonSubclassMappingTests.test_constructor) ... ok
test_get (test.test_ordered_dict.PurePythonSubclassMappingTests.test_get) ... ok
test_getitem (test.test_ordered_dict.PurePythonSubclassMappingTests.test_getitem) ... ok
test_items (test.test_ordered_dict.PurePythonSubclassMappingTests.test_items) ... ok
test_keys (test.test_ordered_dict.PurePythonSubclassMappingTests.test_keys) ... ok
test_len (test.test_ordered_dict.PurePythonSubclassMappingTests.test_len) ... ok
test_pop (test.test_ordered_dict.PurePythonSubclassMappingTests.test_pop) ... ok
test_popitem (test.test_ordered_dict.PurePythonSubclassMappingTests.test_popitem) ... ok
test_read (test.test_ordered_dict.PurePythonSubclassMappingTests.test_read) ... ok
test_setdefault (test.test_ordered_dict.PurePythonSubclassMappingTests.test_setdefault) ... ok
test_update (test.test_ordered_dict.PurePythonSubclassMappingTests.test_update) ... ok
test_values (test.test_ordered_dict.PurePythonSubclassMappingTests.test_values) ... ok
test_write (test.test_ordered_dict.PurePythonSubclassMappingTests.test_write) ... ok
test_add_after_full (test.test_ordered_dict.PySimpleLRUCacheTests.test_add_after_full) ... ok
test_change_order_on_get (test.test_ordered_dict.PySimpleLRUCacheTests.test_change_order_on_get) ... ok
test_pop (test.test_ordered_dict.PySimpleLRUCacheTests.test_pop) ... ok
test_popitem (test.test_ordered_dict.PySimpleLRUCacheTests.test_popitem) ... ok
======================================================================
FAIL: test_reference_loop (test.test_ordered_dict.CPythonOrderedDictSubclassTests.test_reference_loop)
----------------------------------------------------------------------
Traceback (most recent call last):
File ".../cpython/Lib/test/test_ordered_dict.py", line 679, in test_reference_loop
self.assertIsNone(r())
~~~~~~~~~~~~~~~~~^^^^^
AssertionError: <class 'test.test_ordered_dict.OrderedDictTests.test_reference_loop.<locals>.A'> is not None
======================================================================
FAIL: test_reference_loop (test.test_ordered_dict.CPythonOrderedDictTests.test_reference_loop)
----------------------------------------------------------------------
Traceback (most recent call last):
File ".../cpython/Lib/test/test_ordered_dict.py", line 679, in test_reference_loop
self.assertIsNone(r())
~~~~~~~~~~~~~~~~~^^^^^
AssertionError: <class 'test.test_ordered_dict.OrderedDictTests.test_reference_loop.<locals>.A'> is not None
======================================================================
FAIL: test_reference_loop (test.test_ordered_dict.PurePythonOrderedDictSubclassTests.test_reference_loop)
----------------------------------------------------------------------
Traceback (most recent call last):
File ".../cpython/Lib/test/test_ordered_dict.py", line 679, in test_reference_loop
self.assertIsNone(r())
~~~~~~~~~~~~~~~~~^^^^^
AssertionError: <class 'test.test_ordered_dict.OrderedDictTests.test_reference_loop.<locals>.A'> is not None
======================================================================
FAIL: test_reference_loop (test.test_ordered_dict.PurePythonOrderedDictTests.test_reference_loop)
----------------------------------------------------------------------
Traceback (most recent call last):
File ".../cpython/Lib/test/test_ordered_dict.py", line 679, in test_reference_loop
self.assertIsNone(r())
~~~~~~~~~~~~~~~~~^^^^^
AssertionError: <class 'test.test_ordered_dict.OrderedDictTests.test_reference_loop.<locals>.A'> is not None
----------------------------------------------------------------------
Ran 283 tests in 3.262s
FAILED (failures=4)
test test_ordered_dict failed
0:01:21 load avg: 3.81 [32/44/1] test_patma -- test_ordered_dict failed (4 failures)
0:01:21 load avg: 3.81 [33/44/1] test_pickle
0:01:33 load avg: 3.63 [34/44/1] test_pprint
0:01:34 load avg: 3.63 [35/44/1] test_re
0:01:36 load avg: 3.63 [36/44/1] test_set
0:01:45 load avg: 3.68 [37/44/1] test_sqlite3
test_sqlite3 skipped -- No module named '_sqlite3'
0:01:46 load avg: 3.68 [38/44/1] test_statistics -- test_sqlite3 skipped
0:01:57 load avg: 3.50 [39/44/1] test_str
0:02:06 load avg: 3.19 [40/44/1] test_struct
test_1530559 (test.test_struct.StructTest.test_1530559) ... ok
test_705836 (test.test_struct.StructTest.test_705836) ... ok
test_Struct_reinitialization (test.test_struct.StructTest.test_Struct_reinitialization) ... ok
test__sizeof__ (test.test_struct.StructTest.test__sizeof__) ... ok
test__struct_reference_cycle_cleaned_up (test.test_struct.StructTest.test__struct_reference_cycle_cleaned_up) ... FAIL
test__struct_types_immutable (test.test_struct.StructTest.test__struct_types_immutable) ... ok
test_bool (test.test_struct.StructTest.test_bool) ... ok
test_boundary_error_message (test.test_struct.StructTest.test_boundary_error_message) ... ok
test_boundary_error_message_with_large_offset (test.test_struct.StructTest.test_boundary_error_message_with_large_offset) ... ok
test_boundary_error_message_with_negative_offset (test.test_struct.StructTest.test_boundary_error_message_with_negative_offset) ... ok
test_calcsize (test.test_struct.StructTest.test_calcsize) ... ok
test_consistence (test.test_struct.StructTest.test_consistence) ... ok
test_count_overflow (test.test_struct.StructTest.test_count_overflow) ... ok
test_format_attr (test.test_struct.StructTest.test_format_attr) ... ok
test_integers (test.test_struct.StructTest.test_integers) ... ok
test_isbigendian (test.test_struct.StructTest.test_isbigendian) ... ok
test_issue29802 (test.test_struct.StructTest.test_issue29802) ... ok
test_issue35714 (test.test_struct.StructTest.test_issue35714) ... ok
test_issue98248 (test.test_struct.StructTest.test_issue98248) ... ok
test_issue98248_error_propagation (test.test_struct.StructTest.test_issue98248_error_propagation) ... ok
test_nN_code (test.test_struct.StructTest.test_nN_code) ... ok
test_new_features (test.test_struct.StructTest.test_new_features) ... ok
test_p_code (test.test_struct.StructTest.test_p_code) ... ok
test_pack_into (test.test_struct.StructTest.test_pack_into) ... ok
test_pack_into_fn (test.test_struct.StructTest.test_pack_into_fn) ... ok
test_repr (test.test_struct.StructTest.test_repr) ... ok
test_struct_cleans_up_at_runtime_shutdown (test.test_struct.StructTest.test_struct_cleans_up_at_runtime_shutdown) ... ok
test_struct_subclass_instantiation (test.test_struct.StructTest.test_struct_subclass_instantiation) ... ok
test_trailing_counter (test.test_struct.StructTest.test_trailing_counter) ... ok
test_transitiveness (test.test_struct.StructTest.test_transitiveness) ... ok
test_unpack_from (test.test_struct.StructTest.test_unpack_from) ... ok
test_unpack_with_buffer (test.test_struct.StructTest.test_unpack_with_buffer) ... ok
test_arbitrary_buffer (test.test_struct.UnpackIteratorTest.test_arbitrary_buffer) ... ok
test_construct (test.test_struct.UnpackIteratorTest.test_construct) ... ok
test_half_float (test.test_struct.UnpackIteratorTest.test_half_float) ... ok
test_iterate (test.test_struct.UnpackIteratorTest.test_iterate) ... ok
test_length_hint (test.test_struct.UnpackIteratorTest.test_length_hint) ... ok
test_module_func (test.test_struct.UnpackIteratorTest.test_module_func) ... ok
test_uninstantiable (test.test_struct.UnpackIteratorTest.test_uninstantiable) ... ok
======================================================================
FAIL: test__struct_reference_cycle_cleaned_up (test.test_struct.StructTest.test__struct_reference_cycle_cleaned_up)
----------------------------------------------------------------------
Traceback (most recent call last):
File ".../cpython/Lib/test/test_struct.py", line 689, in test__struct_reference_cycle_cleaned_up
self.assertIsNone(
~~~~~~~~~~~~~~~~~^
module_ref(), "_struct module was not garbage collected")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: <module '_struct' from '.../cpython/build/lib.linux-x86_64-3.13/_struct.cpython-313t-x86_64-linux-gnu.so'> is not None : _struct module was not garbage collected
----------------------------------------------------------------------
Ran 39 tests in 1.714s
FAILED (failures=1)
test test_struct failed
0:02:10 load avg: 3.33 [41/44/2] test_tabnanny -- test_struct failed (1 failure)
0:02:14 load avg: 3.39 [42/44/2] test_time
0:02:20 load avg: 3.84 [43/44/2] test_xml_etree
0:02:32 load avg: 3.94 [44/44/2] test_xml_etree_c
== Tests result: FAILURE ==
1 test skipped:
test_sqlite3
2 tests failed:
test_ordered_dict test_struct
41 tests OK.
Total duration: 2 min 41 sec
Total tests: run=8,756 failures=5 skipped=178
Total test files: run=44/44 failed=2 skipped=1
Result: FAILURE
```
### CPython versions tested on:
3.13
### Operating systems tested on:
Linux
<!-- gh-linked-prs -->
### Linked PRs
* gh-118862
* gh-118864
* gh-118867
* gh-118927
<!-- /gh-linked-prs -->
| 1b1db2fd9a531e26b79b34667bccfb938c4d184d | 71cc0651e79041abd648595f3030dfa41009137a |
python/cpython | python__cpython-118935 | # --disable-gil & --enable-experimental-jit fails to build on M1 Mac
# Bug report
### Bug description:
On my M1 Mac, if I configure like so: `./configure --disable-gil --enable-experimental-jit` I get a compilation error:
```
gcc -c -fno-strict-overflow -Wsign-compare -Wunreachable-code -DNDEBUG -g -O3 -Wall -D_Py_TIER2=1 -D_Py_JIT -std=c11 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration -fvisibility=hidden -I./Include/internal -I./Include/internal/mimalloc -I. -I./Include -DPy_BUILD_CORE -o Python/jit.o Python/jit.c
In file included from Python/jit.c:392:
./jit_stencils.h:13419:49: error: use of undeclared identifier '_PyCriticalSection_Resume'
patch_aarch64_16a(code + 0x198, (uintptr_t)&_PyCriticalSection_Resume);
```
(followed by many more of the same error).
I don't recall if I've tried this configure combination before or not. I'm using Apple's clang on an up-to-date MacOS (14.4.1):
```
% gcc --version
Apple clang version 15.0.0 (clang-1500.3.9.4)
Target: arm64-apple-darwin23.4.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
```
### CPython versions tested on:
CPython main branch
### Operating systems tested on:
macOS
<!-- gh-linked-prs -->
### Linked PRs
* gh-118935
* gh-118959
<!-- /gh-linked-prs -->
| 5b941e57c71d7d0ab983d81a169f892662cfe446 | abead548af0172dabba13da8bacf2da3c02d4927 |
python/cpython | python__cpython-119000 | # `--enable-experimental-jit` fails to build: `AssertionError: SHT_NOTE` in 3.13.0b1
# Bug report
### Bug description:
When trying to build CPython with `--enable-experimental-jit` against LLVM 18.1.5, I'm getting the following error:
```pytb
$ make
python3.13 ./Tools/jit/build.py x86_64-pc-linux-gnu
==========================================================
JIT support for x86_64-pc-linux-gnu is still experimental!
Please report any issues you encounter.
==========================================================
+ Exception Group Traceback (most recent call last):
| File "/home/mgorny/git/cpython/./Tools/jit/build.py", line 28, in <module>
| args.target.build(pathlib.Path.cwd(), comment=comment, force=args.force)
| ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/home/mgorny/git/cpython/Tools/jit/_targets.py", line 214, in build
| stencil_groups = asyncio.run(self._build_stencils())
| File "/usr/lib/python3.13/asyncio/runners.py", line 194, in run
| return runner.run(main)
| ~~~~~~~~~~^^^^^^
| File "/usr/lib/python3.13/asyncio/runners.py", line 118, in run
| return self._loop.run_until_complete(task)
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
| File "/usr/lib/python3.13/asyncio/base_events.py", line 721, in run_until_complete
| return future.result()
| ~~~~~~~~~~~~~^^
| File "/home/mgorny/git/cpython/Tools/jit/_targets.py", line 189, in _build_stencils
| async with asyncio.TaskGroup() as group:
| ...<4 lines>...
| tasks.append(group.create_task(coro, name=opname))
| File "/usr/lib/python3.13/asyncio/taskgroups.py", line 154, in __aexit__
| raise me from None
| ExceptionGroup: unhandled errors in a TaskGroup (2 sub-exceptions)
+-+---------------- 1 ----------------
| Traceback (most recent call last):
| File "/home/mgorny/git/cpython/Tools/jit/_targets.py", line 181, in _compile
| return await self._parse(o)
| ^^^^^^^^^^^^^^^^^^^^
| File "/home/mgorny/git/cpython/Tools/jit/_targets.py", line 89, in _parse
| self._handle_section(wrapped_section["Section"], group)
| ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/home/mgorny/git/cpython/Tools/jit/_targets.py", line 349, in _handle_section
| assert section_type in {
| ^^^^^^^^^^^^^^^^^
| ...<5 lines>...
| }, section_type
| ^
| AssertionError: SHT_NOTE
+---------------- 2 ----------------
| Traceback (most recent call last):
| File "/home/mgorny/git/cpython/Tools/jit/_targets.py", line 181, in _compile
| return await self._parse(o)
| ^^^^^^^^^^^^^^^^^^^^
| File "/home/mgorny/git/cpython/Tools/jit/_targets.py", line 89, in _parse
| self._handle_section(wrapped_section["Section"], group)
| ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/home/mgorny/git/cpython/Tools/jit/_targets.py", line 349, in _handle_section
| assert section_type in {
| ^^^^^^^^^^^^^^^^^
| ...<5 lines>...
| }, section_type
| ^
| AssertionError: SHT_NOTE
+------------------------------------
Exception ignored in: <function BaseSubprocessTransport.__del__ at 0x7f2fa5251760>
Traceback (most recent call last):
File "/usr/lib/python3.13/asyncio/base_subprocess.py", line 127, in __del__
File "/usr/lib/python3.13/asyncio/base_subprocess.py", line 104, in close
File "/usr/lib/python3.13/asyncio/unix_events.py", line 603, in close
File "/usr/lib/python3.13/asyncio/unix_events.py", line 627, in _close
File "/usr/lib/python3.13/asyncio/base_events.py", line 829, in call_soon
File "/usr/lib/python3.13/asyncio/base_events.py", line 552, in _check_closed
RuntimeError: Event loop is closed
make: *** [Makefile:3015: jit_stencils.h] Error 1
```
I don't recall which alpha I've tested it last on, but I'm pretty sure it used to work (against LLVM 16). I'm getting the same result on main as of 7c87ce777b3fd9055b118a58ec8614901ecb45e9.
This is Gentoo Linux amd64.
I've reproduced by doing (in git repo):
```
export PATH=/usr/lib/llvm/18/bin:${PATH}
./configure --enable-experimental-jit
make
```
Resulting log (70k): [python-log.txt](https://github.com/python/cpython/files/15262309/python-log.txt)
### CPython versions tested on:
3.13, CPython main branch
### Operating systems tested on:
Linux
<!-- gh-linked-prs -->
### Linked PRs
* gh-119000
* gh-119020
<!-- /gh-linked-prs -->
| e04cd964eb4eee1b0ae5b2c34727abce6c0fb7f0 | fc757925944a9486d4244853dbe6e37ab3e560c2 |
python/cpython | python__cpython-119942 | # IndexError on REPL startup in _pyrepl/reader.py with Python 3.13.0b1+ and a custom sys.ps1 set in a PYTHONSTARTUP file
# Bug report
### Bug description:
I compiled Python 3.13 (commit d86b494117, the current tip of the 3.13 branch), and installed it into ~/opt/python313. When I run `python3.13` with no arguments, I get this:
```python
Python 3.13.0b1+ (heads/3.13:d86b494117, May 9 2024, 15:23:21) [GCC 13.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "/home/mg/opt/python313/lib/python3.13/_pyrepl/__main__.py", line 47, in <module>
interactive_console()
~~~~~~~~~~~~~~~~~~~^^
File "/home/mg/opt/python313/lib/python3.13/_pyrepl/__main__.py", line 44, in interactive_console
return run_interactive(mainmodule)
File "/home/mg/opt/python313/lib/python3.13/_pyrepl/simple_interact.py", line 138, in run_multiline_interactive_console
statement, contains_pasted_code = multiline_input(more_lines, ps1, ps2)
~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
File "/home/mg/opt/python313/lib/python3.13/_pyrepl/readline.py", line 301, in multiline_input
return reader.readline(), reader.was_paste_mode_activated
~~~~~~~~~~~~~~~^^
File "/home/mg/opt/python313/lib/python3.13/_pyrepl/reader.py", line 646, in readline
self.prepare()
~~~~~~~~~~~~^^
File "/home/mg/opt/python313/lib/python3.13/_pyrepl/historical_reader.py", line 285, in prepare
super().prepare()
~~~~~~~~~~~~~~~^^
File "/home/mg/opt/python313/lib/python3.13/_pyrepl/reader.py", line 521, in prepare
self.calc_screen()
~~~~~~~~~~~~~~~~^^
File "/home/mg/opt/python313/lib/python3.13/_pyrepl/completing_reader.py", line 259, in calc_screen
screen = super().calc_screen()
File "/home/mg/opt/python313/lib/python3.13/_pyrepl/reader.py", line 299, in calc_screen
self.cxy = self.pos2xy()
~~~~~~~~~~~^^
File "/home/mg/opt/python313/lib/python3.13/_pyrepl/reader.py", line 474, in pos2xy
p, l2 = self.screeninfo[y]
~~~~~~~~~~~~~~~^^^
IndexError: list index out of range
```
and it exits with status code 1.
My terminal is currently 126 columns by 45 lines, and I have a custom PYTHONSTARTUP environment file pointing to ~/.python, which [you can see in this GH repo](https://github.com/mgedmin/dotfiles/blob/6d4a537e85e58712dc436cae00edddc22673ee71/python). It sets up some conveniences for the old REPL (colorful prompt, rlcompleter-based tab-completion, persistent readline history).
Running `PYTHONSTARTUP= python3.13` fixes the IndexError.
By commenting out bits of the file I can reproduce the IndexError with just this:
```python
import sys
sys.ps1 = '\001\033[0;32m\002>>> \001\033[0m\002'
del sys
```
The `\001`/`\002` characters are hints for readline to inform it that everything between them is a terminal escape sequence that doesn't advance the cursor, without which readline cannot correctly compute the width of the prompt and makes wrong assumptions about line wrapping.
The IndexError goes away if I remove all `\001` and `\002` characters from sys.ps1.
### CPython versions tested on:
3.13
### Operating systems tested on:
Linux
<!-- gh-linked-prs -->
### Linked PRs
* gh-119942
* gh-119990
<!-- /gh-linked-prs -->
| 2e0aa731aebb8ef3d89ada82f5d39b1bbac65d1f | 4e8aa32245e2d72bf558b711ccdbcee594347615 |
python/cpython | python__cpython-119340 | # Bump pickle.DEFAULT_PROTOCOL to 5 in 3.14
Opening so we don't forget. I'll get to it later if no one beats me to it.
<!-- gh-linked-prs -->
### Linked PRs
* gh-119340
<!-- /gh-linked-prs -->
| d66b06107b0104af513f664d9a5763216639018b | a1df1b44394784721239615f307b273455536d14 |
python/cpython | python__cpython-118828 | # Remove deprecated `Quoter` from `urllib.parse`
# Feature or enhancement
It was deprecated in 3.11 https://github.com/python/cpython/commit/d597fdc5fd0e8aa73a783fea27287db669950c15
<!-- gh-linked-prs -->
### Linked PRs
* gh-118828
<!-- /gh-linked-prs -->
| 84c3191954b40e090db15da49a59fcc40afe34fd | 52586f930f62bd80374f0f240a4ecce0c0238174 |
python/cpython | python__cpython-118826 | # Remove deprecated `master_open` and `slave_open` from `pty`
# Feature or enhancement
They were deprecated in https://github.com/python/cpython/issues/85984 and https://github.com/python/cpython/commit/244d4cd9d22d73fb3c0938937c4f435bd68f32d4
<!-- gh-linked-prs -->
### Linked PRs
* gh-118826
<!-- /gh-linked-prs -->
| f912e5a2f6d128b17f85229b722422e4a2478e23 | b407ad38fb93585332c370b8fa56905fb238cdfd |
python/cpython | python__cpython-118848 | # Zero-valued flag enum has no name
# Documentation
Quoting `Doc/howto/enum.rst:1148`:
```rst
- names of pseudo-flags are constructed from their members' names::
>>> (Color.RED | Color.GREEN).name
'RED|GREEN'
```
This section was originally added in 7aaeb2a3.
If you have a zero-valued flag, and you didn't explicitly give it a name, this doesn't seem to apply, it returns `None` instead.
```py
class NoZero(Flag):
ONE = 1
class HasZero(Flag):
ZERO = 0
ONE = 1
print(NoZero(0).name, type(NoZero(0).name)) # None <class 'NoneType'>
print(HasZero(0).name, type(HasZero(0).name)) # ZERO <class 'str'>
```
I'm not entirely sure if this should be considered a documentation issue or a bug report (or both). It doesn't really feel like zero should be treated any differently from other unnamed combinations. But at the same time, I've tested, and this is already the existing behavior in 3.10 through 3.12, and it doesn't seem to be documented anywhere.
<!-- gh-linked-prs -->
### Linked PRs
* gh-118848
* gh-120758
* gh-120759
<!-- /gh-linked-prs -->
| ed5ae6c4d76feaff06c2104c8ff864553b000253 | 753ef8db97ccb755d3c6fe089e883fe7ed5eb0d8 |
python/cpython | python__cpython-118819 | # ``asyncio REPL`` is not working on Windows
# Bug report
### Bug description:
Running the asyncio REPL with Python 3.13b1 on Windows gives
```python
>py -3.13 -m asyncio
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "C:\Users\Berry\AppData\Local\Programs\Python\Python313\Lib\asyncio\__main__.py", line 126, in <module>
readline.set_completer(completer.complete)
^^^^^^^^
```
due to missing `readline` package.
Easy to fix by removing
https://github.com/python/cpython/blob/2f4db5a04d6fa7ba5c1c6b82b482dd7ca48f3382/Lib/asyncio/__main__.py#L108-L111
and inserting `import readline # NoQA` before line 121:
https://github.com/python/cpython/blob/2f4db5a04d6fa7ba5c1c6b82b482dd7ca48f3382/Lib/asyncio/__main__.py#L120-L126
### CPython versions tested on:
3.13
### Operating systems tested on:
Windows
<!-- gh-linked-prs -->
### Linked PRs
* gh-118819
* gh-118847
<!-- /gh-linked-prs -->
| c3643a121401d111bebd3e26d6f362ade2ed2a83 | 35b5eaa176a5bae8a0cacb9c9f40ec948ecc4325 |
python/cpython | python__cpython-118806 | # Remove `type`, `choices`, and `metavar` parameters of `argparse.BooleanOptionalAction`
# Feature or enhancement
Original issue: https://github.com/python/cpython/issues/92248
I will send a PR.
<!-- gh-linked-prs -->
### Linked PRs
* gh-118806
<!-- /gh-linked-prs -->
| da090f1658e72485b201507653f6d673f3e39c86 | c68acb1384a51eb745f572687eaf677371b9e765 |
python/cpython | python__cpython-118831 | # ``test_os`` fails on Windows
# Bug report
### Bug description:
<details>
```python
./python.bat -m test -v test_os
Running Debug|x64 interpreter...
== CPython 3.14.0a0 (heads/bump_lib_version-dirty:a8d31d432c, May 8 2024, 23:21:14) [MSC v.1933 64 bit (AMD64)]
== Windows-10-10.0.19043-SP0 little-endian
== Python build: debug
== cwd: C:\Users\KIRILL-1\CLionProjects\cpython\build\test_python_worker_6120æ
== CPU count: 16
== encodings: locale=cp1251 FS=utf-8
== resources: all test resources are disabled, use -u option to unskip tests
Using random seed: 2053563363
0:00:00 Run 1 test sequentially
0:00:00 [1/1] test_os
test_blocking (test.test_os.BlockingTests.test_blocking) ... skipped 'Windows only supports blocking on pipes'test_compare_to_walk (test.test_os.BytesFwalkTests.test_compare_to_walk) ... skipped 'Test needs os.fwalk()'
test_dir_fd (test.test_os.BytesFwalkTests.test_dir_fd) ... skipped 'Test needs os.fwalk()'
test_fd_leak (test.test_os.BytesFwalkTests.test_fd_leak) ... skipped 'Test needs os.fwalk()'
test_file_like_path (test.test_os.BytesFwalkTests.test_file_like_path) ... skipped 'Test needs os.fwalk()'
test_walk_bad_dir (test.test_os.BytesFwalkTests.test_walk_bad_dir) ... skipped 'Test needs os.fwalk()'
test_walk_bad_dir2 (test.test_os.BytesFwalkTests.test_walk_bad_dir2) ... skipped 'Test needs os.fwalk()'
test_walk_bottom_up (test.test_os.BytesFwalkTests.test_walk_bottom_up) ... skipped 'Test needs os.fwalk()'
test_walk_named_pipe (test.test_os.BytesFwalkTests.test_walk_named_pipe) ... skipped 'Test needs os.fwalk()'
test_walk_named_pipe2 (test.test_os.BytesFwalkTests.test_walk_named_pipe2) ... skipped 'Test needs os.fwalk()'test_walk_prune (test.test_os.BytesFwalkTests.test_walk_prune) ... skipped 'Test needs os.fwalk()'
test_walk_symlink (test.test_os.BytesFwalkTests.test_walk_symlink) ... skipped 'Test needs os.fwalk()'
test_walk_topdown (test.test_os.BytesFwalkTests.test_walk_topdown) ... skipped 'Test needs os.fwalk()'
test_yields_correct_dir_fd (test.test_os.BytesFwalkTests.test_yields_correct_dir_fd) ... skipped 'Test needs os.fwalk()'
test_file_like_path (test.test_os.BytesWalkTests.test_file_like_path) ... ok
test_walk_above_recursion_limit (test.test_os.BytesWalkTests.test_walk_above_recursion_limit) ... ok
test_walk_bad_dir (test.test_os.BytesWalkTests.test_walk_bad_dir) ... ok
test_walk_bad_dir2 (test.test_os.BytesWalkTests.test_walk_bad_dir2) ... ok
test_walk_bottom_up (test.test_os.BytesWalkTests.test_walk_bottom_up) ... ok
test_walk_many_open_files (test.test_os.BytesWalkTests.test_walk_many_open_files) ... ok
test_walk_named_pipe (test.test_os.BytesWalkTests.test_walk_named_pipe) ... skipped 'requires os.mkfifo()'
test_walk_named_pipe2 (test.test_os.BytesWalkTests.test_walk_named_pipe2) ... skipped 'requires os.mkfifo()'
test_walk_prune (test.test_os.BytesWalkTests.test_walk_prune) ... ok
test_walk_symlink (test.test_os.BytesWalkTests.test_walk_symlink) ... skipped 'need symlink support'
test_walk_topdown (test.test_os.BytesWalkTests.test_walk_topdown) ... ok
test_cpu_count (test.test_os.CPUCountTests.test_cpu_count) ... ok
test_process_cpu_count (test.test_os.CPUCountTests.test_process_cpu_count) ... ok
test_process_cpu_count_affinity (test.test_os.CPUCountTests.test_process_cpu_count_affinity) ... skipped "don't have sched affinity support"
test_chown_gid (test.test_os.ChownFileTests.test_chown_gid) ... skipped 'requires os.chown()'
test_chown_uid_gid_arguments_must_be_index (test.test_os.ChownFileTests.test_chown_uid_gid_arguments_must_be_index) ... skipped 'requires os.chown()'
test_chown_with_root (test.test_os.ChownFileTests.test_chown_with_root) ... skipped 'requires os.chown()'
test_chown_without_permission (test.test_os.ChownFileTests.test_chown_without_permission) ... skipped 'requires os.chown()'
test_devnull (test.test_os.DevNullTests.test_devnull) ... ok
test_bad_fd (test.test_os.DeviceEncodingTests.test_bad_fd) ... ok
test_device_encoding (test.test_os.DeviceEncodingTests.test_device_encoding) ... ok
test___repr__ (test.test_os.EnvironTests.test___repr__)
Check that the repr() of os.environ looks like environ({...}). ... ok
test_bool (test.test_os.EnvironTests.test_bool) ... ok
test_constructor (test.test_os.EnvironTests.test_constructor) ... ok
test_environb (test.test_os.EnvironTests.test_environb) ... skipped 'os.environb required for this test.'
test_get (test.test_os.EnvironTests.test_get) ... ok
test_get_exec_path (test.test_os.EnvironTests.test_get_exec_path) ... ok
test_getitem (test.test_os.EnvironTests.test_getitem) ... ok
test_ior_operator (test.test_os.EnvironTests.test_ior_operator) ... ok
test_ior_operator_invalid_dicts (test.test_os.EnvironTests.test_ior_operator_invalid_dicts) ... ok
test_ior_operator_key_value_iterable (test.test_os.EnvironTests.test_ior_operator_key_value_iterable) ... ok
test_items (test.test_os.EnvironTests.test_items) ... ok
test_iter_error_when_changing_os_environ (test.test_os.EnvironTests.test_iter_error_when_changing_os_environ)
... ok
test_iter_error_when_changing_os_environ_items (test.test_os.EnvironTests.test_iter_error_when_changing_os_environ_items) ... ok
test_iter_error_when_changing_os_environ_values (test.test_os.EnvironTests.test_iter_error_when_changing_os_environ_values) ... ok
test_key_type (test.test_os.EnvironTests.test_key_type) ... ok
test_keys (test.test_os.EnvironTests.test_keys) ... ok
test_keyvalue_types (test.test_os.EnvironTests.test_keyvalue_types) ... ok
test_len (test.test_os.EnvironTests.test_len) ... ok
test_or_operator (test.test_os.EnvironTests.test_or_operator) ... ok
test_os_popen_iter (test.test_os.EnvironTests.test_os_popen_iter) ... skipped 'requires a shell'
test_pop (test.test_os.EnvironTests.test_pop) ... ok
test_popitem (test.test_os.EnvironTests.test_popitem) ... ok
test_putenv_unsetenv (test.test_os.EnvironTests.test_putenv_unsetenv) ... ok
test_putenv_unsetenv_error (test.test_os.EnvironTests.test_putenv_unsetenv_error) ... ok
test_read (test.test_os.EnvironTests.test_read) ... ok
test_ror_operator (test.test_os.EnvironTests.test_ror_operator) ... ok
test_setdefault (test.test_os.EnvironTests.test_setdefault) ... ok
test_update (test.test_os.EnvironTests.test_update) ... ok
test_update2 (test.test_os.EnvironTests.test_update2) ... skipped 'requires a shell'
test_values (test.test_os.EnvironTests.test_values) ... ok
test_write (test.test_os.EnvironTests.test_write) ... ok
test_eventfd_initval (test.test_os.EventfdTests.test_eventfd_initval) ... skipped 'requires os.eventfd'
test_eventfd_select (test.test_os.EventfdTests.test_eventfd_select) ... skipped 'requires os.eventfd'
test_eventfd_semaphore (test.test_os.EventfdTests.test_eventfd_semaphore) ... skipped 'requires os.eventfd'
test_execv_with_bad_arglist (test.test_os.ExecTests.test_execv_with_bad_arglist) ... ok
test_execve_invalid_env (test.test_os.ExecTests.test_execve_invalid_env) ... ok
test_execve_with_empty_path (test.test_os.ExecTests.test_execve_with_empty_path) ... ok
test_execvpe_with_bad_arglist (test.test_os.ExecTests.test_execvpe_with_bad_arglist) ... ok
test_execvpe_with_bad_program (test.test_os.ExecTests.test_execvpe_with_bad_program) ... ok
test_internal_execvpe_str (test.test_os.ExecTests.test_internal_execvpe_str) ... ok
test_os_all (test.test_os.ExportsTests.test_os_all) ... ok
test_fds (test.test_os.ExtendedAttributeTests.test_fds) ... skipped 'no non-broken extended attribute support'test_lpath (test.test_os.ExtendedAttributeTests.test_lpath) ... skipped 'no non-broken extended attribute support'
test_simple (test.test_os.ExtendedAttributeTests.test_simple) ... skipped 'no non-broken extended attribute support'
test_dup (test.test_os.FDInheritanceTests.test_dup) ... ok
test_dup2 (test.test_os.FDInheritanceTests.test_dup2) ... ok
test_dup_nul (test.test_os.FDInheritanceTests.test_dup_nul) ... ok
test_dup_standard_stream (test.test_os.FDInheritanceTests.test_dup_standard_stream) ... ok
test_get_inheritable_cloexec (test.test_os.FDInheritanceTests.test_get_inheritable_cloexec) ... skipped 'need
fcntl'
test_get_set_inheritable (test.test_os.FDInheritanceTests.test_get_set_inheritable) ... ok
test_get_set_inheritable_badf (test.test_os.FDInheritanceTests.test_get_set_inheritable_badf) ... ok
test_get_set_inheritable_o_path (test.test_os.FDInheritanceTests.test_get_set_inheritable_o_path) ... skipped
'need os.O_PATH'
test_open (test.test_os.FDInheritanceTests.test_open) ... ok
test_pipe (test.test_os.FDInheritanceTests.test_pipe) ... ok
test_set_inheritable_cloexec (test.test_os.FDInheritanceTests.test_set_inheritable_cloexec) ... skipped 'need
fcntl'
test_identity (test.test_os.FSEncodingTests.test_identity) ... ok
test_nop (test.test_os.FSEncodingTests.test_nop) ... ok
test_access (test.test_os.FileTests.test_access) ... ok
test_closerange (test.test_os.FileTests.test_closerange) ... ok
test_copy_file_range (test.test_os.FileTests.test_copy_file_range) ... skipped 'test needs os.copy_file_range()'
test_copy_file_range_invalid_values (test.test_os.FileTests.test_copy_file_range_invalid_values) ... skipped 'test needs os.copy_file_range()'
test_copy_file_range_offset (test.test_os.FileTests.test_copy_file_range_offset) ... skipped 'test needs os.copy_file_range()'
test_fdopen (test.test_os.FileTests.test_fdopen) ... ok
test_large_read (test.test_os.FileTests.test_large_read) ... skipped 'not enough memory: 2.0G minimum needed'
test_open_keywords (test.test_os.FileTests.test_open_keywords) ... ok
test_read (test.test_os.FileTests.test_read) ... ok
test_rename (test.test_os.FileTests.test_rename) ... ok
test_replace (test.test_os.FileTests.test_replace) ... ok
test_splice (test.test_os.FileTests.test_splice) ... skipped 'test needs os.splice()'
test_splice_invalid_values (test.test_os.FileTests.test_splice_invalid_values) ... skipped 'test needs os.splice()'
test_splice_offset_in (test.test_os.FileTests.test_splice_offset_in) ... skipped 'test needs os.splice()'
test_splice_offset_out (test.test_os.FileTests.test_splice_offset_out) ... skipped 'test needs os.splice()'
test_symlink_keywords (test.test_os.FileTests.test_symlink_keywords) ... ok
test_write (test.test_os.FileTests.test_write) ... ok
test_write_windows_console (test.test_os.FileTests.test_write_windows_console) ... ok
test_fork (test.test_os.ForkTests.test_fork) ... skipped 'requires working os.fork()'
test_fork_at_finalization (test.test_os.ForkTests.test_fork_at_finalization) ... skipped 'requires working os.fork()'
test_fork_warns_when_non_python_thread_exists (test.test_os.ForkTests.test_fork_warns_when_non_python_thread_exists) ... skipped 'requires working os.fork()'
test_compare_to_walk (test.test_os.FwalkTests.test_compare_to_walk) ... skipped 'Test needs os.fwalk()'
test_dir_fd (test.test_os.FwalkTests.test_dir_fd) ... skipped 'Test needs os.fwalk()'
test_fd_leak (test.test_os.FwalkTests.test_fd_leak) ... skipped 'Test needs os.fwalk()'
test_file_like_path (test.test_os.FwalkTests.test_file_like_path) ... skipped 'Test needs os.fwalk()'
test_walk_bad_dir (test.test_os.FwalkTests.test_walk_bad_dir) ... skipped 'Test needs os.fwalk()'
test_walk_bad_dir2 (test.test_os.FwalkTests.test_walk_bad_dir2) ... skipped 'Test needs os.fwalk()'
test_walk_bottom_up (test.test_os.FwalkTests.test_walk_bottom_up) ... skipped 'Test needs os.fwalk()'
test_walk_named_pipe (test.test_os.FwalkTests.test_walk_named_pipe) ... skipped 'Test needs os.fwalk()'
test_walk_named_pipe2 (test.test_os.FwalkTests.test_walk_named_pipe2) ... skipped 'Test needs os.fwalk()'
test_walk_prune (test.test_os.FwalkTests.test_walk_prune) ... skipped 'Test needs os.fwalk()'
test_walk_symlink (test.test_os.FwalkTests.test_walk_symlink) ... skipped 'Test needs os.fwalk()'
test_walk_topdown (test.test_os.FwalkTests.test_walk_topdown) ... skipped 'Test needs os.fwalk()'
test_yields_correct_dir_fd (test.test_os.FwalkTests.test_yields_correct_dir_fd) ... skipped 'Test needs os.fwalk()'
test_getrandom0 (test.test_os.GetRandomTests.test_getrandom0) ... skipped 'need os.getrandom()'
test_getrandom_nonblock (test.test_os.GetRandomTests.test_getrandom_nonblock) ... skipped 'need os.getrandom()'
test_getrandom_random (test.test_os.GetRandomTests.test_getrandom_random) ... skipped 'need os.getrandom()'
test_getrandom_type (test.test_os.GetRandomTests.test_getrandom_type) ... skipped 'need os.getrandom()'
test_getrandom_value (test.test_os.GetRandomTests.test_getrandom_value) ... skipped 'need os.getrandom()'
test_link (test.test_os.LinkTests.test_link) ... ok
test_link_bytes (test.test_os.LinkTests.test_link_bytes) ... ok
test_unicode_name (test.test_os.LinkTests.test_unicode_name) ... ok
test_getlogin (test.test_os.LoginTests.test_getlogin) ... skipped 'Skip due to platform/environment differences on *NIX buildbots'
test_exist_ok_existing_directory (test.test_os.MakedirTests.test_exist_ok_existing_directory) ... ok
test_exist_ok_existing_regular_file (test.test_os.MakedirTests.test_exist_ok_existing_regular_file) ... ok
test_exist_ok_s_isgid_directory (test.test_os.MakedirTests.test_exist_ok_s_isgid_directory) ... skipped 'No support for S_ISGID dir mode.'
test_makedir (test.test_os.MakedirTests.test_makedir) ... ok
test_mode (test.test_os.MakedirTests.test_mode) ... ok
test_win32_mkdir_700 (test.test_os.MakedirTests.test_win32_mkdir_700) ... ok
test_memfd_create (test.test_os.MemfdCreateTests.test_memfd_create) ... skipped 'requires os.memfd_create'
test_getcwd (test.test_os.MiscTests.test_getcwd) ... ok
test_getcwd_long_path (test.test_os.MiscTests.test_getcwd_long_path) ... Tested current directory length: 48
ok
test_getcwdb (test.test_os.MiscTests.test_getcwdb) ... ok
test_directory_link_nonlocal (test.test_os.NonLocalSymlinkTests.test_directory_link_nonlocal)
The symlink target should resolve relative to the link, not relative ... skipped 'Requires functional symlink
implementation'
test_oserror_filename (test.test_os.OSErrorTests.test_oserror_filename) ... ok
test_path_t_converter (test.test_os.PathTConverterTests.test_path_t_converter) ... ok
test_path_t_converter_and_custom_class (test.test_os.PathTConverterTests.test_path_t_converter_and_custom_class) ... ok
test_listdir (test.test_os.Pep383Tests.test_listdir) ... skipped 'Posix specific tests'
test_open (test.test_os.Pep383Tests.test_open) ... skipped 'Posix specific tests'
test_stat (test.test_os.Pep383Tests.test_stat) ... skipped 'Posix specific tests'
test_statvfs (test.test_os.Pep383Tests.test_statvfs) ... skipped 'Posix specific tests'
test_getppid (test.test_os.PidTests.test_getppid) ... ok
test_waitpid (test.test_os.PidTests.test_waitpid) ... ok
test_waitpid_windows (test.test_os.PidTests.test_waitpid_windows) ... ok
test_waitstatus_to_exitcode (test.test_os.PidTests.test_waitstatus_to_exitcode) ... ok
test_waitstatus_to_exitcode_kill (test.test_os.PidTests.test_waitstatus_to_exitcode_kill) ... skipped 'need signal.SIGKILL'
test_waitstatus_to_exitcode_windows (test.test_os.PidTests.test_waitstatus_to_exitcode_windows) ... ok
test_setegid (test.test_os.PosixUidGidTests.test_setegid) ... skipped 'Posix specific tests'
test_seteuid (test.test_os.PosixUidGidTests.test_seteuid) ... skipped 'Posix specific tests'
test_setgid (test.test_os.PosixUidGidTests.test_setgid) ... skipped 'Posix specific tests'
test_setregid (test.test_os.PosixUidGidTests.test_setregid) ... skipped 'Posix specific tests'
test_setregid_neg1 (test.test_os.PosixUidGidTests.test_setregid_neg1) ... skipped 'Posix specific tests'
test_setreuid (test.test_os.PosixUidGidTests.test_setreuid) ... skipped 'Posix specific tests'
test_setreuid_neg1 (test.test_os.PosixUidGidTests.test_setreuid_neg1) ... skipped 'Posix specific tests'
test_setuid (test.test_os.PosixUidGidTests.test_setuid) ... skipped 'Posix specific tests'
test_set_get_priority (test.test_os.ProgramPriorityTests.test_set_get_priority) ... skipped 'needs os.getpriority and os.setpriority'
test_open_via_ptsname (test.test_os.PseudoterminalTests.test_open_via_ptsname) ... skipped 'need os.openpty()'test_openpty (test.test_os.PseudoterminalTests.test_openpty) ... skipped 'need os.openpty()'
test_pipe_spawnl (test.test_os.PseudoterminalTests.test_pipe_spawnl) ... skipped 'need os.openpty()'
test_posix_pty_functions (test.test_os.PseudoterminalTests.test_posix_pty_functions) ... skipped 'need os.openpty()'
test_bytes (test.test_os.ReadlinkTests.test_bytes) ... skipped 'Requires functional symlink implementation'
test_missing_link (test.test_os.ReadlinkTests.test_missing_link) ... ok
test_not_symlink (test.test_os.ReadlinkTests.test_not_symlink) ... ok
test_pathlike (test.test_os.ReadlinkTests.test_pathlike) ... skipped 'Requires functional symlink implementation'
test_pathlike_bytes (test.test_os.ReadlinkTests.test_pathlike_bytes) ... skipped 'Requires functional symlink
implementation'
test_remove_all (test.test_os.RemoveDirsTests.test_remove_all) ... ok
test_remove_nothing (test.test_os.RemoveDirsTests.test_remove_nothing) ... ok
test_remove_partial (test.test_os.RemoveDirsTests.test_remove_partial) ... ok
test_nowait (test.test_os.SpawnTests.test_nowait) ... ok
test_spawnl (test.test_os.SpawnTests.test_spawnl) ... ok
test_spawnl_noargs (test.test_os.SpawnTests.test_spawnl_noargs) ... ok
test_spawnle (test.test_os.SpawnTests.test_spawnle) ... ok
test_spawnle_noargs (test.test_os.SpawnTests.test_spawnle_noargs) ... ok
test_spawnlp (test.test_os.SpawnTests.test_spawnlp) ... skipped 'requires os.spawnlp'
test_spawnlpe (test.test_os.SpawnTests.test_spawnlpe) ... skipped 'requires os.spawnlpe'
test_spawnv (test.test_os.SpawnTests.test_spawnv) ... ok
test_spawnv_noargs (test.test_os.SpawnTests.test_spawnv_noargs) ... ok
test_spawnve (test.test_os.SpawnTests.test_spawnve) ... ok
test_spawnve_bytes (test.test_os.SpawnTests.test_spawnve_bytes) ... ok
test_spawnve_invalid_env (test.test_os.SpawnTests.test_spawnve_invalid_env) ... ok
test_spawnve_noargs (test.test_os.SpawnTests.test_spawnve_noargs) ... ok
test_spawnvp (test.test_os.SpawnTests.test_spawnvp) ... skipped 'requires os.spawnvp'
test_spawnvpe (test.test_os.SpawnTests.test_spawnvpe) ... skipped 'requires os.spawnvpe'
test_spawnvpe_invalid_env (test.test_os.SpawnTests.test_spawnvpe_invalid_env) ... skipped 'requires os.spawnvpe'
test_15261 (test.test_os.StatAttributeTests.test_15261) ... ok
test_1686475 (test.test_os.StatAttributeTests.test_1686475) ... ok
test_access_denied (test.test_os.StatAttributeTests.test_access_denied) ... ok
test_file_attributes (test.test_os.StatAttributeTests.test_file_attributes) ... ok
test_stat_attributes (test.test_os.StatAttributeTests.test_stat_attributes) ... ok
test_stat_attributes_bytes (test.test_os.StatAttributeTests.test_stat_attributes_bytes) ... ok
test_stat_block_device (test.test_os.StatAttributeTests.test_stat_block_device) ... ok
test_stat_result_pickle (test.test_os.StatAttributeTests.test_stat_result_pickle) ... ok
test_statvfs_attributes (test.test_os.StatAttributeTests.test_statvfs_attributes) ... skipped 'test needs os.statvfs()'
test_statvfs_result_pickle (test.test_os.StatAttributeTests.test_statvfs_result_pickle) ... skipped 'need os.statvfs()'
test_does_not_crash (test.test_os.TermsizeTests.test_does_not_crash)
Check if get_terminal_size() returns a meaningful value. ... ok
test_stty_match (test.test_os.TermsizeTests.test_stty_match)
Check if stty returns the same results ... skipped 'stty invocation failed'
test_windows_fd (test.test_os.TermsizeTests.test_windows_fd)
Check if get_terminal_size() returns a meaningful value in Windows ... ok
test_uninstantiable (test.test_os.TestDirEntry.test_uninstantiable) ... ok
test_unpickable (test.test_os.TestDirEntry.test_unpickable) ... ok
test_blocking (test.test_os.TestInvalidFD.test_blocking) ... ok
test_closerange (test.test_os.TestInvalidFD.test_closerange) ... ok
test_dup (test.test_os.TestInvalidFD.test_dup) ... ok
test_dup2 (test.test_os.TestInvalidFD.test_dup2) ... ok
test_dup2_negative_fd (test.test_os.TestInvalidFD.test_dup2_negative_fd) ... ok
test_fchdir (test.test_os.TestInvalidFD.test_fchdir) ... ok
test_fchmod (test.test_os.TestInvalidFD.test_fchmod) ... ok
test_fchown (test.test_os.TestInvalidFD.test_fchown) ... skipped 'test needs os.fchown()'
test_fdatasync (test.test_os.TestInvalidFD.test_fdatasync) ... ok
test_fdopen (test.test_os.TestInvalidFD.test_fdopen) ... ok
test_fpathconf (test.test_os.TestInvalidFD.test_fpathconf) ... skipped 'test needs os.fpathconf()'
test_fstat (test.test_os.TestInvalidFD.test_fstat) ... ok
test_fstatvfs (test.test_os.TestInvalidFD.test_fstatvfs) ... ok
test_fsync (test.test_os.TestInvalidFD.test_fsync) ... ok
test_ftruncate (test.test_os.TestInvalidFD.test_ftruncate) ... ok
test_inheritable (test.test_os.TestInvalidFD.test_inheritable) ... ok
test_isatty (test.test_os.TestInvalidFD.test_isatty) ... ok
test_lseek (test.test_os.TestInvalidFD.test_lseek) ... ok
test_read (test.test_os.TestInvalidFD.test_read) ... ok
test_readv (test.test_os.TestInvalidFD.test_readv) ... skipped 'test needs os.readv()'
test_tcgetpgrp (test.test_os.TestInvalidFD.test_tcgetpgrp) ... ok
test_tcsetpgrpt (test.test_os.TestInvalidFD.test_tcsetpgrpt) ... skipped 'test needs os.tcsetpgrp()'
test_ttyname (test.test_os.TestInvalidFD.test_ttyname) ... ok
test_write (test.test_os.TestInvalidFD.test_write) ... ok
test_writev (test.test_os.TestInvalidFD.test_writev) ... skipped 'test needs os.writev()'
test_argument_required (test.test_os.TestPEP519.test_argument_required) ... ok
test_bad_pathlike (test.test_os.TestPEP519.test_bad_pathlike) ... ok
test_fsencode_fsdecode (test.test_os.TestPEP519.test_fsencode_fsdecode) ... ok
test_fspath_set_to_None (test.test_os.TestPEP519.test_fspath_set_to_None) ... ok
test_garbage_in_exception_out (test.test_os.TestPEP519.test_garbage_in_exception_out) ... ok
test_pathlike (test.test_os.TestPEP519.test_pathlike) ... ok
test_pathlike_class_getitem (test.test_os.TestPEP519.test_pathlike_class_getitem) ... ok
test_pathlike_subclass_slots (test.test_os.TestPEP519.test_pathlike_subclass_slots) ... ok
test_pathlike_subclasshook (test.test_os.TestPEP519.test_pathlike_subclasshook) ... ok
test_return_bytes (test.test_os.TestPEP519.test_return_bytes) ... ok
test_return_string (test.test_os.TestPEP519.test_return_string) ... ok
test_argument_required (test.test_os.TestPEP519PurePython.test_argument_required) ... ok
test_bad_pathlike (test.test_os.TestPEP519PurePython.test_bad_pathlike) ... ok
test_fsencode_fsdecode (test.test_os.TestPEP519PurePython.test_fsencode_fsdecode) ... ok
test_fspath_set_to_None (test.test_os.TestPEP519PurePython.test_fspath_set_to_None) ... ok
test_garbage_in_exception_out (test.test_os.TestPEP519PurePython.test_garbage_in_exception_out) ... ok
test_pathlike (test.test_os.TestPEP519PurePython.test_pathlike) ... ok
test_pathlike_class_getitem (test.test_os.TestPEP519PurePython.test_pathlike_class_getitem) ... ok
test_pathlike_subclass_slots (test.test_os.TestPEP519PurePython.test_pathlike_subclass_slots) ... ok
test_pathlike_subclasshook (test.test_os.TestPEP519PurePython.test_pathlike_subclasshook) ... ok
test_return_bytes (test.test_os.TestPEP519PurePython.test_return_bytes) ... ok
test_return_string (test.test_os.TestPEP519PurePython.test_return_string) ... ok
test_attributes (test.test_os.TestScandir.test_attributes) ... ok
test_attributes_junctions (test.test_os.TestScandir.test_attributes_junctions) ... ok
test_bad_path_type (test.test_os.TestScandir.test_bad_path_type) ... ok
test_broken_symlink (test.test_os.TestScandir.test_broken_symlink) ... skipped 'cannot create symbolic link'
test_bytes (test.test_os.TestScandir.test_bytes) ... ok
test_bytes_like (test.test_os.TestScandir.test_bytes_like) ... ok
test_close (test.test_os.TestScandir.test_close) ... ok
test_consume_iterator_twice (test.test_os.TestScandir.test_consume_iterator_twice) ... ok
test_context_manager (test.test_os.TestScandir.test_context_manager) ... ok
test_context_manager_close (test.test_os.TestScandir.test_context_manager_close) ... ok
test_context_manager_exception (test.test_os.TestScandir.test_context_manager_exception) ... ok
test_current_directory (test.test_os.TestScandir.test_current_directory) ... ok
test_empty_path (test.test_os.TestScandir.test_empty_path) ... ok
test_fd (test.test_os.TestScandir.test_fd) ... skipped 'fd support for listdir required for this test.'
test_fspath_protocol (test.test_os.TestScandir.test_fspath_protocol) ... ok
test_fspath_protocol_bytes (test.test_os.TestScandir.test_fspath_protocol_bytes) ... ok
test_removed_dir (test.test_os.TestScandir.test_removed_dir) ... ok
test_removed_file (test.test_os.TestScandir.test_removed_file) ... ok
test_repr (test.test_os.TestScandir.test_repr) ... ok
test_resource_warning (test.test_os.TestScandir.test_resource_warning) ... ok
test_uninstantiable (test.test_os.TestScandir.test_uninstantiable) ... ok
test_unpickable (test.test_os.TestScandir.test_unpickable) ... ok
test_flags (test.test_os.TestSendfile.test_flags) ... skipped 'test needs os.sendfile()'
test_headers (test.test_os.TestSendfile.test_headers) ... skipped 'test needs os.sendfile()'
test_headers_overflow_32bits (test.test_os.TestSendfile.test_headers_overflow_32bits) ... skipped 'test needs
os.sendfile()'
test_invalid_offset (test.test_os.TestSendfile.test_invalid_offset) ... skipped 'test needs os.sendfile()'
test_keywords (test.test_os.TestSendfile.test_keywords) ... skipped 'test needs os.sendfile()'
test_offset_overflow (test.test_os.TestSendfile.test_offset_overflow) ... skipped 'test needs os.sendfile()'
test_send_at_certain_offset (test.test_os.TestSendfile.test_send_at_certain_offset) ... skipped 'test needs os.sendfile()'
test_send_whole_file (test.test_os.TestSendfile.test_send_whole_file) ... skipped 'test needs os.sendfile()'
test_trailers (test.test_os.TestSendfile.test_trailers) ... skipped 'test needs os.sendfile()'
test_trailers_overflow_32bits (test.test_os.TestSendfile.test_trailers_overflow_32bits) ... skipped 'test needs os.sendfile()'
test_timerfd_TFD_TIMER_ABSTIME (test.test_os.TimerfdTests.test_timerfd_TFD_TIMER_ABSTIME) ... skipped 'requires os.timerfd_create'
test_timerfd_initval (test.test_os.TimerfdTests.test_timerfd_initval) ... skipped 'requires os.timerfd_create'test_timerfd_interval (test.test_os.TimerfdTests.test_timerfd_interval) ... skipped 'requires os.timerfd_create'
test_timerfd_negative (test.test_os.TimerfdTests.test_timerfd_negative) ... skipped 'requires os.timerfd_create'
test_timerfd_non_blocking (test.test_os.TimerfdTests.test_timerfd_non_blocking) ... skipped 'requires os.timerfd_create'
test_timerfd_ns_TFD_TIMER_ABSTIME (test.test_os.TimerfdTests.test_timerfd_ns_TFD_TIMER_ABSTIME) ... skipped 'requires os.timerfd_create'
test_timerfd_ns_initval (test.test_os.TimerfdTests.test_timerfd_ns_initval) ... skipped 'requires os.timerfd_create'
test_timerfd_ns_interval (test.test_os.TimerfdTests.test_timerfd_ns_interval) ... skipped 'requires os.timerfd_create'
test_timerfd_ns_poll (test.test_os.TimerfdTests.test_timerfd_ns_poll) ... skipped 'requires os.timerfd_create'test_timerfd_ns_select (test.test_os.TimerfdTests.test_timerfd_ns_select) ... skipped 'requires os.timerfd_create'
test_timerfd_poll (test.test_os.TimerfdTests.test_timerfd_poll) ... skipped 'requires os.timerfd_create'
test_timerfd_select (test.test_os.TimerfdTests.test_timerfd_select) ... skipped 'requires os.timerfd_create'
test_times (test.test_os.TimesTests.test_times) ... ok
test_urandom_failure (test.test_os.URandomFDTests.test_urandom_failure) ... skipped 'test requires the resource module'
test_urandom_fd_closed (test.test_os.URandomFDTests.test_urandom_fd_closed) ... ok
test_urandom_fd_reopened (test.test_os.URandomFDTests.test_urandom_fd_reopened) ... ok
test_urandom_length (test.test_os.URandomTests.test_urandom_length) ... ok
test_urandom_subprocess (test.test_os.URandomTests.test_urandom_subprocess) ... ok
test_urandom_value (test.test_os.URandomTests.test_urandom_value) ... ok
test_issue31577 (test.test_os.UtimeTests.test_issue31577) ... ok
test_large_time (test.test_os.UtimeTests.test_large_time) ... ok
test_utime (test.test_os.UtimeTests.test_utime) ... ok
test_utime_by_indexed (test.test_os.UtimeTests.test_utime_by_indexed) ... ok
test_utime_by_times (test.test_os.UtimeTests.test_utime_by_times) ... ok
test_utime_current (test.test_os.UtimeTests.test_utime_current) ... ok
test_utime_current_old (test.test_os.UtimeTests.test_utime_current_old) ... ok
test_utime_dir_fd (test.test_os.UtimeTests.test_utime_dir_fd) ... skipped 'dir_fd support for utime required for this test.'
test_utime_directory (test.test_os.UtimeTests.test_utime_directory) ... ok
test_utime_fd (test.test_os.UtimeTests.test_utime_fd) ... skipped 'fd support for utime required for this test.'
test_utime_invalid_arguments (test.test_os.UtimeTests.test_utime_invalid_arguments) ... ok
test_utime_nofollow_symlinks (test.test_os.UtimeTests.test_utime_nofollow_symlinks) ... skipped 'follow_symlinks support for utime required for this test.'
test_utime_nonexistent (test.test_os.UtimeTests.test_utime_nonexistent) ... ok
test_file_like_path (test.test_os.WalkTests.test_file_like_path) ... ok
test_walk_above_recursion_limit (test.test_os.WalkTests.test_walk_above_recursion_limit) ... ok
test_walk_bad_dir (test.test_os.WalkTests.test_walk_bad_dir) ... ok
test_walk_bad_dir2 (test.test_os.WalkTests.test_walk_bad_dir2) ... ok
test_walk_bottom_up (test.test_os.WalkTests.test_walk_bottom_up) ... ok
test_walk_many_open_files (test.test_os.WalkTests.test_walk_many_open_files) ... ok
test_walk_named_pipe (test.test_os.WalkTests.test_walk_named_pipe) ... skipped 'requires os.mkfifo()'
test_walk_named_pipe2 (test.test_os.WalkTests.test_walk_named_pipe2) ... skipped 'requires os.mkfifo()'
test_walk_prune (test.test_os.WalkTests.test_walk_prune) ... ok
test_walk_symlink (test.test_os.WalkTests.test_walk_symlink) ... skipped 'need symlink support'
test_walk_topdown (test.test_os.WalkTests.test_walk_topdown) ... ok
test_chdir (test.test_os.Win32ErrorTests.test_chdir) ... ok
test_chmod (test.test_os.Win32ErrorTests.test_chmod) ... ok
test_mkdir (test.test_os.Win32ErrorTests.test_mkdir) ... ok
test_remove (test.test_os.Win32ErrorTests.test_remove) ... ok
test_rename (test.test_os.Win32ErrorTests.test_rename) ... ok
test_utime (test.test_os.Win32ErrorTests.test_utime) ... ok
test_create_junction (test.test_os.Win32JunctionTests.test_create_junction) ... ok
test_unlink_removes_junction (test.test_os.Win32JunctionTests.test_unlink_removes_junction) ... ok
test_CTRL_BREAK_EVENT (test.test_os.Win32KillTests.test_CTRL_BREAK_EVENT) ... ok
test_CTRL_C_EVENT (test.test_os.Win32KillTests.test_CTRL_C_EVENT) ... skipped "subprocesses aren't inheriting
Ctrl+C property"
test_kill_int (test.test_os.Win32KillTests.test_kill_int) ... ok
test_kill_sigterm (test.test_os.Win32KillTests.test_kill_sigterm) ... ok
test_listdir_extended_path (test.test_os.Win32ListdirTests.test_listdir_extended_path)
Test when the path starts with '\\?\'. ... ok
test_listdir_no_extended_path (test.test_os.Win32ListdirTests.test_listdir_no_extended_path)
Test when the path is not an "extended" path. ... ok
test_listdrives (test.test_os.Win32ListdriveTests.test_listdrives) ... ok
test_listmounts (test.test_os.Win32ListdriveTests.test_listmounts) ... ok
test_listvolumes (test.test_os.Win32ListdriveTests.test_listvolumes) ... ok
test_getfinalpathname_handles (test.test_os.Win32NtTests.test_getfinalpathname_handles) ... ok
test_stat_inaccessible_file (test.test_os.Win32NtTests.test_stat_inaccessible_file) ... File: @test_6120_tmpæ
stat with access: os.stat_result(st_mode=33206, st_ino=112871465661126816, st_dev=2917237812109254748, st_nlink=1, st_uid=0, st_gid=0, st_size=9, st_atime=1715203810, st_mtime=1715203810, st_ctime=1715203806)
without access: os.stat_result(st_mode=33206, st_ino=0, st_dev=0, st_nlink=0, st_uid=0, st_gid=0, st_size=9,
st_atime=1715203810, st_mtime=1715203810, st_ctime=1715203806)
ERROR
test_stat_unlink_race (test.test_os.Win32NtTests.test_stat_unlink_race) ... ok
test_12084 (test.test_os.Win32SymlinkTests.test_12084) ... skipped 'Requires functional symlink implementation'
test_29248 (test.test_os.Win32SymlinkTests.test_29248) ... skipped 'Requires functional symlink implementation'
test_appexeclink (test.test_os.Win32SymlinkTests.test_appexeclink) ... skipped 'Requires functional symlink implementation'
test_buffer_overflow (test.test_os.Win32SymlinkTests.test_buffer_overflow) ... skipped 'Requires functional symlink implementation'
test_directory_link (test.test_os.Win32SymlinkTests.test_directory_link) ... skipped 'Requires functional symlink implementation'
test_file_link (test.test_os.Win32SymlinkTests.test_file_link) ... skipped 'Requires functional symlink implementation'
test_isdir_on_directory_link_to_missing_target (test.test_os.Win32SymlinkTests.test_isdir_on_directory_link_to_missing_target) ... skipped 'Requires functional symlink implementation'
test_remove_directory_link_to_missing_target (test.test_os.Win32SymlinkTests.test_remove_directory_link_to_missing_target) ... skipped 'Requires functional symlink implementation'
test_rmdir_on_directory_link_to_missing_target (test.test_os.Win32SymlinkTests.test_rmdir_on_directory_link_to_missing_target) ... skipped 'Requires functional symlink implementation'
======================================================================
ERROR: test_stat_inaccessible_file (test.test_os.Win32NtTests.test_stat_inaccessible_file)
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\KIRILL-1\CLionProjects\cpython\Lib\test\test_os.py", line 3231, in cleanup
subprocess.check_output([ICACLS, filename, "/grant", "Everyone:(D)"],
~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
stderr=subprocess.STDOUT)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\KIRILL-1\CLionProjects\cpython\Lib\subprocess.py", line 472, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
**kwargs).stdout
^^^^^^^^^
File "C:\Users\KIRILL-1\CLionProjects\cpython\Lib\subprocess.py", line 577, in run
raise CalledProcessError(retcode, process.args,
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['C:\\Windows\\System32\\icacls.exe', '@test_6120_tmpæ', '/grant', 'Everyone:(D)']' returned non-zero exit status 1332.
----------------------------------------------------------------------
Ran 362 tests in 11.095s
FAILED (errors=1, skipped=142)
test test_os failed
test_os failed (1 error)
== Tests result: FAILURE ==
1 test failed:
test_os
Total duration: 11.6 sec
Total tests: run=362 skipped=142
Total test files: run=1/1 failed=1
Result: FAILURE
```
</details>
### CPython versions tested on:
CPython main branch
### Operating systems tested on:
Windows
<!-- gh-linked-prs -->
### Linked PRs
* gh-118831
* gh-118837
* gh-118838
<!-- /gh-linked-prs -->
| 82acc5f2113bffd0ed902851f4ccf5b9be8980b2 | 7c87ce777b3fd9055b118a58ec8614901ecb45e9 |
python/cpython | python__cpython-118799 | # Remove isdst parameter from `email.utils.localtime`
It was deprecated in 3.12 and set for removal in 3.14.
* https://github.com/python/cpython/issues/72346
* https://github.com/python/cpython/pull/91450
<!-- gh-linked-prs -->
### Linked PRs
* gh-118799
* gh-118940
<!-- /gh-linked-prs -->
| c68acb1384a51eb745f572687eaf677371b9e765 | fa9b9cb11379806843ae03b1e4ad4ccd95a63c02 |
python/cpython | python__cpython-118797 | # `_PyWeakref_ClearRef` and `_PyWeakref_ClearWeakRefsExceptCallbacks` should be exposed in 3.13
`_PyWeakref_ClearRef` was previously [exposed](https://github.com/python/cpython/blob/656491783d2be0fe36feef5085a2406a05abbd66/Include/cpython/weakrefobject.h#L37) in the public C-API. In 3.13, it was moved to `pycore_weakref.h` and the symbol is not exposed (i.e., it's `extern void` instead of `PyAPI_FUNC(void)`.
`_PyWeakref_ClearRef` is used to clear a single weakref without calling its callback. `_PyWeakref_ClearWeakRefsExceptCallbacks` is the thread-safe version. If people are using `_PyWeakref_ClearRef`, we'd rather they use `_PyWeakref_ClearWeakRefsExceptCallbacks` so that the code is thread-safe in the free-threading build.
One use case is to clear newly added weakrefs after you've called a finalizer, in case your C type does not delegate to subtype_dealloc.
Uses:
* [PyTorch](https://github.com/pytorch/pytorch/blob/f4b2d50fd738d2ff2a8dde2f218411052f1c2716/torch/csrc/autograd/python_variable.cpp#L1927-L1931)
* [shiboken2](https://github.com/pyside/pyside2-setup/blob/d526f801ced4687d5413907a93dedcd782ef72fa/sources/shiboken2/libshiboken/typespec.cpp#L297) (might be old)
* [Nuitka](https://github.com/Nuitka/Nuitka/blob/f8046cdcf8c14b4a274005799349b56d812acb17/nuitka/build/static_src/HelpersAllocator.c#L384)
At a minimum, we should add `PyAPI_FUNC` to `_PyWeakref_ClearRef` and `_PyWeakref_ClearWeakRefsExceptCallbacks` and consider making `_PyWeakref_ClearWeakRefsExceptCallbacks` part of the public C API.
<!-- gh-linked-prs -->
### Linked PRs
* gh-118797
* gh-118807
* gh-118903
* gh-120695
<!-- /gh-linked-prs -->
| db5af7da092409030c9fbe0a3a986bd0ee441b8b | a895756aec688c049a983199e2d7fb801d6502c8 |
python/cpython | python__cpython-118800 | # tempfile.mkdtemp and pip fail on non-English Windows with 3.13.0b1
# Bug report
### Bug description:
```python
./python -m test -j 8
Running Debug|x64 interpreter...
== CPython 3.14.0a0 (heads/bump_lib_version:a8d31d432c, May 8 2024, 18:48:28) [MSC v.1933 64 bit (AMD64)]
== Windows-10-10.0.19043-SP0 little-endian
== Python build: debug
== cwd: C:\Users\KIRILL-1\CLionProjects\cpython\build\test_python_worker_23724æ
== CPU count: 16
== encodings: locale=cp1251 FS=utf-8
== resources: all test resources are disabled, use -u option to unskip tests
Using random seed: 2865818774
0:00:00 Run 477 tests in parallel using 8 worker processes
Warning -- regrtest worker thread failed: Traceback (most recent call last):
Warning -- File "C:\Users\KIRILL-1\CLionProjects\cpython\Lib\test\libregrtest\run_workers.py", line 393, in run
Warning -- mp_result = self._runtest(test_name)
Warning -- File "C:\Users\KIRILL-1\CLionProjects\cpython\Lib\test\libregrtest\run_workers.py", line 353, in _runtest
Warning -- retcode, tmp_files = self.run_tmp_files(worker_runtests,
Warning -- ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
Warning -- stdout_file.fileno())
Warning -- ^^^^^^^^^^^^^^^^^^^^^
Warning -- File "C:\Users\KIRILL-1\CLionProjects\cpython\Lib\test\libregrtest\run_workers.py", line 286, in run_tmp_files
Warning -- tmp_dir = tempfile.mkdtemp(prefix="test_python_")
Warning -- File "C:\Users\KIRILL-1\CLionProjects\cpython\Lib\tempfile.py", line 384, in mkdtemp
Warning -- _os.mkdir(file, 0o700)
Warning -- ~~~~~~~~~^^^^^^^^^^^^^
Warning -- OSError: [WinError 1332] No mapping between account names and security IDs was done
== Tests result: FAILURE, WORKER BUG ==
477 tests omitted:
test.test_asyncio.test_base_events
test.test_asyncio.test_buffered_proto
test.test_asyncio.test_context
test.test_asyncio.test_eager_task_factory
test.test_asyncio.test_events test.test_asyncio.test_futures
test.test_asyncio.test_futures2 test.test_asyncio.test_locks
test.test_asyncio.test_pep492
test.test_asyncio.test_proactor_events
test.test_asyncio.test_protocols test.test_asyncio.test_queues
test.test_asyncio.test_runners
test.test_asyncio.test_selector_events
test.test_asyncio.test_sendfile test.test_asyncio.test_server
test.test_asyncio.test_sock_lowlevel test.test_asyncio.test_ssl
test.test_asyncio.test_sslproto test.test_asyncio.test_streams
test.test_asyncio.test_subprocess
test.test_asyncio.test_taskgroups test.test_asyncio.test_tasks
test.test_asyncio.test_threads test.test_asyncio.test_timeouts
test.test_asyncio.test_transports
test.test_asyncio.test_unix_events test.test_asyncio.test_waitfor
test.test_asyncio.test_windows_events
test.test_asyncio.test_windows_utils
test.test_concurrent_futures.test_as_completed
test.test_concurrent_futures.test_deadlock
test.test_concurrent_futures.test_future
test.test_concurrent_futures.test_init
test.test_concurrent_futures.test_process_pool
test.test_concurrent_futures.test_shutdown
test.test_concurrent_futures.test_thread_pool
test.test_concurrent_futures.test_wait
test.test_future_stmt.test_future
test.test_future_stmt.test_future_flags
test.test_future_stmt.test_future_multiple_features
test.test_future_stmt.test_future_multiple_imports
test.test_future_stmt.test_future_single_import
test.test_gdb.test_backtrace test.test_gdb.test_cfunction
test.test_gdb.test_cfunction_full test.test_gdb.test_misc
test.test_gdb.test_pretty_print test.test_inspect.test_inspect
test.test_multiprocessing_fork.test_manager
test.test_multiprocessing_fork.test_misc
test.test_multiprocessing_fork.test_processes
test.test_multiprocessing_fork.test_threads
test.test_multiprocessing_forkserver.test_manager
test.test_multiprocessing_forkserver.test_misc
test.test_multiprocessing_forkserver.test_processes
test.test_multiprocessing_forkserver.test_threads
test.test_multiprocessing_spawn.test_manager
test.test_multiprocessing_spawn.test_misc
test.test_multiprocessing_spawn.test_processes
test.test_multiprocessing_spawn.test_threads
test.test_pydoc.test_pydoc test___all__ test__colorize
test__interpchannels test__interpreters test__locale test__opcode
test__osx_support test_abc test_abstract_numbers test_android
test_argparse test_array test_asdl_parser test_ast test_asyncgen
test_atexit test_audit test_augassign test_base64
test_baseexception test_bdb test_bigaddrspace test_bigmem
test_binascii test_binop test_bisect test_bool test_buffer
test_bufio test_builtin test_bytes test_bz2 test_c_locale_coercion
test_calendar test_call test_capi test_cext test_charmapcodec
test_class test_clinic test_cmath test_cmd test_cmd_line
test_cmd_line_script test_code test_code_module
test_codeccallbacks test_codecencodings_cn test_codecencodings_hk
test_codecencodings_iso2022 test_codecencodings_jp
test_codecencodings_kr test_codecencodings_tw test_codecmaps_cn
test_codecmaps_hk test_codecmaps_jp test_codecmaps_kr
test_codecmaps_tw test_codecs test_codeop test_collections
test_colorsys test_compare test_compile test_compileall
test_compiler_assemble test_compiler_codegen test_complex
test_configparser test_contains test_context test_contextlib
test_contextlib_async test_copy test_copyreg test_coroutines
test_cppext test_cprofile test_csv test_ctypes test_curses
test_dataclasses test_datetime test_dbm test_dbm_dumb test_dbm_gnu
test_dbm_ndbm test_dbm_sqlite3 test_decimal test_decorators
test_defaultdict test_deque test_descr test_descrtut test_devpoll
test_dict test_dict_version test_dictcomps test_dictviews
test_difflib test_dis test_doctest test_docxmlrpc test_dtrace
test_dynamic test_dynamicclassattribute test_eintr test_email
test_embed test_ensurepip test_enum test_enumerate test_eof
test_epoll test_errno test_except_star test_exception_group
test_exception_hierarchy test_exception_variations test_exceptions
test_extcall test_external_inspection test_faulthandler test_fcntl
test_file test_file_eintr test_filecmp test_fileinput test_fileio
test_fileutils test_finalization test_float test_flufl
test_fnmatch test_fork1 test_format test_fractions test_frame
test_free_threading test_frozen test_fstring test_ftplib
test_funcattrs test_functools test_gc test_generated_cases
test_generator_stop test_generators test_genericalias
test_genericclass test_genericpath test_genexps test_getopt
test_getpass test_getpath test_gettext test_glob test_global
test_grammar test_graphlib test_grp test_gzip test_hash
test_hashlib test_heapq test_hmac test_html test_htmlparser
test_http_cookiejar test_http_cookies test_httplib
test_httpservers test_idle test_imaplib test_import test_importlib
test_index test_int test_int_literal test_interpreters test_io
test_ioctl test_ipaddress test_isinstance test_iter test_iterlen
test_itertools test_json test_keyword test_keywordonlyarg
test_kqueue test_largefile test_launcher test_linecache test_list
test_listcomps test_lltrace test_locale test_logging test_long
test_longexp test_lzma test_mailbox test_marshal test_math
test_math_property test_memoryio test_memoryview test_metaclass
test_mimetypes test_minidom test_mmap test_module
test_modulefinder test_monitoring test_msvcrt test_multibytecodec
test_multiprocessing_main_handling test_named_expressions
test_netrc test_ntpath test_numeric_tower test_opcache
test_opcodes test_openpty test_operator test_optimizer
test_optparse test_ordered_dict test_os test_osx_env test_pathlib
test_patma test_pdb test_peepholer test_peg_generator
test_pep646_syntax test_perf_profiler test_perfmaps test_pickle
test_picklebuffer test_pickletools test_pkg test_pkgutil
test_platform test_plistlib test_poll test_popen test_poplib
test_positional_only_arg test_posix test_posixpath test_pow
test_pprint test_print test_profile test_property test_pstats
test_pty test_pulldom test_pwd test_py_compile test_pyclbr
test_pyexpat test_pyrepl test_queue test_quopri test_raise
test_random test_range test_re test_readline test_regrtest
test_repl test_reprlib test_resource test_richcmp test_rlcompleter
test_robotparser test_runpy test_sax test_sched test_scope
test_script_helper test_secrets test_select test_selectors
test_set test_setcomps test_shelve test_shlex test_shutil
test_signal test_site test_slice test_smtplib test_smtpnet
test_socket test_socketserver test_sort test_source_encoding
test_sqlite3 test_ssl test_stable_abi_ctypes test_startfile
test_stat test_statistics test_str test_strftime test_string
test_string_literals test_stringprep test_strptime test_strtod
test_struct test_structseq test_subclassinit test_subprocess
test_sundry test_super test_support test_symtable test_syntax
test_sys test_sys_setprofile test_sys_settrace test_sysconfig
test_syslog test_tabnanny test_tarfile test_tcl test_tempfile
test_termios test_textwrap test_thread test_threadedtempfile
test_threading test_threading_local test_threadsignals test_time
test_timeit test_timeout test_tkinter test_tokenize test_tomllib
test_tools test_trace test_traceback test_tracemalloc test_ttk
test_ttk_textonly test_tty test_tuple test_turtle
test_type_aliases test_type_annotations test_type_cache
test_type_comments test_type_params test_typechecks test_types
test_typing test_ucn test_unary test_unicode_file
test_unicode_file_functions test_unicode_identifiers
test_unicodedata test_unittest test_univnewlines test_unpack
test_unpack_ex test_unparse test_urllib test_urllib2
test_urllib2_localnet test_urllib2net test_urllib_response
test_urllibnet test_urlparse test_userdict test_userlist
test_userstring test_utf8_mode test_utf8source test_uuid test_venv
test_wait3 test_wait4 test_warnings test_wave test_weakref
test_weakset test_webbrowser test_winapi test_winconsoleio
test_winreg test_winsound test_with test_wmi test_wsgiref
test_xml_dom_minicompat test_xml_etree test_xml_etree_c
test_xmlrpc test_xxlimited test_xxtestfuzz test_yield_from
test_zipapp test_zipfile test_zipfile64 test_zipimport
test_zipimport_support test_zlib test_zoneinfo
1 test failed:
<regrtest worker>
Total duration: 204 ms
Total tests: run=0
Total test files: run=1/477 failed=1
Result: FAILURE, WORKER BUG
```
### CPython versions tested on:
CPython main branch
### Operating systems tested on:
Windows
<!-- gh-linked-prs -->
### Linked PRs
* gh-118800
* gh-118858
<!-- /gh-linked-prs -->
| 8af84b503d0b62a3db0d806d39f42c1e08746079 | c30d8e5d6c6b657817d6b342f1021676d04dd5af |
python/cpython | python__cpython-118774 | # Relax TypeVar default ordering constraints
# Bug report
### Bug description:
```pycon
% ./python.exe
Python 3.14.0a0 (heads/main-dirty:891fd12e52, May 8 2024, 09:02:37) [Clang 14.0.0 (clang-1400.0.29.202)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from typing import *
>>> T = TypeVar("T")
>>> T_dflt = TypeVar("T_dflt", default=int)
>>> Callable[[T_dflt], T]
Traceback (most recent call last):
File "<python-input-3>", line 1, in <module>
Callable[[T_dflt], T]
~~~~~~~~^^^^^^^^^^^^^
File "/Users/jelle/py/cpython/Lib/typing.py", line 1717, in __getitem__
return self.__getitem_inner__(params)
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
File "/Users/jelle/py/cpython/Lib/typing.py", line 431, in inner
return func(*args, **kwds)
File "/Users/jelle/py/cpython/Lib/typing.py", line 1730, in __getitem_inner__
return self.copy_with(params)
~~~~~~~~~~~~~~^^^^^^^^
File "/Users/jelle/py/cpython/Lib/typing.py", line 1702, in copy_with
return _CallableGenericAlias(self.__origin__, params,
name=self._name, inst=self._inst)
File "/Users/jelle/py/cpython/Lib/typing.py", line 1419, in __init__
self.__parameters__ = _collect_parameters(args)
~~~~~~~~~~~~~~~~~~~^^^^^^
File "/Users/jelle/py/cpython/Lib/typing.py", line 296, in _collect_parameters
raise TypeError(f'Type parameter {t!r} without a default'
' follows type parameter with a default')
TypeError: Type parameter ~T without a default follows type parameter with a default
```
This can reasonably happen if you have a generic class generic over a TypeVar with a default, and that TypeVar appears in a Callable parameter type annotation:
```
class X[T1=int]:
def meth[T](self, x: Callable[[T1], T]): pass
```
We encountered this in Hypothesis.
cc @Gobot1234
### CPython versions tested on:
CPython main branch
### Operating systems tested on:
macOS
<!-- gh-linked-prs -->
### Linked PRs
* gh-118774
* gh-118776
<!-- /gh-linked-prs -->
| aac6b019fe91e2f9f7a955d4fc4db5d5efd968c9 | 6d419db10c84cacbb3862e2adc940342175bfce9 |
python/cpython | python__cpython-118825 | # 3.13 adds C macros/functions/types without the `Py`/`_Py` prefix
3.13 newly defines the following unprefixed functions/macros/types via `Python.h`. They should probably be hidden:
- [x] `uop_get_target` in `Include/cpython/optimizer.h:67`
- [x] `uop_get_exit_index` in `Include/cpython/optimizer.h:73`
- [x] `uop_get_jump_target` in `Include/cpython/optimizer.h:79`
- [x] `uop_get_error_target` in `Include/cpython/optimizer.h:85`
- [x] `BLOOM_FILTER_WORDS` in `Include/cpython/optimizer.h`
- [x] `UOP_FORMAT_TARGET` in `Include/cpython/optimizer.h`
- [x] `UOP_FORMAT_EXIT` in `Include/cpython/optimizer.h`
- [x] `UOP_FORMAT_JUMP` in `Include/cpython/optimizer.h`
- [x] `UOP_FORMAT_UNUSED` in `Include/cpython/optimizer.h`
- [x] `struct _bloom_filter` in `Include/cpython/optimizer.h:19`
- [x] `struct _exit_data` in `Include/cpython/optimizer.h:91`
- [x] `optimize_func` in `Include/cpython/optimizer.h:112`
- [ ] `CO_NO_MONITORING_EVENTS` in `Include/cpython/code.h:192`
Some more are generated by configure:
- [ ] `HAVE_CLOCK_T` in `./pyconfig.h:138`
- [ ] `HAVE_CLOSEFROM` in `./pyconfig.h:138`
- [ ] `HAVE_GETGRENT` in `./pyconfig.h:138`
- [ ] `HAVE_GRANTPT` in `./pyconfig.h:515`
- [ ] `HAVE_POSIX_OPENPT` in `./pyconfig.h:849`
- [ ] `HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDCLOSEFROM_NP` in `./pyconfig.h:849`
- [ ] `HAVE_PROCESS_VM_READV` in `./pyconfig.h:849`
- [ ] `HAVE_PTSNAME` in `./pyconfig.h:957`
- [ ] `HAVE_PTSNAME_R` in `./pyconfig.h:957`
- [ ] `HAVE_SOCKLEN_T` in `./pyconfig.h:957`
- [ ] `HAVE_SYS_TIMERFD_H` in `./pyconfig.h:1406`
- [ ] `HAVE_TIMERFD_CREATE` in `./pyconfig.h:1406`
- [ ] `HAVE_UNLOCKPT` in `./pyconfig.h:1406`
- [ ] `HAVE___UINT128_T` in `./pyconfig.h:1582`
- [ ] `WITH_MIMALLOC` in `./pyconfig.h:1867`
<!-- gh-linked-prs -->
### Linked PRs
* gh-118825
<!-- /gh-linked-prs -->
| 941eea0a27de6e5c02d3c80924235a7a07bd095a | f772d0d08af2beef53db1e076c864cbdf3f5bac9 |
python/cpython | python__cpython-118775 | # Make `bool(NotImplemented)` into an error
See https://discuss.python.org/t/should-bool-notimplemented-become-an-error/51342 and #79893.
<!-- gh-linked-prs -->
### Linked PRs
* gh-118775
* gh-118813
<!-- /gh-linked-prs -->
| 3c079a020369173745a16ed4ef19a64f69e8592b | aac6b019fe91e2f9f7a955d4fc4db5d5efd968c9 |
python/cpython | python__cpython-118782 | # Tkinter getint(), getboolean() argument must be str, not tuple
# Bug report
Discovered during 3.13b1 release (we decided not to block the release over it, so this is just a known issue in b1):
While interacting with the config dialog in IDLE, I get these errors printed in the background.
```pytb
Exception in Tkinter callback
Traceback (most recent call last):
File "D:\cpython\Lib\tkinter\__init__.py", line 2064, in __call__
args = self.subst(*args)
File "D:\cpython\Lib\tkinter\__init__.py", line 1752, in _substitute
e.state = getint_event(s)
~~~~~~~~~~~~^^^
File "D:\cpython\Lib\tkinter\__init__.py", line 1726, in getint_event
return getint(s)
TypeError: getint() argument must be str, not tuple
```
I suspect this is the underlying cause of these test failures, which were discovered in our final stage testing of the Windows release:
```pytb
======================================================================
ERROR: test_highlight_target_text_mouse (idlelib.idle_test.test_configdialog.HighPageTest.test_highlight_target_text_mouse)
----------------------------------------------------------------------
Traceback (most recent call last):
File "D:\a\1\b\Python\Lib\idlelib\idle_test\test_configdialog.py", line 447, in test_highlight_target_text_mouse
eq(d.highlight_target.get(), elem[tag])
~~~~^^^^^
KeyError: 'sel'
======================================================================
FAIL: test_highlight_sample_b1_motion (idlelib.idle_test.test_configdialog.HighPageTest.test_highlight_sample_b1_motion)
----------------------------------------------------------------------
Traceback (most recent call last):
File "D:\a\1\b\Python\Lib\idlelib\idle_test\test_configdialog.py", line 493, in test_highlight_sample_b1_motion
eq(hs.tag_ranges('sel'), ())
~~^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: Tuples differ: (<string object: '1.0'>, <string object: '1.24'>) != ()
First tuple contains 2 additional elements.
First extra element 0:
<string object: '1.0'>
- (<string object: '1.0'>, <string object: '1.24'>)
+ ()
======================================================================
FAIL: test_highlight_sample_double_click (idlelib.idle_test.test_configdialog.HighPageTest.test_highlight_sample_double_click)
----------------------------------------------------------------------
Traceback (most recent call last):
File "D:\a\1\b\Python\Lib\idlelib\idle_test\test_configdialog.py", line 471, in test_highlight_sample_double_click
eq(hs.tag_ranges('sel'), ())
~~^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: Tuples differ: (<string object: '1.0'>, <string object: '1.24'>) != ()
First tuple contains 2 additional elements.
First extra element 0:
<string object: '1.0'>
- (<string object: '1.0'>, <string object: '1.24'>)
+ ()
----------------------------------------------------------------------
```
Possibly related to @serhiy-storchaka's recent changes?
<!-- gh-linked-prs -->
### Linked PRs
* gh-118782
* gh-118784
* gh-119072
* gh-119251
<!-- /gh-linked-prs -->
| 5b88d95cc542cf02303c6fe0e8719a93544decdb | 7d722b7d3ac78bfa74a5d2f21513ffbf4f85cff2 |
python/cpython | python__cpython-118751 | # Asymptotically faster `int(string)`
### Proposal:
EDIT: I made better progress on this than I expected, reducing the cutoff dramatically to about 3.4 million digits, by revisiting and improving the "cached reciprocal approximation" approach. Still not really compelling, but ... what the heck :wink:.
Way back when we were first working on ideas for faster `int <-> decimal string` conversions, @pochmann worked up a function that used the `decimal` module to, in effect, convert from base 10 to base 256. This is "unnatural", in that it requires multiplying and dividing by large powers of 2, which `decimal` isn't naturally suited to. But `decimal`'s `*` and `/` are asymptotically superior to CPython's, so at _some_ point it could be expected to win.
Alas, the crossover point was too high to be of much real interest. I then worked on ways to replace its division with multiplication by a cached reciprocal approximation instead, fixing up (usually small) errors afterwards. This reduced the crossover point significantly, but still too high to be of much real interest. And the code grew increasingly complex.
While working on `_pylong.py` across the last few days on a different issue, I had a different idea: there's no actual need to divide by powers of 2 at all. Since `2*5 = 10`, division by `2**k` is the same as multiplying by `5**k` (exact) and then dividing by `10**k` (also exact in `decimal`, and dirt cheap: the module's `scaleb()` function, which just adjusts the internal exponent).
This yields short and reasonably clear code with a much lower crossover value, at about 26 million digits. That's still too high to be compelling, but I want to record the progress in case someone else is intrigued enough to pursue it (I'm out of time for this for now). So I intend to add the (working, but unused) code to `_pylong.py`.
### Has this already been discussed elsewhere?
No response given
### Links to previous discussion of this feature:
_No response_
<!-- gh-linked-prs -->
### Linked PRs
* gh-118751
<!-- /gh-linked-prs -->
| ecd8664f11298a1a4f7428363c55ad2904c9f279 | caf6064a1bc15ac344afd78b780188e60b9c628e |
python/cpython | python__cpython-118748 | # Segfault accessing frame_locals
# Bug report
### Bug description:
I don't know how to cause this otherwise, but I can reproducibly trigger this segfault running:
```
python -m pytest "sklearn/tests/test_common.py::test_estimators[NuSVC()-check_classifiers_one_label_sample_weights]"
goldbaum at Nathans-MBP in ~/Documents/scikit-learn on main!
± $(pyenv which python) $(pyenv which pytest) -rsx -svx "sklearn/tests/test_common.py::test_estimators[NuSVC()-check_classifiers_one_label_sample_weights]"
===================================================================================== test session starts =====================================================================================
platform darwin -- Python 3.13.0a6+, pytest-8.2.0, pluggy-1.5.0 -- /Users/goldbaum/.pyenv/versions/3.13-dev-debug/bin/python
cachedir: .pytest_cache
hypothesis profile 'default' -> database=DirectoryBasedExampleDatabase(PosixPath('/Users/goldbaum/Documents/scikit-learn/.hypothesis/examples'))
rootdir: /Users/goldbaum/Documents/scikit-learn
configfile: setup.cfg
plugins: hypothesis-6.100.5
collected 1 item
sklearn/tests/test_common.py::test_estimators[NuSVC()-check_classifiers_one_label_sample_weights] I: Seeding RNGs with 1678026760
Fatal Python error: Segmentation fault
Current thread 0x00000001dd5dd000 (most recent call first):
File "/Users/goldbaum/.pyenv/versions/3.13-dev-debug/lib/python3.13/site-packages/_pytest/_code/code.py", line 149 in f_locals
File "/Users/goldbaum/.pyenv/versions/3.13-dev-debug/lib/python3.13/site-packages/_pytest/_code/code.py", line 285 in ishidden
File "/Users/goldbaum/.pyenv/versions/3.13-dev-debug/lib/python3.13/site-packages/_pytest/_code/code.py", line 412 in <lambda>
File "/Users/goldbaum/.pyenv/versions/3.13-dev-debug/lib/python3.13/site-packages/_pytest/_code/code.py", line 342 in __init__
File "/Users/goldbaum/.pyenv/versions/3.13-dev-debug/lib/python3.13/site-packages/_pytest/_code/code.py", line 415 in filter
File "/Users/goldbaum/.pyenv/versions/3.13-dev-debug/lib/python3.13/site-packages/_pytest/python.py", line 1644 in _traceback_filter
File "/Users/goldbaum/.pyenv/versions/3.13-dev-debug/lib/python3.13/site-packages/_pytest/_code/code.py", line 973 in repr_traceback
File "/Users/goldbaum/.pyenv/versions/3.13-dev-debug/lib/python3.13/site-packages/_pytest/_code/code.py", line 1064 in repr_excinfo
File "/Users/goldbaum/.pyenv/versions/3.13-dev-debug/lib/python3.13/site-packages/_pytest/_code/code.py", line 697 in getrepr
File "/Users/goldbaum/.pyenv/versions/3.13-dev-debug/lib/python3.13/site-packages/_pytest/nodes.py", line 462 in _repr_failure_py
File "/Users/goldbaum/.pyenv/versions/3.13-dev-debug/lib/python3.13/site-packages/_pytest/python.py", line 1669 in repr_failure
File "/Users/goldbaum/.pyenv/versions/3.13-dev-debug/lib/python3.13/site-packages/_pytest/reports.py", line 363 in from_item_and_call
File "/Users/goldbaum/.pyenv/versions/3.13-dev-debug/lib/python3.13/site-packages/_pytest/runner.py", line 368 in pytest_runtest_makereport
File "/Users/goldbaum/.pyenv/versions/3.13-dev-debug/lib/python3.13/site-packages/pluggy/_callers.py", line 103 in _multicall
File "/Users/goldbaum/.pyenv/versions/3.13-dev-debug/lib/python3.13/site-packages/pluggy/_manager.py", line 120 in _hookexec
File "/Users/goldbaum/.pyenv/versions/3.13-dev-debug/lib/python3.13/site-packages/pluggy/_hooks.py", line 513 in __call__
File "/Users/goldbaum/.pyenv/versions/3.13-dev-debug/lib/python3.13/site-packages/_pytest/runner.py", line 243 in call_and_report
File "/Users/goldbaum/.pyenv/versions/3.13-dev-debug/lib/python3.13/site-packages/_pytest/runner.py", line 135 in runtestprotocol
File "/Users/goldbaum/.pyenv/versions/3.13-dev-debug/lib/python3.13/site-packages/_pytest/runner.py", line 116 in pytest_runtest_protocol
File "/Users/goldbaum/.pyenv/versions/3.13-dev-debug/lib/python3.13/site-packages/pluggy/_callers.py", line 103 in _multicall
File "/Users/goldbaum/.pyenv/versions/3.13-dev-debug/lib/python3.13/site-packages/pluggy/_manager.py", line 120 in _hookexec
File "/Users/goldbaum/.pyenv/versions/3.13-dev-debug/lib/python3.13/site-packages/pluggy/_hooks.py", line 513 in __call__
File "/Users/goldbaum/.pyenv/versions/3.13-dev-debug/lib/python3.13/site-packages/_pytest/main.py", line 364 in pytest_runtestloop
File "/Users/goldbaum/.pyenv/versions/3.13-dev-debug/lib/python3.13/site-packages/pluggy/_callers.py", line 103 in _multicall
File "/Users/goldbaum/.pyenv/versions/3.13-dev-debug/lib/python3.13/site-packages/pluggy/_manager.py", line 120 in _hookexec
File "/Users/goldbaum/.pyenv/versions/3.13-dev-debug/lib/python3.13/site-packages/pluggy/_hooks.py", line 513 in __call__
File "/Users/goldbaum/.pyenv/versions/3.13-dev-debug/lib/python3.13/site-packages/_pytest/main.py", line 339 in _main
File "/Users/goldbaum/.pyenv/versions/3.13-dev-debug/lib/python3.13/site-packages/_pytest/main.py", line 285 in wrap_session
File "/Users/goldbaum/.pyenv/versions/3.13-dev-debug/lib/python3.13/site-packages/_pytest/main.py", line 332 in pytest_cmdline_main
File "/Users/goldbaum/.pyenv/versions/3.13-dev-debug/lib/python3.13/site-packages/pluggy/_callers.py", line 103 in _multicall
File "/Users/goldbaum/.pyenv/versions/3.13-dev-debug/lib/python3.13/site-packages/pluggy/_manager.py", line 120 in _hookexec
File "/Users/goldbaum/.pyenv/versions/3.13-dev-debug/lib/python3.13/site-packages/pluggy/_hooks.py", line 513 in __call__
File "/Users/goldbaum/.pyenv/versions/3.13-dev-debug/lib/python3.13/site-packages/_pytest/config/__init__.py", line 178 in main
File "/Users/goldbaum/.pyenv/versions/3.13-dev-debug/lib/python3.13/site-packages/_pytest/config/__init__.py", line 206 in console_main
File "/Users/goldbaum/.pyenv/versions/3.13-dev-debug/bin/pytest", line 8 in <module>
Extension modules: numpy._core._multiarray_umath, numpy.linalg._umath_linalg, cython.cimports.libc.math, scipy._lib._ccallback_c, scipy.linalg._fblas, scipy.linalg._flapack, scipy.linalg.cython_lapack, scipy.linalg._cythonized_array_utils, numpy.random._common, numpy.random.bit_generator, numpy.random._bounded_integers, numpy.random._mt19937, numpy.random.mtrand, numpy.random._philox, numpy.random._pcg64, numpy.random._sfc64, numpy.random._generator, scipy.linalg._solve_toeplitz, scipy.linalg._decomp_lu_cython, scipy.linalg._matfuncs_sqrtm_triu, scipy.linalg.cython_blas, scipy.linalg._matfuncs_expm, scipy.linalg._decomp_update, scipy.sparse._sparsetools, _csparsetools, scipy.sparse._csparsetools, scipy.sparse.linalg._dsolve._superlu, scipy.sparse.linalg._eigen.arpack._arpack, scipy.sparse.linalg._propack._spropack, scipy.sparse.linalg._propack._dpropack, scipy.sparse.linalg._propack._cpropack, scipy.sparse.linalg._propack._zpropack, scipy.sparse.csgraph._tools, scipy.sparse.csgraph._shortest_path, scipy.sparse.csgraph._traversal, scipy.sparse.csgraph._min_spanning_tree, scipy.sparse.csgraph._flow, scipy.sparse.csgraph._matching, scipy.sparse.csgraph._reordering, sklearn.__check_build._check_build, scipy.special._ufuncs_cxx, scipy.special._ufuncs, scipy.special._specfun, scipy.special._comb, scipy.special._ellip_harm_2, scipy.spatial._ckdtree, scipy._lib.messagestream, scipy.spatial._qhull, scipy.spatial._voronoi, scipy.spatial._distance_wrap, scipy.spatial._hausdorff, scipy.spatial.transform._rotation, scipy.ndimage._nd_image, _ni_label, scipy.ndimage._ni_label, scipy.optimize._minpack2, scipy.optimize._group_columns, scipy.optimize._trlib._trlib, scipy.optimize._lbfgsb, _moduleTNC, scipy.optimize._moduleTNC, scipy.optimize._cobyla, scipy.optimize._slsqp, scipy.optimize._minpack, scipy.optimize._lsq.givens_elimination, scipy.optimize._zeros, scipy.optimize._highs.cython.src._highs_wrapper, scipy.optimize._highs._highs_wrapper, scipy.optimize._highs.cython.src._highs_constants, scipy.optimize._highs._highs_constants, scipy.linalg._interpolative, scipy.optimize._bglu_dense, scipy.optimize._lsap, scipy.optimize._direct, scipy.integrate._odepack, scipy.integrate._quadpack, scipy.integrate._vode, scipy.integrate._dop, scipy.integrate._lsoda, scipy.special.cython_special, scipy.stats._stats, scipy.interpolate._fitpack, scipy.interpolate.dfitpack, scipy.interpolate._bspl, scipy.interpolate._ppoly, scipy.interpolate.interpnd, scipy.interpolate._rbfinterp_pythran, scipy.interpolate._rgi_cython, scipy.stats._biasedurn, scipy.stats._levy_stable.levyst, scipy.stats._stats_pythran, scipy._lib._uarray._uarray, scipy.stats._ansari_swilk_statistics, scipy.stats._sobol, scipy.stats._qmc_cy, scipy.stats._mvn, scipy.stats._rcont.rcont, scipy.stats._unuran.unuran_wrapper, sklearn.utils._isfinite, sklearn.utils.sparsefuncs_fast, sklearn.utils.murmurhash, sklearn.utils._openmp_helpers, sklearn.preprocessing._csr_polynomial_expansion, sklearn.preprocessing._target_encoder_fast, scipy.io.matlab._mio_utils, scipy.io.matlab._streams, scipy.io.matlab._mio5_utils, sklearn.datasets._svmlight_format_fast, sklearn.utils._random, sklearn.utils._vector_sentinel, sklearn.feature_extraction._hashing_fast, sklearn.metrics.cluster._expected_mutual_info_fast, sklearn.metrics._dist_metrics, sklearn.metrics._pairwise_distances_reduction._datasets_pair, sklearn.utils._cython_blas, sklearn.metrics._pairwise_distances_reduction._base, sklearn.metrics._pairwise_distances_reduction._middle_term_computer, sklearn.utils._heap, sklearn.utils._sorting, sklearn.metrics._pairwise_distances_reduction._argkmin, sklearn.metrics._pairwise_distances_reduction._argkmin_classmode, sklearn.metrics._pairwise_distances_reduction._radius_neighbors, sklearn.metrics._pairwise_distances_reduction._radius_neighbors_classmode, sklearn.metrics._pairwise_fast, sklearn.utils._fast_dict, sklearn.cluster._hierarchical_fast, sklearn.cluster._k_means_common, sklearn.cluster._k_means_elkan, sklearn.cluster._k_means_lloyd, sklearn.cluster._k_means_minibatch, sklearn.neighbors._partition_nodes, sklearn.neighbors._ball_tree, sklearn.neighbors._kd_tree, sklearn.utils.arrayfuncs, sklearn.utils._seq_dataset, sklearn.linear_model._cd_fast, _loss, sklearn._loss._loss, sklearn.svm._liblinear, sklearn.svm._libsvm, sklearn.svm._libsvm_sparse, sklearn.utils._weight_vector, sklearn.linear_model._sgd_fast, sklearn.linear_model._sag_fast, sklearn.decomposition._online_lda_fast, sklearn.decomposition._cdnmf_fast, sklearn.cluster._dbscan_inner, sklearn.cluster._hdbscan._tree, sklearn.cluster._hdbscan._linkage, sklearn.cluster._hdbscan._reachability, sklearn._isotonic, sklearn.tree._utils, sklearn.tree._tree, sklearn.tree._splitter, sklearn.tree._criterion, sklearn.neighbors._quad_tree, sklearn.manifold._barnes_hut_tsne, sklearn.manifold._utils, sklearn.ensemble._gradient_boosting, sklearn.ensemble._hist_gradient_boosting.common, sklearn.ensemble._hist_gradient_boosting._gradient_boosting, sklearn.ensemble._hist_gradient_boosting._binning, sklearn.ensemble._hist_gradient_boosting._bitset, sklearn.ensemble._hist_gradient_boosting.histogram, sklearn.ensemble._hist_gradient_boosting._predictor, sklearn.ensemble._hist_gradient_boosting.splitting (total: 166)
[1] 462 segmentation fault $(pyenv which python) $(pyenv which pytest) -rsx -svx
```
### CPython versions tested on:
CPython main branch
### Operating systems tested on:
macOS
<!-- gh-linked-prs -->
### Linked PRs
* gh-118748
<!-- /gh-linked-prs -->
| e7aec8713f84e90b20c9baae6b7a91d87f327ff0 | 2f0a338be66e276a700f86af51d5ef54a138cbfb |
python/cpython | python__cpython-118735 | # "invalid integer constant expression" compiling pylifecycle.c
Looks like the logic for enabling the JIT cannot handle the variable being omitted entirely. Builds that don't use the build.bat script directly will fail.
<!-- gh-linked-prs -->
### Linked PRs
* gh-118735
<!-- /gh-linked-prs -->
| 460546529b0959ce9528dec1c5cd836dcc04ad2c | f5488550614858fdc7b442076fe73bdfa3cdd738 |
python/cpython | python__cpython-118732 | # "thread sanitizer" (tsan) CI job is hanging
# Bug report
### Bug description:
At least since yesterday, the "tsan" CI jobs (`Thread sanitizer (free threading) / Thread sanitizer`) have been regularly hanging on test_importlib. When that happens, the job must be cancelled and restarted, sometimes multiple times.
Example logs:
<details>
<summary>(expand)</summary>
(from https://github.com/python/cpython/actions/runs/8987721571/job/24686950755?pr=118712)
```
Run ./python -m test --tsan -j4
Using random seed: 1572451380
0:00:00 load avg: 1.28 Run 22 tests in parallel using 4 worker processes
0:00:04 load avg: 1.28 [ 1/22] test_capi.test_pyatomic passed
0:00:09 load avg: 1.49 [ 2/22] test_code passed
0:00:14 load avg: 1.70 [ 3/22] test_functools passed
0:00:17 load avg: 1.96 [ 4/22] test_capi.test_mem passed
0:00:30 load avg: 2.33 [ 5/22] test_httpservers passed -- running (1): test_enum (30.0 sec)
0:00:34 load avg: 2.33 [ 6/22] test_imaplib passed -- running (1): test_enum (34.5 sec)
0:00:47 load avg: 2.70 [ 7/22] test_enum passed (47.0 sec) -- running (1): test_importlib (30.1 sec)
/usr/bin/llvm-symbolizer-18: error: '[stack]': No such file or directory
0:01:17 load avg: 5.66 running (4): test_importlib (1 min), test_logging (42.5 sec), test_io (47.0 sec), test_queue (30.0 sec)
0:01:24 load avg: 5.53 [ 8/22] test_logging passed (49.2 sec) -- running (3): test_importlib (1 min 6 sec), test_io (53.7 sec), test_queue (36.7 sec)
/home/runner/work/cpython/cpython/Lib/multiprocessing/popen_fork.py:67: DeprecationWarning: This process (pid=8735) is multi-threaded, use of fork() may lead to deadlocks in the child.
self.pid = os.fork()
0:01:54 load avg: 5.73 running (3): test_importlib (1 min 36 sec), test_io (1 min 23 sec), test_queue (1 min 6 sec)
0:02:19 load avg: 5.66 [ 9/22] test_signal passed (55.7 sec) -- running (3): test_importlib (2 min 2 sec), test_io (1 min 49 sec), test_queue (1 min 32 sec)
0:02:37 load avg: 5.18 [[10](https://github.com/python/cpython/actions/runs/8987721571/job/24686950755?pr=118712#step:12:11)/22] test_io passed (2 min 7 sec) -- running (2): test_importlib (2 min 20 sec), test_queue (1 min 50 sec)
/usr/bin/llvm-symbolizer-18: error: '[stack]': No such file or directory
0:02:43 load avg: 5.00 [[11](https://github.com/python/cpython/actions/runs/8987721571/job/24686950755?pr=118712#step:12:12)/22] test_queue passed (1 min 56 sec) -- running (1): test_importlib (2 min 26 sec)
/usr/bin/llvm-symbolizer-18: error: '[stack]': No such file or directory
0:02:49 load avg: 5.00 [[12](https://github.com/python/cpython/actions/runs/8987721571/job/24686950755?pr=118712#step:12:13)/22] test_sqlite3 passed -- running (1): test_importlib (2 min 32 sec)
0:02:55 load avg: 4.85 [[13](https://github.com/python/cpython/actions/runs/8987721571/job/24686950755?pr=118712#step:12:14)/22] test_syslog passed -- running (2): test_importlib (2 min 37 sec), test_socket (35.2 sec)
/usr/bin/llvm-symbolizer-18: error: '[stack]': No such file or directory
0:03:01 load avg: 4.70 [[14](https://github.com/python/cpython/actions/runs/8987721571/job/24686950755?pr=118712#step:12:15)/22] test_thread passed -- running (2): test_importlib (2 min 43 sec), test_socket (41.4 sec)
0:03:04 load avg: 4.70 [[15](https://github.com/python/cpython/actions/runs/8987721571/job/24686950755?pr=118712#step:12:16)/22] test_threadedtempfile passed -- running (2): test_importlib (2 min 47 sec), test_socket (45.0 sec)
/usr/bin/llvm-symbolizer-18: error: '[stack]': No such file or directory
0:03:08 load avg: 4.88 [[16](https://github.com/python/cpython/actions/runs/8987721571/job/24686950755?pr=118712#step:12:17)/22] test_ssl passed -- running (2): test_importlib (2 min 51 sec), test_socket (49.1 sec)
0:03:16 load avg: 4.59 [[17](https://github.com/python/cpython/actions/runs/8987721571/job/24686950755?pr=118712#step:12:18)/22] test_threading_local passed -- running (2): test_importlib (2 min 59 sec), test_socket (56.9 sec)
0:03:24 load avg: 4.38 [[18](https://github.com/python/cpython/actions/runs/8987721571/job/24686950755?pr=118712#step:12:19)/22] test_threadsignals passed -- running (2): test_importlib (3 min 7 sec), test_socket (1 min 4 sec)
0:03:43 load avg: 4.21 [[19](https://github.com/python/cpython/actions/runs/8987721571/job/24686950755?pr=118712#step:12:20)/22] test_socket passed (1 min 23 sec) -- running (2): test_importlib (3 min 25 sec), test_threading (38.3 sec)
0:04:13 load avg: 3.86 running (3): test_importlib (3 min 55 sec), test_threading (1 min 8 sec), test_weakref (48.3 sec)
0:04:22 load avg: 3.80 [[20](https://github.com/python/cpython/actions/runs/8987721571/job/24686950755?pr=118712#step:12:21)/22] test_threading passed (1 min 18 sec) -- running (2): test_importlib (4 min 5 sec), test_weakref (58.1 sec)
0:04:52 load avg: 3.17 running (2): test_importlib (4 min 35 sec), test_weakref (1 min 28 sec)
0:04:55 load avg: 3.08 [[21](https://github.com/python/cpython/actions/runs/8987721571/job/24686950755?pr=118712#step:12:22)/22] test_weakref passed (1 min 30 sec) -- running (1): test_importlib (4 min 37 sec)
0:05:25 load avg: 2.26 running (1): test_importlib (5 min 7 sec)
0:05:55 load avg: 1.76 running (1): test_importlib (5 min 37 sec)
0:06:25 load avg: 1.46 running (1): test_importlib (6 min 7 sec)
0:06:55 load avg: 1.28 running (1): test_importlib (6 min 37 sec)
0:07:25 load avg: 1.23 running (1): test_importlib (7 min 7 sec)
0:07:55 load avg: 1.15 running (1): test_importlib (7 min 38 sec)
0:08:25 load avg: 1.09 running (1): test_importlib (8 min 8 sec)
0:08:55 load avg: 1.05 running (1): test_importlib (8 min 38 sec)
0:09:25 load avg: 1.03 running (1): test_importlib (9 min 8 sec)
0:09:55 load avg: 1.08 running (1): test_importlib (9 min 38 sec)
0:10:25 load avg: 1.05 running (1): test_importlib (10 min 8 sec)
0:10:55 load avg: 1.03 running (1): test_importlib (10 min 38 sec)
0:11:25 load avg: 1.02 running (1): test_importlib (11 min 8 sec)
0:11:55 load avg: 1.01 running (1): test_importlib (11 min 38 sec)
0:12:25 load avg: 1.00 running (1): test_importlib (12 min 8 sec)
0:12:55 load avg: 1.00 running (1): test_importlib (12 min 38 sec)
0:13:25 load avg: 1.00 running (1): test_importlib (13 min 8 sec)
0:13:55 load avg: 1.00 running (1): test_importlib (13 min 38 sec)
0:14:25 load avg: 1.05 running (1): test_importlib (14 min 8 sec)
0:14:55 load avg: 1.03 running (1): test_importlib (14 min 38 sec)
0:15:25 load avg: 1.02 running (1): test_importlib (15 min 8 sec)
0:15:55 load avg: 1.01 running (1): test_importlib (15 min 38 sec)
0:16:25 load avg: 1.00 running (1): test_importlib (16 min 8 sec)
0:16:55 load avg: 1.00 running (1): test_importlib (16 min 38 sec)
0:17:25 load avg: 1.00 running (1): test_importlib (17 min 8 sec)
0:17:55 load avg: 1.00 running (1): test_importlib (17 min 38 sec)
0:18:25 load avg: 1.00 running (1): test_importlib (18 min 8 sec)
0:18:55 load avg: 1.00 running (1): test_importlib (18 min 38 sec)
0:19:25 load avg: 1.06 running (1): test_importlib (19 min 8 sec)
0:19:55 load avg: 1.04 running (1): test_importlib (19 min 38 sec)
0:20:25 load avg: 1.02 running (1): test_importlib (20 min 8 sec)
0:20:55 load avg: 1.01 running (1): test_importlib (20 min 38 sec)
0:21:25 load avg: 1.01 running (1): test_importlib (21 min 8 sec)
0:21:55 load avg: 1.00 running (1): test_importlib (21 min 38 sec)
0:[22](https://github.com/python/cpython/actions/runs/8987721571/job/24686950755?pr=118712#step:12:23):25 load avg: 1.00 running (1): test_importlib (22 min 8 sec)
0:22:55 load avg: 1.00 running (1): test_importlib (22 min 38 sec)
0:23:25 load avg: 1.00 running (1): test_importlib (23 min 8 sec)
0:[23](https://github.com/python/cpython/actions/runs/8987721571/job/24686950755?pr=118712#step:12:24):55 load avg: 1.06 running (1): test_importlib (23 min 38 sec)
0:[24](https://github.com/python/cpython/actions/runs/8987721571/job/24686950755?pr=118712#step:12:25):25 load avg: 1.04 running (1): test_importlib (24 min 8 sec)
0:24:55 load avg: 1.02 running (1): test_importlib (24 min 38 sec)
0:[25](https://github.com/python/cpython/actions/runs/8987721571/job/24686950755?pr=118712#step:12:26):25 load avg: 1.01 running (1): test_importlib (25 min 8 sec)
0:25:55 load avg: 1.01 running (1): test_importlib (25 min 38 sec)
0:26:25 load avg: 1.07 running (1): test_importlib ([26](https://github.com/python/cpython/actions/runs/8987721571/job/24686950755?pr=118712#step:12:27) min 8 sec)
0:26:55 load avg: 1.04 running (1): test_importlib (26 min 38 sec)
0:27:25 load avg: 1.02 running (1): test_importlib ([27](https://github.com/python/cpython/actions/runs/8987721571/job/24686950755?pr=118712#step:12:28) min 8 sec)
0:27:55 load avg: 1.01 running (1): test_importlib (27 min 38 sec)
0:[28](https://github.com/python/cpython/actions/runs/8987721571/job/24686950755?pr=118712#step:12:29):25 load avg: 1.06 running (1): test_importlib (28 min 8 sec)
0:28:55 load avg: 1.10 running (1): test_importlib (28 min 38 sec)
0:[29](https://github.com/python/cpython/actions/runs/8987721571/job/24686950755?pr=118712#step:12:30):25 load avg: 1.06 running (1): test_importlib (29 min 8 sec)
0:29:55 load avg: 1.11 running (1): test_importlib (29 min 38 sec)
0:[30](https://github.com/python/cpython/actions/runs/8987721571/job/24686950755?pr=118712#step:12:31):25 load avg: 1.07 running (1): test_importlib (30 min 8 sec)
0:30:55 load avg: 1.04 running (1): test_importlib (30 min 38 sec)
0:[31](https://github.com/python/cpython/actions/runs/8987721571/job/24686950755?pr=118712#step:12:32):25 load avg: 1.02 running (1): test_importlib (31 min 8 sec)
0:31:55 load avg: 1.01 running (1): test_importlib (31 min 38 sec)
0:[32](https://github.com/python/cpython/actions/runs/8987721571/job/24686950755?pr=118712#step:12:33):25 load avg: 1.08 running (1): test_importlib (32 min 8 sec)
0:32:55 load avg: 1.10 running (1): test_importlib (32 min 38 sec)
0:[33](https://github.com/python/cpython/actions/runs/8987721571/job/24686950755?pr=118712#step:12:34):25 load avg: 1.06 running (1): test_importlib (33 min 8 sec)
0:33:55 load avg: 1.09 running (1): test_importlib (33 min 38 sec)
0:[34](https://github.com/python/cpython/actions/runs/8987721571/job/24686950755?pr=118712#step:12:35):25 load avg: 1.05 running (1): test_importlib (34 min 8 sec)
0:34:55 load avg: 1.08 running (1): test_importlib (34 min 38 sec)
0:[35](https://github.com/python/cpython/actions/runs/8987721571/job/24686950755?pr=118712#step:12:36):25 load avg: 1.05 running (1): test_importlib (35 min 8 sec)
0:35:55 load avg: 1.08 running (1): test_importlib (35 min 38 sec)
Error: The operation was canceled.
```
</details>
Logs from a successful run (test_importlib finishes at a bit over a minute):
<details>
<summary>(expand)</summary>
(from https://github.com/python/cpython/actions/runs/8979326734/job/24661801478)
```
Run ./python -m test --tsan -j4
Using random seed: 1782869376
0:00:00 load avg: 1.17 Run 22 tests in parallel using 4 worker processes
0:00:04 load avg: 1.40 [ 1/22] test_capi.test_pyatomic passed
0:00:08 load avg: 1.61 [ 2/22] test_code passed
0:00:14 load avg: 1.80 [ 3/22] test_functools passed
0:00:16 load avg: 1.80 [ 4/22] test_capi.test_mem passed
0:00:29 load avg: 2.21 [ 5/22] test_httpservers passed
0:00:34 load avg: 2.43 [ 6/22] test_imaplib passed -- running (1): test_enum (33.9 sec)
0:00:45 load avg: 2.67 [ 7/22] test_enum passed (44.7 sec)
LLVMSymbolizer: error reading file: No such file or directory
0:01:15 load avg: 5.14 running (4): test_importlib (58.3 sec), test_logging (40.8 sec), test_io (45.7 sec), test_queue (30.0 sec)
0:01:24 load avg: 5.96 [ 8/22] test_logging passed (50.6 sec) -- running (3): test_importlib (1 min 8 sec), test_io (55.5 sec), test_queue (39.8 sec)
/home/runner/work/cpython/cpython/Lib/multiprocessing/popen_fork.py:67: DeprecationWarning: This process (pid=6705) is multi-threaded, use of fork() may lead to deadlocks in the child.
self.pid = os.fork()
0:01:31 load avg: 6.04 [ 9/22] test_importlib passed (1 min 15 sec) -- running (2): test_io (1 min 2 sec), test_queue (46.7 sec)
0:02:01 load avg: 5.99 running (3): test_signal (36.9 sec), test_io (1 min 32 sec), test_queue (1 min 16 sec)
0:02:19 load avg: 6.27 [[10](https://github.com/python/cpython/actions/runs/8979326734/job/24661801478#step:12:11)/22] test_signal passed (54.9 sec) -- running (3): test_socket (48.0 sec), test_io (1 min 50 sec), test_queue (1 min 34 sec)
0:02:32 load avg: 6.47 [[11](https://github.com/python/cpython/actions/runs/8979326734/job/24661801478#step:12:12)/22] test_sqlite3 passed -- running (3): test_socket (1 min), test_io (2 min 2 sec), test_queue (1 min 47 sec)
0:02:35 load avg: 6.83 [[12](https://github.com/python/cpython/actions/runs/8979326734/job/24661801478#step:12:13)/22] test_io passed (2 min 5 sec) -- running (2): test_socket (1 min 3 sec), test_queue (1 min 50 sec)
LLVMSymbolizer: error reading file: No such file or directory
0:02:41 load avg: 8.93 [[13](https://github.com/python/cpython/actions/runs/8979326734/job/24661801478#step:12:14)/22] test_queue passed (1 min 56 sec) -- running (1): test_socket (1 min 9 sec)
LLVMSymbolizer: error reading file: No such file or directory
0:02:41 load avg: 8.93 [[14](https://github.com/python/cpython/actions/runs/8979326734/job/24661801478#step:12:15)/22] test_syslog passed -- running (1): test_socket (1 min 9 sec)
LLVMSymbolizer: error reading file: No such file or directory
0:02:45 load avg: 8.61 [[15](https://github.com/python/cpython/actions/runs/8979326734/job/24661801478#step:12:16)/22] test_threadedtempfile passed -- running (1): test_socket (1 min 13 sec)
0:02:47 load avg: 8.61 [[16](https://github.com/python/cpython/actions/runs/8979326734/job/24661801478#step:12:17)/22] test_thread passed -- running (1): test_socket (1 min 15 sec)
0:02:53 load avg: 7.67 [[17](https://github.com/python/cpython/actions/runs/8979326734/job/24661801478#step:12:18)/22] test_threading_local passed -- running (1): test_socket (1 min 21 sec)
0:02:57 load avg: 7.67 [[18](https://github.com/python/cpython/actions/runs/8979326734/job/24661801478#step:12:19)/22] test_ssl passed -- running (1): test_socket (1 min 25 sec)
0:03:00 load avg: 7.21 [[19](https://github.com/python/cpython/actions/runs/8979326734/job/24661801478#step:12:20)/22] test_socket passed (1 min 28 sec)
0:03:00 load avg: 7.21 [[20](https://github.com/python/cpython/actions/runs/8979326734/job/24661801478#step:12:21)/22] test_threadsignals passed
0:03:30 load avg: 5.24 running (2): test_weakref (33.6 sec), test_threading (45.8 sec)
0:03:46 load avg: 4.52 [[21](https://github.com/python/cpython/actions/runs/8979326734/job/24661801478#step:12:22)/22] test_threading passed (1 min 1 sec) -- running (1): test_weakref (49.8 sec)
0:04:15 load avg: 3.21 [22/22] test_weakref passed (1 min 18 sec)
== Tests result: SUCCESS ==
All [22](https://github.com/python/cpython/actions/runs/8979326734/job/24661801478#step:12:23) tests OK.
Total duration: 4 min 15 sec
Total tests: run=5,876 skipped=162
Total test files: run=22/22
Result: SUCCESS
```
</details>
I noticed this with my one of my PRs, gh-118157, which makes some changes related to importing extension modules. However, I don't know if that PR is at fault. I definitely don't have much insight into what might be causing the hangs.
CC @colesbury
### CPython versions tested on:
CPython main branch
### Operating systems tested on:
_No response_
<!-- gh-linked-prs -->
### Linked PRs
* gh-118732
<!-- /gh-linked-prs -->
| 2c19987db525f61e85dadb40b368c97254adc7cc | f58833ebf8161aaa33844d63fb51b1575180cfbb |
python/cpython | python__cpython-118745 | # Crash in `PyThreadState_DeleteCurrent`: drop_gil: GIL is not locked (free-threading)
# Crash report
https://github.com/python/cpython/blob/b9caa0977c512a5e7966ebfdc64fabdc4f3e4971/Python/ceval_gil.c#L232-L239
Found by running `./python Lib/test/test_importlib/partial/pool_in_threads.py`
```
#0 __pthread_kill_implementation (no_tid=0, signo=6, threadid=139836635715136) at ./nptl/pthread_kill.c:44
#1 __pthread_kill_internal (signo=6, threadid=139836635715136) at ./nptl/pthread_kill.c:78
#2 __GI___pthread_kill (threadid=139836635715136, signo=signo@entry=6) at ./nptl/pthread_kill.c:89
#3 0x00007f2eb2303476 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#4 0x00007f2eb22e97f3 in __GI_abort () at ./stdlib/abort.c:79
#5 0x000055f8d81dcb4b in fatal_error_exit (status=<optimized out>) at Python/pylifecycle.c:2894
#6 0x000055f8d81e9981 in fatal_error (fd=2, header=header@entry=1, prefix=prefix@entry=0x55f8d83592f8 <__func__.20> "drop_gil", msg=msg@entry=0x55f8d8358af4 "drop_gil: GIL is not locked", status=status@entry=-1) at Python/pylifecycle.c:3076
#7 0x000055f8d81e99f3 in _Py_FatalErrorFunc (func=func@entry=0x55f8d83592f8 <__func__.20> "drop_gil", msg=msg@entry=0x55f8d8358af4 "drop_gil: GIL is not locked") at Python/pylifecycle.c:3092
#8 0x000055f8d81a6a39 in drop_gil (interp=<optimized out>, tstate=0x0) at Python/ceval_gil.c:238
#9 0x000055f8d81a75bf in _PyEval_ReleaseLock (interp=<optimized out>, tstate=tstate@entry=0x0) at Python/ceval_gil.c:582
#10 0x000055f8d81ed323 in _PyThreadState_DeleteCurrent (tstate=tstate@entry=0x7f2ea80065e0) at Python/pystate.c:1837
#11 0x000055f8d82a5cff in thread_run (boot_raw=boot_raw@entry=0x7f2ea8006590) at ./Modules/_threadmodule.c:355
#12 0x000055f8d820b7ce in pythread_wrapper (arg=<optimized out>) at Python/thread_pthread.h:243
#13 0x00007f2eb2355ac3 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
#14 0x00007f2eb23e7660 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
```
Note that in the coredump `gil->enabled` is `0`, so it looks like the gil was transiently enabled by a different thread during the call to `_PyThreadState_DeleteCurrent`.
cc @swtaarrs
<!-- gh-linked-prs -->
### Linked PRs
* gh-118745
* gh-119474
<!-- /gh-linked-prs -->
| be1dfccdf2c5c7671b8a549e969b8cf7d60d9936 | b30d30c747df2bf9f1614df8e76db2ffdb24fcd8 |
python/cpython | python__cpython-118725 | # Change in `pdb` behavior at exit from post-mortem debugger
# Bug report
### Bug description:
In 3.12 and earlier, if user enters `quit`/`exit` commands or does Ctrl-D, `pdb` restarts script with corresponding message and exits only on repeated `quit`/`exit`/Ctrl-D:
```
$ python -m pdb -c c pdb_bug.py
Traceback (most recent call last):
File "/usr/local/lib/python3.11/pdb.py", line 1775, in main
pdb._run(target)
File "/usr/local/lib/python3.11/pdb.py", line 1643, in _run
self.run(target.code)
File "/usr/local/lib/python3.11/bdb.py", line 600, in run
exec(cmd, globals, locals)
File "<string>", line 1, in <module>
File "/home/radislav/projects/cpython/pdb_bug.py", line 1, in <module>
raise ValueError()
ValueError
Uncaught exception. Entering post mortem debugging
Running 'cont' or 'step' will restart the program
> /home/radislav/projects/cpython/pdb_bug.py(1)<module>()
-> raise ValueError()
(Pdb) quit
Post mortem debugger finished. The /home/radislav/projects/cpython/pdb_bug.py will be restarted
> /home/radislav/projects/cpython/pdb_bug.py(1)<module>()
-> raise ValueError()
(Pdb) quit
$
```
Since fa18b0afe47615dbda15407a102b84e40cadf6a5 only message is printed, but Python exits completely:
```
$ ./python -m pdb -c c pdb_bug.py
Traceback (most recent call last):
...
File "/home/radislav/projects/cpython/pdb_bug.py", line 1, in <module>
raise ValueError()
ValueError
Uncaught exception. Entering post mortem debugging
Running 'cont' or 'step' will restart the program
> /home/radislav/projects/cpython/pdb_bug.py(1)<module>()
-> raise ValueError()
(Pdb) quit
Post mortem debugger finished. The /home/radislav/projects/cpython/pdb_bug.py will be restarted
$
```
@gaogaotiantian, what's your opinion? Should we restore the old behavior or remove confusing message about "restart"? As I can see, `pdb` docs doesn't state explicitly what `quit`/`exit` commands should do in post-mortem debugger.
### CPython versions tested on:
CPython main branch
### Operating systems tested on:
Linux
<!-- gh-linked-prs -->
### Linked PRs
* gh-118725
* gh-121346
<!-- /gh-linked-prs -->
| e245ed7d1e23b5c8bc0d568bd1a2f06ae92d631a | f8373db153920b890c2e2dd8def249e8df63bcc6 |
python/cpython | python__cpython-120698 | # Make `IPv{4,6}Address.version` and `max_prefixlen` available on classes, not just instances
# Feature or enhancement
### Proposal:
Sometimes, when there is a function that can operate both on IPv4 and IPv6 addresses, it is convenient to pass it the corresponding type object (either `IPv4Address` or `IPv6Address`) as an argument. However, that function cannot access the properties `version` and `max_prefixlen` using those type objects, because they only work on instances. This can be worked around by constructing a dummy instance (e.g. `t(0).max_prefixlen`), but it would be more convenient if those properties could be used on the type object directly (i.e. `t.max_prefixlen`), because their value doesn't depend on the specific instance, only on the type.
The proposal is to make `IPv4Address.version`, `IPv4Address.max_prefixlen`, `IPv6Address.version`, and `IPv6Address.max_prefixlen` evaluate to 4, 32, 6, and 128, respectively. Currently, all those expressions evaluate to property descriptors.
### Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
### Links to previous discussion of this feature:
_No response_
<!-- gh-linked-prs -->
### Linked PRs
* gh-120698
<!-- /gh-linked-prs -->
| c530ce1e9d336b81c053a5985444b4553fdd7050 | 2daed5f7a7087c63f47c57554ff55ee947e7a53d |
python/cpython | python__cpython-118703 | # Implement vectorcall for BaseException to optimize creation of exception instances
Currently, creating an instance of an built-in exception uses the old METH_VARARGS calling convention which creates a temporary tuple to pass positional arguments.
I propose to implement vectorcall for BaseException.
<!-- gh-linked-prs -->
### Linked PRs
* gh-118703
<!-- /gh-linked-prs -->
| aa36f83c1670f1e41fa9432a20e5c4a88ee9012c | ec9d12be9648ee60a2eb02d67069d74f8b314df9 |
python/cpython | python__cpython-119216 | # Avoid creating a StopIteration instance for monitoring
# Feature or enhancement
### Proposal:
A new C-API for injecting monitoring events was discussed in https://github.com/python/cpython/issues/111997 and implemented for Py3.13 in https://github.com/python/cpython/pull/116413
A remaining issue is that signalling "STOP_ITERATION" events requires a `StopIteration` exception instance, whereas generators usually try to avoid creating one during termination to increase their performance.
I think it would be best if CPython's monitoring infrastructure created a StopIteration instance automatically when it detects that it needs to notify about it without having one. It's in the best position to detect whether it really needs an exception instance or not. Event sources shouldn't be forced to a) figure that out themselves or b) create an instance just for it to be thrown away.
CPython already creates an exception instance for submitting a monitoring event for a generator, but does so unconditionally. It would also benefit from not having to generate one unless it's really needed for signalling.
https://github.com/python/cpython/blob/52485967813acdb35c274e1b2eaedd34e9ac01fc/Python/bytecodes.c#L289-L317
Basically, we should move the existing code from the byte code handlers all the way to the other side into the notification mechanism.
In order to report the correct StopIteration value, the event creation function should accept an object value directly, and create a `StopIteration` instance for that value only if it ends up signalling it to listeners.
We might allow passing the value `NULL` (as opposed to the object value `None`) to make the machinery look up an actually existing currently raised `StopIteration` instance. Alternatively, passing a `StopIteration` instance as value is probably also a reasonably clear indication for an instance being available already. We may also consider adding two event creation functions, one with a bare stop value and one with a readily created `StopIteration` instance.
This ticket proposes a usability/performance enhancement to a newly added feature in Py3.13, and thus does not fall under the "beta-1" release end of new features.
### Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
### Links to previous discussion of this feature:
https://github.com/python/cpython/pull/116413#issuecomment-2093689068
<!-- gh-linked-prs -->
### Linked PRs
* gh-119216
* gh-119497
<!-- /gh-linked-prs -->
| 6e9863d7a3516cc76d6ce13923b15620499f3855 | b64182550f73e556344bd754d32e3be5d22a74e1 |
python/cpython | python__cpython-118690 | # ePub error reported at docs@python.org
“error on line 80 at column 12: error parsing attribute name”
https://mail.python.org/archives/list/docs@python.org/thread/7DW6GALZLNNPBD2NWDJKIUKB6GVUEGYK/
<!-- gh-linked-prs -->
### Linked PRs
* gh-118690
* gh-118889
* gh-118890
<!-- /gh-linked-prs -->
| 7ac933e2609b2ef9b08ccf9c815b682b0e1ede2a | 7cc5e81a8259fb2e78ed12cbb15ad9e1710f20ed |
python/cpython | python__cpython-118709 | # REPL: Ctrl-R and arrow key trips assertion
# Bug report
Seen in `main` / b4bdf83cc67434235d9630c92c84a5261992b235 on Linux
1. Open the Python REPL
2. Press Ctrl-R to pull up the `(r-search )` prompt
3. Press any arrow key
```python
(r-search `') Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "/home/barney/projects/cpython/Lib/_pyrepl/__main__.py", line 47, in <module>
interactive_console()
~~~~~~~~~~~~~~~~~~~^^
File "/home/barney/projects/cpython/Lib/_pyrepl/__main__.py", line 44, in interactive_console
return run_interactive(mainmodule)
File "/home/barney/projects/cpython/Lib/_pyrepl/simple_interact.py", line 140, in run_multiline_interactive_console
statement = multiline_input(more_lines, ps1, ps2)
File "/home/barney/projects/cpython/Lib/_pyrepl/readline.py", line 301, in multiline_input
return reader.readline()
~~~~~~~~~~~~~~~^^
File "/home/barney/projects/cpython/Lib/_pyrepl/reader.py", line 646, in readline
self.handle1()
~~~~~~~~~~~~^^
File "/home/barney/projects/cpython/Lib/_pyrepl/reader.py", line 629, in handle1
self.do_cmd(cmd)
~~~~~~~~~~~^^^^^
File "/home/barney/projects/cpython/Lib/_pyrepl/reader.py", line 570, in do_cmd
assert isinstance(cmd[0], str)
~~~~~~~~~~^^^^^^^^^^^^^
AssertionError
```
<!-- gh-linked-prs -->
### Linked PRs
* gh-118709
<!-- /gh-linked-prs -->
| e5413ec7831608f6cb4f39d805785cb1d7b67702 | 71080b8a0fe5da46fb97659060db76fd95a3fb61 |
python/cpython | python__cpython-118730 | # Dead link for `linspace` recipe
# Documentation
https://github.com/python/cpython/blob/00d913c6718aa365027c6dcf850e8f40731e54fc/Doc/library/stdtypes.rst?plain=1#L1497-L1501
The "See also" section for `range` seems to have a dead link to the linspace recipe: https://code.activestate.com/recipes/579000/
<!-- gh-linked-prs -->
### Linked PRs
* gh-118730
* gh-118754
<!-- /gh-linked-prs -->
| c4f9823be277b2e3de2315526612276626217743 | fcf52d7ceea3532f0b3475aadd4e1f72db463a1f |
python/cpython | python__cpython-118681 | # Add additional optional type parameter to `typing.ContextManager` and `typing.AbstractContextManager`
# Feature or enhancement
### Proposal:
As part of https://github.com/python/typeshed/pull/11048 `contextlib.AbstractContextManager` and `contextlib.AbstractAsyncContextManager` received an additional optional type parameter for the return value of `__exit__` in order to have greater control over code-flow analysis in type checkers with things like `ExitStack`.
The `contextlib` `ABC`s don't require any changes, since they accept an arbitrary number of arguments at runtime, but the aliases that live in `typing` are a different story. These will reject the additional parameter at runtime, throwing an exception.
@JelleZijlstra Added support for type var defaults for `typing._SpecialGenericAlias` in #118648, we could leverage that work to add the new optional parameter to the typing aliases, so they can support the same number of type parameters as their `contextlib` counterparts.
### Has this already been discussed elsewhere?
I have already discussed this feature proposal on Discourse
### Links to previous discussion of this feature:
https://discuss.python.org/t/add-an-else-clause-to-with-statements-to-detect-early-termination/38031
<!-- gh-linked-prs -->
### Linked PRs
* gh-118681
<!-- /gh-linked-prs -->
| 71080b8a0fe5da46fb97659060db76fd95a3fb61 | a855f824a2f5a310ffa58a973a8fe9feaa2500b3 |
python/cpython | python__cpython-118669 | # Inconsistent return types between SSLSocket and SSLObject certificate chain APIs
# Bug report
### Bug description:
The `get_verified_chain()` and `get_unverified_chain()` APIs for `SSLSocket` were updated in https://github.com/python/cpython/pull/109113, but the API wasn't updated for `SSLObject`. This leads to inconsistent return types, one returns `_ssl.Certificate` and the other returns `bytes`. It appears from https://github.com/python/cpython/pull/109113 that `bytes` is what's expected.
This [caused an issue for Windows and macOS](https://github.com/pypa/pip/pull/12662#issuecomment-2093887075) using Truststore which relies on these APIs for verifying certificates. A bugfix is coming for Truststore, but these APIs should return the same type.
cc @matiuszka
### CPython versions tested on:
3.13, CPython main branch
### Operating systems tested on:
Linux, Windows
<!-- gh-linked-prs -->
### Linked PRs
* gh-118669
* gh-123082
* gh-124598
* gh-124599
* gh-124972
<!-- /gh-linked-prs -->
| 8ef358dae1959e2aff8b04fb69b8a36d6da6847a | c13e7d98fb8581014a225b900b1b88ccbfc28097 |
python/cpython | python__cpython-118651 | # Enum _sunder_ exclusion is overly strict
# Bug report
### Bug description:
Enums' exclusive access to \_sunder_ members inhibits their use with the IPython/Jupyter pattern of making HTML and other visual reprs available:
```python
from enum import Enum
class MyEnum(Enum):
A = 1
def _repr_html_(self):
return f'<span title="A MyEnum">{self}</abbr>'
# ValueError: _sunder_ names, such as '_repr_html_', are reserved for future Enum use
```
While having exclusive access to some space is valuable, and prefixing enum's range is not practical (as that prefix would need to be repeated by users constructing the class), carving out some space for widespread functions that are not expected to conflict with Enum's internal use should be possible. I suggest that at least `_repr_html_` should be allowed, possibly the whole `_repr_` prefix.
### CPython versions tested on:
3.12
### Operating systems tested on:
Linux
<!-- gh-linked-prs -->
### Linked PRs
* gh-118651
* gh-118698
<!-- /gh-linked-prs -->
| 1e428426c836b9a434810a6b99f70454d3a9611e | 6cf70678e2d4126ed921e6288477ebd6889b9af7 |
python/cpython | python__cpython-118648 | # Add TypeVar defaults for Generator and AsyncGenerator
Now that PEP 696 has landed, we should add defaults to the Generator and AsyncGenerator types for the send and return types.
cc @Gobot1234 @Daverball (https://github.com/python/typeshed/pull/11867#issuecomment-2095879825)
<!-- gh-linked-prs -->
### Linked PRs
* gh-118648
<!-- /gh-linked-prs -->
| 8419f01673858d5002747c9393d4ed0ec22fdb47 | 9fd33af5ac57f649971ffd8091bd898a96f85b55 |
python/cpython | python__cpython-119099 | # Error parsing email headers: AttributeError: 'ValueTerminal' object has no attribute 'fold'
# Bug report
### Bug description:
The following code breaks with an attribute error:
```python
import email.parser
import email.policy
a = 't'*46
h = f'''\
To: =?utf-8?B?dGVzdC50ZXN0LnRlc3QudGVzdEB0ZXN0LmNvbeKAiw=?= <test@test.com>,\r\n\t"tttest&{a}.t.t.t.t.t.t.t@yahoo.ES" <test@test.tj>,\r\n\t"tttest&{a}.t.t.t.t.t.t@yahoo.ES" <info@test.tj>'''
m = email.parser.HeaderParser(policy=email.policy.default).parsestr(h)
m.as_string()
```
The problem was introduced on https://github.com/python/cpython/pull/100885, setting `ListSeparator.as_ew_allowed = False` to `True` fixes the problem. Changing any character in the header in the example above also fixes the problem (which makes it harder to understand exactly why it's broken).
### CPython versions tested on:
3.12
### Operating systems tested on:
macOS
<!-- gh-linked-prs -->
### Linked PRs
* gh-119099
* gh-119389
* gh-119390
* gh-119393
<!-- /gh-linked-prs -->
| 858b9e85fcdd495947c9e892ce6e3734652c48f2 | aee8f03abbebfb76357f459dfb297026862e3c0b |
python/cpython | python__cpython-118437 | # add warning for eval and exec (unsafe usage may lead to critical vulnerabilities)
# Documentation
Currently there are no warnings regarding the unsafe usage of `eval` and `exec`. If arbitrary user-supplied input is passed to them, this may pose a big security risk.
Relevant PR:
https://github.com/python/cpython/pull/118437
Blogpost that made me aware of that: https://snyk.io/de/blog/code-injection-vulnerabilities-caused-by-generative-ai/
<!-- gh-linked-prs -->
### Linked PRs
* gh-118437
* gh-126161
* gh-126162
<!-- /gh-linked-prs -->
| 00e5ec0d35193c1665e5c0cfe5ef82eed270d0f4 | d4b6d84cc84029b598fc24b2d0cea543ee63bf84 |
python/cpython | python__cpython-118665 | # Remove new pyrepl "warning" on Windows
# Bug report
Whenever I start the REPL on Windows, it now prints a new statement: "warning: can't use pyrepl: No module named 'readline'" and as things now, it will continue to do so indefinitely. This is obnoxious. This is not a warning, not something I can or should do anything about (other than switch to Linux), but a statement of fact. Please kill it at least on Windows. And Mac if the situation is the same (never available). It seems useless on *nix too, though I don't care. Just document its availability in appropriate places like we do with other things that are not available everythere.
If desired to make its use obvious, color the splash message in places.
<!-- gh-linked-prs -->
### Linked PRs
* gh-118665
<!-- /gh-linked-prs -->
| 9bf00322ba09e2439a78fcec77dc6917e1391e31 | 67ce820d51d7f4bb7068ed560f4f2e2d83dd30d5 |
python/cpython | python__cpython-118614 | # Missing error handling in `_PyEval_GetFrameLocals` in `ceval.c`
# Bug report
Here's the problematic code: https://github.com/python/cpython/blob/d8d94911e2393bd30ca58a32b33d792307fdc00d/Python/ceval.c#L2497-L2504
What's wrong?
1. `PyDict_New()` can return `NULL`, it is not checked
2. `Py_DECREF(locals);` is only called on success, but not on error
Refs https://github.com/python/cpython/commit/b034f14a4b6e9197d3926046721b8b4b4b4f5b3d
I have a PR ready.
<!-- gh-linked-prs -->
### Linked PRs
* gh-118614
<!-- /gh-linked-prs -->
| a8e5fed1007233f677d3539162257b99b920df00 | 1506d5adc457a806e85886018804483e808d85c5 |
python/cpython | python__cpython-118611 | # Centralize power caching in `_pylong.py`
### Proposal:
A number of functions in `_pylong.py` craft their own schemes to cache costly `**` results. This complicates their code, and all of them end up doing more work than necessary.
So I want to add a new internal `compute_powers()` function that computes all and only the powers needed in advance, and returns a dict recording the results. It should speed things, but not by much (the time is dominated by how long it takes to compute the single largest power needed). The real point is code simplification.
### Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
### Links to previous discussion of this feature:
_No response_
<!-- gh-linked-prs -->
### Linked PRs
* gh-118611
<!-- /gh-linked-prs -->
| 2f0a338be66e276a700f86af51d5ef54a138cbfb | 2a85bed89dc14327afe344a57233a37795fde2b9 |
python/cpython | python__cpython-118615 | # ``Objects/frameobject.c`` lacks error-checking
# Bug report
### Bug description:
There's a couple of moments like this:
https://github.com/python/cpython/blob/d8d94911e2393bd30ca58a32b33d792307fdc00d/Objects/frameobject.c#L323-L327
Of course, we need to add a check that ``dct`` has a non-NULL value.
However, during the build I have notice this warning:
```
Objects/frameobject.c:390:59: warning: omitting the parameter name in a function definition is a C2x extension [-Wc2x-extensions]
framelocalsproxy_values(PyObject *self, PyObject *__unused)
^
```
I think it's ok to address all of these issues in one PR.
### CPython versions tested on:
CPython main branch
### Operating systems tested on:
macOS
<!-- gh-linked-prs -->
### Linked PRs
* gh-118615
<!-- /gh-linked-prs -->
| 7528b84e947f727734bd802356e380673553387d | 709ca90a00e66cea432096a7ba61aa6459d2a9a7 |
python/cpython | python__cpython-118607 | # ``test_bdb`` leaks references
# Bug report
### Bug description:
```python
./python -m test -R 3:3 test_bdb
Using random seed: 2592309756
0:00:00 load avg: 25.13 Run 1 test sequentially
0:00:00 load avg: 25.13 [1/1] test_bdb
beginning 6 repetitions. Showing number of leaks (. for 0 or less, X for 10 or more)
123:456
XX2 222
test_bdb leaked [1, 1, 1] references, sum=3
test_bdb leaked [2, 2, 2] memory blocks, sum=6
test_bdb failed (reference leak)
== Tests result: FAILURE ==
1 test failed:
test_bdb
Total duration: 845 ms
Total tests: run=35
Total test files: run=1/1 failed=1
Result: FAILURE
```
### CPython versions tested on:
CPython main branch
### Operating systems tested on:
Linux
<!-- gh-linked-prs -->
### Linked PRs
* gh-118607
<!-- /gh-linked-prs -->
| b4f8eb0de2c775e4fb11b15d26b9f21195732d47 | d8d94911e2393bd30ca58a32b33d792307fdc00d |
python/cpython | python__cpython-118597 | # Add thread-safety clarifications to the SSLContext documentation
# Documentation
Currently there is no documentation that tells anything about whether `SSLContext` is thread-safe or not and how it can be shared between different connections. Knowing how to share the `SSLContext` between different threads and connections is important for example to solve problems like [this](https://github.com/python/cpython/issues/95031).
This issue has also come up [here](https://github.com/psf/requests/pull/6667) where the matter was clarified by @tiran in [this comment](https://github.com/psf/requests/pull/6667):
> `SSLContext` is designed to be shared and used for multiple connections. It is thread safe as long as you don't reconfigure it once it is used by a connection. Adding new certs to the internal trust store is fine, but changing ciphers, verification settings, or mTLS certs can lead to surprising behavior. The problem is unrelated to threads and can even occur in a single-threaded program.
I have reworked this statement into a PR so that it's generally available for future reference.
<!-- gh-linked-prs -->
### Linked PRs
* gh-118597
* gh-120595
* gh-120596
<!-- /gh-linked-prs -->
| 4f59f8638267aa64ad2daa0111d8b7fdc2499834 | 92cebaa4911786683e87841bf7788351e7595ac2 |
python/cpython | python__cpython-119936 | # inspect.signature.BoundArguments "POSITIONAL_OR_KEYWORD" Arguments are always args
# Feature Request
### Feature description:
```python
from inspect import signature
def foo(bar, /, baz, *, bat):
...
ba = signature(foo).bind('bla', baz='bli', bat='blub')
```
In this case the argument `baz` get returned with `ba.args`, which returns `('bla', 'bli')`
I expected it in `ba.kwargs`, but that returns only `{bat: 'blub'}`.
Binding `baz` positional (`bind('bla', 'bli', bat='blub')`) works as expected.
Here `ba.args` returns `('bla', 'bli')` again and `ba.kwargs` `{bat: 'blub'}`.
Is this behavior wanted like this?
In my perspective it makes more sense when the `BoundArguments` class returns `POSITIONAL_OR_KEYWORD` arguments as it got it (positional as `args` and keyword as `kwargs`) and not always as `args`. I think there happens a lost of Information .
Edit:
At least it not cause errors, because in constellations, where it is necessary to be a keyword it is. So it also could argued against the information lost, that it is a build in feature of simplification of unnecessary keywords.
See the following example:
```python
from inspect import signature
def foo(bar, /, new='blub', baz='bla', *, bat='bli'):
...
ba = signature(foo).bind('bla', baz='bli', bat='blub')
```
`ba.args` => `('bla',)`
`ba.kwargs` => `{'baz': 'bli', 'bat': 'blub'}`
### CPython versions tested on:
3.12
### Operating systems tested on:
Windows
<!-- gh-linked-prs -->
### Linked PRs
* gh-119936
* gh-124004
* gh-124005
<!-- /gh-linked-prs -->
| 8e99495701737c9d9706622f59581213ef163b23 | f5597dbd0e7938648bfd9244f4a9225825b36b2b |
python/cpython | python__cpython-118570 | # How to dynamically create PEP695 classes? Let's add a test for it
# Feature or enhancement
Right now we don't have a single test to dynamically create a PEP-695 class.
It is quite complex, because, for example, it cannot be done via `type()`, you have to use `types.new_class`. Example:
```python
import typing
T = typing.TypeVar('T', infer_variance=True)
Klass = type(
'Klass',
(typing.Generic[T],),
{'__type_params__': (T,)},
)
```
Produces:
```python
Traceback (most recent call last):
File "/Users/sobolev/Desktop/cpython2/ex.py", line 9, in <module>
Klass = type(
'Klass',
...<2 lines>...
# set_type_params,
)
TypeError: type() doesn't support MRO entry resolution; use types.new_class()
```
This is fine (I guess?)
Since `types.new_class` is mentioned and it is there to create classes with complex MROs, we need to be sure that it works the same way as regular `class My[T]: ...`
I will send a PR.
<!-- gh-linked-prs -->
### Linked PRs
* gh-118570
* gh-118574
<!-- /gh-linked-prs -->
| 5f547585fa56c94c5d836b5313a7200f4937ebc4 | f34e965e52b9bdf157b829371870edfde45b80bf |
python/cpython | python__cpython-118723 | # `test_free_threading.test_racing_iter_extend` crash
# Crash report
Seen in one of @swtaarrs's PRs:
```
test_racing_iter_extend (test.test_free_threading.test_list.TestList.test_racing_iter_extend) ... Fatal Python error: Segmentation fault
```
https://github.com/python/cpython/actions/runs/8942881107/job/24566423243 (crash and then success)
<details>
<summary>Logs</summary>
```
test_racing_iter_extend (test.test_free_threading.test_list.TestList.test_racing_iter_extend) ... Fatal Python error: Segmentation fault
Thread 0x00007f062affe700 (most recent call first):
File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/test/test_free_threading/test_list.py", line 47 in __init__
File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/test/test_free_threading/test_list.py", line 56 in writer_func
File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/threading.py", line 990 in run
File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/threading.py", line 1039 in _bootstrap_inner
File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/threading.py", line 1010 in _bootstrap
Thread 0x00007f063affe700 (most recent call first):
File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/test/test_free_threading/test_list.py", line 63 in reader_func
File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/threading.py", line 990 in run
File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/threading.py", line 1039 in _bootstrap_inner
File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/threading.py", line 1010 in _bootstrap
Thread 0x00007f063bfff700 (most recent call first):
File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/test/test_free_threading/test_list.py", line 61 in reader_func
File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/threading.py", line 990 in run
File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/threading.py", line 1039 in _bootstrap_inner
File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/threading.py", line 1010 in _bootstrap
Thread 0x00007f0649ffd700 (most recent call first):
File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/test/test_free_threading/test_list.py", line 63 in reader_func
File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/threading.py", line 990 in run
File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/threading.py", line 1039 in _bootstrap_inner
File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/threading.py", line 1010 in _bootstrap
Thread 0x00007f064affe700 (most recent call first):
File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/test/test_free_threading/test_list.py", line 63 in reader_func
File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/threading.py", line 990 in run
File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/threading.py", line 1039 in _bootstrap_inner
File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/threading.py", line 1010 in _bootstrap
File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/threading.py", line 990 in run
File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/threading.py", line 1039 in _bootstrap_inner
File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/threading.py", line 1010 in _bootstrap
Thread 0x00007f0639ffd700 (most recent call first):
File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/test/test_free_threading/test_list.py", line 62 in reader_func
File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/threading.py", line 990 in run
File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/threading.py", line 1039 in _bootstrap_inner
File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/threading.py", line 1010 in _bootstrap
Thread 0x00007f062bfff700 (most recent call first):
File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/test/test_free_threading/test_list.py", line 62 in reader_func
File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/threading.py", line 990 in run
File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/threading.py", line 1039 in _bootstrap_inner
File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/threading.py", line 1010 in _bootstrap
Thread 0x00007f06cbf7c280 (most recent call first):
File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/threading.py", line 1090 in join
File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/test/test_free_threading/test_list.py", line 74 in test_racing_iter_extend
File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/unittest/case.py", line 606 in _callTestMethod
File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/unittest/case.py", line 651 in run
File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/unittest/case.py", line 707 in __call__
File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/unittest/suite.py", line [122](https://github.com/python/cpython/actions/runs/8942881107/job/24566423243#step:19:123) in run
File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/unittest/suite.py", line 84 in __call__
File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/unittest/suite.py", line 122 in run
File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/unittest/suite.py", line 84 in __call__
File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/unittest/suite.py", line 122 in run
File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/unittest/suite.py", line 84 in __call__
File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/unittest/suite.py", line 122 in run
File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/unittest/suite.py", line 84 in __call__
File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/unittest/runner.py", line 240 in run
File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/test/libregrtest/single.py", line 57 in _run_suite
File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/test/libregrtest/single.py", line 37 in run_unittest
File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/test/libregrtest/single.py", line [132](https://github.com/python/cpython/actions/runs/8942881107/job/24566423243#step:19:133) in test_func
File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/test/libregrtest/single.py", line 88 in regrtest_runner
File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/test/libregrtest/single.py", line 135 in _load_run_test
File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/test/libregrtest/single.py", line 178 in _runtest_env_changed_exc
File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/test/libregrtest/single.py", line 278 in _runtest
File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/test/libregrtest/single.py", line 309 in run_single_test
File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/test/libregrtest/worker.py", line 77 in worker_process
File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/test/libregrtest/worker.py", line 112 in main
File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/test/libregrtest/worker.py", line 116 in <module>
File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/runpy.py", line 88 in _run_code
File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/runpy.py", line 198 in _run_module_as_main
```
</details>
cc @DinoV
<!-- gh-linked-prs -->
### Linked PRs
* gh-118723
* gh-118863
<!-- /gh-linked-prs -->
| 2402715e10d00ef60fad2948d8461559d084eb36 | 82abe75e77129bebb3c13d807e8040f6924194f6 |
python/cpython | python__cpython-118553 | # drop_gil in ceval_gil.c checks locked using _Py_atomic_load_ptr_relaxed instead of _Py_atomic_load_int_relaxed
# Bug report
### Bug description:
In `drop_gil()` in ceval_gil.c, there's a check to see if `gil->locked`, but it's loaded using `_Py_atomic_load_ptr_relaxed` instead of `_Py_atomic_load_int_relaxed`. This sort of "works" because:
- `_Py_atomic_load_ptr_relaxed` takes `const void*` rather than something more specific like `const void**`, so the fact that `&git->locked` is an `int*` causes no compiler displeasure.
- It's just an assertion, so the fact that on 64-bit platforms, this loads the adjacent `switch_number` field just means that the assertion won't fire in some cases where it should.
I don't think this is any kind of security issue and it's probably benign, but worth fixing for sanity.
### CPython versions tested on:
CPython main branch
### Operating systems tested on:
macOS
<!-- gh-linked-prs -->
### Linked PRs
* gh-118553
<!-- /gh-linked-prs -->
| 0e78a545e6e78b16eb7709ec3db2243364603134 | 6d9e8e989e9e0931f84155451f921621b906e213 |
python/cpython | python__cpython-118528 | # Scaling bottlenecks in the free-threaded build
There are a few remaining scaling bottlenecks in the free-threaded build that we should fix.
I have been using the following benchmark to detect bottlenecks that were previously issues in older versions of the nogil forks:
https://gist.github.com/colesbury/429fe9f90036d43ad43576c3d357a12e
Note that for reliable results the above benchmark requires some setup:
* Adjust `NTHREADS` if necessary on your system
* Disable [turbo boost](https://askubuntu.com/a/1163808) or equivalent on your system
* Avoid running on hyper-threading siblings (i.e., use `taskset -c 0-<N>` to choose separate physical cores)
### Current bottlenecks
* cmodule_function
* load_string_const
* load_tuple_const
* create_closure
### Underlying issues
* Reference count contention on non-string constants. We will want to immortalize most constants in `PyCodeObject`.
* Reference count contention on `func.__qualname__` or `code.co_qualname` (when creating closure)
* Reference count contention on module-level `PyCFunctionObjects`
<!-- gh-linked-prs -->
### Linked PRs
* gh-118528
* gh-118529
* gh-118558
* gh-118576
* gh-118667
<!-- /gh-linked-prs -->
| 24e643d4ef024a3561c927dc07c59c435bb27bcc | c8deb1e4b495bf97ab00c710dfd63f227e1fb645 |
python/cpython | python__cpython-118520 | # The check to see if we have no weakrefs isn't correct
# Bug report
### Bug description:
https://github.com/python/cpython/blob/main/Objects/weakrefobject.c#L991
This is checking if we have a list at all, rather than if the list is empty. This is causing a slow down that's pretty significant on free-threaded builds
### CPython versions tested on:
CPython main branch
### Operating systems tested on:
Linux
<!-- gh-linked-prs -->
### Linked PRs
* gh-118520
<!-- /gh-linked-prs -->
| e54b0c8a4ad6c6e958245eb3ea4ecc47e0f97ff0 | 1e67b9207c31a92d76bfac09fc706c4dc703669e |
python/cpython | python__cpython-112254 | # Allow perf to work without frame pointers
<!-- gh-linked-prs -->
### Linked PRs
* gh-112254
* gh-118592
* gh-118640
* gh-118646
* gh-118654
* gh-118693
* gh-118708
* gh-130866
* gh-131059
<!-- /gh-linked-prs -->
| 1b22d801b86ed314c4804b19a1fc4b13484e3cea | 999f0c512281995fb61a0d9eda075fd846e8c505 |
python/cpython | python__cpython-118526 | # UnboundLocalError when module is shadowed by a comprehension and then accessed by another comprehension
# Bug report
### Bug description:
Seems to be a regression in 3.12 when compared to 3.11, likely caused by [PEP 709: Comprehension inlining](https://docs.python.org/3.12/whatsnew/3.12.html#pep-709-comprehension-inlining), but I haven't verified this. Example below. (Noticed while running [this code](https://github.com/Vocab-Apps/anki-hyper-tts/blob/5a1637c/service.py#L74).)
```python
import sys
def f():
_ = [sys for sys in []] # can be any module other than sys
[sys.stdout.write('success\n') for _ in [1]]
f()
```
```
$ python3.11 main.py # 3.11.9
success
```
```
$ python3.12 main.py # 3.12.3
Traceback (most recent call last):
File "/home/jkozera/imp/main.py", line 5, in <module>
f()
File "/home/jkozera/imp/main.py", line 4, in f
[sys.stdout.write('success\n') for _ in [1]]
^^^
UnboundLocalError: cannot access local variable 'sys' where it is not associated with a value
```
```
$ python3.13 main.py # 3.13.0a6+ (heads/main:2770d5c, May 2 2024, 18:19:03)
Traceback (most recent call last):
File "/home/jkozera/imp/main.py", line 5, in <module>
f()
~^^
File "/home/jkozera/imp/main.py", line 4, in f
[sys.stdout.write('success\n') for _ in [1]]
^^^
UnboundLocalError: cannot access local variable 'sys' where it is not associated with a value
```
### CPython versions tested on:
3.11, 3.12, CPython main branch
### Operating systems tested on:
Linux
<!-- gh-linked-prs -->
### Linked PRs
* gh-118526
* gh-118548
<!-- /gh-linked-prs -->
| c8deb1e4b495bf97ab00c710dfd63f227e1fb645 | 37ccf167869d101c4021c435868b7f89ccda8148 |
python/cpython | python__cpython-119155 | # re docs should state exactly which whitespace is matched by \s
# Documentation
Currently, and since 3.0 it seems, it simply states that `\s` "Matches Unicode whitespace characters (which includes `[ \t\n\r\f\v]`, and also many other characters, for example the non-breaking spaces mandated by typography rules in many languages)."
But "Unicode whitespace characters" seems awfully vague. Exactly which [General_Category value] does that correspond to? Space_Separator (Zs)? Separator (Z)? Some Python-specific selection of ""Unicode whitespace characters""? It's not entirely clear.
The 2.7 docs were better, stating that "If [`UNICODE`](https://docs.python.org/2.7/library/re.html#re.UNICODE) is set, this will match the characters `[ \t\n\r\f\v]` plus whatever is classified as space in the Unicode character properties database."
I'd like to believe that Python 3.x uses the exact same definition for `\s` as 2.7 did, and that therefore I already have the answer to my question. I'd like to believe a lot of things. But computers don't run on belief(s).
No one should have to resort to digging thru the source code for the answer to such a simple but important question.
P.S. I did try searching the interwebs for an answer to "which whitespace is matched by \s in python". Unfortunately search engines seem entirely unwilling to help. Perhaps no one else knows or wants to know. That's a shame.
[General_Category value]: https://unicode.org/reports/tr44/#General_Category_Values
<!-- gh-linked-prs -->
### Linked PRs
* gh-119155
* gh-123670
* gh-123671
<!-- /gh-linked-prs -->
| 22fdb8cf899d2dd29f2ac0bf61309af6809719fb | 23f159ae711d84177e8ce34cd9a6c8a762de64ac |
python/cpython | python__cpython-118755 | # Refactor `nt._path_is*` & `nt._path_[l]exists`
# Feature or enhancement
### Proposal:
Quoting @eryksun:
> I agree that all of these `_path_is*` and `_path_[l]exists` helpers are a lot of code to maintain, taken together. It could be refactored into smaller inline helper functions that can be reused, which would also make the code more readable.
### Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
### Links to previous discussion of this feature:
- #117842
<!-- gh-linked-prs -->
### Linked PRs
* gh-118755
* gh-119360
* gh-119381
* gh-119420
* gh-120817
* gh-121365
<!-- /gh-linked-prs -->
| b64182550f73e556344bd754d32e3be5d22a74e1 | de8f530841b55885b919677a6938ab33d4a92f20 |
python/cpython | python__cpython-118501 | # Support zipapp on pdb
# Feature or enhancement
### Proposal:
zipapp is a format Python officially supports and it seems like pdb should just support debugging it. I don't see a reason why we would not want to do that. Also as all the pieces are already in there, it's not difficult to support it.
### Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
### Links to previous discussion of this feature:
_No response_
<!-- gh-linked-prs -->
### Linked PRs
* gh-118501
<!-- /gh-linked-prs -->
| 4e2caf2aa046bf80e87e9b858837bb527459a034 | e54b0c8a4ad6c6e958245eb3ea4ecc47e0f97ff0 |
python/cpython | python__cpython-118530 | # Thread Sanitizer failure: `LLVMSymbolizer: error reading file: No such file or directory` in free-threaded TSan CI
See: https://github.com/python/cpython/actions/runs/8915487425/job/24485217543 and https://github.com/python/cpython/actions/runs/8915976859/job/24486582444?pr=118493
```
0:03:54 load avg: 3.29 [21/22/1] test_threading failed (1 failure) (1 min 5 sec) -- running (1): test_weakref (56.6 sec)
/home/runner/work/cpython/cpython/Lib/unittest/case.py:707: DeprecationWarning: It is deprecated to return a value that is not None from a test case (<bound method skip.<locals>.decorator of <test.test_threading.ThreadJoinOnShutdown testMethod=test_2_join_in_forked_process>>)
return self.run(*args, **kwds)
/home/runner/work/cpython/cpython/Lib/unittest/case.py:707: DeprecationWarning: It is deprecated to return a value that is not None from a test case (<bound method skip.<locals>.decorator of <test.test_threading.ThreadJoinOnShutdown testMethod=test_3_join_in_forked_from_thread>>)
return self.run(*args, **kwds)
/home/runner/work/cpython/cpython/Lib/unittest/case.py:707: DeprecationWarning: It is deprecated to return a value that is not None from a test case (<bound method skip.<locals>.decorator of <test.test_threading.ThreadJoinOnShutdown testMethod=test_clear_threads_states_after_fork>>)
return self.run(*args, **kwds)
/home/runner/work/cpython/cpython/Lib/unittest/case.py:707: DeprecationWarning: It is deprecated to return a value that is not None from a test case (<bound method skip.<locals>.decorator of <test.test_threading.ThreadJoinOnShutdown testMethod=test_reinit_tls_after_fork>>)
return self.run(*args, **kwds)
/home/runner/work/cpython/cpython/Lib/unittest/case.py:707: DeprecationWarning: It is deprecated to return a value that is not None from a test case (<bound method skip.<locals>.decorator of <test.test_threading.ThreadTests testMethod=test_dummy_thread_after_fork>>)
return self.run(*args, **kwds)
/home/runner/work/cpython/cpython/Lib/unittest/case.py:707: DeprecationWarning: It is deprecated to return a value that is not None from a test case (<bound method skip.<locals>.decorator of <test.test_threading.ThreadTests testMethod=test_is_alive_after_fork>>)
return self.run(*args, **kwds)
/home/runner/work/cpython/cpython/Lib/unittest/case.py:707: DeprecationWarning: It is deprecated to return a value that is not None from a test case (<bound method skip.<locals>.decorator of <test.test_threading.ThreadTests testMethod=test_main_thread_after_fork>>)
return self.run(*args, **kwds)
/home/runner/work/cpython/cpython/Lib/unittest/case.py:707: DeprecationWarning: It is deprecated to return a value that is not None from a test case (<bound method skip.<locals>.decorator of <test.test_threading.ThreadTests testMethod=test_main_thread_after_fork_from_nonmain_thread>>)
return self.run(*args, **kwds)
test test_threading failed -- Traceback (most recent call last):
File "/home/runner/work/cpython/cpython/Lib/test/test_threading.py", line 8[50](https://github.com/python/cpython/actions/runs/8915487425/job/24485217543#step:12:51), in test_main_thread_after_fork_from_dummy_thread
self.test_main_thread_after_fork_from_foreign_thread(create_dummy=True)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
File "/home/runner/work/cpython/cpython/Lib/test/test_threading.py", line 839, in test_main_thread_after_fork_from_foreign_thread
self.assertEqual(err.decode(), "")
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
AssertionError: 'LLVMSymbolizer: error reading file: No such file or directory\n' != ''
- LLVMSymbolizer: error reading file: No such file or directory
0:04:17 load avg: 2.64 [22/22/1] test_weakref passed (1 min 19 sec)
```
<!-- gh-linked-prs -->
### Linked PRs
* gh-118530
<!-- /gh-linked-prs -->
| 3e818afb9b7c557aa633aeb3d5c4959750feeab0 | 2dae505e87e3815f087d4b07a71bb2c5cce22304 |
python/cpython | python__cpython-118537 | # Add linting job to `.pre-commit-config.yaml` for JIT files
Per discussion in https://github.com/python/cpython/pull/118481
<!-- gh-linked-prs -->
### Linked PRs
* gh-118537
<!-- /gh-linked-prs -->
| cb57a52a85a7845b1c017085f05a7f6d71855edc | dd8f05fee26cb98770744291a007ceb6b49a5089 |
python/cpython | python__cpython-118488 | # [CVE-2024-4030] Enable `mkdir(mode=0o700)` to work on Windows
If we interpret `0o700` as "only accessible by the current user", then we can imitate the behaviour with ACLs.
<!-- gh-linked-prs -->
### Linked PRs
* gh-118488
* gh-118515
* gh-118737
* gh-118738
* gh-118739
* gh-118740
* gh-118741
* gh-118742
* gh-118768
* gh-119056
* gh-119068
* gh-119069
<!-- /gh-linked-prs -->
| 81939dad77001556c527485d31a2d0f4a759033e | b3372481b6cae5766330b041c4622c28cee2119f |
python/cpython | python__cpython-118474 | # sys.set_asyncgen_hooks with invalid firstiter may partially set finalizer
# Bug report
### Bug description:
```python
finalizer = lambda *a: None
try:
sys.set_asyncgen_hooks(firstiter="invalid", finalizer=finalizer)
except TypeError: # TypeError due to invalid `firstiter` type
cur = sys.get_asyncgen_hooks()
self.assertIsNone(cur.firstiter) # This is not set
self.assertIsNone(cur.finalizer) # But this is set
```
[PEP 525](https://peps.python.org/pep-0525/) doesn't imply or define partial initialization priority. Since inside of `set_asyncgen_hooks` is blackbox to user, this is surprising and users are hard to know they have to back up current setup and recover it when `TypeError` happens.
Inconsistency also cause user experience problem. Current order `sys.set_asyncgen_hooks(firstiter="invalid", finalizer=finalizer)` causes partial set, but `sys.set_asyncgen_hooks(firstiter=finalizer, finalizer="invalid")` will not.
### CPython versions tested on:
CPython main branch
### Operating systems tested on:
macOS
<!-- gh-linked-prs -->
### Linked PRs
* gh-118474
<!-- /gh-linked-prs -->
| 8d8275b0cf43f0e20c72a9641cbddc5044cdae04 | e272195b3eff3a78e334a601a637d198b8de2319 |
python/cpython | python__cpython-118456 | # mangle_from_ default in email.policy.Policy.__doc__ is wrong
# Bug report
### Bug description:
```
>>> from email.policy import Policy
>>> Policy.mangle_from_
False
>>> print(Policy.__doc__)
...
mangle_from_ -- a flag that, when True escapes From_ lines in the
body of the message by putting a `>' in front of
them. This is used when the message is being
serialized by a generator. Default: True.
...
```
This attribute was added in https://github.com/python/cpython/commit/fdb23c2fe5499d26701fa34873c1cdc347adcb80 and was always False by default, as far as I can see.
The [docs](https://docs.python.org/3/library/email.policy.html#email.policy.Policy.mangle_from_) also correctly say that it defaults to False. I don't know why the class docstring says otherwise.
### CPython versions tested on:
CPython main branch
### Operating systems tested on:
Linux
<!-- gh-linked-prs -->
### Linked PRs
* gh-118456
* gh-118586
<!-- /gh-linked-prs -->
| fed8d73fde779fca41026398376cb3038e9b2b5f | 711c80bfca5dd17cb7c6ec26f0e44848b33aec04 |
python/cpython | python__cpython-118489 | # `posixpath.realpath('secretlink')` raises
# Bug report
### Bug description:
GNU coreutils `realpath -m` doesn't raise an error for secret symlinks (no read permission):
```zsh
wannes@Stefans-iMac dirs % sudo ls -l secret-symlink
l--------- 1 wannes staff 44 Jun 30 2023 secret-symlink -> /Users/wannes/path-picker/link-test/dirs/dir
wannes@Stefans-iMac dirs % grealpath -m secret-symlink
/Users/wannes/path-picker/link-test/dirs/secret-symlink
```
But `posixpath.realpath()` does:
```python
>>> import posixpath
>>> posixpath.realpath("secret-symlink")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<frozen posixpath>", line 435, in realpath
File "<frozen posixpath>", line 495, in _joinrealpath
PermissionError: [Errno 13] Permission denied: 'secret-symlink'
```
### CPython versions tested on:
3.12
### Operating systems tested on:
macOS
<!-- gh-linked-prs -->
### Linked PRs
* gh-118489
* gh-119163
* gh-119170
* gh-119181
<!-- /gh-linked-prs -->
| caf6064a1bc15ac344afd78b780188e60b9c628e | 30b4e9f9c42493136c58c56fee5553128bb32428 |
python/cpython | python__cpython-125467 | # Add `INSTRUCTION_SIZE` macro to code generator.
In bytecodes.c we use both `next_instr - this_instr` and `1 + INLINE_CACHE_ENTRIES_...` to mean "instruction length".
We should add a macro for the purpose that is understood by the code generator.
### Examples
The somewhat confusing `LOAD_IP(1 + INLINE_CACHE_ENTRIES_SEND);` would become `LOAD_IP(INSTRUCTION_LENGTH)`
`frame->return_offset = (uint16_t)(next_instr - this_instr);` would become `frame->return_offset = INSTRUCTION_LENGTH;` which is both easier to understand and wouldn't be rejected as tier 2 code.
<!-- gh-linked-prs -->
### Linked PRs
* gh-125467
<!-- /gh-linked-prs -->
| aab58a93efd09185e3622572d2624a31e0fe405b | b2eaa75b176e07730215d76d8dce4d63fb493391 |
python/cpython | python__cpython-118429 | # test_run_fileexflags() crash on PPC64LE RHEL7 LTO + PGO 3.x
# Bug report
build: https://buildbot.python.org/all/#/builders/43/builds/5305/steps/5/logs/stdio
Logs:
```
./python -E -m test --slow-ci --timeout=1200 -j2 --junit-xml test-results.xml -j10
+ ./python -u -W default -bb -E -m test --slow-ci --timeout=1200 -j2 --junit-xml test-results.xml -j10 --dont-add-python-opts
== CPython 3.13.0a6+ (heads/main:8b56d82, Apr 29 2024, 18:49:30) [GCC 8.3.1 20190311 (Red Hat 8.3.1-3)]
== Linux-3.10.0-1160.114.2.el7.ppc64le-ppc64le-with-glibc2.17 little-endian
== Python build: release LTO+PGO
== cwd: /home/buildbot/buildarea/3.x.cstratak-RHEL7-ppc64le.lto-pgo/build/build/test_python_worker_24730æ
== CPU count: 8
== encodings: locale=UTF-8 FS=utf-8
== resources: all
(...)
test_atomic_load_store_uint64 (test.test_capi.test_pyatomic.PyAtomicTests.test_atomic_load_store_uint64) ... ok
test_atomic_load_store_uint8 (test.test_capi.test_pyatomic.PyAtomicTests.test_atomic_load_store_uint8) ... ok
test_atomic_load_store_uintptr (test.test_capi.test_pyatomic.PyAtomicTests.test_atomic_load_store_uintptr) ... ok
test_atomic_release_acquire (test.test_capi.test_pyatomic.PyAtomicTests.test_atomic_release_acquire) ... ok
test_run_fileexflags (test.test_capi.test_run.CAPITest.test_run_fileexflags) ...
Fatal Python error: Segmentation fault
Current thread 0x00003fff876747f0 (most recent call first):
File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-ppc64le.lto-pgo/build/Lib/test/test_capi/test_run.py", line 72 in run
File "/home/buildbot/buildarea/3.x.cstratak-RHEL7-ppc64le.lto-pgo/build/Lib/test/test_capi/test_run.py", line 78 in test_run_fileexflags
(...)
Extension modules: _testinternalcapi, _testcapi, _testlimitedcapi, _testmultiphase, _testsinglephase (total: 5)
```
<!-- gh-linked-prs -->
### Linked PRs
* gh-118429
<!-- /gh-linked-prs -->
| e93c39b47ea623dfaf61f80775ad4747b163efe5 | 587388ff22dc7cfa4b66722daf0d33cd804af9f2 |
python/cpython | python__cpython-118431 | # TypeError: _eval_type() missing 1 required positional argument: 'type_params' with import module
# Bug report
### What happened?
```python
import openai
```
```pytb
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.12/site-packages/openai/__init__.py", line 8, in <module>
from . import types
File "/usr/local/lib/python3.12/site-packages/openai/types/__init__.py", line 5, in <module>
from .batch import Batch as Batch
File "/usr/local/lib/python3.12/site-packages/openai/types/batch.py", line 7, in <module>
from .._models import BaseModel
File "/usr/local/lib/python3.12/site-packages/openai/_models.py", line 35, in <module>
from ._utils import (
File "/usr/local/lib/python3.12/site-packages/openai/_utils/__init__.py", line 3, in <module>
from ._utils import (
File "/usr/local/lib/python3.12/site-packages/openai/_utils/_utils.py", line 24, in <module>
from .._compat import parse_date as parse_date, parse_datetime as parse_datetime
File "/usr/local/lib/python3.12/site-packages/openai/_compat.py", line 48, in <module>
from pydantic.v1.typing import (
File "/usr/local/lib/python3.12/site-packages/pydantic/v1/__init__.py", line 7, in <module>
from .env_settings import BaseSettings
File "/usr/local/lib/python3.12/site-packages/pydantic/v1/env_settings.py", line 23, in <module>
class BaseSettings(BaseModel):
File "/usr/local/lib/python3.12/site-packages/pydantic/v1/main.py", line 178, in __new__
annotations = resolve_annotations(namespace.get('__annotations__', {}), namespace.get('__module__', None))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/pydantic/v1/typing.py", line 400, in resolve_annotations
value = _eval_type(value, base_globals, None)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
```
```python
import fastapi
```
```pytb
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.12/site-packages/fastapi/__init__.py", line 7, in <module>
from .applications import FastAPI as FastAPI
File "/usr/local/lib/python3.12/site-packages/fastapi/applications.py", line 16, in <module>
from fastapi import routing
File "/usr/local/lib/python3.12/site-packages/fastapi/routing.py", line 22, in <module>
from fastapi import params
File "/usr/local/lib/python3.12/site-packages/fastapi/params.py", line 5, in <module>
from fastapi.openapi.models import Example
File "/usr/local/lib/python3.12/site-packages/fastapi/openapi/models.py", line 68, in <module>
class Contact(BaseModelWithConfig):
File "/usr/local/lib/python3.12/site-packages/pydantic/_internal/_model_construction.py", line 197, in __new__
set_model_fields(cls, bases, config_wrapper, types_namespace)
File "/usr/local/lib/python3.12/site-packages/pydantic/_internal/_model_construction.py", line 474, in set_model_fields
fields, class_vars = collect_model_fields(cls, bases, config_wrapper, types_namespace, typevars_map=typevars_map)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/pydantic/_internal/_fields.py", line 131, in collect_model_fields
type_hints = get_cls_type_hints_lenient(cls, types_namespace)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/pydantic/_internal/_typing_extra.py", line 226, in get_cls_type_hints_lenient
hints[name] = eval_type_lenient(value, globalns, localns)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/pydantic/_internal/_typing_extra.py", line 238, in eval_type_lenient
return eval_type_backport(value, globalns, localns)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/pydantic/_internal/_typing_extra.py", line 255, in eval_type_backport
return typing._eval_type(value, globalns, localns)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: _eval_type() missing 1 required positional argument: 'type_params'
```
### CPython versions tested on:
3.12
### Operating systems tested on:
Linux
### Output from running 'python -VV' on the command line:
Python 3.12.3+ (heads/3.12-dirty:817190c, Apr 29 2024, 12:17:20) [GCC 11.4.0]
<!-- gh-linked-prs -->
### Linked PRs
* gh-118431
* gh-118436
* gh-118695
<!-- /gh-linked-prs -->
| 4a5ad8469af9a6fc0ec1355eb203cc22bb4321d5 | 72dae53e09a5344bf4922d934a34a2fa48a11c86 |
python/cpython | python__cpython-118496 | # Assertion failure with multiple threads & legacy opcode tracing in free-threaded build
# Crash report
### What happened?
~~Bisected to 33da0e844c922b3dcded75fbb9b7be67cb013a17.~~
```python
import sys
import threading
def trace(frame, event, arg):
frame.f_trace_opcodes = True
return trace
sys.settrace(trace)
l = threading._RLock()
def f():
while True:
with l:
pass
t = threading.Thread(target=f)
t.start()
while True:
with l:
pass
t.join()
```
```
$ ./python -X faulthandler -X gil=0 repro.py
python: Python/instrumentation.c:1216: _Py_call_instrumentation_line: Assertion `is_version_up_to_date(code, tstate->interp)' failed.
Fatal Python error: Aborted
Current thread 0x00007f7bc3712700 (most recent call first):
File "/home/radislav/projects/cpython/Lib/threading.py", line 209 in acquire
File "/home/radislav/projects/cpython/repro.py", line 14 in f
File "/home/radislav/projects/cpython/Lib/threading.py", line 990 in run
File "/home/radislav/projects/cpython/Lib/threading.py", line 1039 in _bootstrap_inner
File "/home/radislav/projects/cpython/Lib/threading.py", line 1010 in _bootstrap
Thread 0x00007f7bc39fb280 (most recent call first):
File "/home/radislav/projects/cpython/Lib/threading.py", line 206 in acquire
File "/home/radislav/projects/cpython/repro.py", line 20 in <module>
Aborted (core dumped)
```
### CPython versions tested on:
CPython main branch
### Operating systems tested on:
Linux
### Output from running 'python -VV' on the command line:
Python 3.13.0a6+ (heads/main:5a90de0d4c, Apr 30 2024, 00:01:27) [GCC 10.2.1 20210110]
<!-- gh-linked-prs -->
### Linked PRs
* gh-118496
<!-- /gh-linked-prs -->
| 00d913c6718aa365027c6dcf850e8f40731e54fc | 9bf00322ba09e2439a78fcec77dc6917e1391e31 |
python/cpython | python__cpython-118683 | # Assertion failure in `_PyEval_EvalFrameDefault` with generators and `LINE`/`INSTRUCTION` event monitoring
# Crash report
### What happened?
Bisected to 3e06c7f719b99cc7f5e8889319cff4980e41d3e8, where given assertion was added.
Repro:
```python
from sys import monitoring as mon
mon.use_tool_id(mon.DEBUGGER_ID, "test")
mon.set_events(mon.DEBUGGER_ID, mon.events.LINE)
def a():
yield
def b():
yield from a()
next(b())
```
Output:
```
python: Python/generated_cases.c.h:6035: _PyEval_EvalFrameDefault: Assertion `_PyOpcode_Deopt[frame->instr_ptr->op.code] == SEND || _PyOpcode_Deopt[frame->instr_ptr->op.code] == FOR_ITER || _PyOpcode_Deopt[frame->instr_ptr->op.code] == INTERPRETER_EXIT || _PyOpcode_Deopt[frame->instr_ptr->op.code] == ENTER_EXECUTOR' failed.
Fatal Python error: Aborted
Current thread 0x00007f7a88d3f280 (most recent call first):
File "/home/radislav/projects/cpython/repro.py", line 12 in b
File "/home/radislav/projects/cpython/repro.py", line 14 in <module>
Aborted (core dumped)
```
Backtrace:
```
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1 0x00007ffff7c85537 in __GI_abort () at abort.c:79
#2 0x00007ffff7c8540f in __assert_fail_base (fmt=0x7ffff7dfc688 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n",
assertion=0x555555a0fe30 "_PyOpcode_Deopt[frame->instr_ptr->op.code] == SEND || _PyOpcode_Deopt[frame->instr_ptr->op.code] == FOR_ITER || _PyOpcode_Deopt[frame->instr_ptr->op.code] == INTERPRETER_EXIT || _PyOpcode_Deopt[frame-"..., file=0x555555a0db6f "Python/generated_cases.c.h", line=6035, function=<optimized out>) at assert.c:92
#3 0x00007ffff7c94662 in __GI___assert_fail (
assertion=assertion@entry=0x555555a0fe30 "_PyOpcode_Deopt[frame->instr_ptr->op.code] == SEND || _PyOpcode_Deopt[frame->instr_ptr->op.code] == FOR_ITER || _PyOpcode_Deopt[frame->instr_ptr->op.code] == INTERPRETER_EXIT || _PyOpcode_Deopt[frame-"..., file=file@entry=0x555555a0db6f "Python/generated_cases.c.h", line=line@entry=6035,
function=function@entry=0x555555a10fa0 <__PRETTY_FUNCTION__.69> "_PyEval_EvalFrameDefault") at assert.c:101
#4 0x00005555558296b5 in _PyEval_EvalFrameDefault (tstate=tstate@entry=0x555555c27138 <_PyRuntime+308728>, frame=frame@entry=0x200003827c8,
throwflag=throwflag@entry=0) at Python/generated_cases.c.h:6035
#5 0x00005555556aaab4 in _PyEval_EvalFrame (throwflag=0, frame=0x200003827c8, tstate=0x555555c27138 <_PyRuntime+308728>) at ./Include/internal/pycore_ceval.h:118
#6 gen_send_ex2 (gen=0x20000382770, arg=arg@entry=0x0, presult=presult@entry=0x7fffffffda58, exc=exc@entry=0, closing=closing@entry=0) at Objects/genobject.c:228
#7 0x00005555556ab174 in gen_iternext (gen=<optimized out>) at Objects/genobject.c:586
#8 0x0000555555801a9d in builtin_next (self=<optimized out>, args=0x7ffff7fc1078, nargs=1) at Python/bltinmodule.c:1534
#9 0x00005555556f934c in cfunction_vectorcall_FASTCALL (func=0x200003a02b0, args=0x7ffff7fc1078, nargsf=<optimized out>, kwnames=<optimized out>)
at Objects/methodobject.c:425
#10 0x0000555555682724 in _PyObject_VectorcallTstate (tstate=0x555555c27138 <_PyRuntime+308728>, callable=0x200003a02b0, args=0x7ffff7fc1078,
nargsf=9223372036854775809, kwnames=0x0) at ./Include/internal/pycore_call.h:168
#11 0x000055555568283f in PyObject_Vectorcall (callable=callable@entry=0x200003a02b0, args=args@entry=0x7ffff7fc1078, nargsf=<optimized out>, kwnames=kwnames@entry=0x0)
at Objects/call.c:327
#12 0x000055555581436b in _PyEval_EvalFrameDefault (tstate=tstate@entry=0x555555c27138 <_PyRuntime+308728>, frame=0x7ffff7fc1020, throwflag=throwflag@entry=0)
at Python/generated_cases.c.h:813
#13 0x00005555558322e6 in _PyEval_EvalFrame (throwflag=0, frame=<optimized out>, tstate=0x555555c27138 <_PyRuntime+308728>) at ./Include/internal/pycore_ceval.h:118
#14 _PyEval_Vector (tstate=tstate@entry=0x555555c27138 <_PyRuntime+308728>, func=func@entry=0x20000ad0610, locals=locals@entry=0x20000746d90, args=args@entry=0x0,
argcount=argcount@entry=0, kwnames=kwnames@entry=0x0) at Python/ceval.c:1811
#15 0x0000555555832394 in PyEval_EvalCode (co=co@entry=0x200003e3010, globals=globals@entry=0x20000746d90, locals=locals@entry=0x20000746d90) at Python/ceval.c:602
#16 0x00005555558bf007 in run_eval_code_obj (tstate=tstate@entry=0x555555c27138 <_PyRuntime+308728>, co=co@entry=0x200003e3010, globals=globals@entry=0x20000746d90,
locals=locals@entry=0x20000746d90) at Python/pythonrun.c:1291
#17 0x00005555558c11d9 in run_mod (mod=mod@entry=0x20000b61a50, filename=filename@entry=0x20000aa1a50, globals=globals@entry=0x20000746d90,
locals=locals@entry=0x20000746d90, flags=flags@entry=0x7fffffffdf98, arena=arena@entry=0x20000031bd0, interactive_src=<optimized out>,
generate_new_source=<optimized out>) at Python/pythonrun.c:1376
#18 0x00005555558c155c in pyrun_file (fp=fp@entry=0x555555cbbb30, filename=filename@entry=0x20000aa1a50, start=start@entry=257, globals=globals@entry=0x20000746d90,
locals=locals@entry=0x20000746d90, closeit=closeit@entry=1, flags=0x7fffffffdf98) at Python/pythonrun.c:1212
#19 0x00005555558c29b7 in _PyRun_SimpleFileObject (fp=fp@entry=0x555555cbbb30, filename=filename@entry=0x20000aa1a50, closeit=closeit@entry=1,
flags=flags@entry=0x7fffffffdf98) at Python/pythonrun.c:461
#20 0x00005555558c2d3c in _PyRun_AnyFileObject (fp=fp@entry=0x555555cbbb30, filename=filename@entry=0x20000aa1a50, closeit=closeit@entry=1,
--Type <RET> for more, q to quit, c to continue without paging--
flags=flags@entry=0x7fffffffdf98) at Python/pythonrun.c:77
#21 0x00005555558ebbdf in pymain_run_file_obj (program_name=program_name@entry=0x20000ab0610, filename=filename@entry=0x20000aa1a50, skip_source_first_line=0)
at Modules/main.c:357
#22 0x00005555558ebeb6 in pymain_run_file (config=config@entry=0x555555bf9430 <_PyRuntime+121072>) at Modules/main.c:376
#23 0x00005555558ed57b in pymain_run_python (exitcode=exitcode@entry=0x7fffffffe11c) at Modules/main.c:628
#24 0x00005555558ed5e9 in Py_RunMain () at Modules/main.c:707
#25 0x00005555558ed63d in pymain_main (args=args@entry=0x7fffffffe160) at Modules/main.c:737
#26 0x00005555558ed6b2 in Py_BytesMain (argc=<optimized out>, argv=<optimized out>) at Modules/main.c:761
#27 0x00005555555d57de in main (argc=<optimized out>, argv=<optimized out>) at ./Programs/python.c:15
```
### CPython versions tested on:
CPython main branch
### Operating systems tested on:
Linux
### Output from running 'python -VV' on the command line:
Python 3.13.0a6+ (heads/main:5a90de0d4c, Apr 30 2024, 00:01:27) [GCC 10.2.1 20210110]
<!-- gh-linked-prs -->
### Linked PRs
* gh-118683
<!-- /gh-linked-prs -->
| 0d9148823dbb6af020945ab1b487d7f183b561a5 | b2cd54a4fb2ecdb7b1d30bda8af3314d3a32031e |
python/cpython | python__cpython-118491 | # `WithThreadsTestPool.test_release_task_refs`: flaky test or possible free-threading bug
This might be a free-threading related bug or possibly a flaky test. We should investigate and try to figure out the root cause.
```
======================================================================
FAIL: test_release_task_refs (test.test_multiprocessing_spawn.test_threads.WithThreadsTestPool.test_release_task_refs)
----------------------------------------------------------------------
Traceback (most recent call last):
File "D:\a\cpython\cpython\Lib\test\_test_multiprocessing.py", line 2817, in test_release_task_refs
self.assertEqual(set(wr() for wr in refs), {None})
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: Items in the first set but not the second:
<test._test_multiprocessing.CountedObject object at 0x03E7CA50>
```
Originally reported by hugovk in https://github.com/python/cpython/issues/118331#issuecomment-208372155 (https://github.com/python/cpython/actions/runs/8884999534/attempts/1).
<!-- gh-linked-prs -->
### Linked PRs
* gh-118491
* gh-118494
<!-- /gh-linked-prs -->
| c408c36e9b346f9f15a34e98a5596f311df65efa | a7711a2a4e5cf16b34fc284085da724a8c2c06dd |
python/cpython | python__cpython-118428 | # Implement inspect.signature() for sqlite3 connection object
# Feature or enhancement
`sqlite3.connection()` returns a custom callable object. But `inspect.signature()` returns a generic `<Signature (*args, **kwargs)>` for it:
```pycon
>>> import inspect, sqlite3
>>> con = sqlite3.connect(':memory:')
>>> con('select 1')
<sqlite3.Statement object at 0x7f76842d2fd0>
>>> inspect.signature(con)
<Signature (*args, **kwargs)>
```
This issue is similar to #118285 and #118402.
<!-- gh-linked-prs -->
### Linked PRs
* gh-118428
<!-- /gh-linked-prs -->
| b568c2c1ff5c0b1922a6402dc95c588d7f9aa914 | 19d468a3ab1d57c07a4283d67d439908574aa0cc |
python/cpython | python__cpython-118405 | # inspect.signature() raises TypeError for non-comparable callable
# Bug report
Example:
```py
class NoncomparableCallable:
def __call__(self, a):
pass
def __eq__(self, other):
1/0
import inspect
inspect.signature(NoncomparableCallable())
```
Real world example -- the result of `functools.cmp_to_key()` (see also #118402).
<!-- gh-linked-prs -->
### Linked PRs
* gh-118405
* gh-118424
<!-- /gh-linked-prs -->
| 11f8348d78c22f85694d7a424541b34d6054a8ee | 5b05d452cd20d9f0cfecdeec90adad3af5e4dfff |
python/cpython | python__cpython-118427 | # Implement inspect.signature() for functools.cmp_to_key() result
# Feature or enhancement
`functools.cmp_to_key()` returns a custom callable. `inspect.signature()` ~returns generic `<Signature (*args, **kwargs)>`~ raises a TypeError for the C implementation. The following PR makes it returning the same signature (`<Signature (obj)>`) for both Python and C implementations (currently it is returned for the Python implementation).
This issue is similar to #118285.
<!-- gh-linked-prs -->
### Linked PRs
* gh-118427
<!-- /gh-linked-prs -->
| 17a8af9508d6001e1666de984e2fb73f02167306 | 02887c6428042832f17fd71ed90619f25d8f951d |
python/cpython | python__cpython-118403 | # Doc workflow is failing due to a missing file 'Doc/sphinx-warnings.txt'
# Bug report
### Bug description:
Example: https://github.com/python/cpython/actions/runs/8883326110/job/24389960128?pr=118368
```pytb
Traceback (most recent call last):
File "/home/runner/work/cpython/cpython/Doc/tools/check-warnings.py", line 311, in <module>
sys.exit(main())
^^^^^^
File "/home/runner/work/cpython/cpython/Doc/tools/check-warnings.py", line 279, in main
with Path("Doc/sphinx-warnings.txt").open(encoding="UTF-8") as f:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.12.3/x64/lib/python3.12/pathlib.py", line 1013, in open
return io.open(self, mode, buffering, encoding, errors, newline)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'Doc/sphinx-warnings.txt'
```
The `'Doc/sphinx-warnings.txt'` file is a generated file so maybe we upgraded sphinx at some point and the new version does not generate the file if there's no warnings?
### CPython versions tested on:
CPython main branch
### Operating systems tested on:
_No response_
<!-- gh-linked-prs -->
### Linked PRs
* gh-118403
* gh-118407
<!-- /gh-linked-prs -->
| ee3413c1c70725e133b29bb1d245f569a8f64062 | 529a160be6733e04d2a44051d3f42f6ada8c1015 |
python/cpython | python__cpython-118381 | # Don't use `Py_BuildValue("(OO...)", a, b, ...)`
# Feature or enhancement
### Proposal:
This is an inefficient way to build a tuple:
```c
Py_BuildValue("(OO)", a, b)
```
This is faster, and more readable:
```c
PyTuple_Pack(2, a, b)
```
And if #118222 lands, we could use this even faster variant for length 1 & 2:
```c
PyTuple_Pack2( a, b)
```
### Has this already been discussed elsewhere?
No response given
### Links to previous discussion of this feature:
_No response_
<!-- gh-linked-prs -->
### Linked PRs
* gh-118381
<!-- /gh-linked-prs -->
| 9a75d56d5d9fdffb6ce9d83ede98486df238102d | 17a8af9508d6001e1666de984e2fb73f02167306 |
python/cpython | python__cpython-118375 | # ``test_ast`` raises a ``DeprecationWarning``
# Bug report
### Bug description:
```python
./python.exe -m test -q test_ast
Using random seed: 2061872940
0:00:00 load avg: 4.08 Run 1 test sequentially
/Users/admin/Projects/cpython/Lib/test/test_ast.py:1356: DeprecationWarning: Name.__init__ missing 1 required positional argument: 'ctx'. This will become an error in Python 3.15.
[ast.Name('dataclass')],
== Tests result: SUCCESS ==
Total duration: 3.3 sec
Total tests: run=168 skipped=1
Total test files: run=1/1
Result: SUCCESS
```
### CPython versions tested on:
CPython main branch
### Operating systems tested on:
macOS
<!-- gh-linked-prs -->
### Linked PRs
* gh-118375
<!-- /gh-linked-prs -->
| aa8f6d2708bce1462544d2e2cae05a2595ffd9ec | 133c1a7cdb19dd9317e7607ecf8f4fd4fb5842f6 |
python/cpython | python__cpython-118454 | # Simple racing class attribute read-write crashes on free-threaded builds
# Crash report
### What happened?
The following segfaults:
```python
from multiprocessing.dummy import Pool
NTHREADS = 6
class A:
attr = 1
BOTTOM = 0
TOP = 1000
ITERS = 100
def read(id0):
for _ in range(ITERS):
for _ in range(BOTTOM, TOP):
A.attr
# print(A.attr)
def write(id0):
for _ in range(ITERS):
for _ in range(BOTTOM, TOP):
# Make _PyType_Lookup cache hot first
A.attr
A.attr
x = A.attr
x += 1
A.attr = x
# print(f"WRITTEN {x}\n")
def main():
with Pool(NTHREADS) as pool:
pool.apply_async(read, (1,))
pool.apply_async(write, (1,))
pool.close()
pool.join()
main()
print("done")
```
The first issue is that we have `assert(_PyType_HasFeature(type, Py_TPFLAGS_VALID_VERSION_TAG));` in `typeobject.c`, which may not be true as another thread can modify the attribute in the meantime. We should remove that assertion.
The next issue, which I have not yet been able to solve, is that the attribute evaporates midway in `_Py_type_getattro_impl`. This is likely caused by a decref of another thread. So far I've tried changing `_PyType_Lookup` and `find_name_in_mro` to return strong references, but they don't seem to solve it for some reason.
### CPython versions tested on:
CPython main branch
### Operating systems tested on:
_No response_
### Output from running 'python -VV' on the command line:
_No response_
<!-- gh-linked-prs -->
### Linked PRs
* gh-118454
* gh-118666
<!-- /gh-linked-prs -->
| 5a1618a2c8c108b8c73aa9459b63f0dbd66b60f6 | e6b213ee3ffb05f067d30cb8bb45681887212444 |
python/cpython | python__cpython-118368 | # Broken `bdb.Bdb.user_call` API
# Bug report
### Bug description:
This is an issue with how `bdb.Bdb.user_call` is documented.
According to the [`bdb` documentation](https://docs.python.org/3/library/bdb.html#bdb.Bdb.user_call), `bdb.BdB.user_call` has two arguments, `frame` and `argument_list`.
This is implemented in the `bdb` library [here](https://github.com/python/cpython/blob/3.12/Lib/bdb.py#L118).
However, according to the [`sys` documentation](https://docs.python.org/3/library/sys.html#sys.settrace), `sys.settrace` will always set the `arg` to `None` and the code above acknowledges that _"# XXX 'arg' is no longer used"_.
I don't know if this is based on a previous version that would give the call arguments, but I think we should change the signature of `bdb.Bdb.user_call` to exclude the `argument_list` parameter or state in the documentation that it will be `None`.
### CPython versions tested on:
3.12
### Operating systems tested on:
Linux
<!-- gh-linked-prs -->
### Linked PRs
* gh-118368
* gh-118410
<!-- /gh-linked-prs -->
| 8e4fb5d260e529c9d4ca60980225fbd00dd5c3c8 | 96d8ca7ad6c4f23f023dd6ed0abd042b29dff4a2 |
python/cpython | python__cpython-118354 | # ``test_capi`` surprisingly skipped on Windows
# Bug report
### Bug description:
```
>python -m test test_capi
Running Debug|x64 interpreter...
Using random seed: 1337652706
0:00:00 Run 1 test sequentially
0:00:00 [1/1] test_capi
test_capi skipped -- requires test module
test_capi skipped
== Tests result: SUCCESS ==
1 test skipped:
test_capi
```
The test modules are in a build directory.
I can see the default behavior change since ea94b3b149eeadf33c2f7c46f16dcda0adc7cf4e.
cc @erlend-aasland @zooba
### CPython versions tested on:
3.13, CPython main branch
### Operating systems tested on:
Windows
<!-- gh-linked-prs -->
### Linked PRs
* gh-118354
<!-- /gh-linked-prs -->
| 51c70de998ead35674bf4b2b236e9ce8e89d17b4 | 44f57a952ea1c25699f19c6cf1fa47cd300e33aa |
python/cpython | python__cpython-118386 | # Python 3.12.3 installer fails to install py.exe
# Bug report
### Bug description:
I use Python with MkDocs and had needed to update my environment on a Windows 10 machine that only had Python 3.7. I installed version 3.12.3 since it is the latest stable at the time. I used all the default settings. Afterwards, I ran `py --version` and `py --list` and it does not show the latest installation. I thought I must have missed something so I uninstalled 3.12.3 and reinstalled, being careful that the box to install `py.exe` is checked. The installer does not ask for admin permissions. I can run 3.12.3 in its shell via the ***Start*** menu, but it is not known to `py.exe` and the `C:\Winddows\py.exe` executable file has a really old date. I then installed Python 3.9.2 because that is consistent with a Linux environment that I use on another machine. Installing with the default settings, the installer askes for admin permissions and `py.exe` shows the `3.9-64` version and has a newer date consistent with the installer. **It seems to me that the 3.12.3 installer is not handling the `py.exe` installation correctly.** I see some other issues related to the installer but not this specific issue, as far as I can tell.
### CPython versions tested on:
3.9, 3.12
### Operating systems tested on:
Windows
<!-- gh-linked-prs -->
### Linked PRs
* gh-118386
* gh-118409
<!-- /gh-linked-prs -->
| 96d8ca7ad6c4f23f023dd6ed0abd042b29dff4a2 | 2ba1aed596ff9e7c5e193cf990f1f20f08bbf116 |
python/cpython | python__cpython-118339 | # Configure Tier 2 interpreter at build time
It would be nice if by default we didn't ship the optimizer infrastructure, since approximately nobody is going to use it, so we should ship (and by default build) binaries that just don't include it.
I propose to enable it only when configured with `--enable-experimental-jit-interpreter`. We drop support for `PYTHON_UOPS` and `-Xuops`, in favor of `PYTHON_JIT=0|1`.
@mdboom this will have some consequences for the benchmarking infra; checking the `Tier 2` box should use this configure option rather than setting the `PYTHON_UOPS=1` env var. It should be possible to use both (`./configure` gives a warning but otherwise seems to ignore incorrect flags, and the env var will just be ignored).
<!-- gh-linked-prs -->
### Linked PRs
* gh-118339
* gh-118493
* gh-118497
<!-- /gh-linked-prs -->
| a524152b8c56f82d807ecdd7ae9d39cfd643c469 | 97feb4a78bf1ebdec26b685fd509cf57b3333e4a |
python/cpython | python__cpython-118412 | # Deadlock in `test_multiprocessing_pool_circular_import` in free-threaded build
# Bug report
I've observed an occasional deadlock involving the [warnings mutex](https://github.com/python/cpython/blob/5a90de0d4cbc151a6deea36a27eb81b192410e56/Include/internal/pycore_warnings.h#L17) in `test_multiprocessing_pool_circular_import`. That test runs the following program, which involves both threads and multiprocessing.
https://github.com/python/cpython/blob/5a90de0d4cbc151a6deea36a27eb81b192410e56/Lib/test/test_importlib/partial/pool_in_threads.py#L1-L27
### Backtraces
There is a deadlock between thread 2 and thread 5:
<details>
<summary>Thread 2 (stopping the world, waiting for warning lock via critical section resume)</summary>
```
[Switching to thread 2 (Thread 0x7f334c1d7640 (LWP 3070381))]
...
#6 0x000055fe4af3ec9d in _PySemaphore_PlatformWait (sema=sema@entry=0x7f334c1d5070, timeout=timeout@entry=-1) at Python/parking_lot.c:137
#7 0x000055fe4af3edd3 in _PySemaphore_Wait (sema=sema@entry=0x7f334c1d5070, timeout=timeout@entry=-1, detach=detach@entry=1) at Python/parking_lot.c:206
#8 0x000055fe4af3ef5c in _PyParkingLot_Park (addr=addr@entry=0x55fe4b29a338 <_PyRuntime+123768>, expected=expected@entry=0x7f334c1d510f, size=size@entry=1, timeout_ns=timeout_ns@entry=-1, park_arg=park_arg@entry=0x7f334c1d5110, detach=detach@entry=1) at Python/parking_lot.c:309
#9 0x000055fe4af2bed9 in _PyMutex_LockTimed (m=m@entry=0x55fe4b29a338 <_PyRuntime+123768>, timeout=timeout@entry=-1, flags=flags@entry=_PY_LOCK_DETACH) at Python/lock.c:110
#10 0x000055fe4af2bfd9 in _PyMutex_LockSlow (m=m@entry=0x55fe4b29a338 <_PyRuntime+123768>) at Python/lock.c:53
#11 0x000055fe4aee8e1a in PyMutex_Lock (m=0x55fe4b29a338 <_PyRuntime+123768>) at ./Include/internal/pycore_lock.h:75
#12 _PyCriticalSection_Resume (tstate=tstate@entry=0x55fe4b8e82b0) at Python/critical_section.c:88
#13 0x000055fe4af543ac in _PyThreadState_Attach (tstate=tstate@entry=0x55fe4b8e82b0) at Python/pystate.c:2062
#14 0x000055fe4af07e84 in PyEval_AcquireThread (tstate=tstate@entry=0x55fe4b8e82b0) at Python/ceval_gil.c:568
#15 0x000055fe4af3ede2 in _PySemaphore_Wait (sema=sema@entry=0x7f334c1d5260, timeout=timeout@entry=1000000, detach=detach@entry=1) at Python/parking_lot.c:208
#16 0x000055fe4af3ef5c in _PyParkingLot_Park (addr=addr@entry=0x55fe4b29a36c <_PyRuntime+123820>, expected=expected@entry=0x7f334c1d52e7, size=size@entry=1, timeout_ns=1000000, park_arg=park_arg@entry=0x0, detach=detach@entry=1) at Python/parking_lot.c:309
#17 0x000055fe4af2c1ee in PyEvent_WaitTimed (evt=evt@entry=0x55fe4b29a36c <_PyRuntime+123820>, timeout_ns=timeout_ns@entry=1000000) at Python/lock.c:300
#18 0x000055fe4af54aa5 in stop_the_world (stw=stw@entry=0x55fe4b29a368 <_PyRuntime+123816>) at Python/pystate.c:2230
#19 0x000055fe4af54b66 in _PyEval_StopTheWorld (interp=interp@entry=0x55fe4b299280 <_PyRuntime+119488>) at Python/pystate.c:2292
#20 0x000055fe4aefec20 in gc_collect_internal (interp=0x55fe4b299280 <_PyRuntime+119488>, state=state@entry=0x7f334c1d5390) at Python/gc_free_threading.c:1079
#21 0x000055fe4aefeecb in gc_collect_main (tstate=tstate@entry=0x55fe4b8e82b0, generation=generation@entry=0, reason=reason@entry=_Py_GC_REASON_HEAP) at Python/gc_free_threading.c:1174
#22 0x000055fe4aeff189 in _Py_RunGC (tstate=tstate@entry=0x55fe4b8e82b0) at Python/gc_free_threading.c:1631
#23 0x000055fe4af08627 in _Py_HandlePending (tstate=tstate@entry=0x55fe4b8e82b0) at Python/ceval_gil.c:1113
...
```
</details>
<details>
<summary>Thread 5 (holds warning lock via handoff, waiting for stop-the-world)</summary>
```
[Switching to thread 5 (Thread 0x7f334a9ca640 (LWP 3070385))]
...
#6 0x000055fe4af3ec9d in _PySemaphore_PlatformWait (sema=sema@entry=0x7f334a9c8b20, timeout=timeout@entry=-1) at Python/parking_lot.c:137
#7 0x000055fe4af3edd3 in _PySemaphore_Wait (sema=sema@entry=0x7f334a9c8b20, timeout=timeout@entry=-1, detach=detach@entry=0) at Python/parking_lot.c:206
#8 0x000055fe4af3ef5c in _PyParkingLot_Park (addr=addr@entry=0x55fe4b8f6fd8, expected=expected@entry=0x7f334a9c8ba4, size=size@entry=4, timeout_ns=timeout_ns@entry=-1, park_arg=park_arg@entry=0x0, detach=detach@entry=0) at Python/parking_lot.c:309
#9 0x000055fe4af5217f in tstate_wait_attach (tstate=tstate@entry=0x55fe4b8f6fb0) at Python/pystate.c:2024
#10 0x000055fe4af5439f in _PyThreadState_Attach (tstate=tstate@entry=0x55fe4b8f6fb0) at Python/pystate.c:2052
#11 0x000055fe4af07e84 in PyEval_AcquireThread (tstate=tstate@entry=0x55fe4b8f6fb0) at Python/ceval_gil.c:568
#12 0x000055fe4af3ede2 in _PySemaphore_Wait (sema=sema@entry=0x7f334a9c8c70, timeout=timeout@entry=-1, detach=detach@entry=1) at Python/parking_lot.c:208
#13 0x000055fe4af3ef5c in _PyParkingLot_Park (addr=addr@entry=0x55fe4b29a338 <_PyRuntime+123768>, expected=expected@entry=0x7f334a9c8d0f, size=size@entry=1, timeout_ns=timeout_ns@entry=-1, park_arg=park_arg@entry=0x7f334a9c8d10, detach=detach@entry=1) at Python/parking_lot.c:309
#14 0x000055fe4af2bed9 in _PyMutex_LockTimed (m=m@entry=0x55fe4b29a338 <_PyRuntime+123768>, timeout=timeout@entry=-1, flags=flags@entry=_PY_LOCK_DETACH) at Python/lock.c:110
#15 0x000055fe4af2bfd9 in _PyMutex_LockSlow (m=m@entry=0x55fe4b29a338 <_PyRuntime+123768>) at Python/lock.c:53
#16 0x000055fe4aee8c1e in _PyCriticalSection_BeginSlow (c=c@entry=0x7f334a9c8dd0, m=0x55fe4b29a338 <_PyRuntime+123768>) at Python/critical_section.c:17
#17 0x000055fe4ae48aa3 in _PyCriticalSection_Begin (m=<optimized out>, c=0x7f334a9c8dd0) at ./Include/internal/pycore_critical_section.h:201
#18 do_warn (message='This process (pid=3070187) is multi-threaded, use of fork() may lead to deadlocks in the child.', category=<type at remote 0x55fe4b2451e0>, stack_level=1, source=0x0, skip_file_prefixes=skip_file_prefixes@entry=0x0) at Python/_warnings.c:1002
#19 0x000055fe4ae48c00 in warn_unicode (category=<optimized out>, category@entry=<type at remote 0x55fe4b2451e0>, message=message@entry='This process (pid=3070187) is multi-threaded, use of fork() may lead to deadlocks in the child.', stack_level=stack_level@entry=1, source=source@entry=0x0) at Python/_warnings.c:1203
#20 0x000055fe4ae48cbe in _PyErr_WarnFormatV (source=source@entry=0x0, category=<type at remote 0x55fe4b2451e0>, stack_level=stack_level@entry=1, format=format@entry=0x55fe4b0df438 "This process (pid=%d) is multi-threaded, use of %s() may lead to deadlocks in the child.", vargs=vargs@entry=0x7f334a9c8e80) at Python/_warnings.c:1223
#21 0x000055fe4ae49904 in PyErr_WarnFormat (category=<optimized out>, stack_level=stack_level@entry=1, format=format@entry=0x55fe4b0df438 "This process (pid=%d) is multi-threaded, use of %s() may lead to deadlocks in the child.") at Python/_warnings.c:1236
#22 0x000055fe4af9ba89 in warn_about_fork_with_threads (name=name@entry=0x55fe4b0dd837 "fork") at ./Modules/posixmodule.c:7893
#23 0x000055fe4afa481c in os_fork_impl (module=<optimized out>) at ./Modules/posixmodule.c:7993
#24 0x000055fe4afa483d in os_fork (module=<optimized out>, _unused_ignored=<optimized out>) at ./Modules/clinic/posixmodule.c.h:4069
```
</details>
### Explanation
There are two subtle things leading to the deadlock:
1) Thread 2 is waiting for other threads to stop themselves using a [`PyEvent_WaitTimed`](https://github.com/python/cpython/blob/5a90de0d4cbc151a6deea36a27eb81b192410e56/Python/pystate.c#L2230) call, which temporarily detaches and then re-attaches the thread state. In the process of re-attaching, the PyThreadState resumes the top most critical section, which in this case is trying to re-acquire the warnings mutex. (That's a bit weird!)
2) Thread 5 holds the warning mutex. Normally, threads suspend their critical sections detaching but in this case the lock was handed off directly from some other thread to thread 5 [^1]. Thread 5 didn't process that yet, so it doesn't "know" that it holds the mutex.
### Possible fixes:
1) Don't detach when calling `PyEvent_WaitTimed()` in the stop-the-world. Basically, add a variant of `PyEvent_WaitTimed` that accepts `_Py_LOCK_DONT_DETACH` so we never suspend/resume the critical section in the thread performing the stop the world.
2) Insert a dummy critical section in `stop_the_world` (and remove it in `start_the_world`). The thread can still detach, but when it re-attaches it doesn't try to resume any critical sections (until it's done performing the stop-the-world).
3) Avoid handing off locks directly. I'm pretty sure we want to keep supporting handoff, but I listed it here because I think it would also avoid the deadlock.
Both (1) and (2) seem reasonable to me. I'm not sure which is better.
[^1]: `PyMutex` implements stochastic fairness. Basically, after waiting for a while, locks are handed off directly to the next waiter in line without unlocking the mutex so that eventually everyone gets a turn.
<!-- gh-linked-prs -->
### Linked PRs
* gh-118412
<!-- /gh-linked-prs -->
| b2c3b70c7102197e4505e6cd69722dc508527d22 | 4a1cf66c5c0afa36d7a51d5f9d3874cda10df79c |
python/cpython | python__cpython-118334 | # test_repl's test_no_memory: AssertionError: -6 not found in (1, 120)
# Bug report
### Bug description:
One of my PRs (https://github.com/python/cpython/pull/118283) started failing (https://github.com/python/cpython/actions/runs/8843882336?pr=118283) with this. Investigating, I can reproduce it locally on `main`, although I don't know why the CI passes on `main`.
OS: macOS Sonoma 14.4.1, M2.
## To reproduce
```sh
git clone https://github.com/python/cpython
cd cpython
./configure --with-pydebug && make -j10
./python.exe Lib/test/test_repl.py
```
## Actual result
```pytb
.....F.
======================================================================
FAIL: test_no_memory (__main__.TestInteractiveInterpreter.test_no_memory)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/private/tmp/cpython/Lib/test/test_repl.py", line 86, in test_no_memory
self.assertIn(p.returncode, (1, 120))
~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: -6 not found in (1, 120)
```
Printing `output` from the test:
```
Python 3.13.0a5+ (bisect/good-e16062dd3428a5846344e0a8c6ee2f352d34ce1b-1-gdf73179048:df73179048, A) [Clang 15.0.0 (clang-1500.3.9.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> >>> >>> Traceback (most recent call last):
File "<stdin>", line 1, in <module>
1/0
~^~
ZeroDivisionError: division by zero
>>> After the exception.
>>> object address : 0x102f8b9a0
object refcount : 3
object type : 0x102b831a8
object type name: MemoryError
object repr :
lost sys.stderr
object address : 0x102f8b930
object refcount : 3
object type : 0x102b831a8
object type name: MemoryError
object repr :
lost sys.stderr
object address : 0x102f8b9a0
object refcount : 3
object type : 0x102b831a8
object type name: MemoryError
object repr :
lost sys.stderr
object address : 0x102f8b930
object refcount : 3
object type : 0x102b831a8
object type name: MemoryError
object repr :
lost sys.stderr
object address : 0x102f8b9a0
object refcount : 3
object type : 0x102b831a8
object type name: MemoryError
object repr :
lost sys.stderr
object address : 0x102f8b930
object refcount : 3
object type : 0x102b831a8
object type name: MemoryError
object repr :
lost sys.stderr
object address : 0x102f8b9a0
object refcount : 3
object type : 0x102b831a8
object type name: MemoryError
object repr :
lost sys.stderr
object address : 0x102f8b930
object refcount : 3
object type : 0x102b831a8
object type name: MemoryError
object repr :
lost sys.stderr
object address : 0x102f8b9a0
object refcount : 3
object type : 0x102b831a8
object type name: MemoryError
object repr :
lost sys.stderr
object address : 0x102f8b930
object refcount : 3
object type : 0x102b831a8
object type name: MemoryError
object repr :
lost sys.stderr
object address : 0x102f8b9a0
object refcount : 3
object type : 0x102b831a8
object type name: MemoryError
object repr :
lost sys.stderr
object address : 0x102f8b930
object refcount : 3
object type : 0x102b831a8
object type name: MemoryError
object repr :
lost sys.stderr
object address : 0x102f8b9a0
object refcount : 3
object type : 0x102b831a8
object type name: MemoryError
object repr :
lost sys.stderr
object address : 0x102f8b930
object refcount : 3
object type : 0x102b831a8
object type name: MemoryError
object repr :
lost sys.stderr
object address : 0x102f8b9a0
object refcount : 3
object type : 0x102b831a8
object type name: MemoryError
object repr :
lost sys.stderr
object address : 0x102f8b930
object refcount : 3
object type : 0x102b831a8
object type name: MemoryError
object repr :
lost sys.stderr
Fatal Python error: _Py_Dealloc: Deallocator of type '_thread._localdummy' raised an exception
Python runtime state: finalizing (tstate=0x0000000102bf3c40)
Current thread 0x0000000201f77ac0 (most recent call first):
<no Python frame>
```
## Expected result
It passes with `v3.13.0a5`, where `output` is:
```
Python 3.13.0a5 (tags/v3.13.0a5:076d169ebb, Apr 26 2024, 22:13:38) [Clang 15.0.0 (clang-1500.3.9.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> >>> >>> Traceback (most recent call last):
File "<stdin>", line 1, in <module>
1/0
~^~
ZeroDivisionError: division by zero
>>> After the exception.
>>> object address : 0x100f63a10
object refcount : 3
object type : 0x100b5f1a8
object type name: MemoryError
object repr :
lost sys.stderr
object address : 0x100f639a0
object refcount : 3
object type : 0x100b5f1a8
object type name: MemoryError
object repr :
lost sys.stderr
object address : 0x100f63a10
object refcount : 3
object type : 0x100b5f1a8
object type name: MemoryError
object repr :
lost sys.stderr
object address : 0x100f639a0
object refcount : 3
object type : 0x100b5f1a8
object type name: MemoryError
object repr :
lost sys.stderr
object address : 0x100f63a10
object refcount : 3
object type : 0x100b5f1a8
object type name: MemoryError
object repr :
lost sys.stderr
object address : 0x100f639a0
object refcount : 3
object type : 0x100b5f1a8
object type name: MemoryError
object repr :
lost sys.stderr
object address : 0x100f63a10
object refcount : 3
object type : 0x100b5f1a8
object type name: MemoryError
object repr :
lost sys.stderr
object address : 0x100f639a0
object refcount : 3
object type : 0x100b5f1a8
object type name: MemoryError
object repr :
lost sys.stderr
object address : 0x100f63a10
object refcount : 3
object type : 0x100b5f1a8
object type name: MemoryError
object repr :
lost sys.stderr
object address : 0x100f639a0
object refcount : 3
object type : 0x100b5f1a8
object type name: MemoryError
object repr :
lost sys.stderr
object address : 0x100f63a10
object refcount : 3
object type : 0x100b5f1a8
object type name: MemoryError
object repr :
lost sys.stderr
object address : 0x100f639a0
object refcount : 3
object type : 0x100b5f1a8
object type name: MemoryError
object repr :
lost sys.stderr
object address : 0x100f63a10
object refcount : 3
object type : 0x100b5f1a8
object type name: MemoryError
object repr :
lost sys.stderr
object address : 0x100f639a0
object refcount : 3
object type : 0x100b5f1a8
object type name: MemoryError
object repr :
lost sys.stderr
object address : 0x100f63a10
object refcount : 3
object type : 0x100b5f1a8
object type name: MemoryError
object repr :
lost sys.stderr
object address : 0x100f639a0
object refcount : 3
object type : 0x100b5f1a8
object type name: MemoryError
object repr :
lost sys.stderr
```
The main difference is the failure includes this:
```
Fatal Python error: _Py_Dealloc: Deallocator of type '_thread._localdummy' raised an exception
Python runtime state: finalizing (tstate=0x0000000102bf3c40)
Current thread 0x0000000201f77ac0 (most recent call first):
<no Python frame>
```
## Bisecting
```
df7317904849a41d51db39d92c5d431a18e22637 is the first bad commit
commit df7317904849a41d51db39d92c5d431a18e22637
Author: mpage <mpage@meta.com>
Date: Mon Apr 8 07:58:38 2024 -0700
gh-111926: Make weakrefs thread-safe in free-threaded builds (#117168)
Most mutable data is protected by a striped lock that is keyed on the
referenced object's address. The weakref's hash is protected using the
weakref's per-object lock.
Note that this only affects free-threaded builds. Apart from some minor
refactoring, the added code is all either gated by `ifdef`s or is a no-op
(e.g. `Py_BEGIN_CRITICAL_SECTION`).
Include/cpython/weakrefobject.h | 8 +
Include/internal/pycore_interp.h | 7 +
Include/internal/pycore_object.h | 40 +-
Include/internal/pycore_pyatomic_ft_wrappers.h | 5 +
Include/internal/pycore_weakref.h | 73 +++-
Lib/test/test_sys.py | 8 +-
Lib/test/test_weakref.py | 19 +
Modules/_sqlite/blob.c | 5 +-
Modules/_sqlite/connection.c | 4 +-
Modules/_ssl.c | 13 +-
Modules/_ssl/debughelpers.c | 6 +-
Modules/_weakref.c | 42 +-
Modules/clinic/_weakref.c.h | 20 +-
Objects/dictobject.c | 8 +-
Objects/typeobject.c | 12 +-
Objects/weakrefobject.c | 537 ++++++++++++++-----------
Python/pystate.c | 9 +
17 files changed, 490 insertions(+), 326 deletions(-)
bisect found first bad commit
```
PR: https://github.com/python/cpython/pull/117168
Issue: https://github.com/python/cpython/pull/111926
The PR was merged three weeks ago and the CI is passing.
---
On my PR (https://github.com/python/cpython/actions/runs/8843882336?pr=118283), free-threaded builds pass, but regular ones fail. Ubuntu and macOS fail with:
```pytb
AssertionError: -6 not found in (1, 120)
```
Windows with:
```pytb
AssertionError: 3221225477 not found in (1, 120)
```
3221225477 seems to be 0xc0000005 `STATUS_ACCESS_VIOLATION`.
### CPython versions tested on:
3.13
### Operating systems tested on:
macOS
<!-- gh-linked-prs -->
### Linked PRs
* gh-118334
* gh-118338
* gh-130811
* gh-130921
<!-- /gh-linked-prs -->
| 79688b5b0ea761183193ffb0859415f3b02fa44d | ee3413c1c70725e133b29bb1d245f569a8f64062 |
python/cpython | python__cpython-118324 | # Document `&&` eager parsing in `python.gram`
Right now it is not documented: https://github.com/python/cpython/blob/5a4d3df2fa02409ffd2a90cd75b67370206e9891/Grammar/python.gram#L45-L81
<!-- gh-linked-prs -->
### Linked PRs
* gh-118324
<!-- /gh-linked-prs -->
| 51aefc5bf907ddffaaf083ded0de773adcdf08c8 | c57326f48729f5cd7ddf7e2b38c4fd06d0962a41 |
python/cpython | python__cpython-118320 | # binascii.a2b_base64 strict mode accepts invalid base64 input
# Bug report
### Bug description:
```python
>>> import binascii
>>> f = lambda s: binascii.a2b_base64(s, strict_mode=True)
>>> f('AAAA')
b'\x00\x00\x00'
>>> f('AAAA=')
b'\x00\x00\x00'
>>> f('AAAA==')
b'\x00\x00\x00'
>>> f('AAAA===')
b'\x00\x00\x00'
>>> f('AAAA====')
b'\x00\x00\x00'
>>> f('AAAA=====')
b'\x00\x00\x00'
```
[Doc/library/binascii.rst](https://docs.python.org/3/library/binascii.html#module-binascii) defines that a valid base64 "Contains no excess data after padding (including excess padding, newlines, etc.)". However, current implement does not handle the edge case of excess padding after no padding.
### CPython versions tested on:
3.12
### Operating systems tested on:
macOS
<!-- gh-linked-prs -->
### Linked PRs
* gh-118320
* gh-118691
<!-- /gh-linked-prs -->
| fe47d9bee319528ffeb5fd60a615d7f02c7b5585 | 3a6ff1b1d959549546f533b18ec71aa21516328d |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.