summaryrefslogtreecommitdiffstats
path: root/Modules/_testcapimodule.c
Commit message (Collapse)AuthorAgeFilesLines
* [3.10] GH-100892: Fix race in clearing `threading.local` (GH-100922). (#100938)Kumar Aditya2023-01-111-5/+36
| | | | | (cherry picked from commit 762745a124cbc297cf2fe6f3ec9ca1840bb2e873) Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
* [3.10] gh-99240: Reset pointer to NULL when the pointed memory is freed in ↵colorfulappl2022-12-211-0/+20
| | | | | | | | argument parsing (GH-99890) (#100386) (cherry picked from commit efbb1eb9f54cad4f7bf5df03eed3a6aba02d99f4) Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com> Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
* gh-94808: cover `PyMapping_HasKeyString` and `PyMapping_HasKey` (GH-98486)Miss Islington (bot)2022-10-261-0/+36
| | | | | (cherry picked from commit 5d30544485dc56ab999ad7656ef6559306fd013f) Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
* gh-96821: Fix undefined behaviour in `_testcapimodule.c` (GH-96915) (GH-96926)Miss Islington (bot)2022-09-191-1/+3
| | | | | | | | | | * gh-96821: Assert for demonstrating undefined behaviour * Fix UB (cherry picked from commit cbdeda8ce7a3543cb3376d70e4cd46fcf24f42a7) Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM> Co-authored-by: Matthias Görgens <matthias.goergens@gmail.com>
* gh-95878: Fix format char in datetime CAPI tests (GH-95879)Miss Islington (bot)2022-08-111-4/+4
| | | | | (cherry picked from commit 8b34e914bba2ccd6ae39609410db49d0beb19cb1) Co-authored-by: Christian Heimes <christian@python.org>
* [3.10] gh-94930: skipitem() in getargs.c should return non-NULL on error ↵Miss Islington (bot)2022-07-191-2/+21
| | | | | | | | (GH-94931) (GH-94963) (cherry picked from commit 067f0da33506f70c36a67d5f3d8d011c8dae10c9) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* GH-91153: Handle mutating __index__ methods in bytearray item assignment ↵Miss Islington (bot)2022-07-191-0/+16
| | | | | | | (GH-94891) (cherry picked from commit f36589510b8708fa224d799d5b328deab558aa4e) Co-authored-by: Brandt Bucher <brandtbucher@microsoft.com>
* [3.10] gh-91118: Fix docstrings that do not honor --without-doc-strings ↵Oleg Iarygin2022-04-191-1/+1
| | | | | | | | | (GH-31769) (#91662) Co-authored-by: Éric <merwok@netwok.org> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> (cherry picked from commit a573cb2fec664c645ab744658d7e941d72e1a398) Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
* bpo-45822: Minor cleanups to the test_Py_CompileString test (GH-29750) ↵Miss Islington (bot)2021-12-111-1/+1
| | | | | | | (GH-29758) (cherry picked from commit abfc794bbf2c6a0939ddd81b6e700c46944ba87a) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
* [3.10] bpo-45822: Respect PEP 263's coding cookies in the parser even if ↵Pablo Galindo Salgado2021-11-171-0/+14
| | | | | | | flags are not provided (GH-29582) (GH-29586) (cherry picked from commit da20d7401de97b425897d3069f71f77b039eb16f) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
* [3.10] Fix typos in the Modules directory (GH-28761) (GH-28781)Miss Islington (bot)2021-10-071-2/+2
| | | | | | | | (cherry picked from commit dd02a696e55b450413e765e698e653d781ca4205) Co-authored-by: Christian Clauss <cclauss@me.com> Automerge-Triggered-By: GH:gpshead
* bpo-44984: Rewrite test_null_strings in _testcapi (GH-27904)Miss Islington (bot)2021-08-231-8/+16
| | | | | | Test also PyObject_Repr(NULL) and PyObject_Bytes(NULL). (cherry picked from commit 4d689173861257c69adc6dc1dca4171946ddb57f) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-44363: Get test_capi passing with address sanitizer (GH-26639)Miss Islington (bot)2021-06-101-0/+5
| | | | | (cherry picked from commit 31aa0dbff4c1d39c9d77c6c8f4a61d0e46c1268b) Co-authored-by: Mark Shannon <mark@hotpy.org>
* bpo-44263: Fix _decimal and _testcapi GC protocol (GH-26464) (GH-26465)Miss Islington (bot)2021-05-311-0/+8
| | | | | | | | | | | * _testcapi.heapgctype: implement a traverse function since the type is defined with Py_TPFLAGS_HAVE_GC. * _decimal: PyDecSignalDictMixin_Type is no longer defined with Py_TPFLAGS_HAVE_GC since it has no traverse function. (cherry picked from commit 142e5c5445c019542246d93fe2f9e195d3131686) Co-authored-by: Victor Stinner <vstinner@python.org> Co-authored-by: Victor Stinner <vstinner@python.org>
* bpo-40943: Fix skipitem() didn't raise SystemError (GH-25937)Miss Islington (bot)2021-05-071-3/+20
| | | | | | | `convertitem()` raises `SystemError` when 'GH-' is used without `PY_SSIZE_T_CLEAN`. This commit makes `skipitem()` raise it too. (cherry picked from commit 4ebf4a6bfad4afcbab3baf9c0159c7767e2a64c0) Co-authored-by: Inada Naoki <songofacandy@gmail.com>
* Add C-API tests (GH-25886) (#25887)Miss Islington (bot)2021-05-041-0/+21
| | | | | (cherry picked from commit 2f5baa17504feb9a7613bac32fdceed4894434de) Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
* bpo-28254: Add a C-API for controlling the GC state (GH-25687)scoder2021-04-281-0/+62
| | | | | | | | Add new C-API functions to control the state of the garbage collector: PyGC_Enable(), PyGC_Disable(), PyGC_IsEnabled(), corresponding to the functions in the gc module. Co-authored-by: Pablo Galindo <Pablogsal@gmail.com> Co-authored-by: Victor Stinner <vstinner@python.org>
* bpo-43753: Add Py_Is() and Py_IsNone() functions (GH-25227)Victor Stinner2021-04-101-21/+90
| | | | | | | Add the Py_Is(x, y) function to test if the 'x' object is the 'y' object, the same as "x is y" in Python. Add also the Py_IsNone(), Py_IsTrue(), Py_IsFalse() functions to test if an object is, respectively, the None singleton, the True singleton or the False singleton.
* bpo-43422: Revert _decimal C API addition (GH-24960)Antoine Pitrou2021-03-211-253/+0
| | | | | | | | | Stefan Krah requested the reversal of these (unreleased) changes, quoting him: > The capsule API does not meet my testing standards, since I've focused on the upstream mpdecimal in the last couple of months. > Additionally, I'd like to refine the API, perhaps together with the Arrow community. Automerge-Triggered-By: GH:pitrou
* bpo-42979: Enhance abstract.c assertions checking slot result (GH-24352)Victor Stinner2021-01-271-4/+15
| | | | | | | | * bpo-42979: Enhance abstract.c assertions checking slot result Add _Py_CheckSlotResult() function which fails with a fatal error if a slot function succeeded with an exception set or failed with no exception set: write the slot name, the type name and the current exception (if an exception is set).
* bpo-42923: Add Py_FatalError() test in test_capi (GH-24240)Victor Stinner2021-01-181-0/+23
| | | Move faulthandler._fatal_error() to _testcapi.fatal_error().
* bpo-42262: Py_NewRef() casts its argument to PyObject* (GH-23626)Victor Stinner2020-12-031-1/+31
| | | Write also unit tests on Py_NewRef() and Py_XNewRef().
* bpo-42519: Replace PyObject_MALLOC() with PyObject_Malloc() (GH-23587)Victor Stinner2020-12-011-5/+5
| | | | | | | | | No longer use deprecated aliases to functions: * Replace PyObject_MALLOC() with PyObject_Malloc() * Replace PyObject_REALLOC() with PyObject_Realloc() * Replace PyObject_FREE() with PyObject_Free() * Replace PyObject_Del() with PyObject_Free() * Replace PyObject_DEL() with PyObject_Free()
* bpo-42519: Replace PyMem_MALLOC() with PyMem_Malloc() (GH-23586)Victor Stinner2020-12-011-2/+2
| | | | | | | | | | | No longer use deprecated aliases to functions: * Replace PyMem_MALLOC() with PyMem_Malloc() * Replace PyMem_REALLOC() with PyMem_Realloc() * Replace PyMem_FREE() with PyMem_Free() * Replace PyMem_Del() with PyMem_Free() * Replace PyMem_DEL() with PyMem_Free() Modify also the PyMem_DEL() macro to use directly PyMem_Free().
* bpo-39573: Convert Py_TYPE() and Py_SIZE() back to macros (GH-23366)Victor Stinner2020-11-181-0/+25
| | | | | | | | | This change partically reverts commit ad3252bad905d41635bcbb4b76db30d570cf0087 and the commit fe2978b3b940fe2478335e3a2ca5ad22338cdf9c. Many third party C extension modules rely on the ability of using Py_TYPE() to set an object type: "Py_TYPE(obj) = type;" or to set an object type using: "Py_SIZE(obj) = size;".
* bpo-41073: PyType_GetSlot() can now accept static types. (GH-21931)Hai Shi2020-11-101-2/+60
| | | | | | | PyType_GetSlot() can now accept static types. Co-Authored-By: Petr Viktorin <encukou@gmail.com> Automerge-Triggered-By: GH:encukou
* bpo-42085: Introduce dedicated entry in PyAsyncMethods for sending values ↵Vladimir Matveev2020-11-101-1/+2
| | | | (#22780)
* bpo-41832: PyType_FromModuleAndSpec() now accepts NULL tp_doc (GH-23123)Hai Shi2020-11-061-0/+25
|
* bpo-41984: GC track all user classes (GH-22701)Brandt Bucher2020-10-151-0/+20
|
* bpo-41756: Add PyIter_Send function (#22443)Vladimir Matveev2020-10-101-1/+2
|
* bpo-30155: Add macros to get tzinfo from datetime instances (GH-21633)Zackery Spytz2020-09-231-2/+4
| | | | Add PyDateTime_DATE_GET_TZINFO() and PyDateTime_TIME_GET_TZINFO() macros.
* closes bpo-41689: Preserve text signature from tp_doc in C heap type ↵Benjamin Peterson2020-09-021-0/+30
| | | | creation. (GH-22058)
* bpo-41324 Add a minimal decimal capsule API (#21519)Stefan Krah2020-08-101-0/+253
|
* bpo-36346: Make using the legacy Unicode C API optional (GH-21437)Serhiy Storchaka2020-07-101-1/+15
| | | | Add compile time option USE_UNICODE_WCHAR_CACHE. Setting it to 0 makes the interpreter not using the wchar_t cache and the legacy Unicode C API.
* Uncomment Py_DEPRECATED for Py_UNICODE APIs (GH-21318)Inada Naoki2020-07-051-4/+4
| | | | | PyUnicode_EncodeDecimal and PyUnicode_TransformDecimalToASCII are deprecated since Python 3.3. But Py_DEPRECATED(3.3) was commented out.
* bpo-39960: Allow heap types in the "Carlo Verre" hack check that override ↵scoder2020-07-031-0/+80
| | | | | "tp_setattro()" (GH-21092) Automerge-Triggered-By: @gvanrossum
* bpo-35975: Only use cf_feature_version if PyCF_ONLY_AST in cf_flags (#21021)Guido van Rossum2020-06-281-1/+3
|
* bpo-41069: Make TESTFN and the CWD for tests containing non-ascii ↵Serhiy Storchaka2020-06-251-18/+18
| | | | characters. (GH-21035)
* bpo-40943: PY_SSIZE_T_CLEAN required for '#' formats (GH-20784)Victor Stinner2020-06-191-6/+13
| | | | | | | The PY_SSIZE_T_CLEAN macro must now be defined to use PyArg_ParseTuple() and Py_BuildValue() "#" formats: "es#", "et#", "s#", "u#", "y#", "z#", "U#" and "Z#". See the PEP 353. Update _testcapi.test_buildvalue_issue38913().
* bpo-36346: Add Py_DEPRECATED to deprecated unicode APIs (GH-20878)Inada Naoki2020-06-171-0/+10
| | | | Co-authored-by: Kyle Stanley <aeros167@gmail.com> Co-authored-by: Victor Stinner <vstinner@python.org>
* Fix return type of test helper function heapctypewithbuffer_releasebuffer() ↵Rémi Lapeyre2020-06-071-1/+1
| | | | (GH-20685)
* bpo-40724: Support setting buffer slots from type specs (GH-20648)scoder2020-06-061-0/+47
| | | This is not part of the limited API but makes the buffer slots available for type specs.
* bpo-39849: Enable assertions in _testcapimodule.c and _testinternalcapi.c ↵Hai Shi2020-04-201-0/+3
| | | | (GH-19623)
* bpo-40268: Remove unused structmember.h includes (GH-19530)Victor Stinner2020-04-151-1/+1
| | | | | | If only offsetof() is needed: include stddef.h instead. When structmember.h is used, add a comment explaining that PyMemberDef is used.
* bpo-40268: Remove explicit pythread.h includes (#19529)Victor Stinner2020-04-151-1/+0
| | | | Remove explicit pythread.h includes: it is always included by Python.h.
* bpo-40241: Add pycore_gc.h header file (GH-19494)Victor Stinner2020-04-131-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | Move the PyGC_Head structure and the following private macros to the internal C API: * _PyGCHead_FINALIZED() * _PyGCHead_NEXT() * _PyGCHead_PREV() * _PyGCHead_SET_FINALIZED() * _PyGCHead_SET_NEXT() * _PyGCHead_SET_PREV() * _PyGC_FINALIZED() * _PyGC_PREV_MASK * _PyGC_PREV_MASK_COLLECTING * _PyGC_PREV_MASK_FINALIZED * _PyGC_PREV_SHIFT * _PyGC_SET_FINALIZED() * _PyObject_GC_IS_TRACKED() * _PyObject_GC_MAY_BE_TRACKED() * _Py_AS_GC(o) Keep the private _PyGC_FINALIZED() macro in the public C API for backward compatibility with Python 3.8: make it an alias to the new PyObject_GC_IsFinalized() function. Move the SIZEOF_PYGC_HEAD constant from _testcapi module to _testinternalcapi module.
* bpo-40241: Add PyObject_GC_IsTracked and PyObject_GC_IsFinalized to the ↵Pablo Galindo2020-04-111-1/+1
| | | | | public C-API (GH-19461) Add the functions PyObject_GC_IsTracked and PyObject_GC_IsFinalized to the public API to allow to query if Python objects are being currently tracked or have been already finalized by the garbage collector respectively.
* Revert "bpo-39087: Add _PyUnicode_GetUTF8Buffer()" (GH-18985)Inada Naoki2020-03-141-212/+0
| | | | | | | * Revert "bpo-39087: Add _PyUnicode_GetUTF8Buffer() (GH-17659)" This reverts commit c7ad974d341d3edb6b9d2a2dcae4d3d4794ada6b. * Update unicodeobject.h
* bpo-39087: Add _PyUnicode_GetUTF8Buffer() (GH-17659)Inada Naoki2020-03-141-0/+212
| | | Co-authored-by: Victor Stinner <vstinner@python.org>
* bpo-39947: Move get_recursion_depth() to _testinternalcapi (GH-18974)Victor Stinner2020-03-131-13/+5
| | | | | Move get_recursion_depth() function from _testcapi to _testinternalcapi to avoid accessing PyThreadState attributes directly in _testcapi.