mirror of
https://github.com/python/cpython.git
synced 2025-07-12 13:55:34 +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
|
@ -5741,6 +5741,14 @@ unicode_endswith(PyUnicodeObject *self,
|
|||
}
|
||||
|
||||
|
||||
|
||||
static PyObject *
|
||||
unicode_getnewargs(PyUnicodeObject *v)
|
||||
{
|
||||
return Py_BuildValue("(u#)", v->str, v->length);
|
||||
}
|
||||
|
||||
|
||||
static PyMethodDef unicode_methods[] = {
|
||||
|
||||
/* Order is according to common usage: often used methods should
|
||||
|
@ -5791,6 +5799,7 @@ static PyMethodDef unicode_methods[] = {
|
|||
{"freelistsize", (PyCFunction) unicode_freelistsize, METH_NOARGS},
|
||||
#endif
|
||||
|
||||
{"__getnewargs__", (PyCFunction)unicode_getnewargs, METH_NOARGS},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue