[issue16974] when python -c command does a traceback, it open the file string
Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com: -- nosy: +Arfrever ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16974 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16974] when python -c command does a traceback, it open the file string
R. David Murray added the comment: Ideally there would be an unambiguous way to know if the object came from a file or some other source (say, __file__ is None and another special attribute gives the clue to the actual source), but that's not the way things work now, and for backward compatibility reasons I doubt that we can change it. I'm sure there are programs that depend on at least 'string', if not some of the other places where a similar thing is done. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16974 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16974] when python -c command does a traceback, it open the file string
R. David Murray added the comment: Hmm. A backward compatible fix would be to add an attribute that indicates whether or not the __file__ attribute is supposed to be pointing to a real file. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16974 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16974] when python -c command does a traceback, it open the file string
Ramchandra Apte added the comment: +1 On 16 January 2013 17:43, R. David Murray rep...@bugs.python.org wrote: R. David Murray added the comment: Ideally there would be an unambiguous way to know if the object came from a file or some other source (say, __file__ is None and another special attribute gives the clue to the actual source), but that's not the way things work now, and for backward compatibility reasons I doubt that we can change it. I'm sure there are programs that depend on at least 'string', if not some of the other places where a similar thing is done. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16974 ___ -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16974 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16974] when python -c command does a traceback, it open the file string
New submission from Eric Lammerts: $ echo lovely spam string $ python -c 'open(nonexistent,r)' Traceback (most recent call last): File string, line 1, in module lovely spam IOError: [Errno 2] No such file or directory: 'nonexistent' I see this in python 2.7.3 and 3.2.3 from Ubuntu 12.04. -- messages: 180055 nosy: eric-bugs-python priority: normal severity: normal status: open title: when python -c command does a traceback, it open the file string type: behavior versions: Python 2.7, Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16974 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16974] when python -c command does a traceback, it open the file string
R. David Murray added the comment: Heh. Nice find. I'm not sure how practical it is to fix, though. We don't have any actual rules about what indicates a 'non-file-stand-in' for the __file__ attribute, just a loose convention that it is an identifier in angle brackets. If we make that a hard rule, though, and someone really has a file named 'string' :) -- nosy: +r.david.murray versions: +Python 3.3, Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16974 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16974] when python -c command does a traceback, it open the file string
Ramchandra Apte added the comment: Well, it should't open string IMHO. -- nosy: +ramchandra.apte ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16974 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16974] when python -c command does a traceback, it open the file string
Changes by Éric Araujo mer...@netwok.org: -- nosy: +eric.araujo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16974 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16974] when python -c command does a traceback, it open the file string
Eric Lammerts added the comment: Does it have to be an identifier in angle brackets? An empty string makes more sense to me. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16974 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com