summaryrefslogtreecommitdiffstats
path: root/Include/cpython/listobject.h
Commit message (Collapse)AuthorAgeFilesLines
* gh-106320: Remove private _PyList functions (#108451)Victor Stinner2023-08-241-3/+0
| | | | | | | | Move private functions to the internal C API (pycore_list.h): * _PyList_Extend() * _PyList_DebugMallocStats() No longer export these functions.
* gh-106168: PyTuple_SET_ITEM() now checks the index (#106164)Victor Stinner2023-06-281-0/+2
| | | | | | | | | | | | | PyTuple_SET_ITEM() and PyList_SET_ITEM() now check the index argument with an assertion if Python is built in debug mode or is built with assertions. * list_extend() and _PyList_AppendTakeRef() now set the list size before calling PyList_SET_ITEM(). * PyStructSequence_GetItem() and PyStructSequence_SetItem() now check the index argument: must be lesser than REAL_SIZE(op). * PyStructSequence_GET_ITEM() and PyStructSequence_SET_ITEM() are now aliases to PyStructSequence_GetItem() and PyStructSequence_SetItem().
* gh-87347: Add parenthesis around macro arguments (#93915)Victor Stinner2022-06-201-2/+2
| | | Add unit test on Py_MEMBER_SIZE() and some other macros.
* gh-89653: PEP 670: Macros always cast arguments in cpython/ (#93766)Victor Stinner2022-06-131-5/+1
| | | | Header files in the Include/cpython/ are only included if the Py_LIMITED_API macro is not defined.
* gh-89653: PEP 670: Use PyObject* type for parameters (#92694)Victor Stinner2022-05-111-6/+8
| | | | | | | | | Use the PyObject* type for parameters of static inline functions: * Py_SIZE(): same parameter type than PyObject_Size() * PyList_GET_SIZE(), PyList_SET_ITEM(): same parameter type than PyList_Size() and PyList_SetItem() * PyTuple_GET_SIZE(), PyTuple_SET_ITEM(): same parameter type than PyTuple_Size() and PyTuple_SetItem().
* gh-89653: PEP 670: Limited API doesn't cast arguments (#92654)Victor Stinner2022-05-111-1/+5
| | | | | | | | The limited API version 3.11 no longer casts arguments to expected types of functions of functions: * PyList_GET_SIZE(), PyList_SET_ITEM() * PyTuple_GET_SIZE(), PyTuple_SET_ITEM() * PyWeakref_GET_OBJECT()
* gh-92135: Rename _Py_reinterpret_cast() to _Py_CAST() (#92230)Victor Stinner2022-05-031-1/+1
| | | Rename also _Py_static_cast() to _Py_STATIC_CAST().
* gh-91320: Add _Py_reinterpret_cast() macro (#91959)Victor Stinner2022-04-271-1/+2
| | | | | | | | | | | | | | Fix C++ compiler warnings about "old-style cast" (g++ -Wold-style-cast) in the Python C API. Use C++ reinterpret_cast<> and static_cast<> casts when the Python C API is used in C++. Example of fixed warning: Include/object.h:107:43: error: use of old-style cast to ‘PyObject*’ {aka ‘struct _object*’} [-Werror=old-style-cast] #define _PyObject_CAST(op) ((PyObject*)(op)) Add _Py_reinterpret_cast() and _Py_static_cast() macros.
* gh-89653: PEP 670: Convert tuple macros to functions (#91786)Victor Stinner2022-04-211-5/+15
| | | | | | | | | | | | | | Convert macros to static inline functions: * PyTuple_GET_SIZE() * PyTuple_SET_ITEM() * PyList_GET_SIZE() * PyList_SET_ITEM() Add a macro converting arguments to PyTupleObject*, PyListObject* or PyObject* to prevent emitting new compiler warnings. According to PEP 670, PyTuple_GET_ITEM() and PyList_GET_ITEM() are left as macros.
* bpo-45476: Add _Py_RVALUE() macro (GH-29860)Victor Stinner2021-11-301-1/+1
| | | | | | | | | | | | | | | | | | Add a new _Py_RVALUE() macro to prevent using an expression as an l-value. Replace a "(void)" cast with the _Py_RVALUE() macro in the following macros: * PyCell_SET() * PyList_SET_ITEM() * PyTuple_SET_ITEM() * _PyGCHead_SET_FINALIZED() * _PyGCHead_SET_NEXT() * asdl_seq_SET() * asdl_seq_SET_UNTYPED() Add also parentheses around macro arguments in PyCell_SET() and PyTuple_SET_ITEM() macros.
* bpo-30459: Cast the result of PyList_SET_ITEM() to void (GH-19975)Zackery Spytz2020-12-051-1/+1
| | | Do the same for PyTuple_SET_ITEM().
* Fix typo in listobject.h (GH-22588)chilaxan2020-10-111-1/+1
|
* bpo-41078: Add pycore_list.h internal header file (GH-21057)Victor Stinner2020-06-221-1/+0
| | | | | * Move _PyList_ITEMS() to pycore_list.h. * The C extension "_heapq" is now built with Py_BUILD_CORE_MODULE macro defined to access the internal C API.
* bpo-39583: Remove superfluous "extern C" bits from Include/cpython/*.h ↵Skip Montanaro2020-06-011-8/+0
| | | | (GH-18413)
* bpo-40428: Remove PyTuple_ClearFreeList() function (GH-19769)Victor Stinner2020-04-291-1/+0
| | | | | | | | | | | | | | | | | | | Remove the following function from the C API: * PyAsyncGen_ClearFreeLists() * PyContext_ClearFreeList() * PyDict_ClearFreeList() * PyFloat_ClearFreeList() * PyFrame_ClearFreeList() * PyList_ClearFreeList() * PySet_ClearFreeList() * PyTuple_ClearFreeList() Make these functions private, move them to the internal C API and change their return type to void. Call explicitly PyGC_Collect() to free all free lists. Note: PySet_ClearFreeList() did nothing.
* bpo-35134: Create Include/cpython/listobject.h (GH-18395)Victor Stinner2020-02-071-0/+44
Move listobject.h code surrounded by "#ifndef Py_LIMITED_API" to a new Include/cpython/listobject.h header file. Add cpython/ header files to Makefile.pre.in and pythoncore project of PCbuild. Add _PyList_CAST() macro.