Merge lp:~stefanor/ibid/float-maths into lp:~ibid-core/ibid/old-trunk-1.6

Proposed by Stefano Rivera
Status: Merged
Approved by: Jonathan Hitchcock
Approved revision: not available
Merged at revision: 837
Proposed branch: lp:~stefanor/ibid/float-maths
Merge into: lp:~ibid-core/ibid/old-trunk-1.6
Diff against target: 31 lines (+6/-2)
1 file modified
ibid/plugins/maths.py (+6/-2)
To merge this branch: bzr merge lp:~stefanor/ibid/float-maths
Reviewer Review Type Date Requested Status
Jonathan Hitchcock Approve
Michael Gorven Approve
Review via email: mp+17217@code.launchpad.net

This proposal supersedes a proposal from 2010-01-12.

To post a comment you must log in.
Revision history for this message
Jonathan Hitchcock (vhata) : Posted in a previous version of this proposal
review: Approve
Revision history for this message
Michael Gorven (mgorven) wrote :

 review approve

review: Approve
Revision history for this message
Jonathan Hitchcock (vhata) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ibid/plugins/maths.py'
2--- ibid/plugins/maths.py 2010-01-11 22:49:21 +0000
3+++ ibid/plugins/maths.py 2010-01-12 10:58:12 +0000
4@@ -1,4 +1,5 @@
5 from __future__ import division
6+
7 import logging
8 from os import kill
9 import re
10@@ -18,9 +19,12 @@
11
12 except ImportError:
13 from compiler import ast, pycodegen, parse, misc, walk
14+ transform_method='compiler'
15 class NodeTransformer(object):
16 pass
17- transform_method='compiler'
18+ # ExpressionCodeGenerator doesn't inherit __futures__ from calling module:
19+ class FD_ExpressionCodeGenerator(pycodegen.ExpressionCodeGenerator):
20+ futures = ('division',)
21
22 help = {}
23 log = logging.getLogger('maths')
24@@ -161,7 +165,7 @@
25 else:
26 misc.set_filename('<string>', ast)
27 walk(ast, PowSubstitutionWalker())
28- code = pycodegen.ExpressionCodeGenerator(ast).getCode()
29+ code = FD_ExpressionCodeGenerator(ast).getCode()
30
31 result = eval(code, {'__builtins__': None}, self.safe)
32

Subscribers

People subscribed via source and target branches