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
Gwenaël Samain
cython
Commits
22fc9f8e
Commit
22fc9f8e
authored
8 years ago
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make "binding" directive usable at a per-function level
parent
331ef9d0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
6 deletions
+8
-6
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+1
-1
tests/run/line_profile_test.srctree
tests/run/line_profile_test.srctree
+7
-5
No files found.
Cython/Compiler/Nodes.py
View file @
22fc9f8e
...
...
@@ -3055,7 +3055,7 @@ class DefNode(FuncDefNode):
return
True
if
env
.
is_module_scope
or
env
.
is_c_class_scope
:
if
code
is
None
:
return
env
.
directives
[
'binding'
]
return
self
.
local_scope
.
directives
[
'binding'
]
else
:
return
code
.
globalstate
.
directives
[
'binding'
]
return
env
.
is_py_class_scope
or
env
.
is_closure_scope
...
...
This diff is collapsed.
Click to expand it.
tests/run/line_profile_test.srctree
View file @
22fc9f8e
...
...
@@ -7,10 +7,6 @@ from distutils.extension import Extension
from distutils.core import setup
from Cython.Build import cythonize
from Cython.Compiler.Options import _directive_defaults
_directive_defaults['linetrace'] = True
_directive_defaults['binding'] = True
extensions = [
Extension("collatz", ["collatz.pyx"], define_macros=[('CYTHON_TRACE', '1')])
]
...
...
@@ -74,8 +70,11 @@ assert_stats(profile, func.__name__)
######## collatz.pyx ###########
# cython: binding=True
# cython: linetrace=True
cimport cython
@cython.binding(True)
def collatz(n):
while n > 1:
if n % 2 == 0:
...
...
@@ -84,6 +83,7 @@ def collatz(n):
n = 3*n+1
@cython.binding(True)
cpdef cp_collatz(n):
while n > 1:
if n % 2 == 0:
...
...
@@ -92,6 +92,7 @@ cpdef cp_collatz(n):
n = 3*n+1
@cython.binding(True)
class PyClass(object):
def py_pymethod(self):
x = 1
...
...
@@ -100,6 +101,7 @@ class PyClass(object):
return a * 3
@cython.binding(True)
cdef class CClass:
def c_pymethod(self, c=2):
for i in range(10):
...
...
This diff is collapsed.
Click to expand it.
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