[New-bugs-announce] [issue20443] __code__. co_filename should always be an absolute path

Yury Selivanov report at bugs.python.org
Thu Jan 30 03:15:15 CET 2014


New submission from Yury Selivanov:

There are many issues on tracker related to the relative paths in co_filename. Most of them are about introspection functions in inspect module--which are usually broken after 'os.chdir'. 

Test case: create a file t.py:

   def foo(): pass
   print(foo.__code__.co_filename)

Execute it with '$ python t.py' -> it will print 't.py'.

Ideally, when executing a python file, interpreter should expand all relative paths for __file__ and __code__.co_filename attributes.

----------
messages: 209699
nosy: r.david.murray, yselivanov
priority: normal
severity: normal
stage: needs patch
status: open
title: __code__. co_filename should always be an absolute path
type: behavior
versions: Python 3.5

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue20443>
_______________________________________


More information about the New-bugs-announce mailing list