Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 20, 2020

Conversation

shihai1991
Copy link
Member

@shihai1991 shihai1991 commented Mar 20, 2020

if (PyModule_AddObject(module, "ref", (PyObject *) &_PyWeakref_RefType) < 0) {
Py_DECREF(&_PyWeakref_RefType);
return -1;
}
Copy link
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
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
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
Member Author

thanks, folks.

vstinner added a commit that referenced this pull request Mar 23, 2020
@vstinner
Copy link
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants