Text of wiki.python.org › python › archive › TrackingSourceLocation.html as Styx crawled it on Nov 20, 2026. The page may have changed since. Only its words are kept, without pictures or layout.

Open the live page

Tracking Source Location - Python Wiki

Python Wiki Python Wiki / Python Wiki / Archive / Tracking Source Location View as Markdown Tracking Source Location ¶ Legacy Wiki Page This page was migrated from the old MoinMoin-based wiki. Information may be outdated or no longer applicable. For current documentation, see python.org . The CPython interpreter currently tracks the source location of a code object in the co_filename attribute. In certain cases, this is a relative file name, which may break if the current directory changes.

The objective of this project is to make sure that co_filename is always an absolute path, or to allow otherwise to infer the original location of the source file. In addition, if the module was imported from a byte code file, a mechanism should be provided to also find out what that byte code file was. label: NeedsTest CategoryIdeas Previous Trac Tracker Next Trouve Page