bpo-21161: pdb: default: handle list comprehensions by blueyed · Pull Request #15194 · python/cpython · GitHub
Skip to content

bpo-21161: pdb: default: handle list comprehensions - #15194

Closed
blueyed wants to merge 1 commit into
python:mainfrom
blueyed:pdb-list-comprehensions
Closed

bpo-21161: pdb: default: handle list comprehensions#15194
blueyed wants to merge 1 commit into
python:mainfrom
blueyed:pdb-list-comprehensions

Conversation

@blueyed

@blueyed blueyed commented Aug 9, 2019

Copy link
Copy Markdown
Contributor

Fixes https://bugs.python.org/issue21161.

TODO:

  • test
  • news
  • attribute patch author (Xavier de Gaye (xdegaye), @xdegaye)

https://bugs.python.org/issue21161

@blueyed

blueyed commented Aug 9, 2019

Copy link
Copy Markdown
Contributor Author

@blueyed
blueyed force-pushed the pdb-list-comprehensions branch from 00fac9a to ff84fb3 Compare August 12, 2019 01:16
@viniciusd

Copy link
Copy Markdown

Congrats for the work here :)
It looks to me it covers other kinds of comprehensions as well, right? Like set and dictionary comprehension. What do you think of also testing those?

@blueyed

blueyed commented Aug 21, 2019

Copy link
Copy Markdown
Contributor Author

What do you think of also testing those?

I do not think it is necessary really - the test proves that the namespace is handled properly/differently already.

Comment thread Lib/test/test_pdb.py
def test_list_comprehensions(self):
script = """
def f():
mylocal = "init_mylocal" # noqa: F841

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does the comment mean?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Local variable name is assigned to but never used (F841)

Comment thread Lib/test/test_pdb.py
commands = """
continue

p "mylocal:" + mylocal

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need this line in the test?

Comment thread Lib/pdb.py
if line[:1] == '!': line = line[1:]
locals = self.curframe_locals
globals = self.curframe.f_globals
ns = self.curframe.f_globals.copy()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What it the code that is being debugged changes globals()? This would mean any changes to self.curframe.f_globals by the calling code is dropped, is it not?

@erlend-aasland

Copy link
Copy Markdown
Contributor

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants