In _PySys_AddXOptionWithError() and sys_add_xoption(),
bail on first error to prevent exceptions from possibly being
overwritten.
(cherry picked from commit 41cddc2e93)
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Prevent repeated PyLong_FromVoidPtr() from possibly overwriting the
current exception.
(cherry picked from commit e8998e46a7)
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Bail on first error to prevent exceptions from possibly being overwritten.
(cherry picked from commit 555be81026)
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Bail on first error to prevent exceptions from possibly being
overwritten.
(cherry picked from commit 567d6ae8e7)
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Fix a bug where an IndexError could end up being overwritten.
(cherry picked from commit f668f73bc8)
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Fix a bug where an exception could end up being overwritten.
(cherry picked from commit c932f72849)
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Improve error handling so init bails on the first exception.
(cherry picked from commit 16d49680b5)
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Fix a bug where 'tp_richcompare' could end up overwriting an exception.
(cherry picked from commit 35cff545db)
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Cleanup and clarify our hashlib docs. (GH-105624)
Clarify and improve our hashlib docs. Now with 50% less mess!
(cherry picked from commit 0d1d6ab966)
Co-authored-by: Gregory P. Smith <greg@krypto.org>
Fix bugs where exceptions could end up being overwritten
because of deferred error handling.
(cherry picked from commit 33c92c4f15)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Bail on first error in heapctypesubclasswithfinalizer_finalize()
(cherry picked from commit d636d7dfe7)
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Fix bugs where exceptions could end up being overwritten.
(cherry picked from commit 00b599ab5a)
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
test_func_return_too_large_int() was defined twice.
Keep only the redefined method, as that also checks the tracebacks.
(cherry picked from commit b8fa7bda4f)
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Miscellaneous improvements to the typing docs (GH-105529)
Mostly, these are changes so that we use shorter sentences and shorter paragraphs. In particular, I've tried to make the first sentence introducing each object in the typing API short and declarative.
(cherry picked from commit 8e755923c9)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
* gh-102304: Fix Py_INCREF() for limited C API 3.9 (#105550)
When Python is built in debug mode (Py_REF_DEBUG macro), Py_INCREF()
and Py_DECREF() of the limited C API 3.9 (and older) now call
Py_IncRef() and Py_DecRef(), since _Py_IncRef() and _Py_DecRef() were
added to Python 3.10.
(cherry picked from commit 7ba0fd9f87)
* gh-102304: Remove Py_INCREF() doc change (#105552)
Py_INCREF() was made compatible again with Python 3.9 and older in
the limited API of Python debug mode.
(cherry picked from commit 58e4b69f69)
The risk of a race with this state is relatively low, but we play it safe anyway. We do avoid using the lock in performance-sensitive cases where the risk of a race is very, very low.
(cherry picked from commit 68dfa49627)
Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
gh-102832: IDLE - update stackviewer open (GH-105528)
Use 'last_exc' instead of 'last_value' in 3.12/3.
(cherry picked from commit bb3454c1a7)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
gh-102832: IDLE - remove use of deprecated sys.last_xyzs for stackviewer (GH-103339)
(cherry picked from commit 3ee921d84f)
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
The risk of a race with this state is relatively low, but we play it safe anyway.
(cherry picked from commit 7799c8e678)
Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
The original name wasn't as clear as it could have been. This change includes the following:
* rename the function
* change the default value for "disable_check" to False
* add clues to the docstring that folks should probably not use the function
---------
(cherry picked from commit 34c63b86d3)
Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
Forward-port of the tests that were added to the 3.11 branch in GH-105445
(cherry picked from commit f5df347fcf)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
gh-90015: Document that PEP-604 unions do not support forward references (GH-105366)
(cherry picked from commit fbdee000de)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
typing: Improve documentation of generic classes and aliases (GH-105369)
(cherry picked from commit d63a7c3694)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
gh-97797: Improve documentation for typing.Annotated (GH-105365)
(cherry picked from commit e26d296984)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Check for error after each call to PyUnicode_FromStringAndSize().
(cherry picked from commit a24a780d93)
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>