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
1757506c
Commit
1757506c
authored
Jan 31, 2011
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cache constant 'slice' instances
parent
cb858c83
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
0 deletions
+13
-0
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+13
-0
No files found.
Cython/Compiler/ExprNodes.py
View file @
1757506c
...
...
@@ -2724,10 +2724,21 @@ class SliceNode(ExprNode):
self
.
start
=
self
.
start
.
coerce_to_pyobject
(
env
)
self
.
stop
=
self
.
stop
.
coerce_to_pyobject
(
env
)
self
.
step
=
self
.
step
.
coerce_to_pyobject
(
env
)
if
self
.
start
.
is_literal
and
self
.
stop
.
is_literal
and
self
.
step
.
is_literal
:
self
.
is_literal
=
True
self
.
is_temp
=
False
gil_message
=
"Constructing Python slice object"
def
calculate_result_code
(
self
):
return
self
.
result_code
def
generate_result_code
(
self
,
code
):
if
self
.
is_literal
:
self
.
result_code
=
code
.
get_py_const
(
py_object_type
,
'slice_'
,
cleanup_level
=
2
)
code
=
code
.
get_cached_constants_writer
()
code
.
mark_pos
(
self
.
pos
)
code
.
putln
(
"%s = PySlice_New(%s, %s, %s); %s"
%
(
self
.
result
(),
...
...
@@ -2736,6 +2747,8 @@ class SliceNode(ExprNode):
self
.
step
.
py_result
(),
code
.
error_goto_if_null
(
self
.
result
(),
self
.
pos
)))
code
.
put_gotref
(
self
.
py_result
())
if
self
.
is_literal
:
code
.
put_giveref
(
self
.
py_result
())
class
CallNode
(
ExprNode
):
...
...
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