cpython/Modules/_testcapi
Miss Islington (bot) 25b48b84b8
[3.14] gh-143050: Correct PyLong_FromString() to use _PyLong_Negate() (GH-145901) (#147331)
gh-143050: Correct PyLong_FromString() to use _PyLong_Negate() (GH-145901)

The long_from_string_base() might return a small integer, when the
_pylong.py is used to do conversion.  Hence, we must be careful here to
not smash it "small int" bit by using the _PyLong_FlipSign().
(cherry picked from commit db5936c5b8)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2026-03-31 16:14:12 +02:00
..
clinic
abstract.c
buffer.c
bytes.c
code.c
codec.c
complex.c
config.c
datetime.c
dict.c
docstring.c
exceptions.c
file.c
float.c
frame.c
function.c
gc.c
getargs.c
hash.c
heaptype.c [3.14] gh-129849: Add tests for Py_tp_bases (GH-143208) (#146225) 2026-03-21 15:22:58 +05:30
immortal.c [3.14] gh-143050: Correct PyLong_FromString() to use _PyLong_Negate() (GH-145901) (#147331) 2026-03-31 16:14:12 +02:00
import.c
list.c
long.c
mem.c
monitoring.c
numbers.c
object.c
parts.h
pyatomic.c
README.txt
run.c
set.c
structmember.c
time.c
tuple.c
type.c
unicode.c
util.h
vectorcall.c
watchers.c [3.14] gh-146615: Fix format specifiers in test cextensions (GH-146618) (GH-146649) 2026-03-31 08:31:05 +00:00

Tests in this directory are compiled into the _testcapi extension.
The main file for the extension is Modules/_testcapimodule.c, which
calls `_PyTestCapi_Init_*` from these functions.

General guideline when writing test code for C API.
* Use Argument Clinic to minimise the amount of boilerplate code.
* Add a newline between the argument spec and the docstring.
* If a test description is needed, make sure the added docstring clearly and succinctly describes purpose of the function.
* DRY, use the clone feature of Argument Clinic.
* Try to avoid adding new interned strings; reuse existing parameter names if possible. Use the `as` feature of Argument Clinic to override the C variable name, if needed.