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
fb0630cf
Commit
fb0630cf
authored
Dec 08, 2020
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Raise a proper exception when runtime isolation check fails
parent
d9ca179c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
1 deletion
+13
-1
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+13
-1
No files found.
Cython/Compiler/ExprNodes.py
View file @
fb0630cf
...
...
@@ -11357,6 +11357,7 @@ class ConsumeNode(ExprNode):
#
# operand ExprNode
#
# nogil boolean used internally
# generate_runtime_check boolean used internally
# operand_is_named boolean used internally
...
...
@@ -11370,6 +11371,7 @@ class ConsumeNode(ExprNode):
return
operand_type
def
analyse_types
(
self
,
env
):
self
.
nogil
=
env
.
nogil
self
.
operand
=
self
.
operand
.
analyse_types
(
env
)
operand_type
=
self
.
operand
.
type
if
not
operand_type
.
is_cyp_class
:
...
...
@@ -11415,7 +11417,17 @@ class ConsumeNode(ExprNode):
code
.
putln
(
"%s = %s;"
%
(
self
.
result
(),
operand_result
))
if
self
.
generate_runtime_check
:
code
.
putln
(
"if (!%s->CyObject_iso()) {"
%
self
.
result
())
code
.
putln
(
"std::terminate();"
)
if
self
.
nogil
:
code
.
putln
(
"#ifdef WITH_THREAD"
)
code
.
putln
(
"PyGILState_STATE _save = PyGILState_Ensure();"
)
code
.
putln
(
"#endif"
)
code
.
putln
(
"PyErr_SetString(PyExc_TypeError,
\
"
'consume' operand is not isolated
\
"
);"
)
if
self
.
nogil
:
code
.
putln
(
"#ifdef WITH_THREAD"
)
code
.
putln
(
"PyGILState_Release(_save);"
)
code
.
putln
(
"#endif"
)
code
.
putln
(
code
.
error_goto
(
self
.
pos
))
code
.
putln
(
"}"
)
# We steal the reference of the operand.
code
.
putln
(
"%s = NULL;"
%
operand_result
)
...
...
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