Skip to content

Commit 9477dd5

Browse files
author
martin.v.loewis
committed
Fix merge breakage.
git-svn-id: http://svn.python.org/projects/python/branches/py3k-struni@56484 6015fed2-1504-0410-9fe1-9d1591cc4771
1 parent 16ae010 commit 9477dd5

9 files changed

Lines changed: 26 additions & 26 deletions

File tree

Include/bytesobject.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ PyAPI_FUNC(int) PyBytes_Resize(PyObject *, Py_ssize_t);
4242

4343
/* Macros, trading safety for speed */
4444
#define PyBytes_AS_STRING(self) (assert(PyBytes_Check(self)),((PyBytesObject *)(self))->ob_bytes)
45-
#define PyBytes_GET_SIZE(self) (assert(PyBytes_Check(self)),((PyBytesObject *)(self))->ob_size)
45+
#define PyBytes_GET_SIZE(self) (assert(PyBytes_Check(self)),Py_Size(self))
4646

4747
#ifdef __cplusplus
4848
}

Include/stringobject.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ PyAPI_FUNC(void) _Py_ReleaseInternedStrings(void);
8585

8686
/* Macro, trading safety for speed */
8787
#define PyString_AS_STRING(op) (assert(PyString_Check(op)),(((PyStringObject *)(op))->ob_sval))
88-
#define PyString_GET_SIZE(op) (assert(PyString_Check(op)),(((PyStringObject *)(op))->ob_size))
88+
#define PyString_GET_SIZE(op) (assert(PyString_Check(op)),Py_Size(op))
8989

9090
/* _PyString_Join(sep, x) is like sep.join(x). sep must be PyStringObject*,
9191
x must be an iterable object. */

Modules/_ctypes/_ctypes.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4041,7 +4041,7 @@ Simple_repr(CDataObject *self)
40414041
if (val == NULL)
40424042
return NULL;
40434043

