diff options
author | Robert Schuppenies <okkotonushi@googlemail.com> | 2008-07-10 15:24:04 (GMT) |
---|---|---|
committer | Robert Schuppenies <okkotonushi@googlemail.com> | 2008-07-10 15:24:04 (GMT) |
commit | 9be2ec109bcec499c1a6971fb4c40d9a8e7886fe (patch) | |
tree | 04942da45d0452f8555758be18bfa3effda1dedb /Objects/unicodeobject.c | |
parent | cc3f2b1d1677b4464f223c2fbff77f1b8bd6df0a (diff) | |
download | cpython-9be2ec109bcec499c1a6971fb4c40d9a8e7886fe.zip cpython-9be2ec109bcec499c1a6971fb4c40d9a8e7886fe.tar.gz cpython-9be2ec109bcec499c1a6971fb4c40d9a8e7886fe.tar.bz2 |
Added additional __sizeof__ implementations and addressed comments made in
Issue3122.
Diffstat (limited to 'Objects/unicodeobject.c')
-rw-r--r-- | Objects/unicodeobject.c | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 840efb9..a62e929 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -7898,20 +7898,8 @@ PyDoc_STRVAR(p_format__doc__, static PyObject * unicode__sizeof__(PyUnicodeObject *v) { - PyObject *res = NULL, *defsize = NULL; - - res = PyInt_FromSsize_t(sizeof(PyUnicodeObject) + - sizeof(Py_UNICODE) * (v->length + 1)); - if (v->defenc) { - defsize = PyObject_CallMethod(v->defenc, "__sizeof__", NULL); - if (defsize == NULL) { - Py_DECREF(res); - return NULL; - } - res = PyNumber_Add(res, defsize); - Py_DECREF(defsize); - } - return res; + return PyInt_FromSsize_t(sizeof(PyUnicodeObject) + + sizeof(Py_UNICODE) * (v->length + 1)); } PyDoc_STRVAR(sizeof__doc__, |