[ python-Bugs-1514617 ] evaluated code filename changed to <module> instead of ?

SourceForge.net noreply at sourceforge.net
Thu Mar 8 19:19:02 CET 2007


Bugs item #1514617, was opened at 2006-06-29 16:07
Message generated for change (Comment added) made by collinwinter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1514617&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Interpreter Core
Group: Python 2.5
>Status: Closed
>Resolution: Wont Fix
Priority: 5
Private: No
Submitted By: James Y Knight (foom)
Assigned to: Nobody/Anonymous (nobody)
Summary: evaluated code filename changed to <module> instead of ?

Initial Comment:
It seems as though the default filename for evaluated changed from "?" to 
"<module>". Was this intentional? (it's causing some test failures for me. 
The tests are correctable of course, but it doesn't seem to be an obvious 
improvement in behavior, so if it wasn't intentional, perhaps it should be 
changed back.)

Python 2.3.5 (#1, Mar 20 2005, 20:38:20) 
[GCC 3.3 20030304 (Apple Computer, Inc. build 1809)] on darwin

>>> eval("0/0")    
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "<string>", line 0, in ?


Python 2.5b1 (trunk:47096, Jun 25 2006, 23:18:21) 
[GCC 4.0.0 20041026 (Apple Computer, Inc. build 4061)] on darwin

>>> eval("0/0")    
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<string>", line 1, in <module>
ZeroDivisionError: integer division or modulo by zero


----------------------------------------------------------------------

>Comment By: Collin Winter (collinwinter)
Date: 2007-03-08 13:18

Message:
Logged In: YES 
user_id=1344176
Originator: NO

1) An interpreter session is essentially a module that the user types in,
one statement at a time.

2) "?" tells me considerably less about where the error occurred than does
"<module>". "?" could mean anything.

3) Since Python 2.5 has already been released with the objected-to
behavior, I'd say it's incredibly unlikely that this change will be
reverted.

----------------------------------------------------------------------

Comment By: Jp Calderone (kuran)
Date: 2006-07-02 16:20

Message:
Logged In: YES 
user_id=366566

Also see
https://sourceforge.net/tracker/?func=detail&aid=1512007&group_id=5470&atid=305470
for a patch to revert to the old behavior.


----------------------------------------------------------------------

Comment By: Jp Calderone (kuran)
Date: 2006-07-02 16:18

Message:
Logged In: YES 
user_id=366566

Note that in the example James included, the code is /not/
in a module.

A clear improvement to me would be to say something like
<repl> or <interactive prompt> in the case James pasted and
<the name of a module> for the case of top-level code.

"<module>" is about as information-free as "?".


----------------------------------------------------------------------

Comment By: Collin Winter (collinwinter)
Date: 2006-07-01 14:26

Message:
Logged In: YES 
user_id=1344176

For me, this is indeed an obvious improvement in behaviour.
"<module>" is a much clearer indicator of where the code in
question is located; using "?" could mean that it's anywhere.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1514617&group_id=5470


More information about the Python-bugs-list mailing list