| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Modify the :mod:`marshal` format to serialize bytecode more efficiently. |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| """ | ||
| Parts of our build process (looking at you, deepfreeze) need the opcode module | ||
| for the Python *being built*, not the Python *doing the building*. | ||
|
|
||
| This basically just loads ../../Lib/opcode.py: | ||
|
|
||
| >>> import opcode_for_build | ||
| >>> opcode = opcode_for_build.import_opcode() | ||
| """ | ||
|
|
||
| import os | ||
| import types | ||
|
|
||
| _OPCODE_PATH = os.path.realpath( | ||
| os.path.join( | ||
| os.path.dirname(__file__), os.pardir, os.pardir, "Lib", "opcode.py" | ||
| ) | ||
| ) | ||
|
|
||
| def import_opcode() -> types.ModuleType: | ||
| """Import the current version of the opcode module (from Lib).""" | ||
| opcode_module = types.ModuleType("opcode") | ||
| opcode_module.__file__ = os.path.realpath(_OPCODE_PATH) | ||
| with open(_OPCODE_PATH, encoding="utf-8") as opcode_file: | ||
| # Don't try this at home, kids: | ||
| exec(opcode_file.read(), opcode_module.__dict__) | ||
| return opcode_module |
| Back | FazBrowse Home | New Git URL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityUgh, sorry, I can't stomach this. It feels certain that at some point in the future we'll have a corner case where we encounter \0\0 in the middle. If an extra pass is too expensive let's just go with what you had before. Or let's not do this -- I am feeling pretty lukewarm about this scheme, especially since the register VM will require a whole new approach anyway.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.