mirror of
https://github.com/python/cpython.git
synced 2025-11-25 04:34:37 +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
|
|
@ -639,8 +639,15 @@ complex_conjugate(PyObject *self)
|
|||
return PyComplex_FromCComplex(c);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
complex_getnewargs(PyComplexObject *v)
|
||||
{
|
||||
return Py_BuildValue("(D)", v->cval);
|
||||
}
|
||||
|
||||
static PyMethodDef complex_methods[] = {
|
||||
{"conjugate", (PyCFunction)complex_conjugate, METH_NOARGS},
|
||||
{"__getnewargs__", (PyCFunction)complex_getnewargs, METH_NOARGS},
|
||||
{NULL, NULL} /* sentinel */
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue