msg131499 - (view) |
Author: STINNER Victor (vstinner) * |
Date: 2011-03-20 15:15 |
import __hello__ doesn't print any message!!!
|
msg131500 - (view) |
Author: Andreas Stührk (Trundle) * |
Date: 2011-03-20 15:33 |
That was changed in [a2213060d9dd], see issue #1414.
|
msg132123 - (view) |
Author: Éric Araujo (eric.araujo) * |
Date: 2011-03-25 17:47 |
What’s import __hello__? I don’t have it in any version from 2.4 to 3.2.
|
msg132127 - (view) |
Author: Éric Araujo (eric.araujo) * |
Date: 2011-03-25 17:52 |
Okay, it doesn’t work with -m __hello__, but using -c "import __hello__" I can see the message in all versions.
|
msg132221 - (view) |
Author: Andreas Stührk (Trundle) * |
Date: 2011-03-26 10:01 |
On Fri, Mar 25, 2011 at 5:52 PM, Éric Araujo <report@bugs.python.org> wrote:
> Okay, it doesn’t work with -m __hello__, but using -c "import __hello__" I can see the message in all versions.
Can you elaborate on that? I.e. the versions and the actual message.
The current bytecode of the __hello__ module is (default branch):
1 0 LOAD_CONST 1 (True)
3 STORE_NAME 1 (initialized)
6 LOAD_CONST 0 (None)
9 RETURN_VALUE
I'd be a bit surprised if that really prints a message.
|
msg132370 - (view) |
Author: Éric Araujo (eric.araujo) * |
Date: 2011-03-27 22:07 |
I can see the message (“Hello world...”) in 2.4 to 2.7, but actually not in 3.x.
|
msg135860 - (view) |
Author: Georg Brandl (georg.brandl) * |
Date: 2011-05-12 20:36 |
Why is this still open, and more importantly, why is it a release blocker?
|
msg135864 - (view) |
Author: STINNER Victor (vstinner) * |
Date: 2011-05-12 20:44 |
> Why is this still open
Because import __hello__ doesn't print hello.
> and more importantly, why is it a release blocker?
Because it is a very important issue!
|
msg135868 - (view) |
Author: Andreas Stührk (Trundle) * |
Date: 2011-05-12 21:24 |
A patch against 3.1. The new bytecode is now:
1 0 LOAD_CONST 2 (True)
3 STORE_NAME 1 (initialized)
2 6 LOAD_NAME 2 (print)
9 LOAD_CONST 0 ('Hello world...')
12 CALL_FUNCTION 1
15 POP_TOP
16 LOAD_CONST 1 (None)
19 RETURN_VALUE
|
msg135869 - (view) |
Author: STINNER Victor (vstinner) * |
Date: 2011-05-12 21:40 |
+print("Hello world...")
I would prefer a more positive "Hello World!", but thanks for the patch.
|
msg136095 - (view) |
Author: Roundup Robot (python-dev) |
Date: 2011-05-16 14:35 |
New changeset 44fd95cead7b by Victor Stinner in branch '3.1':
Issue #11614: import __hello__ prints "Hello World!". Patch written by Andreas
http://hg.python.org/cpython/rev/44fd95cead7b
New changeset 2c5736e8a221 by Victor Stinner in branch '3.2':
(Merge 3.1) Issue #11614: import __hello__ prints "Hello World!". Patch written
http://hg.python.org/cpython/rev/2c5736e8a221
New changeset 79c49d2fc768 by Victor Stinner in branch 'default':
(Merge 3.2) Issue #11614: import __hello__ prints "Hello World!". Patch written
http://hg.python.org/cpython/rev/79c49d2fc768
|
msg136096 - (view) |
Author: STINNER Victor (vstinner) * |
Date: 2011-05-16 14:37 |
Thanks Andreas for your fix! Python 3 is now better than Python 2: it prints "Hello World!" instead of "Hello World...".
|
msg136101 - (view) |
Author: Roundup Robot (python-dev) |
Date: 2011-05-16 15:01 |
New changeset 9e1d7cd15d2e by Victor Stinner in branch '3.1':
Issue #11614: Fix importlib tests for the new __hello__ module
http://hg.python.org/cpython/rev/9e1d7cd15d2e
New changeset 6119f6cc9b2d by Victor Stinner in branch '3.2':
(Merge 3.1) Issue #11614: Fix importlib tests for the new __hello__ module
http://hg.python.org/cpython/rev/6119f6cc9b2d
New changeset b61a1cd4943b by Victor Stinner in branch 'default':
(Merge 3.2) Issue #11614: Fix importlib tests for the new __hello__ module
http://hg.python.org/cpython/rev/b61a1cd4943b
|
msg136105 - (view) |
Author: Roundup Robot (python-dev) |
Date: 2011-05-16 15:20 |
New changeset 9a4d4506680a by Victor Stinner in branch '3.1':
Issue #11614: Fix test_linecache, cjkencodings_test.py doesn't exist anymore
http://hg.python.org/cpython/rev/9a4d4506680a
New changeset 43cbfacae463 by Victor Stinner in branch '3.2':
(Merge 3.1) Issue #11614: Fix test_linecache, cjkencodings_test.py doesn't
http://hg.python.org/cpython/rev/43cbfacae463
New changeset 06473da99270 by Victor Stinner in branch 'default':
(Merge 3.2) Issue #11614: Fix test_linecache, cjkencodings_test.py doesn't
http://hg.python.org/cpython/rev/06473da99270
|
msg136107 - (view) |
Author: STINNER Victor (vstinner) * |
Date: 2011-05-16 15:23 |
> New changeset 9a4d4506680a by Victor Stinner in branch '3.1':
> Issue #11614: Fix test_linecache, cjkencodings_test.py doesn't exist anymore
Oh, these commits are related to #12057, not this one.
|
msg136131 - (view) |
Author: Roundup Robot (python-dev) |
Date: 2011-05-16 23:19 |
New changeset 47bc3509f76b by Victor Stinner in branch '2.7':
Issue #11614: Fix test_linecache, cjkencodings_test.py doesn't exist anymore
http://hg.python.org/cpython/rev/47bc3509f76b
|
msg337352 - (view) |
Author: Solomon Ucko (Solomon Ucko) |
Date: 2019-03-07 02:43 |
The byte code could be further optimized (because this is such a speed-critical module! :)):
1 0 LOAD_CONST 2 (True)
3 STORE_NAME 1 (initialized)
2 6 LOAD_NAME 2 (print)
9 LOAD_CONST 0 ('Hello world...')
12 CALL_FUNCTION 1
15 RETURN_VALUE
|
msg337385 - (view) |
Author: STINNER Victor (vstinner) * |
Date: 2019-03-07 11:38 |
> The byte code could be further optimized (because this is such a speed-critical module! :)): (...)
You propose to replace
8 CALL_FUNCTION 1
10 POP_TOP
12 LOAD_CONST 2 (None)
14 RETURN_VALUE
with:
12 CALL_FUNCTION 1
15 RETURN_VALUE
It changes the semantics of Python. Technically, you *can* override the print() builtin function:
vstinner@apu$ ./python
Python 3.8.0a2+ (heads/master:dc078947a5, Mar 7 2019, 12:23:23)
>>> import builtins
>>> def mock(*args, **kw): return 3
...
>>> builtins.print=mock
>>> print("hello")
3
>>> import __phello__
>>> # doesn't print anything
...
It would be possible if you ensure that print() isn't replaced.
Longer explanation:
https://fatoptimizer.readthedocs.io/en/latest/semantics.html
To use more efficient bytecode without modying the Python semantics, you need to deoptimize if print() is replaced. I implemented that in my old FAT Python project :-)
https://fatoptimizer.readthedocs.io/en/latest/optimizations.html#call-pure
--
I would be more interested by a tool to update/regenerate M___hello__ in Python/frozen.c.
|
msg337390 - (view) |
Author: Solomon Ucko (Solomon Ucko) |
Date: 2019-03-07 12:05 |
> It changes the semantics of Python.
When would the return value actually matter? Would it affect the value of the variable `__hello__`?
|
|
Date |
User |
Action |
Args |
2022-04-11 14:57:15 | admin | set | github: 55823 |
2019-03-07 12:05:32 | Solomon Ucko | set | messages:
+ msg337390 |
2019-03-07 11:42:36 | pablogsal | set | nosy:
+ pablogsal
|
2019-03-07 11:38:41 | vstinner | set | messages:
+ msg337385 |
2019-03-07 02:43:29 | Solomon Ucko | set | nosy:
+ Solomon Ucko messages:
+ msg337352
|
2011-05-16 23:19:23 | python-dev | set | messages:
+ msg136131 |
2011-05-16 15:23:33 | vstinner | set | messages:
+ msg136107 |
2011-05-16 15:20:54 | python-dev | set | messages:
+ msg136105 |
2011-05-16 15:01:28 | python-dev | set | messages:
+ msg136101 |
2011-05-16 14:37:02 | vstinner | set | status: open -> closed resolution: fixed messages:
+ msg136096
|
2011-05-16 14:35:46 | python-dev | set | nosy:
+ python-dev messages:
+ msg136095
|
2011-05-15 15:47:54 | georg.brandl | set | priority: release blocker -> deferred blocker |
2011-05-12 22:19:03 | Trundle | set | files:
+ issue11614_!.patch |
2011-05-12 21:40:18 | vstinner | set | messages:
+ msg135869 |
2011-05-12 21:24:52 | Trundle | set | files:
+ issue11614.patch keywords:
+ patch messages:
+ msg135868
|
2011-05-12 20:44:53 | vstinner | set | messages:
+ msg135864 |
2011-05-12 20:36:28 | georg.brandl | set | messages:
+ msg135860 |
2011-03-27 22:07:08 | eric.araujo | set | messages:
+ msg132370 |
2011-03-26 10:01:16 | Trundle | set | messages:
+ msg132221 |
2011-03-25 18:15:07 | ezio.melotti | set | nosy:
+ ezio.melotti
|
2011-03-25 17:52:48 | eric.araujo | set | messages:
+ msg132127 |
2011-03-25 17:47:42 | eric.araujo | set | nosy:
+ eric.araujo messages:
+ msg132123
|
2011-03-20 15:33:04 | Trundle | set | nosy:
+ Trundle messages:
+ msg131500
|
2011-03-20 15:15:10 | vstinner | create | |