Skip to content

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