mirror of
https://github.com/python/cpython.git
synced 2025-08-29 13:15:11 +00:00
Merged revisions 64002-64003,64012,64036-64037,64047,64050-64052,64054-64055,64066,64071 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r64002 | travis.oliphant | 2008-06-07 00:33:21 +0200 (Sat, 07 Jun 2008) | 1 line Add long double check support to configure test. ........ r64003 | travis.oliphant | 2008-06-07 00:39:47 +0200 (Sat, 07 Jun 2008) | 1 line Remove locking part of new buffer protocol. ........ r64012 | facundo.batista | 2008-06-07 15:36:36 +0200 (Sat, 07 Jun 2008) | 4 lines Finished bug #2451. Fixed the retrying part to make it more robust. ........ r64036 | georg.brandl | 2008-06-08 10:54:40 +0200 (Sun, 08 Jun 2008) | 2 lines #3028: tokenize passes the physical line. ........ r64037 | georg.brandl | 2008-06-08 10:59:38 +0200 (Sun, 08 Jun 2008) | 2 lines Argh, I read it wrong. Reverted 64036 and added a clarifying remark. ........ r64047 | raymond.hettinger | 2008-06-09 03:28:30 +0200 (Mon, 09 Jun 2008) | 1 line Issue3065: Fixed pickling of named tuples. Added tests. ........ r64050 | raymond.hettinger | 2008-06-09 08:54:45 +0200 (Mon, 09 Jun 2008) | 1 line Issue #2138: Add math.factorial(). ........ r64051 | raymond.hettinger | 2008-06-09 10:33:37 +0200 (Mon, 09 Jun 2008) | 1 line Let set.union() and set.update() accept multiple inputs. ........ r64052 | raymond.hettinger | 2008-06-09 11:29:17 +0200 (Mon, 09 Jun 2008) | 1 line Address double-rounding scenarios by setting all variables to long doubles. ........ r64054 | raymond.hettinger | 2008-06-09 13:24:47 +0200 (Mon, 09 Jun 2008) | 1 line Unhappy buildbots. Revert 64052. Long doubles have unexpected effects on some builds. ........ r64055 | raymond.hettinger | 2008-06-09 15:07:27 +0200 (Mon, 09 Jun 2008) | 1 line Let set.intersection() and set.intersection_update() take multiple input arguments. ........ r64066 | robert.schuppenies | 2008-06-10 12:10:31 +0200 (Tue, 10 Jun 2008) | 2 lines Issue 3048: Fixed sys.getsizeof for unicode objects. ........ r64071 | thomas.heller | 2008-06-10 16:07:12 +0200 (Tue, 10 Jun 2008) | 3 lines NEWS entry for: Add an optional 'offset' parameter to byref, defaulting to zero. ........
This commit is contained in:
parent
e932c5c813
commit
c28e1fa71f
13 changed files with 277 additions and 57 deletions
|
@ -8300,6 +8300,28 @@ PyDoc_STRVAR(p_format__doc__,
|
|||
\n\
|
||||
");
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(sizeof__doc__,
|
||||
"S.__sizeof__() -> size of S in memory, in bytes");
|
||||
|
||||
static PyObject *
|
||||
unicode_getnewargs(PyUnicodeObject *v)
|
||||
{
|
||||
|
@ -8357,6 +8379,7 @@ static PyMethodDef unicode_methods[] = {
|
|||
{"_formatter_parser", (PyCFunction) formatter_parser, METH_NOARGS},
|
||||
{"maketrans", (PyCFunction) unicode_maketrans,
|
||||
METH_VARARGS | METH_STATIC, maketrans__doc__},
|
||||
{"__sizeof__", (PyCFunction) unicode__sizeof__, METH_NOARGS, sizeof__doc__},
|
||||
#if 0
|
||||
{"capwords", (PyCFunction) unicode_capwords, METH_NOARGS, capwords__doc__},
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue