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 — gh-95913: Edit, expand & format Bytecode sect in 3.11 WhatsNew by CAM-Gerlach · Pull Request #98559 · python/cpython

Conversation

@CAM-Gerlach

@CAM-Gerlach CAM-Gerlach commented Oct 22, 2022 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

Part of #95913

This PR expands, edits and formats the CPython Bytecode Changes section in the What's New in Python 3.11 document.

On the editing side, like with the other PRs, it:

  • Uses clear, consistent phrasing on all bytecode entries, making them easier to scan and read
  • Orders them more consistently (Added, Replaced, Removed, Changed, roughly alphabetical by opcode name within each, aside from special cases), for the same reasons
  • Fixes and improves the Sphinx syntax and semantics

Likewise, it adds some missing additional opcodes that were added, replaced or removed in 3.11:

  • Added COPY_FREE_VARS, MAKE_CELL, PUSH_EXC_INFO, PREP_RE_RAISE_STAR, RETURN_GENERATOR, SEND and ASYNC_GEN_WRAP
  • Replaced SETUP_WITH and SETUP_ASYNC_WITH with BEFORE_WITH
  • Removed POP_BLOCK, SETUP_FINALLY and YIELD_FROM

Finally, it consolidates the sets of replaced opcodes into a much quicker and easier to navigate table.

Rendered Preview

--> Rendered Preview (click to expand) <---

image

  • Issue: Edit What's New for Python 3.11 #95913

Sorry, something went wrong.

Uh oh!

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

All reactions
CAM-Gerlach added 6 commits October 20, 2022 17:39
@CAM-Gerlach
Fix Sphinx syntax in bytecode section and tweak phrasing
48a18d5
@CAM-Gerlach
Use clear, consistant phrasing on all Bytecode entries
4a3d830
@CAM-Gerlach
Re-order opcode changes to Added, Replaced, Removed, Changed
611a628
@CAM-Gerlach
Add missing added and removed opcodes to section
68bef2a
@CAM-Gerlach
Add table with all added/replace/removed opcodes
f34698c
@CAM-Gerlach
Merge opcode information from list into tables
650b4e4
@bedevere-bot bedevere-bot added awaiting review docs Documentation in the Doc dir skip news labels Oct 22, 2022
@CAM-Gerlach CAM-Gerlach added 3.11 only security fixes needs backport to 3.11 only security fixes labels Oct 22, 2022
@CAM-Gerlach
CAM-Gerlach requested review from JelleZijlstra, brandtbucher, ezio-melotti and pablogsal October 22, 2022 22:11
CAM-Gerlach
CAM-Gerlach commented Oct 22, 2022
View reviewed changes
Comment thread Doc/whatsnew/3.11.rst Outdated
Comment on lines +1518 to +1522
Changed Opcodes
---------------

* Changed :opcode:`JUMP_IF_TRUE_OR_POP` and :opcode:`JUMP_IF_FALSE_OR_POP`
to now be relative rather than absolute.

@CAM-Gerlach CAM-Gerlach Oct 22, 2022 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member Author

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.

I left the Changes section as it was for now (aside from minor technical edits), but there were a handful of additional Opcode changes of what seemed to be roughly comparable magnitude to those mentioned that weren't noted here, mostly grouped by a few specific common alterations, that we could include in a final short table (with columns Opcode(s) and Change), if you feel its worth including.

Here are the additional changes that could be mentioned:

List of additional changes

Added where oparg

  • GET_AWAITABLE

Exception representation on the stack now consist of one, not three, items

  • END_ASYNC_FOR
  • POP_EXCEPT
  • RERAISE
  • WITH_EXCEPT_START

The exit function is in position 4 of the stack rather than 7.

  • WITH_EXCEPT_START

If the low bit of namei is set, then a NULL is pushed to the stack before the global variable.

  • LOAD_GLOBAL

