mirror of
https://github.com/python/cpython.git
synced 2025-11-01 18:51:43 +00:00
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.
This commit is contained in:
parent
d3590f937f
commit
5d9113d8be
10 changed files with 133 additions and 19 deletions
|
|
@ -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 */
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue