Skip to content

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

Merged
hoodmane merged 17 commits intopyodide:nextfrom
hoodmane:jspi-patches-2
Jul 8, 2023
Merged

Patch CPython to use a type reflection trampoline if possible#3964
hoodmane merged 17 commits intopyodide:nextfrom
hoodmane:jspi-patches-2

Conversation

@hoodmane
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
@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.

4 participants