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 — bpo-37947: Avoid double-decrement in symtable recursion counting by ncoghlan · Pull Request #15593 · python/cpython

Conversation

@ncoghlan

@ncoghlan ncoghlan commented Aug 29, 2019 •
edited by bedevere-bot
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

With symtable_visit_expr now correctly adjusting the recursion depth for named
expressions, symtable_handle_namedexpr should be leaving it alone.

https://bugs.python.org/issue37947

Sorry, something went wrong.

Uh oh!

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

All reactions
@ncoghlan
bpo-37947: Avoid double-decrement in symtable recursion counting
eb863e1
@ncoghlan
ncoghlan requested a review from pablogsal August 29, 2019 12:20
@the-knights-who-say-ni the-knights-who-say-ni added the CLA signed label Aug 29, 2019
@bedevere-bot bedevere-bot added the awaiting core review label Aug 29, 2019
@ncoghlan ncoghlan added needs backport to 3.8 skip news labels Aug 29, 2019
@ncoghlan ncoghlan mentioned this pull request Aug 29, 2019
bpo-37947: Adjust correctly the recursion level in symtable for named expressions #15499
Merged
pablogsal
pablogsal approved these changes Aug 29, 2019
View reviewed changes

@pablogsal pablogsal left a comment

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.

LGTM

Thank you for correcting this!

Sorry, something went wrong.

Uh oh!

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

All reactions
@bedevere-bot bedevere-bot added awaiting merge and removed awaiting core review labels Aug 29, 2019
@ncoghlan

ncoghlan commented Aug 29, 2019

Copy link
Copy Markdown
Contributor Author

I think I've found a good spot to add a sanity check that will make the test cases fail if a PR gets this accounting wrong - building that now (and I'll test it out by partially reverting the previous change).

All reactions

Sorry, something went wrong.

Uh oh!

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

@ncoghlan

ncoghlan commented Aug 29, 2019

Copy link
Copy Markdown
Contributor Author

Neat:

======================================================================
ERROR: test_named_expression_variable_reuse_in_comprehensions (test.test_named_expressions.NamedExpressionScopeTest) (case='Nested nonlocal')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/ncoghlan/devel/cpython/Lib/test/test_named_expressions.py", line 469, in test_named_expression_variable_reuse_in_comprehensions
    exec(code, ns)
SystemError: symtable analysis recursion depth mismatch (before=96, after=95)

(This is with VISIT_QUIT(st, 1) at the end of symtable_handle_namedexpr)

All reactions

Sorry, something went wrong.

Uh oh!

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

ncoghlan added 2 commits August 29, 2019 22:50
@ncoghlan
Ensure the symtable recursion accounting balances
b4a341e
@ncoghlan
Remove spurious line
6e83dc2
@ncoghlan
ncoghlan merged commit 0614523 into python:master Aug 29, 2019
@ncoghlan
ncoghlan deleted the bpo-37947-symtable-recursion-counting branch August 29, 2019 13:26
@miss-islington

miss-islington commented Aug 29, 2019

Copy link
Copy Markdown
Contributor

Thanks @ncoghlan for the PR 🌮🎉.. I'm working now to backport this PR to: 3.8.
🐍🍒⛏🤖

All reactions

Sorry, something went wrong.

Uh oh!

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

@bedevere-bot bedevere-bot removed awaiting merge needs backport to 3.8 labels Aug 29, 2019
@bedevere-bot

bedevere-bot commented Aug 29, 2019

Copy link
Copy Markdown

GH-15594 is a backport of this pull request to the 3.8 branch.

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 Aug 29, 2019
@ncoghlan @miss-islington
bpo-37947: Avoid double-decrement in symtable recursion counting (pyt…
bdabf9c
…honGH-15593)

With `symtable_visit_expr` now correctly adjusting the recursion depth for named
expressions, `symtable_handle_namedexpr` should be leaving it alone.

Also adds a new check to `PySymtable_BuildObject` that raises `SystemError`
if a successful first symbol analysis pass fails to keep the stack depth
accounting clean.
(cherry picked from commit 0614523)

Co-authored-by: Nick Coghlan <[email protected]>
miss-islington added a commit that referenced this pull request Aug 29, 2019
@miss-islington @ncoghlan
bpo-37947: Avoid double-decrement in symtable recursion counting (GH-…
384c6d7
…15593)

With `symtable_visit_expr` now correctly adjusting the recursion depth for named
expressions, `symtable_handle_namedexpr` should be leaving it alone.

Also adds a new check to `PySymtable_BuildObject` that raises `SystemError`
if a successful first symbol analysis pass fails to keep the stack depth
accounting clean.
(cherry picked from commit 0614523)

Co-authored-by: Nick Coghlan <[email protected]>
lisroach pushed a commit to lisroach/cpython that referenced this pull request Sep 10, 2019
@ncoghlan @lisroach
bpo-37947: Avoid double-decrement in symtable recursion counting (pyt…
3eacae2
…honGH-15593)

With `symtable_visit_expr` now correctly adjusting the recursion depth for named
expressions, `symtable_handle_namedexpr` should be leaving it alone.

Also adds a new check to `PySymtable_BuildObject` that raises `SystemError`
if a successful first symbol analysis pass fails to keep the stack depth
accounting clean.
DinoV pushed a commit to DinoV/cpython that referenced this pull request Jan 14, 2020
@ncoghlan @DinoV
bpo-37947: Avoid double-decrement in symtable recursion counting (pyt…
27e8ee5
…honGH-15593)

With `symtable_visit_expr` now correctly adjusting the recursion depth for named
expressions, `symtable_handle_namedexpr` should be leaving it alone.

Also adds a new check to `PySymtable_BuildObject` that raises `SystemError`
if a successful first symbol analysis pass fails to keep the stack depth
accounting clean.
websurfer5 pushed a commit to websurfer5/cpython that referenced this pull request Jul 20, 2020
@ncoghlan @websurfer5
bpo-37947: Avoid double-decrement in symtable recursion counting (pyt…
97413a5
…honGH-15593)

With `symtable_visit_expr` now correctly adjusting the recursion depth for named
expressions, `symtable_handle_namedexpr` should be leaving it alone.

Also adds a new check to `PySymtable_BuildObject` that raises `SystemError`
if a successful first symbol analysis pass fails to keep the stack depth
accounting clean.
@bedevere-app bedevere-app Bot mentioned this pull request Jul 25, 2024
symtable_handle_namedexpr does not adjust correctly the recursion level #82128
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@pablogsal pablogsal pablogsal approved these changes

Uh oh!

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

Assignees

No one assigned

Labels

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

@ncoghlan @miss-islington @bedevere-bot @pablogsal @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 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.