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
95bf3e76
Commit
95bf3e76
authored
Mar 03, 2019
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '0.29.x'
parents
9470dab5
61505ce4
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
7 deletions
+27
-7
CHANGES.rst
CHANGES.rst
+3
-0
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+11
-2
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+3
-1
tests/errors/e_nogilfunctype.pyx
tests/errors/e_nogilfunctype.pyx
+10
-4
No files found.
CHANGES.rst
View file @
95bf3e76
...
...
@@ -112,6 +112,9 @@ Bugs fixed
*
Coverage
reporting
did
not
include
the
signature
line
of
``
cdef
``
functions
.
(
Github
issue
#
1461
)
*
Casting
a
GIL
-
requiring
function
into
a
nogil
function
now
issues
a
warning
.
(
Github
issue
#
2879
)
0.29.6
(
2019
-
02
-
27
)
===================
...
...
Cython/Compiler/ExprNodes.py
View file @
95bf3e76
...
...
@@ -10448,7 +10448,8 @@ class TypecastNode(ExprNode):
error
(
self
.
pos
,
"Python objects cannot be cast from pointers of primitive types"
)
else
:
# Should this be an error?
warning
(
self
.
pos
,
"No conversion from %s to %s, python object pointer used."
%
(
self
.
operand
.
type
,
self
.
type
))
warning
(
self
.
pos
,
"No conversion from %s to %s, python object pointer used."
%
(
self
.
operand
.
type
,
self
.
type
))
self
.
operand
=
self
.
operand
.
coerce_to_simple
(
env
)
elif
from_py
and
not
to_py
:
if
self
.
type
.
create_from_py_utility_code
(
env
):
...
...
@@ -10457,7 +10458,8 @@ class TypecastNode(ExprNode):
if
not
(
self
.
type
.
base_type
.
is_void
or
self
.
type
.
base_type
.
is_struct
):
error
(
self
.
pos
,
"Python objects cannot be cast to pointers of primitive types"
)
else
:
warning
(
self
.
pos
,
"No conversion from %s to %s, python object pointer used."
%
(
self
.
type
,
self
.
operand
.
type
))
warning
(
self
.
pos
,
"No conversion from %s to %s, python object pointer used."
%
(
self
.
type
,
self
.
operand
.
type
))
elif
from_py
and
to_py
:
if
self
.
typecheck
:
self
.
operand
=
PyTypeTestNode
(
self
.
operand
,
self
.
type
,
env
,
notnone
=
True
)
...
...
@@ -10469,6 +10471,13 @@ class TypecastNode(ExprNode):
elif
self
.
operand
.
type
.
is_fused
:
self
.
operand
=
self
.
operand
.
coerce_to
(
self
.
type
,
env
)
#self.type = self.operand.type
if
self
.
type
.
is_ptr
and
self
.
type
.
base_type
.
is_cfunction
and
self
.
type
.
base_type
.
nogil
:
op_type
=
self
.
operand
.
type
if
op_type
.
is_ptr
:
op_type
=
op_type
.
base_type
if
op_type
.
is_cfunction
and
not
op_type
.
nogil
:
warning
(
self
.
pos
,
"Casting a GIL-requiring function into a nogil function circumvents GIL validation"
,
1
)
return
self
def
is_simple
(
self
):
...
...
Cython/Compiler/Nodes.py
View file @
95bf3e76
...
...
@@ -7580,12 +7580,14 @@ class TryFinallyStatNode(StatNode):
code
.
funcstate
.
in_try_finally
=
was_in_try_finally
code
.
putln
(
"}"
)
code
.
set_all_labels
(
old_labels
)
temps_to_clean_up
=
code
.
funcstate
.
all_free_managed_temps
()
code
.
mark_pos
(
self
.
finally_clause
.
pos
)
code
.
putln
(
"/*finally:*/ {"
)
# Reset labels only after writing out a potential line trace call for correct nogil error handling.
code
.
set_all_labels
(
old_labels
)
def
fresh_finally_clause
(
_next
=
[
self
.
finally_clause
]):
# generate the original subtree once and always keep a fresh copy
node
=
_next
[
0
]
...
...
tests/errors/e_nogilfunctype.pyx
View file @
95bf3e76
# mode: error
# tag: warnings
cdef
extern
from
*
:
cdef
void
f
()
cdef
void
(
*
fp
)()
nogil
cdef
void
f
()
cdef
void
(
*
fp
)()
nogil
ctypedef
void
(
*
fp_t
)()
nogil
fp
=
f
fp
=
<
fp_t
>
f
_ERRORS
=
u"""
7:5: Cannot assign type 'void (void)' to 'void (*)(void) nogil'
9:5: Cannot assign type 'void (void)' to 'void (*)(void) nogil'
"""
_WARNINGS
=
"""
10:5: Casting a GIL-requiring function into a nogil function circumvents GIL validation
"""
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