If use a non-builtin codec, partially implemented in Python
(e.g. ISO-8859-15), a new RecursionError (with empty error message)
can be raised while handle a RecursionError.
Testing for error message was needed to distinguish
a recursion error from arbitrary RuntimeError. After introducing
RecursionError, it became unnecessary.
(cherry picked from commit a568585069)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* gh-91888: Add a :gh: role to the documentation (GH-91889).
* [3.10] gh-91888: add a `:gh:` role to the documentation (GH-91889)
* Add a new :gh:`...` role for GitHub issues.
* Fix a GitHub id to use the :gh: role.
* Add Misc/NEWS entry.
* Refactoring and rephrasing.
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>.
(cherry picked from commit f7641a2ffe)
Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
It always failed on non-UTF-8 locale and prevented running regrtests.
(cherry picked from commit 54d068adfb)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* Update Sphinx bpo role to use redirect URI. (GH-32342)
* [3.10] Update Sphinx bpo role to use redirect URI. (GH-32342).
(cherry picked from commit 08cfe07950)
Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
* Fix whitespace.
In expression (?(group)...) an appropriate re.error is now
raised if the group number refers to not defined group.
Previously it raised RuntimeError: invalid SRE code.
(cherry picked from commit 48ec61a89a)
Shutting down a multiprocessing BaseManager now waits for 1 second until
the process completes, rather than 0.1 second, after the process is
terminated.
For things like test_asyncio.test_thread this was causing frequent
"environment modified by test" errors as the executor threads had not
always stopped running after the test was over.
- Drop 'nonstandard'; it does not add any value
- Try to be more concise
- Make return value a little more explicit
(cherry picked from commit 017f07a229)
Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>
* Fix test_concurrent_futures to actually test what it says.
Many ProcessPoolExecutor based tests were ignoring the mp_context
and using the default instead. This meant we lacked proper test
coverage of all of them.
Also removes the old _prime_executor() worker delay seeding code
as it appears to have no point and causes 20-30 seconds extra
latency on this already long test. It also interfered with some
of the refactoring to fix the above to not needlessly create their
own executor when setUp has already created an appropriate one.
* Don't import the name from multiprocessing directly to avoid confusion.
(cherry picked from commit 7fa3a5a219)
Co-authored-by: Gregory P. Smith <greg@krypto.org>
* fix the comparison of character and integer by using ord()
* 📜🤖 Added by blurb_it.
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
(cherry picked from commit 9300b6d729)
Co-authored-by: Yu Liu <yuki.liu@utexas.edu>
* revise the first paragraph of docs for os.path
* add a mention of `os.PathLike` protocol
* remove warnings rendered irrelevant by :pep:`383` and :pep:`529`
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
(cherry picked from commit 468314cc8b)
Co-authored-by: Jack DeVries <jdevries3133@gmail.com>
* add a paragraph to document this kwarg in detail
* update docstring in the source accordingly
(cherry picked from commit f33e2c87a8)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
The left-hand side expression of the if-check can be converted to a
constant by the compiler, but the addition on the right-hand side is
performed during runtime.
Move the addition from the right-hand side to the left-hand side by
turning it into a subtraction there. Since the values are known to
be large enough to not turn negative, this is a safe operation.
Prevents a very unlikely integer overflow on 32 bit systems.
Fixes GH-91421.
(cherry picked from commit 0859368335)
Co-authored-by: Tobias Stoeckmann <stoeckmann@users.noreply.github.com>
_Py_closerange() currently assumes that close_range() closes
all file descriptors even if it returns an error (other than ENOSYS).
This assumption can be wrong on Linux if a seccomp sandbox denies
the underlying syscall, pretending that it returns EPERM or EACCES.
In this case _Py_closerange() won't close any descriptors at all,
which in the worst case can be a security issue.
Fix this by falling back to other methods in case of any close_range()
error. Note that fallbacks will not be triggered on any problems with
closing individual file descriptors because close_range() is documented
to ignore such errors on both Linux[1] and FreeBSD[2].
[1] https://man7.org/linux/man-pages/man2/close_range.2.html
[2] https://www.freebsd.org/cgi/man.cgi?query=close_range&sektion=2
(cherry picked from commit 1c8b3b5d66)
Co-authored-by: Alexey Izbyshev <izbyshev@ispras.ru>