mirror of
https://github.com/python/cpython.git
synced 2026-06-10 03:42:08 +00:00
gh-100239: expose sq_repeat helpers for BINARY_OP_EXTEND (#148791)
This commit is contained in:
parent
52a05e8da7
commit
d2d24e46d3
9 changed files with 46 additions and 74 deletions
|
|
@ -8,7 +8,7 @@
|
|||
#endif
|
||||
|
||||
#include "Python.h"
|
||||
#include "pycore_bytesobject.h" // _PyBytes_Repeat
|
||||
#include "pycore_bytesobject.h" // _PyBytes_RepeatBuffer
|
||||
#include "pycore_call.h" // _PyObject_CallMethod()
|
||||
#include "pycore_ceval.h" // _PyEval_GetBuiltin()
|
||||
#include "pycore_floatobject.h" // _PY_FLOAT_BIG_ENDIAN
|
||||
|
|
@ -1147,7 +1147,7 @@ array_repeat(PyObject *op, Py_ssize_t n)
|
|||
|
||||
const Py_ssize_t oldbytes = array_length * a->ob_descr->itemsize;
|
||||
const Py_ssize_t newbytes = oldbytes * n;
|
||||
_PyBytes_Repeat(np->ob_item, newbytes, a->ob_item, oldbytes);
|
||||
_PyBytes_RepeatBuffer(np->ob_item, newbytes, a->ob_item, oldbytes);
|
||||
|
||||
return (PyObject *)np;
|
||||
}
|
||||
|
|
@ -1304,7 +1304,7 @@ array_inplace_repeat(PyObject *op, Py_ssize_t n)
|
|||
if (array_resize(self, n * array_size) == -1)
|
||||
return NULL;
|
||||
|
||||
_PyBytes_Repeat(self->ob_item, n*size, self->ob_item, size);
|
||||
_PyBytes_RepeatBuffer(self->ob_item, n*size, self->ob_item, size);
|
||||
}
|
||||
return Py_NewRef(self);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue