pygame-ce icon indicating copy to clipboard operation
pygame-ce copied to clipboard

Replace AddObject() with AddObjectRef()

Open MightyJosip opened this issue 7 months ago • 2 comments
trafficstars

Since Python 3.13 PyModule_AddObject() is soft deprecated. This PR replaces it with newer function, PyModule_AddObjectRef(). It was changed following the way adviced in the official documentation between versions 3.9 <-> 3.14 image

MightyJosip avatar Apr 19 '25 13:04 MightyJosip

It's also confusing to see replacements for things that didn't previously have an incref.

Starbuck5 avatar Apr 26 '25 07:04 Starbuck5

It's also confusing to see replacements for things that didn't previously have an incref.

Yea you are right, that comment is mostly for encapsulate_api, and in the current master if I print Py_REFCNT of apiobj, it is 1. However, after this PR it is indeed 2 like you said. I will remove it from those places, and use it only when we actually increase the ref

MightyJosip avatar Apr 26 '25 07:04 MightyJosip