Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New REPL sets global __package__ to '_pyrepl' #123973

Open
sobolevn opened this issue Sep 11, 2024 · 3 comments
Open

New REPL sets global __package__ to '_pyrepl' #123973

sobolevn opened this issue Sep 11, 2024 · 3 comments
Labels
topic-repl Related to the interactive shell

Comments

@sobolevn
Copy link
Member

Python 3.14.0a0 (heads/main-dirty:a2d0818c85c, Sep 10 2024, 22:19:41) [Clang 15.0.0 (clang-1500.3.9.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> __package__
'_pyrepl'
Python 3.11.9 (main, Jun 29 2024, 11:57:49) [Clang 15.0.0 (clang-1500.3.9.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> __package__ is None
True

I am not sure that this is a bug. But it might be.
Please, feel free to close if this is expected.

@sobolevn sobolevn added the topic-repl Related to the interactive shell label Sep 11, 2024
@sobolevn
Copy link
Member Author

This also happens:

>>> import inspect
>>> def func():
...     frame = inspect.currentframe()
...     print(frame.f_globals)
...     
>>> func()
{'__package__': '_pyrepl', ...}

@sobolevn
Copy link
Member Author

cc @ambv and @pablogsal

@pablogsal
Copy link
Member

I'm not fully sure this qualifies as a bug. Unsetting this can be quite painful because it can mess up with using PyREPL as a module which we use quite often to check for coverage or profile.

@ambv what do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic-repl Related to the interactive shell
Projects
None yet
Development

No branches or pull requests

2 participants