i is no longer offset by the length of co_varnames

  • LOAD_CLOSURE
  • LOAD_DEREF
  • LOAD_CLASSDEREF
  • STORE_DEREF
  • DELETE_DEREF

Sorry, something went wrong.

Uh oh!

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

All reactions
@CAM-Gerlach CAM-Gerlach mentioned this pull request Oct 22, 2022
Edit What's New for Python 3.11 #95913
Closed
31 of 33 tasks
@pablogsal

pablogsal commented Oct 22, 2022

Copy link
Copy Markdown
Member

This should be also checked with @markshannon, @brandtbucher, @iritkatriel and @ericsnowcurrently.

If this doesn't land today, it won't be included in 3.11.0

CAM-Gerlach 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.

@CAM-Gerlach
CAM-Gerlach requested review from ericsnowcurrently, iritkatriel and markshannon and removed request for JelleZijlstra October 23, 2022 03:25
iritkatriel
iritkatriel reviewed Oct 23, 2022
View reviewed changes
Comment thread Doc/whatsnew/3.11.rst

* :opcode:`JUMP_IF_TRUE_OR_POP` and :opcode:`JUMP_IF_FALSE_OR_POP` are now
relative rather than absolute.
.. _whatsnew311-added-opcodes:

@iritkatriel iritkatriel Oct 23, 2022

Copy link
Copy Markdown
Member

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.

The list we have now has all the jump related changes together, but if you split it into a "added" table and a "replaced" table then they are no longer together. I don't know if that's an improvement.

Sorry, something went wrong.

Uh oh!

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

All reactions

@iritkatriel iritkatriel Oct 23, 2022

Copy link
Copy Markdown
Member

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.

I created an alternative PR -#98566. It tries to consolidate related items into a high level descriptions, rather than enumerate all the changes. Maybe this is more useful for whatsnew. The full details, if you need them, as in the dis doc.

I added an item about the exc-info related changes. Didn't do anything about these:

GET_AWAITABLE

WITH_EXCEPT_START
If the low bit of namei is set, then a NULL is pushed to the stack before the global variable.

LOAD_GLOBAL
i is no longer offset by the length of co_varnames

LOAD_CLOSURE
LOAD_DEREF
LOAD_CLASSDEREF
STORE_DEREF
DELETE_DEREF

Sorry, something went wrong.

Uh oh!

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

All reactions

@CAM-Gerlach CAM-Gerlach Oct 23, 2022 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member Author

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.

