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

Added HPySlice_New #481

Merged
merged 4 commits into from
Jun 7, 2024
Merged

Conversation

DuToitSpies
Copy link
Contributor

Added HPySlice_New - still need to add tests. Needed for benchmarks for Cython.

@DuToitSpies DuToitSpies requested a review from fangerer June 6, 2024 11:17
Copy link
Contributor

@fangerer fangerer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM so far. As you mentioned, please add tests. This should be very easy since this function only fails if the object cannot be allocated and we don't test for out of memory problems.
You should just test if HPy_NULL is correctly handled if passed as start, stop, or step.

hpy/tools/autogen/public_api.h Show resolved Hide resolved
return HPy_NULL;
}
HPy length = HPySlice_New(ctx, start, stop, step);
return length;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor: this could just be return HPySlice_New(...)

*
* :param start:
* A pointer to a variable where to write the unpacked slice start. Must not
* be ``NULL``.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this is just a copy-and-paste-error but those parameters are not pointers.
I would write something like: "A handle to an object to be used as slice start" or something (your English is better than mine 🙂). Also, we allow HPy_NULL !
(Same for the other params.)

@DuToitSpies DuToitSpies merged commit 79fb330 into hpyproject:master Jun 7, 2024
38 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.

2 participants