This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients brett.cannon, eric.snow, ncoghlan, serhiy.storchaka, tcaswell
Date 2017-08-27.06:33:45
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1503815625.46.0.371966845029.issue31286@psf.upfronthosting.co.za>
In-reply-to
Content
The regression was introduced in issue30024. It was missed a difference between LOAD_ATTR and IMPORT_FROM. LOAD_ATTR replaces the object with the value of the attribute (do not changing the stack pointer). IMPORT_FROM keeps the original module on the stack and pushes the value of the attribute increasing the stack pointer.

There are two ways of fixing this issue.

1. Add two instructions ROT_TWO and POP_TOP after every IMPORT_FROM in the bytecode generated from "import a.b.c as d".

2. Make IMPORT_FROM popping the original module from the stack. The explicit DUP_TOP instruction should be inserted before every IMPORT_FROM in the bytecode generated from "from a import b, c".
History
Date User Action Args
2017-08-27 06:33:45serhiy.storchakasetrecipients: + serhiy.storchaka, brett.cannon, ncoghlan, eric.snow, tcaswell
2017-08-27 06:33:45serhiy.storchakasetmessageid: <1503815625.46.0.371966845029.issue31286@psf.upfronthosting.co.za>
2017-08-27 06:33:45serhiy.storchakalinkissue31286 messages
2017-08-27 06:33:45serhiy.storchakacreate