This repository has been archived by the owner on Jan 30, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
47 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
tarball=cython-VERSION.tar.bz2 | ||
sha1=9728545db586559ff736a18183c57e419ad18b4a | ||
md5=7838eac2e779d60fe4eefab920f54f31 | ||
cksum=650483743 | ||
tarball=Cython-VERSION.tar.gz | ||
sha1=fb22442bd23acb26b6a803bad0dd6746cbb602f3 | ||
md5=6563dad21e2b5e31f9f7262a60dd0550 | ||
cksum=988879217 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
0.19.1.p0 | ||
0.20.p0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
diff --git a/Cython/Compiler/Optimize.py b/Cython/Compiler/Optimize.py | ||
index cefcef4..f1a55e2 100644 | ||
--- a/Cython/Compiler/Optimize.py | ||
+++ b/Cython/Compiler/Optimize.py | ||
@@ -3378,22 +3378,25 @@ class ConstantFolding(Visitor.VisitorTransform, SkipDeclarations): | ||
return new_node | ||
|
||
def visit_MulNode(self, node): | ||
- self._calculate_const(node) | ||
if isinstance(node.operand1, (ExprNodes.ListNode, ExprNodes.TupleNode)): | ||
- return self._calculate_constant_seq(node.operand1, node.operand2) | ||
+ sequence_node = node.operand1 | ||
+ factor = node.operand2 | ||
+ self._calculate_const(factor) | ||
+ if factor.constant_result != 1 and sequence_node.args: | ||
+ sequence_node.mult_factor = factor | ||
+ self.visitchildren(sequence_node) | ||
+ return sequence_node | ||
if isinstance(node.operand1, ExprNodes.IntNode) and \ | ||
- isinstance(node.operand2, (ExprNodes.ListNode, ExprNodes.TupleNode)): | ||
- return self._calculate_constant_seq(node.operand2, node.operand1) | ||
+ isinstance(node.operand2, (ExprNodes.ListNode, ExprNodes.TupleNode)): | ||
+ sequence_node = node.operand2 | ||
+ factor = node.operand1 | ||
+ self._calculate_const(factor) | ||
+ if factor.constant_result != 1 and sequence_node.args: | ||
+ sequence_node.mult_factor = factor | ||
+ self.visitchildren(sequence_node) | ||
+ return sequence_node | ||
return self.visit_BinopNode(node) | ||
|
||
- def _calculate_constant_seq(self, sequence_node, factor): | ||
- if factor.constant_result != 1 and sequence_node.args: | ||
- if isinstance(factor.constant_result, (int, long)) and factor.constant_result <= 0: | ||
- del sequence_node.args[:] | ||
- factor = None | ||
- sequence_node.mult_factor = factor | ||
- return sequence_node | ||
- | ||
def visit_PrimaryCmpNode(self, node): | ||
# calculate constant partial results in the comparison cascade | ||
self.visitchildren(node, ['operand1']) |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.