Fix merge breakage.
This commit is contained in:
parent
9f2e346911
commit
5d7428b8ce
|
@ -42,7 +42,7 @@ PyAPI_FUNC(int) PyBytes_Resize(PyObject *, Py_ssize_t);
|
|||
|
||||
/* Macros, trading safety for speed */
|
||||
#define PyBytes_AS_STRING(self) (assert(PyBytes_Check(self)),((PyBytesObject *)(self))->ob_bytes)
|
||||
#define PyBytes_GET_SIZE(self) (assert(PyBytes_Check(self)),((PyBytesObject *)(self))->ob_size)
|
||||
#define PyBytes_GET_SIZE(self) (assert(PyBytes_Check(self)),Py_Size(self))
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -85,7 +85,7 @@ PyAPI_FUNC(void) _Py_ReleaseInternedStrings(void);
|
|||
|
||||
/* Macro, trading safety for speed */
|
||||
#define PyString_AS_STRING(op) (assert(PyString_Check(op)),(((PyStringObject *)(op))->ob_sval))
|
||||
#define PyString_GET_SIZE(op) (assert(PyString_Check(op)),(((PyStringObject *)(op))->ob_size))
|
||||
#define PyString_GET_SIZE(op) (assert(PyString_Check(op)),Py_Size(op))
|
||||
|
||||
/* _PyString_Join(sep, x) is like sep.join(x). sep must be PyStringObject*,
|
||||
x must be an iterable object. */
|
||||
|
|
|
@ -4041,7 +4041,7 @@ Simple_repr(CDataObject *self)
|
|||
if (val == NULL)
|
||||
return NULL;
|
||||
|
||||
name = PyUnicode_FromString(self->ob_type->tp_name);
|
||||
name = PyUnicode_FromString(Py_Type(self)->tp_name);
|
||||
if (name == NULL) {
|
||||
Py_DECREF(val);
|
||||
return NULL;
|
||||
|
|
|
@ -1235,7 +1235,7 @@ array. Also called as read.");
|
|||
static PyObject *
|
||||
array_tofile(arrayobject *self, PyObject *f)
|
||||
{
|
||||
Py_ssize_t nbytes = self->ob_size * self->ob_descr->itemsize;
|
||||
Py_ssize_t nbytes = Py_Size(self) * self->ob_descr->itemsize;
|
||||
/* Write 64K blocks at a time */
|
||||
/* XXX Make the block size settable */
|
||||
int BLOCKSIZE = 64*1024;
|
||||
|
@ -1383,7 +1383,7 @@ static PyObject *
|
|||
array_tostring(arrayobject *self, PyObject *unused)
|
||||
{
|
||||
return PyBytes_FromStringAndSize(self->ob_item,
|
||||
self->ob_size * self->ob_descr->itemsize);
|
||||
Py_Size(self) * self->ob_descr->itemsize);
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(tostring_doc,
|
||||
|
|
|
@ -950,7 +950,7 @@ call_tzname(PyObject *tzinfo, PyObject *tzinfoarg)
|
|||
if (!PyString_Check(result) && !PyUnicode_Check(result)) {
|
||||
PyErr_Format(PyExc_TypeError, "tzinfo.tzname() must "
|
||||
"return None or a string, not '%s'",
|
||||
result->ob_type->tp_name);
|
||||
Py_Type(result)->tp_name);
|
||||
Py_DECREF(result);
|
||||
result = NULL;
|
||||
}
|
||||
|
@ -1969,18 +1969,18 @@ delta_repr(PyDateTime_Delta *self)
|
|||
{
|
||||
if (GET_TD_MICROSECONDS(self) != 0)
|
||||
return PyUnicode_FromFormat("%s(%d, %d, %d)",
|
||||
self->ob_type->tp_name,
|
||||
Py_Type(self)->tp_name,
|
||||
GET_TD_DAYS(self),
|
||||
GET_TD_SECONDS(self),
|
||||
GET_TD_MICROSECONDS(self));
|
||||
if (GET_TD_SECONDS(self) != 0)
|
||||
return PyUnicode_FromFormat("%s(%d, %d)",
|
||||
self->ob_type->tp_name,
|
||||
Py_Type(self)->tp_name,
|
||||
GET_TD_DAYS(self),
|
||||
GET_TD_SECONDS(self));
|
||||
|
||||
return PyUnicode_FromFormat("%s(%d)",
|
||||
self->ob_type->tp_name,
|
||||
Py_Type(self)->tp_name,
|
||||
GET_TD_DAYS(self));
|
||||
}
|
||||
|
||||
|
@ -2381,7 +2381,7 @@ static PyObject *
|
|||
date_repr(PyDateTime_Date *self)
|
||||
{
|
||||
return PyUnicode_FromFormat("%s(%d, %d, %d)",
|
||||
self->ob_type->tp_name,
|
||||
Py_Type(self)->tp_name,
|
||||
GET_YEAR(self), GET_MONTH(self), GET_DAY(self));
|
||||
}
|
||||
|
||||
|
@ -2557,7 +2557,7 @@ date_getstate(PyDateTime_Date *self, int hashable)
|
|||
static PyObject *
|
||||
date_reduce(PyDateTime_Date *self, PyObject *arg)
|
||||
{
|
||||
return Py_BuildValue("(ON)", self->ob_type, date_getstate(self, 0));
|
||||
return Py_BuildValue("(ON)", Py_Type(self), date_getstate(self, 0));
|
||||
}
|
||||
|
||||
static PyMethodDef date_methods[] = {
|
||||
|
|
|
@ -102,7 +102,7 @@ PyBytes_FromStringAndSize(const char *bytes, Py_ssize_t size)
|
|||
memcpy(new->ob_bytes, bytes, size);
|
||||
new->ob_bytes[size] = '\0'; /* Trailing null byte */
|
||||
}
|
||||
new->ob_size = size;
|
||||
Py_Size(new) = size;
|
||||
new->ob_alloc = alloc;
|
||||
|
||||
return (PyObject *)new;
|
||||
|
@ -232,7 +232,7 @@ bytes_iconcat(PyBytesObject *self, PyObject *other)
|
|||
return PyErr_NoMemory();
|
||||
if (size < self->ob_alloc) {
|
||||
Py_Size(self) = size;
|
||||
self->ob_bytes[self->ob_size] = '\0'; /* Trailing null byte */
|
||||
self->ob_bytes[Py_Size(self)] = '\0'; /* Trailing null byte */
|
||||
}
|
||||
else if (PyBytes_Resize((PyObject *)self, size) < 0)
|
||||
return NULL;
|
||||
|
@ -281,7 +281,7 @@ bytes_irepeat(PyBytesObject *self, Py_ssize_t count)
|
|||
return PyErr_NoMemory();
|
||||
if (size < self->ob_alloc) {
|
||||
Py_Size(self) = size;
|
||||
self->ob_bytes[self->ob_size] = '\0'; /* Trailing null byte */
|
||||
self->ob_bytes[Py_Size(self)] = '\0'; /* Trailing null byte */
|
||||
}
|
||||
else if (PyBytes_Resize((PyObject *)self, size) < 0)
|
||||
return NULL;
|
||||
|
@ -816,7 +816,7 @@ static PyObject *
|
|||
bytes_repr(PyBytesObject *self)
|
||||
{
|
||||
static const char *hexdigits = "0123456789abcdef";
|
||||
size_t newsize = 3 + 4 * self->ob_size;
|
||||
size_t newsize = 3 + 4 * Py_Size(self);
|
||||
PyObject *v;
|
||||
if (newsize > PY_SSIZE_T_MAX || newsize / 4 != Py_Size(self)) {
|
||||
PyErr_SetString(PyExc_OverflowError,
|
||||
|
@ -2594,7 +2594,7 @@ static PyObject *
|
|||
bytes_join(PyBytesObject *self, PyObject *it)
|
||||
{
|
||||
PyObject *seq;
|
||||
Py_ssize_t mysize = self->ob_size;
|
||||
Py_ssize_t mysize = Py_Size(self);
|
||||
Py_ssize_t i;
|
||||
Py_ssize_t n;
|
||||
PyObject **items;
|
||||
|
@ -2727,7 +2727,7 @@ bytes_reduce(PyBytesObject *self)
|
|||
return Py_BuildValue("(O(s#s))",
|
||||
Py_Type(self),
|
||||
self->ob_bytes == NULL ? "" : self->ob_bytes,
|
||||
self->ob_size,
|
||||
Py_Size(self),
|
||||
"latin-1");
|
||||
}
|
||||
|
||||
|
|
|
@ -619,21 +619,21 @@ set_repr(PySetObject *so)
|
|||
if (status != 0) {
|
||||
if (status < 0)
|
||||
return NULL;
|
||||
return PyUnicode_FromFormat("%s(...)", so->ob_type->tp_name);
|
||||
return PyUnicode_FromFormat("%s(...)", Py_Type(so)->tp_name);
|
||||
}
|
||||
|
||||
/* shortcut for the empty set */
|
||||
if (!so->used) {
|
||||
Py_ReprLeave((PyObject*)so);
|
||||
return PyUnicode_FromFormat("%s()", so->ob_type->tp_name);
|
||||
return PyUnicode_FromFormat("%s()", Py_Type(so)->tp_name);
|
||||
}
|
||||
|
||||
keys = PySequence_List((PyObject *)so);
|
||||
if (keys == NULL)
|
||||
goto done;
|
||||
|
||||
if (so->ob_type != &PySet_Type) {
|
||||
result = PyUnicode_FromFormat("%s(%R)", so->ob_type->tp_name, keys);
|
||||
if (Py_Type(so) != &PySet_Type) {
|
||||
result = PyUnicode_FromFormat("%s(%R)", Py_Type(so)->tp_name, keys);
|
||||
Py_DECREF(keys);
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -835,7 +835,7 @@ PyString_Repr(PyObject *obj, int smartquotes)
|
|||
static const char *hexdigits = "0123456789abcdef";
|
||||
register PyStringObject* op = (PyStringObject*) obj;
|
||||
Py_ssize_t length = PyString_GET_SIZE(op);
|
||||
size_t newsize = 3 + 4 * op->ob_size;
|
||||
size_t newsize = 3 + 4 * Py_Size(op);
|
||||
PyObject *v;
|
||||
if (newsize > PY_SSIZE_T_MAX || newsize / 4 != Py_Size(op)) {
|
||||
PyErr_SetString(PyExc_OverflowError,
|
||||
|
|
|
@ -305,7 +305,7 @@ void unicode_dealloc(register PyUnicodeObject *unicode)
|
|||
|
||||
case SSTATE_INTERNED_MORTAL:
|
||||
/* revive dead object temporarily for DelItem */
|
||||
unicode->ob_refcnt = 3;
|
||||
Py_Refcnt(unicode) = 3;
|
||||
if (PyDict_DelItem(interned, (PyObject *)unicode) != 0)
|
||||
Py_FatalError(
|
||||
"deletion of interned unicode string failed");
|
||||
|
@ -8758,7 +8758,7 @@ PyUnicode_InternInPlace(PyObject **p)
|
|||
PyThreadState_GET()->recursion_critical = 0;
|
||||
/* The two references in interned are not counted by refcnt.
|
||||
The deallocator will take care of this */
|
||||
s->ob_refcnt -= 2;
|
||||
Py_Refcnt(s) -= 2;
|
||||
PyUnicode_CHECK_INTERNED(s) = SSTATE_INTERNED_MORTAL;
|
||||
}
|
||||
|
||||
|
@ -8812,11 +8812,11 @@ void _Py_ReleaseInternedUnicodeStrings(void)
|
|||
/* XXX Shouldn't happen */
|
||||
break;
|
||||
case SSTATE_INTERNED_IMMORTAL:
|
||||
s->ob_refcnt += 1;
|
||||
Py_Refcnt(s) += 1;
|
||||
immortal_size += s->length;
|
||||
break;
|
||||
case SSTATE_INTERNED_MORTAL:
|
||||
s->ob_refcnt += 2;
|
||||
Py_Refcnt(s) += 2;
|
||||
mortal_size += s->length;
|
||||
break;
|
||||
default:
|
||||
|
|
Loading…
Reference in New Issue