diff Objects/unicodeobject.c @ 48467:c0c06ffaea83

Merged revisions 64842,64853,64856,64945 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r64842 | robert.schuppenies | 2008-07-10 15:43:26 +0200 (Thu, 10 Jul 2008) | 2 lines Fixed Issue3122 and extended sys.getsizeof tests for built-in types. ........ r64853 | robert.schuppenies | 2008-07-10 17:24:04 +0200 (Thu, 10 Jul 2008) | 3 lines Added additional __sizeof__ implementations and addressed comments made in Issue3122. ........ r64856 | robert.schuppenies | 2008-07-10 19:13:55 +0200 (Thu, 10 Jul 2008) | 3 lines Added garbage collector overhead and optional default return value to sys.getsizeof. ........ r64945 | robert.schuppenies | 2008-07-14 10:42:18 +0200 (Mon, 14 Jul 2008) | 2 lines Fixed test failure on Win64 machines. ........
author Robert Schuppenies <okkotonushi@googlemail.com>
date Mon, 14 Jul 2008 10:13:31 +0000
parents 04817793b962
children 83d0d4cb7a66
line wrap: on
line diff
--- a/Objects/unicodeobject.c	Sun Jul 13 22:28:42 2008 +0000
+++ b/Objects/unicodeobject.c	Mon Jul 14 10:13:31 2008 +0000
@@ -8350,20 +8350,8 @@
 static PyObject *
 unicode__sizeof__(PyUnicodeObject *v)
 {
-    PyObject *res = NULL, *defsize = NULL;
-
-    res = PyLong_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 PyLong_FromSsize_t(sizeof(PyUnicodeObject) +
+                              sizeof(Py_UNICODE) * (v->length + 1));
 }
 
 PyDoc_STRVAR(sizeof__doc__,