4044-
name = PyUnicode_FromString(self->ob_type->tp_name);
4044+
name = PyUnicode_FromString(Py_Type(self)->tp_name);
40454045
if (name == NULL) {
40464046
Py_DECREF(val);
40474047
return NULL;

Modules/arraymodule.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1235,7 +1235,7 @@ array. Also called as read.");
12351235
static PyObject *
12361236
array_tofile(arrayobject *self, PyObject *f)
12371237
{
1238-
Py_ssize_t nbytes = self->ob_size * self->ob_descr->itemsize;
1238+
Py_ssize_t nbytes = Py_Size(self) * self->ob_descr->itemsize;
12391239
/* Write 64K blocks at a time */
12401240
/* XXX Make the block size settable */
12411241
int BLOCKSIZE = 64*1024;
@@ -1383,7 +1383,7 @@ static PyObject *
13831383
array_tostring(arrayobject *self, PyObject *unused)
13841384
{
13851385
return PyBytes_FromStringAndSize(self->ob_item,
1386-
self->ob_size * self->ob_descr->itemsize);
1386+
Py_Size(self) * self->ob_descr->itemsize);
13871387
}
13881388

13891389
PyDoc_STRVAR(tostring_doc,

Modules/datetimemodule.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -950,7 +950,7 @@ call_tzname(PyObject *tzinfo, PyObject *tzinfoarg)
950950
if (!PyString_Check(result) && !PyUnicode_Check(result)) {
951951
PyErr_Format(PyExc_TypeError, "tzinfo.tzname() must "
952952
"return None or a string, not '%s'",
953-
result->ob_type->tp_name);
953+
Py_Type(result)->tp_name);
954954
Py_DECREF(result);
955955
result = NULL;
956956
}
@@ -1969,18 +1969,18 @@ delta_repr(PyDateTime_Delta *self)
19691969
{
19701970
if (GET_TD_MICROSECONDS(self) != 0)
19711971
return PyUnicode_FromFormat("%s(%d, %d, %d)",
1972-
self->ob_type->tp_name,
1972+
Py_Type(self)->tp_name,
19731973
GET_TD_DAYS(self),
19741974
GET_TD_SECONDS(self),
19751975
GET_TD_MICROSECONDS(self));
19761976
if (GET_TD_SECONDS(self) != 0)
19771977
return PyUnicode_FromFormat("%s(%d, %d)",
1978-
self->ob_type->tp_name,
1978+
Py_Type(self)->tp_name,
19791979
GET_TD_DAYS(self),
19801980
GET_TD_SECONDS(self));
19811981

19821982
return PyUnicode_FromFormat("%s(%d)",
1983-
self->ob_type->tp_name,
1983+
Py_Type(self)->tp_name,
19841984
GET_TD_DAYS(self));
19851985
}
19861986

@@ -2381,7 +2381,7 @@ static PyObject *
23812381
date_repr(PyDateTime_Date *self)
23822382
{
23832383
return PyUnicode_FromFormat("%s(%d, %d, %d)",
2384-
self->ob_type->tp_name,
2384+
Py_Type(self)->tp_name,
23852385
GET_YEAR(self), GET_MONTH(self), GET_DAY(self));
23862386
}
23872387

@@ -2557,7 +2557,7 @@ date_getstate(PyDateTime_Date *self, int hashable)
25572557
static PyObject *
25582558
date_reduce(PyDateTime_Date *self, PyObject *arg)
25592559
{
2560-
return Py_BuildValue("(ON)", self->ob_type, date_getstate(self, 0));
2560+
return Py_BuildValue("(ON)", Py_Type(self), date_getstate(self, 0));
25612561
}
25622562

25632563
static PyMethodDef date_methods[] = {

Objects/bytesobject.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ PyBytes_FromStringAndSize(const char *bytes, Py_ssize_t size)
102102
memcpy(new->ob_bytes, bytes, size);
103103
new->ob_bytes[size] = '\0'; /* Trailing null byte */
104104
}
105-
new->ob_size = size;
105+
Py_Size(new) = size;
106106
new->ob_alloc = alloc;
107107

108108
return (PyObject *)new;
@@ -232,7 +232,7 @@ bytes_iconcat(PyBytesObject *self, PyObject *other)
232232
return PyErr_NoMemory();
233233
if (size < self->ob_alloc) {
234234
Py_Size(self) = size;
235-
self->ob_bytes[self->ob_size] = '\0'; /* Trailing null byte */
235+
self->ob_bytes[Py_Size(self)] = '\0'; /* Trailing null byte */
236236
}
237237
else if (PyBytes_Resize((PyObject *)self, size) < 0)
238238
return NULL;
@@ -281,7 +281,7 @@ bytes_irepeat(PyBytesObject *self, Py_ssize_t count)
281281
return PyErr_NoMemory();
282282
if (size < self->ob_alloc) {
283283
Py_Size(self) = size;
284-
self->ob_bytes[self->ob_size] = '\0'; /* Trailing null byte */
284+
self->ob_bytes[Py_Size(self)] = '\0'; /* Trailing null byte */
285285
}
286286
else if (PyBytes_Resize((PyObject *)self, size) < 0)
287287
return NULL;
@@ -816,7 +816,7 @@ static PyObject *
816816
bytes_repr(PyBytesObject *self)
817817
{
818818
static const char *hexdigits = "0123456789abcdef";
819-
size_t newsize = 3 + 4 * self->ob_size;
819+
size_t newsize = 3 + 4 * Py_Size(self);
820820
PyObject *v;
821821
if (newsize > PY_SSIZE_T_MAX || newsize / 4 != Py_Size(self)) {
822822
PyErr_SetString(PyExc_OverflowError,
@@ -2594,7 +2594,7 @@ static PyObject *
25942594
bytes_join(PyBytesObject *self, PyObject *it)
25952595
{
25962596
PyObject *seq;
2597-
Py_ssize_t mysize = self->ob_size;
2597+
Py_ssize_t mysize = Py_Size(self);
25982598
Py_ssize_t i;
25992599
Py_ssize_t n;
26002600
PyObject **items;
@@ -2727,7 +2727,7 @@ bytes_reduce(PyBytesObject *self)
27272727
return Py_BuildValue("(O(s#s))",
27282728
Py_Type(self),
27292729
self->ob_bytes == NULL ? "" : self->ob_bytes,
2730-
self->ob_size,
2730+
Py_Size(self),
27312731
"latin-1");
27322732
}
27332733

Objects/setobject.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -619,21 +619,21 @@ set_repr(PySetObject *so)
619619
if (status != 0) {
620620
if (status < 0)
621621
return NULL;
622-
return PyUnicode_FromFormat("%s(...)", so->ob_type->tp_name);
622+
return PyUnicode_FromFormat("%s(...)", Py_Type(so)->tp_name);
623623
}
624624

625625
/* shortcut for the empty set */
626626
if (!so->used) {
627627
Py_ReprLeave((PyObject*)so);
628-
return PyUnicode_FromFormat("%s()", so->ob_type->tp_name);
628+
return PyUnicode_FromFormat("%s()", Py_Type(so)->tp_name);
629629
}
630630

631631
keys = PySequence_List((PyObject *)so);
632632
if (keys == NULL)
633633
goto done;
634634

635-
if (so->ob_type != &PySet_Type) {
636-
result = PyUnicode_FromFormat("%s(%R)", so->ob_type->tp_name, keys);
635+
if (Py_Type(so) != &PySet_Type) {
636+
result = PyUnicode_FromFormat("%s(%R)", Py_Type(so)->tp_name, keys);
637637
Py_DECREF(keys);
638638
}
639639
else {

Objects/stringobject.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -835,7 +835,7 @@ PyString_Repr(PyObject *obj, int smartquotes)
835835
static const char *hexdigits = "0123456789abcdef";
836836
register PyStringObject* op = (PyStringObject*) obj;
837837
Py_ssize_t length = PyString_GET_SIZE(op);
838-
size_t newsize = 3 + 4 * op->ob_size;
838+
size_t newsize = 3 + 4 * Py_Size(op);
839839
PyObject *v;
840840
if (newsize > PY_SSIZE_T_MAX || newsize / 4 != Py_Size(op)) {
841841
PyErr_SetString(PyExc_OverflowError,

Objects/unicodeobject.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ void unicode_dealloc(register PyUnicodeObject *unicode)
305305

306306
case SSTATE_INTERNED_MORTAL:
307307
/* revive dead object temporarily for DelItem */
308-
unicode->ob_refcnt = 3;
308+
Py_Refcnt(unicode) = 3;
309309
if (PyDict_DelItem(interned, (PyObject *)unicode) != 0)
310310
Py_FatalError(
311311
"deletion of interned unicode string failed");
@@ -8758,7 +8758,7 @@ PyUnicode_InternInPlace(PyObject **p)
87588758
PyThreadState_GET()->recursion_critical = 0;
87598759
/* The two references in interned are not counted by refcnt.
87608760
The deallocator will take care of this */
8761-
s->ob_refcnt -= 2;
8761+
Py_Refcnt(s) -= 2;
87628762
PyUnicode_CHECK_INTERNED(s) = SSTATE_INTERNED_MORTAL;
87638763
}
87648764

@@ -8812,11 +8812,11 @@ void _Py_ReleaseInternedUnicodeStrings(void)
88128812
/* XXX Shouldn't happen */
88138813
break;
88148814
case SSTATE_INTERNED_IMMORTAL:
8815-
s->ob_refcnt += 1;
8815+
Py_Refcnt(s) += 1;
88168816
immortal_size += s->length;
88178817
break;
88188818
case SSTATE_INTERNED_MORTAL:
8819-
s->ob_refcnt += 2;
8819+
Py_Refcnt(s) += 2;
88208820
mortal_size += s->length;
88218821
break;
88228822
default:

0 commit comments

Comments
 (0)