Commits
Click on a commit to change the comparison rangefix(pymodule): improve safety of PyModule::from_code
If `PyImport_ExecCodeModuleEx` is called with an empty filename or
module name, references to any Python variables defined in this
context may break assumptions in standard library code.
Notably, if `inspect.stack()` is called while any stack frame holds
a reference to a variable declared in this Python snippet, and
`file_name` is empty, then `inspect.stack()` will throw while trying
to resolve the file in which said variable was defined.
The `exec` builtin handles this by defaulting `file_name` to `<string>`
and `module_name` to `<module>` - these are not the most obvious
defaults, but in the spirit of consistency and providing pyo3 users with
a safe API, it makes sense for `PyModule::from_code` to do the same.