summaryrefslogtreecommitdiffstats
path: root/Modules/_testcapi
Commit message (Collapse)AuthorAgeFilesLines
* gh-91053: Add an optional callback that is invoked whenever a function is ↵mpage2022-11-221-0/+237
| | | | modified (#98175)
* gh-99537: Use Py_SETREF() function in longobject C code (#99655)Victor Stinner2022-11-221-8/+4
| | | | Replace "Py_DECREF(var); var = new;" with "Py_SETREF(var, new);" in longobject.c and _testcapi/long.c.
* gh-47146: Soft-deprecate structmember.h, expose its contents via Python.h ↵Petr Viktorin2022-11-222-0/+218
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (GH-99014) The ``structmember.h`` header is deprecated, though it continues to be available and there are no plans to remove it. There are no deprecation warnings. Old code can stay unchanged (unless the extra include and non-namespaced macros bother you greatly). Specifically, no uses in CPython are updated -- that would just be unnecessary churn. The ``structmember.h`` header is deprecated, though it continues to be available and there are no plans to remove it. Its contents are now available just by including ``Python.h``, with a ``Py`` prefix added if it was missing: - `PyMemberDef`, `PyMember_GetOne` and`PyMember_SetOne` - Type macros like `Py_T_INT`, `Py_T_DOUBLE`, etc. (previously ``T_INT``, ``T_DOUBLE``, etc.) - The flags `Py_READONLY` (previously ``READONLY``) and `Py_AUDIT_READ` (previously all uppercase) Several items are not exposed from ``Python.h``: - `T_OBJECT` (use `Py_T_OBJECT_EX`) - `T_NONE` (previously undocumented, and pretty quirky) - The macro ``WRITE_RESTRICTED`` which does nothing. - The macros ``RESTRICTED`` and ``READ_RESTRICTED``, equivalents of `Py_AUDIT_READ`. - In some configurations, ``<stddef.h>`` is not included from ``Python.h``. It should be included manually when using ``offsetof()``. The deprecated header continues to provide its original contents under the original names. Your old code can stay unchanged, unless the extra include and non-namespaced macros bother you greatly. There is discussion on the issue to rename `T_PYSSIZET` to `PY_T_SSIZE` or similar. I chose not to do that -- users will probably copy/paste that with any spelling, and not renaming it makes migration docs simpler. Co-Authored-By: Alexander Belopolsky <abalkin@users.noreply.github.com> Co-Authored-By: Matthias Braun <MatzeB@users.noreply.github.com>
* gh-93649: Split float/long tests from _testcapimodule.c (GH-99549)Erlend E. Aasland2022-11-174-0/+867
| | | Automerge-Triggered-By: GH:erlend-aasland
* gh-93649: Split watcher API tests from _testcapimodule.c (#99532)Erlend E. Aasland2022-11-162-0/+303
|
* gh-93649: Split memory and docstring tests from _testcapimodule.c (#99517)Erlend E. Aasland2022-11-163-0/+752
|
* gh-99300: Replace Py_INCREF() with Py_NewRef() (#99513)Victor Stinner2022-11-161-4/+2
| | | | Replace Py_INCREF() and Py_XINCREF() using a cast with Py_NewRef() and Py_XNewRef().
* gh-93649: Split pytime and datetime tests from _testcapimodule.c (#99494)Erlend E. Aasland2022-11-153-0/+729
|
* gh-93649: Split getargs tests from _testcapimodule.c (#99346)Erlend E. Aasland2022-11-142-0/+921
|
* gh-99300: Use Py_NewRef() in Modules/ directory (#99440)Victor Stinner2022-11-131-6/+3
| | | | Replace Py_INCREF() and Py_XINCREF() with Py_NewRef() and Py_XNewRef() in test C files of the Modules/ directory.
* gh-98586: Add vector call APIs to the Limited API (GH-98587)Wenzel Jakob2022-10-271-4/+101
| | | Expose the facilities for making vector calls through Python's limited API.
* gh-94808: Cover `PyUnicode_Count` in CAPI (#96929)Nikita Sobolev2022-10-061-0/+21
|
* GH-91049: Introduce set vectorcall field API for PyFunctionObject (GH-92257)adphrost2022-09-151-0/+19
| | | | Co-authored-by: Andrew Frost <adfrost@fb.com> Co-authored-by: Itamar Ostricher <itamarost@gmail.com>
* gh-95991: Add some infrastructure for testing Limited API in _testcapi ↵Petr Viktorin2022-08-172-16/+33
| | | | | | | | | | | | | (GH-95992) - Limited API needs to be enabled per source file - Some builds don't support Limited API, so Limited API tests must be skipped on those builds (currently this is `Py_TRACE_REFS`, but that may change.) - `Py_LIMITED_API` must be defined before `<Python.h>` is included. This puts the hoop-jumping in `testcapi/parts.h`, so individual test files can be relatively simple. (Currently that's only `vectorcall_limited.c`, imagine more.)
* GH-95245: Move weakreflist into the pre-header. (GH-95996)Mark Shannon2022-08-161-0/+32
|
* gh-95707: Fix function signature (GH-95995)Christian Heimes2022-08-151-1/+2
|
* GH-95707: Fix uses of `Py_TPFLAGS_MANAGED_DICT` (GH-95854)Mark Shannon2022-08-151-0/+45
| | | | | | * Make sure that tp_dictoffset is correct with Py_TPFLAGS_MANAGED_DICT is set. * Avoid traversing managed dict twice when subclassing class with Py_TPFLAGS_MANAGED_DICT set.
* gh-90928: Statically Initialize the Keywords Tuple in Clinic-Generated Code ↵Eric Snow2022-08-111-1/+7
| | | | | | | | | | | | | | | | (gh-95860) We only statically initialize for core code and builtin modules. Extension modules still create the tuple at runtime. We'll solve that part of interpreter isolation separately. This change includes generated code. The non-generated changes are in: * Tools/clinic/clinic.py * Python/getargs.c * Include/cpython/modsupport.h * Makefile.pre.in (re-generate global strings after running clinic) * very minor tweaks to Modules/_codecsmodule.c and Python/Python-tokenize.c All other changes are generated code (clinic, global strings).
* gh-95504: Fix negative numbers in PyUnicode_FromFormat (GH-95848)Petr Viktorin2022-08-101-0/+60
| | | Co-authored-by: philg314 <110174000+philg314@users.noreply.github.com>
* gh-93649: Undefine NDEBUG in Modules/_testcapi/* to enable assert() (GH-95793)Petr Viktorin2022-08-101-0/+3
|
* gh-93649: Split unicode tests from _testcapimodule.c & add some more (GH-95819)Petr Viktorin2022-08-102-0/+654
| | | | | | - Move PyUnicode tests to a separate file - Add some more tests for PyUnicode_FromFormat Co-authored-by: philg314 <110174000+philg314@users.noreply.github.com>
* Disable Limited API tests with Py_TRACE_REFS (GH-95796)Petr Viktorin2022-08-091-0/+15
|
* gh-93274: Expose receiving vectorcall in the Limited API (GH-95717)Petr Viktorin2022-08-082-0/+78
|
* Fix downcast compiler warning in Modules/_testcapi/vectorcall.c (#95729)Erlend E. Aasland2022-08-081-1/+1
|
* gh-93274: Make vectorcall safe on mutable classes & inherit it by default ↵Petr Viktorin2022-08-042-1/+228
| | | | (#95437)
* gh-95388: Deprecate creating immutable types with mutable bases (GH-95533)Petr Viktorin2022-08-041-0/+16
|
* GH-92678: Fix tp_dictoffset inheritance. (GH-95596)Mark Shannon2022-08-031-0/+28
| | | | | | * Add test for inheriting explicit __dict__ and weakref. * Restore 3.10 behavior for multiple inheritance of C extension classes that store their dictionary at the end of the struct.
* gh-93649: Split heaptype tests from _testcapimodule.c (GH-95386)Petr Viktorin2022-08-012-0/+974
| | | | | This removes the unused negative_dictoffset function: the type this function would create is available as _testcapi.HeapCTypeWithNegativeDict
* gh-93649: Fix linkage of _PyTestCapi_Init_Vectorcall (#94702)Oleg Iarygin2022-07-131-1/+1
|
* gh-93649: Split vectorcall testing from _testcapimodule.c (GH-94549)Petr Viktorin2022-07-083-0/+276
The `_testcapimodule.c` file is getting too large to work with effectively. This PR lays out a general structure of how tests can be split up, with more splitting to come later if the structure is OK. Vectorcall tests aren't the biggest issue -- it's just an area I want to work on next, so I'm starting here. An issue specific to vectorcall tests is that it wasn't clear that e.g. `MethodDescriptor2` is related to testing vectorcall: the `/* Test PEP 590 */` section had an ambiguous end. Separate file should make things like this much clearer. OTOH, for some pieces it might not be clear where they should be -- I left `meth_fastcall` with tests of the other calling conventions. IMO, even with the ambiguity it's still worth it to split the huge file up. I'm not sure about the buildsystem changes, hopefully CI will tell me what's wrong. @vstinner, @markshannon: Do you think this is a good idea? Automerge-Triggered-By: GH:encukou