Skip to content

Conversation

@lazka
Copy link
Member

@lazka lazka commented Nov 8, 2025

Move to newer APIs to avoid borrowed references. Plus some error handling fixes that were noticed along the way.

lazka added 13 commits November 8, 2025 17:41
return -1 on error, while still allowing NULL as a successfull result
This vendors some new API functions from
python/pythoncapi-compat@e3efede

Not everything since it triggers various compiler warnings and we only need a few,
so let's try that for now.
Port to PyDict_GetItemRef and PyDict_GetItemStringRef so we get rid
of borrowed references there.
Use PyModule_AddObjectRef() and PyModule_Add() instead.
…ySequence_ITEM

To avoid working with borrowed references
index is unsigned, so make sure we don't allow negative numbers there.
…signedLong

Check the value before to avoid calling PyErr_Occurred
No longer needed with modern Python
@lazka lazka changed the title Avoid using borrowed references Avoid using borrowed references + other cleanups Nov 9, 2025
@lazka lazka merged commit 333e805 into pygobject:main Nov 9, 2025
24 checks passed
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.

1 participant