diff options
author | Jeremy Hylton <jeremy@alum.mit.edu> | 2001-09-17 16:41:02 +0000 |
---|---|---|
committer | Jeremy Hylton <jeremy@alum.mit.edu> | 2001-09-17 16:41:02 +0000 |
commit | b696648d69f40527e7d81f48ef09ad053558bdab (patch) | |
tree | 89103c1f923e1a5c39d88fbe8bdb1093b9b4f98d /Tools/compiler | |
parent | 01fa634ba2d434cec1c3229de2e914b42b33c816 (diff) | |
download | cpython-b696648d69f40527e7d81f48ef09ad053558bdab.tar.gz |
support true division
Diffstat (limited to 'Tools/compiler')
-rw-r--r-- | Tools/compiler/compiler/pycodegen.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Tools/compiler/compiler/pycodegen.py b/Tools/compiler/compiler/pycodegen.py index 0097482447..a019828e9e 100644 --- a/Tools/compiler/compiler/pycodegen.py +++ b/Tools/compiler/compiler/pycodegen.py @@ -161,12 +161,14 @@ class CodeGenerator: self.maxStack = 0 self.last_lineno = None self._setupGraphDelegation() + self._div_op = "BINARY_DIVIDE" # XXX set flags based on future features futures = self.get_module().futures for feature in futures: if feature == "division": self.graph.setFlag(CO_FUTURE_DIVISION) + self._div_op = "BINARY_TRUE_DIVIDE" elif feature == "generators": self.graph.setFlag(CO_GENERATOR_ALLOWED) @@ -975,7 +977,7 @@ class CodeGenerator: return self.binaryOp(node, 'BINARY_MULTIPLY') def visitDiv(self, node): - return self.binaryOp(node, 'BINARY_DIVIDE') + return self.binaryOp(node, self._div_op) def visitFloorDiv(self, node): return self.binaryOp(node, 'BINARY_FLOOR_DIVIDE') |