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

Further limited API fixes #5798

Merged
merged 6 commits into from Nov 20, 2023
Merged

Further limited API fixes #5798

merged 6 commits into from Nov 20, 2023

Conversation

da-woods
Copy link
Contributor

@da-woods da-woods commented Nov 5, 2023

  1. A bunch of tests enabled (mostly already working)
  2. (some) fstrings work.
  3. cython.array works
  4. assorted other small fixes

1. A bunch of tests enabled (mostly already working)
2. (some) fstrings work.
3. cython.array works
4. assorted other small fixes
@@ -409,12 +409,12 @@ def make_length_call():
PyBytes_AS_STRING_func_type = PyrexTypes.CFuncType(
PyrexTypes.c_char_ptr_type, [
PyrexTypes.CFuncTypeArg("s", Builtin.bytes_type, None)
])
], exception_value="NULL")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'd quite like some way to enable the exception check only when a macro is defined (to avoid generating the code on non-limited api cases). Probably an improvement for the future rather than this PR though.

Copy link
Contributor

@scoder scoder left a comment

Choose a reason for hiding this comment

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

Looks good overall, comments below.

Cython/Utility/ObjectHandling.c Outdated Show resolved Hide resolved
Cython/Utility/ObjectHandling.c Outdated Show resolved Hide resolved
Cython/Utility/ObjectHandling.c Outdated Show resolved Hide resolved
#else
base = PyTuple_GetItem(bases, i);
if (!base) goto error;
#endif
Copy link
Contributor

Choose a reason for hiding this comment

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

We should incref base if we "avoid borrowed refs". We do too many operations below to keep it as a borrowed reference for all that time.

Comment on lines +67 to +81
#if CYTHON_ASSUME_SAFE_MACROS
#define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s))
#else
#define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AsString(s))
#define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AsString(s))
#define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AsString(s))
#define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AsString(s))
#define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AsString(s))
#define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AsString(s))
#endif
Copy link
Contributor

Choose a reason for hiding this comment

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

I do hope that we actually do error checking on these. We didn't need it before, so it seems worth taking a look.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The two I've used in Optimize.py have error checking (because I added it). For their use in PyrexTypes.py, they have error checking because self.exception_value = NULL (

self.exception_value = "NULL"
). So it all looks error-checked.

@scoder scoder added this to the 3.1 milestone Nov 16, 2023
da-woods added a commit to da-woods/cython that referenced this pull request Nov 19, 2023
It isn't actually usable because it cimports other modules
but it does build without warning. Changes are mainly to string
handling (because that's the nature of parsing).

Depends on cython#5841 and cython#5798 to actually build, but the PR itself
doesn't depend on those
da-woods added a commit to da-woods/cython that referenced this pull request Nov 19, 2023
It isn't actually usable because it cimports other modules
but it does build without warning. Changes are mainly to string
handling (because that's the nature of parsing).

Depends on cython#5841 and cython#5798 to actually build, but the PR itself
doesn't depend on those
@da-woods da-woods merged commit 8af78af into cython:master Nov 20, 2023
62 of 63 checks passed
@da-woods da-woods deleted the more-limited-api branch November 20, 2023 18:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants