-
Notifications
You must be signed in to change notification settings - Fork 0
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
Work In Progress: Du Toit's Pillow Port to HPy #1
base: main
Are you sure you want to change the base?
Conversation
} | ||
|
||
PyObject *py_size = HPy_AsPyObject(ctx, h_size); | ||
PyObject *py_kernel = HPy_AsPyObject(ctx, kernel); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that HPy_AsPyObject
increments ref count before returning the underlying PyObject*
to you, so you should Py_DECREF(py_kernel)
when you're done with it (or leave it be and fix it by migrating it all to HPy).
src/_imaging.c
Outdated
PyObject *color = HPy_AsPyObject(ctx, h_color); | ||
|
||
x = PyLong_AsLong(PyTuple_GetItem(coords, 0)); | ||
y = PyLong_AsLong(PyTuple_GetItem(coords, 1)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this shows often, I think we can reconsider the support for tuple deconstruction in HPyArg_Parse
. Once this is proper HPy code, it will be even more bloated, because you'll have to HPy_Close
all the items retrieved from the tuple.
@@ -121,7 +122,7 @@ typedef struct { | |||
ImagingAccess access; | |||
} ImagingObject; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way to directly convert between structs like this and an HPy type, without having to go through a PyObject?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HPy_AsStruct
. I think the best knowledge source for now are the tests in the HPy repository. Maybe this is something we can improve in the docs..
My port of Pillow to HPy so far: currently I have ported most of the Image class, as well as the ImageMorph class.