diff options
author | Guido van Rossum <guido@python.org> | 2003-01-29 17:58:45 +0000 |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2003-01-29 17:58:45 +0000 |
commit | d926b8f1d08c9ee74ce25e8f6dcf8e53bedece7d (patch) | |
tree | b64ae1ec092991eaa9e0aba11f32446f66705c5a /Objects/stringobject.c | |
parent | 4c0601a796b90587d6a215ba795c09259139eb16 (diff) | |
download | cpython-d926b8f1d08c9ee74ce25e8f6dcf8e53bedece7d.tar.gz |
Implement appropriate __getnewargs__ for all immutable subclassable builtin
types. The special handling for these can now be removed from save_newobj().
Add some testing for this.
Also add support for setting the 'fast' flag on the Python Pickler class,
which suppresses use of the memo.
Diffstat (limited to 'Objects/stringobject.c')
-rw-r--r-- | Objects/stringobject.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Objects/stringobject.c b/Objects/stringobject.c index f18edb00c4..9598ffb3cf 100644 --- a/Objects/stringobject.c +++ b/Objects/stringobject.c @@ -3045,6 +3045,12 @@ string_splitlines(PyStringObject *self, PyObject *args) #undef SPLIT_APPEND +static PyObject * +string_getnewargs(PyStringObject *v) +{ + return Py_BuildValue("(s#)", v->ob_sval, v->ob_size); +} + static PyMethodDef string_methods[] = { @@ -3091,6 +3097,7 @@ string_methods[] = { expandtabs__doc__}, {"splitlines", (PyCFunction)string_splitlines, METH_VARARGS, splitlines__doc__}, + {"__getnewargs__", (PyCFunction)string_getnewargs, METH_NOARGS}, {NULL, NULL} /* sentinel */ }; |