Conversation
This comment was marked as resolved.
This comment was marked as resolved.
90569a5 to
8ada517
Compare
|
PyList_GetItem returns a borrowed reference (like PyList_GET_ITEM) while PyList_GetItemRef returns a new reference, so you have to choose one, in this case use always PyList_GetItem regardless of the Python version. |
|
#1435 describes why We could use a compatibility layer ( |
|
I think we should add an implementation of PyList_GetItemRef for versions older than 3.13, then use it. |
8ada517 to
465b44b
Compare
|
Ok. I've added the conditional definition of I'm not well accustomed to using the Python C API directly. So, thank you for reviewing this and giving feedback. |
465b44b to
48c178f
Compare
ngoldbaum
left a comment
There was a problem hiding this comment.
Some comments about idiomatic use of the C API.
|
Also please feel free to ping me for code review on any change related to supporting free-threaded Python. Happy to help out! |
48c178f to
6e3459d
Compare
resolves libgit2#1434 Instead use [`PyList_GetItemRef()`] for python >= 3.13. Internally, this function is conditionally defined for python < 3.13. [`PyList_GetItemRef()`] is part of the Stable ABI but also propagate errors. Whereas the previous [`PyList_GET_ITEM()`] did not do any error checking and was not part of the Stable ABI. [`PyList_GetItemRef()`]: https://docs.python.org/3/c-api/list.html#c.PyList_GetItemRef [`PyList_GET_ITEM()`]: https://docs.python.org/3/c-api/list.html#c.PyList_GET_ITEM
6e3459d to
db088ec
Compare
|
@2bndy5 I just dropped support for Python 3.10 ; with 3.11 Py_buffer is part of the stable ABI, |
The Limited API is a subset of the Stable ABI. I don't think I can get abi3 wheels ready within the next few weeks. There's a lot of |
|
@2bndy5 feel free to reach out to the email on my github profile to set up a call to go over debugging techniques and how to think about writing code against the C API. I'm happy to help mentor people who are interested in improving things :) I may even be able to nerdsnipe you into helping to figure out how to one day release numpy wheels using the stable ABI. |
resolves #1434
Instead use
PyList_GetItemRef()for python >= 3.13. Internally, this function is conditionally defined for python < 3.13.PyList_GetItemRef()is part of the Stable ABI but also propagate errors. Whereas the previousPyList_GET_ITEM()did not do any error checking and was not part of the Stable ABI.