diff options
| author | Victor Stinner <vstinner@redhat.com> | 2018-10-26 14:35:00 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-10-26 14:35:00 +0200 |
| commit | b4435e20a92af474f117b78b98ddc6f515363af5 (patch) | |
| tree | 4383bfb9ba3f9ec21a2d0cbdd726b38c5a9e1956 /Objects/bytesobject.c | |
| parent | 7cd25434164882c2093ea41ccfc7b95a05cd5cbd (diff) | |
| download | cpython-git-b4435e20a92af474f117b78b98ddc6f515363af5.tar.gz | |
bpo-35059: Convert PyObject_INIT() to function (GH-10077)
* Convert PyObject_INIT() and PyObject_INIT_VAR() macros to static
inline functions.
* Fix usage of these functions: cast to PyObject* or PyVarObject*.
Diffstat (limited to 'Objects/bytesobject.c')
| -rw-r--r-- | Objects/bytesobject.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c index c412393e6c..9a0881450c 100644 --- a/Objects/bytesobject.c +++ b/Objects/bytesobject.c @@ -85,7 +85,7 @@ _PyBytes_FromSize(Py_ssize_t size, int use_calloc) op = (PyBytesObject *)PyObject_Malloc(PyBytesObject_SIZE + size); if (op == NULL) return PyErr_NoMemory(); - (void)PyObject_INIT_VAR(op, &PyBytes_Type, size); + (void)PyObject_INIT_VAR((PyVarObject *)op, &PyBytes_Type, size); op->ob_shash = -1; if (!use_calloc) op->ob_sval[size] = '\0'; @@ -163,7 +163,7 @@ PyBytes_FromString(const char *str) op = (PyBytesObject *)PyObject_MALLOC(PyBytesObject_SIZE + size); if (op == NULL) return PyErr_NoMemory(); - (void)PyObject_INIT_VAR(op, &PyBytes_Type, size); + (void)PyObject_INIT_VAR((PyVarObject *)op, &PyBytes_Type, size); op->ob_shash = -1; memcpy(op->ob_sval, str, size+1); /* share short strings */ @@ -1508,7 +1508,7 @@ bytes_repeat(PyBytesObject *a, Py_ssize_t n) op = (PyBytesObject *)PyObject_MALLOC(PyBytesObject_SIZE + nbytes); if (op == NULL) return PyErr_NoMemory(); - (void)PyObject_INIT_VAR(op, &PyBytes_Type, size); + (void)PyObject_INIT_VAR((PyVarObject *)op, &PyBytes_Type, size); op->ob_shash = -1; op->ob_sval[size] = '\0'; if (Py_SIZE(a) == 1 && n > 0) { |
