summaryrefslogtreecommitdiffstats
path: root/Modules/_testcapimodule.c
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* bpo-39877: Remove useless PyEval_InitThreads() calls (GH-18883)Victor Stinner2020-03-091-4/+0
| | | | Py_Initialize() calls PyEval_InitThreads() since Python 3.7. It's no longer needed to call it explicitly.
* bpo-38643: Raise SystemError instead of crashing when PyNumber_ToBase is ↵Serhiy Storchaka2020-03-091-0/+14
| | | | called with invalid base. (GH-18863)
* bpo-38913: Fix segfault in Py_BuildValue("(s#O)", ...) if entered with ↵Serhiy Storchaka2020-03-021-0/+43
| | | | exception raised. (GH-18656)
* bpo-39245: Switch to public API for Vectorcall (GH-18460)Petr Viktorin2020-02-111-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The bulk of this patch was generated automatically with: for name in \ PyObject_Vectorcall \ Py_TPFLAGS_HAVE_VECTORCALL \ PyObject_VectorcallMethod \ PyVectorcall_Function \ PyObject_CallOneArg \ PyObject_CallMethodNoArgs \ PyObject_CallMethodOneArg \ ; do echo $name git grep -lwz _$name | xargs -0 sed -i "s/\b_$name\b/$name/g" done old=_PyObject_FastCallDict new=PyObject_VectorcallDict git grep -lwz $old | xargs -0 sed -i "s/\b$old\b/$new/g" and then cleaned up: - Revert changes to in docs & news - Revert changes to backcompat defines in headers - Nudge misaligned comments
* bpo-39573: Add Py_SET_TYPE() function (GH-18394)Victor Stinner2020-02-071-2/+2
| | | Add Py_SET_TYPE() function to set the type of an object.
* bpo-39573: Use Py_TYPE() macro in Modules directory (GH-18393)Victor Stinner2020-02-071-2/+2
| | | Replace direct access to PyObject.ob_type with Py_TYPE().
* bpo-39573: Add Py_SET_REFCNT() function (GH-18389)Victor Stinner2020-02-071-7/+8
| | | | Add a Py_SET_REFCNT() function to set the reference counter of an object.
* bpo-39573: Use Py_REFCNT() macro (GH-18388)Victor Stinner2020-02-061-7/+9
| | | | Replace direct acccess to PyObject.ob_refcnt with usage of the Py_REFCNT() macro.
* bpo-39542: Simplify _Py_NewReference() (GH-18332)Victor Stinner2020-02-031-3/+5
| | | | | | | | | * Remove _Py_INC_REFTOTAL and _Py_DEC_REFTOTAL macros: modify directly _Py_RefTotal. * _Py_ForgetReference() is no longer defined if the Py_TRACE_REFS macro is not defined. * Remove _Py_NewReference() implementation from object.c: unify the two implementations in object.h inline function. * Fix Py_TRACE_REFS build: _Py_INC_TPALLOCS() macro has been removed.
* bpo-39489: Remove COUNT_ALLOCS special build (GH-18259)Victor Stinner2020-02-031-10/+0
| | | | | | | | | | | Remove: * COUNT_ALLOCS macro * sys.getcounts() function * SHOW_ALLOC_COUNT code in listobject.c * SHOW_TRACK_COUNT code in tupleobject.c * PyConfig.show_alloc_count field * -X showalloccount command line option * @test.support.requires_type_collecting decorator
* bpo-27961: Replace PY_LLONG_MAX, PY_LLONG_MIN and PY_ULLONG_MAX with ↵Sergey Fedoseev2019-12-051-15/+15
| | | | | standard macros (GH-15385) Use standard constants LLONG_MIN, LLONG_MAX and ULLONG_MAX.
* bpo-36854: Fix refleak in subinterpreter (GH-17331)Victor Stinner2019-11-221-2/+5
| | | | finalize_interp_clear() now explicitly clears the codec registry and then trigger a GC collection to clear all references.
* bpo-27961: Replace PY_LONG_LONG with long long. (GH-15386)Sergey Fedoseev2019-10-211-2/+2
|
* bpo-38006: Add unit test for weakref clear bug (GH-16788)Neil Schemenauer2019-10-161-0/+55
|
* bpo-36389: _PyObject_CheckConsistency() available in release mode (GH-16612)Victor Stinner2019-10-071-0/+9
| | | | | | | | | | | | | | | | | | | | | bpo-36389, bpo-38376: The _PyObject_CheckConsistency() function is now also available in release mode. For example, it can be used to debug a crash in the visit_decref() function of the GC. Modify the following functions to also work in release mode: * _PyDict_CheckConsistency() * _PyObject_CheckConsistency() * _PyType_CheckConsistency() * _PyUnicode_CheckConsistency() Other changes: * _PyMem_IsPtrFreed(ptr) now also returns 1 if ptr is NULL (equals to 0). * _PyBytesWriter_CheckConsistency() now returns 1 and is only used with assert(). * Reorder _PyObject_Dump() to write safe fields first, and only attempt to render repr() at the end.
* bpo-38321: Fix _testcapimodule.c warning (GH-16494)Victor Stinner2019-09-301-2/+2
| | | | | | | Fix the following warning: modules\_testcapimodule.c(6409): warning C4146: unary minus operator applied to unsigned type, result still unsigned
* bpo-38140: Make dict and weakref offsets opaque for C heap types (#16076)Eddie Elizondo2019-09-191-0/+118
| | | | | | * Make dict and weakref offsets opaque for C heap types * Add news
* bpo-38150 Fix refleak in the finalizer of a _testcapimodule type (GH-16115)Eddie Elizondo2019-09-131-5/+13
| | | | | | | | | | The PyLong created in the finalizer was not being cleaned up https://bugs.python.org/issue38150 Automerge-Triggered-By: @matrixise
* bpo-37879: Fix warnings in _testcapimodule (GH-16004)Petr Viktorin2019-09-121-6/+7
|