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-122017 | # test_sysconfig.test_user_similar fails on --disable-gil --with-platlibdir=lib64
# Bug report
### Bug description:
```
$ /configure --config-cache --without-ensurepip --with-pydebug --disable-gil --with-platlibdir=lib64 && make
...
$ ./python -m test test_sysconfig
Using random seed: 1721645515
0:00:00 load avg: 1.40 Run 1 test sequentially in a single process
0:00:00 load avg: 1.40 [1/1] test_sysconfig
test test_sysconfig failed -- Traceback (most recent call last):
File ".../cpython/Lib/test/test_sysconfig.py", line 424, in test_user_similar
self.assertEqual(user_path, expected)
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
AssertionError: '/home/.../.local/lib/python3.14t/site-packages' != '/home/.../.local/lib64/python3.14t/site-packages'
- /home/.../.local/lib/python3.14t/site-packages
+ /home/.../.local/lib64/python3.14t/site-packages
? ++
test_sysconfig failed (1 failure)
== Tests result: FAILURE ==
1 test failed:
test_sysconfig
Total duration: 248 ms
Total tests: run=27 failures=1 skipped=3
Total test files: run=1/1 failed=1
Result: FAILURE
```
### CPython versions tested on:
3.13, CPython main branch
### Operating systems tested on:
Linux
<!-- gh-linked-prs -->
### Linked PRs
* gh-122017
* gh-122039
<!-- /gh-linked-prs -->
| 186b4d8ea2fdc91bf18e8be695244ead1722af18 | d66b06107b0104af513f664d9a5763216639018b |
python/cpython | python__cpython-122002 | # Fully implement PEP 706: Change default filter for TarFile.extract() and extractall() to 'data'
# Feature or enhancement
### Proposal:
The documentation for tarfile discusses changes to the default behavior in 3.14 as a future change, but now that 3.14 is in development this change should be implemented and references to the change should reflect that the default behavior is now implemented.
- [x] Change default behavior in tarfile.py
- [x] Remove deprecation warning when using None
- [x] Update tests to reflect new default behavior
- [x] Update tarfile documentation to reflect that the change has been implemented
- [x] Update shutil
- [x] Update shutil tests
- [x] Add test to ensure default filter is set to 'data'
### Has this already been discussed elsewhere?
No response given
### Links to previous discussion of this feature:
https://peps.python.org/pep-0706/#defaults-and-their-configuration
> If both the argument and attribute are None:
> - In Python 3.12-3.13, a DeprecationWarning will be emitted and extraction will use the 'fully_trusted' filter.
> - In Python 3.14+, it will use the 'data' filter.
https://docs.python.org/3.14/library/tarfile.html#extraction-filters
> None (default): Use [TarFile.extraction_filter](https://docs.python.org/3.14/library/tarfile.html#tarfile.TarFile.extraction_filter).
>
> If that is also None (the default), raise a DeprecationWarning, and fall back to the 'fully_trusted' filter, whose dangerous behavior matches previous versions of Python.
>
> In Python 3.14, the 'data' filter will become the default instead. It’s possible to switch earlier; see [TarFile.extraction_filter](https://docs.python.org/3.14/library/tarfile.html#tarfile.TarFile.extraction_filter).
<!-- gh-linked-prs -->
### Linked PRs
* gh-122002
<!-- /gh-linked-prs -->
| dcafb362f7eab84710ad924cac1724bbf3b9c304 | bc94cf7e254e43318223553a7959115573c679a5 |
python/cpython | python__cpython-121990 | # `test_pyrepl` is taking 1 hour on refleaks buildbots
Looks like it started with ac07451116d52dd6a5545d27b6a2e3737ed27cf0 (cc @AlexWaygood).
https://buildbot.python.org/#/builders/259/builds/1189
https://buildbot.python.org/#/builders/1226/builds/2261
The last time this occurred (https://github.com/python/cpython/issues/121605) was because:
1) The refleaks buildbots run with a really long value for `SHORT_TIMEOUT`
2) `run_repl` was hanging until the timeout expired
<!-- gh-linked-prs -->
### Linked PRs
* gh-121990
* gh-122064
<!-- /gh-linked-prs -->
| a09e215abf3c80a3c99c86b4482b512b42aad072 | b7ad711fcb37dd001e6bf8466c9503eef6d20331 |
python/cpython | python__cpython-121983 | # csv module: Missing test case for an invalid quoting value
# Bug report
### Bug description:
This branch is currently not covered by the tests:
https://github.com/python/cpython/blob/12c1afa9d153fbdf78c970054c08c755f504c5e9/Modules/_csv.c#L330-L331
We should add a test case for it. I can send a PR shortly ;)
### CPython versions tested on:
CPython main branch
### Operating systems tested on:
Linux
<!-- gh-linked-prs -->
### Linked PRs
* gh-121983
* gh-124925
* gh-124926
<!-- /gh-linked-prs -->
| 656b7a3c83c79f99beac950b59c47575562ea729 | c066bf553577d1000e208eb078d9e758c3e41186 |
python/cpython | python__cpython-122075 | # `statistics.mode` fails for unhashable data
# Bug report
### Bug description:
`statistics.mode` uses `collections.Counter` so only works for data that are hashable
```python
from statistics import mode
mode([{1,2},{1,2},{3}])
```
raises`TypeError: unhashable type: 'set'`
Same issue with `multimode`.
This limitation is not mentioned in the docs or the docstring.
Potential solutions:
1. Add the fact that the function doesn't work on unhashable types to the documentation, and raise a `StatisticsError` if the user provides unhashable data
2. Come up with a separate algorithm for handling unhashable data. Would be interested to hear ideas on the appropriate algorithm.
### CPython versions tested on:
CPython main branch
### Operating systems tested on:
Windows
<!-- gh-linked-prs -->
### Linked PRs
* gh-122075
* gh-122076
* gh-122077
<!-- /gh-linked-prs -->
| ebc18abbf34ff248764bda1a02db7f1c783b71e3 | c4c7097e64b0c9cb0081de8872b90594865c892b |
python/cpython | python__cpython-122140 | # test_pyrepl: test_inspect_keeps_globals_from_inspected_* are very flaky
# Bug report
### Bug description:
When running the test suite on Gentoo Linux amd64 (with all CPUs busy), these tests are failing frequently:
<details>
```pytb
$ LD_LIBRARY_PATH=. ./python -u -W default -bb -E -m test --fast-ci --timeout= --dont-add-python-opts test_pyrepl
Using random seed: 1056915174
0:00:00 load avg: 14.22 Run 1 test in parallel using 1 worker process (timeout: 10 min, worker timeout: 15 min)
0:00:01 load avg: 14.21 [1/1/1] test_pyrepl failed (3 failures)
test_empty (test.test_pyrepl.test_input.KeymapTranslatorTests.test_empty) ... ok
test_push_character_key (test.test_pyrepl.test_input.KeymapTranslatorTests.test_push_character_key) ... ok
test_push_character_key_with_stack (test.test_pyrepl.test_input.KeymapTranslatorTests.test_push_character_key_with_stack) ... ok
test_push_invalid_key (test.test_pyrepl.test_input.KeymapTranslatorTests.test_push_invalid_key) ... ok
test_push_invalid_key_with_stack (test.test_pyrepl.test_input.KeymapTranslatorTests.test_push_invalid_key_with_stack) ... ok
test_push_invalid_key_with_unicode_category (test.test_pyrepl.test_input.KeymapTranslatorTests.test_push_invalid_key_with_unicode_category) ... ok
test_push_multiple_keys (test.test_pyrepl.test_input.KeymapTranslatorTests.test_push_multiple_keys) ... ok
test_push_single_key (test.test_pyrepl.test_input.KeymapTranslatorTests.test_push_single_key) ... ok
test_push_transition_key (test.test_pyrepl.test_input.KeymapTranslatorTests.test_push_transition_key) ... ok
test_push_transition_key_interrupted (test.test_pyrepl.test_input.KeymapTranslatorTests.test_push_transition_key_interrupted) ... ok
test_empty_line (test.test_pyrepl.test_interact.TestMoreLines.test_empty_line) ... ok
test_incomplete_statement (test.test_pyrepl.test_interact.TestMoreLines.test_incomplete_statement) ... ok
test_invalid_syntax_single_line (test.test_pyrepl.test_interact.TestMoreLines.test_invalid_syntax_single_line) ... ok
test_multiline_single_assignment (test.test_pyrepl.test_interact.TestMoreLines.test_multiline_single_assignment) ... ok
test_multiline_single_block (test.test_pyrepl.test_interact.TestMoreLines.test_multiline_single_block) ... ok
test_multiple_blocks (test.test_pyrepl.test_interact.TestMoreLines.test_multiple_blocks) ... ok
test_multiple_blocks_empty_newline (test.test_pyrepl.test_interact.TestMoreLines.test_multiple_blocks_empty_newline) ... ok
test_multiple_blocks_indented_newline (test.test_pyrepl.test_interact.TestMoreLines.test_multiple_blocks_indented_newline) ... ok
test_multiple_statements (test.test_pyrepl.test_interact.TestMoreLines.test_multiple_statements) ... ok
test_multiple_statements_single_line (test.test_pyrepl.test_interact.TestMoreLines.test_multiple_statements_single_line) ... ok
test_valid_single_statement (test.test_pyrepl.test_interact.TestMoreLines.test_valid_single_statement) ... ok
test_empty (test.test_pyrepl.test_interact.TestSimpleInteract.test_empty) ... ok
test_multiple_statements (test.test_pyrepl.test_interact.TestSimpleInteract.test_multiple_statements) ... ok
test_multiple_statements_output (test.test_pyrepl.test_interact.TestSimpleInteract.test_multiple_statements_output) ... ok
test_no_active_future (test.test_pyrepl.test_interact.TestSimpleInteract.test_no_active_future) ... ok
test_runsource_compiles_and_runs_code (test.test_pyrepl.test_interact.TestSimpleInteract.test_runsource_compiles_and_runs_code) ... ok
test_runsource_returns_false_for_failed_compilation (test.test_pyrepl.test_interact.TestSimpleInteract.test_runsource_returns_false_for_failed_compilation) ... ok
test_runsource_returns_false_for_successful_compilation (test.test_pyrepl.test_interact.TestSimpleInteract.test_runsource_returns_false_for_successful_compilation) ... ok
test_runsource_shows_syntax_error_for_failed_compilation (test.test_pyrepl.test_interact.TestSimpleInteract.test_runsource_shows_syntax_error_for_failed_compilation) ... ok
test_clashing_definitions (test.test_pyrepl.test_keymap.TestCompileKeymap.test_clashing_definitions) ... ok
test_empty_keymap (test.test_pyrepl.test_keymap.TestCompileKeymap.test_empty_keymap) ... ok
test_empty_value (test.test_pyrepl.test_keymap.TestCompileKeymap.test_empty_value) ... ok
test_multiple_empty_values (test.test_pyrepl.test_keymap.TestCompileKeymap.test_multiple_empty_values) ... ok
test_multiple_keymaps (test.test_pyrepl.test_keymap.TestCompileKeymap.test_multiple_keymaps) ... ok
test_nested_keymap (test.test_pyrepl.test_keymap.TestCompileKeymap.test_nested_keymap) ... ok
test_nested_multiple_keymaps (test.test_pyrepl.test_keymap.TestCompileKeymap.test_nested_multiple_keymaps) ... ok
test_non_bytes_key (test.test_pyrepl.test_keymap.TestCompileKeymap.test_non_bytes_key) ... ok
test_single_keymap (test.test_pyrepl.test_keymap.TestCompileKeymap.test_single_keymap) ... ok
test_combinations (test.test_pyrepl.test_keymap.TestParseKeys.test_combinations) ... ok
test_control_sequences (test.test_pyrepl.test_keymap.TestParseKeys.test_control_sequences)
Ensure that supported control sequences are parsed successfully. ... ok
test_escape_sequences (test.test_pyrepl.test_keymap.TestParseKeys.test_escape_sequences)
Ensure that escaping sequences are parsed to their corresponding mapping. ... ok
test_index_errors (test.test_pyrepl.test_keymap.TestParseKeys.test_index_errors) ... ok
test_keynames (test.test_pyrepl.test_keymap.TestParseKeys.test_keynames)
Ensure that keynames are parsed to their corresponding mapping. ... ok
test_keyspec_errors (test.test_pyrepl.test_keymap.TestParseKeys.test_keyspec_errors) ... ok
test_meta_sequences (test.test_pyrepl.test_keymap.TestParseKeys.test_meta_sequences) ... ok
test_single_character (test.test_pyrepl.test_keymap.TestParseKeys.test_single_character)
Ensure that single ascii characters or single digits are parsed as single characters. ... ok
test_cursor_position_after_wrap_and_move_up (test.test_pyrepl.test_pyrepl.TestCursorPosition.test_cursor_position_after_wrap_and_move_up) ... ok
test_cursor_position_double_width_character (test.test_pyrepl.test_pyrepl.TestCursorPosition.test_cursor_position_double_width_character) ... ok
test_cursor_position_double_width_character_move_left (test.test_pyrepl.test_pyrepl.TestCursorPosition.test_cursor_position_double_width_character_move_left) ... ok
test_cursor_position_double_width_character_move_left_right (test.test_pyrepl.test_pyrepl.TestCursorPosition.test_cursor_position_double_width_character_move_left_right) ... ok
test_cursor_position_double_width_characters_move_up (test.test_pyrepl.test_pyrepl.TestCursorPosition.test_cursor_position_double_width_characters_move_up) ... ok
test_cursor_position_double_width_characters_move_up_down (test.test_pyrepl.test_pyrepl.TestCursorPosition.test_cursor_position_double_width_characters_move_up_down) ... ok
test_cursor_position_move_down_to_eol (test.test_pyrepl.test_pyrepl.TestCursorPosition.test_cursor_position_move_down_to_eol) ... ok
test_cursor_position_move_up_to_eol (test.test_pyrepl.test_pyrepl.TestCursorPosition.test_cursor_position_move_up_to_eol) ... ok
test_cursor_position_multiple_double_width_characters_move_left (test.test_pyrepl.test_pyrepl.TestCursorPosition.test_cursor_position_multiple_double_width_characters_move_left) ... ok
test_cursor_position_multiple_mixed_lines_move_up (test.test_pyrepl.test_pyrepl.TestCursorPosition.test_cursor_position_multiple_mixed_lines_move_up) ... ok
test_cursor_position_simple_character (test.test_pyrepl.test_pyrepl.TestCursorPosition.test_cursor_position_simple_character) ... ok
test_down_arrow_end_of_input (test.test_pyrepl.test_pyrepl.TestCursorPosition.test_down_arrow_end_of_input) ... ok
test_left_arrow_simple (test.test_pyrepl.test_pyrepl.TestCursorPosition.test_left_arrow_simple) ... ok
test_right_arrow_end_of_line (test.test_pyrepl.test_pyrepl.TestCursorPosition.test_right_arrow_end_of_line) ... ok
test_up_arrow_simple (test.test_pyrepl.test_pyrepl.TestCursorPosition.test_up_arrow_simple) ... ok
test_dumb_terminal_exits_cleanly (test.test_pyrepl.test_pyrepl.TestMain.test_dumb_terminal_exits_cleanly) ... ok
test_exposed_globals_in_repl (test.test_pyrepl.test_pyrepl.TestMain.test_exposed_globals_in_repl) ... ok
test_inspect_keeps_globals_from_inspected_file (test.test_pyrepl.test_pyrepl.TestMain.test_inspect_keeps_globals_from_inspected_file) ...
test_inspect_keeps_globals_from_inspected_file (test.test_pyrepl.test_pyrepl.TestMain.test_inspect_keeps_globals_from_inspected_file) (var='FOO', expected='42') ... FAIL
test_inspect_keeps_globals_from_inspected_module (test.test_pyrepl.test_pyrepl.TestMain.test_inspect_keeps_globals_from_inspected_module) ...
test_inspect_keeps_globals_from_inspected_module (test.test_pyrepl.test_pyrepl.TestMain.test_inspect_keeps_globals_from_inspected_module) (var='__package__', expected="'blue'") ... FAIL
test_inspect_keeps_globals_from_inspected_module (test.test_pyrepl.test_pyrepl.TestMain.test_inspect_keeps_globals_from_inspected_module) (var='__file__', expected=re.compile("^'.*calx.py'$")) ... FAIL
test_not_wiping_history_file (test.test_pyrepl.test_pyrepl.TestMain.test_not_wiping_history_file) ... ok
test_python_basic_repl (test.test_pyrepl.test_pyrepl.TestMain.test_python_basic_repl) ... ok
test_bracketed_paste (test.test_pyrepl.test_pyrepl.TestPasteEvent.test_bracketed_paste)
Test that bracketed paste using and works. ... ok
test_bracketed_paste_single_line (test.test_pyrepl.test_pyrepl.TestPasteEvent.test_bracketed_paste_single_line) ... ok
test_paste (test.test_pyrepl.test_pyrepl.TestPasteEvent.test_paste) ... ok
test_paste_mid_newlines (test.test_pyrepl.test_pyrepl.TestPasteEvent.test_paste_mid_newlines) ... ok
test_paste_mid_newlines_not_in_paste_mode (test.test_pyrepl.test_pyrepl.TestPasteEvent.test_paste_mid_newlines_not_in_paste_mode) ... ok
test_paste_not_in_paste_mode (test.test_pyrepl.test_pyrepl.TestPasteEvent.test_paste_not_in_paste_mode) ... ok
test_auto_indent_continuation (test.test_pyrepl.test_pyrepl.TestPyReplAutoindent.test_auto_indent_continuation) ... ok
test_auto_indent_default (test.test_pyrepl.test_pyrepl.TestPyReplAutoindent.test_auto_indent_default) ... ok
test_auto_indent_ignore_comments (test.test_pyrepl.test_pyrepl.TestPyReplAutoindent.test_auto_indent_ignore_comments) ... ok
test_auto_indent_multiline (test.test_pyrepl.test_pyrepl.TestPyReplAutoindent.test_auto_indent_multiline) ... ok
test_auto_indent_prev_block (test.test_pyrepl.test_pyrepl.TestPyReplAutoindent.test_auto_indent_prev_block) ... ok
test_auto_indent_with_comment (test.test_pyrepl.test_pyrepl.TestPyReplAutoindent.test_auto_indent_with_comment) ... ok
test_completion_with_many_options (test.test_pyrepl.test_pyrepl.TestPyReplCompleter.test_completion_with_many_options) ... ok
test_completion_with_warnings (test.test_pyrepl.test_pyrepl.TestPyReplCompleter.test_completion_with_warnings) ... ok
test_empty_namespace_completion (test.test_pyrepl.test_pyrepl.TestPyReplCompleter.test_empty_namespace_completion) ... ok
test_global_namespace_completion (test.test_pyrepl.test_pyrepl.TestPyReplCompleter.test_global_namespace_completion) ... ok
test_simple_completion (test.test_pyrepl.test_pyrepl.TestPyReplCompleter.test_simple_completion) ... ok
test_updown_arrow_with_completion_menu (test.test_pyrepl.test_pyrepl.TestPyReplCompleter.test_updown_arrow_with_completion_menu)
Up arrow in the middle of unfinished tab completion when the menu is displayed ... ok
test_basic (test.test_pyrepl.test_pyrepl.TestPyReplOutput.test_basic) ... ok
test_control_character (test.test_pyrepl.test_pyrepl.TestPyReplOutput.test_control_character) ... ok
test_history_navigation_with_down_arrow (test.test_pyrepl.test_pyrepl.TestPyReplOutput.test_history_navigation_with_down_arrow) ... ok
test_history_navigation_with_up_arrow (test.test_pyrepl.test_pyrepl.TestPyReplOutput.test_history_navigation_with_up_arrow) ... ok
test_history_search (test.test_pyrepl.test_pyrepl.TestPyReplOutput.test_history_search) ... ok
test_history_with_multiline_entries (test.test_pyrepl.test_pyrepl.TestPyReplOutput.test_history_with_multiline_entries) ... ok
test_multiline_edit (test.test_pyrepl.test_pyrepl.TestPyReplOutput.test_multiline_edit) ... ok
test_stdin_is_tty (test.test_pyrepl.test_pyrepl.TestPyReplOutput.test_stdin_is_tty) ... ok
test_stdout_is_tty (test.test_pyrepl.test_pyrepl.TestPyReplOutput.test_stdout_is_tty) ... skipped 'stdout is not a tty'
test_calc_screen_backspace (test.test_pyrepl.test_reader.TestReader.test_calc_screen_backspace) ... ok
test_calc_screen_backspace_in_second_line_after_wrap (test.test_pyrepl.test_reader.TestReader.test_calc_screen_backspace_in_second_line_after_wrap) ... ok
test_calc_screen_wrap_removes_after_backspace (test.test_pyrepl.test_reader.TestReader.test_calc_screen_wrap_removes_after_backspace) ... ok
test_calc_screen_wrap_simple (test.test_pyrepl.test_reader.TestReader.test_calc_screen_wrap_simple) ... ok
test_calc_screen_wrap_three_lines (test.test_pyrepl.test_reader.TestReader.test_calc_screen_wrap_three_lines) ... ok
test_calc_screen_wrap_three_lines_mixed_character (test.test_pyrepl.test_reader.TestReader.test_calc_screen_wrap_three_lines_mixed_character) ... ok
test_calc_screen_wrap_wide_characters (test.test_pyrepl.test_reader.TestReader.test_calc_screen_wrap_wide_characters) ... ok
test_completions_updated_on_key_press (test.test_pyrepl.test_reader.TestReader.test_completions_updated_on_key_press) ... ok
test_control_characters (test.test_pyrepl.test_reader.TestReader.test_control_characters) ... ok
test_input_hook_is_called_if_set (test.test_pyrepl.test_reader.TestReader.test_input_hook_is_called_if_set) ... ok
test_key_press_on_tab_press_once (test.test_pyrepl.test_reader.TestReader.test_key_press_on_tab_press_once) ... ok
test_keyboard_interrupt_clears_screen (test.test_pyrepl.test_reader.TestReader.test_keyboard_interrupt_clears_screen) ... ok
test_newline_within_block_trailing_whitespace (test.test_pyrepl.test_reader.TestReader.test_newline_within_block_trailing_whitespace) ... ok
test_prompt_length (test.test_pyrepl.test_reader.TestReader.test_prompt_length) ... ok
test_setpos_for_xy_simple (test.test_pyrepl.test_reader.TestReader.test_setpos_for_xy_simple) ... ok
test_setpos_from_xy_after_wrap (test.test_pyrepl.test_reader.TestReader.test_setpos_from_xy_after_wrap) ... ok
test_setpos_from_xy_multiple_lines (test.test_pyrepl.test_reader.TestReader.test_setpos_from_xy_multiple_lines) ... ok
test_setpos_fromxy_in_wrapped_line (test.test_pyrepl.test_reader.TestReader.test_setpos_fromxy_in_wrapped_line) ... ok
test_up_arrow_after_ctrl_r (test.test_pyrepl.test_reader.TestReader.test_up_arrow_after_ctrl_r) ... ok
test_cursor_back_write (test.test_pyrepl.test_unix_console.TestConsole.test_cursor_back_write) ... ok
test_cursor_left (test.test_pyrepl.test_unix_console.TestConsole.test_cursor_left) ... ok
test_cursor_left_right (test.test_pyrepl.test_unix_console.TestConsole.test_cursor_left_right) ... ok
test_cursor_up (test.test_pyrepl.test_unix_console.TestConsole.test_cursor_up) ... ok
test_cursor_up_down (test.test_pyrepl.test_unix_console.TestConsole.test_cursor_up_down) ... ok
test_multiline_function_move_up_down_short_terminal (test.test_pyrepl.test_unix_console.TestConsole.test_multiline_function_move_up_down_short_terminal) ... ok
test_multiline_function_move_up_short_terminal (test.test_pyrepl.test_unix_console.TestConsole.test_multiline_function_move_up_short_terminal) ... ok
test_resize_bigger_on_multiline_function (test.test_pyrepl.test_unix_console.TestConsole.test_resize_bigger_on_multiline_function) ... ok
test_resize_smaller_on_multiline_function (test.test_pyrepl.test_unix_console.TestConsole.test_resize_smaller_on_multiline_function) ... ok
test_simple_addition (test.test_pyrepl.test_unix_console.TestConsole.test_simple_addition) ... ok
test_wrap (test.test_pyrepl.test_unix_console.TestConsole.test_wrap) ... ok
test_empty (test.test_pyrepl.test_unix_eventqueue.TestUnixEventQueue.test_empty) ... ok
test_flush_buf (test.test_pyrepl.test_unix_eventqueue.TestUnixEventQueue.test_flush_buf) ... ok
test_get (test.test_pyrepl.test_unix_eventqueue.TestUnixEventQueue.test_get) ... ok
test_insert (test.test_pyrepl.test_unix_eventqueue.TestUnixEventQueue.test_insert) ... ok
test_push_special_key (test.test_pyrepl.test_unix_eventqueue.TestUnixEventQueue.test_push_special_key) ... ok
test_push_unrecognized_escape_sequence (test.test_pyrepl.test_unix_eventqueue.TestUnixEventQueue.test_push_unrecognized_escape_sequence) ... ok
test_push_with_key_in_keymap (test.test_pyrepl.test_unix_eventqueue.TestUnixEventQueue.test_push_with_key_in_keymap) ... ok
test_push_with_keymap_in_keymap (test.test_pyrepl.test_unix_eventqueue.TestUnixEventQueue.test_push_with_keymap_in_keymap) ... ok
test_push_with_keymap_in_keymap_and_escape (test.test_pyrepl.test_unix_eventqueue.TestUnixEventQueue.test_push_with_keymap_in_keymap_and_escape) ... ok
test_push_without_key_in_keymap (test.test_pyrepl.test_unix_eventqueue.TestUnixEventQueue.test_push_without_key_in_keymap) ... ok
test.test_pyrepl.test_windows_console (unittest.loader.ModuleSkipped.test.test_pyrepl.test_windows_console) ... skipped 'test only relevant on win32'
======================================================================
FAIL: test_inspect_keeps_globals_from_inspected_file (test.test_pyrepl.test_pyrepl.TestMain.test_inspect_keeps_globals_from_inspected_file) (var='FOO', expected='42')
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/mgorny/git/cpython/Lib/test/test_pyrepl/test_pyrepl.py", line 995, in _run_repl_globals_test
self.fail(f"{var}= not found in output")
~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: FOO= not found in output
======================================================================
FAIL: test_inspect_keeps_globals_from_inspected_module (test.test_pyrepl.test_pyrepl.TestMain.test_inspect_keeps_globals_from_inspected_module) (var='__package__', expected="'blue'")
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/mgorny/git/cpython/Lib/test/test_pyrepl/test_pyrepl.py", line 995, in _run_repl_globals_test
self.fail(f"{var}= not found in output")
~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: __package__= not found in output
======================================================================
FAIL: test_inspect_keeps_globals_from_inspected_module (test.test_pyrepl.test_pyrepl.TestMain.test_inspect_keeps_globals_from_inspected_module) (var='__file__', expected=re.compile("^'.*calx.py'$"))
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/mgorny/git/cpython/Lib/test/test_pyrepl/test_pyrepl.py", line 995, in _run_repl_globals_test
self.fail(f"{var}= not found in output")
~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: __file__= not found in output
----------------------------------------------------------------------
Ran 135 tests in 1.340s
FAILED (failures=3, skipped=2)
test test_pyrepl failed
== Tests result: FAILURE ==
10 slowest tests:
- test_pyrepl: 1.7 sec
1 test failed:
test_pyrepl
0:00:01 load avg: 14.21 Re-running 1 failed tests in verbose mode in subprocesses
0:00:01 load avg: 14.21 Run 1 test in parallel using 1 worker process (timeout: 10 min, worker timeout: 15 min)
0:00:02 load avg: 14.21 [1/1/1] test_pyrepl failed (3 failures)
Re-running test_pyrepl in verbose mode (matching: test_inspect_keeps_globals_from_inspected_file, test_inspect_keeps_globals_from_inspected_module, test_inspect_keeps_globals_from_inspected_module)
test_inspect_keeps_globals_from_inspected_file (test.test_pyrepl.test_pyrepl.TestMain.test_inspect_keeps_globals_from_inspected_file) ...
test_inspect_keeps_globals_from_inspected_file (test.test_pyrepl.test_pyrepl.TestMain.test_inspect_keeps_globals_from_inspected_file) (var='__name__', expected="'__main__'") ... FAIL
test_inspect_keeps_globals_from_inspected_file (test.test_pyrepl.test_pyrepl.TestMain.test_inspect_keeps_globals_from_inspected_file) (var='__package__', expected='None') ... FAIL
test_inspect_keeps_globals_from_inspected_module (test.test_pyrepl.test_pyrepl.TestMain.test_inspect_keeps_globals_from_inspected_module) ...
test_inspect_keeps_globals_from_inspected_module (test.test_pyrepl.test_pyrepl.TestMain.test_inspect_keeps_globals_from_inspected_module) (var='__name__', expected="'__main__'") ... FAIL
======================================================================
FAIL: test_inspect_keeps_globals_from_inspected_file (test.test_pyrepl.test_pyrepl.TestMain.test_inspect_keeps_globals_from_inspected_file) (var='__name__', expected="'__main__'")
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/mgorny/git/cpython/Lib/test/test_pyrepl/test_pyrepl.py", line 995, in _run_repl_globals_test
self.fail(f"{var}= not found in output")
~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: __name__= not found in output
======================================================================
FAIL: test_inspect_keeps_globals_from_inspected_file (test.test_pyrepl.test_pyrepl.TestMain.test_inspect_keeps_globals_from_inspected_file) (var='__package__', expected='None')
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/mgorny/git/cpython/Lib/test/test_pyrepl/test_pyrepl.py", line 995, in _run_repl_globals_test
self.fail(f"{var}= not found in output")
~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: __package__= not found in output
======================================================================
FAIL: test_inspect_keeps_globals_from_inspected_module (test.test_pyrepl.test_pyrepl.TestMain.test_inspect_keeps_globals_from_inspected_module) (var='__name__', expected="'__main__'")
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/mgorny/git/cpython/Lib/test/test_pyrepl/test_pyrepl.py", line 995, in _run_repl_globals_test
self.fail(f"{var}= not found in output")
~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: __name__= not found in output
----------------------------------------------------------------------
Ran 2 tests in 0.205s
FAILED (failures=3)
test test_pyrepl failed
1 test failed again:
test_pyrepl
== Tests result: FAILURE then FAILURE ==
10 slowest tests:
- test_pyrepl: 1.7 sec
1 re-run test:
test_pyrepl
1 test failed:
test_pyrepl
Total duration: 2.1 sec
Total tests: run=137 failures=6 skipped=2
Total test files: run=2/1 failed=1 rerun=1
Result: FAILURE then FAILURE
```
</details>
This is with 3.13.0b4.
### CPython versions tested on:
3.13
### Operating systems tested on:
Linux
<!-- gh-linked-prs -->
### Linked PRs
* gh-122140
* gh-122173
<!-- /gh-linked-prs -->
| 2c1b1e7a07eba0138b9858c6f2bea3cae9af0808 | 624bda76386efd8eecf73c4ad06f997b9b25f07f |
python/cpython | python__cpython-122086 | # `typing_extensions.deprecated` and `warnings.deprecated` remove coroutine property; How to deprecate async functions?
When I annotate an async function with `@deprecated(...)`, `inspect.iscoroutinefunction` no longer returns True. This is not what I expect to happen, as with `partial` from `functools` this does not happen.
Consider the following code:
```python
import inspect
from functools import partial
from typing_extensions import deprecated
async def coroutinefunction_a():
pass
@deprecated("deprecated coroutine")
async def coroutinefunction_b():
pass
assert inspect.iscoroutinefunction(coroutinefunction_a) is True # correct
assert inspect.iscoroutinefunction(partial(coroutinefunction_a)) is True # correct
assert inspect.iscoroutinefunction(coroutinefunction_b) is True # fail
```
With typing_extensions and python3.13, the last assertion fails.
This is especially annoying since e.g. [libraries use `inspect.iscoroutinefunction` to detect the type of function](https://github.com/miguelgrinberg/python-socketio/blob/main/src/socketio/async_namespace.py#L35-L41).
I am not sure this is the correct place for this bug report, as this both happens with python 3.13 and typing_extensions on older python versions.
<!-- gh-linked-prs -->
### Linked PRs
* gh-122086
* gh-122156
<!-- /gh-linked-prs -->
| 375c9f6dfb78345dd0966d6f3b281f15107b0561 | 2a5d1eb7073179a13159bce937afdbe240432e7d |
python/cpython | python__cpython-125877 | # test_ctypes: test_generated_data() fails on x86 Debian Installed with X 3.x
# Bug report
x86 Debian Installed with X 3.x build: https://buildbot.python.org/all/#/builders/1244/builds/2499
```
FAIL: test_generated_data (test.test_ctypes.test_generated_structs.GeneratedTest.test_generated_data) (name='Packed4')
Check that a ctypes struct/union matches its C equivalent.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/buildbot/buildarea/3.x.ware-debian-x86.installed/build/target/lib/python3.14/test/test_ctypes/test_generated_structs.py", line 444, in test_generated_data
self.assertEqual(sizeof(cls), next(expected))
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 12 != 16
```
The structure:
```py
@register()
class Packed4(Structure):
_fields_ = [('a', c_int8), ('b', c_int64)]
_pack_ = 8
```
configure:
```
./configure --prefix '$(PWD)/target'
```
test.pythoninfo:
```
CC.version: gcc (Debian 12.2.0-14) 12.2.0
sysconfig[CFLAGS]: -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O3 -Wall
sysconfig[PY_CFLAGS]: -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O3 -Wall
sysconfig[PY_CFLAGS_NODIST]: -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
sysconfig[PY_STDMODULE_CFLAGS]: -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O3 -Wall -std=c11 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration -fvisibility=hidden -I./Include/internal -I./Include/internal/mimalloc -I. -I./Include
```
<!-- gh-linked-prs -->
### Linked PRs
* gh-125877
<!-- /gh-linked-prs -->
| 13c9fa3d64e0653d696daad716703ef05fd5002b | 9c01db40aa5edbd75ce50342c08f7ed018ee7864 |
python/cpython | python__cpython-121926 | # `console`, `empty_tuple`, `kwargs`, `console_result` might be uninitialized in `main.c`
# Bug report
Variables here are uninitialized: https://github.com/python/cpython/blob/ac07451116d52dd6a5545d27b6a2e3737ed27cf0/Modules/main.c#L263-L268
It can jump here: https://github.com/python/cpython/blob/ac07451116d52dd6a5545d27b6a2e3737ed27cf0/Modules/main.c#L300-L305
Here's how our CI reports it:
<img width="664" alt="Снимок экрана 2024-07-17 в 18 43 39" src="https://github.com/user-attachments/assets/7ec75559-ce7f-4790-a662-0dd519ee191f">
I will fix it.
<!-- gh-linked-prs -->
### Linked PRs
* gh-121926
* gh-121931
<!-- /gh-linked-prs -->
| f4bc84d261c828ed81f137f2a48fa2f0de7a0211 | 19cbf8fd636192059550d0c908c3e29797feed1f |
python/cpython | python__cpython-135288 | # Ambiguous symbol table names
# Feature or enhancement
Every symbol table has type and name. The name of the symbol table that corresponds a class or a function is the same as the name of the corresponding class or function. But there are special symbol tables of type function for lambdas and generator expressions (there were also symbol tables for comprehensions, but they are no longer used). For lambdas. the name "lambda" does not conflict with other function names, because it is a reserved word. But for general expressions, the name "genexpr" can conflict with local function "genexpr" (see #119698). It is possible to distinguish the symbol table corresponding to a generator expression by looking in the list of its parameters, but this is not so convenient.
I propose to make the difference more clear:
* Either use separate types for lambda and generator expression symbol tables.
* Or use names which cannot be confused with any function name:
- reserved word like `lambda`. But I do not know good variant for generator expression.
- hyphenated word, like `gen-expr`.
- angle brackets, like `<genexpr>` and `<lambda>`.
- other special characters, e.g. `.genexpr`.
Names of symbol tables of other types like `top` and `__annotations__` can also be changed for uniformity and to avoid possible future conflicts.
The original issue #119698 was solved in other way, so there is no urge for such change. This is just a wild idea.
<!-- gh-linked-prs -->
### Linked PRs
* gh-135288
<!-- /gh-linked-prs -->
| da699ed7e546ec106609a3858dd529335facaa4d | 85ec3b3b503ffd5b7e45f8b3fa2cec0c10e4bef0 |
python/cpython | python__cpython-122269 | # `create_connection` and `create_server` in `asyncio` didn't work with a Python build with IPv6 disabled
# Bug report
### Bug description:
Build Python with the configuration `--disable-ipv6`, and run the test with `./python.exe -m test test_asyncio.test_events -m 'test_create_connection_local_addr_skip_different_family' -v`. You will encounter the following error stack:
```
ERROR: test_create_connection_local_addr_skip_different_family (test.test_asyncio.test_events.SelectEventLoopTests.test_create_connection_local_addr_skip_different_family)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/asaka/Codes/cpython/Lib/asyncio/base_events.py", line 1026, in _connect_sock
sock.bind(laddr)
OSError: bind(): bad family
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/asaka/Codes/cpython/Lib/test/test_asyncio/test_events.py", line 695, in test_create_connection_local_addr_skip_different_family
self.loop.run_until_complete(f)
File "/Users/asaka/Codes/cpython/Lib/asyncio/base_events.py", line 721, in run_until_complete
return future.result()
File "/Users/asaka/Codes/cpython/Lib/asyncio/base_events.py", line 1138, in create_connection
sock = await self._connect_sock(exceptions, addrinfo, laddr_infos)
File "/Users/asaka/Codes/cpython/Lib/asyncio/base_events.py", line 1032, in _connect_sock
f'{exc.strerror.lower()}'
AttributeError: 'NoneType' object has no attribute 'lower'
```
This issue not only affects the test but also user's code.
After some research, I found that it's caused by these two functions, which use `getaddrinfo` to get a list of connection infos and then attempt to call `bind` for each of the infos, ignoring `OSError` until a working one is found.
However, in the iteration code, it attempts to use `OSError().strerror` to create a new error. Unfortunately, some `OSError` instances have a `strerror` field of `None`. The error raised by `sock.bind` with `AF_INET6` when `--disable-ipv6` is used does not have this field, leading to an error that prevents the iteration loop from trying the next potential solution.
There are already reports for the missing `strerror` / `errno` fields issues: [https://github.com/python/cpython/issues/109601](https://github.com/python/cpython/issues/109601) and [https://github.com/python/cpython/issues/50720](https://github.com/python/cpython/issues/50720) with a draft PR #109720.
But before we fix this issue, should we provide a workaround for this specific problem, like using `str(exc)` instead of `exc.strerror`, or skip this loop if `not socket.has_ipv6` and current family is `AF_INET6`?
### CPython versions tested on:
CPython main branch
### Operating systems tested on:
macOS
<!-- gh-linked-prs -->
### Linked PRs
* gh-122269
* gh-122278
* gh-122279
<!-- /gh-linked-prs -->
| 070f1e2e5b9b31ee3e7a1af2e30d7e3a66040b17 | 6c09b8de5c67406113e8d082e05c9587e35a852a |
python/cpython | python__cpython-121907 | # "floating point" vs "floating-point"
@mdickinson in https://github.com/python/cpython/pull/26827#discussion_r1413049353 suggested to use the spelling "floating-point" (with a hyphen) instead of "floating point". Currently there are 118 occurrences of "floating-point" and at least 162 occurrences of "floating point" (in several cases it is split between lines, so it is not easy to get accurate number).
This looks reasonable to me. Wikipedia redirects from "floating point" to "Floating-point arithmetic".
<!-- gh-linked-prs -->
### Linked PRs
* gh-121907
* gh-122012
* gh-122013
<!-- /gh-linked-prs -->
| 1a0c7b9ba48a2dffb70bb0c7327abae1d3e87356 | 420d94312824825a18fa1fd9a36773626a54d97a |
python/cpython | python__cpython-121892 | # cmath.acosh(complex('±0+nanj')) should return complex('nan±pi/2j') (imaginary part sign is unspecified)
# Bug report
### Bug description:
As per C11 [DR#471](https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2244.htm#dr_471) (adjusted resolution accepted for C17). See glibc patch: https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=5244527da1bfa751492e146d3e6ae128c59bfcc4
Currently, imaginary part is nan.
### CPython versions tested on:
CPython main branch
### Operating systems tested on:
_No response_
<!-- gh-linked-prs -->
### Linked PRs
* gh-121892
<!-- /gh-linked-prs -->
| 3462a80d2cf37a63fe43f46f64a8c9823f84531d | 151934a324789c58cca9c7bbd6753d735454df5a |
python/cpython | python__cpython-121883 | # docs: inconsistent open and io.open audit-event parameters
# Bug report
### Bug description:
While working on [reproducible builds](https://reproducible-builds.org/) for [openSUSE](https://en.opensuse.org/openSUSE:Reproducible_Builds) (sponsored by the NLnet NGI0 fund), I found that
our `openSUSE:Factory/python312` doc varied in `html/library/audit_events.html` in a strange way:
```diff
<td><p><a class="reference internal" href="../reference/datamodel.html#href_anchor">[1]</a></p></td>
</tr>
<tr class="row-odd"><td><p>open</p></td>
-<td><p><code class="docutils literal notranslate"><span class="pre">path</span></code>, <code class="docutils literal notranslate"><span class="pre">mode</span></code>, <code class="docutils literal notranslate"><span class="pre">flags</span></code></p></td>
+<td><p><code class="docutils literal notranslate"><span class="pre">file</span></code>, <code class="docutils literal notranslate"><span class="pre">mode</span></code>, <code class="docutils literal notranslate"><span class="pre">flags</span></code></p></td>
<td><p><a class="reference internal" href="functions.html#href_anchor">[1]</a><a class="reference internal" href="io.html#href_anchor">[2]</a><a class="reference internal" href="os.html#href_anchor">[3]</a></p></td>
</tr>
```
According to strace, this file is written by a call to `["sphinx-build", "-b", "html", "-d", "build/doctrees", "-j", "auto", ".", "build/html"]`
All build output should be deterministic.
### CPython versions tested on:
3.10, 3.11, 3.12
### Operating systems tested on:
Linux
<!-- gh-linked-prs -->
### Linked PRs
* gh-121883
* gh-121955
* gh-121956
<!-- /gh-linked-prs -->
| 24cf867bed6035f33cd3b38d89d303b7522f12a6 | 63ddd28cf3e4a9a11a39d03418c5ad92785af4ff |
python/cpython | python__cpython-121872 | # Documentation HTML varies from timestamp
# Bug report
### Bug description:
While working on [reproducible builds](https://reproducible-builds.org/) for [openSUSE](https://en.opensuse.org/openSUSE:Reproducible_Builds) (sponsored by the NLnet NGI0 fund), I found that
building the `openSUSE:Factory/python311` doc, a timestamp is embedded into the HTML. This results in such variations:
```diff
<a href="https://www.python.org/psf/donations/">Please donate.</a>
<br />
<br />
- Last updated on Jul 16, 2024 (19:18 UTC).
+ Last updated on Jul 16, 2024 (19:19 UTC).
```
This is introduced via
Doc/tools/templates/download.html `{% if last_updated %}<p><b>Last updated on: {{ last_updated }}.</b></p>{% endif %}`
and `Doc/conf.py`
### CPython versions tested on:
3.11, 3.12
### Operating systems tested on:
Linux
<!-- gh-linked-prs -->
### Linked PRs
* gh-121872
* gh-121887
* gh-121888
<!-- /gh-linked-prs -->
| 941b3b7f4473153bf99f4c47e99f34f7aefe51ac | f036a463dbc43d25712183dc6afa4e38c1aaf93d |
python/cpython | python__cpython-121903 | # CMultiplyNested closure crash: Python 3.13 regression
Test extracted from Cython `tests/run/methodmangling_T5.py`:
```py
class CMultiplyNested:
def f1(self):
__arg = 1
class D:
def g(self, __arg):
return __arg
return D().g(_CMultiplyNested__arg=2)
def f2(self):
__arg = 1
class D:
def g(self, __arg):
return __arg
return D().g
if __name__ == "__main__":
import faulthandler; faulthandler.enable()
inst = CMultiplyNested()
name = '_CMultiplyNested__arg'
try:
inst.f1()
except TypeError:
print("TypeError")
closure = inst.f2()
closure(_CMultiplyNested__arg=2)
```
Output:
```
$ ./python bug.py
TypeError
Fatal Python error: Segmentation fault
Current thread 0x00007fa713149740 (most recent call first):
File "/home/vstinner/python/3.13/bug.py", line 27 in <module>
Erreur de segmentation (core dumped)
```
<!-- gh-linked-prs -->
### Linked PRs
* gh-121903
* gh-121904
<!-- /gh-linked-prs -->
| cffad5c6ef9371b26e32556296cea2bfe8358b1a | bfdbeac355235f6831ace5b514264bd1908000e5 |
python/cpython | python__cpython-121866 | # Crash on _PyDict_CheckConsistency with an empty instance dict
When running a complicated application that involves Cython I am getting the following crash:
```
Objects/dictobject.c:716: _PyDict_CheckConsistency: Assertion failed: mp->ma_values->valid == 1
Enable tracemalloc to get the memory block allocation traceback
object address : 0x21bbd30
object refcount : 1
object type : 0x9cb9e0
object type name: dict
object repr : {}
Fatal Python error: _PyObject_AssertFailed: _PyObject_AssertFailed
Python runtime state: finalizing (tstate=0x0000000000a522b8)
Current thread 0x00007ffff7fe2740 (most recent call first):
Garbage-collecting
<no Python frame>
Extension modules: xxx._ext, xxx._ext, xxx._tcp_impl (total: 3)
Thread 1 "python" received signal SIGABRT, Aborted.
```
I am trying to get a smaller reproducer that doesn't involve the entire world out of the application, but it may take me a while.
<!-- gh-linked-prs -->
### Linked PRs
* gh-121866
* gh-121867
<!-- /gh-linked-prs -->
| 162b41f57757c1df40eb377985e2e877fb0f0ea3 | c46d64e0ef8e92a6b4ab4805d813d7e4d6663380 |
python/cpython | python__cpython-121843 | # Improve `PyBytes_FromStringAndSize` test coverage
There's a fast-path in `PyBytes_FromStringAndSize` that is not covered: https://github.com/python/cpython/blob/8549559f383dfcc0ad0c32496f62a4b737c05b4f/Objects/bytesobject.c#L120-L124
Here:
https://github.com/python/cpython/blob/8549559f383dfcc0ad0c32496f62a4b737c05b4f/Objects/bytesobject.c#L111-L124
We don't have test cases for it: https://github.com/python/cpython/blob/8549559f383dfcc0ad0c32496f62a4b737c05b4f/Lib/test/test_capi/test_bytes.py#L49-L65
I propose adding:
```python
self.assertEqual(fromstringandsize(b'a'), b'a')
self.assertEqual(fromstringandsize(b'a', 1), b'a')
```
So we would have better C coverage stats. It won't hurt in any case, even if this path is removed some day.
<!-- gh-linked-prs -->
### Linked PRs
* gh-121843
* gh-121893
* gh-121894
<!-- /gh-linked-prs -->
| f6c7d8d79c4e17167af98f2e0cb4b1e55d7b5d3c | 37611171af4dffbd139e0393873479ed973e9585 |
python/cpython | python__cpython-121835 | # Improve `complex` C-API error descriptions
There several things to improve:
- Some functions do not have an error description at all: https://github.com/python/cpython/blob/7e91e0dcfe2faab1e1a4630e6f745aa30ca87b3d/Doc/c-api/complex.rst?plain=1#L106-L115 So, we should add that these functions can fail.
- Some functions mention the error case, but do not mention that exception is set: https://github.com/python/cpython/blob/7e91e0dcfe2faab1e1a4630e6f745aa30ca87b3d/Doc/c-api/complex.rst?plain=1#L152-L153
Plus, I would unify the wording in some other functions.
<!-- gh-linked-prs -->
### Linked PRs
* gh-121835
* gh-121895
* gh-121897
<!-- /gh-linked-prs -->
| 72dccd60735b597e99c007a7b69210763a746877 | f6c7d8d79c4e17167af98f2e0cb4b1e55d7b5d3c |
python/cpython | python__cpython-122150 | # Test suite crashes when run single process `--with-pydebug` enabled
# Crash report
### What happened?
The `make testios` testing target crashes when compiled `--with-pydebug` enabled (as is done in CI).
The error is a SIGABRT, raised during `test_types`; however, running `test_types` by itself isn't enough to reproduce the problem.
The error is raised on [L8476 of `typeobject.c`](https://github.com/python/cpython/blob/2bac2b86b1486f15038fb246835e04bb1b213cd8/Objects/typeobject.c#L8476):
```
assert(self->tp_version_tag != 0);
```
The same failure can be manufactured on macOS with M1 hardware, as long as the test suite is executed as a single process (i.e. `python -m test`, not the multi-process option enabled by `make test`).
Full error trace on iOS:
[stacktrace.txt](https://github.com/user-attachments/files/16243035/stacktrace.txt)
The same problem doesn't appear to occur when debug is *not* enabled.
### CPython versions tested on:
CPython main branch
### Operating systems tested on:
macOS, iOS
### Output from running 'python -VV' on the command line:
3.14.0a0; verified on 2bac2b86, but possibly present back to dc03ce79
<!-- gh-linked-prs -->
### Linked PRs
* gh-122150
* gh-122159
* gh-122182
* gh-122290
* gh-122340
* gh-122342
<!-- /gh-linked-prs -->
| 863a92f2bc708b9e3dfa9828bb8155b8d371e09c | 4a2607c1807982a107445b5a35240f587a61eb0d |
python/cpython | python__cpython-121818 | # Segfault in 3.13 when calling `PyEval_SetTrace` from a thread with no Python frames
# Bug report
### Bug description:
Given a `setup.py` with:
```python
from setuptools import Extension
from setuptools import setup
setup(
name="testext",
version="0.0",
ext_modules=[
Extension("testext", language="c++", sources=["testext.cpp"]),
],
zip_safe=False,
)
```
and a `testext.cpp` with:
```cpp
#define PY_SSIZE_T_CLEAN
#include <Python.h>
#include <assert.h>
#include <pthread.h>
#include <unistd.h>
int tracefunc(PyObject *, PyFrameObject *, int, PyObject *)
{
return 0;
}
void*
thread_body(void*)
{
PyGILState_STATE gilstate = PyGILState_Ensure();
PyEval_SetTrace(&tracefunc, Py_None);
PyGILState_Release(gilstate);
return NULL;
}
PyObject*
trace_in_thread(PyObject*, PyObject*)
{
pthread_t thread;
int ret = pthread_create(&thread, NULL, &thread_body, NULL);
assert(0 == ret);
Py_BEGIN_ALLOW_THREADS
ret = pthread_join(thread, NULL);
assert(0 == ret);
Py_END_ALLOW_THREADS
Py_RETURN_NONE;
}
static PyMethodDef methods[] = {
{"trace_in_thread", trace_in_thread, METH_NOARGS, "Call PyEval_SetTrace in a thread"},
{NULL, NULL, 0, NULL},
};
static struct PyModuleDef moduledef = {PyModuleDef_HEAD_INIT, "testext", "", -1, methods};
PyMODINIT_FUNC
PyInit_testext(void)
{
return PyModule_Create(&moduledef);
}
```
doing:
```shell
python3.13 -m pip install .
python3.13 -c 'import testext; testext.trace_in_thread()'
```
gives a segmentation fault, because of this code in `_PyEval_SetTrace`:
https://github.com/python/cpython/blob/7b413952e817ae87bfda2ac85dd84d30a6ce743b/Python/legacy_tracing.c#L607-L608
This reproducer enters `_PyEval_SetTrace` with no Python frames on the stack, and so `PyEval_GetFrame` returns a null pointer and `frame->f_trace_opcodes` dereferences it. It seems that this needs to be guarded:
```c
PyFrameObject* frame = PyEval_GetFrame();
if (frame && frame->f_trace_opcodes) {
```
### CPython versions tested on:
3.13
### Operating systems tested on:
Linux
<!-- gh-linked-prs -->
### Linked PRs
* gh-121818
* gh-121861
<!-- /gh-linked-prs -->
| 2b1b68939b15b913080a3403e3ba18e2a1f520ef | 4134261ab831863565fefc7a04d05a1fc1bca2f8 |
python/cpython | python__cpython-121886 | # The new repl sometimes does not show the error location when `SyntaxError` is raised
# Bug report
### Bug description:
When I run `def f[Foo, Foo](): ...` from a file, I get a nice error message including the location of the error:
```python
File ".../test.py", line 1
def f[Foo, Foo](): ...
^^^
SyntaxError: duplicate type parameter 'Foo'
```
However, when I run this in the new repl, the error location is not shown:
```python
>>> def f[Foo, Foo](): ...
File "<python-input-0>", line 1
SyntaxError: duplicate type parameter 'Foo'
```
The same thing happens with this error as well:
```python
>>> def f(x, x): ...
File "<python-input-0>", line 1
SyntaxError: duplicate argument 'x' in function definition
```
The missing location seems to be the case for these two errors only as other errors do show it:
```python
>>> def f(42): ...
File "<unknown>", line 1
def f(42): ...
^^
SyntaxError: invalid syntax
```
What's interesting is that for the first two errors the file shows up as `<python-input-0>` while for the last one it's `<unknown>`. This could be related to the last error coming from the parser while the previous errors come from symtable:
https://github.com/python/cpython/blob/6522f0e438a8c56a8f3cce2095b193ea6e3f5016/Python/symtable.c#L1421-L1435
Though it looks like that the error location is being set with `SET_ERROR_LOCATION`..
### CPython versions tested on:
CPython main branch
### Operating systems tested on:
Linux
<!-- gh-linked-prs -->
### Linked PRs
* gh-121886
* gh-123148
* gh-123202
* gh-123366
* gh-123631
<!-- /gh-linked-prs -->
| 354d55eb1fa40f272419aa6459ee5d2c4804c8ea | e077b201f49a6007ddad7c1b6e3069a037b6d952 |
python/cpython | python__cpython-121801 | # Add class method Decimal.from_number()
# Feature or enhancement
It is an alternate constructor which only accepts a single numeric argument. Unlike to `Decimal.from_float()` it accepts also Decimal. Unlike to the standard constructor, it does not accept strings and tuples.
Similar to `float.from_number()` and `complex.from_number()` (see #84978) and `Fraction.from_number()` (see #121797).
<!-- gh-linked-prs -->
### Linked PRs
* gh-121801
<!-- /gh-linked-prs -->
| 5217328f93f599755bd70418952392c54f705a71 | 4b358ee647809019813f106eb901f466a3846d98 |
python/cpython | python__cpython-121800 | # Add class method Fraction.from_number()
# Feature or enhancement
It is an alternate constructor which only accepts a single numeric argument. Unlike to `Fraction.from_float()` and `Fraction.from_decimal()` it accepts any real numbers supported by the standard constructor (int, float, Decimal, Rational numbers). Unlike to the standard constructor, it does not accept strings.
Similar to `float.from_number()` and `complex.from_number()` (see #84978).
<!-- gh-linked-prs -->
### Linked PRs
* gh-121800
<!-- /gh-linked-prs -->
| b52c7306ea4470f9d7548655c2a1b89a07ff5504 | 66b3922b97388c328c9bd8df050eef11c0261fae |
python/cpython | python__cpython-121796 | # Improve performance of set membership testing from set arguments
# Feature or enhancement
### Proposal:
For set `s` and set `elem`, the operations `elem in s`, `s.remove(elem)`, and `s.discard(elem)` are equivalent to `frozenset(elem) in s`, `s.remove(frozenset(elem))`, and `s.discard(frozenset(elem))`, respectively. This feature is documented in [Built-in Types](https://docs.python.org/3/library/stdtypes.html#set):
> Note, the elem argument to the [__contains__()](https://docs.python.org/3/reference/datamodel.html#object.__contains__), [remove()](https://docs.python.org/3/library/stdtypes.html#frozenset.remove), and [discard()](https://docs.python.org/3/library/stdtypes.html#frozenset.discard) methods may be a set. To support searching for an equivalent frozenset, a temporary one is created from elem.
The implementation can be improved by calculating the hash value directly from the set object (as if it is a frozenset), instead of copying it into a new frozenset before calculating the hash value. The hash function for `set` is internal use only, and `set` is still unhashable.
### 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-121796
<!-- /gh-linked-prs -->
| 2408a8a22bd13d8f15172a2ecf8bbbc4355dcb3b | 97668192f7670caebe04c0cbcc488ae0334597d9 |
python/cpython | python__cpython-121799 | # `_Py_MergeZeroLocalRefcount` should not set `ob_tid` to zero in fast-path dealloc
# Bug report
The `_Py_MergeZeroLocalRefcount` function is called when the local refcount field reaches zero. We generally maintain the invariant [^1] that `ob_tid == 0` implies that the refcount fields are merged (i.e., `ob_ref_shared` flags are `_Py_REF_MERGED`) and vice versa.
The current implementation breaks the invariant by setting `ob_tid` to zero when the refcount fields aren't merged. Typically, this isn't a problem because:
* Most commonly, the object is deallocated so the values do not matter
* If the object is resurrected in `subtype_dealloc` (e.g., for a finalizer), we use `Py_SET_REFCNT`, which will mark the fields as merged, restoring the invariant
However, if resurrection is done slightly differently, such as by `Py_INCREF()`, then things can break in very strange ways:
* The GC may restore `ob_tid` from the allocator (because it's not merged), but `ob_ref_local` is still zero. The next `Py_DECREF` then leads to a "negative refcount" error.
### Summary
We should maintain the invariant that `ob_tid == 0` <=> `_Py_REF_IS_MERGED()` and check it with assertions when possible.
https://github.com/python/cpython/blob/8303d32ff55945c5b38eeeaf1b1811dbcf8aa9be/Objects/object.c#L373-L398
Originally reported by @albanD
[^1]: There are a few places where we deliberately re-use `ob_tid` for other purposes, such as the trashcan mechanism and during GC, but these objects are not visible to other parts of the program.
<!-- gh-linked-prs -->
### Linked PRs
* gh-121799
* gh-121821
<!-- /gh-linked-prs -->
| d23be3947ced081914f4458c84f729c9c37f0219 | 82a4dac9f6131954c32dac9d0277283fc5b499a9 |
python/cpython | python__cpython-121792 | # `MethodDescriptor2_new` does not check for `NULL` in `_testcapi`
# Bug report
Here: https://github.com/python/cpython/blob/8303d32ff55945c5b38eeeaf1b1811dbcf8aa9be/Modules/_testcapi/vectorcall.c#L347-L354
I know that memory errors are very unluckily, but still: why not having a correct code?
<!-- gh-linked-prs -->
### Linked PRs
* gh-121792
* gh-121839
* gh-121840
<!-- /gh-linked-prs -->
| 8b6d4755812d0b02e9f26beb9c9a7714e4c5ac28 | 1755df7b3bf5aaaba55fd7ec02a91d99305e362e |
python/cpython | python__cpython-121793 | # `python3.13 -m asyncio` immediately fails with `TypeError`
# Bug report
### Bug description:
```bash
python -m asyncio
```
fails with:
```
asyncio REPL 3.14.0a0 experimental free-threading build (heads/main:4b9e10d0ea3, Jul 13 2024, 14:18:40) [GCC 11.4.0] on linux
Use "await" directly instead of "asyncio.run()".
Type "help", "copyright", "credits" or "license" for more information.
>>> import asyncio
TypeError: run_multiline_interactive_console() missing 1 required positional argument: 'namespace'
Internal error, exiting asyncio REPL...
```
### CPython versions tested on:
CPython main branch
### Operating systems tested on:
Linux
<!-- gh-linked-prs -->
### Linked PRs
* gh-121793
* gh-121822
<!-- /gh-linked-prs -->
| e5c7216f376a06d2c931daf999e2980e494e747e | d23be3947ced081914f4458c84f729c9c37f0219 |
python/cpython | python__cpython-121787 | # codecs.py: Legacy --disable-unicode branch
# Bug report
### Bug description:
(Not a bug report, but there is no appropriate category when creating an issue.)
git HEAD as well as Python 3.12 has the following code in codecs.py:
https://github.com/python/cpython/blob/8303d32ff55945c5b38eeeaf1b1811dbcf8aa9be/Lib/codecs.py#L1112-L1126
Is `--disable-unicode` even a thing anymore or is the exception handler just dead code that should be removed?
### CPython versions tested on:
3.12, CPython main branch
### Operating systems tested on:
Linux
<!-- gh-linked-prs -->
### Linked PRs
* gh-121787
<!-- /gh-linked-prs -->
| 74fbdcd74abc1bac6846ec92f00d21fe8f87610b | 94bee45dee41876e88fe023b9163178d376355dc |
python/cpython | python__cpython-121788 | # Tier 1 code generator doesn't track used values if named `unused`
# Bug report
### Bug description:
The `_INIT_CALL_BOUND_METHOD_EXACT_ARGS` uop definition requires explicit code to force the function and `self` to be written to memory, or the values are lost.
This is because following uops do not use those values, so when they are used they are loaded from memory.
This can be fixed in one of two ways:
* Raise an error if a value that is cached is marked as `unused` forcing it to be explicitly named.
* Implicitly name `unused` but cached values in the code generator, so that they are tracked properly.
### CPython versions tested on:
CPython main branch
### Operating systems tested on:
_No response_
<!-- gh-linked-prs -->
### Linked PRs
* gh-121788
<!-- /gh-linked-prs -->
| 3eacfc1a4d09a9807bedba58ef4037788b6df961 | 169324c27a39a4d6a4dd7b313b0de6ab2d1f7e6b |
python/cpython | python__cpython-121750 | # Discrepancy in docs for `PyModule_AddObjectRef`
# Bug report
### Bug description:
The docs for `PyModule_AddObjectRef` say:
https://github.com/python/cpython/blob/cae15267166e217822e3c58ac22b7817162f323a/Doc/c-api/module.rst?plain=1#L520-L521
However the function actually returns `-1` in that case:
https://github.com/python/cpython/blob/cae15267166e217822e3c58ac22b7817162f323a/Python/modsupport.c#L590-L597
We should update the documentation to reflect that.
### CPython versions tested on:
CPython main branch
### Operating systems tested on:
Linux
<!-- gh-linked-prs -->
### Linked PRs
* gh-121750
* gh-121752
* gh-121753
<!-- /gh-linked-prs -->
| 26dfb2771236bfd96cdaa1081103f75141ecff47 | cae15267166e217822e3c58ac22b7817162f323a |
python/cpython | python__cpython-121754 | # Inconsistent behaviour for ALT+Enter keybinding in pyrepl, ipython and ptpython
# Bug report
### Bug description:
IPython and ptpython use <kbd>ALT</kbd>+<kbd>Enter</kbd> to submit multiline input, regardless of the position of the cursor, but the new REPL does not.
Looks like it'd be good to be consistent with those two multiline REPLs.
P.S.
The new REPL has a couple of similar bindings, but they all have issues:
- <kbd>ALT</kbd>+<kbd>Enter</kbd> is commented out, so it's not being used (and it is pointing at the wrong command)
- <kbd>CTRL</kbd>+<kbd>J</kbd> and <kbd>CTRL</kbd>+<kbd>M</kbd> are bound to the correct command but many terminals cannot tell those apart from `\n` and `\r`, unless they support a newer, more advanced terminal protocol (that must be explicitly enabled) (c.f. https://sw.kovidgoyal.net/kitty/keyboard-protocol/)
- `\<return>` is bound to the correct command but it's not activated by the <kbd>Enter</kbd> key, it must be some obscure keybinding that I couldn't even figure out how to trigger.
### CPython versions tested on:
3.13, CPython main branch
### Operating systems tested on:
macOS
<!-- gh-linked-prs -->
### Linked PRs
* gh-121754
* gh-121803
<!-- /gh-linked-prs -->
| 6522f0e438a8c56a8f3cce2095b193ea6e3f5016 | 74fbdcd74abc1bac6846ec92f00d21fe8f87610b |
python/cpython | python__cpython-123037 | # Can't open orphan path on bare importlib.resources.files() under zipapp
# Bug report
### Bug description:
Context: In Python 3.12 the function importlib.resources.files() was updated: https://docs.python.org/3/library/importlib.resources.html#importlib.resources.files
> Changed in version 3.12: package parameter was renamed to anchor. anchor can now be a non-package module and if omitted will default to the caller’s module. package is still accepted for compatibility but will raise a [DeprecationWarning](https://docs.python.org/3/library/exceptions.html#DeprecationWarning). Consider passing the anchor positionally or using importlib_resources >= 5.10 for a compatible interface on older Pythons.
The Issue: When using `importlib.resources.files()`, I am able to open and read a text file included as package data in my package. However, if I zip up my package with zipapp and run the .pyz file, it is unable to read the text file.
If I use `importlib.resources.files("mypkg")` it will work in both cases.
Minimal example:
Create a project directory named `mypkg` with the [src layout](https://setuptools.pypa.io/en/latest/userguide/package_discovery.html#src-layout).
Create the following files.
mypkg/src/mypkg/a.py
```python
import importlib.resources
def main():
x = importlib.resources.files() / "data.txt"
print(x.read_text())
```
mypkg/src/mypkg/data.txt
```text
datadata
```
In pyproject.toml make sure to set up the entry script and include the data file.
mypkg/pyproject.toml
```
[project.scripts]
myscript = "mypkg.a:main"
[tool.setuptools.package-data]
mypkg = ["*.txt"]
```
Install the package into a fresh Python (virtual) environment with pip.
Run `myscript` and verify it prints `datadata`.
Now back in the mypkg project root folder, we will generate a .pyz file with zipapp and run the program from the .pyz file.
Run `pip install . --target buildtemp --upgrade && python3 -m zipapp buildtemp --main mypkg.a:main -p '/usr/bin/env python3' -o mypkg.pyz` in the terminal.
Run `./mypkg.pyz`. This results in an error:
```
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/win/code/sandbox/python/mypkg/./mypkg.pyz/__main__.py", line 3, in <module>
File "/home/win/code/sandbox/python/mypkg/./mypkg.pyz/mypkg/a.py", line 6, in main
File "/home/win/.local/share/mise/installs/python/3.12.4/lib/python3.12/importlib/resources/abc.py", line 89, in read_text
with self.open(encoding=encoding) as strm:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/win/.local/share/mise/installs/python/3.12.4/lib/python3.12/importlib/resources/_adapters.py", line 139, in open
raise FileNotFoundError("Can't open orphan path")
FileNotFoundError: Can't open orphan path
```
Note that if you change `x = importlib.resources.files() / "data.txt"` to `x = importlib.resources.files("mypkg") / "data.txt"`, it will work when running the .pyz file.
### CPython versions tested on:
3.12
### Operating systems tested on:
Linux, macOS
<!-- gh-linked-prs -->
### Linked PRs
* gh-123037
* gh-123986
* gh-124011
<!-- /gh-linked-prs -->
| ba687d9481c04fd160795ff8d8568f5c9f877128 | 3bd942f106aa36c261a2d90104c027026b2a8fb6 |
python/cpython | python__cpython-121732 | # mimalloc build fails on GNU/Hurd due to undeclared 'open'
# Bug report
### Bug description:
# Bug description:
The compilation of mimalloc on GNU/Hurd currently fails with the following error:
```
In file included from ../Objects/mimalloc/prim/prim.c:22,
from ../Objects/mimalloc/static.c:37:
../Objects/mimalloc/prim/unix/prim.c: In function 'mi_prim_open':
../Objects/mimalloc/prim/unix/prim.c:82:10: error: implicit declaration of function 'open'; did you mean 'popen'? [-Werror=implicit-function-declaration]
82 | return open(fpath,open_flags);
| ^~~~
| popen
```
This is already fixed upstream by https://github.com/microsoft/mimalloc/commit/98abfe042cbb168309832b744bbed982d81bba6b . will submit a PR containing a backport
# CPython versions tested on:
CPython 3.13.0 b3
### CPython versions tested on:
3.13
### Operating systems tested on:
Other
<!-- gh-linked-prs -->
### Linked PRs
* gh-121732
* gh-121773
<!-- /gh-linked-prs -->
| d005f2c1861dbf0ab3d9f80b54d05d0c0b522c3c | 5d6861ad06b524358f52603f242e7c0d57532a58 |
python/cpython | python__cpython-122154 | # multiprocessing.Pool in spawn mode breaks logging.handlers.QueueHandler configuration
# Bug report
### Bug description:
multiprocessing.Pool with **spawn** method breaks logging.handlers.QueueHandler configuration
```python
import logging
import logging.config
import multiprocessing
import time
def _init(q):
logging.config.dictConfig({
'version': 1,
'disable_existing_loggers': True,
'handlers': {'log_to_parent': {'class': 'logging.handlers.QueueHandler', 'queue': q}},
'root': {'handlers': ['log_to_parent'], 'level': 'DEBUG'}
})
logging.getLogger().info('log from child')
if __name__ == '__main__':
multiprocessing.set_start_method('spawn')
with multiprocessing.Manager() as manager:
# q = manager.Queue()
q = multiprocessing.Queue()
# listen for log messages from child processes
# ...
with multiprocessing.Pool(processes=1, maxtasksperchild=1, initializer=_init, initargs=(q,)) as pool:
time.sleep(1)
```
got exception (when q = manager.Queue() or q = multiprocessing.Queue())
```
Process SpawnPoolWorker-2:
Traceback (most recent call last):
File "/home/foo/miniconda3/envs/py312forge/lib/python3.12/logging/config.py", line 581, in configure
handler = self.configure_handler(handlers[name])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/foo/miniconda3/envs/py312forge/lib/python3.12/logging/config.py", line 792, in configure_handler
proxy_queue = MM().Queue()
^^^^
File "/home/foo/miniconda3/envs/py312forge/lib/python3.12/multiprocessing/context.py", line 57, in Manager
m.start()
File "/home/foo/miniconda3/envs/py312forge/lib/python3.12/multiprocessing/managers.py", line 562, in start
self._process.start()
File "/home/foo/miniconda3/envs/py312forge/lib/python3.12/multiprocessing/process.py", line 118, in start
assert not _current_process._config.get('daemon'), \
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: daemonic processes are not allowed to have children
The above exception was the direct cause of the following exception:
...
```
### CPython versions tested on:
3.12
### Operating systems tested on:
Linux
<!-- gh-linked-prs -->
### Linked PRs
* gh-122154
* gh-122603
* gh-122604
* gh-122969
* gh-122991
<!-- /gh-linked-prs -->
| fb864c76cd5e450e789a7b4095832e118cc49a39 | addbb73927f55855dfcc62fd47b0018de8a814ed |
python/cpython | python__cpython-121714 | # `python -m asyncio` returns 0 when failing with ENOTTY in the runner thread
# Bug report
### Bug description:
The return code at the end here is `0` when it should be `25` aka `ENOTTY`:
```
import subprocess
proc = subprocess.Popen(["./python", "-m", "asyncio"], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
with proc:
try:
out, err = proc.communicate()
finally:
proc.kill()
proc.returncode
```
note: I tested this with `--disable-gil` configured
### CPython versions tested on:
CPython main branch
### Operating systems tested on:
Linux
<!-- gh-linked-prs -->
### Linked PRs
* gh-121714
* gh-121718
<!-- /gh-linked-prs -->
| a1834742936a3a2164c25c14ecf4ae6a95288ca3 | 178e44de8f023be7a5dc400044ab61983b191f24 |
python/cpython | python__cpython-121713 | # Incomplete test coverage for `unittest.util`
# Bug report
### Bug description:
`safe_repr`, `sorted_list_difference` and `unorderable_list_difference` inside `unittest.util` are not properly tested. I'll send a PR shortly with some tests ;)
### CPython versions tested on:
CPython main branch
### Operating systems tested on:
Linux
<!-- gh-linked-prs -->
### Linked PRs
* gh-121713
* gh-121737
* gh-121738
<!-- /gh-linked-prs -->
| 901ea411bf51f59f2a4b0b4fec6f60d29c76ca05 | a2bec77d25b11f50362a7117223f6d1d5029a909 |
python/cpython | python__cpython-121701 | # Emscripten trampolines not quite right since #106219
# Bug report
### Bug description:
`pycore_emscripten_trampoline.h` defines `_PyCFunctionWithKeywords_TrampolineCall` as a macro but `pycore_object.h` tries to declare it. This leads to a compile error. The fix is to delete the declaration from `pycore_object.h`.
```patch
--- a/Include/internal/pycore_object.h
+++ b/Include/internal/pycore_object.h
@@ -733,13 +733,7 @@ PyAPI_FUNC(PyObject*) _PyObject_GetState(PyObject *);
* Third party code unintentionally rely on problematic fpcasts. The call
* trampoline mitigates common occurrences of bad fpcasts on Emscripten.
*/
-#if defined(__EMSCRIPTEN__) && defined(PY_CALL_TRAMPOLINE)
-#define _PyCFunction_TrampolineCall(meth, self, args) \
- _PyCFunctionWithKeywords_TrampolineCall( \
- (*(PyCFunctionWithKeywords)(void(*)(void))(meth)), (self), (args), NULL)
-extern PyObject* _PyCFunctionWithKeywords_TrampolineCall(
- PyCFunctionWithKeywords meth, PyObject *, PyObject *, PyObject *);
-#else
+#if !(defined(__EMSCRIPTEN__) && defined(PY_CALL_TRAMPOLINE))
#define _PyCFunction_TrampolineCall(meth, self, args) \
(meth)((self), (args))
#define _PyCFunctionWithKeywords_TrampolineCall(meth, self, args, kw) \
```
### CPython versions tested on:
CPython main branch
### Operating systems tested on:
Other
<!-- gh-linked-prs -->
### Linked PRs
* gh-121701
* gh-121744
* gh-133984
<!-- /gh-linked-prs -->
| 3086b86cfda829e23a71569908edbfbcdc16327f | 04130b290b545e64625c07dc8fa2709d17e70880 |
python/cpython | python__cpython-121699 | # Emscripten: Use updated WebAssembly type reflection proposal
# Bug report
### Bug description:
The way to use WebAssembly type reflection has changed from a static method `WebAssembly.Function.type(wasmFunc)` to an instance method `wasmFunc.type()`. We use the old version here:
https://github.com/python/cpython/blob/main/Python/emscripten_trampoline.c?plain=1#L46
This needs to be updated as follows:
```patch
--- a/Python/emscripten_trampoline.c
+++ b/Python/emscripten_trampoline.c
@@ -43,7 +43,7 @@ EM_JS(int, _PyEM_CountFuncParams, (PyCFunctionWithKeywords func),
if (n !== undefined) {
return n;
}
- n = WebAssembly.Function.type(wasmTable.get(func)).parameters.length;
+ n = wasmTable.get(func).type().parameters.length;
_PyEM_CountFuncParams.cache.set(func, n);
return n;
}
```
### CPython versions tested on:
CPython main branch
### Operating systems tested on:
Other
<!-- gh-linked-prs -->
### Linked PRs
* gh-121699
* gh-121745
<!-- /gh-linked-prs -->
| cae15267166e217822e3c58ac22b7817162f323a | 3086b86cfda829e23a71569908edbfbcdc16327f |
python/cpython | python__cpython-121677 | # Python implementation of `functools.reduce` accepts keyword arguments, while the C implementation does not
# Bug report
### Bug description:
Steps to reproduce:
```python
printf '*disabled*\n_functools\n' > Modules/Setup.local
./configure --with-pydebug && make -j
./python
Python 3.14.0a0 (heads/main:dc03ce797a, Jul 13 2024, 09:31:53) [GCC 13.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import functools
>>> functools.reduce(function=lambda x, y: x + y, sequence=[1, 2, 3, 4, 5])
15
```
Our docs mention `functools.reduce` as a function that accepts positional-only arguments.
I have a PR ready to fix that.
### CPython versions tested on:
CPython main branch
### Operating systems tested on:
Linux
<!-- gh-linked-prs -->
### Linked PRs
* gh-121677
<!-- /gh-linked-prs -->
| d903b17499b1a3bfb3ea848f6a1b6da02eac3328 | c5438fdf4706a70bdd19338edc000dacffff6837 |
python/cpython | python__cpython-121674 | # Incomplete test coverage for `ast.get_docstring`
# Bug report
### Bug description:
The `ast.get_docstring` is missing test coverage:

I'll send a PR with some additional tests ;)
### CPython versions tested on:
CPython main branch
### Operating systems tested on:
Linux
<!-- gh-linked-prs -->
### Linked PRs
* gh-121674
* gh-121690
* gh-121691
<!-- /gh-linked-prs -->
| 0a26aa5007cb32610366c31fbac846b5fe2f4f90 | fc2178117538c161471711073887f34bcd464cc1 |
python/cpython | python__cpython-121661 | # `ga_getitem` can fail if `Py_GenericAlias` returns `NULL`
# Bug report
This code is problematic: https://github.com/python/cpython/blob/dc03ce797ae8786a9711e6ee5dcaadde02c55864/Objects/genericaliasobject.c#L565-L569
Why? `Py_GenericAlias` can return `NULL` in different cases: https://github.com/python/cpython/blob/dc03ce797ae8786a9711e6ee5dcaadde02c55864/Objects/genericaliasobject.c#L995-L999
So, we need to check for `NULL`.
<!-- gh-linked-prs -->
### Linked PRs
* gh-121661
* gh-121761
* gh-121762
<!-- /gh-linked-prs -->
| bb802db8cfa35a88582be32fae05fe1cf8f237b1 | 6505bda85a3b11c9012707896b0c3dee8a3855cb |
python/cpython | python__cpython-121680 | # Incorrect error message for `yield from`
# Bug report
### Bug description:
```python
% ./python.exe -c 'yield x'
File "<string>", line 1
SyntaxError: 'yield' outside function
% ./python.exe -c 'yield from x'
File "<string>", line 1
SyntaxError: 'yield' outside function
% ./python.exe -c 'async def f(): yield from x'
File "<string>", line 1
SyntaxError: 'yield from' inside async function
```
The middle one should also say "yield from".
### CPython versions tested on:
CPython main branch
### Operating systems tested on:
_No response_
<!-- gh-linked-prs -->
### Linked PRs
* gh-121680
* gh-121722
* gh-121768
* gh-121769
* gh-121961
* gh-121962
<!-- /gh-linked-prs -->
| 178e44de8f023be7a5dc400044ab61983b191f24 | f4d6e45c1e7161878b36ef9e876ca3e44b80a97d |
python/cpython | python__cpython-122457 | # Limited API way of assigning to immutable types and/or making a class immutable
# Feature or enhancement
### Proposal:
This is one of the uglier bits of Cython's limited API implementation.
When we create our extension type ("cdef classes") we want them to be presented to users as immutable (mainly because that's what they are in non-limited-API modes and we want it to remain the same).
However, we do want to assign things to the type dict *just after* type creation (i.e. before it's presented to the user). That's for 2 things:
```cython
cdef class Example:
class_attribute = 1 # needs assigning
def f(self): # also needs assigning
pass
```
We make `f` our own function type (to get better introspection that the default Python C function), so need to be able to assign those functions into the class namespace (i.e. we don't want to just use `PyMethodDef`).
What doesn't work:
* `PyObject_SetAttr` - fails because the type is immutable
* getting `__dict__` - returns a read-only proxy
* `PyType_GetDict` - not in the Limited API.
My current workaround is to use `PyObject_GenericSetAttr`. This is *supposed* to be used as a good initial value of `tp_setattro` for mutable types. However, it doesn't check the mutability of the type, and does succeed in modifying immutable types. However, it feels like I'm misusing non-documented unintended behaviour in something.
Solutions I think could work:
* expose `PyType_GetDict`,
* some official way to set an attribute of an immutable type (that could just be deciding my `GenericGetAttr` way is actually fine),
* some way to change a mutable type to immutable (so we create it as mutable, make the additions we need, then change it to immutable).
* something else I haven't thought of?
@markshannon @encukou @vstinner tagging you as people who might have an interest in this. Not urgent though - we have a functioning workaround.
### Has this already been discussed elsewhere?
No response given
### Links to previous discussion of this feature:
_No response_
<!-- gh-linked-prs -->
### Linked PRs
* gh-122457
* gh-124789
<!-- /gh-linked-prs -->
| db96327203b09ada45f2214567f92fe4d837f82a | da8673da362a2135cd621ac619d3aced6bb55100 |
python/cpython | python__cpython-121653 | # `weakrefobject.c` doesn't handle `allocate_weakref` failures
# Bug report
We need to handle the case where `allocate_weakref` returns `NULL` due to an out-of-memory error.
https://github.com/python/cpython/blob/dc03ce797ae8786a9711e6ee5dcaadde02c55864/Objects/weakrefobject.c#L428-L439
<!-- gh-linked-prs -->
### Linked PRs
* gh-121653
* gh-121721
<!-- /gh-linked-prs -->
| a640a605a8a1a3f73b98f948d0c2a7d42134f692 | a1834742936a3a2164c25c14ecf4ae6a95288ca3 |
python/cpython | python__cpython-121724 | # ``test_pdb`` fails with an ``--forever`` argument
# Bug report
### Bug description:
```python
./python -m test -v test_pdb --forever
== CPython 3.14.0a0 (heads/main:dc03ce797a, Jul 12 2024, 21:10:05) [Clang 15.0.0 (clang-1500.3.9.4)]
== macOS-14.5-arm64-arm-64bit-Mach-O little-endian
== Python build: debug
== cwd: /Users/admin/Projects/cpython/build/test_python_worker_92101æ
== CPU count: 8
== encodings: locale=UTF-8 FS=utf-8
== resources: all test resources are disabled, use -u option to unskip tests
Using random seed: 265477390
0:00:00 load avg: 1.70 Run tests sequentially in a single process
0:00:00 load avg: 1.70 [ 1] test_pdb
test_checkline_after_reset (test.test_pdb.ChecklineTests.test_checkline_after_reset) ... ok
test_checkline_before_debugging (test.test_pdb.ChecklineTests.test_checkline_before_debugging) ... ok
test_checkline_is_not_executable (test.test_pdb.ChecklineTests.test_checkline_is_not_executable) ... ok
test_blocks_at_first_code_line (test.test_pdb.PdbTestCase.test_blocks_at_first_code_line) ... ok
test_breakpoint (test.test_pdb.PdbTestCase.test_breakpoint) ... ok
test_dir_as_script (test.test_pdb.PdbTestCase.test_dir_as_script) ... ok
test_errors_in_command (test.test_pdb.PdbTestCase.test_errors_in_command) ... ok
test_file_modified_after_execution (test.test_pdb.PdbTestCase.test_file_modified_after_execution) ... ok
test_file_modified_after_execution_with_multiple_instances (test.test_pdb.PdbTestCase.test_file_modified_after_execution_with_multiple_instances) ... ok
test_file_modified_after_execution_with_restart (test.test_pdb.PdbTestCase.test_file_modified_after_execution_with_restart) ... ok
test_find_function_empty_file (test.test_pdb.PdbTestCase.test_find_function_empty_file) ... ok
test_find_function_first_executable_line (test.test_pdb.PdbTestCase.test_find_function_first_executable_line) ... ok
test_find_function_found (test.test_pdb.PdbTestCase.test_find_function_found) ... ok
test_find_function_found_with_bom (test.test_pdb.PdbTestCase.test_find_function_found_with_bom) ... ok
test_find_function_found_with_encoding_cookie (test.test_pdb.PdbTestCase.test_find_function_found_with_encoding_cookie) ... ok
test_gh_93696_frozen_list (test.test_pdb.PdbTestCase.test_gh_93696_frozen_list) ... ok
test_gh_94215_crash (test.test_pdb.PdbTestCase.test_gh_94215_crash) ... ok
test_header (test.test_pdb.PdbTestCase.test_header) ... ok
test_invalid_cmd_line_options (test.test_pdb.PdbTestCase.test_invalid_cmd_line_options) ... ok
test_issue13120 (test.test_pdb.PdbTestCase.test_issue13120) ... ok
test_issue13183 (test.test_pdb.PdbTestCase.test_issue13183) ... ok
test_issue16180 (test.test_pdb.PdbTestCase.test_issue16180) ... ok
test_issue26053 (test.test_pdb.PdbTestCase.test_issue26053) ... ok
test_issue34266 (test.test_pdb.PdbTestCase.test_issue34266)
do_run handles exceptions from parsing its arg ... ok
test_issue36250 (test.test_pdb.PdbTestCase.test_issue36250) ... ok
test_issue42383 (test.test_pdb.PdbTestCase.test_issue42383) ... ok
test_issue42384 (test.test_pdb.PdbTestCase.test_issue42384)
When running `python foo.py` sys.path[0] is an absolute path. `python -m pdb foo.py` should behave the same ... ok
test_issue42384_symlink (test.test_pdb.PdbTestCase.test_issue42384_symlink)
When running `python foo.py` sys.path[0] resolves symlinks. `python -m pdb foo.py` should behave the same ... ok
test_issue46434 (test.test_pdb.PdbTestCase.test_issue46434) ... ok
test_issue7964 (test.test_pdb.PdbTestCase.test_issue7964) ... ok
test_issue84583 (test.test_pdb.PdbTestCase.test_issue84583) ... ok
test_module_is_run_as_main (test.test_pdb.PdbTestCase.test_module_is_run_as_main) ... ok
test_module_without_a_main (test.test_pdb.PdbTestCase.test_module_without_a_main) ... ok
test_non_utf8_encoding (test.test_pdb.PdbTestCase.test_non_utf8_encoding) ... ok
test_nonexistent_module (test.test_pdb.PdbTestCase.test_nonexistent_module) ... ok
test_package_without_a_main (test.test_pdb.PdbTestCase.test_package_without_a_main) ... ok
test_pdbrc_alias (test.test_pdb.PdbTestCase.test_pdbrc_alias) ... ok
test_pdbrc_basic (test.test_pdb.PdbTestCase.test_pdbrc_basic) ... ok
test_pdbrc_commands (test.test_pdb.PdbTestCase.test_pdbrc_commands) ... ok
test_pdbrc_empty_line (test.test_pdb.PdbTestCase.test_pdbrc_empty_line)
Test that empty lines in .pdbrc are ignored. ... ok
test_pdbrc_semicolon (test.test_pdb.PdbTestCase.test_pdbrc_semicolon) ... ok
test_post_mortem_restart (test.test_pdb.PdbTestCase.test_post_mortem_restart) ... ok
test_readrc_homedir (test.test_pdb.PdbTestCase.test_readrc_homedir) ... ok
test_readrc_kwarg (test.test_pdb.PdbTestCase.test_readrc_kwarg) ... ok
test_relative_imports (test.test_pdb.PdbTestCase.test_relative_imports) ... ok
test_relative_imports_on_plain_module (test.test_pdb.PdbTestCase.test_relative_imports_on_plain_module) ... ok
test_run_module (test.test_pdb.PdbTestCase.test_run_module) ... ok
test_run_module_with_args (test.test_pdb.PdbTestCase.test_run_module_with_args) ... ok
test_run_pdb_with_pdb (test.test_pdb.PdbTestCase.test_run_pdb_with_pdb) ... ok
test_safe_path (test.test_pdb.PdbTestCase.test_safe_path)
With safe_path set, pdb should not mangle sys.path[0] ... ok
test_spec (test.test_pdb.PdbTestCase.test_spec) ... ok
test_zipapp (test.test_pdb.PdbTestCase.test_zipapp) ... ok
setUpClass (test.test_pdb.PdbTestReadline) ... skipped 'libedit readline is not supported for pdb'
test_convenience_variables (test.test_pdb)
Doctest: test.test_pdb.test_convenience_variables ... ok
test_list_commands (test.test_pdb)
Doctest: test.test_pdb.test_list_commands ... ok
test_next_until_return_at_return_event (test.test_pdb)
Doctest: test.test_pdb.test_next_until_return_at_return_event ... ok
test_pdb_alias_command (test.test_pdb)
Doctest: test.test_pdb.test_pdb_alias_command ... ok
test_pdb_ambiguous_statements (test.test_pdb)
Doctest: test.test_pdb.test_pdb_ambiguous_statements ... ok
test_pdb_basic_commands (test.test_pdb)
Doctest: test.test_pdb.test_pdb_basic_commands ... ok
test_pdb_breakpoint_commands (test.test_pdb)
Doctest: test.test_pdb.test_pdb_breakpoint_commands ... ok
test_pdb_breakpoint_with_filename (test.test_pdb)
Doctest: test.test_pdb.test_pdb_breakpoint_with_filename ... ok
test_pdb_breakpoints_preserved_across_interactive_sessions (test.test_pdb)
Doctest: test.test_pdb.test_pdb_breakpoints_preserved_across_interactive_sessions ... ok
test_pdb_closure (test.test_pdb)
Doctest: test.test_pdb.test_pdb_closure ... ok
test_pdb_continue_in_bottomframe (test.test_pdb)
Doctest: test.test_pdb.test_pdb_continue_in_bottomframe ... ok
test_pdb_display_command (test.test_pdb)
Doctest: test.test_pdb.test_pdb_display_command ... ok
test_pdb_displayhook (test.test_pdb)
Doctest: test.test_pdb.test_pdb_displayhook ... ok
test_pdb_empty_line (test.test_pdb)
Doctest: test.test_pdb.test_pdb_empty_line ... ok
test_pdb_f_trace_lines (test.test_pdb)
Doctest: test.test_pdb.test_pdb_f_trace_lines ... ok
test_pdb_function_break (test.test_pdb)
Doctest: test.test_pdb.test_pdb_function_break ... ok
test_pdb_interact_command (test.test_pdb)
Doctest: test.test_pdb.test_pdb_interact_command ... ok
test_pdb_invalid_arg (test.test_pdb)
Doctest: test.test_pdb.test_pdb_invalid_arg ... ok
test_pdb_issue_20766 (test.test_pdb)
Doctest: test.test_pdb.test_pdb_issue_20766 ... ok
test_pdb_issue_43318 (test.test_pdb)
Doctest: test.test_pdb.test_pdb_issue_43318 ... ok
test_pdb_issue_gh_101517 (test.test_pdb)
Doctest: test.test_pdb.test_pdb_issue_gh_101517 ... ok
test_pdb_issue_gh_101673 (test.test_pdb)
Doctest: test.test_pdb.test_pdb_issue_gh_101673 ... ok
test_pdb_issue_gh_103225 (test.test_pdb)
Doctest: test.test_pdb.test_pdb_issue_gh_103225 ... ok
test_pdb_issue_gh_108976 (test.test_pdb)
Doctest: test.test_pdb.test_pdb_issue_gh_108976 ... ok
test_pdb_issue_gh_65052 (test.test_pdb)
Doctest: test.test_pdb.test_pdb_issue_gh_65052 ... ok
test_pdb_issue_gh_80731 (test.test_pdb)
Doctest: test.test_pdb.test_pdb_issue_gh_80731 ... ok
test_pdb_issue_gh_91742 (test.test_pdb)
Doctest: test.test_pdb.test_pdb_issue_gh_91742 ... ok
test_pdb_issue_gh_94215 (test.test_pdb)
Doctest: test.test_pdb.test_pdb_issue_gh_94215 ... ok
test_pdb_multiline_statement (test.test_pdb)
Doctest: test.test_pdb.test_pdb_multiline_statement ... ok
test_pdb_next_command_for_asyncgen (test.test_pdb)
Doctest: test.test_pdb.test_pdb_next_command_for_asyncgen ... ok
test_pdb_next_command_for_coroutine (test.test_pdb)
Doctest: test.test_pdb.test_pdb_next_command_for_coroutine ... ok
test_pdb_next_command_for_generator (test.test_pdb)
Doctest: test.test_pdb.test_pdb_next_command_for_generator ... ok
test_pdb_next_command_in_generator_for_loop (test.test_pdb)
Doctest: test.test_pdb.test_pdb_next_command_in_generator_for_loop ... ok
test_pdb_next_command_subiterator (test.test_pdb)
Doctest: test.test_pdb.test_pdb_next_command_subiterator ... ok
test_pdb_pp_repr_exc (test.test_pdb)
Doctest: test.test_pdb.test_pdb_pp_repr_exc ... ok
test_pdb_return_command_for_coroutine (test.test_pdb)
Doctest: test.test_pdb.test_pdb_return_command_for_coroutine ... ok
test_pdb_return_command_for_generator (test.test_pdb)
Doctest: test.test_pdb.test_pdb_return_command_for_generator ... ok
test_pdb_return_to_different_file (test.test_pdb)
Doctest: test.test_pdb.test_pdb_return_to_different_file ... ok
test_pdb_run_with_code_object (test.test_pdb)
Doctest: test.test_pdb.test_pdb_run_with_code_object ... ok
test_pdb_run_with_incorrect_argument (test.test_pdb)
Doctest: test.test_pdb.test_pdb_run_with_incorrect_argument ... ok
test_pdb_show_attribute_and_item (test.test_pdb)
Doctest: test.test_pdb.test_pdb_show_attribute_and_item ... ok
test_pdb_skip_modules (test.test_pdb)
Doctest: test.test_pdb.test_pdb_skip_modules ... ok
test_pdb_skip_modules_with_callback (test.test_pdb)
Doctest: test.test_pdb.test_pdb_skip_modules_with_callback ... ok
test_pdb_until_command_for_coroutine (test.test_pdb)
Doctest: test.test_pdb.test_pdb_until_command_for_coroutine ... ok
test_pdb_until_command_for_generator (test.test_pdb)
Doctest: test.test_pdb.test_pdb_until_command_for_generator ... ok
test_pdb_whatis_command (test.test_pdb)
Doctest: test.test_pdb.test_pdb_whatis_command ... ok
test_pdb_where_command (test.test_pdb)
Doctest: test.test_pdb.test_pdb_where_command ... ok
test_pdb_with_inline_breakpoint (test.test_pdb)
Doctest: test.test_pdb.test_pdb_with_inline_breakpoint ... ok
test_post_mortem (test.test_pdb)
Doctest: test.test_pdb.test_post_mortem ... ok
test_post_mortem_cause_no_context (test.test_pdb)
Doctest: test.test_pdb.test_post_mortem_cause_no_context ... ok
test_post_mortem_chained (test.test_pdb)
Doctest: test.test_pdb.test_post_mortem_chained ... ok
test_post_mortem_complex (test.test_pdb)
Doctest: test.test_pdb.test_post_mortem_complex ... ok
test_post_mortem_context_of_the_cause (test.test_pdb)
Doctest: test.test_pdb.test_post_mortem_context_of_the_cause ... ok
test_post_mortem_from_no_stack (test.test_pdb)
Doctest: test.test_pdb.test_post_mortem_from_no_stack ... ok
test_post_mortem_from_none (test.test_pdb)
Doctest: test.test_pdb.test_post_mortem_from_none ... ok
test_post_mortem_single_no_stack (test.test_pdb)
Doctest: test.test_pdb.test_post_mortem_single_no_stack ... ok
----------------------------------------------------------------------
Ran 108 tests in 4.367s
OK (skipped=1)
0:00:04 load avg: 1.80 [ 2] test_pdb
test_checkline_after_reset (test.test_pdb.ChecklineTests.test_checkline_after_reset) ... ok
test_checkline_before_debugging (test.test_pdb.ChecklineTests.test_checkline_before_debugging) ... ok
test_checkline_is_not_executable (test.test_pdb.ChecklineTests.test_checkline_is_not_executable) ... ok
test_blocks_at_first_code_line (test.test_pdb.PdbTestCase.test_blocks_at_first_code_line) ... ok
test_breakpoint (test.test_pdb.PdbTestCase.test_breakpoint) ... ok
test_dir_as_script (test.test_pdb.PdbTestCase.test_dir_as_script) ... ok
test_errors_in_command (test.test_pdb.PdbTestCase.test_errors_in_command) ... ok
test_file_modified_after_execution (test.test_pdb.PdbTestCase.test_file_modified_after_execution) ... ok
test_file_modified_after_execution_with_multiple_instances (test.test_pdb.PdbTestCase.test_file_modified_after_execution_with_multiple_instances) ... ok
test_file_modified_after_execution_with_restart (test.test_pdb.PdbTestCase.test_file_modified_after_execution_with_restart) ... ok
test_find_function_empty_file (test.test_pdb.PdbTestCase.test_find_function_empty_file) ... ok
test_find_function_first_executable_line (test.test_pdb.PdbTestCase.test_find_function_first_executable_line) ... ok
test_find_function_found (test.test_pdb.PdbTestCase.test_find_function_found) ... ok
test_find_function_found_with_bom (test.test_pdb.PdbTestCase.test_find_function_found_with_bom) ... ok
test_find_function_found_with_encoding_cookie (test.test_pdb.PdbTestCase.test_find_function_found_with_encoding_cookie) ... ok
test_gh_93696_frozen_list (test.test_pdb.PdbTestCase.test_gh_93696_frozen_list) ... ok
test_gh_94215_crash (test.test_pdb.PdbTestCase.test_gh_94215_crash) ... ok
test_header (test.test_pdb.PdbTestCase.test_header) ... FAIL
======================================================================
FAIL: test_header (test.test_pdb.PdbTestCase.test_header)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/admin/Projects/cpython/Lib/test/test_pdb.py", line 3394, in test_header
self.assertEqual(stdout.getvalue(), header + '\n')
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: '' != 'Nobody expects... blah, blah, blah\n'
+ Nobody expects... blah, blah, blah
----------------------------------------------------------------------
Ran 18 tests in 0.812s
FAILED (failures=1)
test test_pdb failed
== Tests result: FAILURE ==
1 test failed:
test_pdb
1 test OK.
Total duration: 5.4 sec
Total tests: run=126 failures=1 skipped=1
Total test files: run=2 failed=1
Result: FAILURE
```
### CPython versions tested on:
CPython main branch
### Operating systems tested on:
macOS
<!-- gh-linked-prs -->
### Linked PRs
* gh-121724
<!-- /gh-linked-prs -->
| c0af6d4ff1705d9857c9f2e96acc142c5b8b84e9 | a640a605a8a1a3f73b98f948d0c2a7d42134f692 |
python/cpython | python__cpython-121646 | # [C API] Add PyBytes_Join() function
# Feature or enhancement
Python 3.13 alpha 1 removed the private `_PyBytes_Join(sep, iterable)` function which calls `sep.join(iterable)`.
mypyc uses it. Since we already have `PyUnicode_Join(sep, iterable)`, I propose to add a new `PyBytes_Join()` function.
In practice, it's just about renaming `_PyBytes_Join()` to `PyBytes_Join()`.
<!-- gh-linked-prs -->
### Linked PRs
* gh-121646
* gh-123783
<!-- /gh-linked-prs -->
| 3d60dfbe1755e00ab20d0ee81281886be77ad5da | 7fca268beee8ed13a8f161f0a0d5e21ff52d1ac1 |
python/cpython | python__cpython-121656 | # Python/compile.c:7482: int compute_code_flags(struct compiler *): Assertion `IS_TOP_LEVEL_AWAIT(c) || _PyST_IsFunctionLike(ste)' failed
# Crash report
### What happened?
```
~/p/cpython ❯❯❯ ./python.exe -c 'compile("assert await u", "", "exec", optimize=2)'
Assertion failed: (IS_TOP_LEVEL_AWAIT(c) || _PyST_IsFunctionLike(ste)), function compute_code_flags, file compile.c, line 7482.
fish: Job 1, './python.exe -c 'compile("asser…' terminated by signal SIGABRT (Abort)
```
Full stacktrace:
```
fuzz_pycompile: Python/compile.c:7482: int compute_code_flags(struct compiler *): Assertion `IS_TOP_LEVEL_AWAIT(c) \|\| _PyST_IsFunctionLike(ste)' failed.
--
| ==24717== ERROR: libFuzzer: deadly signal
| #0 0x59033612cf71 in __sanitizer_print_stack_trace /src/llvm-project/compiler-rt/lib/asan/asan_stack.cpp:87:3
| #1 0x59033602fd98 in fuzzer::PrintStackTrace() /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerUtil.cpp:210:5
| #2 0x590336012ac3 in fuzzer::Fuzzer::CrashCallback() /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:231:3
| #3 0x79353882e41f in libpthread.so.0
| #4 0x79353862800a in __libc_signal_restore_set /build/glibc-SzIz7B/glibc-2.31/sysdeps/unix/sysv/linux/internal-signals.h:86:3
| #5 0x79353862800a in raise /build/glibc-SzIz7B/glibc-2.31/sysdeps/unix/sysv/linux/raise.c:48:3
| #6 0x793538607858 in abort /build/glibc-SzIz7B/glibc-2.31/stdlib/abort.c:79:7
| #7 0x793538607728 in __assert_fail_base /build/glibc-SzIz7B/glibc-2.31/assert/assert.c:92:3
| #8 0x793538618fd5 in __assert_fail /build/glibc-SzIz7B/glibc-2.31/assert/assert.c:101:3
| #9 0x5903364b52da in compute_code_flags cpython3/Python/compile.c:7482:9
| #10 0x5903364b52da in optimize_and_assemble cpython3/Python/compile.c:7578:22
| #11 0x5903364af709 in compiler_mod cpython3/Python/compile.c:1597:10
| #12 0x5903364af709 in _PyAST_Compile cpython3/Python/compile.c:422:24
| #13 0x59033660c8a0 in Py_CompileStringObject cpython3/Python/pythonrun.c:1450:10
| #14 0x59033660c994 in Py_CompileStringExFlags cpython3/Python/pythonrun.c:1463:10
| #15 0x590336161d2e in fuzz_pycompile cpython3/Modules/_xxtestfuzz/fuzzer.c:551:24
| #16 0x590336161d2e in _run_fuzz cpython3/Modules/_xxtestfuzz/fuzzer.c:570:14
| #17 0x590336161d2e in LLVMFuzzerTestOneInput cpython3/Modules/_xxtestfuzz/fuzzer.c:711:11
| #18 0x590336013fe0 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:614:13
| #19 0x590335ffe774 in fuzzer::RunOneTest(fuzzer::Fuzzer*, char const*, unsigned long) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:327:6
| #20 0x59033600420a in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:862:9
| #21 0x590336030602 in main /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerMain.cpp:20:10
| #22 0x793538609082 in __libc_start_main /build/glibc-SzIz7B/glibc-2.31/csu/libc-start.c:308:16
| #23 0x590335ff524d in _start
|
```
This regressed somewhere in https://github.com/python/cpython/compare/f62161837e68c1c77961435f1b954412dd5c2b65...690b9355e00d1ea52020fde3feb4c043a2b214e2
### CPython versions tested on:
CPython main branch
### Operating systems tested on:
Linux
### Output from running 'python -VV' on the command line:
_No response_
<!-- gh-linked-prs -->
### Linked PRs
* gh-121656
<!-- /gh-linked-prs -->
| 2762c6cc5e4c1c0d630568db5fbba7a3a71a507c | 69f2dc5c06e62b4a9eb4da8f0cd456cc09b998ed |
python/cpython | python__cpython-121622 | # asyncio module state should be locked with mutexes in free-threaded builds
# Feature or enhancement
### Proposal:
Please see issue title.
### Has this already been discussed elsewhere?
No response given
### Links to previous discussion of this feature:
_No response_
<!-- gh-linked-prs -->
### Linked PRs
* gh-121622
* gh-121695
* gh-121774
* gh-121864
* gh-121915
* gh-121939
* gh-121943
* gh-122046
* gh-122048
<!-- /gh-linked-prs -->
| 5d6861ad06b524358f52603f242e7c0d57532a58 | bb802db8cfa35a88582be32fae05fe1cf8f237b1 |
python/cpython | python__cpython-121616 | # Improve `module.rst` C-API docs
There are multiple places in https://github.com/python/cpython/blob/main/Doc/c-api/module.rst where exception are not mentioned in the docs.
Like:
https://github.com/python/cpython/blob/690b9355e00d1ea52020fde3feb4c043a2b214e2/Doc/c-api/module.rst#L685
Some functions do not even declare that they can return `NULL`. Like:
https://github.com/python/cpython/blob/690b9355e00d1ea52020fde3feb4c043a2b214e2/Doc/c-api/module.rst#L457-L470
I will send a PR with the fix.
<!-- gh-linked-prs -->
### Linked PRs
* gh-121616
* gh-121618
* gh-121619
<!-- /gh-linked-prs -->
| e6264b44dc7221c713b14dfa0f5929b33d362829 | 690b9355e00d1ea52020fde3feb4c043a2b214e2 |
python/cpython | python__cpython-121757 | # Copy-pasted multi-statement block cannot be extended with new REPL
# Bug report
### Bug description:
To reproduce, copy paste this into the Python REPL:
```python
from dataclasses import dataclass
@dataclass
class Point:
x: float
y: float
```
You'll see:
```pycon
>>> from dataclasses import dataclass
...
... @dataclass
... class Point:
... x: float
... y: float
...
>>>
```
Now attempt to edit that class to include `z: float` (in addition to `x: float` and `y: float`).
To do this, hit the up arrow key to edit the previous block and you'll see:
```pycon
>>> from dataclasses import dataclass
...
... @dataclass
... class Point:
... x: float
... y: float
```
Hitting Enter will then execute the block of code (notice that there's no blank line at the end):
```pycon
>>> from dataclasses import dataclass
...
... @dataclass
... class Point:
... x: float
... y: float
>>>
```
If `from dataclasses import dataclass` is not included in the pasted text, adding `z: float` is possible (as expected).
Given that, I suspect this is a special case related to there being multiple distinct top-level blocks/statements within the pasted text.
### CPython versions tested on:
3.13, CPython main branch
### Operating systems tested on:
Linux
<!-- gh-linked-prs -->
### Linked PRs
* gh-121757
* gh-121825
<!-- /gh-linked-prs -->
| 7d111dac160c658b277ec0fac75eee8edcfbe9dc | 2b1b68939b15b913080a3403e3ba18e2a1f520ef |
python/cpython | python__cpython-121667 | # Pasting 🏳️🌈 crashes the new Python REPL
# Crash report
### What happened?
To reproduce, start the new Python REPL in 3.13.0b3 and start to assign a string:
```bash
$ python3.13
Python 3.13.0b3 (main, Jul 2 2024, 13:24:06) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> flag = '
```
Then paste 🏳️🌈 and this happens:
```bash
$ python3.13
Python 3.13.0b3 (main, Jul 2 2024, 13:24:06) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> flag = '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/trey/.pyenv/versions/3.13.0b3/lib/python3.13/_pyrepl/__main__.py", line 3, in <module>
__pyrepl_interactive_console()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "/home/trey/.pyenv/versions/3.13.0b3/lib/python3.13/_pyrepl/main.py", line 55, in interactive_console
run_interactive(namespace)
~~~~~~~~~~~~~~~^^^^^^^^^^^
File "/home/trey/.pyenv/versions/3.13.0b3/lib/python3.13/_pyrepl/simple_interact.py", line 144, in run_multiline_interactive_console
statement = multiline_input(more_lines, ps1, ps2)
File "/home/trey/.pyenv/versions/3.13.0b3/lib/python3.13/_pyrepl/readline.py", line 385, in multiline_input
return reader.readline()
~~~~~~~~~~~~~~~^^
File "/home/trey/.pyenv/versions/3.13.0b3/lib/python3.13/_pyrepl/reader.py", line 768, in readline
self.handle1()
~~~~~~~~~~~~^^
File "/home/trey/.pyenv/versions/3.13.0b3/lib/python3.13/_pyrepl/reader.py", line 751, in handle1
self.do_cmd(cmd)
~~~~~~~~~~~^^^^^
File "/home/trey/.pyenv/versions/3.13.0b3/lib/python3.13/_pyrepl/reader.py", line 695, in do_cmd
self.refresh()
~~~~~~~~~~~~^^
File "/home/trey/.pyenv/versions/3.13.0b3/lib/python3.13/_pyrepl/reader.py", line 672, in refresh
self.screen = self.calc_screen()
~~~~~~~~~~~~~~~~^^
File "/home/trey/.pyenv/versions/3.13.0b3/lib/python3.13/_pyrepl/completing_reader.py", line 261, in calc_screen
screen = super().calc_screen()
File "/home/trey/.pyenv/versions/3.13.0b3/lib/python3.13/_pyrepl/reader.py", line 360, in calc_screen
l, l2 = disp_str(line)
~~~~~~~~^^^^^^
File "/home/trey/.pyenv/versions/3.13.0b3/lib/python3.13/_pyrepl/reader.py", line 61, in disp_str
b.append(str_width(c))
~~~~~~~~~^^^
File "/home/trey/.pyenv/versions/3.13.0b3/lib/python3.13/_pyrepl/utils.py", line 10, in str_width
if ord(c) < 128:
~~~^^^
TypeError: ord() expected a character, but string of length 6 found
```
This looks like an issue with multiple-character glyphs, as 🏴 causes the same issue.
I found myself at my system command prompt after this (Python had exited).
I initially tested this on Python 3.13.0b3, but I also reproduced the issue on the current `main` branch.
### CPython versions tested on:
CPython main branch
### Operating systems tested on:
Linux
### Output from running 'python -VV' on the command line:
Python 3.13.0b3 (main, Jul 2 2024, 13:24:06) [GCC 11.4.0]
<!-- gh-linked-prs -->
### Linked PRs
* gh-121667
* gh-121733
<!-- /gh-linked-prs -->
| e745996b2d24b9234f896bdc2f3320e49287dcd0 | 18015451d0e3f4d155d56f70faf9b76ce5b7ad79 |
python/cpython | python__cpython-121519 | # Improve/clarify importlib recipe for loading code from a source file path
> https://docs.python.org/3/library/importlib.html#importing-a-source-file-directly
Ahh -- thanks -- I hadn't found that.
That looks to me like it's the non-deprecated way to do:
`module = SourceFileLoader(name, path).load_module()`
Is that correct -- will it do the same thing?
In which case, I propose that that recipe be added to `importlib` as a utility function along the lines of:
```
def load_module_from_path(name, path):
"""
load a module from a file on disk
:param name: name of the module
:type name: str
:param path: path to the file
:type path: PathLike
:returns: instantiated module object
Note: The module is also added to sys.modules, and will behave the same as though
the file were on sys.path and imported the usual way.
"""
import os # import here, so that it only gets imported if needed.
path = os.fspath(path)
spec = importlib.util.spec_from_file_location(name, path)
module = importlib.util.module_from_spec(spec)
sys.modules[name] = module
spec.loader.exec_module(module)
return module
```
I understand that it was a deliberate decision to put the recipe in the docs, rather than a utility function, though unless it's really something that is "not recommended" (in which case perhaps it should say so in the docs) -- then this is just complex enough that a utility function is called for -- particularly since ` SourceFileLoader(name, path).load_module()` (now deprecated?) is advice readily found on the internet.
Does this need another issue or PR?
Meanwhile, for the original issue:
I suggest that checking for `__fspath__` be added to the: `FileLoader.__init__()` and perhaps a couple other places where file paths are initialized -- that is the "outer" parts of the importlib API.
Though for my use-case the proposed utility function would solve the problem at hand.
_Originally posted by @ChrisBarker-NOAA in https://github.com/python/cpython/issues/87005#issuecomment-2215359160_
<!-- gh-linked-prs -->
### Linked PRs
* gh-121519
* gh-124080
* gh-124081
<!-- /gh-linked-prs -->
| 38809171b8768517824fb62d48abe2cb0aff8429 | cd06f5e32369c7816c7360cbb20fbe9f38b4f3a7 |
python/cpython | python__cpython-121606 | # `test_pyrepl.run_repl` timeout is too small
The timeout in `run_repl` of 0.5 seconds is too small and leads to spurious failures on slow/heavily loaded machines, or when running with sanitizers:
https://github.com/python/cpython/blob/ef10110cd781afe8ddd3e65a54dc2b5ed2cb3187/Lib/test/test_pyrepl/test_pyrepl.py#L951
(This is my second attempt at describing the problems I ran into with https://github.com/python/cpython/issues/121603)
<!-- gh-linked-prs -->
### Linked PRs
* gh-121606
* gh-121702
* gh-121820
* gh-121823
<!-- /gh-linked-prs -->
| abc3aeebdbae560476f2f8c0312e9a4bf0dbfd33 | 0a26aa5007cb32610366c31fbac846b5fe2f4f90 |
python/cpython | python__cpython-121597 | # Sharing Interpreter Channels is Broken
# Bug report
### Bug description:
We try to load the channel end types from "test.support.interpreters.channel", which doesn't exist.
### CPython versions tested on:
CPython main branch
### Operating systems tested on:
_No response_
<!-- gh-linked-prs -->
### Linked PRs
* gh-121597
* gh-121600
<!-- /gh-linked-prs -->
| 35a67e36aa7cb0fc915771327f58bb0c70213867 | 7641743d48b276de88a709ad40d715b6c5d7a2ea |
python/cpython | python__cpython-121594 | # `select.poll()` objects are not thread-safe in the free-threaded build
# Bug report
The [polling objects](https://docs.python.org/3/library/select.html#poll-objects) returned by [`select.poll`](https://docs.python.org/3/library/select.html#select.poll) and related functions are not thread-safe in the free-threaded build.
The fix might be as simple as adding critical sections to the functions on `pollObject` or it may require more work.
The following test exercises the thread-unsafe behavior:
* `./python -m test test_poll -m test_threaded_poll`
Relevant object:
https://github.com/python/cpython/blob/3ec719fabf936ea7a012a76445b860759155de86/Modules/selectmodule.c#L434-L441
<!-- gh-linked-prs -->
### Linked PRs
* gh-121594
* gh-121623
<!-- /gh-linked-prs -->
| 44937d11a6a045a624918db78aa36e715ffabcd4 | e6264b44dc7221c713b14dfa0f5929b33d362829 |
python/cpython | python__cpython-121587 | # Can't build C extensions with --enable-pystats builds
# Bug report
### Bug description:
After building with `--enable-pystats`, you can't build any C extensions because `Python.h` includes `pycode_uop_ids.h` (indirectly).
```
In file included from /home/mdboom/Work/builds/cpython/Include/pystats.h:16,
from /home/mdboom/Work/builds/cpython/Include/Python.h:65,
from src/_imagingmorph.c:14:
/home/mdboom/Work/builds/cpython/Include/cpython/pystats.h:22:10: fatal error: pycore_uop_ids.h: No such file or directory
22 | #include "pycore_uop_ids.h"
| ^~~~~~~~~~~~~~~~~~
compilation terminated.
```
### CPython versions tested on:
CPython main branch
### Operating systems tested on:
Linux
<!-- gh-linked-prs -->
### Linked PRs
* gh-121587
* gh-121880
<!-- /gh-linked-prs -->
| f036a463dbc43d25712183dc6afa4e38c1aaf93d | 4e35dd607b0f32657341e6c4f583d14964ee1699 |
python/cpython | python__cpython-121572 | # Do not use `EnvironmentError` in tests, use `OSError` instead
# Bug report
Since 3.3 `EnvironmentError` is just an alias for `OSError`. There are several places where it is still used. I propose to modernize the code. Just like we did with `IOError`.
```diff
diff --git Lib/test/support/__init__.py Lib/test/support/__init__.py
index 18455bb6e0f..7f657931958 100644
--- Lib/test/support/__init__.py
+++ Lib/test/support/__init__.py
@@ -387,7 +387,7 @@ def skip_if_buildbot(reason=None):
reason = 'not suitable for buildbots'
try:
isbuildbot = getpass.getuser().lower() == 'buildbot'
- except (KeyError, EnvironmentError) as err:
+ except (KeyError, OSError) as err:
warnings.warn(f'getpass.getuser() failed {err}.', RuntimeWarning)
isbuildbot = False
return unittest.skipIf(isbuildbot, reason)
diff --git Lib/test/test_subprocess.py Lib/test/test_subprocess.py
index 8b69cd03ba7..9412a2d737b 100644
--- Lib/test/test_subprocess.py
+++ Lib/test/test_subprocess.py
@@ -1407,7 +1407,7 @@ def open_fds():
t = threading.Thread(target=open_fds)
t.start()
try:
- with self.assertRaises(EnvironmentError):
+ with self.assertRaises(OSError):
subprocess.Popen(NONEXISTING_CMD,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
```
<!-- gh-linked-prs -->
### Linked PRs
* gh-121572
* gh-121574
* gh-121575
<!-- /gh-linked-prs -->
| e2822360da30853f092d8a50ad83e52f6ea2ced9 | 22a0bdbf9a63f92f45106c7dc4377e45e0278e60 |
python/cpython | python__cpython-121568 | # Improve `slice` C-API docs by mentioning exceptions
There are two cases where we can add explicit `with exception set` part. First one is:
https://github.com/python/cpython/blob/9585a1a2a251aaa15baf6579e13dd3be0cb05f1f/Doc/c-api/slice.rst#L21-L27
Notice this part:
> Return `NULL` if the new object could not be allocated.
And:
https://github.com/python/cpython/blob/9585a1a2a251aaa15baf6579e13dd3be0cb05f1f/Doc/c-api/slice.rst#L90-L100
https://github.com/python/cpython/blob/9585a1a2a251aaa15baf6579e13dd3be0cb05f1f/Doc/c-api/slice.rst#L98
<!-- gh-linked-prs -->
### Linked PRs
* gh-121568
* gh-121578
* gh-121579
<!-- /gh-linked-prs -->
| 84a5597b08b7d53aced2fbd0048271ce762807a8 | cced22c760a9398c27f0381048a1b3eb2e8ef50d |
python/cpython | python__cpython-121563 | # hex_from_char run faster replacing switch-case with lookup table
# Feature or enhancement
### Proposal:
Replacing switch-case in `hex_from_char` with a lookup table makes python `float.fromhex(...)` run 4%-5% faster. Probably if we measure `hex_from_char` in isolation we will get a much greater % improvement.
https://github.com/python/cpython/blob/f62161837e68c1c77961435f1b954412dd5c2b65/Objects/floatobject.c#L1145-L1208
New `hex_from_char` code:
```C
int _char_to_hex[256] = {
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -1, -1, -1, -1, -1, -1,
-1, 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
};
static int
hex_from_char(unsigned char c) {
return _char_to_hex[c];
}
```
Timing with old `hex_from_char`:
``` bash
$ ./python -m pyperf timeit --duplicate 100 "float.fromhex('0x123456.ffffp10')"
.....................
Mean +- std dev: 86.0 ns +- 0.9 ns
```
With new `hex_from_char`:
``` bash
./python -m pyperf timeit --duplicate 100 "float.fromhex('0x123456.ffffp10')"
.....................
Mean +- std dev: 81.8 ns +- 1.0 ns
```
I will create a new PR.
### Has this already been discussed elsewhere?
No response given
### Links to previous discussion of this feature:
_No response_
<!-- gh-linked-prs -->
### Linked PRs
* gh-121563
<!-- /gh-linked-prs -->
| 04130b290b545e64625c07dc8fa2709d17e70880 | f6f4022a357f70f1c40945403065e81b6c2e4854 |
python/cpython | python__cpython-121555 | # remove _PyCompile_OpcodeHas* functions
There are a bunch of functions in compile.c that expose data from pycore_opcode_metadata.h as private C API. These are only used in Modules/_opcode.c.
However, Modules/_opcode.c can just include pycore_opcode_metadata.h and pycore_opcode_utils.h, and access this data directly.
<!-- gh-linked-prs -->
### Linked PRs
* gh-121555
<!-- /gh-linked-prs -->
| 6557af669899f18f8d123f8e1b6c3380d502c519 | ef10110cd781afe8ddd3e65a54dc2b5ed2cb3187 |
python/cpython | python__cpython-121548 | # duplicated code in compiler's const cache functions
There is code duplication between `_PyCompile_ConstCacheMergeOne` and `merge_consts_recursive` - the former can be implemented in terms of the latter if we add a boolean "is-recursive" arg.
<!-- gh-linked-prs -->
### Linked PRs
* gh-121548
<!-- /gh-linked-prs -->
| cced22c760a9398c27f0381048a1b3eb2e8ef50d | e2822360da30853f092d8a50ad83e52f6ea2ced9 |
python/cpython | python__cpython-121740 | # ContextVars are not thread-safe in the free-threaded build
# Bug report
The [ContextVar](https://docs.python.org/3/library/contextvars.html) implementation is not thread-safe in the free-threaded build:
In particular, the caching is not thread-safe, although there may be other thread-safety issues as well:
https://github.com/python/cpython/blob/9c08f40a613d9aee78de4ce4ec3e125d1496d148/Python/context.c#L206-L212
### Example Test Cases:
* `./python -m test test_context -m test_context_threads_1`
* `./python -m test test_decimal -m test_threading`
<!-- gh-linked-prs -->
### Linked PRs
* gh-121740
* gh-121808
<!-- /gh-linked-prs -->
| e904300882055bed71cae59f8ca9161066659b7c | 6b98b274b60a15b490d2ea85069638c037b2a9cd |
python/cpython | python__cpython-121543 | # email: documenting different behavior of trailing newline in `set_content` and `set_payload`
# Documentation
See #121515, which reported that `set_content()` implicitly adds a newline to the end of the content (if it doesn't have one already), whereas `set_payload()` ignores it. Unfortunately, this would be a breaking change to fix, so we should just document this behavior.
<!-- gh-linked-prs -->
### Linked PRs
* gh-121543
* gh-128995
* gh-128996
<!-- /gh-linked-prs -->
| fba475ae6f932d0aaee6832b4102b2d4c50df70f | 3de7cc15c2f3186b84c0fb105bc84c27e9589902 |
python/cpython | python__cpython-121534 | # `PyCell_[G,S]et` does not document that they set an exception
https://github.com/python/cpython/blob/9ba2a4638d7b620c939face7642b2f53a9fadc4b/Doc/c-api/cell.rst#L51-L56
We should add "returns `-1` with an exception set".
<!-- gh-linked-prs -->
### Linked PRs
* gh-121534
* gh-121539
* gh-121540
<!-- /gh-linked-prs -->
| 649d5b6d7b04607dd17810ac73e8f16720c6dc78 | 9ba2a4638d7b620c939face7642b2f53a9fadc4b |
python/cpython | python__cpython-121530 | # Undocumented from_ parameter in _mboxMMDF methods
Some _mboxMMDF methods have an extra from_ parameter which is currently undocumented.
<!-- gh-linked-prs -->
### Linked PRs
* gh-121530
* gh-131622
* gh-131623
<!-- /gh-linked-prs -->
| 557d2d20d484a7b22da39cdb876f6312ab66d561 | a9a399f0ecfeeff91425cc089057f1b95799853b |
python/cpython | python__cpython-121522 | # Detect when wasmtime is not installed in `Tools/wasm/wasi.py`
# Feature or enhancement
### Proposal:
Right now, `Tools/wasm/wasi.py` calls `shutil.which()` at the global level of the file. That means you can end up w/ `None` in your `HOSTRUNNER` environment variable.
### 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-121522
* gh-121558
<!-- /gh-linked-prs -->
| f62161837e68c1c77961435f1b954412dd5c2b65 | 80209468144fbd1af5cd31f152a6631627a9acab |
python/cpython | python__cpython-121531 | # The pyrepl cache doesn't play well with history
Type the following in the REPL:
```
>>> def foo():
... x = 1
... y = 2
... z = 3
...
>>> def bar():
... return 42
...
```
Now press up arrow 3 times to go to the `foo` function. The REPL shows:
```
>>> def bar():
... x = 1
... y = 2
... z = 3
```
which is a weird mix between the two entries.
I have bisected this to 32a0faba439b239d7b0c242c1e3cd2025c52b8cf
<!-- gh-linked-prs -->
### Linked PRs
* gh-121531
* gh-121679
<!-- /gh-linked-prs -->
| 4b9e10d0ea352592049c1f2a00318d7274143fa4 | e745996b2d24b9234f896bdc2f3320e49287dcd0 |
python/cpython | python__cpython-121498 | # Pyrepl doesn't respect correctly the history with input hook set
When an input hook is set, Pyrepl doesn't correctly display the history until a new key press is made.
<!-- gh-linked-prs -->
### Linked PRs
* gh-121498
* gh-121703
<!-- /gh-linked-prs -->
| 4e36dd7d87eb0f1bd1ecd53e368c16a5f75967a0 | dc03ce797ae8786a9711e6ee5dcaadde02c55864 |
python/cpython | python__cpython-121488 | # Deprecation warning for ATOMIC_VAR_INIT in mimalloc
# Bug report
### Bug description:
`ATOMIC_VAR_INIT` is marked as deprecated in C17 and C++20.
```cpp
/.../cpython/Include/internal/mimalloc/mimalloc/atomic.h:42:14: error: macro 'ATOMIC_VAR_INIT' has been marked as deprecated [-Werror,-Wdeprecated-pragma] (diff)
#if !defined(ATOMIC_VAR_INIT) || (__STDC_VERSION__ >= 201710L) // c17, see issue #735
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/15.0.0/include/stdatomic.h:54:41: note: macro marked 'deprecated' here
#pragma clang deprecated(ATOMIC_VAR_INIT)
```
This was fixed upstream but isn't included in the vendored copy.
https://github.com/microsoft/mimalloc/commit/36ee5f9024af87172fcb0fb8b20f8062fa3463d2
https://github.com/microsoft/mimalloc/commit/1325ee640aa429ff4db080458895c8864e406a95
https://github.com/microsoft/mimalloc/issues/735
### CPython versions tested on:
3.13, CPython main branch
### Operating systems tested on:
macOS
<!-- gh-linked-prs -->
### Linked PRs
* gh-121488
* gh-121504
<!-- /gh-linked-prs -->
| 31873bea471020ca5deaf735d9acb0f1abeb1d3c | db00fee3a22db1c4b893b432c64a8123d7e92322 |
python/cpython | python__cpython-121486 | # Use 64-bit integers for bit counts
Some internal C functions represent the number of bits in the Python integer as `size_t` or `Py_ssize_t`. It is fine on 64-bit platforms, where you need exbibytes of memory to get an overflow error. But on 32-bit platform you can create an integer objects that has a size of just 0.5 GiB.
This problem can be solved if always use 64-bit integers (`uint64_t` or `int64_t`) for bit counts. We can even introduce a hard limit for the range of integers in CPython (to $2^{2^{64}-1}$ or $2^{2^{63}-1}$) and remove the possibility of overflow error in `_PyLong_NumBits()` and `_PyLong_Frexp()`. No existing 64-bit platform supports such large address space, and even if they support, it would take years to create a single integer object of such size (just to fill memory).
<!-- gh-linked-prs -->
### Linked PRs
* gh-121486
<!-- /gh-linked-prs -->
| 32c7dbb2bc58bee953622fc5ac24aad123f0d8f2 | 58ce131037ecb34d506a613f21993cde2056f628 |
python/cpython | python__cpython-121478 | # PyLong_FromString() docs should point to C API functions rather than to int.to_bytes()/from_bytes()
Patch:
```diff
diff --git a/Doc/c-api/long.rst b/Doc/c-api/long.rst
index 42162914c0..a43a46a55a 100644
--- a/Doc/c-api/long.rst
+++ b/Doc/c-api/long.rst
@@ -94,9 +94,9 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate.
ignored. If there are no digits or *str* is not NULL-terminated following the
digits and trailing whitespace, :exc:`ValueError` will be raised.
- .. seealso:: Python methods :meth:`int.to_bytes` and :meth:`int.from_bytes`
- to convert a :c:type:`PyLongObject` to/from an array of bytes in base
- ``256``. You can call those from C using :c:func:`PyObject_CallMethod`.
+ .. seealso:: :c:func:`PyLong_AsNativeBytes()` and
+ :c:func:`PyLong_FromNativeBytes()` functions could be used to convert
+ a :c:type:`PyLongObject` to/from an array of bytes in base ``256``.
.. c:function:: PyObject* PyLong_FromUnicodeObject(PyObject *u, int base)
```
<!-- gh-linked-prs -->
### Linked PRs
* gh-121478
<!-- /gh-linked-prs -->
| ce4b9c8464706a58d0c98c2b0deeec07e7496ccc | e9287ea426e8e1b930f1c3f0cb949a1416d29090 |
python/cpython | python__cpython-121480 | # Barrier hangs indefinitely when arg `parties` < 0 or invalid type
# Bug report
### Bug description:
`threading.Barrier` at no point checks for valid `parties`. `parties`, of a negative value, or invalid type hang indefinitely on `.wait()`. This behavior is inconsistent from the behavior of any other `threading` primitives, which either conduct sanity checks on args during initialization, or fail at some point in their execution.
Steps to reproduce:
```python
from threading import Barrier
# negative
barrier = Barrier(-1) # <threading.Barrier at 0x10aa789b0: waiters=0/-1>
barrier.wait()
# invalid type string
barrier = Barrier("test") # <threading.Barrier at 0x10ae64980: waiters=0/test>
barrier.wait()
# invalid type float
barrier = Barrier(0.5) # <threading.Barrier at 0x10aa7a570: waiters=0/0.5>
barrier.wait()
# invalid type object
barrier = Barrier(object()) # <threading.Barrier at 0x10ae4f500: waiters=0/<object object at 0x10a878730>>
barrier.wait()
```
### CPython versions tested on:
CPython main branch
### Operating systems tested on:
macOS
<!-- gh-linked-prs -->
### Linked PRs
* gh-121480
* gh-122443
* gh-122444
<!-- /gh-linked-prs -->
| d27a53fc02a87e76066fc4e15ff1fff3922a482d | 3a9b2aae615165a40614db9aaa8b90c55ff0c7f9 |
python/cpython | python__cpython-121469 | # Mimalloc headers are not being installed
# Bug report
### Bug description:
An error in the makefile causes `make install` / `make inclinstall` to skip the `internal/mimalloc` headers. Instead the output for the corresponding line is
```
/bin/sh: 1: test: yes: unexpected operator
```
To fix that, the sting comparisons in these lines should only use a single `=`.
https://github.com/python/cpython/blob/b765e4adf858ff8a8646f38933a5a355b6d72760/Makefile.pre.in#L2655
https://github.com/python/cpython/blob/b765e4adf858ff8a8646f38933a5a355b6d72760/Makefile.pre.in#L2676
<details><summary>Full `make inclinstall` output</summary>
```
Creating directory /opt/include/python3.14
Creating directory /opt/include/python3.14/cpython
Creating directory /opt/include/python3.14/internal
/bin/sh: 1: test: yes: unexpected operator
/usr/bin/install -c -m 644 ./Include/Python.h /opt/include/python3.14
/usr/bin/install -c -m 644 ./Include/abstract.h /opt/include/python3.14
/usr/bin/install -c -m 644 ./Include/bltinmodule.h /opt/include/python3.14
/usr/bin/install -c -m 644 ./Include/boolobject.h /opt/include/python3.14
/usr/bin/install -c -m 644 ./Include/bytearrayobject.h /opt/include/python3.14
/usr/bin/install -c -m 644 ./Include/bytesobject.h /opt/include/python3.14
/usr/bin/install -c -m 644 ./Include/ceval.h /opt/include/python3.14
/usr/bin/install -c -m 644 ./Include/codecs.h /opt/include/python3.14
/usr/bin/install -c -m 644 ./Include/compile.h /opt/include/python3.14
/usr/bin/install -c -m 644 ./Include/complexobject.h /opt/include/python3.14
/usr/bin/install -c -m 644 ./Include/critical_section.h /opt/include/python3.14
/usr/bin/install -c -m 644 ./Include/datetime.h /opt/include/python3.14
/usr/bin/install -c -m 644 ./Include/descrobject.h /opt/include/python3.14
/usr/bin/install -c -m 644 ./Include/dictobject.h /opt/include/python3.14
/usr/bin/install -c -m 644 ./Include/dynamic_annotations.h /opt/include/python3.14
/usr/bin/install -c -m 644 ./Include/enumobject.h /opt/include/python3.14
/usr/bin/install -c -m 644 ./Include/errcode.h /opt/include/python3.14
/usr/bin/install -c -m 644 ./Include/exports.h /opt/include/python3.14
/usr/bin/install -c -m 644 ./Include/fileobject.h /opt/include/python3.14
/usr/bin/install -c -m 644 ./Include/fileutils.h /opt/include/python3.14
/usr/bin/install -c -m 644 ./Include/floatobject.h /opt/include/python3.14
/usr/bin/install -c -m 644 ./Include/frameobject.h /opt/include/python3.14
/usr/bin/install -c -m 644 ./Include/genericaliasobject.h /opt/include/python3.14
/usr/bin/install -c -m 644 ./Include/import.h /opt/include/python3.14
/usr/bin/install -c -m 644 ./Include/intrcheck.h /opt/include/python3.14
/usr/bin/install -c -m 644 ./Include/iterobject.h /opt/include/python3.14
/usr/bin/install -c -m 644 ./Include/listobject.h /opt/include/python3.14
/usr/bin/install -c -m 644 ./Include/lock.h /opt/include/python3.14
/usr/bin/install -c -m 644 ./Include/longobject.h /opt/include/python3.14
/usr/bin/install -c -m 644 ./Include/marshal.h /opt/include/python3.14
/usr/bin/install -c -m 644 ./Include/memoryobject.h /opt/include/python3.14
/usr/bin/install -c -m 644 ./Include/methodobject.h /opt/include/python3.14
/usr/bin/install -c -m 644 ./Include/modsupport.h /opt/include/python3.14
/usr/bin/install -c -m 644 ./Include/moduleobject.h /opt/include/python3.14
/usr/bin/install -c -m 644 ./Include/monitoring.h /opt/include/python3.14
/usr/bin/install -c -m 644 ./Include/object.h /opt/include/python3.14
/usr/bin/install -c -m 644 ./Include/objimpl.h /opt/include/python3.14
/usr/bin/install -c -m 644 ./Include/opcode.h /opt/include/python3.14
/usr/bin/install -c -m 644 ./Include/opcode_ids.h /opt/include/python3.14
/usr/bin/install -c -m 644 ./Include/osdefs.h /opt/include/python3.14
/usr/bin/install -c -m 644 ./Include/osmodule.h /opt/include/python3.14
/usr/bin/install -c -m 644 ./Include/patchlevel.h /opt/include/python3.14
/usr/bin/install -c -m 644 ./Include/py_curses.h /opt/include/python3.14
/usr/bin/install -c -m 644 ./Include/pyatomic.h /opt/include/python3.14
/usr/bin/install -c -m 644 ./Include/pybuffer.h /opt/include/python3.14
/usr/bin/install -c -m 644 ./Include/pycapsule.h /opt/include/python3.14
/usr/bin/install -c -m 644 ./Include/pydtrace.h /opt/include/python3.14
/usr/bin/install -c -m 644 ./Include/pyerrors.h /opt/include/python3.14
/usr/bin/install -c -m 644 ./Include/pyexpat.h /opt/include/python3.14
/usr/bin/install -c -m 644 ./Include/pyframe.h /opt/include/python3.14
/usr/bin/install -c -m 644 ./Include/pyhash.h /opt/include/python3.14
/usr/bin/install -c -m 644 ./Include/pylifecycle.h /opt/include/python3.14
/usr/bin/install -c -m 644 ./Include/pymacconfig.h /opt/include/python3.14
/usr/bin/install -c -m 644 ./Include/pymacro.h /opt/include/python3.14
/usr/bin/install -c -m 644 ./Include/pymath.h /opt/include/python3.14
/usr/bin/install -c -m 644 ./Include/pymem.h /opt/include/python3.14
/usr/bin/install -c -m 644 ./Include/pyport.h /opt/include/python3.14
/usr/bin/install -c -m 644 ./Include/pystate.h /opt/include/python3.14
/usr/bin/install -c -m 644 ./Include/pystats.h /opt/include/python3.14
/usr/bin/install -c -m 644 ./Include/pystrcmp.h /opt/include/python3.14
/usr/bin/install -c -m 644 ./Include/pystrtod.h /opt/include/python3.14
/usr/bin/install -c -m 644 ./Include/pythonrun.h /opt/include/python3.14
/usr/bin/install -c -m 644 ./Include/pythread.h /opt/include/python3.14
/usr/bin/install -c -m 644 ./Include/pytypedefs.h /opt/include/python3.14
/usr/bin/install -c -m 644 ./Include/rangeobject.h /opt/include/python3.14
/usr/bin/install -c -m 644 ./Include/refcount.h /opt/include/python3.14
/usr/bin/install -c -m 644 ./Include/setobject.h /opt/include/python3.14
/usr/bin/install -c -m 644 ./Include/sliceobject.h /opt/include/python3.14
/usr/bin/install -c -m 644 ./Include/structmember.h /opt/include/python3.14
/usr/bin/install -c -m 644 ./Include/structseq.h /opt/include/python3.14
/usr/bin/install -c -m 644 ./Include/sysmodule.h /opt/include/python3.14
/usr/bin/install -c -m 644 ./Include/traceback.h /opt/include/python3.14
/usr/bin/install -c -m 644 ./Include/tupleobject.h /opt/include/python3.14
/usr/bin/install -c -m 644 ./Include/typeslots.h /opt/include/python3.14
/usr/bin/install -c -m 644 ./Include/unicodeobject.h /opt/include/python3.14
/usr/bin/install -c -m 644 ./Include/warnings.h /opt/include/python3.14
/usr/bin/install -c -m 644 ./Include/weakrefobject.h /opt/include/python3.14
/usr/bin/install -c -m 644 ./Include/cpython/abstract.h /opt/include/python3.14/cpython
/usr/bin/install -c -m 644 ./Include/cpython/bytearrayobject.h /opt/include/python3.14/cpython
/usr/bin/install -c -m 644 ./Include/cpython/bytesobject.h /opt/include/python3.14/cpython
/usr/bin/install -c -m 644 ./Include/cpython/cellobject.h /opt/include/python3.14/cpython
/usr/bin/install -c -m 644 ./Include/cpython/ceval.h /opt/include/python3.14/cpython
/usr/bin/install -c -m 644 ./Include/cpython/classobject.h /opt/include/python3.14/cpython
/usr/bin/install -c -m 644 ./Include/cpython/code.h /opt/include/python3.14/cpython
/usr/bin/install -c -m 644 ./Include/cpython/compile.h /opt/include/python3.14/cpython
/usr/bin/install -c -m 644 ./Include/cpython/complexobject.h /opt/include/python3.14/cpython
/usr/bin/install -c -m 644 ./Include/cpython/context.h /opt/include/python3.14/cpython
/usr/bin/install -c -m 644 ./Include/cpython/critical_section.h /opt/include/python3.14/cpython
/usr/bin/install -c -m 644 ./Include/cpython/descrobject.h /opt/include/python3.14/cpython
/usr/bin/install -c -m 644 ./Include/cpython/dictobject.h /opt/include/python3.14/cpython
/usr/bin/install -c -m 644 ./Include/cpython/fileobject.h /opt/include/python3.14/cpython
/usr/bin/install -c -m 644 ./Include/cpython/fileutils.h /opt/include/python3.14/cpython
/usr/bin/install -c -m 644 ./Include/cpython/floatobject.h /opt/include/python3.14/cpython
/usr/bin/install -c -m 644 ./Include/cpython/frameobject.h /opt/include/python3.14/cpython
/usr/bin/install -c -m 644 ./Include/cpython/funcobject.h /opt/include/python3.14/cpython
/usr/bin/install -c -m 644 ./Include/cpython/genobject.h /opt/include/python3.14/cpython
/usr/bin/install -c -m 644 ./Include/cpython/import.h /opt/include/python3.14/cpython
/usr/bin/install -c -m 644 ./Include/cpython/initconfig.h /opt/include/python3.14/cpython
/usr/bin/install -c -m 644 ./Include/cpython/listobject.h /opt/include/python3.14/cpython
/usr/bin/install -c -m 644 ./Include/cpython/lock.h /opt/include/python3.14/cpython
/usr/bin/install -c -m 644 ./Include/cpython/longintrepr.h /opt/include/python3.14/cpython
/usr/bin/install -c -m 644 ./Include/cpython/longobject.h /opt/include/python3.14/cpython
/usr/bin/install -c -m 644 ./Include/cpython/memoryobject.h /opt/include/python3.14/cpython
/usr/bin/install -c -m 644 ./Include/cpython/methodobject.h /opt/include/python3.14/cpython
/usr/bin/install -c -m 644 ./Include/cpython/modsupport.h /opt/include/python3.14/cpython
/usr/bin/install -c -m 644 ./Include/cpython/monitoring.h /opt/include/python3.14/cpython
/usr/bin/install -c -m 644 ./Include/cpython/object.h /opt/include/python3.14/cpython
/usr/bin/install -c -m 644 ./Include/cpython/objimpl.h /opt/include/python3.14/cpython
/usr/bin/install -c -m 644 ./Include/cpython/odictobject.h /opt/include/python3.14/cpython
/usr/bin/install -c -m 644 ./Include/cpython/picklebufobject.h /opt/include/python3.14/cpython
/usr/bin/install -c -m 644 ./Include/cpython/pthread_stubs.h /opt/include/python3.14/cpython
/usr/bin/install -c -m 644 ./Include/cpython/pyatomic.h /opt/include/python3.14/cpython
/usr/bin/install -c -m 644 ./Include/cpython/pyatomic_gcc.h /opt/include/python3.14/cpython
/usr/bin/install -c -m 644 ./Include/cpython/pyatomic_msc.h /opt/include/python3.14/cpython
/usr/bin/install -c -m 644 ./Include/cpython/pyatomic_std.h /opt/include/python3.14/cpython
/usr/bin/install -c -m 644 ./Include/cpython/pyctype.h /opt/include/python3.14/cpython
/usr/bin/install -c -m 644 ./Include/cpython/pydebug.h /opt/include/python3.14/cpython
/usr/bin/install -c -m 644 ./Include/cpython/pyerrors.h /opt/include/python3.14/cpython
/usr/bin/install -c -m 644 ./Include/cpython/pyfpe.h /opt/include/python3.14/cpython
/usr/bin/install -c -m 644 ./Include/cpython/pyframe.h /opt/include/python3.14/cpython
/usr/bin/install -c -m 644 ./Include/cpython/pyhash.h /opt/include/python3.14/cpython
/usr/bin/install -c -m 644 ./Include/cpython/pylifecycle.h /opt/include/python3.14/cpython
/usr/bin/install -c -m 644 ./Include/cpython/pymem.h /opt/include/python3.14/cpython
/usr/bin/install -c -m 644 ./Include/cpython/pystate.h /opt/include/python3.14/cpython
/usr/bin/install -c -m 644 ./Include/cpython/pystats.h /opt/include/python3.14/cpython
/usr/bin/install -c -m 644 ./Include/cpython/pythonrun.h /opt/include/python3.14/cpython
/usr/bin/install -c -m 644 ./Include/cpython/pythread.h /opt/include/python3.14/cpython
/usr/bin/install -c -m 644 ./Include/cpython/pytime.h /opt/include/python3.14/cpython
/usr/bin/install -c -m 644 ./Include/cpython/setobject.h /opt/include/python3.14/cpython
/usr/bin/install -c -m 644 ./Include/cpython/sysmodule.h /opt/include/python3.14/cpython
/usr/bin/install -c -m 644 ./Include/cpython/traceback.h /opt/include/python3.14/cpython
/usr/bin/install -c -m 644 ./Include/cpython/tracemalloc.h /opt/include/python3.14/cpython
/usr/bin/install -c -m 644 ./Include/cpython/tupleobject.h /opt/include/python3.14/cpython
/usr/bin/install -c -m 644 ./Include/cpython/unicodeobject.h /opt/include/python3.14/cpython
/usr/bin/install -c -m 644 ./Include/cpython/warnings.h /opt/include/python3.14/cpython
/usr/bin/install -c -m 644 ./Include/cpython/weakrefobject.h /opt/include/python3.14/cpython
/usr/bin/install -c -m 644 ./Include/internal/pycore_abstract.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_asdl.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_ast.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_ast_state.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_atexit.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_backoff.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_bitutils.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_blocks_output_buffer.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_brc.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_bytes_methods.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_bytesobject.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_call.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_capsule.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_cell.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_ceval.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_ceval_state.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_code.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_codecs.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_compile.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_complexobject.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_condvar.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_context.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_critical_section.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_crossinterp.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_descrobject.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_dict.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_dict_state.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_dtoa.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_emscripten_signal.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_emscripten_trampoline.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_exceptions.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_faulthandler.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_fileutils.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_fileutils_windows.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_floatobject.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_flowgraph.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_format.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_frame.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_freelist.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_function.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_gc.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_genobject.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_getopt.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_gil.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_global_objects.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_global_objects_fini_generated.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_global_strings.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_hamt.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_hashtable.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_import.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_importdl.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_initconfig.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_instruction_sequence.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_instruments.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_interp.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_intrinsics.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_jit.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_list.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_llist.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_lock.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_long.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_memoryobject.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_mimalloc.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_modsupport.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_moduleobject.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_namespace.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_object.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_object_alloc.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_object_deferred.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_object_stack.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_object_state.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_obmalloc.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_obmalloc_init.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_opcode_metadata.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_opcode_utils.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_optimizer.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_parking_lot.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_parser.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_pathconfig.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_pyarena.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_pyatomic_ft_wrappers.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_pybuffer.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_pyerrors.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_pyhash.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_pylifecycle.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_pymath.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_pymem.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_pymem_init.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_pystate.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_pystats.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_pythonrun.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_pythread.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_qsbr.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_range.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_runtime.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_runtime_init.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_runtime_init_generated.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_semaphore.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_setobject.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_signal.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_sliceobject.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_stackref.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_strhex.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_structseq.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_symtable.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_sysmodule.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_time.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_token.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_traceback.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_tracemalloc.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_tstate.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_tuple.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_typeobject.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_typevarobject.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_ucnhash.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_unicodeobject.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_unicodeobject_generated.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_unionobject.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_uop_ids.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_uop_metadata.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_warnings.h /opt/include/python3.14/internal
/usr/bin/install -c -m 644 ./Include/internal/pycore_weakref.h /opt/include/python3.14/internal
/bin/sh: 1: test: yes: unexpected operator
echo /usr/bin/install -c -m 644 pyconfig.h /opt/include/python3.14/pyconfig.h
/usr/bin/install -c -m 644 pyconfig.h /opt/include/python3.14/pyconfig.h
/usr/bin/install -c -m 644 pyconfig.h /opt/include/python3.14/pyconfig.h
```
</details>
### CPython versions tested on:
3.13, CPython main branch
### Operating systems tested on:
Linux
<!-- gh-linked-prs -->
### Linked PRs
* gh-121469
* gh-121471
<!-- /gh-linked-prs -->
| 5aa1e60e0cc9c48abdd8d2c03fcc71927cf95204 | c8669489d45f22a8c6de7e05b7625db10befb8db |
python/cpython | python__cpython-121465 | # pathlib docs: table of corresponding os/os.path functions is disorganised
# Documentation
The [*Corresponding tools* table](https://docs.python.org/3.14/library/pathlib.html#corresponding-tools) in the pathlib docs has evolved organically and is overdue some editing.
<!-- gh-linked-prs -->
### Linked PRs
* gh-121465
* gh-122359
* gh-122360
<!-- /gh-linked-prs -->
| cbac8a3888411587beb026e246889154fbdd49a3 | 45614ecb2bdc2b984f051c7eade39458a3f8709f |
python/cpython | python__cpython-121466 | # `os.path.normpath` documentation is not correctly indented
# Documentation
https://github.com/python/cpython/blob/b765e4adf858ff8a8646f38933a5a355b6d72760/Doc/library/os.path.rst?plain=1#L384-L402
Note that on this line
https://github.com/python/cpython/blob/b765e4adf858ff8a8646f38933a5a355b6d72760/Doc/library/os.path.rst?plain=1#L392
a space is missing before `.. note::` directive.
<!-- gh-linked-prs -->
### Linked PRs
* gh-121466
* gh-121472
* gh-121473
<!-- /gh-linked-prs -->
| bf74db731bf108e880348f2925160af61570dbf4 | 5aa1e60e0cc9c48abdd8d2c03fcc71927cf95204 |
python/cpython | python__cpython-121491 | # test.test__interpchannels.ChannelTests.test_channel_list_interpreters_released hangs on 32-bit ARM --pydebug builds
# Bug report
### Bug description:
It looks like there's a memory handling error in interpreter cleanup, that manifests on 32-bit ARM `--pydebug` builds.
In Debian tests of 3.13.0 beta 3 on `armhf` and `armel` (32-bit ARM), `test__interpchannels` was hanging forever, specifically in the `test_channel_list_interpreters_released` test. Likewise, `test_interpreters` hangs in `test_after_destroy_all`.
Attaching to hung interpreter with gdb shows that we're caught in a faulthandler loop:
```
Program received signal SIGSEGV, Segmentation fault.
0x0002a734 in __errno_location@plt ()
(gdb) bt
#0 0x0002a734 in __errno_location@plt ()
#1 0x0024f242 in faulthandler_fatal_error (signum=11) at ../Modules/faulthandler.c:289
#2 <signal handler called>
#3 0x0002a734 in __errno_location@plt ()
#4 0x0024f242 in faulthandler_fatal_error (signum=11) at ../Modules/faulthandler.c:289
#5 <signal handler called>
#6 0x0002a734 in __errno_location@plt ()
#7 0x0024f242 in faulthandler_fatal_error (signum=11) at ../Modules/faulthandler.c:289
#8 <signal handler called>
#9 0x0002a734 in __errno_location@plt ()
#10 0x0024f242 in faulthandler_fatal_error (signum=11) at ../Modules/faulthandler.c:289
#11 <signal handler called>
#12 0x0002a734 in __errno_location@plt ()
#13 0x0024f242 in faulthandler_fatal_error (signum=11) at ../Modules/faulthandler.c:289
```
etc.
Running the process entirely under GDB I catch the SEGV early, before the faulthandler loop:
```
$ gdb --args python3.13d -W default -bb -E -R test/regrtest.py test__interpchannels -m test_channel_list_interpreters_released GNU gdb (Debian 13.2-1+b3) 13.2
Copyright (C) 2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "arm-linux-gnueabihf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from python3.13d...
r(gdb) run
Starting program: /usr/bin/python3.13d -W default -bb -E -R test/regrtest.py test__interpchannels -m test_channel_list_interpreters_released
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".
Using random seed: 1504835330
0:00:00 load avg: 0.16 Run 1 test sequentially
0:00:00 load avg: 0.16 [1/1] test__interpchannels
Program received signal SIGSEGV, Segmentation fault.
0x0002a3e0 in munmap@plt ()
(gdb) bt
#0 0x0002a3e0 in munmap@plt ()
#1 0x000e6f32 in _PyMem_ArenaFree (_unused_ctx=<optimized out>, ptr=<optimized out>,
size=<optimized out>) at ../Objects/obmalloc.c:391
#2 0x000e7588 in free_obmalloc_arenas (interp=interp@entry=0x715920)
at ../Objects/obmalloc.c:3172
#3 0x000e7f10 in _PyInterpreterState_FinalizeAllocatedBlocks (interp=interp@entry=0x715920)
at ../Objects/obmalloc.c:1484
#4 0x001d3da0 in PyInterpreterState_Delete (interp=interp@entry=0x715920)
at ../Python/pystate.c:957
#5 0x001cfee2 in finalize_interp_delete (interp=0x715920) at ../Python/pylifecycle.c:1908
#6 0x001d13c8 in Py_EndInterpreter (tstate=tstate@entry=0x72de40)
at ../Python/pylifecycle.c:2409
#7 0x0019e800 in _PyXI_EndInterpreter (interp=interp@entry=0x715920, tstate=0x72de40,
tstate@entry=0x0, p_save_tstate=p_save_tstate@entry=0x0) at ../Python/crossinterp.c:1910
#8 0xb67826ae in interp_destroy (self=<optimized out>, args=<optimized out>,
kwds=<optimized out>) at ../Modules/_interpretersmodule.c:707
#9 0x000d0d08 in cfunction_call (
func=<built-in method destroy of module object at remote 0xb67b6b40>, args=(1,),
kwargs=0x0) at ../Objects/methodobject.c:540
#10 0x0009321e in _PyObject_MakeTpCall (tstate=tstate@entry=0x51b1d0 <_PyRuntime+157112>,
callable=callable@entry=<built-in method destroy of module object at remote 0xb67b6b40>,
args=args@entry=0xb6fd8884, nargs=nargs@entry=1, keywords=keywords@entry=0x0)
at ../Objects/call.c:242
#11 0x000933a6 in _PyObject_VectorcallTstate (tstate=0x51b1d0 <_PyRuntime+157112>,
callable=callable@entry=<built-in method destroy of module object at remote 0xb67b6b40>,
args=args@entry=0xb6fd8884, nargsf=nargsf@entry=2147483649, kwnames=<optimized out>,
kwnames@entry=0x0) at ../Include/internal/pycore_call.h:166
#12 0x0009340a in PyObject_Vectorcall (
callable=callable@entry=<built-in method destroy of module object at remote 0xb67b6b40>,
args=args@entry=0xb6fd8884, nargsf=nargsf@entry=2147483649, kwnames=kwnames@entry=0x0)
at ../Objects/call.c:327
#13 0x0017a044 in _PyEval_EvalFrameDefault (tstate=<optimized out>, frame=0xb6fd8848,
throwflag=0) at ../Python/generated_cases.c.h:813
#14 0x00185e72 in _PyEval_EvalFrame (tstate=tstate@entry=0x51b1d0 <_PyRuntime+157112>,
frame=<optimized out>, throwflag=throwflag@entry=0)
at ../Include/internal/pycore_ceval.h:119
#15 0x00185f6e in _PyEval_Vector (tstate=0x51b1d0 <_PyRuntime+157112>, func=0xb69b6cf0,
locals=locals@entry=0x0, args=0xbeffe5a4, argcount=<optimized out>,
kwnames=<optimized out>) at ../Python/ceval.c:1819
#16 0x000930d0 in _PyFunction_Vectorcall (func=<optimized out>, stack=<optimized out>,
nargsf=<optimized out>, kwnames=<optimized out>) at ../Objects/call.c:413
#17 0x0009529a in _PyObject_VectorcallTstate (
tstate=tstate@entry=0x51b1d0 <_PyRuntime+157112>,
callable=callable@entry=<function at remote 0xb69b6cf0>, args=args@entry=0xbeffe5a4,
nargsf=nargsf@entry=2, kwnames=<optimized out>, kwnames@entry=0x0)
--Type <RET> for more, q to quit, c to continue without paging--q
Quit
(gdb) py-bt
Traceback (most recent call first):
<built-in method destroy of module object at remote 0xb67b6b40>
File "/usr/lib/python3.13/test/test__interpreters.py", line 82, in clean_up_interpreters
_interpreters.destroy(id)
File "/usr/lib/python3.13/test/test__interpchannels.py", line 249, in tearDown
clean_up_interpreters()
File "/usr/lib/python3.13/unittest/case.py", line 611, in _callTearDown
self.tearDown()
File "/usr/lib/python3.13/unittest/case.py", line 654, in run
self._callTearDown()
File "/usr/lib/python3.13/unittest/case.py", line 707, in __call__
return self.run(*args, **kwds)
File "/usr/lib/python3.13/unittest/suite.py", line 122, in run
test(result)
File "/usr/lib/python3.13/unittest/suite.py", line 84, in __call__
return self.run(*args, **kwds)
File "/usr/lib/python3.13/unittest/suite.py", line 122, in run
test(result)
File "/usr/lib/python3.13/unittest/suite.py", line 84, in __call__
return self.run(*args, **kwds)
File "/usr/lib/python3.13/test/libregrtest/testresult.py", line 146, in run
test(self.result)
File "/usr/lib/python3.13/test/libregrtest/single.py", line 57, in _run_suite
result = runner.run(suite)
File "/usr/lib/python3.13/test/libregrtest/single.py", line 37, in run_unittest
return _run_suite(tests)
File "/usr/lib/python3.13/test/libregrtest/single.py", line 135, in test_func
return run_unittest(test_mod)
File "/usr/lib/python3.13/test/libregrtest/single.py", line 91, in regrtest_runner
test_result = test_func()
File "/usr/lib/python3.13/test/libregrtest/single.py", line 138, in _load_run_test
regrtest_runner(result, test_func, runtests)
File "/usr/lib/python3.13/test/libregrtest/single.py", line 181, in _runtest_env_changed_exc
_load_run_test(result, runtests)
File "/usr/lib/python3.13/test/libregrtest/single.py", line 281, in _runtest
_runtest_env_changed_exc(result, runtests,
File "/usr/lib/python3.13/test/libregrtest/single.py", line 310, in run_single_test
_runtest(result, runtests)
File "/usr/lib/python3.13/test/libregrtest/main.py", line 355, in run_test
result = run_single_test(test_name, runtests)
File "/usr/lib/python3.13/test/libregrtest/main.py", line 389, in run_tests_sequentially
result = self.run_test(test_name, runtests, tracer)
File "/usr/lib/python3.13/test/libregrtest/main.py", line 533, in _run_tests
self.run_tests_sequentially(runtests)
--Type <RET> for more, q to quit, c to continue without paging--
```
This doesn't seem to be reproducible on amd64 or without `--pydebug`.
### CPython versions tested on:
3.13
### Operating systems tested on:
Linux
<!-- gh-linked-prs -->
### Linked PRs
* gh-121491
* gh-121589
<!-- /gh-linked-prs -->
| a802277914405786f6425f2776605c44bd407fc0 | 0177a343353d88ca8475dccabf6e98e164abb0e8 |
python/cpython | python__cpython-123128 | # PEP 703 Deferred reference counts
# Feature or enhancement
### Proposal:
[PEP 703](https://peps.python.org/pep-0703/#deferred-reference-counting) proposes deferred reference counting to reduce contention between threads on shared objects' reference count fields.
This issue is not in conflict with Faster CPython's scheme of fully removing reference counts in the eval loop. In fact, some of the work runs parallel to it and will actually help it.
There are 3 wins I can observe right now:
* deferring `LOAD_GLOBAL`
* deferring `LOAD_ATTR`
* deferring frames' strong references on the code object and function (this is the hardest of the three)
I shall proceed in this order.
### Has this already been discussed elsewhere?
No response given
### Links to previous discussion of this feature:
_No response_
<!-- gh-linked-prs -->
### Linked PRs
* gh-123128
* gh-124085
* gh-124101
* gh-124894
* gh-125711
<!-- /gh-linked-prs -->
| 8810e286fa48876422d1b230208911decbead294 | 74330d992be26829dba65ab83d698d42b2f2a2ee |
python/cpython | python__cpython-121454 | # Doc `tools/templates/download.html` missing `texinfo` format download link
# Bug report
### Bug description:
In python 3.8, added support for `texinfo` format https://github.com/python/cpython/pull/14606, but not added link in https://github.com/python/cpython/blob/main/Doc/tools/templates/download.html
And need update the doc download files size estimates. The last update was in python 2.7
<!-- gh-linked-prs -->
### Linked PRs
* gh-121454
* gh-121890
* gh-121891
<!-- /gh-linked-prs -->
| 37611171af4dffbd139e0393873479ed973e9585 | 941b3b7f4473153bf99f4c47e99f34f7aefe51ac |
python/cpython | python__cpython-121451 | # Inline breakpoints should use the most recent pdb isntance, instead of creating a new one
# Feature or enhancement
### Proposal:
Currently, the inline breakpoints (`breakpoint()` or `pdb.set_trace()`) will create a new pdb instance, which breaks all the instance-specific feature for pdb. For example, all the `display`s will be discarded. The `last_cmd` will be lost so `<Enter>` will not repeat the last command you type. Breakpoints will be preserved but the corresponding commands won't exist anymore. Everything stored in the pdb instance will not work anymore.
We should make inline breakpoints work as the real breakpoints set in the debugger - just break there and keep everything. My approach is to store the last pdb instance created and use that in `pdb.set_trace()`. This solves all the issues above and I think it's the right way to go.
It will also make features the rely on data on instance possible with inline breakpoints.
Very few existing code will be impacted.
### 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-121451
<!-- /gh-linked-prs -->
| 690b9355e00d1ea52020fde3feb4c043a2b214e2 | 6557af669899f18f8d123f8e1b6c3380d502c519 |
python/cpython | python__cpython-121428 | # PyTupleObjects with an ob_size of 20 are not reused.
# Bug report
### Bug description:
In the `maybe_freelist_push` function, PyTupleObjects with an ob_size of 20 are being stored in the free_list for potential reuse. However, in the `maybe_freelist_pop` function, these objects aren't actually being reused.
```C
// Objects/tupleobject.c
static inline int
maybe_freelist_push(PyTupleObject *op) {
// ....
}
static inline PyTupleObject *
maybe_freelist_pop(Py_ssize_t size) {
// ...
}
```
I've already submitted a PR.
Here is the link to the PR: https://github.com/python/cpython/pull/121428
### CPython versions tested on:
CPython main branch
### Operating systems tested on:
_No response_
<!-- gh-linked-prs -->
### Linked PRs
* gh-121428
* gh-121565
* gh-121566
<!-- /gh-linked-prs -->
| 9585a1a2a251aaa15baf6579e13dd3be0cb05f1f | f62161837e68c1c77961435f1b954412dd5c2b65 |
python/cpython | python__cpython-121424 | # Speed up `socket.errorTab` and lazy import `selectors`
# Feature or enhancement

```
>python -m timeit -n 1000 -s "import socket" "print(socket.__all__)"
1000 loops, best of 5: 407 usec per loop
>python -m timeit -n 1000 -s "import socket" "print(socket.__all__)"
1000 loops, best of 5: 352 usec per loop
```
1.15x faster
<!-- gh-linked-prs -->
### Linked PRs
* gh-121424
<!-- /gh-linked-prs -->
| 7bd964dbbe301059f3971b1be281bee0938bc70a | 91ff700de28f3415cbe44f58ce84a2670b8c9f15 |
python/cpython | python__cpython-121500 | # split compiler.c into compiler and codegen
compile.c is one of the largest source files in python (at about 8000 lines). Most of the code is code generation functions (the AST traversals). Most of the complexity is in the compiler data structure management.
In this work I will split out the code generation functions into a separate file so that they are independent of the compiler internals (access the compiler through an opaque reference and a well defined API). First I will transform the codegen functions so that they no longer access internals of ``struct compiler`` or ``struct compiler_unit``. Then I will rename compile.c to codegen.c (to preserve commit history for the codegen functions) and copy out the compiler implementation code to a new file (compile.c, so the entry point is where people are used to finding it).
The benefits will be that (1) codegen code is simpler (2) the complexity of compile.c is more manageable as it will probably only span 2-3K lines of code (3) it becomes possible to share parts of the compiler with alternative compiler implementation.
<!-- gh-linked-prs -->
### Linked PRs
* gh-121500
* gh-121538
* gh-122127
* gh-122181
* gh-123021
* gh-123043
* gh-123078
* gh-123139
* gh-123199
* gh-123225
* gh-123245
* gh-123262
* gh-123382
* gh-123398
* gh-123510
* gh-123575
* gh-123651
* gh-124109
* gh-125101
<!-- /gh-linked-prs -->
| 2be37ec8e2f68d2c2fce7ea7b9eef73d218a22f9 | 1d3cf79a501a93a7a488fc75d4db3060c5ee7d1a |
python/cpython | python__cpython-121626 | # Calling PyList_GetItemRef after PyList_New segfaults
# Crash report
### What happened?
While working on Pillow, I came across the following issue: I'm getting a crash when calling `PyList_GetItemRef` immediately after calling `PyList_New` since list item is initialized to `NULL`.
```c
PyObject *list = PyList_New(1);
return PyList_GetItemRef(list, 0);
```
In the docs for `PyList_New`, we include the following note:
> If len is greater than zero, the returned list object’s items are set to NULL. Thus you cannot use abstract API functions such as [PySequence_SetItem()](https://docs.python.org/3.13/c-api/sequence.html#c.PySequence_SetItem) or expose the object to Python code before setting all items to a real object with [PyList_SetItem()](https://docs.python.org/3.13/c-api/list.html#c.PyList_SetItem).
Not sure if this includes calling `PyList_GetItemRef`.
The problem is there on both builds, cause they both eventually try to call some variation of `Py_NewRef` / `_Py_NewRefWithLock`. `PyList_GetItem` does not crash and returns `NULL`.
### CPython versions tested on:
CPython main branch
### Operating systems tested on:
macOS
### Output from running 'python -VV' on the command line:
Python 3.13.0b2+ (heads/3.13:7302855, Jun 21 2024, 10:05:10) [Clang 15.0.0 (clang-1500.3.9.4)]
<!-- gh-linked-prs -->
### Linked PRs
* gh-121626
* gh-121827
<!-- /gh-linked-prs -->
| 2bac2b86b1486f15038fb246835e04bb1b213cd8 | 498a94c198e72525b8a7f4cb4f4a8957560f593a |
python/cpython | python__cpython-121391 | # Memory leak in tracemalloc
# Bug report
### Bug description:
The `tracemalloc_tracebacks` hash table has traceback keys and NULL values, but its destructors do not reflect this -- `key_destroy_func` is NULL while `value_destroy_func` is `raw_free`. The leaked traceback keys can be seen with AddressSanitizer:
```sh
./configure --with-pydebug --with-address-sanitizer
make -j "$(nproc)"
./python -X tracemalloc -c 'print("hello there")'
```
### CPython versions tested on:
CPython main branch
### Operating systems tested on:
Linux
<!-- gh-linked-prs -->
### Linked PRs
* gh-121391
* gh-121392
* gh-121393
<!-- /gh-linked-prs -->
| db39bc42f90c151b298f97b780e62703adbf1221 | cb688bab08559079d0ee9ffd841dd6eb11116181 |
python/cpython | python__cpython-121383 | # subprocess._USE_VFORK doesn't change usage of vfork
# Bug report
### Bug description:
Discussion: https://discuss.python.org/t/subprocess-use-vfork-escape-hatch-broken-fix-or-remove/56915
This flag was added as an escape hatch in gh-91401 and backported to Python 3.10. The flag broke at some point between its addition and now. As there is currently no publicly known environments that require this, planning to remove it rather than work on fixing it.
I found that the test for this was broken while working on tests for reducing system calls in other cases (GH-120754). The `strace` based test isn't currently being run by any CI bots. Have a PR which both adds tests around `read` and fixes the strace tests to run on some of the bots: https://github.com/python/cpython/pull/121143
### CPython versions tested on:
CPython main branch
### Operating systems tested on:
Linux
<!-- gh-linked-prs -->
### Linked PRs
* gh-121383
<!-- /gh-linked-prs -->
| a9344cdffa30fdf60154d645f9e74ab3d67ae2e9 | 82db5728136ebec3a1d221570b810b4128a21255 |
python/cpython | python__cpython-121418 | # 3.13 Incorrect Docstrings in `_interpchannels`
# Bug report
### Bug description:
There are some slightly incorrect docstrings in `_interpchannels`:
- `send` enforces kwargs after `obj`, and has a timeout kwarg.
- `send_buffer` enforces kwargs after `obj`, and has a timeout kwarg.
### CPython versions tested on:
3.13
<!-- gh-linked-prs -->
### Linked PRs
* gh-121418
* gh-121501
<!-- /gh-linked-prs -->
| 5289550b33de3d56f89a5d44a665283f7c8483a7 | 8ad6067bd4556afddc86004f8e350aa672fda217 |
python/cpython | python__cpython-121388 | # TypeError: descriptor 'some_method' for 'A' objects doesn't apply to a 'B' object
# Bug report
I found a bug that seems to be code corruption.
While working on an example project with ~70 threads, I occasionally (once every hour or so) get the following exception from various locks:
```
Exception in thread Sequence 2:
Traceback (most recent call last):
File "/Volumes/RAMDisk/installed-nogil-main/Library/Frameworks/Python.framework/Versions/3.14/lib/python3.14/threading.py", line 1039, in _bootstrap_inner
self.run()
~~~~~~~~^^
...
File "/Volumes/RAMDisk/installed-nogil-main/Library/Frameworks/Python.framework/Versions/3.14/lib/python3.14/threading.py", line 656, in wait
with self._cond:
^^^^^^^^^^
File "/Volumes/RAMDisk/installed-nogil-main/Library/Frameworks/Python.framework/Versions/3.14/lib/python3.14/threading.py", line 304, in __enter__
return self._lock.__enter__()
~~~~~~~~~~~~~~~~~~~~^^
TypeError: descriptor '__exit__' for '_thread.RLock' objects doesn't apply to a '_thread.lock' object
```
or
```
Exception in thread Clock:
Traceback (most recent call last):
File "/Volumes/RAMDisk/installed-nogil-main/Library/Frameworks/Python.framework/Versions/3.14/lib/python3.14/threading.py", line 1039, in _bootstrap_inner
self.run()
~~~~~~~~^^
File "europython.py", line 113, in run
for message in input:
File "/Volumes/RAMDisk/nogil-ep-temp/lib/python3.14/site-packages/mido/ports.py", line 243, in __iter__
yield self.receive()
~~~~~~~~~~~~^^
File "/Volumes/RAMDisk/nogil-ep-temp/lib/python3.14/site-packages/mido/ports.py", line 215, in receive
with self._lock:
^^^^^^^^^^
TypeError: descriptor '__exit__' for '_thread.lock' objects doesn't apply to a '_thread.RLock' object
```
This looks like it's a bug related to locks but it isn't. It's not even related to descriptors, only descriptors nicely refuse running invalid code.
---
This issue is also externally reported in https://github.com/PyWavelets/pywt/issues/758 with the same Lock descriptor error message I've seen, and I can reproduce the failure locally, albeit with a different exception:
```
TypeError: descriptor 'sort' for 'numpy.ndarray' objects doesn't apply to a 'ThreadPoolExecutor' object
```
To reproduce this with cpython `main`, do the following:
- make a venv with a free-threaded build of Python
- install Cython from main with `pip install -e .`
- install Numpy from main with `pip install . --no-build-isolation` (**important:** no `-e` in this case)
- install pywt from main with `pip install -e . --no-build-isolation` (**important:** you *DO* need `-e` in this case)
- run pytest in a loop (or with [autoclave](https://github.com/silentbicycle/autoclave)) like this: `PYTHON_GIL=0 pytest pywt/tests/test_concurrent.py`
You will need to run this for a longer while to get to a failure.
By doing this, I managed to find this particular failure case:
```
self = <concurrent.futures.thread.ThreadPoolExecutor object at 0x225be124750>, fn = functools.partial(<function dwtn at 0x225be6d3b40>, wavelet='haar')
args = (array([[1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],
[0., 1., 0., 0., 0., 0., 0., 0., 0., ...., 0., 0., 0., 0., 0., 0., 0., 0., 1., 0.],
[0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 1.]]),)
kwargs = {}, f = <Future at 0x225bea44310 state=finished returned dict>, w = <concurrent.futures.thread._WorkItem object at 0x225bc875bf0>
def submit(self, fn, /, *args, **kwargs):
with self._shutdown_lock, _global_shutdown_lock:
if self._broken:
raise BrokenThreadPool(self._broken)
if self._shutdown:
raise RuntimeError('cannot schedule new futures after shutdown')
if _shutdown:
raise RuntimeError('cannot schedule new futures after '
'interpreter shutdown')
f = _base.Future()
w = _WorkItem(f, fn, args, kwargs)
self._work_queue.put(w)
> self._adjust_thread_count()
E TypeError: Future.set_result() missing 1 required positional argument: 'result'
args = (array([[1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],
[0., 1., 0., 0., 0., 0., 0., 0., 0., ...., 0., 0., 0., 0., 0., 0., 0., 0., 1., 0.],
[0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 1.]]),)
f = <Future at 0x225bea44310 state=finished returned dict>
fn = functools.partial(<function dwtn at 0x225be6d3b40>, wavelet='haar')
kwargs = {}
self = <concurrent.futures.thread.ThreadPoolExecutor object at 0x225be124750>
w = <concurrent.futures.thread._WorkItem object at 0x225bc875bf0>
../installed-nogil-main/Library/Frameworks/Python.framework/Versions/3.14/lib/python3.14/concurrent/futures/thread.py:179: TypeError
======================================================================================================== short test summary info ========================================================================================================
FAILED pywt/tests/test_concurrent.py::test_concurrent_dwt - TypeError: Future.set_result() missing 1 required positional argument: 'result'
====================================================================================================== 1 failed, 3 passed in 0.44s ======================================================================================================
-- 863 runs, 862 passes, 1 failure, 734486 msec
```
Observe how Python wants to call `self._adjust_thread_count()` (with no arguments) but ends up calling `f.set_result()`, which causes an exception due to no arguments being passed.
---
Tested on macOS Sonoma on M1 Max with Python 3.14.0a0 experimental free-threading build (heads/main:7a807c3efaa, Jul 2 2024, 11:58:38).
AFAICT the problem only occurs with the GIL actually disabled.
<!-- gh-linked-prs -->
### Linked PRs
* gh-121388
* gh-121505
<!-- /gh-linked-prs -->
| 1d3cf79a501a93a7a488fc75d4db3060c5ee7d1a | 31873bea471020ca5deaf735d9acb0f1abeb1d3c |
python/cpython | python__cpython-122663 | # dis: BUILD_LIST docs incorrectly say count must be > 0
# Documentation
The `dis` module docs for `BUILD_LIST` (and `BUILD_SET` and `BUILD_TUPLE`) say that the `count` argument must be > 0:
https://github.com/python/cpython/blob/17d5b9df10f53ae3c09c8b22f27d25d9e83b4b7e/Doc/library/dis.rst?plain=1#L1081-L1098
But the code `[]` generates the instruction `BUILD_LIST 0`. [godbolt repro](https://godbolt.org/#g:!((g:!((g:!((h:codeEditor,i:(filename:'1',fontScale:14,fontUsePx:'0',j:1,lang:python,selection:(endColumn:3,endLineNumber:1,positionColumn:3,positionLineNumber:1,selectionStartColumn:3,selectionStartLineNumber:1,startColumn:3,startLineNumber:1),source:%5B%5D),l:'5',n:'1',o:'Python+source+%231',t:'0')),k:50.47766019988242,l:'4',n:'0',o:'',s:0,t:'0'),(g:!((h:compiler,i:(compiler:python312,filters:(b:'0',binary:'1',binaryObject:'1',commentOnly:'0',debugCalls:'1',demangle:'0',directives:'0',execute:'1',intel:'0',libraryCode:'0',trim:'0',verboseDemangling:'0'),flagsViewOpen:'1',fontScale:14,fontUsePx:'0',j:2,lang:python,libs:!(),options:'',overrides:!(),selection:(endColumn:50,endLineNumber:5,positionColumn:50,positionLineNumber:5,selectionStartColumn:50,selectionStartLineNumber:5,startColumn:50,startLineNumber:5),source:1),l:'5',n:'0',o:'+Python+3.12+(Editor+%231)',t:'0')),k:49.52233980011758,l:'4',n:'0',o:'',s:0,t:'0')),l:'2',m:100,n:'0',o:'',t:'0')),version:4)
I assume either the docs are meant to say `assert count >= 0` or maybe the assert is only valid for `BUILD_TUPLE`?
<!-- gh-linked-prs -->
### Linked PRs
* gh-122663
* gh-122683
* gh-122684
<!-- /gh-linked-prs -->
| 1422500d020bd199b26357fc387f8b79b82226cd | 5207adf228547273b0e8d0253c23c69b95d7fe11 |
python/cpython | python__cpython-121414 | # test_pyrepl.test_exposed_globals_in_repl failure
# Bug report
### Bug description:
I'm seeing this on a Dell laptop running XUbuntu 22.04 and MacBook Pro M1 running MacOS 14.5. In both cases, Python was built on main with the following sequence:
```
git fetch --all
git pull
git clean -fdx
./configure
nice make -j test
```
On the Mac, I also tested on the 3.13 branch and see the same failure (same out as below, save for the printed interpreter version details).
Dell:
```
======================================================================
FAIL: test_exposed_globals_in_repl (test.test_pyrepl.test_pyrepl.TestMain.test_exposed_globals_in_repl)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/skip/src/python/cpython/Lib/test/support/__init__.py", line 2622, in wrapper
return func(*args, **kwargs)
File "/home/skip/src/python/cpython/Lib/test/test_pyrepl/test_pyrepl.py", line 868, in test_exposed_globals_in_repl
self.assertTrue(case1 or case2 or case3 or case4, output)
~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: False is not true : sorted(dir())
exit
Python 3.14.0a0 (heads/main:19d1e43e43d, Jul 4 2024, 06:49:38) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> s
>>> so
>>> sor
>>> sort
>>> sorte
>>> sorted
>>> sorted(
>>> sorted(d
>>> sorted(di
>>> sorted(dir
>>> sorted(dir(
>>> sorted(dir()
>>> sorted(dir())
['__class__', '__class_getitem__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getstate__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__ior__', '__iter__', '__le__', '__len__', '__lt__', '__ne__', '__new__', '__or__', '__reduce__', '__reduce_ex__', '__repr__', '__reversed__', '__ror__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'clear', 'copy', 'fromkeys', 'get', 'items', 'keys', 'pop', 'popitem', 'setdefault', 'update', 'values']
>>>
>>> e
>>> ex
>>> exi
>>> exit
```
Mac:
```
======================================================================
FAIL: test_exposed_globals_in_repl (test.test_pyrepl.test_pyrepl.TestMain.test_exposed_globals_in_repl)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/skip/src/python/cpython/Lib/test/support/__init__.py", line 2622, in wrapper
return func(*args, **kwargs)
File "/Users/skip/src/python/cpython/Lib/test/test_pyrepl/test_pyrepl.py", line 868, in test_exposed_globals_in_repl
self.assertTrue(case1 or case2 or case3 or case4, output)
~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: False is not true : sorted(dir())
exit
Python 3.14.0a0 (heads/main:19d1e43e43d, Jul 4 2024, 06:49:28) [Clang 15.0.0 (clang-1500.3.9.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> s
>>> sor
>>> sorted(
>>> sorted(d
>>> sorted(di
>>> sorted(dir())
['__class__', '__class_getitem__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getstate__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__ior__', '__iter__', '__le__', '__len__', '__lt__', '__ne__', '__new__', '__or__', '__reduce__', '__reduce_ex__', '__repr__', '__reversed__', '__ror__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'clear', 'copy', 'fromkeys', 'get', 'items', 'keys', 'pop', 'popitem', 'setdefault', 'update', 'values']
>>> ex
>>> exit
```
### CPython versions tested on:
3.13, CPython main branch
### Operating systems tested on:
Linux, macOS
<!-- gh-linked-prs -->
### Linked PRs
* gh-121414
* gh-121417
* gh-121672
* gh-121810
<!-- /gh-linked-prs -->
| 6239d41527d5977aa5d44e4b894d719bc045860e | 892e3a1b708391cb43517a141f9b9712e047b8a4 |
python/cpython | python__cpython-121356 | # Minor error in simple_stmts.rst
# Documentation
https://github.com/python/cpython/blob/2f5f19e783385ec5312f7054827ccf1cdb6e14ef/Doc/reference/simple_stmts.rst?plain=1#L296
In this line, isn't it should be `assignment statement`, not `assignment expression`?
<!-- gh-linked-prs -->
### Linked PRs
* gh-121356
* gh-121362
* gh-121363
<!-- /gh-linked-prs -->
| 715ec630dd78819ed79cad5ac28617daefe1e745 | 06a1c3fb24c4be9ce3b432022ebaf3f913f86ba7 |
python/cpython | python__cpython-121353 | # Use _Py_SourceLocation in symtable
We now have the ``_Py_SourceLocation`` which captures a 4-int source location range. We can use it in symtable instead of passing 4 ints around everywhere.
<!-- gh-linked-prs -->
### Linked PRs
* gh-121353
<!-- /gh-linked-prs -->
| 19d1e43e43df97d14c5ab415520b6ccd941e1c88 | 2f5f19e783385ec5312f7054827ccf1cdb6e14ef |
python/cpython | python__cpython-121422 | # test_pyrepl: test_not_wiping_history_file() fails (randomly?) on multiple buildbots
Example with s390x Fedora 3.x: https://buildbot.python.org/all/#/builders/223/builds/6180
```
FAIL: test_not_wiping_history_file (test.test_pyrepl.test_pyrepl.TestMain.test_not_wiping_history_file)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/dje/cpython-buildarea/3.x.edelsohn-fedora-z/build/Lib/test/test_pyrepl/test_pyrepl.py", line 916, in test_not_wiping_history_file
self.assertNotEqual(pathlib.Path(hfile.name).stat().st_size, 0)
~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 0 == 0
```
Failure seen on:
* s390x Fedora 3.x: https://buildbot.python.org/all/#/builders/223/builds/6180
* AMD64 FreeBSD14 3.x: https://buildbot.python.org/all/#/builders/1232/builds/2756
* ARM64 MacOS M1 NoGIL 3.x: https://buildbot.python.org/all/#/builders/1270/builds/1984
* PPC64LE RHEL7 3.x: https://buildbot.python.org/all/#/builders/446/builds/5115
<!-- gh-linked-prs -->
### Linked PRs
* gh-121422
* gh-121449
<!-- /gh-linked-prs -->
| 68e279b37aae3019979a05ca55f462b11aac14be | 114389470ec3db457c589b3991b695258d23ce5a |
python/cpython | python__cpython-121340 | # MSVC pragma to turn compiler optimization off around the _PyEval_EvalFrameDefault is no longer necessary
# Bug report
### Bug description:
When the Tier 2 interpreter loop was first merged with the Tier 1 interpreter loop, the MSVC compiler would crash when building for PGO, presumably due to the very large size of the function. #111786 introduced a `#pragma optimize("off")` to turn off optimization around `_PyEval_EvalFrameDefault` which seems to have side-stepped the crash.
[This crash was reported to the MSVC compiler team](https://dev.azure.com/devdiv/DevDiv/_workitems/edit/1914472), but there hasn't been resolution around that.
In the intervening time, the interpreter loop has changed significantly again, and it seems that this `#pragma` hack is no longer necessary, either for default builds (which no longer include a Tier 2 interpreter) and `--enable-experimental-jit` builds (which do). I propose we remove it for the sake of removing what should have been a temporary hack and to give the compiler the fairest shot at doing its best work. Benchmarking shows no significant change for either a [default build](https://github.com/faster-cpython/benchmarking-public/tree/main/results/bm-20240702-3.14.0a0-a03affd) or a [JIT build](https://github.com/faster-cpython/benchmarking-public/tree/main/results/bm-20240702-3.14.0a0-a03affd-JIT).
I'm not sure whether this should also be backported to 3.13. It's not really a bugfix, but I would certainly feel better shipping 3.13.0 without a weird compiler workaround (which would be harder to remove after the rc).
### CPython versions tested on:
CPython main branch
### Operating systems tested on:
Windows
<!-- gh-linked-prs -->
### Linked PRs
* gh-121340
* gh-121492
<!-- /gh-linked-prs -->
| d69529d31ccd1510843cfac1ab53bb8cb027541f | 59be79ae60073f7b6bdf6ce921560c279937e4ab |
python/cpython | python__cpython-121335 | # Clarify what is the default executor for `asyncio.run_in_executor`
# Documentation
The document of asyncio said:
https://github.com/python/cpython/blob/84512c0e7f4441f060026f4fd9ddb7611fc10de4/Doc/library/asyncio-eventloop.rst?plain=1#L1263-L1264
But it dosn't mention that what is the default executor, like if it's `ThreadPoolExecutor` or `ProcessPoolExecutor`.
Someone on stackoverflow got the same question: https://stackoverflow.com/questions/60204054/default-executor-asyncio
<!-- gh-linked-prs -->
### Linked PRs
* gh-121335
* gh-121525
* gh-121526
<!-- /gh-linked-prs -->
| facf9862da0cf9331550747197800d682cd371fb | 15d48aea02099ffc5bdc5511cc53ced460cb31b9 |
python/cpython | python__cpython-121334 | # ast constructors should look at `_attributes` for allowed attributes
# Bug report
### Bug description:
https://github.com/python/cpython/pull/121162/files#r1664259401
### CPython versions tested on:
3.13, CPython main branch
### Operating systems tested on:
_No response_
<!-- gh-linked-prs -->
### Linked PRs
* gh-121334
* gh-121625
<!-- /gh-linked-prs -->
| 58e8cf2bb61f82df9eabd1209fe5e3d146e4c8cd | 44937d11a6a045a624918db78aa36e715ffabcd4 |
python/cpython | python__cpython-121302 | # 3.13 `copy.replace` isn't in `__all__`
# Bug report
### Bug description:
`copy.replace` isn't exported as a part of `__all__` in the `copy` module. This seemed liked an oversight, as opposed to being intentional, but feel free to close this issue if not.
### CPython versions tested on:
3.13
### Operating systems tested on:
_No response_
<!-- gh-linked-prs -->
### Linked PRs
* gh-121302
* gh-121304
* gh-121337
<!-- /gh-linked-prs -->
| 7c66906802cd8534b05264bd47acf9eb9db6d09e | ca2e8765009d0d3eb9fe6c75465825c50808f4dd |
python/cpython | python__cpython-121815 | # KeyboardInterrupt during paste breaks the new REPL
# Bug report
### Bug description:
To reproduce, type `f = """` then paste a giant block of text (I pasted [the text of Frankenstein](https://github.com/asweigart/codebreaker/blob/master/frankenstein.txt)) then press Ctrl+C immediately (while the text is being pasted).
```pycon
>>> f = """
<GIANT BLOCK OF TEXT>
Then hit Ctrl+C
```
After this the REPL will enter a state where it seems unable to *end* a block of code. The prompt changes to `...` and only Ctrl+C will quit out of the block.
Also nothing is displayed while typing until Enter is pressed.
Here's [an animation](https://asciinema.org/a/GMRyMxyzKjB0NxLt5MaQIsXyL) showing the issue:

This issue is also reproducible on the `main` branch.
I checked out commit 32a0faba439b239d7b0c242c1e3cd2025c52b8cf and I could not reproduce this, so the issue arose sometime after #120253 was merged.
### CPython versions tested on:
3.13, CPython main branch
### Operating systems tested on:
Linux
<!-- gh-linked-prs -->
### Linked PRs
* gh-121815
* gh-121826
<!-- /gh-linked-prs -->
| 498a94c198e72525b8a7f4cb4f4a8957560f593a | 7d111dac160c658b277ec0fac75eee8edcfbe9dc |
python/cpython | python__cpython-121286 | # Remove backtracking from parsing tarfile members and headers
### Bug description:
Today the `tarfile` module parsing of header values allows for backtracking when parsing header values. Headers have a well-known format that doesn't require backtracking to parse reliably, the new method of parsing will only require a single pass over a byte stream.
### CPython versions tested on:
CPython main branch
### Operating systems tested on:
_No response_
<!-- gh-linked-prs -->
### Linked PRs
* gh-121286
* gh-123542
* gh-123543
* gh-123639
* gh-123640
* gh-123641
* gh-123642
<!-- /gh-linked-prs -->
| 34ddb64d088dd7ccc321f6103d23153256caa5d4 | 0cba289870d5cd41f24b2f63b9480e4593aa2330 |
python/cpython | python__cpython-122754 | # email: invalid RFC 2047 address header after refolding with email.policy.default
# Bug report
### Bug description:
If an email message (modern or legacy) is assigned an address header that is pre-encoded with RFC 2047, calling as_bytes(policy=default) can generate an invalid address header. The resulting header may include unquoted RFC 5322 special characters in a way that can alter its meaning.
Here is a minimal example to demonstrate the problem, isolated from much larger code (including Django's django.core.mail.message). Although this example starts with a legacy Message, an example using only the modern email API [is in a later comment](#issuecomment-2207348299):
```python
import email.message
import email.policy
message = email.message.Message()
message["To"] = '=?utf-8?b?TmfGsOG7nWkgbmjhuq1uIGEgdmVyeSB2ZXJ5IGxvbmcs?= name <to@example.com>'
message.as_bytes(policy=email.policy.default)
# b'To: =?utf-8?b?TmfGsOG7nWkgbmjhuq1u?= a very very long, name <to@example.com>\n\n'
```
(The unquoted comma in the resulting display-name is not valid.)
For a real-world case where this can occur, see [Django ticket 35378](https://code.djangoproject.com/ticket/35378) and anymail/django-anymail#369. (Thanks to @andresmrm for noticing the problem and isolating a test case.)
Oddly, as_string(policy=default) doesn't exhibit the problem:
```python
message.as_string(policy=email.policy.default)
# 'To: =?utf-8?b?TmfGsOG7nWkgbmjhuq1uIGEgdmVyeSB2ZXJ5IGxvbmcs?= name <to@example.com>\n\n'
```
Also, the problem does not occur when assigning the non-encoded equivalent to the header:
```python
message2 = email.message.Message()
message2["To"] = '"Người nhận a very very long, name" <to@example.com>'
message2.as_bytes(policy=email.policy.default)
# b'To:\n =?utf-8?b?TmfGsOG7nWkgbmjhuq1uIGEgdmVyeSB2ZXJ5IGxvbmcs?= name <to@example.com>\n\n'
```
(Possibly related to #80222)
### CPython versions tested on:
3.9, 3.12
### Operating systems tested on:
macOS
[edits: removed ambiguous use of "default" in example comment; clarified this is not a real-world example, but a minimal test case]
<!-- gh-linked-prs -->
### Linked PRs
* gh-122754
* gh-131403
* gh-131404
* gh-131405
* gh-131411
* gh-131412
<!-- /gh-linked-prs -->
| 295b53df2aa18deb625a7da41f7e4babfe6ef34b | ab6333f7f56554bfd6c01eff567ddfb163a3dae6 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.