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-104116 | # `pathlib.WindowsPath.glob()` preserves case of literal pattern segments
When `pathlib.WindowsPath.glob()` evaluates a literal (non-wildcard) pattern segment, it returns paths using the case of the pattern segment, rather than the real filesystem case. This problem does not affect segments involving `*` or `**` wildcards.
```python
>>> from pathlib import WindowsPath
>>> next(WindowsPath().glob('LIB/PATHLIB.*'))
WindowsPath('LIB/pathlib.py') # 'LIB' should be 'Lib'
```
<!-- gh-linked-prs -->
### Linked PRs
* gh-104116
<!-- /gh-linked-prs -->
| da1980afcb8820ffaa0574df735bc39b1a276a76 | 38dc3f28dde92b4fa6284a57f4e554991a3d9276 |
python/cpython | python__cpython-104113 | # we should not recommend using functools.cache on methods
# Documentation
Currently [the documentation for functools.cached_property](https://docs.python.org/3/library/functools.html#functools.cached_property) recommends stacking `@property` and `@functools.cache` decorators to "achieve an effect similar to" `functools.cached_property`. But this omits a critical problem with using `@functools.cache` on instance methods: it is an unbounded cache, and will use `self` as a cache key, so any instance on which this "cached property" is ever accessed will be kept alive by the cache forever (unless the cache is manually cleared), and the memory used by these cached instances can grow unboundedly.
The [FAQ entry on caching methods](https://docs.python.org/3/faq/programming.html#faq-cache-method-calls) does not recommend (or even mention) `functools.cache`, and it explicitly recommends a bounded `functools.lru_cache` in order to avoid keeping alive all instances indefinitely.
Specific proposals:
1. The `cached_property` documentation should not recommend using `functools.cache` on a method.
2. It also doesn't need to give a full example of using `lru_cache` for a method cache; it can instead just mention the possibility, and link to the FAQ entry for more detailed discussion.
<!-- gh-linked-prs -->
### Linked PRs
* gh-104113
* gh-104182
<!-- /gh-linked-prs -->
| fa86a77589a06661fcebb806d36f3a7450e2aecf | 46361bb84332800bc3632688e6ef3b4dd4a48723 |
python/cpython | python__cpython-104110 | # Expose Py_NewInterpreterFromConfig() and PyInterpreterConfig in the Public C-API
This is part of the PEP 684 (per-interpreter GIL) implementation.
<!-- gh-linked-prs -->
### Linked PRs
* gh-104110
<!-- /gh-linked-prs -->
| 292076a9aa29aba1023340a0d24252a7b27a454e | de64e7561680fdc5358001e9488091e75d4174a3 |
python/cpython | python__cpython-104148 | # Add a Module Def Slot for Supporting Multiple Interpreters
PEP 489 is clear that extension modules implementing multi-phase init are expected to support use in multiple interpreters. However, there are two situations where that mandate isn't sufficient:
1. PEP 684 introduces a per-interpreter GIL, where there is an additional thread-safety constraint beyond support for multiple interpreters
2. the HPy project implies modules with multi-phase init but not necessarily supporting multiple interpreters
In both cases a new module def slot (the same one, in fact) is a correct solution.
For per-interpreter GIL, [PEP 684 specifies](https://peps.python.org/pep-0684/#extension-module-thread-safety) that we must add a module def slot for opting in to supporting per-interpreter GIL.
For HPy, the situation was pointed out to me by @hodgestar during a conversation at PyCon.
CC @encukou
----
I propose the following solution:
1. add a new `Py_mod_multiple_interpreters` module def slot
2. interpret the value to indicate support for multiple interpreters and for per-interpreter GIL
3. call `_PyImport_CheckSubinterpIncompatibleExtensionAllowed()` when appropriate in `PyModule_FromDefAndSpec2()`
The slot value may be one of the following:
* `0` - does not support multiple interpreters (for HPy)
* `1` - supports multiple interpreters (the default)
* `2` - supports per-interpreter GIL
It would probably make sense to define a constant (macro) for each of those.
<!-- gh-linked-prs -->
### Linked PRs
* gh-104148
<!-- /gh-linked-prs -->
| c2627d6eea924daf80f374c18a5fd73ef61283fa | 3e818afb9b7c557aa633aeb3d5c4959750feeab0 |
python/cpython | python__cpython-104129 | # Python 3.11 is unbuildable with GCC on macOS (error: 'HAVE_MKFIFOAT_RUNTIME' undeclared, error: 'HAVE_MKNODAT_RUNTIME' undeclared)
<!--
If you're new to Python and you're not sure whether what you're experiencing is a bug, the CPython issue tracker is not
the right place to seek help. Consider the following options instead:
- reading the Python tutorial: https://docs.python.org/3/tutorial/
- posting in the "Users" category on discuss.python.org: https://discuss.python.org/c/users/7
- emailing the Python-list mailing list: https://mail.python.org/mailman/listinfo/python-list
- searching our issue tracker (https://github.com/python/cpython/issues) to see if
your problem has already been reported
-->
# Bug report
Due to missing fallback macro definitions in `Modules/posixmodule.c` ([source](
https://github.com/python/cpython/blob/main/Modules/posixmodule.c#LL87C1-L108C31)) for `HAVE_MKFIFOAT_RUNTIME` and `HAVE_MKNODAT_RUNTIME`, Python 3.11 cannot be built with GCC on macOS, due to the following failures:
```
./Modules/posixmodule.c: In function 'parse_posix_spawn_flags':
./Modules/posixmodule.c:186:64: warning: comparison between pointer and integer
186 | (posix_spawn != NULL && setsid != NULL)
| ^~
./Modules/posixmodule.c:6026:13: note: in expansion of macro 'HAVE_POSIX_SPAWN_SETSID_RUNTIME'
6026 | if (HAVE_POSIX_SPAWN_SETSID_RUNTIME) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./Modules/posixmodule.c: In function 'os_mkfifo_impl':
./Modules/posixmodule.c:10690:17: error: 'HAVE_MKFIFOAT_RUNTIME' undeclared (first use in this function); did you mean 'HAVE_MKDIRAT_RUNTIME'?
10690 | if (HAVE_MKFIFOAT_RUNTIME) {
| ^~~~~~~~~~~~~~~~~~~~~
| HAVE_MKDIRAT_RUNTIME
./Modules/posixmodule.c:10690:17: note: each undeclared identifier is reported only once for each function it appears in
./Modules/posixmodule.c: In function 'os_mknod_impl':
./Modules/posixmodule.c:10759:17: error: 'HAVE_MKNODAT_RUNTIME' undeclared (first use in this function); did you mean 'HAVE_MKDIRAT_RUNTIME'?
10759 | if (HAVE_MKNODAT_RUNTIME) {
| ^~~~~~~~~~~~~~~~~~~~
| HAVE_MKDIRAT_RUNTIME
./Modules/posixmodule.c: In function 'probe_mkfifoat':
arm64-apple-darwin22-gcc -Wsign-compare -DNDEBUG -O2 -pipe -fwrapv -std=c11 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration -fvisibility=hidden -I./Include/internal -I. -I./Include -I/Users/gentoo/gentoo/tmp/usr/include/ncursesw -DPy_BUILD_CORE_BUILTIN -c ./Modules/_codecsmodule.c -o Modules/_codecsmodule.o
./Modules/posixmodule.c:15647:23: error: 'HAVE_MKFIFOAT_RUNTIME' undeclared (first use in this function); did you mean 'HAVE_MKDIRAT_RUNTIME'?
15647 | PROBE(probe_mkfifoat, HAVE_MKFIFOAT_RUNTIME)
| ^~~~~~~~~~~~~~~~~~~~~
./Modules/posixmodule.c:15611:11: note: in definition of macro 'PROBE'
15611 | if (test) { \
| ^~~~
./Modules/posixmodule.c: In function 'probe_mknodat':
./Modules/posixmodule.c:15651:22: error: 'HAVE_MKNODAT_RUNTIME' undeclared (first use in this function); did you mean 'HAVE_MKDIRAT_RUNTIME'?
15651 | PROBE(probe_mknodat, HAVE_MKNODAT_RUNTIME)
| ^~~~~~~~~~~~~~~~~~~~
./Modules/posixmodule.c:15611:11: note: in definition of macro 'PROBE'
15611 | if (test) { \
| ^~~~
make: *** [Makefile:2695: Modules/posixmodule.o] Error 1
make: *** Waiting for unfinished jobs....
```
In `Modules/posixmodule.c`, Python conditionally defines a series of macros that indicate whether a system call is supported based on `#ifdef` checks. By default, the clang specific `__builtin_available()` compiler built-in function is used to check them. But if `__builtin_available()` is unavailable, a fallback is also provided.
For example, for `HAVE_FSTATAT_RUNTIME`, we have:
```
#ifdef HAVE_BUILTIN_AVAILABLE
# define HAVE_FSTATAT_RUNTIME __builtin_available(macOS 10.10, iOS 8.0, *)
// [...]
#else /* Xcode 8 or earlier */
/* __builtin_available is not present in these compilers, but
* some of the symbols might be weak linked (10.10 SDK or later
* deploying on 10.9.
*
* Fall back to the older style of availability checking for
* symbols introduced in macOS 10.10.
*/
# ifdef HAVE_FSTATAT
# define HAVE_FSTATAT_RUNTIME (fstatat != NULL)
# endif
#endif
```
The fallback is important because it's not only used to support older Xcode or macOS, but it also provides fallback when GCC is used. The function `__builtin_available()` is clang-only and does not exist in GCC. In the past, this was handled by the `else` portion of the `ifdef`, so it worked on GCC as well. Unfortunately, when `HAVE_MKFIFOAT_RUNTIME` and `HAVE_MKDIRAT_RUNTIME` have been added to the code, a fallback was never provided, thus, compiling Python 3.11 with GCC now fails due to undeclared macros.
# Your environment
<!-- Include as many relevant details as possible about the environment you experienced the bug in -->
- CPython versions tested on: Python 3.11.3
- Operating system and architecture: macOS 13.2.1
- GCC 12.2.0
<!--
You can freely edit this text. Remove any lines you believe are unnecessary.
-->
<!-- gh-linked-prs -->
### Linked PRs
* gh-104129
* gh-104187
<!-- /gh-linked-prs -->
| e5b8b19d99861c73ab76ee0175a685acf6082d7e | ce871fdc3a02e8441ad73b13f9fced308a9d9ad1 |
python/cpython | python__cpython-104105 | # Optimize `pathlib.Path.glob()` by avoiding repeated calls to `os.path.normcase()`
As part of removing "flavour" classes in #31691, I changed pathlib's `glob()` implementation: previously it used `re.IGNORECASE` to implement case-insensitive matches, whereas after it called `os.path.normcase()` on the pattern and the paths. The new behaviour is a little slower, and I think we should restore the previous implementation.
<!-- gh-linked-prs -->
### Linked PRs
* gh-104105
<!-- /gh-linked-prs -->
| 47770a1e91d096fd1c689eb0c78b0f9e76b43639 | 1f5384434dce013b5dcf7e7ea3ec5312d13bba72 |
python/cpython | python__cpython-104103 | # Optimize `pathlib.Path.glob()` handling of `../` pattern segments
These segments do not require a `stat()` call, as the selector's `_select_from()` method is called after we've established that the parent is a directory.
<!-- gh-linked-prs -->
### Linked PRs
* gh-104103
<!-- /gh-linked-prs -->
| 65a49c6553a27cc36eebb4b79f409c3cb4450d8c | 47770a1e91d096fd1c689eb0c78b0f9e76b43639 |
python/cpython | python__cpython-104137 | # Failed test_write_filtered_python_package test case in ./python -We -m test -v test_zipfile
<!--
If you're new to Python and you're not sure whether what you're experiencing is a bug, the CPython issue tracker is not
the right place to seek help. Consider the following options instead:
- reading the Python tutorial: https://docs.python.org/3/tutorial/
- posting in the "Users" category on discuss.python.org: https://discuss.python.org/c/users/7
- emailing the Python-list mailing list: https://mail.python.org/mailman/listinfo/python-list
- searching our issue tracker (https://github.com/python/cpython/issues) to see if
your problem has already been reported
-->
# Bug report
```sh
======================================================================
FAIL: test_write_filtered_python_package (test.test_zipfile.test_core.PyZipFileTests.test_write_filtered_python_package)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/workspace/cpython/Lib/test/test_zipfile/test_core.py", line 1240, in test_write_filtered_python_package
self.assertTrue('SyntaxError' not in reportStr)
AssertionError: False is not true
----------------------------------------------------------------------
Ran 287 tests in 17.715s
FAILED (failures=1, skipped=4)
test test_zipfile failed
test_zipfile failed (1 failure)
== Tests result: FAILURE ==
1 test failed:
test_zipfile
Total duration: 17.9 sec
Tests result: FAILURE
```
# Your environment
<!-- Include as many relevant details as possible about the environment you experienced the bug in -->
- CPython versions tested on: CPython 3.12.0a7+
- Operating system and architecture: Ubuntu 22.04.2 LTS | Linux-5.15.0-47-generic-x86_64-with-glibc2.35 little-endian
<!--
You can freely edit this text. Remove any lines you believe are unnecessary.
-->
<!-- gh-linked-prs -->
### Linked PRs
* gh-104137
<!-- /gh-linked-prs -->
| 83751bbd142c23ca3f6af34ec617630dc3173b2a | 6ab463684b9d79880d98cd1f1406aa86af65985e |
python/cpython | python__cpython-104079 | # Performance of PyObject_HasAttrString
# Feature or enhancement
`PyObject_HasAttrString` is implemented in terms of `PyObject_GetAttrString` / `PyErr_Clear`.
for non-existing attributes, there's significant overhead from creating an error only to clear it later.
this can be optimized by implementing it in terms of `PyObject_HasAttr`.
## microbenchmark
```
python -m pyperf timeit -s '
import _testcapi
hasattr_string = _testcapi.hasattr_string
class A:
def __init__(self):
self.attr = 1
a = A()' 'hasattr_string(a, "noattr")'
.....................
Mean +- std dev: 487 ns +- 7 ns
```
<!-- gh-linked-prs -->
### Linked PRs
* gh-104079
<!-- /gh-linked-prs -->
| 8d34031068ece75667260f6526d3165efe34e054 | fdb3ef8c0f94c7e55870a585dc6499aca46f9f90 |
python/cpython | python__cpython-104063 | # Performance of attribute lookup for module objects
# Feature or enhancement
Similar to gh-92216 (for type objects) - attribute lookup on module objects for non-existing attributes is significantly slower compared to existing attributes, as well as non-existing attributes on types and instances.
microbenchmark on main:
```
python -m pyperf timeit -s 'import os' 'hasattr(os, "getenv")'
.....................
Mean +- std dev: 37.8 ns +- 1.5 ns
```
```
python -m pyperf timeit -s 'import os' 'hasattr(os, "nothing")'
.....................
Mean +- std dev: 541 ns +- 16 ns
```
As in gh-92216, the reason for the slowness is time spent in creating an `AttributeError`, which is not needed.
By adding a special case for modules (similar to the type special case in gh-99979), this overhead can be eliminated.
<!-- gh-linked-prs -->
### Linked PRs
* gh-104063
<!-- /gh-linked-prs -->
| fdcb49c36b2ed8347d8d9f2dcd7052cc90207beb | c9ecd3ee75b472bb0a7538e0288c5cfea146da83 |
python/cpython | python__cpython-104062 | # Add SO_BINDTOIFINDEX constant to socket module
# Feature or enhancement
Since Linux 5.0 socket option `SO_BINDTOIFINDEX` is available to avoid a race condition between `SO_BINDTODEVICE` and network interface renaming. Add this constant to `Modules/socketmodule.c` if available.
# Pitch
I will shamelessly steal David Herrmann's reasoning in [his proposal to add `SO_BINDTOIFINDEX` to the Linux kernel](https://lwn.net/ml/netdev/20190115134216.1757-1-dh.herrmann@gmail.com/):
> This introduces a new generic SOL_SOCKET-level socket option called SO_BINDTOIFINDEX. It behaves similar to SO_BINDTODEVICE, but takes a network interface index as argument, rather than the network interface name.
>
> User-space often refers to network-interfaces via their index, but has to temporarily resolve it to a name for a call into SO_BINDTODEVICE. This might pose problems when the network-device is renamed asynchronously by other parts of the system. When this happens, the SO_BINDTODEVICE might either fail, or worse, it might bind to the wrong device.
>
> In most cases user-space only ever operates on devices which they either manage themselves, or otherwise have a guarantee that the device name will not change (e.g., devices that are UP cannot be renamed). However, particularly in libraries this guarantee is non-obvious and it would be nice if that race-condition would simply not exist. It would make it easier for those libraries to operate even in situations where the device-name might change under the hood.
>
> A real use-case that we recently hit is trying to start the network stack early in the initrd but make it survive into the real system. Existing distributions rename network-interfaces during the transition from initrd into the real system. This, obviously, cannot affect devices that are up and running (unless you also consider moving them between network-namespaces). However, the network manager now has to make sure its management engine for dormant devices will not run in parallel to these renames. Particularly, when you offload operations like DHCP into separate processes, these might setup their sockets early, and thus have to resolve the device-name possibly running into this race-condition.
>
> By avoiding a call to resolve the device-name, we no longer depend on the name and can run network setup of dormant devices in parallel to the transition off the initrd. The SO_BINDTOIFINDEX ioctl plugs this race.
# Previous discussion
I have not discussed this addition. It looks like similar additions, like #100813 or #91968, were not discussed outside of Github either.
<!--
You can freely edit this text. Remove any lines you believe are unnecessary.
-->
<!-- gh-linked-prs -->
### Linked PRs
* gh-104062
<!-- /gh-linked-prs -->
| e1fdc3c323bd605f92622b7ee18805885ff0bb4e | 142502ea8d26b17732009b6e981e630c342054f7 |
python/cpython | python__cpython-104059 | # Some test modules fail when run as a script
```python
C:\Users\KIRILL-1\CLionProjects\cpython> ./python Lib/test/test_module.py
Running Debug|x64 interpreter...
.....................F..............
======================================================================
FAIL: test_module_repr_with_full_loader (__main__.ModuleTests.test_module_repr_with_full_loader)
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\KIRILL-1\CLionProjects\cpython\Lib\test\test_module.py", line 238, in test_module_repr_with_full_loader
self.assertEqual(
AssertionError: "<module 'foo' (<class '__main__.FullLoader'>)>" != "<module 'foo' (<class 'test.test_module.FullLoader'>)>"
- <module 'foo' (<class '__main__.FullLoader'>)>
? ^ ^^^^^
+ <module 'foo' (<class 'test.test_module.FullLoader'>)>
? ^^^^^^^^^ ^^^^^
----------------------------------------------------------------------
Ran 36 tests in 0.217s
FAILED (failures=1)
```
I'll soon send a PR to fix it.
<!-- gh-linked-prs -->
### Linked PRs
* gh-104059
* gh-104064
* gh-104069
<!-- /gh-linked-prs -->
| d448fcb0323bf00cb4ff4a1e65e8424a73b5f0d4 | e665563f8301d0db5cb0847d75fc879f074aa100 |
python/cpython | python__cpython-104052 | # crash in ./python.exe -We -m test -v test_xxtestfuzz
```
% ./python.exe -We -m test -v test_xxtestfuzz
Raised RLIMIT_NOFILE: 256 -> 1024
== CPython 3.12.0a7+ (heads/main:2d526cd32f, May 1 2023, 19:02:26) [Clang 14.0.3 (clang-1403.0.22.14.1)]
== macOS-13.3.1-x86_64-i386-64bit little-endian
== Python build: debug
== cwd: /Users/iritkatriel/src/cpython-1/build/test_python_17978æ
== CPU count: 12
== encodings: locale=UTF-8, FS=utf-8
0:00:00 load avg: 2.91 Run tests sequentially
0:00:00 load avg: 2.91 [1/1] test_xxtestfuzz
test_sample_input_smoke_test (test.test_xxtestfuzz.TestFuzzer.test_sample_input_smoke_test)
This is only a regression test: Check that it doesn't crash. ... Traceback (most recent call last):
File "/Users/iritkatriel/src/cpython-1/Lib/sre_compile.py", line 2, in <module>
warnings.warn(f"module {__name__!r} is deprecated",
DeprecationWarning: module 'sre_compile' is deprecated
Fatal Python error: Aborted
Current thread 0x00007ff85940a340 (most recent call first):
File "/Users/iritkatriel/src/cpython-1/Lib/test/test_xxtestfuzz.py", line 13 in test_sample_input_smoke_test
File "/Users/iritkatriel/src/cpython-1/Lib/unittest/case.py", line 589 in _callTestMethod
File "/Users/iritkatriel/src/cpython-1/Lib/unittest/case.py", line 634 in run
File "/Users/iritkatriel/src/cpython-1/Lib/unittest/case.py", line 690 in __call__
File "/Users/iritkatriel/src/cpython-1/Lib/unittest/suite.py", line 122 in run
File "/Users/iritkatriel/src/cpython-1/Lib/unittest/suite.py", line 84 in __call__
File "/Users/iritkatriel/src/cpython-1/Lib/unittest/suite.py", line 122 in run
File "/Users/iritkatriel/src/cpython-1/Lib/unittest/suite.py", line 84 in __call__
File "/Users/iritkatriel/src/cpython-1/Lib/unittest/suite.py", line 122 in run
File "/Users/iritkatriel/src/cpython-1/Lib/unittest/suite.py", line 84 in __call__
File "/Users/iritkatriel/src/cpython-1/Lib/unittest/runner.py", line 240 in run
File "/Users/iritkatriel/src/cpython-1/Lib/test/support/__init__.py", line 1106 in _run_suite
File "/Users/iritkatriel/src/cpython-1/Lib/test/support/__init__.py", line 1232 in run_unittest
File "/Users/iritkatriel/src/cpython-1/Lib/test/libregrtest/runtest.py", line 294 in _test_module
File "/Users/iritkatriel/src/cpython-1/Lib/test/libregrtest/runtest.py", line 330 in _runtest_inner2
File "/Users/iritkatriel/src/cpython-1/Lib/test/libregrtest/runtest.py", line 373 in _runtest_inner
File "/Users/iritkatriel/src/cpython-1/Lib/test/libregrtest/runtest.py", line 248 in _runtest
File "/Users/iritkatriel/src/cpython-1/Lib/test/libregrtest/runtest.py", line 278 in runtest
File "/Users/iritkatriel/src/cpython-1/Lib/test/libregrtest/main.py", line 483 in run_tests_sequential
File "/Users/iritkatriel/src/cpython-1/Lib/test/libregrtest/main.py", line 601 in run_tests
File "/Users/iritkatriel/src/cpython-1/Lib/test/libregrtest/main.py", line 779 in _main
File "/Users/iritkatriel/src/cpython-1/Lib/test/libregrtest/main.py", line 738 in main
File "/Users/iritkatriel/src/cpython-1/Lib/test/libregrtest/main.py", line 802 in main
File "/Users/iritkatriel/src/cpython-1/Lib/test/__main__.py", line 2 in <module>
File "/Users/iritkatriel/src/cpython-1/Lib/runpy.py", line 88 in _run_code
File "/Users/iritkatriel/src/cpython-1/Lib/runpy.py", line 198 in _run_module_as_main
Extension modules: _testcapi, _xxtestfuzz (total: 2)
```
<!-- gh-linked-prs -->
### Linked PRs
* gh-104052
<!-- /gh-linked-prs -->
| 81fc135f263e9ec5df3d967290b9665d7e100c7f | 163034515a81f137d1dd7d289dc048eb0f1cd424 |
python/cpython | python__cpython-104421 | # Add type annotations to clinic.py
# Feature or enhancement
Gradually add type hints to clinic.py.
# Pitch
Adding type hints to clinic.py will make it easier to debug, fix bugs, do code review, add new features, and triage. IMO, the churn is worth the effort in the long run.
# Previous discussion
Since adding typing to the CPython code base has been a slightly controversial topic (obviously controversial for `Lib/`), I created a [topic on Discourse](https://discuss.python.org/t/consider-adding-type-hints-to-clinic-py/26320?u=erlendaasland) and asked for feedback. So far, I have not received any discouragements :)
<!-- gh-linked-prs -->
### Linked PRs
* gh-104421
* gh-104538
* gh-104543
* gh-104544
* gh-104547
* gh-104588
* gh-104589
* gh-104626
* gh-104628
* gh-104631
* gh-104648
* gh-104704
* gh-104705
* gh-104706
* gh-106343
* gh-106354
* gh-106357
* gh-106376
* gh-106431
* gh-106435
* gh-106437
* gh-106519
* gh-106655
* gh-106699
* gh-106732
* gh-106750
* gh-106760
* gh-106810
* gh-106929
* gh-106932
* gh-106934
* gh-106935
* gh-107074
* gh-107192
* gh-107200
* gh-107206
* gh-107207
* gh-107209
* gh-107210
* gh-107225
* gh-107264
* gh-107288
* gh-107293
* gh-107294
* gh-107399
* gh-107405
<!-- /gh-linked-prs -->
| 9d41f83c58e6dc2fc6eb4b91f803551850b0adeb | a6bcc8fb92ffb75bb1907cc568ba9fff516979c3 |
python/cpython | python__cpython-104067 | # python 3.11 http.server internal path disclosure
# Bug report
Description
---
Python http.server will disclose the full path where the http server is running when certains URL encoded values are sent as parameters. This was tested on a linux and windows machine. This was initially reported to security@ but I was asked to create an issue here. I am including the analysis that Gregory P Smith did.
Steps to reproduce
---
Run
```
python -m http.server 9000
```
From another terminal:
```
C:\Users\fmunozs>curl http://localhost:9000/?x=123
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Directory listing for /?x=123</title>
</head>
<body>
<h1>Directory listing for /?x=123</h1>
<hr>
<ul>
<li><a href="x.txt">x.txt</a></li>
</ul>
<hr>
</body>
</html>
curl http://localhost:9000/?x=%bb
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Directory listing for C:\Users\fmunozs\Desktop\test/</title>
</head>
<body>
<h1>Directory listing for C:\Users\fmunozs\Desktop\test/</h1>
<hr>
<ul>
<li><a href="x.txt">x.txt</a></li>
</ul>
<hr>
</body>
</html>
```
# Your environment
- CPython versions tested on: 3.11.3
- Operating system and architecture: Windows 11 and Linux
# Analysis by Gregory P Smith
This comes from https://github.com/python/cpython/blob/v3.11.3/Lib/http/server.py#L789-L793 and has been that way probably forever in Python.
```
urllib.parse.unquote('/?x=%bb', errors='surrogatepass')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xbb in position 4: invalid start byte
```
Thus `self.path` isn't used for displaypath and it falls back to displaying `path` which is the local filesystem path we don't want a server to expose, per that try:..except:..
<!-- gh-linked-prs -->
### Linked PRs
* gh-104067
* gh-104119
* gh-104120
* gh-104121
* gh-104122
* gh-104123
<!-- /gh-linked-prs -->
| c7c3a60c88de61a79ded9fdaf6bc6a29da4efb9a | 292076a9aa29aba1023340a0d24252a7b27a454e |
python/cpython | python__cpython-104037 | # Running test_typing file directly fails
```python
C:\Users\KIRILL-1\CLionProjects\cpython> ./python Lib/test/test_typing.py
Running Debug|x64 interpreter...
.............................F....................................................................................................
..........................................................................................................s.......................
..................................................................................................................................
..................................................................................................................................
.......................................................
======================================================================
FAIL: test_repr (__main__.AnyTests.test_repr)
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\KIRILL-1\CLionProjects\cpython\Lib\test\test_typing.py", line 118, in test_repr
self.assertEqual(
AssertionError: "<class '__main__.AnyTests.test_repr.<locals>.Sub'>" != "<class 'test.test_typing.AnyTests.test_repr.<locals>.Sub'
>"
- <class '__main__.AnyTests.test_repr.<locals>.Sub'>
? ^^^ ^^
+ <class 'test.test_typing.AnyTests.test_repr.<locals>.Sub'>
? +++++++++ ^^^ ^
----------------------------------------------------------------------
Ran 575 tests in 0.815s
FAILED (failures=1, skipped=1)
```
It's easy to fix, just need to replace `"<class 'test.test_typing.AnyTests.test_repr.<locals>.Sub'>"` to `f"<class '{__name__}.AnyTests.test_repr.<locals>.Sub'>"`
I'll soon send a PR
<!-- gh-linked-prs -->
### Linked PRs
* gh-104037
* gh-104039
<!-- /gh-linked-prs -->
| 4181d078fc945313568eb39965cb9190881606b5 | 59c27fa5cb95e2d608747a50fc675bbe2fc96beb |
python/cpython | python__cpython-104041 | # Frozen dataclasses with slots cannot override __getstate__ or __setstate__
You are supposed to be able to override how `pickle` pickles an object with `__getstate__` and `__setstate__`. However, these methods [are ignored](https://stackoverflow.com/questions/76143398/pickle-ignores-getstate-on-frozen-dataclasses-with-slots) in a dataclass when specifying both `frozen=True` and `slots=True`.
See this example:
```python
import pickle
from dataclasses import dataclass
@dataclass(frozen=True, slots=True)
class Foo:
bar: int
def __getstate__(self):
print("getstate")
return {"bar": self.bar}
def __setstate__(self, state):
print("setstate")
object.__setattr__(self, "bar", state["bar"])
b = pickle.dumps(Foo(1))
foo = pickle.loads(b)
```
The expected "getstate" and "setstate" lines are never printed because the supplied methods are never called. If either `frozen` or `slots` is removed, the expected lines are printed.
From [the source code](https://github.com/python/cpython/blob/main/Lib/dataclasses.py#L1228-L1231), it is pretty clear why this is happening. If `frozen` and `slots` are both `True`, then special versions of `__getstate__` and `__setstate__` are unconditionally attached to the dataclass. The dataclass decorator should probably treat this way that it does other methods—only add a method if it is not already present.
<!-- gh-linked-prs -->
### Linked PRs
* gh-104041
* gh-104044
<!-- /gh-linked-prs -->
| 99aab610622fc4b4c4fe56b77c0760cf77066a53 | e1476942525ae847875dab55541bef4a8a99dd3d |
python/cpython | python__cpython-104030 | # Reduce redundant object creation while calling callback function from gc
https://github.com/python/cpython/blob/4b27972f5fe816d3616f97f8643d8ad922473ab5/Modules/gcmodule.c#L1391-L1402
The phase object can be created earlier with one-time creation and it can be replaced with vectorcall either.
From my microbenchmark, there is 4-5% performance improvement by doing this.
## microbenchmark
```python
import pyperf
import gc
def benchamark_collection(loops):
def callback_foo(phase, info):
pass
for _ in range(100):
gc.callbacks.append(callback_foo)
total_time = 0
for _ in range(loops):
t0 = pyperf.perf_counter()
collected = gc.collect()
total_time += pyperf.perf_counter() - t0
return total_time
if __name__ == "__main__":
runner = pyperf.Runner()
runner.metadata["description"] = "GC callback benchmark"
runner.bench_time_func("create_gc_cycles", benchamark_collection)
`````
<!-- gh-linked-prs -->
### Linked PRs
* gh-104030
<!-- /gh-linked-prs -->
| e1476942525ae847875dab55541bef4a8a99dd3d | 4181d078fc945313568eb39965cb9190881606b5 |
python/cpython | python__cpython-104033 | # "z" format specifier is treated differently in unicode and bytes
Hello up there. I've hit a discrepancy in how `z` flags is handled by `%` in unicode and bytes:
- for unicode `%` rejects it as "unsupported format character" according to original discussion in https://github.com/python/cpython/issues/90153 (= [BPO-45995](https://bugs.python.org/issue45995)),
- hower for bytes `%` fully handles "z":
```console
kirr@deca:~$ python3
Python 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> '%zf' % 1 <-- unicode
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: unsupported format character 'z' (0x7a) at index 1
>>> b'%zf' % 1 <-- bytes
b'1.000000'
>>> b'%zf' % 0.0 <-- +0 -> 0
b'0.000000'
>>> b'%zf' % -0.0 <-- -0 -> 0
b'0.000000'
>>> b'%f' % -0.0 <-- -0 -> -0 if run without 'z'
b'-0.000000'
```
In other words there is inconsistency in how 'z' is handled by '%' for unicode and bytes, and there is also inconsistency in how 'z' was supposed to be handled by `.format` and not handled by '%' as originally discussed on BPO-45995.
'z' handling was implemented in https://github.com/python/cpython/pull/30049 and indeed there I see b'%z' being fully handled:
https://github.com/python/cpython/commit/b0b836b20cb5#diff-f6d440aad34e1c4535c0d898c0197a95490766c745991caace6f64b5dd1ece51
but u'%z' being only partly handled internally without corresponding frontend parsing that bytes has:
https://github.com/python/cpython/commit/b0b836b20cb5#diff-34c966e7876d6f8bf801dd51896327e4f68bba02cddb95fbf3963f0b2e39c38a
In my view the fix should be either a) to add '%z' handling to unicode, or b) to remove '%z' handling from bytes.
Thanks beforehand,
Kirill
- CPython versions tested on: 3.11.2
- Operating system and architecture: Debian GNU/Linux 12 on AMD64
/cc @belm0, @mdickinson
<!-- gh-linked-prs -->
### Linked PRs
* gh-104033
* gh-104058
* gh-104107
* gh-104260
<!-- /gh-linked-prs -->
| 69621d1b09c996e43a1e13d2fa4c317d3dd4d738 | c53547c907371be53c8016145d73ba4ea0a22756 |
python/cpython | python__cpython-104047 | # Out-of-bounds write in AST parser
# Crash report
Reported by OSS-Fuzz (issue 58510).
Reproducer:
```python
import ast
ast.parse(bytes([
0x46, 0x22, 0x76, 0x76, 0x3a, 0x6f, 0x72, 0x3a, 0x2d, 0x7b, 0x22, 0x7b,
0x22, 0x46, 0x22, 0x76, 0x3a, 0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22,
0x77, 0x72, 0x3a, 0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a,
0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x78, 0x3a, 0x77, 0x76, 0x3a,
0x3a, 0x20, 0x73, 0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a,
0x2e, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x2d, 0x7b, 0x22,
0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73,
0x61, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73, 0x2d, 0x7b, 0x22, 0x7b, 0x22,
0x46, 0x22, 0x76, 0x3a, 0x2e, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76,
0x3a, 0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x77, 0x76,
0x3a, 0x3a, 0x20, 0x73, 0x61, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73, 0x2d,
0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x2e, 0x7b, 0x22, 0x7b,
0x22, 0x46, 0x22, 0x76, 0x3a, 0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22,
0x76, 0x3a, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73, 0x61, 0x77, 0x76, 0x3a,
0x3a, 0x20, 0x73, 0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a,
0x2e, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x2d, 0x7b, 0x22,
0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73,
0x61, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73, 0x2d, 0x7b, 0x22, 0x7b, 0x22,
0x46, 0x22, 0x76, 0x3a, 0x2e, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76,
0x3a, 0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x77, 0x76,
0x3a, 0x3a, 0x20, 0x73, 0x61, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73, 0x2d,
0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x2e, 0x7b, 0x22, 0x7b,
0x22, 0x46, 0x22, 0x76, 0x3a, 0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22,
0x76, 0x3a, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73, 0x61, 0x77, 0x76, 0x3a,
0x3a, 0x20, 0x73, 0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a,
0x2e, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x2d, 0x7b, 0x22,
0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73,
0x61, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73, 0x2d, 0x7b, 0x22, 0x7b, 0x22,
0x46, 0x22, 0x76, 0x3a, 0x2e, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76,
0x3a, 0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x77, 0x76,
0x3a, 0x3a, 0x20, 0x73, 0x61, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73, 0x2d,
0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x2e, 0x7b, 0x22, 0x7b,
0x22, 0x46, 0x22, 0x76, 0x3a, 0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22,
0x76, 0x3a, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73, 0x61, 0x77, 0x76, 0x3a,
0x3a, 0x20, 0x73, 0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a,
0x2e, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x2d, 0x7b, 0x22,
0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73,
0x61, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73, 0x2d, 0x7b, 0x22, 0x7b, 0x22,
0x46, 0x22, 0x76, 0x3a, 0x2e, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76,
0x3a, 0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x77, 0x76,
0x3a, 0x3a, 0x20, 0x73, 0x61, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73, 0x2d,
0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x2e, 0x7b, 0x22, 0x7b,
0x22, 0x46, 0x22, 0x76, 0x3a, 0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22,
0x76, 0x3a, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73, 0x61, 0x77, 0x76, 0x3a,
0x3a, 0x20, 0x73, 0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a,
0x2e, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x2d, 0x7b, 0x22,
0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73,
0x61, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73, 0x2d, 0x7b, 0x22, 0x7b, 0x22,
0x46, 0x22, 0x76, 0x3a, 0x2e, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76,
0x3a, 0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x77, 0x76,
0x3a, 0x3a, 0x20, 0x73, 0x61, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73, 0x2d,
0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x2e, 0x7b, 0x22, 0x7b,
0x22, 0x46, 0x22, 0x76, 0x3a, 0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22,
0x76, 0x3a, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73, 0x61, 0x77, 0x76, 0x3a,
0x3a, 0x20, 0x73, 0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a,
0x2e, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x2d, 0x7b, 0x22,
0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73,
0x61, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73, 0x2d, 0x7b, 0x22, 0x7b, 0x22,
0x46, 0x22, 0x76, 0x3a, 0x2e, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76,
0x3a, 0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x77, 0x76,
0x3a, 0x3a, 0x20, 0x73, 0x61, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73, 0x2d,
0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x2e, 0x7b, 0x22, 0x7b,
0x22, 0x46, 0x22, 0x76, 0x3a, 0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22,
0x76, 0x3a, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73, 0x61, 0x77, 0x76, 0x3a,
0x3a, 0x20, 0x73, 0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a,
0x2e, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x2d, 0x7b, 0x22,
0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73,
0x61, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73, 0x2d, 0x7b, 0x22, 0x7b, 0x22,
0x46, 0x22, 0x76, 0x3a, 0x2e, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76,
0x3a, 0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x77, 0x76,
0x3a, 0x3a, 0x20, 0x73, 0x61, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73, 0x2d,
0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x2e, 0x7b, 0x22, 0x7b,
0x22, 0x46, 0x22, 0x76, 0x3a, 0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22,
0x76, 0x3a, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73, 0x61, 0x77, 0x76, 0x3a,
0x3a, 0x20, 0x73, 0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a,
0x2e, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x2d, 0x7b, 0x22,
0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73,
0x61, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73, 0x2d, 0x7b, 0x22, 0x7b, 0x22,
0x46, 0x22, 0x76, 0x3a, 0x2e, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76,
0x3a, 0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x77, 0x76,
0x3a, 0x3a, 0x20, 0x73, 0x61, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73, 0x2d,
0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x2e, 0x7b, 0x22, 0x7b,
0x22, 0x46, 0x22, 0x76, 0x3a, 0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22,
0x76, 0x3a, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73, 0x61, 0x77, 0x76, 0x3a,
0x3a, 0x20, 0x73, 0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a,
0x2e, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x2d, 0x7b, 0x22,
0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73,
0x61, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73, 0x2d, 0x7b, 0x22, 0x7b, 0x22,
0x46, 0x22, 0x76, 0x3a, 0x2e, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76,
0x3a, 0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x77, 0x76,
0x3a, 0x3a, 0x20, 0x73, 0x61, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73, 0x2d,
0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x2e, 0x7b, 0x22, 0x7b,
0x22, 0x46, 0x22, 0x76, 0x3a, 0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22,
0x76, 0x3a, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73, 0x61, 0x77, 0x76, 0x3a,
0x3a, 0x20, 0x73, 0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a,
0x2e, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x2d, 0x7b, 0x22,
0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73,
0x61, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73, 0x2d, 0x7b, 0x22, 0x7b, 0x22,
0x46, 0x22, 0x76, 0x3a, 0x2e, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76,
0x3a, 0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x77, 0x76,
0x3a, 0x3a, 0x20, 0x73, 0x61, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73, 0x2d,
0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x2e, 0x7b, 0x22, 0x7b,
0x22, 0x46, 0x22, 0x76, 0x3a, 0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22,
0x76, 0x3a, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73, 0x61, 0x77, 0x76, 0x3a,
0x3a, 0x20, 0x73, 0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a,
0x2e, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x2d, 0x7b, 0x22,
0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73,
0x61, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73, 0x2d, 0x7b, 0x22, 0x7b, 0x22,
0x46, 0x22, 0x76, 0x3a, 0x2e, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76,
0x3a, 0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x77, 0x76,
0x3a, 0x3a, 0x20, 0x73, 0x61, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73, 0x2d,
0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x2e, 0x7b, 0x22, 0x7b,
0x22, 0x46, 0x22, 0x76, 0x3a, 0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22,
0x76, 0x3a, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73, 0x61, 0x77, 0x76, 0x3a,
0x3a, 0x20, 0x73, 0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a,
0x2e, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x2d, 0x7b, 0x22,
0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73,
0x61, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73, 0x2d, 0x7b, 0x22, 0x7b, 0x22,
0x46, 0x22, 0x76, 0x3a, 0x2e, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76,
0x3a, 0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x77, 0x76,
0x3a, 0x3a, 0x20, 0x73, 0x61, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73, 0x2d,
0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x2e, 0x7b, 0x22, 0x7b,
0x22, 0x46, 0x22, 0x76, 0x3a, 0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22,
0x76, 0x3a, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73, 0x61, 0x77, 0x76, 0x3a,
0x3a, 0x20, 0x73, 0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a,
0x2e, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x2d, 0x7b, 0x22,
0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73,
0x61, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73, 0x2d, 0x7b, 0x22, 0x7b, 0x22,
0x46, 0x22, 0x76, 0x3a, 0x2e, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76,
0x3a, 0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x77, 0x76,
0x3a, 0x3a, 0x20, 0x73, 0x61, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73, 0x2d,
0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x2e, 0x7b, 0x22, 0x7b,
0x22, 0x46, 0x22, 0x76, 0x3a, 0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22,
0x76, 0x3a, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73, 0x61, 0x77, 0x76, 0x3a,
0x3a, 0x20, 0x73, 0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a,
0x2e, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x2d, 0x7b, 0x22,
0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73,
0x61, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73, 0x2d, 0x7b, 0x22, 0x7b, 0x22,
0x46, 0x22, 0x76, 0x3a, 0x2e, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76,
0x3a, 0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x77, 0x76,
0x3a, 0x3a, 0x20, 0x73, 0x61, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73, 0x2d,
0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x2e, 0x7b, 0x22, 0x7b,
0x22, 0x46, 0x22, 0x76, 0x3a, 0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22,
0x76, 0x3a, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73, 0x61, 0x77, 0x76, 0x3a,
0x3a, 0x20, 0x73, 0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a,
0x2e, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x2d, 0x7b, 0x22,
0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73,
0x61, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73, 0x2d, 0x7b, 0x22, 0x7b, 0x22,
0x46, 0x22, 0x76, 0x3a, 0x2e, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76,
0x3a, 0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x77, 0x76,
0x3a, 0x3a, 0x20, 0x73, 0x61, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73, 0x2d,
0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x2e, 0x7b, 0x22, 0x7b,
0x22, 0x46, 0x22, 0x76, 0x3a, 0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22,
0x76, 0x3a, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73, 0x61, 0x77, 0x76, 0x3a,
0x3a, 0x20, 0x73, 0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a,
0x2e, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x2d, 0x7b, 0x22,
0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73,
0x61, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73, 0x2d, 0x7b, 0x22, 0x7b, 0x22,
0x46, 0x22, 0x76, 0x3a, 0x2e, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76,
0x3a, 0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x77, 0x76,
0x3a, 0x3a, 0x20, 0x73, 0x61, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73, 0x2d,
0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x7b, 0x22, 0x46, 0x22, 0x76,
0x3a, 0x2e, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x2d, 0x7b,
0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x77, 0x76, 0x3a, 0x3a, 0x20,
0x73, 0x61, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73, 0x2d, 0x7b, 0x22, 0x7b,
0x22, 0x46, 0x22, 0x76, 0x3a, 0x2e, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22,
0x76, 0x3a, 0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x77,
0x76, 0x3a, 0x3a, 0x20, 0x73, 0x61, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73,
0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x2e, 0x7b, 0x22,
0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46,
0x22, 0x76, 0x3a, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73, 0x61, 0x77, 0x76,
0x3a, 0x3a, 0x20, 0x73, 0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76,
0x3a, 0x2e, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x2d, 0x7b,
0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x77, 0x76, 0x3a, 0x3a, 0x20,
0x73, 0x61, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73, 0x2d, 0x7b, 0x22, 0x7b,
0x22, 0x46, 0x22, 0x76, 0x3a, 0x2e, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22,
0x76, 0x3a, 0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x77,
0x76, 0x3a, 0x3a, 0x20, 0x73, 0x61, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73,
0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x2e, 0x7b, 0x22,
0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46,
0x22, 0x76, 0x3a, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73, 0x61, 0x77, 0x76,
0x3a, 0x3a, 0x20, 0x73, 0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76,
0x3a, 0x2e, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x2d, 0x7b,
0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x77, 0x76, 0x3a, 0x3a, 0x20,
0x73, 0x61, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73, 0x2d, 0x7b, 0x22, 0x7b,
0x22, 0x46, 0x22, 0x76, 0x3a, 0x2e, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22,
0x76, 0x3a, 0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x77,
0x76, 0x3a, 0x3a, 0x20, 0x73, 0x61, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73,
0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x2e, 0x7b, 0x22,
0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46,
0x22, 0x76, 0x3a, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73, 0x61, 0x77, 0x76,
0x3a, 0x3a, 0x20, 0x73, 0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76,
0x3a, 0x2e, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x2d, 0x7b,
0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x77, 0x76, 0x3a, 0x3a, 0x20,
0x73, 0x61, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73, 0x2d, 0x7b, 0x22, 0x7b,
0x22, 0x46, 0x22, 0x76, 0x3a, 0x2e, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22,
0x76, 0x3a, 0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x77,
0x76, 0x3a, 0x3a, 0x20, 0x73, 0x61, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73,
0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x2e, 0x7b, 0x22,
0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46,
0x22, 0x76, 0x3a, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73, 0x61, 0x77, 0x76,
0x3a, 0x3a, 0x20, 0x73, 0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76,
0x3a, 0x2e, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x2d, 0x7b,
0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x77, 0x76, 0x3a, 0x3a, 0x20,
0x73, 0x61, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73, 0x2d, 0x7b, 0x22, 0x7b,
0x22, 0x46, 0x22, 0x76, 0x3a, 0x2e, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22,
0x76, 0x3a, 0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x77,
0x76, 0x3a, 0x3a, 0x20, 0x73, 0x61, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73,
0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x2e, 0x7b, 0x22,
0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46,
0x22, 0x76, 0x3a, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73, 0x61, 0x77, 0x76,
0x3a, 0x3a, 0x20, 0x73, 0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76,
0x3a, 0x2e, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x2d, 0x7b,
0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x77, 0x76, 0x3a, 0x3a, 0x20,
0x73, 0x61, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73, 0x2d, 0x7b, 0x22, 0x7b,
0x22, 0x46, 0x22, 0x76, 0x3a, 0x2e, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22,
0x76, 0x3a, 0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x77,
0x76, 0x3a, 0x3a, 0x20, 0x73, 0x61, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73,
0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x2e, 0x7b, 0x22,
0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46,
0x22, 0x76, 0x3a, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73, 0x61, 0x77, 0x76,
0x3a, 0x3a, 0x20, 0x73, 0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76,
0x3a, 0x2e, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x2d, 0x7b,
0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x77, 0x76, 0x3a, 0x3a, 0x20,
0x73, 0x61, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73, 0x2d, 0x7b, 0x22, 0x7b,
0x22, 0x46, 0x22, 0x76, 0x3a, 0x2e, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22,
0x76, 0x3a, 0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x77,
0x76, 0x3a, 0x3a, 0x20, 0x73, 0x61, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73,
0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x2e, 0x7b, 0x22,
0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46,
0x22, 0x76, 0x3a, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73, 0x61, 0x77, 0x76,
0x3a, 0x3a, 0x20, 0x73, 0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76,
0x3a, 0x2e, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x2d, 0x7b,
0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x77, 0x76, 0x3a, 0x3a, 0x20,
0x73, 0x61, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73, 0x2d, 0x7b, 0x22, 0x7b,
0x22, 0x46, 0x22, 0x76, 0x3a, 0x2e, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22,
0x76, 0x3a, 0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x77,
0x76, 0x3a, 0x3a, 0x20, 0x73, 0x61, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73,
0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x2e, 0x7b, 0x22,
0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46,
0x22, 0x76, 0x3a, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73, 0x61, 0x77, 0x76,
0x3a, 0x3a, 0x20, 0x73, 0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76,
0x3a, 0x2e, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x2d, 0x7b,
0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x77, 0x76, 0x3a, 0x3a, 0x20,
0x73, 0x61, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73, 0x2d, 0x7b, 0x22, 0x7b,
0x22, 0x46, 0x22, 0x76, 0x3a, 0x2e, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22,
0x76, 0x3a, 0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x77,
0x76, 0x3a, 0x3a, 0x20, 0x73, 0x61, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73,
0x3a, 0x2e, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x2d, 0x7b,
0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x77, 0x76, 0x3a, 0x3a, 0x20,
0x73, 0x61, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73, 0x2d, 0x7b, 0x22, 0x7b,
0x22, 0x46, 0x22, 0x76, 0x3a, 0x2e, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22,
0x76, 0x3a, 0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x77,
0x76, 0x3a, 0x3a, 0x20, 0x73, 0x61, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73,
0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x2e, 0x7b, 0x22,
0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46,
0x22, 0x76, 0x3a, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73, 0x61, 0x77, 0x76,
0x3a, 0x3a, 0x20, 0x73, 0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76,
0x3a, 0x2e, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x2d, 0x7b,
0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x77, 0x76, 0x3a, 0x3a, 0x20,
0x73, 0x61, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73, 0x2d, 0x7b, 0x22, 0x7b,
0x22, 0x46, 0x22, 0x76, 0x3a, 0x2e, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22,
0x76, 0x3a, 0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x77,
0x76, 0x3a, 0x3a, 0x20, 0x73, 0x61, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73,
0x2d, 0x7b, 0x75, 0x74, 0x66, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a,
0x2e, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x2d, 0x7b, 0x22,
0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73,
0x61, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73, 0x2d, 0x7b, 0x22, 0x7b, 0x22,
0x46, 0x22, 0x76, 0x3a, 0x2e, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76,
0x3a, 0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x77, 0x76,
0x3a, 0x3a, 0x20, 0x74, 0x61, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73, 0x2d,
0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22, 0x76, 0x3a, 0x2e, 0x7b, 0x22, 0x7b,
0x22, 0x46, 0x22, 0x76, 0x3a, 0x2d, 0x7b, 0x22, 0x7b, 0x22, 0x46, 0x22,
0x76, 0x3a, 0x77, 0x76, 0x3a, 0x3a, 0x20, 0x73, 0x61, 0x2d, 0x7b, 0xa7,
0x61, 0x2d, 0xf3, 0xa0, 0x81, 0xb5, 0xf3, 0xa0, 0x81, 0x81, 0xb5, 0xf3,
0xa0, 0x81, 0x81, 0xb5, 0xf3, 0xa0, 0x81, 0x81, 0xb5, 0xf3, 0xa0, 0x81,
0x81, 0xb5, 0xf3, 0xa0, 0x81, 0x81, 0xb5, 0xf3, 0xa1, 0x81, 0x81, 0xb5,
0xf3, 0xa0, 0x81, 0x81, 0xb5, 0xf3, 0xa0, 0x81, 0x81, 0xb5, 0xf3, 0xa0,
0x81, 0x81, 0xb5, 0xf3, 0xa0, 0x81, 0x81, 0xb5, 0xf3, 0xa0, 0x81, 0x81,
0xb5, 0xf3, 0xa0, 0x81, 0x81, 0xb5, 0xf3, 0xa0, 0x81, 0x81, 0xb5, 0xf3,
0xa0, 0x81, 0x81, 0xb5, 0xf3, 0xa0, 0x81, 0x81, 0xb5, 0xf3, 0xa0, 0x81,
0x81, 0xb5, 0xf3, 0xa0, 0x81, 0x81, 0xb5, 0xf3, 0xa0, 0x81, 0x81, 0xb5,
0xf3, 0xa0, 0x81, 0x81, 0xb5, 0xf3, 0xa0, 0x81, 0x81, 0xb5, 0xf3, 0xa0,
0x81, 0x81, 0xb5, 0xf3, 0xa0, 0x81, 0x81, 0xb5, 0xf3, 0xa0, 0x81, 0x81,
0xb5, 0xf3, 0xa0, 0x81, 0x81, 0xb5, 0xf3, 0xa0, 0x81, 0x81, 0xb5, 0xf3,
0xa0, 0x81, 0x81, 0xb5, 0xf3, 0xa0, 0x81, 0x81, 0xb5, 0xf3, 0xa0, 0x81,
0x81, 0xb5, 0xf3, 0xa0, 0x81, 0x82, 0xb5, 0xf3, 0xa0, 0x81, 0x81, 0xb5,
0xf3, 0xa0, 0x81, 0x81, 0xb5, 0xf3, 0xa0, 0x81, 0x81, 0xb5, 0xf3, 0xa0,
0x81, 0x81, 0xb5, 0xf3, 0xa0, 0x81, 0x81, 0xb5, 0xf3, 0xa0, 0x81, 0x81,
0xb5, 0xf3, 0xa0, 0x81, 0x81, 0xb5, 0xf3, 0xa0, 0x81, 0x81, 0xb5, 0xf3,
0xa0, 0x81, 0x81, 0xb5, 0xf3, 0xa0, 0x81, 0x81, 0xb5, 0xf3, 0xa0, 0x81,
0x81, 0xb5, 0xf3, 0xa1, 0x81, 0x81, 0xb5, 0xf3, 0xa0, 0x81, 0x81, 0xb5,
0xf3, 0xa0, 0x81, 0x81, 0xb5, 0xf3, 0xa0, 0x81, 0x81, 0xb5, 0xf3, 0xa0,
0x81, 0x81, 0xb5, 0xf3, 0xa0, 0x81, 0x81, 0xb5, 0xf3, 0xa0, 0x81, 0x81,
0xb5, 0xf3, 0xa0, 0x81, 0x81, 0xb5, 0xf3, 0xa0, 0x81, 0x81, 0xb5, 0xf3,
0xa0, 0x81, 0x81, 0xb5, 0xf3, 0xa0, 0x81, 0x81, 0xb5, 0xf3, 0xa0, 0x81,
0x81, 0xb5, 0xf3, 0xa0, 0x81, 0x81, 0xb5, 0xf3, 0xa0, 0x81, 0x81, 0xb5,
0xf3, 0xa0, 0x81, 0x81, 0xb5, 0xf3, 0xa0, 0x81, 0x81, 0xb5, 0xf3, 0xa0,
0x81, 0x81, 0xb5, 0xf3, 0xa0, 0x81, 0x81, 0xb5, 0xf3, 0xa0, 0x81, 0x81,
0xb5, 0xf3, 0xa0, 0x81, 0x81, 0xb5, 0xf3, 0xa0, 0x81, 0x81, 0xb5, 0xf3,
0xa0, 0x81, 0x81, 0xb5, 0xf3, 0xa0, 0x81, 0x81, 0xb5, 0xf3, 0xa0, 0x81,
0x81, 0xb5, 0xf3, 0xa0, 0x81, 0x81, 0xb5, 0xf3, 0xa0, 0x81, 0x81, 0xb5,
0xf3, 0xa0, 0x81, 0x81, 0xb5, 0xf3, 0xa0, 0x81, 0x81, 0xb5, 0xf3, 0xa0,
0x81, 0x81, 0xb5, 0xf3, 0xa0, 0x81, 0x81, 0xb5, 0xf3, 0xa0, 0x81, 0x81,
0xb5, 0xf3, 0xa0, 0x81, 0x81, 0xb5, 0xf3, 0xa0, 0x81, 0x81, 0xb5, 0xf3,
0xa0, 0x81, 0x81, 0xb5, 0xf3, 0xa0, 0x81, 0x81, 0xb5, 0xf3, 0xa0, 0x81,
0x81, 0xb5, 0xf3, 0xa0, 0x81, 0x81, 0xb5, 0xf3, 0xa0, 0x81, 0x81, 0xb5,
0xf3, 0xa0, 0x81, 0x81, 0xb5, 0xf3, 0xa0, 0x81, 0x81, 0xb5, 0xf3, 0xa0,
0x81, 0x81, 0xb5, 0xf3, 0xa0, 0x81, 0x81, 0xb5, 0xf3, 0xa0, 0x81, 0x81,
0xb5, 0xf3, 0xa0, 0x81, 0x81, 0xb5, 0xf3, 0xa0, 0x81, 0x81, 0xb5, 0xf3,
0xa0, 0x81, 0x81, 0xb5, 0xf3, 0xa0, 0x81, 0x81, 0xb5, 0xf3, 0xa0, 0x81,
0x81, 0xb5, 0xf3, 0xa0, 0x81, 0x81, 0xb5, 0xf3, 0xa0, 0x81, 0x81, 0xb5,
0xf3, 0xa0, 0x81, 0x81, 0xb5, 0xf3, 0xa0, 0x81, 0x81, 0xb5, 0xf3, 0xa0,
0x81, 0x81, 0xb5, 0xf3, 0xa0, 0x81, 0xa7, 0x7b, 0x15, 0x7b, 0xc0, 0xad,
0x7b, 0x7b, 0xc0, 0xad, 0x7b, 0x22]))
```
Regression range: https://github.com/python/cpython/compare/ece20dba120a1a4745721c49f8d7389d4b1ee2a7...6be7aee18c5b8e639103df951d0d277f4b46f902
# Error messages
AddressSanitizer stack trace:
```
==2936==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x62a0000b91f4 at pc 0x000000c0a818 bp 0x7ffc21dc1e30 sp 0x7ffc21dc1e28
WRITE of size 1 at 0x62a0000b91f4 thread T0
SCARINESS: 31 (1-byte-write-heap-buffer-overflow)
#0 0xc0a817 in tok_get_normal_mode cpython/Parser/tokenizer.c:2240:41
#1 0xbf81d5 in tok_get cpython/Parser/tokenizer.c:2676:16
#2 0xbf81d5 in _PyTokenizer_Get cpython/Parser/tokenizer.c:2685:18
#3 0xb46ffa in _PyPegen_tokenize_full_source_to_check_for_errors cpython/Parser/pegen_errors.c:171:17
#4 0xb46c26 in _Pypegen_set_syntax_error cpython/Parser/pegen_errors.c:0
#5 0xb4313c in _PyPegen_run_parser cpython/Parser/pegen.c:858:9
#6 0xb43a4d in _PyPegen_run_parser_from_string cpython/Parser/pegen.c:952:14
#7 0xbf4ec7 in _PyParser_ASTFromString cpython/Parser/peg_api.c:14:21
#8 0x95dab9 in Py_CompileStringObject cpython/Python/pythonrun.c:1771:11
#9 0x7d8af6 in builtin_compile_impl cpython/Python/bltinmodule.c:831:14
#10 0x7d8af6 in builtin_compile cpython/Python/clinic/bltinmodule.c.h:383:20
#11 0xca3720 in cfunction_vectorcall_FASTCALL_KEYWORDS cpython/Objects/methodobject.c:438:24
#12 0x5c1b88 in _PyObject_VectorcallTstate cpython/Include/internal/pycore_call.h:92:11
#13 0x5c1b88 in PyObject_Vectorcall cpython/Objects/call.c:301:12
#14 0x7f427f in _PyEval_EvalFrameDefault cpython/Python/bytecodes.c:2577:19
#15 0x7e2a1f in _PyEval_EvalFrame cpython/Include/internal/pycore_ceval.h:88:16
#16 0x7e2a1f in _PyEval_Vector cpython/Python/ceval.c:1529:12
#17 0x5c261e in _PyFunction_Vectorcall cpython/Objects/call.c:0
#18 0x5c193f in _PyVectorcall_Call cpython/Objects/call.c:247:16
#19 0x5c1f22 in _PyObject_Call cpython/Objects/call.c:330:16
#20 0x5c2a23 in PyObject_CallObject cpython/Objects/call.c:454:12
#21 0x593bc4 in LLVMFuzzerTestOneInput python-library-fuzzers/fuzzer.cpp:134:14
#22 0x461943 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:611:15
#23 0x44d0a2 in fuzzer::RunOneTest(fuzzer::Fuzzer*, char const*, unsigned long) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:324:6
#24 0x45294c in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:860:9
#25 0x47be82 in main /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerMain.cpp:20:10
#26 0x7eafaded4082 in __libc_start_main /build/glibc-SzIz7B/glibc-2.31/csu/libc-start.c:308:16
#27 0x44326d in _start
0x62a0000b91f4 is located 4 bytes to the right of 20464-byte region [0x62a0000b4200,0x62a0000b91f0)
allocated by thread T0 here:
#0 0x552ad6 in __interceptor_malloc /src/llvm-project/compiler-rt/lib/asan/asan_malloc_linux.cpp:69:3
#1 0x68ee29 in _PyMem_RawMalloc cpython/Objects/obmalloc.c:42:12
#2 0x691e7a in PyMem_Malloc cpython/Objects/obmalloc.c:587:12
#3 0xbf580a in tok_new cpython/Parser/tokenizer.c:74:49
#4 0xbf580a in _PyTokenizer_FromString cpython/Parser/tokenizer.c:884:29
#5 0xb43752 in _PyPegen_run_parser_from_string cpython/Parser/pegen.c:929:15
#6 0xbf4ec7 in _PyParser_ASTFromString cpython/Parser/peg_api.c:14:21
#7 0x95dab9 in Py_CompileStringObject cpython/Python/pythonrun.c:1771:11
#8 0x7d8af6 in builtin_compile_impl cpython/Python/bltinmodule.c:831:14
#9 0x7d8af6 in builtin_compile cpython/Python/clinic/bltinmodule.c.h:383:20
#10 0xca3720 in cfunction_vectorcall_FASTCALL_KEYWORDS cpython/Objects/methodobject.c:438:24
#11 0x5c1b88 in _PyObject_VectorcallTstate cpython/Include/internal/pycore_call.h:92:11
#12 0x5c1b88 in PyObject_Vectorcall cpython/Objects/call.c:301:12
#13 0x7f427f in _PyEval_EvalFrameDefault cpython/Python/bytecodes.c:2577:19
#14 0x7e2a1f in _PyEval_EvalFrame cpython/Include/internal/pycore_ceval.h:88:16
#15 0x7e2a1f in _PyEval_Vector cpython/Python/ceval.c:1529:12
#16 0x5c261e in _PyFunction_Vectorcall cpython/Objects/call.c:0
#17 0x5c193f in _PyVectorcall_Call cpython/Objects/call.c:247:16
#18 0x5c1f22 in _PyObject_Call cpython/Objects/call.c:330:16
#19 0x5c2a23 in PyObject_CallObject cpython/Objects/call.c:454:12
#20 0x593bc4 in LLVMFuzzerTestOneInput python-library-fuzzers/fuzzer.cpp:134:14
#21 0x461943 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:611:15
#22 0x44d0a2 in fuzzer::RunOneTest(fuzzer::Fuzzer*, char const*, unsigned long) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:324:6
#23 0x45294c in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:860:9
#24 0x47be82 in main /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerMain.cpp:20:10
#25 0x7eafaded4082 in __libc_start_main /build/glibc-SzIz7B/glibc-2.31/csu/libc-start.c:308:16
```
# Your environment
Linux x64, latest cpython `main` branch checkout.
<!-- gh-linked-prs -->
### Linked PRs
* gh-104047
* gh-104071
<!-- /gh-linked-prs -->
| 5078eedc5b18f0d208af6e30f60b33419132d1b6 | 2d526cd32fe8b286aae38956648e508070729f8f |
python/cpython | python__cpython-104017 | # Running test_dataclasses file directly fails
# Bug report
Running `./python Lib/test/test_dataclasses.py` gives me these test fails:
```pytb
[root@codespaces-44977f cpython]# ./python Lib/test/test_dataclasses.py
....................................................................................................................................................................................EEEEEE...................................................
======================================================================
ERROR: test_pickle_support (__main__.TestMakeDataclass.test_pickle_support) (proto=0)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/workspaces/cpython/Lib/test/test_dataclasses.py", line 3802, in test_pickle_support
pickle.loads(pickle.dumps(klass, proto)),
^^^^^^^^^^^^^^^^^^^^^^^^^^
_pickle.PicklingError: Can't pickle <class 'test.test_dataclasses.ManualModuleMakeDataClass'>: it's not the same object as test.test_dataclasses.ManualModuleMakeDataClass
======================================================================
ERROR: test_pickle_support (__main__.TestMakeDataclass.test_pickle_support) (proto=1)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/workspaces/cpython/Lib/test/test_dataclasses.py", line 3802, in test_pickle_support
pickle.loads(pickle.dumps(klass, proto)),
^^^^^^^^^^^^^^^^^^^^^^^^^^
_pickle.PicklingError: Can't pickle <class 'test.test_dataclasses.ManualModuleMakeDataClass'>: it's not the same object as test.test_dataclasses.ManualModuleMakeDataClass
======================================================================
ERROR: test_pickle_support (__main__.TestMakeDataclass.test_pickle_support) (proto=2)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/workspaces/cpython/Lib/test/test_dataclasses.py", line 3802, in test_pickle_support
pickle.loads(pickle.dumps(klass, proto)),
^^^^^^^^^^^^^^^^^^^^^^^^^^
_pickle.PicklingError: Can't pickle <class 'test.test_dataclasses.ManualModuleMakeDataClass'>: it's not the same object as test.test_dataclasses.ManualModuleMakeDataClass
======================================================================
ERROR: test_pickle_support (__main__.TestMakeDataclass.test_pickle_support) (proto=3)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/workspaces/cpython/Lib/test/test_dataclasses.py", line 3802, in test_pickle_support
pickle.loads(pickle.dumps(klass, proto)),
^^^^^^^^^^^^^^^^^^^^^^^^^^
_pickle.PicklingError: Can't pickle <class 'test.test_dataclasses.ManualModuleMakeDataClass'>: it's not the same object as test.test_dataclasses.ManualModuleMakeDataClass
======================================================================
ERROR: test_pickle_support (__main__.TestMakeDataclass.test_pickle_support) (proto=4)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/workspaces/cpython/Lib/test/test_dataclasses.py", line 3802, in test_pickle_support
pickle.loads(pickle.dumps(klass, proto)),
^^^^^^^^^^^^^^^^^^^^^^^^^^
_pickle.PicklingError: Can't pickle <class 'test.test_dataclasses.ManualModuleMakeDataClass'>: it's not the same object as test.test_dataclasses.ManualModuleMakeDataClass
======================================================================
ERROR: test_pickle_support (__main__.TestMakeDataclass.test_pickle_support) (proto=5)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/workspaces/cpython/Lib/test/test_dataclasses.py", line 3802, in test_pickle_support
pickle.loads(pickle.dumps(klass, proto)),
^^^^^^^^^^^^^^^^^^^^^^^^^^
_pickle.PicklingError: Can't pickle <class 'test.test_dataclasses.ManualModuleMakeDataClass'>: it's not the same object as test.test_dataclasses.ManualModuleMakeDataClass
----------------------------------------------------------------------
Ran 232 tests in 0.408s
FAILED (errors=6)
```
When running `./python -m test test_dataclasses`, the tests all pass successfully. My understanding is that `python -m test` is the recommended way of running tests, but it's confusing to have it support running the file directly, but have the tests fail.
I'm not sure what the cause of the failure is.
# Your environment
- CPython versions tested on: main (ed95e8cbd4cbc813666c7ce7760257cc0f169d03)
- Operating system and architecture: GitHub Codespaces
<!-- gh-linked-prs -->
### Linked PRs
* gh-104017
<!-- /gh-linked-prs -->
| 654d44b3a4d3ee4d92b690668aa5189acf4f9d8f | 7d3931e94a76491111a6e391e111cb066236cff4 |
python/cpython | python__cpython-104014 | # `test_calendar` fails on Azure Pipelines
The newly added test `test_calendar.CalendarTestCase.test_deprecation_warning` (added in https://github.com/python/cpython/commit/84e7d0f0c7f9a44d81be2d705ed4d401a6505356) has been consistently failing on Azure Pipelines over the past day. Example: https://dev.azure.com/Python/cpython/_build/results?buildId=126290&view=logs&j=0fcf9c9b-89fc-526f-8708-363e467e119e&t=fa5ef4ee-3911-591e-4444-19482ab189b7&l=463. I'm not sure why there's a difference between Azure Pipelines and GitHub Actions here, but it does also fail for me locally on Windows.
Cc. @Agent-Hellboy / @hugovk
The fix seems simple; I have a PR ready.
<!-- gh-linked-prs -->
### Linked PRs
* gh-104014
<!-- /gh-linked-prs -->
| 7d3931e94a76491111a6e391e111cb066236cff4 | f186557dc3e77495ba65b9b7e492ab6ddb7cecc3 |
python/cpython | python__cpython-104013 | # typing: Document get_origin and get_args separately
Currently `get_args` and `get_origin` share the same documentation paragraph:
<img width="904" alt="Screen Shot 2023-04-30 at 6 58 36 AM" src="https://user-images.githubusercontent.com/906600/235356943-27853a8c-384b-4585-8047-1b6487effac3.png">
This makes it look like `get_args` is undocumented. I think the two functions are different enough that it makes sense to give each its own paragraph of documentation.
<!-- gh-linked-prs -->
### Linked PRs
* gh-104013
* gh-104359
<!-- /gh-linked-prs -->
| a7a2dbbf72aceef61bfb50901bfa39bfb8d6d229 | ce8d3db25660b029fa589a2072f4daf2a8723c50 |
python/cpython | python__cpython-104004 | # Implement PEP 702: Marking deprecations using the type system
PEP-702 is still under consideration by the Steering Council. I'm opening a PR now with a draft implementation, so we can get it merged quickly if the SC approves the PEP in time for the 3.12 cutoff.
<!-- gh-linked-prs -->
### Linked PRs
* gh-104004
<!-- /gh-linked-prs -->
| d4a6229afe10d7e5a9a59bf9472f36d7698988db | 403886942376210662610627b01fea6acd77d331 |
python/cpython | python__cpython-103990 | # segfault in mmap object when using __index__ method that closes the mmap
The following (artificial) code segfaults CPython (I tried a bunch of versions, including git main) on my x86 Ubuntu Linux 22.10:
```python
import mmap
with open("abcds", "w+") as f:
f.write("foobar")
f.flush()
class X(object):
def __index__(self):
m.close()
return 1
m = mmap.mmap(f.fileno(), 6, access=mmap.ACCESS_READ)
print(m[1])
print(m[X()])
```
The problem is this code in `mmapmodule.c`
```c
static PyObject *
mmap_subscript(mmap_object *self, PyObject *item)
{
CHECK_VALID(NULL);
if (PyIndex_Check(item)) {
Py_ssize_t i = PyNumber_AsSsize_t(item, PyExc_IndexError);
if (i == -1 && PyErr_Occurred())
return NULL;
if (i < 0)
i += self->size;
if (i < 0 || i >= self->size) {
PyErr_SetString(PyExc_IndexError,
"mmap index out of range");
return NULL;
}
return PyLong_FromLong(Py_CHARMASK(self->data[i]));
...
```
the `CHECK_VALID(NULL)` call which checks whether the mmap object is closed happens before the `PyNumber_AsSsize_t` call which closes the object (and similarly for the slice handling which happens further down).
<!-- gh-linked-prs -->
### Linked PRs
* gh-103990
* gh-104677
<!-- /gh-linked-prs -->
| ceaa4c3476ac49b5b31954fec53796c7a3b40349 | 3bc94e678f2961eafc9d665898d73afc6204d314 |
python/cpython | python__cpython-103979 | # 'class' parameter name in headers breaks building C++ extensions
See https://github.com/python/cpython/pull/103809#issuecomment-1526680458
<!-- gh-linked-prs -->
### Linked PRs
* gh-103979
<!-- /gh-linked-prs -->
| ebf97c50f25d61e15671a4658f5718f214c35a98 | 83aa496f81f86b46caf249a8ff7e168e6b27622d |
python/cpython | python__cpython-103981 | # Move compiled regular expressions in platform.py into cached methods
In `platform.py` there are several regular expressions compiled during import that might not be used at all. The regular expressions are only called once at most, since they are called from without cached metods. We can eliminate the cost of compilation by moving the regular expressions into the methods.
<!-- gh-linked-prs -->
### Linked PRs
* gh-103981
<!-- /gh-linked-prs -->
| f186557dc3e77495ba65b9b7e492ab6ddb7cecc3 | ed95e8cbd4cbc813666c7ce7760257cc0f169d03 |
python/cpython | python__cpython-103980 | # Incorrect locations for code following `case` blocks
# Bug report
In the following example, the debugger hits a breakpoint that is set in the `aVariable = ...` line, which is in an if-statement whose condition is `False` and which should therefore not be executed. When I run the example with coverage (under PyCharm 2023.1), that line turns green. The print statement is _not_ executed, which matches the expectation.
The assignment does not actually happen. It somehow just _hits_ the line without really executing it.
Minimal reproducible example:
```
match 1:
case 1:
if False:
print('this should not be executed')
aVariable = 'somehow, we can hit a breakpoint here'
```
The same happens, if the last statement in the unreachable code is a _pass_. If I replace it with e.g. a `print()` statement, then everything behaves as expected.
If we extend the example a little bit, that behavior is reproducible for an unreachable _else_ block, too:
```
match 1:
case 1:
if True:
pass
else:
anotherVariable = 'somehow, we can hit a breakpoint here, too'
```
# Your environment
```
python --version
Python 3.11.3
```
```
lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.2 LTS
Release: 22.04
Codename: jammy
```
I initially encountered that behavior in a 3.10 version. Due to the fact that I thought, I could fix it with an upgrade to 3.11, I don't know the exact minor version of 3.10.
I double-checked this with the first online Python debugger that I could find and it behaves the same way.
<!-- gh-linked-prs -->
### Linked PRs
* gh-103980
* gh-103984
<!-- /gh-linked-prs -->
| 79b9db9295a5a1607a0b4b10a8b4b72567eaf1ef | 689723a4abdc1e61a9f71db8ff40886ae1b1704d |
python/cpython | python__cpython-103972 | # PyType_FromSpec refuses to create classes with tp_new
As reported in #60074, since `PyType_FromMetaclass` was added, other functions from the `PyType_FromSpec` family refuse to create classes whose metaclass has a non-default `tp_new`. IMO this is the correct default behaviour -- we don't have the arguments to call `tp_new` with, and skipping it may be dangerous.
Nevertheless, it's a backwards-incompatible change. It should only be made after a deprecation period.
I'm working on a fix.
<!-- gh-linked-prs -->
### Linked PRs
* gh-103972
* gh-105386
* gh-105697
* gh-105698
* gh-106619
<!-- /gh-linked-prs -->
| 524a7f77fd8244835e382f076dd4a76404580bb3 | 423d7faeb37b6c13b3ebbf9255165fefc651983e |
python/cpython | python__cpython-104029 | # dis: Show names of intrinsics
For `CALL_INTRINSIC_*` opcodes, `dis` currently just shows the number, which makes it hard to figure out what the code actually does:
```
2 LOAD_CONST 0 ('T')
4 CALL_INTRINSIC_1 7
```
It would be nice if this instead said
```
2 LOAD_CONST 0 ('T')
4 CALL_INTRINSIC_1 7 (INTRINSIC_TYPEVAR)
```
Possible implementation strategy:
- instrinsic names are defined in opcode.py
- `pycore_intrinsics.h` is generated from opcode.py (bonus: we no longer have to manually update MAX_INTRINSIC_1)
- `dis` learns to read the intrinsic names from opcode.py
<!-- gh-linked-prs -->
### Linked PRs
* gh-104029
* gh-104177
<!-- /gh-linked-prs -->
| 872cbc613245db7a1fc5e6656ed0135d2e115f50 | 65a49c6553a27cc36eebb4b79f409c3cb4450d8c |
python/cpython | python__cpython-103983 | # Documentation: dark theme & images
# Documentation
Starting from version 3.12, the Docs now have a dark theme. However, this feature does not affect the images. As an example, please visit https://docs.python.org/3.12/library/pathlib.html.
The page contains an image of an inheritance tree. In the dark theme, the rectangles remain white, which is not visually appealing: 
To address this issue, I propose making these images compatible with the dark theme:

Although I'm not an expert in HTML/CSS, a quick search suggests that adding `style="filter:invert(1)"` to `<img>` element can help achieve this.
<!-- gh-linked-prs -->
### Linked PRs
* gh-103983
* gh-104358
<!-- /gh-linked-prs -->
| 13ac1766bca7969a6c142c9176db901dd29c3519 | b8f7ab5783b370004757af5a4c6e70c63dc5fe7a |
python/cpython | python__cpython-103958 | # `trace`: line tracing output lacks newlines if source lines are not available
`trace` doesn't print newline character when handling line event if it can't fetch source line that corresponds to a current frame, e. g. in case of frozen modules (or in any other case when `frame.f_code.co_filename` points to a non-existing file).
Example:
```python
import numpy as np
x = np.array([1, 2, 3])
```
```
./python -m trace --trace example.py
```
```
--- modulename: example, funcname: <module>
example.py(2): import signal
--- modulename: _bootstrap, funcname: _find_and_load
<frozen importlib._bootstrap>(1299): <frozen importlib._bootstrap>(1300): <frozen importlib._bootstrap>(1302): --- modulename: _bootstrap, funcname: __init__
<frozen importlib._bootstrap>(325): <frozen importlib._bootstrap>(326): --- modulename: _bootstrap, funcname: __enter__
<frozen importlib._bootstrap>(329): --- modulename: _bootstrap, funcname: _get_module_lock
<frozen importlib._bootstrap>(344): <frozen importlib._bootstrap>(345): <frozen importlib._bootstrap>(346): <frozen importlib._bootstrap>(347): <frozen importlib._bootstrap>(348): <frozen importlib._bootstrap>(349): <frozen importlib._bootstrap>(351): <frozen importlib._bootstrap>(352): <frozen importlib._bootstrap>(355): --- modulename: _bootstrap, funcname: __init__
<frozen importlib._bootstrap>(165): <frozen importlib._bootstrap>(166): <frozen importlib._bootstrap>(169): <frozen importlib._bootstrap>(173): <frozen importlib._bootstrap>(184): <frozen importlib._bootstrap>(198): <frozen importlib._bootstrap>(357): <frozen importlib._bootstrap>(368): <frozen importlib._bootstrap>(370): <frozen importlib._bootstrap>(372): <frozen importlib._bootstrap>(330): --- modulename: _bootstrap, funcname: acquire
<frozen importlib._bootstrap>(222): <frozen importlib._bootstrap>(223): --- modulename: _bootstrap, funcname: __init__
<frozen importlib._bootstrap>(71): <frozen importlib._bootstrap>(72): --- modulename: _bootstrap, funcname: __enter__
<frozen importlib._bootstrap>(82): <frozen importlib._bootstrap>(83): <frozen importlib._bootstrap>(224): <frozen importlib._bootstrap>(228): <frozen importlib._bootstrap>(229): <frozen importlib._bootstrap>(236): <frozen importlib._bootstrap>(237): <frozen importlib._bootstrap>(238): <frozen importlib._bootstrap>(228): <frozen importlib._bootstrap>(223): --- modulename: _bootstrap, funcname: __exit__
<frozen importlib._bootstrap>(87): <frozen importlib._bootstrap>(1303): <frozen importlib._bootstrap>(1304): <frozen importlib._bootstrap>(1305): --- modulename: _bootstrap, funcname: _find_and_load_unlocked
<frozen importlib._bootstrap>(1250): <frozen importlib._bootstrap>(1251): <frozen importlib._bootstrap>(1252): <frozen importlib._bootstrap>(1253): <frozen importlib._bootstrap>(1267): --- modulename: _bootstrap, funcname: _find_spec
<frozen importlib._bootstrap>(1185): <frozen importlib._bootstrap>(1186): <frozen importlib._bootstrap>(1191): <frozen importlib._bootstrap>(1197): <frozen importlib._bootstrap>(1198): <frozen importlib._bootstrap>(1199): --- modulename: _bootstrap, funcname: __enter__
...
numeric.py(205): a = empty(shape, dtype, order)
numeric.py(206): multiarray.copyto(a, 1, casting='unsafe')
--- modulename: overrides, funcname: copyto
<__array_function__ internals>(179): <__array_function__ internals>(180): --- modulename: multiarray, funcname: copyto
multiarray.py(1127): return (dst, src, where)
<__array_function__ internals>(200): <__array_function__ internals>(201): <__array_function__ internals>(200): numeric.py(207): return a
__init__.py(348): if not abs(x.dot(x) - float32(2.0)) < 1e-5:
__init__.py(359): del _sanity_check
__init__.py(361): def _mac_os_check():
...
```
It happens because `Trace` object's `localtrace_trace` and `localtrace_trace_and_count` methods expect the call to `linecache.getline` to always return source line with newline at the end of it.
https://github.com/python/cpython/blob/bf0b8a9f8d647515170cbdf3b6a8c0f44e0f37b3/Lib/trace.py#L566-L577
Confirmed on 3.11.1 and 3.12.0a7+(63842bd907).
I'll do a PR with possible fix.
<!-- gh-linked-prs -->
### Linked PRs
* gh-103958
* gh-118832
* gh-118833
* gh-118834
<!-- /gh-linked-prs -->
| 7c87ce777b3fd9055b118a58ec8614901ecb45e9 | da090f1658e72485b201507653f6d673f3e39c86 |
python/cpython | python__cpython-126264 | # Fast attribute access for module subclasses
# Feature or enhancement
There is a specialisation that allows for fast attribute access on the module type, and only the module type, since it is guarded by `PyModule_CheckExact()`. This specialisation could be enabled for module subclasses.
# Pitch
There are occasionally reasons to subclass `ModuleType` to create module types which are more "class-like", e.g. to equip them with magic methods. These subclasses suffer from a performance penalty on attribute access because the specialisation is guarded against subclasses. I do not see the reason for this; in fact, the specialisation can be applied to all module subclasses with no ill effects (that I can observe) using a tiny patch:
<details><summary>Patch</summary>
```diff
diff --git a/Python/bytecodes.c b/Python/bytecodes.c
index 9de0d92..ab948f5 100644
--- a/Python/bytecodes.c
+++ b/Python/bytecodes.c
@@ -1676,7 +1676,7 @@ dummy_func(
}
inst(LOAD_ATTR_MODULE, (unused/1, type_version/2, index/1, unused/5, owner -- res2 if (oparg & 1), res)) {
- DEOPT_IF(!PyModule_CheckExact(owner), LOAD_ATTR);
+ DEOPT_IF(!PyModule_Check(owner), LOAD_ATTR);
PyDictObject *dict = (PyDictObject *)((PyModuleObject *)owner)->md_dict;
assert(dict != NULL);
DEOPT_IF(dict->ma_keys->dk_version != type_version, LOAD_ATTR);
diff --git a/Python/generated_cases.c.h b/Python/generated_cases.c.h
index 864a4f7..96c764f 100644
--- a/Python/generated_cases.c.h
+++ b/Python/generated_cases.c.h
@@ -2338,7 +2338,7 @@
uint32_t type_version = read_u32(&next_instr[1].cache);
uint16_t index = read_u16(&next_instr[3].cache);
#line 1679 "Python/bytecodes.c"
- DEOPT_IF(!PyModule_CheckExact(owner), LOAD_ATTR);
+ DEOPT_IF(!PyModule_Check(owner), LOAD_ATTR);
PyDictObject *dict = (PyDictObject *)((PyModuleObject *)owner)->md_dict;
assert(dict != NULL);
DEOPT_IF(dict->ma_keys->dk_version != type_version, LOAD_ATTR);
diff --git a/Python/specialize.c b/Python/specialize.c
index 33a3c45..527b454 100644
--- a/Python/specialize.c
+++ b/Python/specialize.c
@@ -752,7 +752,7 @@ _Py_Specialize_LoadAttr(PyObject *owner, _Py_CODEUNIT *instr, PyObject *name)
SPECIALIZATION_FAIL(LOAD_ATTR, SPEC_FAIL_OTHER);
goto fail;
}
- if (PyModule_CheckExact(owner)) {
+ if (PyModule_Check(owner)) {
if (specialize_module_load_attr(owner, instr, name))
{
goto fail;
@@ -925,7 +925,7 @@ _Py_Specialize_StoreAttr(PyObject *owner, _Py_CODEUNIT *instr, PyObject *name)
SPECIALIZATION_FAIL(STORE_ATTR, SPEC_FAIL_OTHER);
goto fail;
}
- if (PyModule_CheckExact(owner)) {
+ if (PyModule_Check(owner)) {
SPECIALIZATION_FAIL(STORE_ATTR, SPEC_FAIL_OVERRIDDEN);
goto fail;
}
```
</details>
# Previous discussion
There are two ongoing discussions at the time of writing to make modules more class-like, [here](https://discuss.python.org/t/pep-713-callable-modules/26127?u=ntessore) and [here](https://discuss.python.org/t/extend-pep-562-with-setattr-for-modules/25506?u=ntessore). While both of these proposals would benefit from this change, this change is generally useful. In fact, if implemented, it might be an argument for making the linked proposals external packages, and not language features.
<!-- gh-linked-prs -->
### Linked PRs
* gh-126264
<!-- /gh-linked-prs -->
| d9e251223e8314ca726fc0be8b834362184b0aad | 3fecbe9255391be1ac3c3b52dfe0254ee5c665bd |
python/cpython | python__cpython-103949 | # crash in "./python.exe -We -m test -v test_datetime -m test_folds"
Running on a Mac:
```
% ./python.exe -We -m test -v test_datetime -m test_folds
Raised RLIMIT_NOFILE: 256 -> 1024
== CPython 3.12.0a7+ (heads/main:44b5c21f41, Apr 27 2023, 20:09:36) [Clang 14.0.3 (clang-1403.0.22.14.1)]
== macOS-13.3.1-x86_64-i386-64bit little-endian
== Python build: debug
== cwd: /Users/iritkatriel/src/cpython-1/build/test_python_30946æ
== CPU count: 12
== encodings: locale=UTF-8, FS=utf-8
0:00:00 load avg: 5.01 Run tests sequentially
0:00:00 load avg: 5.01 [1/1] test_datetime
test_folds (test.datetimetester.IranTest_Pure.test_folds) ... ERROR
test_folds (test.datetimetester.ZoneInfoTest_Pure.test_folds) ... ERROR
test_folds (test.datetimetester.IranTest_Fast.test_folds) ... Fatal Python error: _Py_CheckFunctionResult: a function returned a result with an exception set
Python runtime state: initialized
DeprecationWarning: datetime.utcfromtimestamp() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.now(datetime.UTC).
The above exception was the direct cause of the following exception:
SystemError: <built-in method utcfromtimestamp of type object at 0x10d2559d8> returned a result with an exception set
Current thread 0x00007ff85940a340 (most recent call first):
File "/Users/iritkatriel/src/cpython-1/Lib/test/datetimetester.py", line 6102 in transitions
File "/Users/iritkatriel/src/cpython-1/Lib/test/datetimetester.py", line 6124 in folds
File "/Users/iritkatriel/src/cpython-1/Lib/test/datetimetester.py", line 6158 in test_folds
File "/Users/iritkatriel/src/cpython-1/Lib/unittest/case.py", line 589 in _callTestMethod
File "/Users/iritkatriel/src/cpython-1/Lib/unittest/case.py", line 634 in run
File "/Users/iritkatriel/src/cpython-1/Lib/unittest/case.py", line 690 in __call__
File "/Users/iritkatriel/src/cpython-1/Lib/unittest/suite.py", line 122 in run
File "/Users/iritkatriel/src/cpython-1/Lib/unittest/suite.py", line 84 in __call__
File "/Users/iritkatriel/src/cpython-1/Lib/unittest/suite.py", line 122 in run
File "/Users/iritkatriel/src/cpython-1/Lib/unittest/suite.py", line 84 in __call__
File "/Users/iritkatriel/src/cpython-1/Lib/unittest/runner.py", line 240 in run
File "/Users/iritkatriel/src/cpython-1/Lib/test/support/__init__.py", line 1106 in _run_suite
File "/Users/iritkatriel/src/cpython-1/Lib/test/support/__init__.py", line 1232 in run_unittest
File "/Users/iritkatriel/src/cpython-1/Lib/test/libregrtest/runtest.py", line 281 in _test_module
File "/Users/iritkatriel/src/cpython-1/Lib/test/libregrtest/runtest.py", line 317 in _runtest_inner2
File "/Users/iritkatriel/src/cpython-1/Lib/test/libregrtest/runtest.py", line 360 in _runtest_inner
File "/Users/iritkatriel/src/cpython-1/Lib/test/libregrtest/runtest.py", line 235 in _runtest
File "/Users/iritkatriel/src/cpython-1/Lib/test/libregrtest/runtest.py", line 265 in runtest
File "/Users/iritkatriel/src/cpython-1/Lib/test/libregrtest/main.py", line 483 in run_tests_sequential
File "/Users/iritkatriel/src/cpython-1/Lib/test/libregrtest/main.py", line 601 in run_tests
File "/Users/iritkatriel/src/cpython-1/Lib/test/libregrtest/main.py", line 779 in _main
File "/Users/iritkatriel/src/cpython-1/Lib/test/libregrtest/main.py", line 738 in main
File "/Users/iritkatriel/src/cpython-1/Lib/test/libregrtest/main.py", line 802 in main
File "/Users/iritkatriel/src/cpython-1/Lib/test/__main__.py", line 2 in <module>
File "/Users/iritkatriel/src/cpython-1/Lib/runpy.py", line 88 in _run_code
File "/Users/iritkatriel/src/cpython-1/Lib/runpy.py", line 198 in _run_module_as_main
Extension modules: _testcapi (total: 1)
zsh: abort ./python.exe -We -m test -v test_datetime -m test_folds
```
<!-- gh-linked-prs -->
### Linked PRs
* gh-103949
* gh-103995
<!-- /gh-linked-prs -->
| 689723a4abdc1e61a9f71db8ff40886ae1b1704d | ebf97c50f25d61e15671a4658f5718f214c35a98 |
python/cpython | python__cpython-103947 | # trace.__main__ does not use io.open_code
When used as an entry point, the `trace` module opens code files without using `io.open_code`:
https://github.com/python/cpython/blob/main/Lib/trace.py#L719
This should use the `io.open_code` method instead of `open(..., 'rb')`.
<!-- gh-linked-prs -->
### Linked PRs
* gh-103947
* gh-103950
* gh-103952
* gh-103953
* gh-103954
<!-- /gh-linked-prs -->
| d50f01ad0a965c6d41e24ef77be0fe643efa1bfd | bf0b8a9f8d647515170cbdf3b6a8c0f44e0f37b3 |
python/cpython | python__cpython-104642 | # Document PEP 695
We should document PEP-695 for Python 3.12 (issue #103763, PR #103764 for implementation). I am leaving docs out of the PR to avoid complicating an already huge PR with a tight deadline, but let's start thinking about what we need to document:
- [x] New AST nodes in `ast.rst`
- [x] Language reference should be updated to include the new grammar changes
- [x] Language reference should be updated to reflect new scoping rules (https://docs.python.org/3.12/reference/executionmodel.html#naming-and-binding)
- [x] `typing.rst` should list the PEP
- [x] `typing.rst` should mention that `TypeVar` gained an `infer_variance` argument and that it now supports lazily evaluated bounds/constraints
- [x] Examples of generics in `typing.rst` should use the new syntax
- [x] `typing.rst` should document the new `TypeAliasType`
- [x] `typing.TypeAlias` should be mentioned as deprecated (including in the deprecation timeline at the bottom of `typing.rst`), and any examples of type aliases should be updated to use the new syntax
- [x] New opcodes need to be mentioned in `dis.rst`. `dis.dis` docs should mention new contexts where nested code objects can appear. The `CALL_INTRINSIC_1` and 2 opcodes should mention the new intrinsics.
<!-- gh-linked-prs -->
### Linked PRs
* gh-104642
* gh-104654
* gh-104989
* gh-105007
* gh-105093
* gh-105101
<!-- /gh-linked-prs -->
| 060277d96bf4ba86df8e4d65831a8cbdfeb51fc5 | 95f1b1fef777254a45559c0348e80185df3634ff |
python/cpython | python__cpython-103904 | # Test documentation with the oldest supported Sphinx version
As we've discussed at various points recently, it would be of some use to have an automatic test that the minimum Sphinx version that we advertise in ``Doc/conf.py`` actually works. See PR for a new GitHub Actions job to test this on all documentation changes.
A
<!-- gh-linked-prs -->
### Linked PRs
* gh-103904
* gh-103948
<!-- /gh-linked-prs -->
| 44b5c21f4124f9fa1312fada313c80c6abfa6d49 | 0b7fd8ffc5df187edf8b5d926cee359924462df5 |
python/cpython | python__cpython-103900 | # Provide a hint when accidentally calling a module
This is sort of inspired by [PEP 713](https://peps.python.org/pep-0713), but I think it's worth doing whether that PEP is accepted or not.
When somebody attempts to call a module, we can provide a more helpful `TypeError` message than `'module' object is not callable`. Instead, we can check if the module has a callable attribute with the same name:
```py
>>> import pprint
>>> pprint(thing)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'module' object is not callable. Did you mean: 'pprint.pprint(...)'?
```
As somebody who hits this fairly frequently with modules like `dis` and `datetime`, I think that this error message could reduce some confusion for beginners and friction for experienced users.
This is a cold code path, and I assume that this error is the most common reason for hitting it with a module object. So a little extra code (just one branch for non-modules) shouldn't be noticeable at all.
<!-- gh-linked-prs -->
### Linked PRs
* gh-103900
<!-- /gh-linked-prs -->
| 7d35c3121ade679dd6e8b4a0bac7b3702aee6921 | f5c38382f9c40f0017cef086896a8160e313ac9e |
python/cpython | python__cpython-103897 | # Issues when showing broken `Exception.__notes__`
# Bug report
When [notes on an exception](https://docs.python.org/3/library/exceptions.html#BaseException.__notes__) cannot be shown because the `repr` and `str` raise exceptions, a `<note str() failed>` message is shown instead. In the case where `exception.__notes__` is not a sequence and cannot be shown, a `<__notes__ repr() failed>` is shown. In the second case, the message does not include a trailing newline.
`__notes__` is a list containing a broken "note" - output includes a newline:
```python
class A:
def __repr__(self):
raise Exception()
e = Exception()
e.__notes__ = [A()] # !!!
raise e
```
```
user@host $ ./repro.py
Traceback (most recent call last):
File "./repro.py", line 8, in <module>
raise e
Exception
<note str() failed>
user@host $
```
`__notes__` is just a single broken "note" - output does not include a newline:
```python
class A:
def __repr__(self):
raise Exception()
e = Exception()
e.__notes__ = A() # !!!
raise e
```
```
user@host $ ./repro.py
Traceback (most recent call last):
File "./repro.py", line 8, in <module>
raise e
Exception
<__notes__ repr() failed>user@host $
```
Additionally, when `__notes__` is a string/bytes, the contents are expoded over multiple lines because of an `isinstance(__notes__, Sequence)` check.
String:
```python
e = Exception()
e.__notes__ = "a note"
raise e
```
```
user@host $ ./repro.py
Traceback (most recent call last):
File "./repro.py", line 8, in <module>
raise e
Exception
a
n
o
t
e
user@host $
```
Bytes:
```python
e = Exception()
e.__notes__ = b"a note"
raise e
```
```
user@host $ ./repro.py
Traceback (most recent call last):
File "./repro.py", line 8, in <module>
raise e
Exception
97
32
110
111
116
101
user@host $
```
Even though the above are all edge cases, since there are some checks that handle these cases already, it makes sense to handle them more gracefully.
# Your environment
- CPython versions tested on: 3.12.0a7+
- Operating system and architecture: macOS Mojave (x86)
<!-- gh-linked-prs -->
### Linked PRs
* gh-103897
<!-- /gh-linked-prs -->
| 487f55d5801a9ae7d79d37e259e8c377c9acd39b | 93107aa2a49a9354ffb10b3cd263dc3e99ebdeff |
python/cpython | python__cpython-104179 | # Improve `builtins.__doc__`
```pycon
>>> import builtins
>>> print(builtins.__doc__)
Built-in functions, exceptions, and other objects.
Noteworthy: None is the `nil' object; Ellipsis represents `...' in slices.
>>>
```
A few possible improvements:
- `None` is not actually in the builtins module, as it's a keyword
- `Ellipsis` has more uses than just slices
- The docstring doesn't explain what "builtins" means. It should say that this module is special in that its namespace is always available, or something along those lines.
<!-- gh-linked-prs -->
### Linked PRs
* gh-104179
* gh-104257
<!-- /gh-linked-prs -->
| b35711d17a90251bdd57d255090e07daafe89f6c | 4ee2068c34bd45eddba7f6a8ee83f62d5b6932fc |
python/cpython | python__cpython-103889 | # Running the Docs workflow via workflow_dispatch always fails
Our Docs workflow file allows people to manually trigger the workflow on arbitrary branches in their GitHub fork of CPython:
https://github.com/python/cpython/blob/6c4124d11ab731f3774e3454ded33df089bd317e/.github/workflows/doc.yml#L1-L4
This is a useful feature that I like to use in order to test possible changes prior to filing a PR. However, on latest `main`, while it is still _possible_ to run the Docs workflow via the `workflow_dispatch`, it now always fails if you try to do so. Example failing run on my GitHub fork: https://github.com/AlexWaygood/cpython/actions/runs/4803232831/jobs/8547528105.
The error occurs in the "Get list of changed files" step here (added to the workflow in #102513):
https://github.com/python/cpython/blob/6c4124d11ab731f3774e3454ded33df089bd317e/.github/workflows/doc.yml#L57-L62
The error message is:
```
Run Ana06/get-changed-files@v[2](https://github.com/AlexWaygood/cpython/actions/runs/4803232831/jobs/8547528105#step:8:2).2.0
with:
filter: Doc/**
token: ***
format: space-delimited
env:
pythonLocation: /opt/hostedtoolcache/Python/[3](https://github.com/AlexWaygood/cpython/actions/runs/4803232831/jobs/8547528105#step:8:3).11.3/x6[4](https://github.com/AlexWaygood/cpython/actions/runs/4803232831/jobs/8547528105#step:8:4)
PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.11.3/x[6](https://github.com/AlexWaygood/cpython/actions/runs/4803232831/jobs/8547528105#step:8:6)4/lib/pkgconfig
Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.[11](https://github.com/AlexWaygood/cpython/actions/runs/4803232831/jobs/8547528105#step:8:11).3/x64
Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.11.3/x64
Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.11.3/x64
LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.11.3/x64/lib
Error: This action only supports pull requests and pushes, workflow_dispatch events are not supported. Please submit an issue on this action's GitHub repo if you believe this in correct.
Base commit: undefined
Head commit: undefined
Error: The base and head commits are missing from the payload for this workflow_dispatch event. Please submit an issue on this action's GitHub repo.
Error: Not Found
```
While this isn't a _huge_ problem, it would be nice if we could continue to be able to run the Docs workflow via the `workflow_dispatch` trigger without it failing.
Cc. @hugovk, @ezio-melotti, @CAM-Gerlach
<!-- gh-linked-prs -->
### Linked PRs
* gh-103889
<!-- /gh-linked-prs -->
| 842daa57cf93280dfb3430061007b7d54d3c1353 | bb8aa7a2b41ad7649d66909e5266fcee039e63ed |
python/cpython | python__cpython-103913 | # Python/C API "PyUnicode_FromObject" is listed in the "Deprecated " section
In the documentation of Python 3.11 (or earlier), the Python/C API "PyUnicode_FromObject" is listed in the "Deprecated Py_UNICODE APIs" section, which is marked to be removed in version 3.12:
https://docs.python.org/3.11/c-api/unicode.html#deprecated-py-unicode-apis
However, the API seems not to get removed from neither of the actual implementation nor the documentation in Python 3.12. PEP 623 (https://peps.python.org/pep-0623/) doesn't even mention "PyUnicode_FromObject" as deprecated.
I suspect it is an error of the documentation, or did I miss something else?
<!-- gh-linked-prs -->
### Linked PRs
* gh-103913
* gh-103915
<!-- /gh-linked-prs -->
| ce2383ec6665850a1bdffad388876481b6f3205f | 1d99e9e46e9b517532fea11befe2e6d0043850bd |
python/cpython | python__cpython-103916 | # Broken test in test_genericalias
The test at https://github.com/python/cpython/blob/1c0a9c5a1c84bc334f2bde9d45676f19d9632823/Lib/test/test_genericalias.py#L315 has multiple statements in one `with self.assertRaises` block. This is bad, because the test will pass if only one of them raises. Presumably, we want a separate `with` for every statement.
At work, I implemented a lint rule that enforces that for our equivalent of `assertRaises`, there is only one statement within the `with` block. We could use the same pattern to look for other instances of this problem in our codebase.
cc @sobolevn as this may be of interest to you
<!-- gh-linked-prs -->
### Linked PRs
* gh-103916
* gh-103917
<!-- /gh-linked-prs -->
| dff8e5dc8d0758d1f9c55fdef308e44aefebe1a2 | ce2383ec6665850a1bdffad388876481b6f3205f |
python/cpython | python__cpython-103882 | # Numerous refleaks on main
https://buildbot.python.org/all/#/release_status shows that the refleak buildbots are failing on current main. Example output on https://buildbot.python.org/all/#/builders/75/builds/745/steps/5/logs/warnings__111_.
Failing tests:
<details>
```
test_functools leaked [1, 1, 2] references, sum=4
test_warnings leaked [4, 4, 4] references, sum=12
test_ipaddress leaked [6, 6, 6] references, sum=18
test_zoneinfo leaked [7, 6, 11] references, sum=24
FAIL: test_flock (__main__.FNTLEINTRTest.test_flock)
test_random leaked [1, 2, 4] references, sum=7
test_statistics leaked [175, 174, 175] references, sum=524
test_dataclasses leaked [3, 3, 2] references, sum=8
test_argparse leaked [69, 70, 76] references, sum=215
/home/dje/cpython-buildarea/3.x.edelsohn-rhel8-z.refleak/build/Lib/test/support/__init__.py:743: ResourceWarning: unclosed <socket.socket [closed] fd=3, family=2, type=1, proto=6>
ResourceWarning: Enable tracemalloc to get the object allocation traceback
./home/dje/cpython-buildarea/3.x.edelsohn-rhel8-z.refleak/build/Lib/test/support/__init__.py:743: ResourceWarning: unclosed <socket.socket [closed] fd=3, family=2, type=1, proto=6>
ResourceWarning: Enable tracemalloc to get the object allocation traceback
./home/dje/cpython-buildarea/3.x.edelsohn-rhel8-z.refleak/build/Lib/test/support/__init__.py:743: ResourceWarning: unclosed <socket.socket [closed] fd=3, family=2, type=1, proto=6>
ResourceWarning: Enable tracemalloc to get the object allocation traceback
./home/dje/cpython-buildarea/3.x.edelsohn-rhel8-z.refleak/build/Lib/test/support/__init__.py:743: ResourceWarning: unclosed <socket.socket [closed] fd=3, family=2, type=1, proto=6>
ResourceWarning: Enable tracemalloc to get the object allocation traceback
./home/dje/cpython-buildarea/3.x.edelsohn-rhel8-z.refleak/build/Lib/test/support/__init__.py:743: ResourceWarning: unclosed <socket.socket [closed] fd=3, family=2, type=1, proto=6>
ResourceWarning: Enable tracemalloc to get the object allocation traceback
./home/dje/cpython-buildarea/3.x.edelsohn-rhel8-z.refleak/build/Lib/test/support/__init__.py:743: ResourceWarning: unclosed <socket.socket [closed] fd=3, family=2, type=1, proto=6>
ResourceWarning: Enable tracemalloc to get the object allocation traceback
test_tarfile leaked [17, 17, 16] references, sum=50
test_typing leaked [95, 121, 95] references, sum=311
test_typing leaked [1, 14, 1] memory blocks, sum=16
test_lib2to3 leaked [5, 8, 6] references, sum=19
test_shutil leaked [2, 2, 2] references, sum=6
test_unittest leaked [8, 12, 15] references, sum=35
test_logging leaked [3, 2, 1] references, sum=6
test__xxsubinterpreters leaked [46, 45, 45] references, sum=136
test_mailbox leaked [2, 3, 2] references, sum=7
test_socket leaked [24, 23, 23] references, sum=70
test_htmlparser leaked [2, 2, 2] references, sum=6
test_regrtest leaked [9, 12, 8] references, sum=29
test_datetime leaked [11, 11, 11] references, sum=33
test_nntplib leaked [1, 3, 2] references, sum=6
test_ftplib leaked [10, 13, 9] references, sum=32
test_interpreters leaked [54, 54, 54] references, sum=162
test_zipfile leaked [3, 4, 4] references, sum=11
test_sys_settrace leaked [6, 6, 6] references, sum=18
test_descr leaked [3, 65, 67] references, sum=135
test_compile leaked [7, 7, 7] references, sum=21
test_bytes leaked [2, 2, 2] references, sum=6
test_ast leaked [9, 9, 9] references, sum=27
test_poplib leaked [3, 3, 2] references, sum=8
test_types leaked [8, 50, 43] references, sum=101
test_concurrent_futures leaked [11, 12, 11] references, sum=34
test_genericalias leaked [2, 2, 3] references, sum=7
test_math leaked [32, 31, 33] references, sum=96
test_numeric_tower leaked [2, 1, 2] references, sum=5
test_capi leaked [99, 99, 99] references, sum=297
test_import leaked [170, 171, 168] references, sum=509
test_import leaked [71, 71, 70] memory blocks, sum=212
.test test_monitoring failed -- multiple errors occurred; run in verbose mode for details
test_selectors leaked [5, 6, 4] references, sum=15
test_email leaked [27, 26, 25] references, sum=78
test_subprocess leaked [1, 1, 1] references, sum=3
test_struct leaked [1, 1, 1] references, sum=3
test_weakref leaked [1, 1, 1] references, sum=3
test_imaplib leaked [2, 2, 1] references, sum=5
0:45:54 load avg: 0.13 Re-running failed tests in verbose mode
0:45:54 load avg: 0.13 Re-running test_functools in verbose mode
test_functools leaked [1, 1, 2] references, sum=4
0:45:55 load avg: 0.13 Re-running test_warnings in verbose mode
test_warnings leaked [4, 4, 4] references, sum=12
0:45:59 load avg: 0.20 Re-running test_ipaddress in verbose mode
test_ipaddress leaked [6, 6, 6] references, sum=18
0:46:00 load avg: 0.20 Re-running test_zoneinfo in verbose mode
test_zoneinfo leaked [7, 6, 11] references, sum=24
```
</details>
I saw similar leaks triggering the refleak buildbots on #103866 and #103764, before I realized the issue was probably on main.
Based on @sunmy2019's work in https://github.com/python/cpython/pull/103764#issuecomment-1522831646, we're likely leaking references to the `object.__setattr__` wrapper descriptor.
<!-- gh-linked-prs -->
### Linked PRs
* gh-103882
<!-- /gh-linked-prs -->
| 6c4124d11ab731f3774e3454ded33df089bd317e | 1c0a9c5a1c84bc334f2bde9d45676f19d9632823 |
python/cpython | python__cpython-103876 | # Use char and latin1 singletons in deepfreeze
# Feature or enhancement
Since https://github.com/python/cpython/pull/32152, deepfreeze will try to use static string singletons if possible.
But chars and latin1 singletons are not used. Here I propose to reuse them as well.
# Pitch
-
# Previous discussion
<!--
New features to Python should first be discussed elsewhere before creating issues on GitHub,
for example in the "ideas" category (https://discuss.python.org/c/ideas/6) of discuss.python.org,
or the python-ideas mailing list (https://mail.python.org/mailman3/lists/python-ideas.python.org/).
Use this space to post links to the places where you have already discussed this feature proposal:
-->
<!--
You can freely edit this text. Remove any lines you believe are unnecessary.
-->
<!-- gh-linked-prs -->
### Linked PRs
* gh-103876
<!-- /gh-linked-prs -->
| 214e5684c274f359d4cc34381f65e9f1a9952802 | 438b811761da124b949265d233f9fd9a74d7dd3f |
python/cpython | python__cpython-103873 | # Upgrade the bundled version of pip to 23.1.2
# Feature or enhancement
This is the latest pip release.
# Pitch
This ensures that users who install newest release of Python get the newest version of pip.
<!-- gh-linked-prs -->
### Linked PRs
* gh-103873
* gh-103874
<!-- /gh-linked-prs -->
| 438b811761da124b949265d233f9fd9a74d7dd3f | 2763994be38e388c321a6807264c694dbf1dafcb |
python/cpython | python__cpython-103866 | # LOAD_SUPER_ATTR doesn't match monitoring behavior of the opcodes it replaces
The `LOAD_SUPER_ATTR` super-instruction optimization doesn't correctly match the PEP 669 monitoring events that would be fired by the call to `super()` followed by attribute load that it replaces. This should be fixed.
<!-- gh-linked-prs -->
### Linked PRs
* gh-103866
<!-- /gh-linked-prs -->
| f40890b124a330b589c8093127be1274e15dbd7f | febcc6ccfb0726dab588e64b68d91abb37db1939 |
python/cpython | python__cpython-103863 | # Writing a small file into a ZipFile while forcing zip64 extensions results in an incorrect zip file
# Bug report
When forcing a small file to be added to a `zipfile.Zipfile` object with zip64 extensions when it doesn't need it, a Zip64 extra record is added to the resulting file, but the minimum version and filesize information are not updated to reflect this.
An example of this issue in the wild: https://github.com/pR0Ps/zipstream-ng/issues/13
## To reproduce:
Create the file:
```python
import zipfile
with zipfile.ZipFile("out.zip", mode="w", allowZip64=True) as zf:
with zf.open("text.txt", mode="w", force_zip64=True) as zi:
zi.write(b"some data")
```
Using [zipdetails](https://github.com/pmqs/zipdetails) to parse information from the resulting file (red lines are incorrect):
```patch
0000 LOCAL HEADER #1 04034B50
-0004 Extract Zip Spec 14 '2.0'
0005 Extract OS 00 'MS-DOS'
0006 General Purpose Flag 0000
0008 Compression Method 0000 'Stored'
000A Last Mod Time 00210000 'Mon Dec 31 19:00:00 1979'
000E CRC D9C2E91E
-0012 Compressed Length 00000009
-0016 Uncompressed Length 00000009
001A Filename Length 0008
001C Extra Length 0014
001E Filename 'text.txt'
0026 Extra ID #0001 0001 'ZIP64'
0028 Length 0010
002A Uncompressed Size 0000000000000009
0032 Compressed Size 0000000000000009
003A PAYLOAD some data
0043 CENTRAL HEADER #1 02014B50
-0047 Created Zip Spec 14 '2.0'
0048 Created OS 03 'Unix'
-0049 Extract Zip Spec 14 '2.0'
004A Extract OS 00 'MS-DOS'
004B General Purpose Flag 0000
004D Compression Method 0000 'Stored'
004F Last Mod Time 00210000 'Mon Dec 31 19:00:00 1979'
0053 CRC D9C2E91E
0057 Compressed Length 00000009
005B Uncompressed Length 00000009
005F Filename Length 0008
0061 Extra Length 0000
0063 Comment Length 0000
0065 Disk Start 0000
0067 Int File Attributes 0000
[Bit 0] 0 'Binary Data'
0069 Ext File Attributes 01800000
006D Local Header Offset 00000000
0071 Filename 'text.txt'
0079 END CENTRAL HEADER 06054B50
007D Number of this disk 0000
007F Central Dir Disk no 0000
0081 Entries in this disk 0001
0083 Total Entries 0001
0085 Size of Central Dir 00000036
0089 Offset to Central Dir 00000043
008D Comment Length 0000
```
In this case, the Extract Zip Spec should be `0x2D` (`zipfile.ZIP64_VERSION`) and the Compressed/Uncompressed Lengths should both be `0xFFFFFFFF` in order to defer to the lengths in the Zip64 record.
# Your environment
- CPython versions tested on: 3.12.0
- Operating system and architecture: macOS Mojave (x86)
<!-- gh-linked-prs -->
### Linked PRs
* gh-103863
* gh-104534
<!-- /gh-linked-prs -->
| 798bcaa1eb01de7db9ff1881a3088603ad09b096 | 85ec192ac4b000d4e47df6123b65eacbd1fdccfa |
python/cpython | python__cpython-103858 | # Deprecate `utcnow` and `utcfromtimestamp`
# Feature or enhancement
Previously, we have [documented that `utcnow` and `utcfromtimestamp` should not be used](https://github.com/python/cpython/issues/81669), but we didn't go so far as to actually deprecate them, and I wrote a whole article about [how you shouldn't use them](https://blog.ganssle.io/articles/2019/11/utcnow.html).
The main reason I had for not deprecating them at the time was that `.utcnow()` is faster than `.now(datetime.UTC)`, and if you are immediately converting the datetime to a string, like `datetime.utcnow().isoformat()`, there's no danger.
I have come around to the idea that this type of use case is not important enough to leave the [attractive nuisances](https://blog.ganssle.io/articles/2023/01/attractive-nuisances.html) of `utcnow()` and `utcfromtimestamp()` in place, and we should go ahead and deprecate them.
# Pitch
We should deprecate them in the documentation and also add `DeprecationWarning`s imploring people not to use them. I'm OK with us saying that we will remove them "at some point in the future" and not necessarily putting a deadline on it, considering how much use of `utcnow()` is out there.
# Previous discussion
- #81669
- https://discuss.python.org/t/add-aliases-with-explicit-names-for-naive-and-aware-datetime-now-and-utcnow/25997
- Various bugs about this: #90477, #56965, #77474
<!-- gh-linked-prs -->
### Linked PRs
* gh-103858
* gh-104431
* gh-104542
<!-- /gh-linked-prs -->
| 0b7fd8ffc5df187edf8b5d926cee359924462df5 | a5308e188b810e5cc69c1570bdc9b21ed6c87805 |
python/cpython | python__cpython-103849 | # [CVE-2024-11168] urlparse incorrectly retrieves IPv4 and regular name hosts from inside of brackets
# Background
RFC 3986 defines a host as follows
```
host = IP-literal / IPv4address / reg-name
```
Where
```
IP-literal = "[" ( IPv6address / IPvFuture ) "]"
reg-name = *( unreserved / pct-encoded / sub-delims )
IPv4address = dec-octet "." dec-octet "." dec-octet "." dec-octet
```
WhatWG says that "A valid host string must be a [valid domain string](https://url.spec.whatwg.org/#valid-domain-string), a [valid IPv4-address string](https://url.spec.whatwg.org/#valid-ipv4-address-string), or: U+005B ([), followed by a [valid IPv6-address string](https://url.spec.whatwg.org/#valid-ipv6-address-string), followed by U+005D (])."
# The Bug
This is code from ```Lib/urllib/parse.py:196-208``` used for retrieving the hostname from the netloc
```python
@property
def _hostinfo(self):
netloc = self.netloc
_, _, hostinfo = netloc.rpartition('@')
_, have_open_br, bracketed = hostinfo.partition('[')
if have_open_br:
hostname, _, port = bracketed.partition(']')
_, _, port = port.partition(':')
else:
hostname, _, port = hostinfo.partition(':')
if not port:
port = None
return hostname, port
```
It will incorrectly retrieve IPv4 addresses and regular name hosts from inside brackets. This is in violation of both specifications.
Minimally reproducible example:
```python
from urllib.parse import urlsplit
parsedURL = urlsplit('scheme://user@[regname]/Path')
print(parsedURL.hostname) # Prints 'regname'
```
# Your environment
<!-- Include as many relevant details as possible about the environment you experienced the bug in -->
- CPython versions tested on:
- 3.12a7 ([```23cf1e2```](https://github.com/JohnJamesUtley/cpython/commit/23cf1e20a6470588fbc64483031ceeec7614dc56))
- 3.10.10
- Operating system and architecture:
- Arch Linux x86_64
<!--
You can freely edit this text. Remove any lines you believe are unnecessary.
-->
<!-- gh-linked-prs -->
### Linked PRs
* gh-103849
* gh-104349
* gh-126975
* gh-126976
<!-- /gh-linked-prs -->
| 29f348e232e82938ba2165843c448c2b291504c5 | 2c863b3871c6127a80aa7229033219f1cdcc8711 |
python/cpython | python__cpython-103851 | # Ref tests failure on test_monitoring
Tested on cef542ca57, GCC 11.3 Ubuntu 22.04
```
./python -m test test_monitoring -R :
```
<details><summary>Error Log</summary>
<p>
```
======================================================================
FAIL: test_c_call (test.test_monitoring.TestLineAndInstructionEvents.test_c_call)
----------------------------------------------------------------------
Lists differ:
First differing element 1:
('instruction', 'func2', 2)
('line', 'func2', 1)
Second list contains 3 additional elements.
First extra element 12:
('instruction', 'func2', 42)
[('line', 'check_events', 10),
+ ('line', 'func2', 1),
('instruction', 'func2', 2),
('instruction', 'func2', 4),
+ ('line', 'func2', 2),
('instruction', 'func2', 6),
('instruction', 'func2', 8),
('instruction', 'func2', 28),
('instruction', 'func2', 30),
('instruction', 'func2', 38),
+ ('line', 'func2', 3),
('instruction', 'func2', 40),
('instruction', 'func2', 42),
('instruction', 'func2', 44),
('line', 'check_events', 11)]
======================================================================
FAIL: test_simple (test.test_monitoring.TestLineAndInstructionEvents.test_simple)
----------------------------------------------------------------------
Lists differ:
First differing element 1:
('instruction', 'func1', 2)
('line', 'func1', 1)
Second list contains 3 additional elements.
First extra element 9:
('instruction', 'func1', 12)
[('line', 'check_events', 10),
+ ('line', 'func1', 1),
('instruction', 'func1', 2),
('instruction', 'func1', 4),
+ ('line', 'func1', 2),
('instruction', 'func1', 6),
('instruction', 'func1', 8),
+ ('line', 'func1', 3),
('instruction', 'func1', 10),
('instruction', 'func1', 12),
('instruction', 'func1', 14),
('line', 'check_events', 11)]
======================================================================
FAIL: test_try_except (test.test_monitoring.TestLineAndInstructionEvents.test_try_except)
----------------------------------------------------------------------
Lists differ:
First differing element 1:
('instruction', 'func3', 2)
('line', 'func3', 1)
Second list contains 6 additional elements.
First extra element 15:
('instruction', 'func3', 28)
[('line', 'check_events', 10),
+ ('line', 'func3', 1),
('instruction', 'func3', 2),
+ ('line', 'func3', 2),
('instruction', 'func3', 4),
('instruction', 'func3', 6),
+ ('line', 'func3', 3),
('instruction', 'func3', 8),
('instruction', 'func3', 18),
('instruction', 'func3', 20),
+ ('line', 'func3', 4),
('instruction', 'func3', 22),
+ ('line', 'func3', 5),
('instruction', 'func3', 24),
('instruction', 'func3', 26),
('instruction', 'func3', 28),
+ ('line', 'func3', 6),
('instruction', 'func3', 30),
('instruction', 'func3', 32),
('instruction', 'func3', 34),
('line', 'check_events', 11)]
----------------------------------------------------------------------
Ran 42 tests in 0.015s
FAILED (failures=3)
```
</p>
</details>
Looks like the behavior is changed when using `-R :`?
CC: @markshannon
<!-- gh-linked-prs -->
### Linked PRs
* gh-103851
<!-- /gh-linked-prs -->
| bcea36f8db9ad4fd542b38997e065987e829cb9f | 0a5cd984b215f28d3c205eadf0daf201b3388c90 |
python/cpython | python__cpython-103842 | # TIP 538 prevents building Tkinter against Tcl 8.7 built with bundled libtommath
<!--
If you're new to Python and you're not sure whether what you're experiencing is a bug, the CPython issue tracker is not
the right place to seek help. Consider the following options instead:
- reading the Python tutorial: https://docs.python.org/3/tutorial/
- posting in the "Users" category on discuss.python.org: https://discuss.python.org/c/users/7
- emailing the Python-list mailing list: https://mail.python.org/mailman/listinfo/python-list
- searching our issue tracker (https://github.com/python/cpython/issues) to see if
your problem has already been reported
-->
# Bug report
Separated out from https://github.com/python/cpython/issues/103194#issuecomment-1518656159 since I believe this likely should be addressed first.
[TIP 538](https://core.tcl-lang.org/tips/doc/trunk/tip/538.md) means that Tcl 8.7 can be built to use separately-built libtommath, and no longer recommends building with the bundled libtommath. tclTomMath.h requires tommath.h, which Tcl will no longer install a copy of even when the bundled libtommath is used (as another user recently found out: https://core.tcl-lang.org/tcl/info/ff255adc4cb5). Either tommath.h must be obtained separately, or `TCL_NO_TOMMATH_H` must be defined before including tclTomMath.h.
Package managers presumably would want to build Tcl against separately-built libtommath once they update to 8.7, and in turn build Tkinter against separately-built Tcl and libtommath. But given that nothing else in CPython uses libtommath, how much would the official Python binary distributions prefer that Tcl continue building its bundled libtommath?
<!-- gh-linked-prs -->
### Linked PRs
* gh-103842
<!-- /gh-linked-prs -->
| 625887e6df5dbebe48be172b424ba519e2ba2ddc | 486bc8e03019b8edc3cbfc6e64db96d65dbe13b6 |
python/cpython | python__cpython-103825 | # Fix unused variable warning
https://github.com/python/cpython/pull/102343 introduced a variable used only in the assert macro, causing unused variable warnings in release mode.
<!-- gh-linked-prs -->
### Linked PRs
* gh-103825
<!-- /gh-linked-prs -->
| 0acea96dad622cba41bf1e9ee25d87658579ba88 | d8627999d85cc5b000dbe17180250d919f8510ad |
python/cpython | python__cpython-103993 | # Found Heap-use-after-free errors and SEGV in Python
# Your environment
- CPython versions tested on: 3.12.0 alpha 7
- Operating system and architecture: ubuntu20.04.1,x86_64
- Compiler flags: clang with ASAN and UBSAN instrument
# Bug description
The AddressSanitizer (ASAN) tool has detected multiple heap-use-after-free errors and a segmentation fault (SEGV) in the Python interpreter. The heap-use-after-free errors occurred in the ascii_decode and unicode_decode_utf8 functions in the unicodeobject.c file, and the SEGV occurred in the tok_backup function in the tokenizer.c file. Additionally, a memory leak was detected in the pystate.c file.
# Steps to reproduce
1. Compile Python with ASAN enabled: `./configure && make`
1. Run Python with ASAN enabled: `./python < poc_file`
1. The heap-use-after-free errors and SEGV should be detected and logged by ASAN.
# Expected behavior
No heap-use-after-free errors or SEGV should occur.
# Actual behavior
ASAN detected multiple heap-use-after-free errors and a SEGV, as well as a memory leak.
# Relevant logs and/or screenshots
The ASAN summary output is as follows:
```
AddressSanitizer: heap-use-after-free /src/cpython/Objects/unicodeobject.c:4474:28 in ascii_decode
AddressSanitizer: heap-use-after-free /src/cpython/Objects/unicodeobject.c:4506:28 in ascii_decode
AddressSanitizer: heap-use-after-free /src/cpython/Objects/unicodeobject.c:4483:32 in ascii_decode
AddressSanitizer: SEGV /src/cpython/Parser/tokenizer.c:1234:33 in tok_backup
AddressSanitizer: heap-use-after-free /src/cpython/Objects/unicodeobject.c:4526:37 in unicode_decode_utf8
AddressSanitizer: 3824 byte(s) leaked in 4 allocation(s).
AddressSanitizer: heap-use-after-free /src/cpython/Python/pystate.c:229:23 in bind_tstate
The full ASAN log can be found in the asan.log file.
```
[asan.log](https://github.com/python/cpython/files/11316179/asan.log)
[python_bug_poc.zip](https://github.com/python/cpython/files/11316193/python_bug_poc.zip)
<!-- gh-linked-prs -->
### Linked PRs
* gh-103993
<!-- /gh-linked-prs -->
| d5a97074d24cd14cb2a35a2b1ad3074863cde264 | 99aab610622fc4b4c4fe56b77c0760cf77066a53 |
python/cpython | python__cpython-103827 | # Return newly added Enum constants for month and days in calendar module
# Pitch
As discussed with @ethanfurman in one of my PR, I am going to create a PR to change the return type of functions and methods which currently return ints from 0-7 and 1-12 to represent days and months to newly added enum attributes
# Previous discussion
the previous discussion can be tracked from the last comment on #103642
<!-- gh-linked-prs -->
### Linked PRs
* gh-103827
<!-- /gh-linked-prs -->
| 1f5384434dce013b5dcf7e7ea3ec5312d13bba72 | 587f2f018051049cf5d9de3e12ed5aa7644404dc |
python/cpython | python__cpython-103821 | # IDLE bindings for scrolling using buttons 4 and 5 should only apply to X11
<!--
If you're new to Python and you're not sure whether what you're experiencing is a bug, the CPython issue tracker is not
the right place to seek help. Consider the following options instead:
- reading the Python tutorial: https://docs.python.org/3/tutorial/
- posting in the "Users" category on discuss.python.org: https://discuss.python.org/c/users/7
- emailing the Python-list mailing list: https://mail.python.org/mailman/listinfo/python-list
- searching our issue tracker (https://github.com/python/cpython/issues) to see if
your problem has already been reported
-->
# Bug report
On X11, vertical scrolling is conventionally done using events for mouse “buttons” 4 and 5. But on Win32 and Aqua, which have a dedicated event for scrolling (`<MouseWheel>` in Tk), buttons 4 and 5 correspond to additional hardware buttons present on some mice. Tk 8.6 and earlier do not abstract away these platform differences, so bindings in IDLE for scrolling should ignore buttons 4 and 5 on non-X11.
Accordingly, idlelib.idle_test.test_sidebar.ShellSidebarTest.test_mousewheel should be revised to check the windowing system, so that it correctly distinguishes between Aqua and XQuartz (which `sys.platform == 'darwin'` does not do), sends button 4/5 events on X11 only, and sends `<MouseWheel>` with the correct sign for `delta` on Aqua.
Tk 8.7 ([TIP 474](https://core.tcl-lang.org/tips/doc/trunk/tip/474.md)) will change mouse events to be consistent across windowing systems. This requires further revisions, but I imagine it is better to separately address issues for Tk ≤ 8.6 first.
<!--
You can freely edit this text. Remove any lines you believe are unnecessary.
-->
<!-- gh-linked-prs -->
### Linked PRs
* gh-103821
* gh-114901
* gh-114902
<!-- /gh-linked-prs -->
| d25d4ee60cc789a8b9c222859bb720ade1ab2e30 | 53339a0ef72fcfc15221792b117c4670b07a0b20 |
python/cpython | python__cpython-103811 | # Broken references in dataclasses docs
When building the `dataclasses` docs in nitpicky mode , there are some warnings for broken references. Confirmed that the links in the live [docs](https://docs.python.org/3/library/dataclasses.html) are also broken.
```
make SPHINXOPTS="-n --keep-going" html
/Users/omatoula/Documents/projects/cpython/Doc/library/dataclasses.rst:14: WARNING: py:meth reference target not found: __init__
/Users/omatoula/Documents/projects/cpython/Doc/library/dataclasses.rst:14: WARNING: py:meth reference target not found: __repr__
/Users/omatoula/Documents/projects/cpython/Doc/library/dataclasses.rst:34: WARNING: py:meth reference target not found: __init__
/Users/omatoula/Documents/projects/cpython/Doc/library/dataclasses.rst:89: WARNING: py:meth reference target not found: __init__
/Users/omatoula/Documents/projects/cpython/Doc/library/dataclasses.rst:92: WARNING: py:meth reference target not found: __init__
/Users/omatoula/Documents/projects/cpython/Doc/library/dataclasses.rst:95: WARNING: py:meth reference target not found: __repr__
/Users/omatoula/Documents/projects/cpython/Doc/library/dataclasses.rst:102: WARNING: py:meth reference target not found: __repr__
/Users/omatoula/Documents/projects/cpython/Doc/library/dataclasses.rst:105: WARNING: py:meth reference target not found: __eq__
/Users/omatoula/Documents/projects/cpython/Doc/library/dataclasses.rst:110: WARNING: py:meth reference target not found: __eq__
/Users/omatoula/Documents/projects/cpython/Doc/library/dataclasses.rst:113: WARNING: py:meth reference target not found: __lt__
/Users/omatoula/Documents/projects/cpython/Doc/library/dataclasses.rst:113: WARNING: py:meth reference target not found: __le__
/Users/omatoula/Documents/projects/cpython/Doc/library/dataclasses.rst:113: WARNING: py:meth reference target not found: __gt__
/Users/omatoula/Documents/projects/cpython/Doc/library/dataclasses.rst:113: WARNING: py:meth reference target not found: __ge__
/Users/omatoula/Documents/projects/cpython/Doc/library/dataclasses.rst:120: WARNING: py:meth reference target not found: __lt__
/Users/omatoula/Documents/projects/cpython/Doc/library/dataclasses.rst:120: WARNING: py:meth reference target not found: __le__
/Users/omatoula/Documents/projects/cpython/Doc/library/dataclasses.rst:120: WARNING: py:meth reference target not found: __gt__
/Users/omatoula/Documents/projects/cpython/Doc/library/dataclasses.rst:120: WARNING: py:meth reference target not found: __ge__
/Users/omatoula/Documents/projects/cpython/Doc/library/dataclasses.rst:124: WARNING: py:meth reference target not found: __hash__
/Users/omatoula/Documents/projects/cpython/Doc/library/dataclasses.rst:127: WARNING: py:meth reference target not found: __hash__
/Users/omatoula/Documents/projects/cpython/Doc/library/dataclasses.rst:127: WARNING: py:meth reference target not found: __hash__
/Users/omatoula/Documents/projects/cpython/Doc/library/dataclasses.rst:127: WARNING: py:meth reference target not found: __eq__
/Users/omatoula/Documents/projects/cpython/Doc/library/dataclasses.rst:134: WARNING: py:meth reference target not found: __hash__
/Users/omatoula/Documents/projects/cpython/Doc/library/dataclasses.rst:134: WARNING: py:meth reference target not found: __hash__
/Users/omatoula/Documents/projects/cpython/Doc/library/dataclasses.rst:134: WARNING: py:meth reference target not found: __hash__
/Users/omatoula/Documents/projects/cpython/Doc/library/dataclasses.rst:140: WARNING: py:meth reference target not found: __hash__
/Users/omatoula/Documents/projects/cpython/Doc/library/dataclasses.rst:140: WARNING: py:meth reference target not found: __hash__
/Users/omatoula/Documents/projects/cpython/Doc/library/dataclasses.rst:140: WARNING: py:meth reference target not found: __hash__
/Users/omatoula/Documents/projects/cpython/Doc/library/dataclasses.rst:147: WARNING: py:meth reference target not found: __hash__
/Users/omatoula/Documents/projects/cpython/Doc/library/dataclasses.rst:147: WARNING: py:meth reference target not found: __hash__
/Users/omatoula/Documents/projects/cpython/Doc/library/dataclasses.rst:152: WARNING: py:meth reference target not found: __hash__
/Users/omatoula/Documents/projects/cpython/Doc/library/dataclasses.rst:152: WARNING: py:meth reference target not found: __hash__
/Users/omatoula/Documents/projects/cpython/Doc/library/dataclasses.rst:152: WARNING: py:meth reference target not found: __hash__
/Users/omatoula/Documents/projects/cpython/Doc/library/dataclasses.rst:152: WARNING: py:meth reference target not found: __hash__
/Users/omatoula/Documents/projects/cpython/Doc/library/dataclasses.rst:160: WARNING: py:meth reference target not found: __setattr__
/Users/omatoula/Documents/projects/cpython/Doc/library/dataclasses.rst:160: WARNING: py:meth reference target not found: __delattr__
/Users/omatoula/Documents/projects/cpython/Doc/library/dataclasses.rst:165: WARNING: py:meth reference target not found: __init__
/Users/omatoula/Documents/projects/cpython/Doc/library/dataclasses.rst:165: WARNING: py:meth reference target not found: __init__
/Users/omatoula/Documents/projects/cpython/Doc/library/dataclasses.rst:174: WARNING: py:meth reference target not found: __init__
/Users/omatoula/Documents/projects/cpython/Doc/library/dataclasses.rst:174: WARNING: py:meth reference target not found: __init__
/Users/omatoula/Documents/projects/cpython/Doc/library/dataclasses.rst:185: WARNING: py:attr reference target not found: __slots__
/Users/omatoula/Documents/projects/cpython/Doc/library/dataclasses.rst:185: WARNING: py:attr reference target not found: __slots__
/Users/omatoula/Documents/projects/cpython/Doc/library/dataclasses.rst:217: WARNING: py:meth reference target not found: __init__
/Users/omatoula/Documents/projects/cpython/Doc/library/dataclasses.rst:258: WARNING: py:meth reference target not found: __init__
/Users/omatoula/Documents/projects/cpython/Doc/library/dataclasses.rst:261: WARNING: py:meth reference target not found: __repr__
/Users/omatoula/Documents/projects/cpython/Doc/library/dataclasses.rst:264: WARNING: py:meth reference target not found: __hash__
/Users/omatoula/Documents/projects/cpython/Doc/library/dataclasses.rst:277: WARNING: py:meth reference target not found: __eq__
/Users/omatoula/Documents/projects/cpython/Doc/library/dataclasses.rst:277: WARNING: py:meth reference target not found: __gt__
/Users/omatoula/Documents/projects/cpython/Doc/library/dataclasses.rst:289: WARNING: py:meth reference target not found: __init__
/Users/omatoula/Documents/projects/cpython/Doc/library/dataclasses.rst:438: WARNING: py:meth reference target not found: __init__
/Users/omatoula/Documents/projects/cpython/Doc/library/dataclasses.rst:438: WARNING: py:meth reference target not found: __post_init__
/Users/omatoula/Documents/projects/cpython/Doc/library/dataclasses.rst:442: WARNING: py:meth reference target not found: __init__
/Users/omatoula/Documents/projects/cpython/Doc/library/dataclasses.rst:442: WARNING: py:meth reference target not found: __post_init__
/Users/omatoula/Documents/projects/cpython/Doc/library/dataclasses.rst:450: WARNING: py:meth reference target not found: __post_init__
/Users/omatoula/Documents/projects/cpython/Doc/library/dataclasses.rst:477: WARNING: py:meth reference target not found: __init__
/Users/omatoula/Documents/projects/cpython/Doc/library/dataclasses.rst:504: WARNING: py:meth reference target not found: __setattr__
/Users/omatoula/Documents/projects/cpython/Doc/library/dataclasses.rst:504: WARNING: py:meth reference target not found: __delattr__
/Users/omatoula/Documents/projects/cpython/Doc/library/dataclasses.rst:511: WARNING: py:meth reference target not found: __init__
/Users/omatoula/Documents/projects/cpython/Doc/library/dataclasses.rst:511: WARNING: py:meth reference target not found: __post_init__
/Users/omatoula/Documents/projects/cpython/Doc/library/dataclasses.rst:511: WARNING: py:meth reference target not found: __post_init__
/Users/omatoula/Documents/projects/cpython/Doc/library/dataclasses.rst:511: WARNING: py:meth reference target not found: __post_init__
/Users/omatoula/Documents/projects/cpython/Doc/library/dataclasses.rst:511: WARNING: py:meth reference target not found: __init__
/Users/omatoula/Documents/projects/cpython/Doc/library/dataclasses.rst:511: WARNING: py:meth reference target not found: __post_init__
/Users/omatoula/Documents/projects/cpython/Doc/library/dataclasses.rst:531: WARNING: py:meth reference target not found: __init__
/Users/omatoula/Documents/projects/cpython/Doc/library/dataclasses.rst:531: WARNING: py:meth reference target not found: __init__
/Users/omatoula/Documents/projects/cpython/Doc/library/dataclasses.rst:531: WARNING: py:meth reference target not found: __init__
/Users/omatoula/Documents/projects/cpython/Doc/library/dataclasses.rst:531: WARNING: py:meth reference target not found: __post_init__
/Users/omatoula/Documents/projects/cpython/Doc/library/dataclasses.rst:548: WARNING: py:meth reference target not found: __init__
/Users/omatoula/Documents/projects/cpython/Doc/library/dataclasses.rst:552: WARNING: py:meth reference target not found: __post_init__
/Users/omatoula/Documents/projects/cpython/Doc/library/dataclasses.rst:570: WARNING: py:meth reference target not found: __init__
/Users/omatoula/Documents/projects/cpython/Doc/library/dataclasses.rst:570: WARNING: py:meth reference target not found: __post_init__
/Users/omatoula/Documents/projects/cpython/Doc/library/dataclasses.rst:601: WARNING: py:meth reference target not found: __setattr__
/Users/omatoula/Documents/projects/cpython/Doc/library/dataclasses.rst:601: WARNING: py:meth reference target not found: __delattr__
/Users/omatoula/Documents/projects/cpython/Doc/library/dataclasses.rst:607: WARNING: py:meth reference target not found: __init__
/Users/omatoula/Documents/projects/cpython/Doc/library/dataclasses.rst:637: WARNING: py:meth reference target not found: __init__
/Users/omatoula/Documents/projects/cpython/Doc/library/dataclasses.rst:641: WARNING: py:meth reference target not found: __init__
/Users/omatoula/Documents/projects/cpython/Doc/library/dataclasses.rst:644: WARNING: py:meth reference target not found: __init__
/Users/omatoula/Documents/projects/cpython/Doc/library/dataclasses.rst:665: WARNING: py:meth reference target not found: __init__
/Users/omatoula/Documents/projects/cpython/Doc/library/dataclasses.rst:673: WARNING: py:meth reference target not found: __init__
/Users/omatoula/Documents/projects/cpython/Doc/library/dataclasses.rst:686: WARNING: py:meth reference target not found: __init__
/Users/omatoula/Documents/projects/cpython/Doc/library/dataclasses.rst:686: WARNING: py:meth reference target not found: __init__
```
<!-- gh-linked-prs -->
### Linked PRs
* gh-103811
* gh-103813
<!-- /gh-linked-prs -->
| 0f23eda4b996dacd19dbe91bd47a30433bf236d2 | 8291ae31ddc2f935b8ec60f3d5f3825f78ccf244 |
python/cpython | python__cpython-103812 | # Adjust F541 linting issue on Lib/test module
# Feature or enhancement
After running [ruff](https://github.com/charliermarsh/ruff) in CPython, some linting and formatting errors were found.
This issue intends to fix the `F541 f-string without any placeholders` errors related to the Lib/test module.
# Pitch
In the `CPython/Lib` directory, we run the following command:
```
ruff test/ --select F541
```
We can see these kind of alerts:
```
...
test/test_sqlite3/test_regression.py:494:32: F541 f-string without any placeholders
test/test_sqlite3/test_regression.py:501:32: F541 f-string without any placeholders
test/test_sqlite3/test_regression.py:508:32: F541 f-string without any placeholders
test/test_sqlite3/test_userfunctions.py:565:22: F541 f-string without any placeholders
...
```
# Previous discussion
None
<!-- gh-linked-prs -->
### Linked PRs
* gh-103812
<!-- /gh-linked-prs -->
| 8291ae31ddc2f935b8ec60f3d5f3825f78ccf244 | df3173d28ef25a0f97d2cca8cf4e64e062a08d06 |
python/cpython | python__cpython-103806 | # Add missing tests to the dis module
Improve test coverage for the dis module i.e `cpython/lib/dis.py`, tests are in `cpython/Lib/tests/test_dis.py`. Missing tests include:
- `dis.disco`
- `dis.findlinestarts`
<!-- gh-linked-prs -->
### Linked PRs
* gh-103806
* gh-103901
<!-- /gh-linked-prs -->
| 86aa8a5e98e5742bb5bb6ab617f08b1679b33b55 | ef25febcf2ede92a03c5ea00a13e167e0b5cb274 |
python/cpython | python__cpython-103796 | # Adjust `Tools/wasm` linting and formatting issues found by `ruff`
# Feature or enhancement
After running [`ruff`](https://github.com/charliermarsh/ruff) in CPython, some linting and formatting errors were found.
This issue intends to fix those related to the `wasm` module under `Tools/wasm`.
# Pitch
In the CPython directory, we run the following command:
```sh
ruff .
```
We can see these three alerts under the Tools/wasm module:
```
Tools/wasm/wasm_assets.py:9:89: E501 Line too long (115 > 88 characters)
Tools/wasm/wasm_build.py:76:18: F541 [*] f-string without any placeholders
Tools/wasm/wasm_build.py:601:77: F841 [*] Local variable `s` is assigned to but never used
```
# Previous discussion
None.
<!-- gh-linked-prs -->
### Linked PRs
* gh-103796
<!-- /gh-linked-prs -->
| 01be52e42eac468b6511b56ee60cd1b99baf3848 | d94b3a6f45a068b2d2e5a75127f3c69a652645da |
python/cpython | python__cpython-103767 | # Defer string formatting in asyncio Task creation
# Feature or enhancement
When an asyncio Task is created without passing in a `name` (a common case), the init method uses a global counter to generate a task name of the form `"Task-<counter>"`.
It is very common in applications that the task name is never read or used, and string formatting has non-negligible runtime cost, making task creation slower. It would be beneficial to defer the string formatting operation and avoid incurring that overhead during task creation.
This can be done by storing the counter in the task struct, and using it to lazily populate the name in the `get_name` method.
<!-- gh-linked-prs -->
### Linked PRs
* gh-103767
<!-- /gh-linked-prs -->
| 85c7bf5bcec07beea6064976e6199195cd34329d | fbf3596c3edadd03b5a8c659e9f27a09e5d1a051 |
python/cpython | python__cpython-103792 | # contextlib.suppress does not support ExceptionGroups
Currently, `contextlib.suppress` does not successfully suppress exceptions that are wrapped within an `ExceptionGroup`.
In other words, this works:
```python
def raise_ve():
raise ValueError("ve")
with suppress(ValueError):
raise_ve()
```
while this doesn't:
```python
def raise_ve_eg():
raise ExceptionGroup("eg", [ValueError("ve")])
with suppress(ValueError):
raise_ve_eg()
```
The user's intent is to suppress the latter case, too. It should work just as well, removing `ValueError` instances from the exception group. If it ends up empty, nothing gets raised. Otherwise, an `ExceptionGroup` should be re-raised with the remaining exceptions. For instance:
```python
def raise_ve_eg3():
raise ExceptionGroup("eg", [ValueError("ve1"), KeyError("ke"), ValueError("ve2")])
with suppress(ValueError):
raise_ve_eg3()
```
should raise an `ExceptionGroup` with the `KeyError("ke")` only, as we suppressed ValueError instances.
<!-- gh-linked-prs -->
### Linked PRs
* gh-103792
* gh-111910
* gh-111955
<!-- /gh-linked-prs -->
| 22bed58e531ce780d91f3364c5ace98fad28c2e8 | 19e4f757de8c7cf2b4b9b4cbb32e376d0e50d2d4 |
python/cpython | python__cpython-103782 | # asyncio unix events test doesn't restore mocked unix_events.can_use_pidfd
# Bug report
in `test_asyncio.test_unix_events.PolicyTest.test_get_default_child_watcher`, `unix_events.can_use_pidfd` is mocked within the test body, but never restored to the original function.
this doesn't cause test failures during regular test runs, but during a refleak test run on MacOS it a `AttributeError: module 'os' has no attribute 'pidfd_open'` to be thrown (presumably due to another test using the non-mocked function in the second iteration).
repro:
```
./python.exe -m test test_asyncio -m '*.test_unix_events.*' -R 2:2
WARNING: Running tests with --huntrleaks/-R and less than 3 warmup repetitions can give false positives!
0:00:00 load avg: 3.79 Run tests sequentially
0:00:00 load avg: 3.79 [1/1] test_asyncio
beginning 4 repetitions
1234
.Process ForkProcess-10:
Traceback (most recent call last):
...
...
AttributeError: module 'os' has no attribute 'pidfd_open'
...
...
```
this can be fixed by patching instead of mocking in the `test_get_default_child_watcher` test (PR coming up).
# Your environment
- CPython versions tested on: main
- Operating system and architecture: MacOS x86-64
<!-- gh-linked-prs -->
### Linked PRs
* gh-103782
<!-- /gh-linked-prs -->
| 518050ced18422fd00fadc1a81b0d942b98e2e5b | 04ea04807dc76955f56ad25a81a0947536343c09 |
python/cpython | python__cpython-103778 | # `SHELL=/bin/sh -e` can cause failures when `Makefile` re-runs `./configure`
# Bug report
Since the change in GH-100328 to make `SHELL=/bin/sh -e` rather than just `/bin/sh`, `./configure` can fail in some cases when re-run by the `config.status` recipe in `Makefile`.
# Your environment
- Any environment where `./configure` can execute a failing non-checked command, including common macOS environments
Failure originally reported and culprit found by @gvanrossum via Discord.
<!-- gh-linked-prs -->
### Linked PRs
* gh-103778
<!-- /gh-linked-prs -->
| ed948e01bb68e3f026f38a7e43241d850ee1bfb5 | 6751a4af9512d4a6d65b5eedd60ff9923c519ad2 |
python/cpython | python__cpython-103769 | # Fix 'Warning: py:class reference target not found: ModuleSpec'
Follow-up from https://github.com/python/cpython/pull/103701#issuecomment-1518916047
<!-- gh-linked-prs -->
### Linked PRs
* gh-103769
* gh-103797
* gh-103799
<!-- /gh-linked-prs -->
| d2745fe850d7b1959843c3fd3d284aa14956cd9e | 68f583658247ceced323d79e1cf775c91c53c019 |
python/cpython | python__cpython-103764 | # Implement PEP 695
We should implement PEP-695. Some discussion of the implementation is at https://github.com/erictraut/cpython/issues. I will open a draft PR momentarily.
TODO:
- [ ] Evaluate TypeAlias values
- [ ] Lazy evaluation for TypeVar bounds
- [ ] More tests
- [ ] Fix remaining tests in test_typing.py
<!-- gh-linked-prs -->
### Linked PRs
* gh-103764
<!-- /gh-linked-prs -->
| 24d8b88420b81fc60aeb0cbcacef1e72d633824a | fdafdc235e74f2f4fedc1f745bf8b90141daa162 |
python/cpython | python__cpython-103747 | # `types.UnionType` + `Literal` types are not tested together
`Literal` had some known problems when used with `typing.Union` and `types.UnionType`.
Example: https://github.com/python/cpython/issues/103592
I've covered `typing.Union`, see https://github.com/python/cpython/pull/103706
But, I forgot about `types.UnionType`.
So, I will add this new test as a part of this issue.
<!-- gh-linked-prs -->
### Linked PRs
* gh-103747
* gh-103772
<!-- /gh-linked-prs -->
| 3d29edaf0a5f2e12e7f72552f602c761ddaf0d13 | d2745fe850d7b1959843c3fd3d284aa14956cd9e |
python/cpython | python__cpython-103744 | # Allocating extra data after an object instance
# Feature or enhancement
Add an unstable (in PEP 689 sense) function that allocates memory for a GC object and allows the caller to specify the size of additional memory that should be allocated after the object. Similar to what could be done using `_PyObject_GC_Malloc` function in Python <= 3.10.
# Pitch
Currently there is no way of allocating extra data after an object and still being able to have a standard Python class that supports GC, allows inheriting and doesn't come with limitations of `PyVarObject` (see #103740).
See the linked discussion for more details, but in essence the use case is the following. We have a base class and metaclass that support defining "slots" on classes (similar to Python `__slots__`, but with a different behavior, more on that later). The data for the slots is stored after the object, in the same block of memory. When inheriting from a class that defines such "slots", the subclass gets all the slots from its base classes + slots defined on it. The data for all those slots is always stored after the object, so the slot storage size doesn't really come into calculation for `tp_basicsize`.
A nice effect of this behavior is that a subclass can inherit from multiple classes with each of the bases defining its own slots. The subclass then gets all those slots, as if they were directly defined on it (in contrast with Python `__slots__`, which prevents such inheritance).
CC: @encukou
# Previous discussion
See [this discussion](https://discuss.python.org/t/equivalent-of-pyobject-gc-malloc-in-python-3-11/25919) for more details.
<!-- gh-linked-prs -->
### Linked PRs
* gh-103744
<!-- /gh-linked-prs -->
| 87223f32aba872cfebde6fbe38673799eb79f248 | f6314b92dcfc8ca6ff3fd150814f85448db69165 |
python/cpython | python__cpython-110960 | # IDLE - Remove unneeded .keys for dict iteration
Issue #87179, item 6. At the moment, `ob.keys()` appears 16 times in idlelib. Sometimes 'ob' is a dict, in which case '.keys()' can be removed. Sometimes ob is not a dict, and possibly not an iterable, and '.keys()' returns an iterable other than a dict keys view. In some such cases I am adding a note as to what the return value is to be clear that '.keys()' is needed.
Sometimes `func(somedict)` (list or tuple or set or ?) is needed because an immediate iteration will modify the dict or the captured keys will be sent elsewhere, such as through the rpc connection, or the keys are transformed, as with sorted.
<!-- gh-linked-prs -->
### Linked PRs
* gh-110960
* gh-111026
* gh-111027
<!-- /gh-linked-prs -->
| baefbb21d91db2d950706737a6ebee9b2eff5c2d | 77dbd956090aac66e264d9d640f6adb6b0930b87 |
python/cpython | python__cpython-103736 | # Remove recognition of "procbody" Tcl value type
Ever since #36111, Tkinter has checked for Tcl values with the "procbody" type, presumably because it was (and still is) one of the registered types or listed in tclInt.h. But this type is not interesting to Tkinter: any values of this type are wrapped with `_tkinter.Tcl_Obj` just as if they were of an unrecognized type. I suggest that Tkinter not cache this type or check for values using it.
<!-- gh-linked-prs -->
### Linked PRs
* gh-103736
<!-- /gh-linked-prs -->
| d96ca41688b9c2a8d261c340ae98438ca41796d8 | 579100f6d75a27429e7f8de74935d7bc3a3e44e6 |
python/cpython | python__cpython-103732 | # Remove `#ifdef TCL_WIDE_INT_TYPE` usage
In Tcl 8.4 and later, tcl.h has always provided `TCL_WIDE_INT_TYPE`, `Tcl_WideInt`, and `Tcl_WideUInt`. Since Tkinter requires 8.5.12, it is okay for `AsObj()` to use `Tcl_WideInt` without checking if `TCL_WIDE_INT_TYPE` is defined. `Tcl_WideInt` is already used without similar `#ifdef`s in `fromWideIntObj()`.
<!-- gh-linked-prs -->
### Linked PRs
* gh-103732
<!-- /gh-linked-prs -->
| 6e850c30bb7085c80a97982d00c9c20e7d23ff84 | ccd4253752ae2d84a5448281db1a1298ca8d8610 |
python/cpython | python__cpython-103775 | # Empty unclosed f-string does not directly raise a SyntaxError in the REPL
# Bug report
This is another bug introduced in https://github.com/python/cpython/commit/1ef61cf71a218c71860ff6aecf0fd51edb8b65dc. When typing an empty single-quoted unclosed f-string in the REPL, another line is added and input is expected, before a `SyntaxError` is raised.
Before https://github.com/python/cpython/commit/1ef61cf71a218c71860ff6aecf0fd51edb8b65dc:
```python3
❯ ./python.exe
Python 3.12.0a7+ (tags/v3.12.0a7-153-ga6b07b5a34:a6b07b5a34, Apr 23 2023, 13:18:40) [Clang 14.0.3 (clang-1403.0.22.14.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> f'
File "<stdin>", line 1
f'
^
SyntaxError: unterminated string literal (detected at line 1)
```
Current main:
```python3
❯ ./python.exe
Python 3.12.0a7+ (heads/main:05b3ce7339, Apr 23 2023, 13:26:24) [Clang 14.0.3 (clang-1403.0.22.14.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> f"
...
File "<stdin>", line 1
f"
^
SyntaxError: unterminated f-string literal (detected at line 2)
>>> f"
... asdnc
File "<stdin>", line 1
f"
^
SyntaxError: unterminated f-string literal (detected at line 2)
>>> f"
... asdasd"
File "<stdin>", line 1
f"
^
SyntaxError: unterminated f-string literal (detected at line 2)
```
<!-- gh-linked-prs -->
### Linked PRs
* gh-103775
<!-- /gh-linked-prs -->
| cb157a1a353675cb6f08bdae5d7aadd6b28bb0a9 | ab25c7e3112b24a4cd8cb626bbd924c57af0fe1c |
python/cpython | python__cpython-103728 | # ASAN false positives due to vfork() with GCC 9
Older versions of ASAN don't properly support `vfork()`. Python uses `vfork()` when available in `_posixsubprocess.c`. This can lead to false positive reports from ASAN. I believe this issue exists with GCC 9 (and older), but not GCC 10 (and newer). The CPython GitHub actions ASAN runner currently uses GCC 9.4.0, so it does not properly handle vfork().
I've seen these false positives in my nogil-3.12 fork. I'm unsure if you've run into them upstream.
See https://github.com/google/sanitizers/issues/925
https://github.com/python/cpython/blob/5041c2ba6e9c992d1c54834481c9be64581c0235/Modules/_posixsubprocess.c#L43-L49
<!-- gh-linked-prs -->
### Linked PRs
* gh-103728
* gh-104794
<!-- /gh-linked-prs -->
| 83305808000e03cbad31ac3e9ef65454fb409282 | c9134fb228860bbb641794b1d165a95a55b5c669 |
python/cpython | python__cpython-103725 | # Add test case to assert Type error if no arg as provided in os.register_at_fork
# Test case
Add test case to ensure os.register_at_fork returns type error if no arg is specified
```
>>> import os
>>> os.register_at_fork()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: At least one argument is required.
```
<!-- gh-linked-prs -->
### Linked PRs
* gh-103725
<!-- /gh-linked-prs -->
| 7255bbd4a1841447a21c3eb74e4fd9e21818d833 | 82932b72cabb6a77bbf5465a0a9574f90773aadf |
python/cpython | python__cpython-103719 | # Not closing an f-string leads to a use-after-free
# Bug report
Not closing an f-string in the REPL or a file leads to a use-after-free. This had to do with how f-string buffers are updated when in need of reallocating more space for the tokenizer buffer and it was introduced in https://github.com/python/cpython/commit/1ef61cf71a218c71860ff6aecf0fd51edb8b65dc. Here's an example (this only fails with address sanitizer enabled):
```
❯ ./python.exe
Python 3.12.0a7+ (heads/fix-updating-fstring-buffers-tok:0056701aa3, Apr 23 2023, 11:12:49) [Clang 14.0.3 (clang-1403.0.22.14.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> f"
...
=================================================================
==8991==ERROR: AddressSanitizer: heap-use-after-free on address 0x000104313550 at pc 0x0001006c6d98 bp 0x00016fa28e70 sp 0x00016fa28e68
READ of size 1 at 0x000104313550 thread T0
#0 0x1006c6d94 in unicode_decode_utf8 unicodeobject.c:4526
#1 0x1006cc0bc in PyUnicode_DecodeUTF8 unicodeobject.c:4431
#2 0x10050f1d8 in _syntaxerror_range tokenizer.c:1252
#3 0x10050da08 in syntaxerror tokenizer.c:1294
#4 0x100500bbc in _PyTokenizer_Get tokenizer.c:2639
#5 0x1003d6810 in _PyPegen_fill_token pegen.c:201
#6 0x100475738 in fstring_replacement_field_rule parser.c:15626
#7 0x1003eeb98 in fstring_rule parser.c:1334
#8 0x10044b1fc in strings_rule parser.c:15962
#9 0x10041b00c in atom_rule parser.c:14388
#10 0x100427ee4 in t_primary_rule parser.c:18429
#11 0x1004ef890 in single_subscript_attribute_target_rule parser.c:18319
#12 0x1004e75a8 in _tmp_13_rule parser.c:25515
#13 0x1004d8a34 in simple_stmt_rule parser.c:1730
#14 0x1003f4140 in simple_stmts_rule parser.c:1625
#15 0x1003e81f4 in _PyPegen_parse parser.c:41238
#16 0x1003da7b4 in _PyPegen_run_parser pegen.c:825
#17 0x1003dae14 in _PyPegen_run_parser_from_file_pointer pegen.c:897
#18 0x1004fdc6c in _PyParser_ASTFromFile peg_api.c:26
#19 0x1008f0c74 in PyRun_InteractiveOneObjectEx pythonrun.c:240
#20 0x1008efa04 in _PyRun_InteractiveLoopObject pythonrun.c:137
#21 0x1008ef6e8 in _PyRun_AnyFileObject pythonrun.c:72
#22 0x1008f0920 in PyRun_AnyFileExFlags pythonrun.c:104
#23 0x100943acc in Py_RunMain main.c:689
#24 0x1009448d4 in pymain_main main.c:719
#25 0x100944b74 in Py_BytesMain main.c:743
#26 0x1003d5b7c in main python.c:15
#27 0x18e8dff24 (<unknown module>)
0x000104313550 is located 16 bytes inside of 28-byte region [0x000104313540,0x00010431355c)
freed by thread T0 here:
#0 0x101c070ec in wrap_realloc+0x9c (libclang_rt.asan_osx_dynamic.dylib:arm64e+0x430ec) (BuildId: f0a7ac5c49bc3abc851181b6f92b308a32000000200000000100000000000b00)
#1 0x10065213c in _PyMem_RawRealloc obmalloc.c:64
#2 0x100653cd0 in _PyMem_DebugRawRealloc obmalloc.c:1957
#3 0x1006544e4 in _PyMem_DebugRealloc obmalloc.c:2045
#4 0x100654afc in PyMem_Realloc obmalloc.c:609
#5 0x10050e950 in tok_reserve_buf tokenizer.c:480
#6 0x10050c3c4 in tok_nextc tokenizer.c:1198
#7 0x100500490 in _PyTokenizer_Get tokenizer.c:2639
#8 0x1003d6810 in _PyPegen_fill_token pegen.c:201
#9 0x100475738 in fstring_replacement_field_rule parser.c:15626
#10 0x1003eeb98 in fstring_rule parser.c:1334
#11 0x10044b1fc in strings_rule parser.c:15962
#12 0x10041b00c in atom_rule parser.c:14388
#13 0x100427ee4 in t_primary_rule parser.c:18429
#14 0x1004ef890 in single_subscript_attribute_target_rule parser.c:18319
#15 0x1004e75a8 in _tmp_13_rule parser.c:25515
#16 0x1004d8a34 in simple_stmt_rule parser.c:1730
#17 0x1003f4140 in simple_stmts_rule parser.c:1625
#18 0x1003e81f4 in _PyPegen_parse parser.c:41238
#19 0x1003da7b4 in _PyPegen_run_parser pegen.c:825
#20 0x1003dae14 in _PyPegen_run_parser_from_file_pointer pegen.c:897
#21 0x1004fdc6c in _PyParser_ASTFromFile peg_api.c:26
#22 0x1008f0c74 in PyRun_InteractiveOneObjectEx pythonrun.c:240
#23 0x1008efa04 in _PyRun_InteractiveLoopObject pythonrun.c:137
#24 0x1008ef6e8 in _PyRun_AnyFileObject pythonrun.c:72
#25 0x1008f0920 in PyRun_AnyFileExFlags pythonrun.c:104
#26 0x100943acc in Py_RunMain main.c:689
#27 0x1009448d4 in pymain_main main.c:719
#28 0x100944b74 in Py_BytesMain main.c:743
#29 0x1003d5b7c in main python.c:15
previously allocated by thread T0 here:
#0 0x101c06e68 in wrap_malloc+0x94 (libclang_rt.asan_osx_dynamic.dylib:arm64e+0x42e68) (BuildId: f0a7ac5c49bc3abc851181b6f92b308a32000000200000000100000000000b00)
#1 0x1006520f8 in _PyMem_RawMalloc obmalloc.c:42
#2 0x100654144 in _PyMem_DebugMalloc obmalloc.c:2022
#3 0x100654a04 in PyMem_Malloc obmalloc.c:587
#4 0x10050b620 in tok_nextc tokenizer.c:1198
#5 0x100504848 in tok_get_normal_mode tokenizer.c:1619
#6 0x1005006ac in _PyTokenizer_Get tokenizer.c:2639
#7 0x1003d6810 in _PyPegen_fill_token pegen.c:201
#8 0x1003e71f4 in _PyPegen_parse parser.c:41238
#9 0x1003da7b4 in _PyPegen_run_parser pegen.c:825
#10 0x1003dae14 in _PyPegen_run_parser_from_file_pointer pegen.c:897
#11 0x1004fdc6c in _PyParser_ASTFromFile peg_api.c:26
#12 0x1008f0c74 in PyRun_InteractiveOneObjectEx pythonrun.c:240
#13 0x1008efa04 in _PyRun_InteractiveLoopObject pythonrun.c:137
#14 0x1008ef6e8 in _PyRun_AnyFileObject pythonrun.c:72
#15 0x1008f0920 in PyRun_AnyFileExFlags pythonrun.c:104
#16 0x100943acc in Py_RunMain main.c:689
#17 0x1009448d4 in pymain_main main.c:719
#18 0x100944b74 in Py_BytesMain main.c:743
#19 0x1003d5b7c in main python.c:15
#20 0x18e8dff24 (<unknown module>)
SUMMARY: AddressSanitizer: heap-use-after-free unicodeobject.c:4526 in unicode_decode_utf8
Shadow bytes around the buggy address:
0x007020882650: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x007020882660: fa fa fa fa fa fa fa fa fa fa fa fa 00 00 00 05
0x007020882670: fa fa 00 00 00 05 fa fa fd fd fd fd fa fa fd fd
0x007020882680: fd fd fa fa fd fd fd fd fa fa fd fd fd fd fa fa
0x007020882690: fd fd fd fd fa fa 00 00 00 00 fa fa 00 00 00 00
=>0x0070208826a0: fa fa fd fd fd fd fa fa fd fd[fd]fd fa fa fd fd
0x0070208826b0: fd fd fa fa fd fd fd fd fa fa fd fd fd fd fa fa
0x0070208826c0: fd fd fd fd fa fa 00 00 00 00 fa fa 00 00 00 06
0x0070208826d0: fa fa 00 00 00 03 fa fa 00 00 02 fa fa fa 00 00
0x0070208826e0: 00 00 fa fa 00 00 02 fa fa fa 00 00 02 fa fa fa
0x0070208826f0: 00 00 02 fa fa fa 00 00 02 fa fa fa 00 00 00 01
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
Left alloca redzone: ca
Right alloca redzone: cb
==8991==ABORTING
zsh: abort ./python.exe
```
<!--
You can freely edit this text. Remove any lines you believe are unnecessary.
-->
<!-- gh-linked-prs -->
### Linked PRs
* gh-103719
* gh-103815
<!-- /gh-linked-prs -->
| 05b3ce7339b9ce44eec728e88e80ba1f125436ed | 5041c2ba6e9c992d1c54834481c9be64581c0235 |
python/cpython | python__cpython-103717 | # Add missing requires_fork decorator to test case in simple_subprocess
# Enhancement
`simple_subprocess` test in Lib/test/test_socketserver.py could use `test.support.requires_fork()` as it depends on fork functionality.
<!-- gh-linked-prs -->
### Linked PRs
* gh-103717
<!-- /gh-linked-prs -->
| 777bdff0ec4c21176ddf61e07bc75d170bc65d54 | 9c3442c0938127788fa59e4ceb80ae78b86fad1d |
python/cpython | python__cpython-103713 | # Length of type names in AttributeError are inconsistent
Some of them truncate the type name at 50 characters, some 100, and some 200. 50 is noticeably short enough that I actually do encounter truncations with nested modules.
It'd be good to make this minimally consistent by replacing all the 50s with 100s.
<!-- gh-linked-prs -->
### Linked PRs
* gh-103713
<!-- /gh-linked-prs -->
| 543009347e7cfcc495ca8553fab8d622dcfd18e3 | 59c522f9650c22dc986debce483b83a4ffc6dc0d |
python/cpython | python__cpython-103709 | # Make site-packages implementation configurable
# Enhancement
It is confusing for different implementations of python (eg pypy and rustpython) to specify correct layout of site-packages, whether they should include their own implementation (by making huge diffs in sysconfig.py) or use same as cpython's implementation viz pythonX.Y. Pypy has good solution of this problem where sysconfig _INSTALL_SCHEMES has term `implementation_lower` (lower counterpart of `implementation`). Definition of `implementation` is up to different flavours of python to decide. This can reduce lot of diffs in sysconfig.py in various implementations and make layout of site-packages more uniform.
# Example (taken from Pypi implementation)
```python
'posix_prefix': {
'stdlib': '{base}/lib/{implementation_lower}{py_version_short}',
'platstdlib': '{platbase}/lib/{implementation_lower}{py_version_short}',
'purelib': '{base}/lib/{implementation_lower}{py_version_short}/site-packages',
'platlib': '{platbase}/lib/{implementation_lower}{py_version_short}/site-packages',
'include': '{base}/include/{implementation_lower}{py_version_short}',
'platinclude': '{platbase}/include/{implementation_lower}{py_version_short}',
'scripts': '{base}/bin',
'data': '{base}',
}
```
```python
def _get_implementation():
if sys.implementation.name == 'pypy':
return 'PyPy'
return 'Python'
```
# Related discussions
https://github.com/RustPython/RustPython/issues/4925
Reference: https://github.com/mozillazg/pypy/blob/master/lib-python/2.7/sysconfig.py
<!-- gh-linked-prs -->
### Linked PRs
* gh-103709
<!-- /gh-linked-prs -->
| f46987b8281148503568516c29a4a04a75aaba8d | cf34b7704be4c97d0479c04df0d9cd8fe210e5f4 |
python/cpython | python__cpython-103698 | # Add `__orig_bases__` to non-generic TypedDict
# Feature or enhancement
As discussed at the typing summit, non generic TypedDict's completely loose all inheritance information. Funny enough, _generic_ TypedDict's actually preserve it via `__orig_bases__` because Generic does that. So this just brings non-generic TypedDicts to be the same.
# Pitch
This is very useful for runtime type checkers, and as per above the attribute already exists for generic TypedDicts
# Previous discussion
Discussed at PyCon 2023 typing summit, this was an uncontroversial yes at the time.
<!-- gh-linked-prs -->
### Linked PRs
* gh-103698
<!-- /gh-linked-prs -->
| 0056701aa370553636b676cc99e327137d1688c6 | e38bebb9ee805df6848f42845e71c8da8a821ad3 |
python/cpython | python__cpython-103694 | # Add convenience variables to `pdb`
# Feature or enhancement
Add convenience variables like `$foo` to `pdb`, which would be global and temporary. There is a similar feature in `gdb`.
# Pitch
Currently, if the user needs to store something temporarily, they need to use a real variable in the current frame, which could potentially interfere with their program (overwrite an existing variable, or messing up with checks in the future). Also, there is no easy way for the users to create a variable that's accessible when they explore every frame.
An easily distinguishable variable (that starts with `$`) which is global and temporary would solve this issue. Behind the curtain, we simply replace the variable with a secret variable in global dict and clear the dict when `pdb` gives control back to the program.
With this feature, we actually solves another issue - it's super non-intuitive to access to some key data in the debugger. For example, `retval`. There's an issue for this https://github.com/python/cpython/issues/86690. You can display the value use `retval`, but to actually get access to it, you need something undocumented and hacky - `locals()['__return__']`. You can only do that when you are in the frame that's returning (which kind of makes sense, but only the BOTTOM ONE frame can be at this state). Also, there's the `f_locals` disaster that we have not yet solved https://github.com/python/cpython/issues/102864.
Another example would be the current frame. You'd be surprised that it's super difficult to access the current frame object you are debugging, `sys._getframe()` and its variance won't give you what you want.
So, we introduce a couple of internal convenience variables
* `$_frame` - the current frame being debugged
* `$_retval` - the return value if the bottom function is returning (this is globally distinct)
* `$_exception` - the (exc_type, exc_value) tuple if an exception is being raised
This could be easily extended in the future to store variables that users are interested in but don't have easy access to.
<!-- gh-linked-prs -->
### Linked PRs
* gh-103694
<!-- /gh-linked-prs -->
| 0fc58c66bafbd20f02c206c801cf9ab939853164 | 524a7f77fd8244835e382f076dd4a76404580bb3 |
python/cpython | python__cpython-103686 | # Tk 8.7: TIP 577 breaks tkinter.Menu.index()
# Bug report
One effect of [TIP 577](https://core.tcl-lang.org/tips/doc/trunk/tip/577.md) is that as of Tk 8.7, the `index` command for menus will now return an empty string instead of `none`, leading to an error in `tkinter.Menu.index()`:
```
>>> m.index('none')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/user/git/cpython/Lib/tkinter/__init__.py", line 3434, in index
return self.tk.getint(i)
^^^^^^^^^^^^^^^^^
_tkinter.TclError: expected integer but got ""
```
It should be easy to accommodate both the new and old behavior.
<!-- gh-linked-prs -->
### Linked PRs
* gh-103686
* gh-103734
<!-- /gh-linked-prs -->
| f0ed293f6aec1c2ed22725301b77d6ccedc2d486 | bd2dca035af88694e25fb060f984fbbcda82bed8 |
python/cpython | python__cpython-103674 | # socketserver: Add missing ForkingUnixStreamServer and ForkingUnixDatagramServer servers
# Enhancement
This issue / PR addresses two missing servers from the `socketserver` module
## Current behaviour
socketserver has the following
| Protocol | Family | Simple | Forking | Threading |
| - | - | - | - | - |
| TCP | AF_INET | TCPServer | ForkingTCPServer | ThreadingTCPServer |
| TCP | AF_UNIX | UnixStreamServer | ??? | ThreadingUnixStreamServer |
| UDP | AF_INET | UDPServer | ForkingUDPServer | ThreadingUDPServer |
| UDP | AF_UNIX | UnixDatagramServer | ??? | ThreadingUnixDatagramServer |
Observe the two gaps marked by "???"
## Proposal
In the case `hasattr(socket, "AF_UNIX") and hasattr(os, "fork")` we enable the two missing servers as
```py
class ForkingUnixStreamServer(ForkingMixIn, UnixStreamServer): pass
class ForkingUnixDatagramServer(ForkingMixIn, UnixDatagramServer): pass
```
These follow the established naming convention
This enhancement is completely forwards/backwards compatible
Mentions in the documentation are included in the PR corresponding to this issue
# Pitch
Googling `ForkingUnixStreamServer` shows a few people / codebases which define such a class in the same manner as above. I myself have done so in a [project](https://github.com/jb2170/SocketCat/blob/73d3bf4f30bfb1ad6e3b2710cc3a7586b5d1499c/src/SocketCat/common.py#L14).
These classes seem to have been overlooked because they require two `if` checks for `hasattr(socket, "AF_UNIX")` and `hasattr(os, "fork")`.
It seems clear to me therefore that these two classes should be added to the `socketserver` standard library module
Some people prefer forks to threads
<!-- gh-linked-prs -->
### Linked PRs
* gh-103674
<!-- /gh-linked-prs -->
| d94b3a6f45a068b2d2e5a75127f3c69a652645da | 209a0a76552c19088e74b0f27827b9214b6c2cf8 |
python/cpython | python__cpython-103671 | # IDLE - Update code with pyupgrade
Item 7 for #87179. In https://github.com/python/cpython/issues/87179#issuecomment-1093900180, Anthony Sottile suggestted running his program [pyupgrade](https://pypi.org/project/pyupgrade/), which automates code updates. It would have done some of the things already done and will do some more. In response to my query, he said on another comment that it has been well tested on multiple packages to only do valid changes. His comment includes a bash command:
`git ls-files -- Lib/idlelib | grep '\\.py$' | xargs pyupgrade --py36-plus`
On Windows, use pyupgrade-directories or try above with git bash on idlelib and idle_test.
<!-- gh-linked-prs -->
### Linked PRs
* gh-103671
* gh-103730
<!-- /gh-linked-prs -->
| bd2dca035af88694e25fb060f984fbbcda82bed8 | 7255bbd4a1841447a21c3eb74e4fd9e21818d833 |
python/cpython | python__cpython-103662 | # importlib/test_metadata_api fails on Windows buildbots
:warning::warning::warning: Buildbot failure :warning::warning::warning:
------------------------------------------------------------------------
Hi! The buildbot **AMD64 Windows10 3.x** has failed when building commit 3e0fec7e07a71bdeeab7554e980110fbc47763b9.
What do you need to do:
1. Don't panic.
2. Check [the buildbot page in the devguide](https://devguide.python.org/buildbots/) if you don't know what the buildbots are or how they work.
3. Go to the page of the buildbot that failed (https://buildbot.python.org/all/#builders/146/builds/4915) and take a look at the build logs.
4. Check if the failure is related to this commit (3e0fec7e07a71bdeeab7554e980110fbc47763b9) or if it is a false positive.
5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.
You can take a look at the buildbot page here:
https://buildbot.python.org/all/#builders/146/builds/4915
Failed tests:
- test_importlib
Failed subtests:
- test_read_text - test.test_importlib.test_metadata_api.APITests.test_read_text
Summary of the results of the build (if available):
== Tests result: FAILURE then FAILURE ==
399 tests OK.
10 slowest tests:
- test_math: 6 min 34 sec
- test_asyncio: 4 min 43 sec
- test_tokenize: 3 min 42 sec
- test_multiprocessing_spawn: 3 min 41 sec
- test_lib2to3: 2 min 52 sec
- test_capi: 2 min 30 sec
- test_unparse: 1 min 57 sec
- test_concurrent_futures: 1 min 46 sec
- test_unicodedata: 1 min 42 sec
- test_compileall: 1 min 33 sec
1 test failed:
test_importlib
34 tests skipped:
test_clinic test_curses test_dbm_gnu test_dbm_ndbm test_devpoll
test_epoll test_fcntl test_fork1 test_gdb test_grp test_ioctl
test_kqueue test_multiprocessing_fork
test_multiprocessing_forkserver test_nis test_openpty
test_ossaudiodev test_peg_generator test_perf_profiler test_pipes
test_poll test_posix test_pty test_pwd test_readline test_resource
test_spwd test_syslog test_threadsignals test_wait3 test_wait4
test_xxlimited test_xxtestfuzz test_zipfile64
1 re-run test:
test_importlib
Total duration: 20 min 48 sec
<details>
<summary>Click to see traceback logs</summary>
```python-traceback
Traceback (most recent call last):
File "D:\buildarea\3.x.bolen-windows10\build\Lib\test\test_importlib\test_metadata_api.py", line 86, in test_read_text
top_level = [
^
IndexError: list index out of range
```
</details>
_Originally posted by @bedevere-bot in https://github.com/python/cpython/issues/103584#issuecomment-1517184673_
<!-- gh-linked-prs -->
### Linked PRs
* gh-103662
* gh-103681
<!-- /gh-linked-prs -->
| dc328d398d8f65ec6d2fa493e16ceee75f6d774a | a4967d9d5974562dc0b3d2fcb494483cce9b8122 |
python/cpython | python__cpython-103651 | # perf maps address format
# Bug report
As implemented by @pablogsal in #96123 we can now generate perf maps(which is awesome BTW).
Currently, perf maps are formatted this way:
```
0x58c5882 b py::<module>:/home/arthur/Projects/python-playground/dummy_script.py
0x58c588d b py::baz:/home/arthur/Projects/python-playground/dummy_script.py
0x58c5898 b py::bar:/home/arthur/Projects/python-playground/dummy_script.py
0x58c58a3 b py::foo:/home/arthur/Projects/python-playground/dummy_script.py
```
However, as per the [perf maps interface specification](https://github.com/torvalds/linux/blob/master/tools/perf/Documentation/jit-interface.txt) it seems the address should not include the leading `0x`.
Thus the perf map should look like this:
```
58c5882 b py::<module>:/home/arthur/Projects/python-playground/dummy_script.py
58c588d b py::baz:/home/arthur/Projects/python-playground/dummy_script.py
58c5898 b py::bar:/home/arthur/Projects/python-playground/dummy_script.py
58c58a3 b py::foo:/home/arthur/Projects/python-playground/dummy_script.py
```
Still, it works fine with `perf` but might not with other tools not handling this leading `0x`.
# Your environment
- CPython versions tested on: 3.12.0a7
- Operating system and architecture: Manjaro 22.1.0 x86_64
<!-- gh-linked-prs -->
### Linked PRs
* gh-103651
<!-- /gh-linked-prs -->
| 8d95012c95988dc517db6e09348aab996868699c | e8d77b03e08a4c7e7dde0830c5a12a0b41ff7c33 |
python/cpython | python__cpython-103642 | # Convert calendar constants to enums and add months
From [this discuss thread](https://discuss.python.org/t/define-constants-for-month-numbers-in-calendar-module/25999?u=stoneleaf):
>The `calendar` module already defines constants e.g. `MONDAY` (0), `TUESDAY` (1), etc. for the [days of the week] https://docs.python.org/3/library/calendar.html#calendar.MONDAY).
>
>Since these are likely to be commonly needed too, would it make sense for the calendar module to also export constants for all of `JANUARY` (1), `FEBRUARY` (2), …, `DECEMBER` (12)?
>
>This would allow one to write `from calendar import APRIL` and then e.g. use `APRIL` instead of `4` when building a `datetime.date` object.
>
> Related: [datetime - Python module defining constants for month numbers? - Stack Overflow ](https://stackoverflow.com/q/76028482/359178)
<!-- gh-linked-prs -->
### Linked PRs
* gh-103642
* gh-103833
<!-- /gh-linked-prs -->
| b934f97850b7b2db30fa2b26720d58aac4783149 | 57f8f9a66d4d0b5e590f7746a58136b3b45b1336 |
python/cpython | python__cpython-104949 | # PurePosixPath no longer correctly parses PureWindowsPath
# Bug report
In `pathlib` prior to Python 3.12, passing a `PureWindowsPath` to a `PurePosixPath` resulted in the Windows separator (`\`) being converted to the POSIX separator (`/`). However, in the current main branch the backslashes are preserved in the `PurePosixPath` object.
Here is an example which illustrates this:
```pycon
Python 3.12.0a7 (tags/v3.12.0a7:b861ba4, Apr 6 2023, 16:09:18) [Clang 10.0.0 ] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pathlib
>>> print(pathlib.PurePosixPath(pathlib.PureWindowsPath(r"a\b\c")))
a\b\c
>>> print(pathlib.PurePosixPath(pathlib.PureWindowsPath(r"a\b\c")).as_posix())
a\b\c
```
```pycon
Python 3.11.2 (tags/v3.11.2:878ead1, Mar 9 2023, 16:26:59) [Clang 10.0.0 ] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pathlib
>>> print(pathlib.PurePosixPath(pathlib.PureWindowsPath(r"a\b\c")))
a/b/c
>>> print(pathlib.PurePosixPath(pathlib.PureWindowsPath(r"a\b\c")).as_posix())
a/b/c
```
(The behaviour is the same if using `PosixPath` or `WindowsPath` on the relevant platform; it's not specific to the "pure" variants.)
-----
Before the recent refactoring of the module, passing one `Path` or `PurePath` object to another resulted in the `_parts` attribute being inspected. This was a list of the individual path elements (e.g. `['a', 'b', 'c']` for the path `a\b\c`). The `_parts` attribute was removed in GH-102476 and replaced with `_tail`, but with slightly different semantics.
The current code replaces any `os.altsep` in the path with `os.sep`, which for `WindowsPath` replaces `/` with `\` but for `PosixPath` does nothing as there is no alternative separator. However, the following will produce a correct result:
```pycon
Python 3.12.0a7+ (heads/main:bd2ed06, Apr 19 2023, 15:27:47) [GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pathlib
>>> pathlib.PurePosixPath._flavour.altsep = "\\"
>>> pathlib.PurePosixPath(pathlib.PureWindowsPath(r"a\b\c")).as_posix()
'a/b/c'
```
Thus I think the problem can be isolated to these lines here:
https://github.com/python/cpython/blob/da2273fec7b1644786b9616592b53b04fdec4024/Lib/pathlib.py#L316-L324
# Your environment
- CPython versions tested on: 3.8, 3.11 and 3.12 (alpha 7 and HEAD)
- Operating system and architecture: Ubuntu 20.04 and Windows 10
<!--
You can freely edit this text. Remove any lines you believe are unnecessary.
-->
<!-- gh-linked-prs -->
### Linked PRs
* gh-104949
* gh-104991
<!-- /gh-linked-prs -->
| 328422ce6162eb18735a2c0de12f8a696be97d0c | ad0be361c9922a918c7c3eaf83e1d8f2b019279c |
python/cpython | python__cpython-103894 | # Implement PEP 692
PEP-692 was accepted, but without the syntax change. That means there's very little to do in CPython, but a few changes should be made:
- https://docs.python.org/3.12/library/typing.html#typing.Unpack should mention this new use for Unpack
- https://docs.python.org/3.12/whatsnew/3.12.html should mention the PEP
- Maybe some aspects of `typing.py` assume Unpack is only used for PEP 646 and should be updated
And maybe something else I'm forgetting.
cc @franekmagiera
<!-- gh-linked-prs -->
### Linked PRs
* gh-103894
* gh-104048
<!-- /gh-linked-prs -->
| dc3f97549a8fe4f7fea8d0326e394760b51caa6e | a3a5b4bb232ba29875147baa3b56a5524eece353 |
python/cpython | python__cpython-103618 | # Compiler warnings in _iomodule.c
I'm getting a compiler warning for `_iomodule.c`:
```console
./Modules/_io/_iomodule.c:649:15: warning: incompatible function pointer types initializing 'freefunc' (aka 'void (*)(void *)') with an expression of type 'void (PyObject *)' (aka 'void (struct _object *)') [-Wincompatible-function-pointer-types]
.m_free = iomodule_free,
^~~~~~~~~~~~~
```
<!-- gh-linked-prs -->
### Linked PRs
* gh-103618
<!-- /gh-linked-prs -->
| ffdbfe197694cb6f2509b94859ccf3534daa6fd1 | 700ec657c80e78fb299963ffaa684c859ddb8f87 |
python/cpython | python__cpython-109472 | # Behavior change for opcode trace after PEP 669
Before PEP 669, the opcode trace is togglable after trace function being set. So something like
```python
import sys
def opcode_trace_func(frame, event, arg):
print(frame, event)
return opcode_trace_func
sys.settrace(opcode_trace_func)
sys._getframe().f_trace = opcode_trace_func
sys._getframe().f_trace_opcodes = True
def f():
a = [1, 2, 3]
return a[0]
f()
```
would work.
After PEP 669, the opcode event is set on `sys.settrace()` so it's impossible to enable it after enabling the trace.
```python
sys._getframe().f_trace_opcodes = True
sys.settrace(opcode_trace_func)
sys._getframe().f_trace = opcode_trace_func
```
kind of works but it's super intuitive.
For the current implementation, if we enabled opcode before we do `sys.settrace()`, it would be "enabled" forever. Meaning the event will be always on, the callback will be always triggered, but `frame.f_trace_opcode` will be checked in the callback function. Can we always have opcode callback on? It would be a performance hit(extra call for each opcode), but that happens if we want any opcode event at all, and I think that's basically how the old tracing system does it.
Another option would be making `f_trace_opcode` a descriptor and toggle(actually, probable just enable) opcode events there.
If we don't want to do that at all and just want to break the backward-compatibility because no one is doing insturction trace anyway (I only realized this when syncing https://github.com/python/cpython/pull/103050/ to the lastest change), we should probably document it - make sure the current frame's `f_trace_opcode` is set before calling `sys.settrace()` if you want opcode events.
BTW we would've caught this if we already had the instruction level debugging :)
<!-- gh-linked-prs -->
### Linked PRs
* gh-109472
<!-- /gh-linked-prs -->
| e0afed7e276b6611a2142ec70a0440298d528305 | 2bc01cc0c72a3d91bdcce09886efa987a90396d9 |
python/cpython | python__cpython-17425 | # Cannot pause asyncio transport immediately
# Bug report
When creating a asyncio transport/protocol pair, one might want to call `transport.pause_reading()` immediately when `protocol.connection_made()` is called. This is currently not possible. The call to `pause_reading()` is ignored, and reading commences nonetheless.
This is problematic, because there is no other place where the transport can be immediately paused, especially when the protocol is created through `loop.create_server`.
As a remedy, I would suggest guarding
https://github.com/python/cpython/blob/ece20dba120a1a4745721c49f8d7389d4b1ee2a7/Lib/asyncio/selector_events.py#L931-L932
with `if not self._paused:`. There might be other places where this is needed, for other event loops.
<!-- gh-linked-prs -->
### Linked PRs
* gh-17425
* gh-103918
<!-- /gh-linked-prs -->
| 78942ecd9b1dbbd95e99cc298b0154fe126dac12 | dff8e5dc8d0758d1f9c55fdef308e44aefebe1a2 |
python/cpython | python__cpython-103628 | # Unhelpful error message from logging.config.FileConfig can be improved
# Feature or enhancement
If a configuration file does not exist, the error raised by `logging.config.fileConfig` doesn't say that the file doesn't exist, instead suggesting that the file has an invalid format. This should be improved so that the correct error message is provided.
# Pitch
The improved error message will guide a user to an error such as a typo in the filename more quickly. See for example [this question](https://stackoverflow.com/questions/76026274).
<!-- gh-linked-prs -->
### Linked PRs
* gh-103628
* gh-104687
* gh-104701
<!-- /gh-linked-prs -->
| 152227b569c3a9b87fe0483706f704762ced6d75 | c5b670efd1e6dabc94b6308734d63f762480b80f |
python/cpython | python__cpython-103600 | # [Enum] attributes of mixed-in classes can be shadowed by other members
As mentioned in #101273 , when mixing data types into an enum, the data type's methods can be lost:
```python
from enum import StrEnum, auto
class Book(StrEnum):
author = auto()
title = auto()
isbn = auto()
Book.author
# <Book.author: 'author'>
Book.author.title()
# book object not callable exception, but 'Author' is expected
```
<!-- gh-linked-prs -->
### Linked PRs
* gh-103600
<!-- /gh-linked-prs -->
| 700ec657c80e78fb299963ffaa684c859ddb8f87 | 07804ce24c3103ee1bb141af31b9a1a0f92f5e43 |
python/cpython | python__cpython-103706 | # Incorrect deduplication of Enum values in `Union[Literal[1], Literal[SomeEnum.one]]`
This was fixed on 3.9 (by https://github.com/python/cpython/pull/23294 or followups). Here's a test / example:
```python
from enum import Enum
from typing import Literal, Union, get_args
class MyEnum(int, Enum):
foo = 1
tp = Union[Literal[MyEnum.foo], Literal[1]]
assert len(get_args(tp)) == 2, get_args(tp)
tp = Union[Literal[1], Literal[MyEnum.foo]]
assert len(get_args(tp)) == 2, get_args(tp)
```
These assertions fail on 3.8 since `Union` deduplicates both `Literal`s into the same thing. The reason you need `Literal` here is because enum values are values not types so they can only appear in a Union if they're also within a Literal.
As per https://github.com/python/cpython/pull/23294#issuecomment-728659310 maybe the answer here is to not do anything. And in fact I looked into back porting and it was too big of a change to be called a back port. But I didn't see *this specific* issue w/ Enum and Union reported, so I at least wanted to report it and confirm that it is a bug.
<!-- gh-linked-prs -->
### Linked PRs
* gh-103706
* gh-103720
<!-- /gh-linked-prs -->
| 5041c2ba6e9c992d1c54834481c9be64581c0235 | 777bdff0ec4c21176ddf61e07bc75d170bc65d54 |
python/cpython | python__cpython-103665 | # [ExceptionGroup] Inconsistent raise inside except*
<!--
If you're new to Python and you're not sure whether what you're experiencing is a bug, the CPython issue tracker is not
the right place to seek help. Consider the following options instead:
- reading the Python tutorial: https://docs.python.org/3/tutorial/
- posting in the "Users" category on discuss.python.org: https://discuss.python.org/c/users/7
- emailing the Python-list mailing list: https://mail.python.org/mailman/listinfo/python-list
- searching our issue tracker (https://github.com/python/cpython/issues) to see if
your problem has already been reported
-->
# Bug report
When raising inside except* block and the caught exception wasn't an ExceptionGroup originally, then raised exception doesn't get wrapped in ExceptionGroup:
```py
try:
try:
raise TypeError(1) # prints ValueError(3)
raise ExceptionGroup('', [TypeError(2)]) # prints ExceptionGroup('', [ValueError(3)])
except* TypeError:
raise ValueError(3)
except BaseException as e:
print(repr(e))
```
# Your environment
<!-- Include as many relevant details as possible about the environment you experienced the bug in -->
- CPython versions tested on: 3.11.3
- Operating system and architecture: Windows 11 / Ubuntu 22.04
<!--
You can freely edit this text. Remove any lines you believe are unnecessary.
-->
<!-- gh-linked-prs -->
### Linked PRs
* gh-103665
* gh-104094
* gh-104095
<!-- /gh-linked-prs -->
| 63842bd90793c693f56bd8aad710b5267d41cf6d | 78942ecd9b1dbbd95e99cc298b0154fe126dac12 |
python/cpython | python__cpython-103540 | # Isolate _multibytecodec
<!-- gh-linked-prs -->
### Linked PRs
* gh-103540
* gh-103588
* gh-103589
* gh-103868
* gh-103869
* gh-103870
<!-- /gh-linked-prs -->
| 217911ede5d52b02b2e3c9222439e1ea08545291 | ff3303e49c13495d8d9cf1dc0cf0624bbda1d3ae |
python/cpython | python__cpython-103586 | # Dangling references to argparse.REMAINDER
# Documentation
In #61252, `argparse.REMAINDER` was removed from [the nargs documentation](https://docs.python.org/3.12/library/argparse.html#nargs) but there are still two references to the feature, one in [the table at the top](https://docs.python.org/3.12/library/argparse.html#quick-links-for-add-argument) and one in [the intermixed parsing section](https://docs.python.org/3.12/library/argparse.html#intermixed-parsing). I think they should also be removed to fully un-document the feature.
This also confused [some Reddit users](https://www.reddit.com/r/learnpython/comments/trhpow/undocumented_features_eg_argparseremainder/).
<!-- gh-linked-prs -->
### Linked PRs
* gh-103586
* gh-103620
<!-- /gh-linked-prs -->
| f4d087964e3deaabc902a155efdf0e7f43f78d52 | e989e0b62aba9b487faf24d8694d28022d35a776 |
python/cpython | python__cpython-103581 | # python -m pdb <utf-8 encoding file.py> return UnicodeDecodeError on Windows 8.1/10 (code page 936)
how to replicate the issue
Python 3.11.3/3.11.2/3.11.1/3.11.0 (python-3.11.3-amd64.exe etc)
Microsoft Windows [Version 10.0.19044.2130] (Active code page: 936)
tmp.py
```py
#coding:utf-8
print("中文")
```
python -m pdb tmp.py
```pytb
Traceback (most recent call last):
File "C:\Users\xond\AppData\Local\Programs\Python\Python311\Lib\pdb.py", line 1774, in main
pdb._run(target)
File "C:\Users\xond\AppData\Local\Programs\Python\Python311\Lib\pdb.py", line 1652, in _run
self.run(target.code)
^^^^^^^^^^^
File "C:\Users\xond\AppData\Local\Programs\Python\Python311\Lib\pdb.py", line 167, in code
return f"exec(compile({fp.read()!r}, {self!r}, 'exec'))"
^^^^^^^^^
UnicodeDecodeError: 'gbk' codec can't decode byte 0xae in position 28: illegal multibyte sequence
Uncaught exception. Entering post mortem debugging
Running 'cont' or 'step' will restart the program
> c:\users\xond\appdata\local\programs\python\python311\lib\pdb.py(167)code()
-> return f"exec(compile({fp.read()!r}, {self!r}, 'exec'))"
```
<!-- gh-linked-prs -->
### Linked PRs
* gh-103581
* gh-103867
<!-- /gh-linked-prs -->
| 31acfd78a0810f84898d36a8289e407d3754b823 | c9864121cba5e5366d8e023fa14be0eac504cc06 |
python/cpython | python__cpython-103560 | # Upgrade the bundled version of pip to 23.1.1
# Feature or enhancement
This is the latest pip release.
# Pitch
This ensures that users who install newest release of Python get the newest version of pip.
<!-- gh-linked-prs -->
### Linked PRs
* gh-103560
* gh-103752
<!-- /gh-linked-prs -->
| b2862950dc05d313b228f02a8efdd8c9c59a8ff4 | 6b58d419a1bd62ac94274d108d59980a3eb6f6e0 |
python/cpython | python__cpython-103570 | # Improve coverage of `argparse` module
Since none of currently active core-devs have deep expertise in `argparse`, but we still need to fix bugs in this module. The best way to start is to add more tests and increase the coverage of this module.
Right now it has a pretty solid coverage of 97%
<img width="676" alt="Снимок экрана 2023-04-15 в 13 15 01" src="https://user-images.githubusercontent.com/4660275/232207868-1590d9e0-e629-454c-9cf4-72a747a79590.png">
You can get this yourself:
```bash
# compile python, create and activate venv, then:
./python.exe -m pip install coverage
coverage run --pylib --branch --source=argparse -m test -v test_argparse
coverage html
```
Here's the initial (current) state report. [argparse_coverage.tar.gz](https://github.com/python/cpython/files/11239091/argparse_coverage.tar.gz)
Any help is welcome :)
<!-- gh-linked-prs -->
### Linked PRs
* gh-103570
<!-- /gh-linked-prs -->
| 9efaff5fd31a55e3beaa1fa430058de36a145566 | 418befd75d4d0d1cba83d8b81e1a7bcc9a65be8e |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.