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
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
9a0acc05
Commit
9a0acc05
authored
Feb 10, 2018
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix compiler crash on an assertion that had better been a safety condition.
Closes #2096.
parent
34b81d54
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
1 deletion
+22
-1
Cython/Compiler/Optimize.py
Cython/Compiler/Optimize.py
+2
-1
tests/run/strmethods.pyx
tests/run/strmethods.pyx
+20
-0
No files found.
Cython/Compiler/Optimize.py
View file @
9a0acc05
...
@@ -2297,10 +2297,11 @@ class OptimizeBuiltinCalls(Visitor.NodeRefCleanupMixin,
...
@@ -2297,10 +2297,11 @@ class OptimizeBuiltinCalls(Visitor.NodeRefCleanupMixin,
arg_count
=
len
(
arg_list
)
arg_count
=
len
(
arg_list
)
if
is_unbound_method
or
arg_count
>=
3
or
not
(
function
.
is_attribute
and
function
.
is_py_attr
):
if
is_unbound_method
or
arg_count
>=
3
or
not
(
function
.
is_attribute
and
function
.
is_py_attr
):
return
node
return
node
if
not
function
.
obj
.
type
.
is_builtin_type
:
return
node
if
function
.
obj
.
type
.
name
in
(
'basestring'
,
'type'
):
if
function
.
obj
.
type
.
name
in
(
'basestring'
,
'type'
):
# these allow different actual types => unsafe
# these allow different actual types => unsafe
return
node
return
node
assert
function
.
obj
.
type
.
is_builtin_type
return
ExprNodes
.
CachedBuiltinMethodCallNode
(
return
ExprNodes
.
CachedBuiltinMethodCallNode
(
node
,
function
.
obj
,
attr_name
,
arg_list
)
node
,
function
.
obj
,
attr_name
,
arg_list
)
...
...
tests/run/strmethods.pyx
View file @
9a0acc05
...
@@ -55,6 +55,26 @@ def str_endswith(str s, sub, start=None, stop=None):
...
@@ -55,6 +55,26 @@ def str_endswith(str s, sub, start=None, stop=None):
return
s
.
endswith
(
sub
,
start
,
stop
)
return
s
.
endswith
(
sub
,
start
,
stop
)
def
object_as_name
(
object
):
"""
>>> object_as_name('abx')
True
>>> object_as_name('abc')
False
"""
return
object
.
endswith
(
"x"
)
def
str_as_name
(
str
):
"""
>>> str_as_name('abx')
True
>>> str_as_name('abc')
False
"""
return
str
.
endswith
(
"x"
)
@
cython
.
test_assert_path_exists
(
@
cython
.
test_assert_path_exists
(
"//SimpleCallNode"
,
"//SimpleCallNode"
,
"//SimpleCallNode//NoneCheckNode"
,
"//SimpleCallNode//NoneCheckNode"
,
...
...
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