This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: evaluated code filename changed to instead of ?
Type: Stage:
Components: Interpreter Core Versions: Python 2.5
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: collinwinter, exarkun, foom
Priority: normal Keywords:

Created on 2006-06-29 20:07 by foom, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (5)
msg28981 - (view) Author: James Y Knight (foom) Date: 2006-06-29 20:07
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
msg28982 - (view) Author: Collin Winter (collinwinter) * (Python committer) Date: 2006-07-01 18:26
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.
msg28983 - (view) Author: Jean-Paul Calderone (exarkun) * (Python committer) Date: 2006-07-02 20:18
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 "?".
msg28984 - (view) Author: Jean-Paul Calderone (exarkun) * (Python committer) Date: 2006-07-02 20:20
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.
msg28985 - (view) Author: Collin Winter (collinwinter) * (Python committer) Date: 2007-03-08 18:18
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.
History
Date User Action Args
2022-04-11 14:56:18adminsetgithub: 43578
2006-06-29 20:07:21foomcreate