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

Add _pyodide_core C extension module #1090

Merged
merged 23 commits into from
Jan 11, 2021
Merged

Add _pyodide_core C extension module #1090

merged 23 commits into from
Jan 11, 2021

Conversation

hoodmane
Copy link
Member

@hoodmane hoodmane commented Jan 9, 2021

This is meant to address two issues:

  1. hard to tell which things are defined in core It's hard to figure out where things are defined #1079,
  2. the bootstrap order is confusing -- pyodide_py needs a most of the stuff from core in order to work, but core imports pyodide_py fairly early on in the initialization. Currently it works fine because pyodide_py only needs core to run it's methods not for initialization, but it's easy to make innocuous-seeming changes that mess it up.

Instead of directly adding stuff to pyodide_py, we make a C module called _core and add things to this instead. I also added _core.py which imports names from _core if we are running in the browser and spits out empty shims otherwise. If needed for testing reasons, these shims can be modified. In _core.py we can specify which C source file added each object imported from _core.

src/tests/test_pyproxy.py Outdated Show resolved Hide resolved
src/pyodide-py/pyodide/_core.py Outdated Show resolved Hide resolved
src/pyodide-py/pyodide/_core.py Show resolved Hide resolved
src/core/jsproxy.c Show resolved Hide resolved
src/tests/test_pyproxy.py Outdated Show resolved Hide resolved
src/tests/test_pyproxy.py Outdated Show resolved Hide resolved
src/tests/test_pyproxy.py Outdated Show resolved Hide resolved
Copy link
Member

@rth rth left a comment

Choose a reason for hiding this comment

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

Thanks !

@rth rth changed the title _core C extension module Add _pyodide_core C extension module Jan 11, 2021
@rth rth merged commit 3548683 into pyodide:master Jan 11, 2021
@hoodmane hoodmane deleted the core-module branch January 11, 2021 18:39
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.

2 participants