Message239749
When a decorater contains a `lambda` declaration, using the pdb command `longlist` will show only the definition of the decorator. The definition of the function itself is not shown:
cat mini.py
#!/usr/bin/python3.4
def foo(x, y=None):
return x
@foo(foo, lambda a:a)
def spam():
0+0
1+1
1/0
spam()
$ python3.4 -mpdb mini.py
> /tmp/mini.py(3)<module>()
-> def foo(x, y=None):
(Pdb) cont
Traceback (most recent call last):
File "/usr/lib64/python3.4/pdb.py", line 1661, in main
pdb._runscript(mainpyfile)
File "/usr/lib64/python3.4/pdb.py", line 1542, in _runscript
self.run(statement)
File "/usr/lib64/python3.4/bdb.py", line 431, in run
exec(cmd, globals, locals)
File "<string>", line 1, in <module>
File "/tmp/mini.py", line 3, in <module>
def foo(x, y=None):
File "/tmp/mini.py", line 10, in spam
1/0
ZeroDivisionError: division by zero
Uncaught exception. Entering post mortem debugging
Running 'cont' or 'step' will restart the program
> /tmp/mini.py(10)spam()
-> 1/0
(Pdb) longlist
6 @foo(foo, lambda a:a)
(Pdb)
The last line illustrates the problem. `longlist` should show the definition of `spam`, not just the decorator. |
|
Date |
User |
Action |
Args |
2015-03-31 20:35:12 | Gerrit.Holl | set | recipients:
+ Gerrit.Holl |
2015-03-31 20:35:12 | Gerrit.Holl | set | messageid: <1427834112.73.0.627625379595.issue23832@psf.upfronthosting.co.za> |
2015-03-31 20:35:12 | Gerrit.Holl | link | issue23832 messages |
2015-03-31 20:35:12 | Gerrit.Holl | create | |
|