Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert get/set/size to PEP-384 style #324

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

jcpunk
Copy link
Contributor

@jcpunk jcpunk commented Oct 16, 2020

Ultimately, for PEP-384 (CPython 3.2+) someone who understands the output needs to run abitype.py[1] against src/object/enum.cpp and src/object/class.cpp. The slot/spec layouts[2] generated by that code are pretty close to right, but need someone more fluent in this than I....

This PR gets the other helpers in place for staying to the stricter ABI.

[1]
https://github.com/python/cpython/blob/master/Tools/scripts/abitype.py

[2]
https://pythoncapi.readthedocs.io/type_object.html#pytype-fromspec

@knoepfel
Copy link

@jcpunk, do you have reason to suspect the output of abitype.py on those files is wrong?

@jcpunk
Copy link
Contributor Author

jcpunk commented Oct 22, 2020

I'm really unsure what the changes from abitype.py mean for the overall usage and behaviour of the library. To be honest, I'm not much of a C++ programmer and can't meaningfully assess that output. All I know is it doesn't compile without help. I honestly don't understand that section of the code in any real way.

@stefanseefeld
Copy link
Member

I'm not entirely sure I understand the purpose of this PR. As far as I can see, all it does is to replace non-checking functions by their checking counter parts, thereby making the code overall slower. (Example: PyTuple_GET_SIZE is replaced by PyTuple_Size, PyTuple_GET_ITEM is replaced by PyTuple_GetItem, etc.)
Am I missing something ?

@jcpunk
Copy link
Contributor Author

jcpunk commented Jan 7, 2021

As I understand it, this PR (switching to the checking versions) is a pre-req for the PEP-384 abitype.py conversion to the stable C API.

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.

3 participants