-
-
Notifications
You must be signed in to change notification settings - Fork 30.4k
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
[3.5] bpo-29537: Tolerate legacy invalid bytecode #169
[3.5] bpo-29537: Tolerate legacy invalid bytecode #169
Conversation
bpo-27286 fixed a problem where BUILD_MAP_UNPACK_WITH_CALL could be emitted with an incorrect oparg value, causing the eval loop to access the wrong stack entry when attempting to read the function name. The associated magic number change caused significant problems when attempting to upgrade to 3.5.3 for anyone that relies on pre-cached bytecode remaining valid across maintenance releases. This patch restores the ability to import legacy bytecode generated by 3.5.0, 3.5.1 or 3.5.2 (TODO!), and modifies the eval loop to avoid any harmful consequences from the potentially malformed legacy bytecode.
On the bug you say it only makes sense to push this with my patch to accept old bytecode. That patch is at encukou@magic-number-workaround . It's meant to be one-off, and includes redundant sanity checks that it's patching the right magic number. If you want to include it in your PR, consider the patch a contribution under Python's CLA, which I signed. |
@encukou Thanks, I'll bring it in under those terms and make a combined PR with both changes. |
Codecov Report
@@ Coverage Diff @@
## 3.5 #169 +/- ##
======================================
Coverage ? 82.41%
======================================
Files ? 1404
Lines ? 341485
Branches ? 0
======================================
Hits ? 281442
Misses ? 60043
Partials ? 0
Continue to review full report at Codecov.
|
…-BUILD_MAP_UNPACK_WITH_CALL-bytecode
… modules (python#169) Many extension modules were created by Cython versions before commit 037bcf0 and were compiled with regular C-Python. These modules call PyEval_EvalFrameEx() with a broken frame object. This commit add code to recover a broken frame in PyEval_EvalFrameEx().
bpo-27286 fixed a problem where BUILD_MAP_UNPACK_WITH_CALL could
be emitted with an incorrect oparg value, causing the eval loop
to access the wrong stack entry when attempting to read the
function name.
The associated magic number change caused significant problems when
attempting to upgrade to 3.5.3 for anyone that relies on pre-cached
bytecode remaining valid across maintenance releases.
This patch restores the ability to import legacy bytecode generated
by 3.5.0, 3.5.1 or 3.5.2, and modifies the eval loop to
avoid any harmful consequences from the potentially malformed legacy
bytecode.