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.

classification
Title: future division isn't propagated
Type: Stage:
Components: Interpreter Core Versions:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: tim.peters Nosy List: gvanrossum, tim.peters
Priority: high Keywords:

Created on 2001-08-17 21:36 by tim.peters, last changed 2022-04-10 16:04 by admin. This issue is now closed.

Messages (3)
msg6038 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2001-08-17 21:36
When I first saw this, I thought it was a bug in the 
PEP 264 patch.  Then I thought it was because 
PyEval_MergeCompilerFlags hadn't been taught about 
CO_FUTURE_DIVISION.  But I just repaired (and checked 
in) the latter, so that's not it either (although that 
was a cause of related bugs).  If it's not more 
obvious to you than it is to me, assign it back to me 
and I'll get back to it later.

C:\Code\python\PCbuild>python
Python 2.2a1+ (#21, Aug 17 2001, 17:16:14) [MSC 32 bit 
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for 
more information.
>>> from __future__ import division
>>> 1/2
0.5
>>> eval("1/2")
0
>>>

The same thing happens if you run it from file:

from __future__ import division
print 1/2
print eval("1/2")

That prints "0.5" and "0".
msg6039 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2001-08-17 21:41
Logged In: YES 
user_id=6380

Looks to me like builtin_eval() doesn't do the necessary
dance to pass in any compiler flags -- it uses the old API,
PyRun_String().
msg6040 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2001-08-17 23:06
Logged In: YES 
user_id=31435

Fixed and Closed (Guido's observation was spot on):

Lib/test/test_binop.py; new revision: 1.2
Python/bltinmodule.c; new revision: 2.229
History
Date User Action Args
2022-04-10 16:04:20adminsetgithub: 34995
2001-08-17 21:36:43tim.peterscreate