mirror of
https://github.com/python/cpython.git
synced 2025-11-01 10:45:30 +00:00
gh-91247: Use memcpy for list and tuple repeat (#91482)
* Add _Py_memory_repeat function to pycore_list * Add _Py_RefcntAdd function to pycore_object * Use the new functions in tuplerepeat, list_repeat, and list_inplace_repeat
This commit is contained in:
parent
27055d766a
commit
2ef73be891
5 changed files with 73 additions and 65 deletions
|
|
@ -37,6 +37,16 @@ PyAPI_FUNC(void) _Py_NO_RETURN _Py_FatalRefcountErrorFunc(
|
|||
#define _Py_FatalRefcountError(message) \
|
||||
_Py_FatalRefcountErrorFunc(__func__, (message))
|
||||
|
||||
// Increment reference count by n
|
||||
static inline void _Py_RefcntAdd(PyObject* op, Py_ssize_t n)
|
||||
{
|
||||
#ifdef Py_REF_DEBUG
|
||||
_Py_RefTotal += n;
|
||||
#endif
|
||||
op->ob_refcnt += n;
|
||||
}
|
||||
#define _Py_RefcntAdd(op, n) _Py_RefcntAdd(_PyObject_CAST(op), n)
|
||||
|
||||
static inline void
|
||||
_Py_DECREF_SPECIALIZED(PyObject *op, const destructor destruct)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue