[issue11614] import __hello__ is broken in Python 3

2019-03-07 Thread Solomon Ucko


Solomon Ucko  added the comment:

> It changes the semantics of Python.

When would the return value actually matter? Would it affect the value of the 
variable `__hello__`?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11614] import __hello__ is broken in Python 3

2019-03-07 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
nosy: +pablogsal

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11614] import __hello__ is broken in Python 3

2019-03-07 Thread STINNER Victor


STINNER Victor  added the comment:

> The byte code could be further optimized (because this is such a 
> speed-critical module! :)): (...)

You propose to replace

  8 CALL_FUNCTION1
 10 POP_TOP
 12 LOAD_CONST   2 (None)
 14 RETURN_VALUE

with:

 12 CALL_FUNCTION1 
 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.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11614] import __hello__ is broken in Python 3

2019-03-06 Thread Solomon Ucko


Solomon Ucko  added the comment:

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_NAME2 (print) 
  9 LOAD_CONST   0 ('Hello world...') 
 12 CALL_FUNCTION1 
 15 RETURN_VALUE

--
nosy: +Solomon Ucko

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11614] import __hello__ is broken in Python 3

2011-05-16 Thread Roundup Robot

Roundup Robot devnull@devnull added the comment:

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

--
nosy: +python-dev

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11614
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11614] import __hello__ is broken in Python 3

2011-05-16 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

Thanks Andreas for your fix! Python 3 is now better than Python 2: it prints 
Hello World! instead of Hello World

--
resolution:  - fixed
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11614
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11614] import __hello__ is broken in Python 3

2011-05-16 Thread Roundup Robot

Roundup Robot devnull@devnull added the comment:

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

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11614
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11614] import __hello__ is broken in Python 3

2011-05-16 Thread Roundup Robot

Roundup Robot devnull@devnull added the comment:

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

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11614
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11614] import __hello__ is broken in Python 3

2011-05-16 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

 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.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11614
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11614] import __hello__ is broken in Python 3

2011-05-16 Thread Roundup Robot

Roundup Robot devnull@devnull added the comment:

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

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11614
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11614] import __hello__ is broken in Python 3

2011-05-15 Thread Georg Brandl

Changes by Georg Brandl ge...@python.org:


--
priority: release blocker - deferred blocker

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11614
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11614] import __hello__ is broken in Python 3

2011-05-12 Thread Georg Brandl

Georg Brandl ge...@python.org added the comment:

Why is this still open, and more importantly, why is it a release blocker?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11614
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11614] import __hello__ is broken in Python 3

2011-05-12 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

 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!

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11614
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11614] import __hello__ is broken in Python 3

2011-05-12 Thread Andreas Stührk

Andreas Stührk andy-pyt...@hammerhartes.de added the comment:

A patch against 3.1. The new bytecode is now:

  1   0 LOAD_CONST   2 (True) 
  3 STORE_NAME   1 (initialized) 

  2   6 LOAD_NAME2 (print) 
  9 LOAD_CONST   0 ('Hello world...') 
 12 CALL_FUNCTION1 
 15 POP_TOP  
 16 LOAD_CONST   1 (None) 
 19 RETURN_VALUE

--
keywords: +patch
Added file: http://bugs.python.org/file21987/issue11614.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11614
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11614] import __hello__ is broken in Python 3

2011-05-12 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

+print(Hello world...)

I would prefer a more positive Hello World!, but thanks for the patch.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11614
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11614] import __hello__ is broken in Python 3

2011-05-12 Thread Andreas Stührk

Changes by Andreas Stührk andy-pyt...@hammerhartes.de:


Added file: http://bugs.python.org/file21988/issue11614_!.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11614
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11614] import __hello__ is broken in Python 3

2011-03-27 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

I can see the message (“Hello world...”) in 2.4 to 2.7, but actually not in 3.x.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11614
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11614] import __hello__ is broken in Python 3

2011-03-26 Thread Andreas Stührk

Andreas Stührk andy-pyt...@hammerhartes.de added the comment:

On Fri, Mar 25, 2011 at 5:52 PM, Éric Araujo rep...@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.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11614
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11614] import __hello__ is broken in Python 3

2011-03-25 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

What’s import __hello__?  I don’t have it in any version from 2.4 to 3.2.

--
nosy: +eric.araujo

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11614
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11614] import __hello__ is broken in Python 3

2011-03-25 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

Okay, it doesn’t work with -m __hello__, but using -c import __hello__ I can 
see the message in all versions.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11614
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11614] import __hello__ is broken in Python 3

2011-03-25 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


--
nosy: +ezio.melotti

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11614
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11614] import __hello__ is broken in Python 3

2011-03-20 Thread STINNER Victor

New submission from STINNER Victor victor.stin...@haypocalc.com:

import __hello__ doesn't print any message!!!

--
messages: 131499
nosy: benjamin.peterson, georg.brandl, haypo
priority: release blocker
severity: normal
status: open
title: import __hello__ is broken in Python 3
versions: Python 3.1, Python 3.2, Python 3.3, Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11614
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11614] import __hello__ is broken in Python 3

2011-03-20 Thread Andreas Stührk

Andreas Stührk andy-pyt...@hammerhartes.de added the comment:

That was changed in [a2213060d9dd], see issue #1414.

--
nosy: +Trundle

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11614
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com