Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

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

Closed
wants to merge 1 commit into from

Conversation

blueyed
Copy link
Contributor

@blueyed blueyed commented Aug 9, 2019

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

TODO:

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

https://bugs.python.org/issue21161

@blueyed
Copy link
Contributor Author

blueyed commented Aug 9, 2019

test_gdb crashed on Azure (https://dev.azure.com/Python/cpython/_build/results?buildId=48361&view=logs&j=c83831cd-3752-5cc7-2f01-8276919eb334):

0:12:45 load avg: 0.01 [418/419] test_io passed (4 min 23 sec) -- running: test_gdb (10 min 1 sec)
running: test_gdb (10 min 31 sec)
running: test_gdb (11 min 1 sec)
running: test_gdb (11 min 31 sec)
running: test_gdb (15 min 31 sec)
running: test_gdb (16 min 1 sec)
running: test_gdb (16 min 31 sec)
running: test_gdb (17 min 1 sec)
running: test_gdb (17 min 31 sec)
running: test_gdb (18 min 1 sec)
running: test_gdb (18 min 31 sec)
running: test_gdb (19 min 1 sec)
running: test_gdb (19 min 31 sec)
Timeout (0:20:00)!
0:22:44 load avg: 0.00 [419/419/1] test_gdb crashed (Exit code 1)
Thread 0x00000fa4 (most recent call first):
File "D:\a\1\s\lib\subprocess.py", line 1353 in _readerthread
File "D:\a\1\s\lib\threading.py", line 876 in run
File "D:\a\1\s\lib\threading.py", line 938 in _bootstrap_inner
File "D:\a\1\s\lib\threading.py", line 896 in _bootstrap
Thread 0x000003f4 (most recent call first):
File "D:\a\1\s\lib\subprocess.py", line 1353 in _readerthread
File "D:\a\1\s\lib\threading.py", line 876 in run
File "D:\a\1\s\lib\threading.py", line 938 in _bootstrap_inner
File "D:\a\1\s\lib\threading.py", line 896 in _bootstrap
Thread 0x00000a7c (most recent call first):
File "D:\a\1\s\lib\threading.py", line 1033 in _wait_for_tstate_lock
File "D:\a\1\s\lib\threading.py", line 1017 in join
File "D:\a\1\s\lib\subprocess.py", line 1382 in _communicate
File "D:\a\1\s\lib\subprocess.py", line 1015 in communicate
File "D:\a\1\s\lib\test\test_gdb.py", line 105 in run_gdb
File "D:\a\1\s\lib\test\test_gdb.py", line 122 in gdb_has_frame_select
File "D:\a\1\s\lib\test\test_gdb.py", line 129 in <module>
File "<frozen importlib._bootstrap>", line 219 in _call_with_frames_removed
File "<frozen importlib._bootstrap_external>", line 782 in exec_module
== Tests result: FAILURE ==

(retrying)

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

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
Copy link
Contributor Author

blueyed commented Aug 21, 2019

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.

def test_list_comprehensions(self):
script = """
def f():
mylocal = "init_mylocal" # noqa: F841
Copy link
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

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)

commands = """
continue

p "mylocal:" + mylocal
Copy link
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?

@@ -362,7 +362,8 @@ def displayhook(self, obj):
def default(self, line):
if line[:1] == '!': line = line[1:]
locals = self.curframe_locals
globals = self.curframe.f_globals
ns = self.curframe.f_globals.copy()
Copy link
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
Contributor

The linked issue was fixed by #111094; closing this since the linked issue is now resolved.

Thanks for your interest in improving CPython!

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