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

Ensure typeid is used only in C++ mode #3637

Merged
merged 3 commits into from May 26, 2020

Conversation

Celelibi
Copy link
Contributor

Right now, cython just generate invalid C code when using typeid in C. This patch emits an error if a TypeidNode is used in C. Maybe the parser shouldn't generate such node in C mode in the first place since typeid is a valid C identifier?

I added a test to check that the error is raised. I also added a few tests for C++-only features that raise an error.

Since the tests on travis mysteriously fail on Mac OS X, I'm setting this PR as a draft.

Celelibi and others added 3 commits May 25, 2020 20:46
Signed-off-by: Celelibi <celelibi@gmail.com>
Signed-off-by: Celelibi <celelibi@gmail.com>
@scoder
Copy link
Contributor

scoder commented May 26, 2020

Looks good to me. The test failures could be a travis hickup. I had to change the test name anyway, so they'll rerun. Let's see what that gives.

@scoder scoder added this to the 3.0 milestone May 26, 2020
@scoder scoder marked this pull request as ready for review May 26, 2020 10:43
@scoder
Copy link
Contributor

scoder commented May 26, 2020

It was a bug in the test runner. We didn't have a non-C++ error test yet, it seems, and the tag handling was broken in that case. The MacOS tests are special because they run the tests for the C and C++ backend combined.

@scoder scoder merged commit fba0673 into cython:master May 26, 2020
@scoder
Copy link
Contributor

scoder commented May 26, 2020

Thanks!

@Celelibi Celelibi deleted the test_cpp_only_features branch May 26, 2020 14:35
@scoder scoder modified the milestones: 3.0, 0.29.19 May 26, 2020
@scoder scoder modified the milestones: 0.29.19, 0.29.20 May 29, 2020
SylvainGault added a commit to SylvainGault/cython that referenced this pull request Jul 25, 2020
SylvainGault added a commit to SylvainGault/cython that referenced this pull request Jul 26, 2020
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