Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cython
Commits
07629865
Commit
07629865
authored
Mar 03, 2013
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix reversed order of operands in constant calculation for 'in' and 'not in' operator
parent
e896d20f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
5 deletions
+14
-5
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+2
-5
tests/run/constant_folding.py
tests/run/constant_folding.py
+12
-0
No files found.
Cython/Compiler/ExprNodes.py
View file @
07629865
...
...
@@ -8219,9 +8219,6 @@ class TypeofNode(ExprNode):
#
#-------------------------------------------------------------------
def
_not_in
(
x
,
seq
):
return
x
not
in
seq
compile_time_binary_operators
=
{
'<'
:
operator
.
lt
,
'<='
:
operator
.
le
,
...
...
@@ -8243,8 +8240,8 @@ compile_time_binary_operators = {
'>>'
:
operator
.
rshift
,
'-'
:
operator
.
sub
,
'^'
:
operator
.
xor
,
'in'
:
operator
.
contains
,
'not_in'
:
_not_in
,
'in'
:
lambda
x
,
seq
:
x
in
seq
,
'not_in'
:
lambda
x
,
seq
:
x
not
in
seq
,
}
def
get_compile_time_binop
(
node
):
...
...
tests/run/constant_folding.py
View file @
07629865
...
...
@@ -131,3 +131,15 @@ def str_slicing2():
str3
=
'abc
\
xE9
def'
[
2
:
4
]
return
str0
,
str1
,
str2
,
str3
@
cython
.
test_fail_if_path_exists
(
"//IfStatNode"
,
)
def
str_in_and_not_in
():
"""
>>> str_in_and_not_in()
True
"""
if
'a'
in
'abc'
and
'b'
in
'abc'
and
'c'
in
'abc'
and
'd'
not
in
'abc'
:
return
True
else
:
return
False
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment