Skip to content

bpo-20443: make code objects filename an absolute path#13527

Closed
isidentical wants to merge 8 commits intopython:masterfrom
isidentical:issue20443
Closed

bpo-20443: make code objects filename an absolute path#13527
isidentical wants to merge 8 commits intopython:masterfrom
isidentical:issue20443

Conversation

@isidentical
Copy link
Copy Markdown
Member

@isidentical isidentical commented May 23, 2019

@benjaminp
Copy link
Copy Markdown
Contributor

The compiler isn't an appropriate place to do this. compiler("some", "exec", "<some file>") should return a code object with co_filename == "<some file>".

@isidentical
Copy link
Copy Markdown
Member Author

Then, where to it'll return absolute path? For not breaking backwards compability, we can set up a future flag if it is OK?

@terryjreedy
Copy link
Copy Markdown
Member

Then, where to it'll return absolute path?

I think you meant, where to patch to that co_filename == ? I agree with what Benjamin implied, that the call site should pass in the absolute patch when there is one. The passed-in 'filename' can be anything and does not have to correspond to a real file on external storage.

For not breaking backwards compability, we can set up a future flag if it is OK?

This would definitely require a PEP.

@isidentical
Copy link
Copy Markdown
Member Author

isidentical commented May 25, 2019

This would definitely require a PEP.

I know, i posted to python-ideas.

@vstinner
Copy link
Copy Markdown
Member

I concur with Benjamin: code object constructor is the wrong place to fix the issue. The filename must be made absolute somewhere in the caller. I'm not against https://bugs.python.org/issue20443 I'm only against the proposed implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants