← 返回首页
bpo-1635741: Port _weakref extension module to multiphase initialization(PEP 489) by shihai1991 · Pull Request #19084 · python/cpython · GitHub
Skip to content

Navigation Menu

Toggle navigation
Sign in
Appearance settings
Search or jump to...

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Resetting focus

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 commented Mar 20, 2020
edited by bedevere-bot
Loading

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality Hide comment

@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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality Hide comment

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality Hide comment

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 merged commit 8334f30 into python:master Mar 20, 2020

Copy link
Copy Markdown
Member Author

thanks, folks.

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

Copy link
Copy Markdown
Member

I had to revert this change: #19128

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

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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

Footer

© 2026 GitHub, Inc.