GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [3.5] bpo-29537: Tolerate legacy invalid bytecode by ncoghlan · Pull Request #169 · python/cpython

Conversation

@ncoghlan

@ncoghlan ncoghlan commented Feb 19, 2017 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@ncoghlan
WIP: [3.5] bpo-29537: Tolerate legacy invalid bytecode
c5b9817
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.
@the-knights-who-say-ni the-knights-who-say-ni added the CLA signed label Feb 19, 2017
@serhiy-storchaka serhiy-storchaka added the type-bug An unexpected behavior, bug, or error label Feb 19, 2017
serhiy-storchaka
serhiy-storchaka approved these changes Feb 19, 2017
View reviewed changes
@encukou

encukou commented Feb 20, 2017

Copy link
Copy Markdown
Member

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.
What should I do to help? Submit it as PR for review, or rework it somehow?

If you want to include it in your PR, consider the patch a contribution under Python's CLA, which I signed.

ncoghlan reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ncoghlan

ncoghlan commented Feb 23, 2017

Copy link
Copy Markdown
Contributor Author

@encukou Thanks, I'll bring it in under those terms and make a combined PR with both changes.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

ncoghlan added 2 commits February 24, 2017 18:12
@ncoghlan
Adjust test case for eval loop change
b978d98
@ncoghlan
Include bytecode compatibility handling
2322493
@codecov

codecov Bot commented Feb 24, 2017 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Codecov Report

❗ No coverage uploaded for pull request base (3.5@24bfe15). Click here to learn what that means.
The diff coverage is 77.77%.

@@          Coverage Diff           @@
##             3.5     #169   +/-   ##
======================================
  Coverage       ?   82.41%           
======================================
  Files          ?     1404           
  Lines          ?   341485           
  Branches       ?        0           
======================================
  Hits           ?   281442           
  Misses         ?    60043           
  Partials       ?        0
Impacted Files Coverage Δ
Lib/test/test_unpack_ex.py 88.88% <ø> (ø)
Lib/test/test_extcall.py 85.71% <ø> (ø)
Lib/pkgutil.py 47.33% <100%> (ø)
Lib/pydoc.py 62.08% <100%> (ø)
Lib/importlib/util.py 95.17% <100%> (ø)
Lib/importlib/_bootstrap_external.py 82.42% <60%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 24bfe15...a5444ae. Read the comment docs.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ncoghlan
Amend comment based on implementation changes
a5444ae
serhiy-storchaka
serhiy-storchaka approved these changes Feb 24, 2017
View reviewed changes
@ncoghlan ncoghlan changed the title WIP: [3.5] bpo-29537: Tolerate legacy invalid bytecode [3.5] bpo-29537: Tolerate legacy invalid bytecode Mar 8, 2017
ncoghlan added 3 commits March 8, 2017 15:02
@ncoghlan
Merge remote-tracking branch 'origin/3.5' into bpo29537-handle-legacy…
0ba334d
…-BUILD_MAP_UNPACK_WITH_CALL-bytecode
@ncoghlan
Add NEWS entry
22d1a65
@ncoghlan
Add legacy bytecode compatibility tests
ca24864
@ncoghlan
ncoghlan merged commit 93602e3 into python:3.5 Mar 8, 2017
@ncoghlan
ncoghlan deleted the bpo29537-handle-legacy-BUILD_MAP_UNPACK_WITH_CALL-bytecode branch March 30, 2018 07:44
akruis pushed a commit to akruis/cpython that referenced this pull request Feb 18, 2019
Anselm Kruis
Stackless issue python#168: make Stackless compatible with old Cython…
638e61c
… 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().
jaraco pushed a commit that referenced this pull request Dec 2, 2022
@pyup-bot @Mariatta
Update pytest from 3.8.0 to 3.9.3 (#169)
2b56d7e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@serhiy-storchaka serhiy-storchaka serhiy-storchaka approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

type-bug An unexpected behavior, bug, or error

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@ncoghlan @encukou @serhiy-storchaka @the-knights-who-say-ni
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.