PYTHON-5033 Use PyModule_Add on >= 3.13#2332
PYTHON-5033 Use PyModule_Add on >= 3.13#2332aclark4life merged 6 commits intomongodb:masterfrom aclark4life:PYTHON-5033
Conversation
bson/_cbsonmodule.c
Outdated
|
|
||
| #if PY_VERSION_HEX >= 0x030D0000 | ||
| if (PyModule_Add(m, "_C_API", c_api_object) < 0) { | ||
| Py_DECREF(c_api_object); |
There was a problem hiding this comment.
We need to remove this decref, the new API always steals the reference: https://docs.python.org/3/c-api/module.html#c.PyModule_Add
There was a problem hiding this comment.
Once again, you removed the wrong line.
There was a problem hiding this comment.
🤦 In 75233bb I only added two DECREFs … identical to the DECREFs in the else clause. Are you saying we need to remove a DECREF from somewhere else, unrelated to this PR?
There was a problem hiding this comment.
We need to decref m here, not c_api_object.
There was a problem hiding this comment.
OK but that was already done in 9c768f5 and you said that I removed the wrong one … 🤔
There was a problem hiding this comment.
No it was not done in 9c768f5 .
That commit removes code in a completely unrelated code block.
There was a problem hiding this comment.
Ah! Sorry about that, thanks
There was a problem hiding this comment.
Thanks. FYI you should only resolve your own comments, not other people's. That way the reviewers can double check their comment is resolved.
PYTHON-5033