FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Regression: Importing __hello__ doesn't print "Hello world!" · Issue #100136 · python/cpython · GitHub

Repository navigation

Regression: Importing __hello__ doesn't print "Hello world!" #100136

Description

Bug report

Importing __hello__ or __phello__ on Python 3.7-3.10 prints "Hello world!"

Importing __hello__ or __phello__ on Python 3.11-3.12 prints nothing.

$ python3.7
Python 3.7.13 (default, Jul  8 2022, 20:05:46)
[Clang 13.1.6 (clang-1316.0.21.2.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import __hello__
Hello world!
>>> import __phello__
Hello world!
>>>
$ python3.8
Python 3.8.13 (default, Apr 26 2022, 16:12:31)
[Clang 13.1.6 (clang-1316.0.21.2.3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import __hello__
Hello world!
>>> import __phello__
Hello world!
>>>
$ python3.9
Python 3.9.13 (main, May 24 2022, 21:13:51)
[Clang 13.1.6 (clang-1316.0.21.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import __hello__
Hello world!
>>> import __phello__
Hello world!
>>>
$ python3.10
Python 3.10.6 (main, Aug 30 2022, 04:58:14) [Clang 13.1.6 (clang-1316.0.21.2.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import __hello__
Hello world!
>>> import __phello__
Hello world!
>>>
$ python3.11
Python 3.11.1 (v3.11.1:a7a450f84a, Dec  6 2022, 15:24:06) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import __hello__
>>> import __phello__
>>> ^D
$ python3.12
Python 3.12.0a3 (v3.12.0a3:b6bd7ffcbc, Dec  6 2022, 15:26:51) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import __hello__
>>> import __phello__
>>> ^D

And at least as early as 3.11.0a2:

$ ./python.exe
Python 3.11.0a2 (tags/v3.11.0a2:e2b4e4bab9, Dec  9 2022, 16:19:07) [Clang 14.0.0 (clang-1400.0.29.102)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import __phello__
>>> import __hello__
>>>

(I couldn't build 3.11.0a1)

Your environment

  • CPython versions tested on: 3.7.13, 3.8.13, 3.9.13, 3.10.6, 3.11.0a2, 3.11.1, 3.12.0a3
  • Operating system and architecture: macOS M1

Activity

  1. added
    type-bugAn unexpected behavior, bug, or error
    3.11only security fixes
    3.12only security fixes
    on Dec 9, 2022
  2. eryksun commented on Dec 9, 2022

    Contributor

    The behavior was intentionally changed by issue #89182 and pull request #28374. __hello__ and __phello__.spam still print to sys.stdout when run as scripts. When imported, main() has to be called. For example:

    >>> import __hello__
    >>> __hello__.main()
    Hello world!
    >>> import __phello__.spam
    >>> __phello__.main()
    Hello world!
    >>> __phello__.spam.main()
    Hello world!
  3. hugovk commented on Dec 9, 2022

    MemberAuthor

    Okay, thanks.

    I saw the old, short and simple version on a list of Python Easter eggs:

    https://github.com/OrkoHunter/python-easter-eggs

    And searching for Python Easter eggs it often shows up as the first one such as 'The Easiest “Hello World”':

    It's less exciting in the new form.

    But fine by me if you'd like to close this as correct behaviour.

  4. eryksun commented on Dec 9, 2022

    Contributor

    At least import this still prints the text of "The Zen of Python".

  5. zware commented on Dec 9, 2022

    Member

    How badly would it break the tests that depend on __hello__ to also call main() if sys.ps1 has a value? Is it worth saving the easter egg? :)

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.11only security fixes3.12only security fixestype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL