summaryrefslogtreecommitdiffstats
path: root/Objects/stringobject.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2003-01-29 17:58:45 (GMT)
committerGuido van Rossum <guido@python.org>2003-01-29 17:58:45 (GMT)
commit5d9113d8be81596bc93f2b1a37f57e5110d39a77 (patch)
treef7bdf7fc9aa5afbf967e9e110baea0e4cdd9ffec /Objects/stringobject.c
parentd3590f937f4493445beeb253e5048771d1663ab7 (diff)
downloadcpython-5d9113d8be81596bc93f2b1a37f57e5110d39a77.zip
cpython-5d9113d8be81596bc93f2b1a37f57e5110d39a77.tar.gz
cpython-5d9113d8be81596bc93f2b1a37f57e5110d39a77.tar.bz2
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.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/Objects/stringobject.c b/Objects/stringobject.c
index f18edb0..9598ffb 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 */
};