Great points, thanks. I've incorporated the changes suggested via your PR, specifically:

  • Consolidated the jump opcode additions, replacements and changes (except for the NO_INTERRUPT opcode addition, which didn't appear to be closely related to the others) into a single Replaced table entry with a linked note
  • Just linked the high-level jump opcode name patterns, instead of every opcode.
  • Added a "Changed" note about the exception stack representation
  • (EXC/EG changes were already consolidated)

Beyond that, I've given this PR a major revamp based on your feedback above:

  • Converted the "Added" section back to (much shorter) bullets
  • Inlined the previous separate notes into the Replaced table
  • Combined the previous "Removed" and "Changed" sections into one, condensing the Removed items into a single bullet to take up much less space
  • Made additional textual refinements, particularly in the Changed entries, to be both more clear and more concise

In total, this retains nearly the same space consumption of the previous dense wall of flat bullets format (once allowing for the missing substantive additions, replacements and removals added here), while being much easier for the reader to quickly navigate, find what they're looking for and jump to more information in the dis docs.

Flat Bullets Initial PR Revised PR
image image image

Sorry, something went wrong.

Uh oh!

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

All reactions
CAM-Gerlach added 6 commits October 23, 2022 14:11
@CAM-Gerlach
Add exception reprisentation change to Changed Opcodes
87e06bb
@CAM-Gerlach
Unify & simplify added and replaced tables & entries
9c165b8
@CAM-Gerlach
Move added opcodes out of table into a bulleted list instead
1e0d7cb
@CAM-Gerlach
Re-order Replaced Opcodes table by replaced opcode
a0b90d8
@CAM-Gerlach
Consolidate changed and removed sections to be more concise
4ed6cfb
@CAM-Gerlach
Consolidate jump opcode changes further
7c94ab0
@CAM-Gerlach CAM-Gerlach mentioned this pull request Oct 23, 2022
gh-95913: edit description of opcodes changes #98566
Closed
@CAM-Gerlach
CAM-Gerlach requested a review from iritkatriel October 23, 2022 22:11
iritkatriel
iritkatriel reviewed Oct 24, 2022
View reviewed changes
Comment thread Doc/whatsnew/3.11.rst Resolved

Uh oh!

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

Comment thread Doc/whatsnew/3.11.rst Resolved

Uh oh!

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

@iritkatriel

iritkatriel commented Oct 24, 2022

Copy link
Copy Markdown
Member

Yeah this is better! Just CHECK_EG_MATCH is also new for PEP 654.

All reactions

Sorry, something went wrong.

Uh oh!

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

@pablogsal

pablogsal commented Oct 24, 2022

Copy link
Copy Markdown
Member

Heads up: please land this before 3Pm GMT+0 if you want it to be in 3.11.0

All reactions

Sorry, something went wrong.

Uh oh!

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

@iritkatriel
CHECK_EG_MATCH is new
c1a7743
iritkatriel
iritkatriel approved these changes Oct 24, 2022
View reviewed changes
@bedevere-bot bedevere-bot added awaiting merge and removed awaiting review labels Oct 24, 2022
@iritkatriel
iritkatriel merged commit 22739a0 into python:main Oct 24, 2022
@bedevere-bot bedevere-bot removed the awaiting merge label Oct 24, 2022
@miss-islington

miss-islington commented Oct 24, 2022

Copy link
Copy Markdown
Contributor

Thanks @CAM-Gerlach for the PR, and @iritkatriel for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11.
🐍🍒⛏🤖

All reactions

Sorry, something went wrong.

Uh oh!

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

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Oct 24, 2022
@CAM-Gerlach @miss-islington
pythongh-95913: Edit, expand & format Bytecode sect in 3.11 WhatsNew (p…
7d5d0d5
…ythonGH-98559)

(cherry picked from commit 22739a0)

Co-authored-by: C.A.M. Gerlach <[email protected]>
@bedevere-bot

bedevere-bot commented Oct 24, 2022

Copy link
Copy Markdown

GH-98597 is a backport of this pull request to the 3.11 branch.

All reactions

Sorry, something went wrong.

Uh oh!

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

@bedevere-bot bedevere-bot removed the needs backport to 3.11 only security fixes label Oct 24, 2022
miss-islington added a commit that referenced this pull request Oct 24, 2022
@miss-islington @CAM-Gerlach
gh-95913: Edit, expand & format Bytecode sect in 3.11 WhatsNew (GH-98559
2a346b0
)

(cherry picked from commit 22739a0)

Co-authored-by: C.A.M. Gerlach <[email protected]>
@iritkatriel

iritkatriel commented Oct 24, 2022

Copy link
Copy Markdown
Member

Heads up: please land this before 3Pm GMT+0 if you want it to be in 3.11.0

It's merged and backported.

All reactions

Sorry, something went wrong.

Uh oh!

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@iritkatriel iritkatriel iritkatriel approved these changes
@pablogsal pablogsal Awaiting requested review from pablogsal
@brandtbucher brandtbucher Awaiting requested review from brandtbucher
@ezio-melotti ezio-melotti Awaiting requested review from ezio-melotti
@markshannon markshannon Awaiting requested review from markshannon
@ericsnowcurrently ericsnowcurrently Awaiting requested review from ericsnowcurrently

Uh oh!

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

Assignees

No one assigned

Labels

3.11 only security fixes docs Documentation in the Doc dir skip news

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.

5 participants

@CAM-Gerlach @pablogsal @iritkatriel @miss-islington @bedevere-bot
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 01402503 — 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.