[Python-bugs-list] [Bug #131560] pdb imports 'repr', causing name collision

noreply@sourceforge.net noreply@sourceforge.net
Thu, 08 Feb 2001 08:33:19 -0800


Bug #131560, was updated on 2001-Feb-08 08:33
Here is a current snapshot of the bug.

Project: Python
Category: Python Library
Status: Open
Resolution: None
Bug Group: None
Priority: 5
Submitted by: gward
Assigned to : nobody
Summary: pdb imports 'repr', causing name collision

Details: It's apparently impossible to debug code that calls the
built-in function 'repr', because pdb.py imports the
repr module, resulting in a "call of non-function (type module)"
traceback.

Here's my example script:
$ cat r.py
print repr(0.1)

And here's what happens when I run it through the debugger:

$ python2.0 [...]/pdb.py r.py
> /tmp/<string>(0)?()
(Pdb) c
> /tmp/<string>(1)?()
(Pdb) c
TypeError: 'call of non-...(type module)'
> /tmp/<string>(1)?()
(Pdb) c
Traceback (most recent call last):
  File "/www/python/lib/python2.0/pdb.py", line 943, in ?
    run('execfile(' + `filename` + ')')
  File "/www/python/lib/python2.0/pdb.py", line 878, in run
    Pdb().run(statement, globals, locals)
  File "/www/plat/python2.0/lib/python2.0/bdb.py", line 346, in run
    exec cmd in globals, locals
  File "<string>", line 1, in ?
  File "r.py", line 1, in ?
    print repr(0.1)
TypeError: call of non-function (type module)

Two obvious fixes: import repr "as" something else, or do "from repr import
repr" instead of "import repr".  Whatever.

I've checked the CVS version, and this bug appears to be still present.


For detailed info, follow this link:
http://sourceforge.net/bugs/?func=detailbug&bug_id=131560&group_id=5470