Skip to content

bpo-1635741: Port _weakref extension module to multiphase initialization(PEP 489) - #19084

Merged
vstinner merged 2 commits into
python:masterfrom
shihai1991:bpo_1635741_weakref
Mar 20, 2020
Merged

bpo-1635741: Port _weakref extension module to multiphase initialization(PEP 489)#19084
vstinner merged 2 commits into
python:masterfrom
shihai1991:bpo_1635741_weakref

Conversation

@shihai1991

@shihai1991 shihai1991 commented Mar 20, 2020

Copy link
Copy Markdown
Member
Comment thread Modules/_weakref.c
if (PyModule_AddObject(module, "ref", (PyObject *) &_PyWeakref_RefType) < 0) {
Py_DECREF(&_PyWeakref_RefType);
return -1;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@corona10: Ah, now I see that we would benefit of a helper function calling PyType_Ready() + _PyType_Name() + PyModule_AddObject() ;-)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will submit the PR for this :)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am looking forword this feature;)
In this case, _PyWeakref_RefType have been added much times(it is means this type have much objects name). it can use this feature too?

@vstinner
vstinner merged commit 8334f30 into python:master Mar 20, 2020
@shihai1991

Copy link
Copy Markdown
Member Author

thanks, folks.

vstinner added a commit that referenced this pull request Mar 23, 2020
@vstinner

Copy link
Copy Markdown
Member

I had to revert this change: #19128

Because it introduced a reference leak: https://bugs.python.org/issue40050

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

5 participants