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
a5d9314c
Commit
a5d9314c
authored
Mar 01, 2019
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '0.29.x'
parents
a80d9ce5
02c019e4
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
21 deletions
+32
-21
CHANGES.rst
CHANGES.rst
+10
-0
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+3
-0
tests/run/coverage_nogil.srctree
tests/run/coverage_nogil.srctree
+19
-21
No files found.
CHANGES.rst
View file @
a5d9314c
...
@@ -103,6 +103,16 @@ Other changes
...
@@ -103,6 +103,16 @@ Other changes
*
Support
for
Python
2.6
was
removed
.
*
Support
for
Python
2.6
was
removed
.
0.29.7
(
2019
-
0
?-??)
===================
Bugs
fixed
----------
*
Coverage
reporting
did
not
include
the
signature
line
of
``
cdef
``
functions
.
(
Github
issue
#
1461
)
0.29.6
(
2019
-
02
-
27
)
0.29.6
(
2019
-
02
-
27
)
===================
===================
...
...
Cython/Compiler/Nodes.py
View file @
a5d9314c
...
@@ -2687,6 +2687,9 @@ class CFuncDefNode(FuncDefNode):
...
@@ -2687,6 +2687,9 @@ class CFuncDefNode(FuncDefNode):
self
.
generate_arg_none_check
(
arg
,
code
)
self
.
generate_arg_none_check
(
arg
,
code
)
def
generate_execution_code
(
self
,
code
):
def
generate_execution_code
(
self
,
code
):
if
code
.
globalstate
.
directives
[
'linetrace'
]:
code
.
mark_pos
(
self
.
pos
)
code
.
putln
(
""
)
# generate line tracing code
super
(
CFuncDefNode
,
self
).
generate_execution_code
(
code
)
super
(
CFuncDefNode
,
self
).
generate_execution_code
(
code
)
if
self
.
py_func_stat
:
if
self
.
py_func_stat
:
self
.
py_func_stat
.
generate_execution_code
(
code
)
self
.
py_func_stat
.
generate_execution_code
(
code
)
...
...
tests/run/coverage_nogil.srctree
View file @
a5d9314c
...
@@ -25,7 +25,7 @@ plugins = Cython.Coverage
...
@@ -25,7 +25,7 @@ plugins = Cython.Coverage
# cython: linetrace=True
# cython: linetrace=True
# distutils: define_macros=CYTHON_TRACE=1 CYTHON_TRACE_NOGIL=1
# distutils: define_macros=CYTHON_TRACE=1 CYTHON_TRACE_NOGIL=1
cdef int func1(int a, int b) nogil:
cdef int func1(int a, int b) nogil:
# 4
cdef int x # 5
cdef int x # 5
with gil: # 6
with gil: # 6
x = 1 # 7
x = 1 # 7
...
@@ -33,11 +33,11 @@ cdef int func1(int a, int b) nogil:
...
@@ -33,11 +33,11 @@ cdef int func1(int a, int b) nogil:
return x + c # 9
return x + c # 9
cdef int func2(int a) with gil:
cdef int func2(int a) with gil:
# 12
return a * 2 # 13
return a * 2 # 13
def call(int a, int b):
def call(int a, int b):
# 16
a, b = b, a # 17
a, b = b, a # 17
with nogil: # 18
with nogil: # 18
result = func1(b, a) # 19
result = func1(b, a) # 19
...
@@ -56,20 +56,18 @@ except ImportError:
...
@@ -56,20 +56,18 @@ except ImportError:
from coverage import coverage
from coverage import coverage
import coverage_test_nogil
def run_coverage():
cov = coverage()
assert not any(coverage_test_nogil.__file__.endswith(ext)
cov.start()
for ext in '.py .pyc .pyo .pyw .pyx .pxi'.split()), \
coverage_test_nogil.__file__
def run_coverage(module):
import coverage_test_nogil as module
module_name = module.__name__
module_name = module.__name__
module_path = module_name + '.pyx'
module_path = module_name + '.pyx'
assert not any(module.__file__.endswith(ext)
cov = coverage()
for ext in '.py .pyc .pyo .pyw .pyx .pxi'.split()), \
cov.start()
module.__file__
assert module.call(1, 2) == (1 * 2) + 2 + 1
assert module.call(1, 2) == (1 * 2) + 2 + 1
cov.stop()
cov.stop()
out = StringIO()
out = StringIO()
...
@@ -84,10 +82,10 @@ def run_coverage(module):
...
@@ -84,10 +82,10 @@ def run_coverage(module):
executed = set(exec_lines) - set(missing_lines)
executed = set(exec_lines) - set(missing_lines)
# check that everything that runs with the gil owned was executed
# check that everything that runs with the gil owned was executed
assert all(line in executed for line in [1
3
, 17, 18, 20]), '%s / %s' % (exec_lines, missing_lines)
assert all(line in executed for line in [1
2, 13, 16
, 17, 18, 20]), '%s / %s' % (exec_lines, missing_lines)
# check that everything that runs in nogil sections was executed
# check that everything that runs in nogil sections was executed
assert all(line in executed for line in [6, 7, 8, 9]), '%s / %s' % (exec_lines, missing_lines)
assert all(line in executed for line in [
4,
6, 7, 8, 9]), '%s / %s' % (exec_lines, missing_lines)
if __name__ == '__main__':
if __name__ == '__main__':
run_coverage(
coverage_test_nogil
)
run_coverage()
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