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

[PRISM] Fix error handling in pm_parse_prism #9862

Merged

Conversation

eileencodes
Copy link
Contributor

Following changes made in ruby/prism#2365 this implements error handling for when pm_string_mapped_init returns false.

Related: ruby/prism#2207

prism_compile.c Outdated
int e = errno;
#endif

rb_syserr_fail(e, RSTRING_PTR(filepath));
Copy link
Contributor

Choose a reason for hiding this comment

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

We want to return an error from this function so that callers can do cleanup (free anything they allocated). Could you create the error from this function and return it instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh no, I didn't even remove the following line. OK I think this is fixed now.

Following changes made in ruby/prism#2365 this implements error handling
for when `pm_string_mapped_init` returns `false`.

Related: ruby/prism#2207
@eileencodes eileencodes force-pushed the prism-improve-error-handling-2207 branch from dae5753 to 4cdb74c Compare February 7, 2024 16:34
@kddnewton
Copy link
Contributor

Nice looks great! Thanks @eileencodes!

@kddnewton kddnewton merged commit a3ceb69 into ruby:master Feb 11, 2024
97 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants