mirror of
https://github.com/python/cpython.git
synced 2025-08-22 17:55:18 +00:00
gh-79512: Fixed names and __module__ value of weakref classes (GH-93719)
Classes ReferenceType, ProxyType and CallableProxyType have now correct atrtributes __module__, __name__ and __qualname__. It makes them (types, not instances) pickleable.
This commit is contained in:
parent
6fd4c8ec77
commit
8352e322e8
3 changed files with 17 additions and 3 deletions
|
@ -371,7 +371,7 @@ static PyMethodDef weakref_methods[] = {
|
|||
PyTypeObject
|
||||
_PyWeakref_RefType = {
|
||||
PyVarObject_HEAD_INIT(&PyType_Type, 0)
|
||||
.tp_name = "weakref",
|
||||
.tp_name = "weakref.ReferenceType",
|
||||
.tp_basicsize = sizeof(PyWeakReference),
|
||||
.tp_dealloc = weakref_dealloc,
|
||||
.tp_vectorcall_offset = offsetof(PyWeakReference, vectorcall),
|
||||
|
@ -719,7 +719,7 @@ static PyMappingMethods proxy_as_mapping = {
|
|||
PyTypeObject
|
||||
_PyWeakref_ProxyType = {
|
||||
PyVarObject_HEAD_INIT(&PyType_Type, 0)
|
||||
"weakproxy",
|
||||
"weakref.ProxyType",
|
||||
sizeof(PyWeakReference),
|
||||
0,
|
||||
/* methods */
|
||||
|
@ -754,7 +754,7 @@ _PyWeakref_ProxyType = {
|
|||
PyTypeObject
|
||||
_PyWeakref_CallableProxyType = {
|
||||
PyVarObject_HEAD_INIT(&PyType_Type, 0)
|
||||
"weakcallableproxy",
|
||||
"weakref.CallableProxyType",
|
||||
sizeof(PyWeakReference),
|
||||
0,
|
||||
/* methods */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue