You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
inspect.getsource returns irrelevant text when used in repl on a class defined in place #126019
"built-in" is misleading here. That's actually a regular module.
We could check object.__spec__ (which is None for modules created in the REPL like you did). If there is a __spec__ then object.__spec__.origin can point to a source file, contain the string "(built-in)" or the string "(frozen)". That would allow for a better description of the module type in the error message.
Activity
devdanzin commentedon Oct 27, 2024
Seems related to #122071 and its associated issues, probably due to how linecache works.
evle-zzz commentedon Oct 28, 2024
Just in case, similar small issue nearby:
"built-in" is misleading here. That's actually a regular module.
devdanzin commentedon Oct 28, 2024
We could check
object.__spec__(which isNonefor modules created in the REPL like you did). If there is a__spec__thenobject.__spec__.origincan point to a source file, contain the string "(built-in)" or the string "(frozen)". That would allow for a better description of the module type in the error message.Should we open a new issue for this?