Issue1230674

classification
Title: eval with from future does not work through import
Type: Severity: normal
Components: Core Versions:
Milestone:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: bzimmer Nosy List: bzimmer, cgroves, fwierzbicki, leouserz
Priority: low Keywords:

Created on 2005-07-01.01:28:46 by fwierzbicki, last changed 2007-04-20.04:24:29 by cgroves.

Messages
msg995 (view) Author: Frank Wierzbicki (fwierzbicki) Date: 2005-07-01.01:28:46
patch 312867 fixed test_long_future.py when run
directly, but it still fails when run by import (the
way regrtest.py runs tests).

$ jython test_long_future.py
long true division

$ jython
Jython 2.2a2 on java1.4.2_07 (JIT: null)
Type "copyright", "credits" or "license" for more
information.
>>> import test_long_future
long true division
Traceback (innermost last):
  File "<console>", line 1, in ?
  File
"/Users/fwier/src/jython/dist/Lib/test/test_long_future.py",
line 55, in ?
  File
"/Users/fwier/src/jython/dist/Lib/test/test_long_future.py",
line 38, in test_true_division
TestFailed: expected OverflowError from 'huge / 1'
>>> ^D
  
msg996 (view) Author: Deleted User leouserz (leouserz) Date: 2007-01-15.20:29:17
I don't have a patch yet, but Im narrowing in on this.  It appears it bombs because the code being generated is not targeting _truediv.  This is because the Future object in Module is reporting false for the areDivisionOn() method.

more later....
msg997 (view) Author: Deleted User leouserz (leouserz) Date: 2007-01-15.20:58:13
hmmm, it seems that the preprocessFuture method results in the future having its division flag set to true.  This is if the type is a Module.  If its Interactive, there doesn't appear to be any setting.... which results in truediv not being used.
msg998 (view) Author: Deleted User leouserz (leouserz) Date: 2007-01-15.21:20:41
no... the last statement is incorrect. :(  If the module is freshly imported it does have its division set to true.  It seems that each eval is being compiled and it does not have any compile flags set.  Im looking at inheriting the flags from the frame with a different compile method but it doesn't appear to solve the problem either.  All Im seeing is 1 set, which is CO_OPTIMIZED.  Arggh.... !!!!
msg999 (view) Author: Deleted User leouserz (leouserz) Date: 2007-01-15.22:49:30
okay, this appears to be a compilation problem.  It seems that there are cases where a CompilerFlags instance is null and it is passed into the Module object.  This results in all flags being ignored, even though the future items like generators or division are not passed onto the PyTableCode.  The compiled code appears to be a static block.  There are 2 solutions I have in mind:
1. In the section where the flags are set up add some logic to check for future and see that division or generators are on.  If so, add to the flags.
2. In null CompilerFlags situations, check the Future object for division or generator.  If on and no CompilerFlags, create one and set its flags.

Ill do both patches and put them in the patch list.

leouser
msg1000 (view) Author: Deleted User leouserz (leouserz) Date: 2007-01-15.22:59:42
patches for this are at:
http://sourceforge.net/tracker/index.php?func=detail&aid=1636300&group_id=12867&atid=312867
msg1001 (view) Author: Charlie Groves (cgroves) Date: 2007-04-20.04:24:29
Fixed in r3173.  
History
Date User Action Args
2005-07-01 01:28:46fwierzbickicreate