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

Patch CPython to use a type reflection trampoline if possible #3964

Merged
merged 17 commits into from Jul 8, 2023

Conversation

hoodmane
Copy link
Member

@hoodmane hoodmane commented Jun 28, 2023

This is a replacement for #3954 and #3955 structured as an upstream patch.

CF upstream PR:
python/cpython#106219

Copy link
Member

@ryanking13 ryanking13 left a comment

Choose a reason for hiding this comment

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

Thanks, @hoodmane, it looks generally good to me, Let's see what CPython devs respond in the upstream PR.

Personally, I am okay with merging this even if the upstream PR is rejected for some reason, so this does not block other JSPI related features.

+ case 3:
+ return ((three_arg)func)(self, args, kw);
+ default:
+ PyErr_SetString(PyExc_SystemError, "Handler takes too many arguments");
Copy link
Member

Choose a reason for hiding this comment

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

What happens if a function falls into here? Is this a "should not happen" condition?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes. Maybe we could fail more dramatically to make it more obvious. But I have never seen a function in the wild which takes too many arguments. The issue is always with functions that take too few arguments because they don't care about some of them.

@hoodmane
Copy link
Member Author

Looks like they are likely willing to merge it, I got an approval. I'm actually pretty surprised that Brett rejected your ctypes.util.find_library patch.

@hoodmane hoodmane changed the base branch from main to next June 29, 2023 20:48
@ryanking13
Copy link
Member

I'm actually pretty surprised that Brett rejected your ctypes.util.find_library patch.

Yeah, I think I'll try it again when they include ctypes module in their WASM build.

@hoodmane
Copy link
Member Author

hoodmane commented Jul 8, 2023

Okay I'm going to merge this since I think the upstream PR is ready. Hopefully upstream will merge this soon too.

@hoodmane hoodmane merged commit 6f3e4c5 into pyodide:next Jul 8, 2023
34 of 35 checks passed
@hoodmane hoodmane deleted the jspi-patches-2 branch July 8, 2023 15:35
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.

None yet

4 participants