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
97689343
Commit
97689343
authored
May 05, 2020
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add tests that f-strings are rejected in nogil sections.
parent
aed19e49
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
9 deletions
+20
-9
tests/errors/nogil.pyx
tests/errors/nogil.pyx
+20
-9
No files found.
tests/errors/nogil.pyx
View file @
97689343
...
...
@@ -8,14 +8,14 @@ cdef void g(int x) nogil:
cdef
object
z
z
=
None
cdef
void
h
(
int
x
)
nogil
:
cdef
void
h
(
int
x
)
nogil
:
# allowed
p
()
cdef
object
p
()
nogil
:
pass
cdef
void
r
()
nogil
:
q
()
cdef
void
r
()
nogil
:
# allowed
q
()
# allowed
cdef
object
m
():
cdef
object
x
,
y
=
0
,
obj
...
...
@@ -23,11 +23,11 @@ cdef object m():
global
fred
q
()
with
nogil
:
r
()
r
()
# allowed to call plain C functions
q
()
i
=
42
i
=
42
# allowed with type inference
obj
=
None
17L
17L
# allowed
<
object
>
7j
help
xxx
=
`"Hello"`
...
...
@@ -45,7 +45,7 @@ cdef object m():
{
x
,
y
}
obj
and
x
t
(
obj
)
# f(42) # Cython handles this internally
f
(
42
)
x
+
obj
-
obj
x
=
y
=
obj
...
...
@@ -90,8 +90,13 @@ def bare_pyvar_name(object x):
with
nogil
:
x
# For m(), the important thing is that there are errors on all lines in the range 23-69
# except these: 29, 34, 44, 56, 58, 60, 62-64
cdef
int
fstrings
(
int
x
,
object
obj
)
nogil
except
-
1
:
f""
# allowed
f"a"
# allowed
f"a"f"b"
# allowed
f"
{
x
}
"
f"
{
obj
}
"
_ERRORS
=
u"""
4:5: Function with Python return type cannot be declared nogil
...
...
@@ -133,6 +138,7 @@ _ERRORS = u"""
46:12: Discarding owned Python object not allowed without gil
46:12: Truth-testing Python object not allowed without gil
47:10: Python type test not allowed without gil
48:9: Discarding owned Python object not allowed without gil
49:10: Discarding owned Python object not allowed without gil
49:10: Operation not allowed without gil
50:8: Discarding owned Python object not allowed without gil
...
...
@@ -158,4 +164,9 @@ _ERRORS = u"""
63:24: Coercion from Python not allowed without the GIL
65:8: Try-except statement not allowed without gil
86:8: For-loop using object bounds or target not allowed without gil
97:4: Discarding owned Python object not allowed without gil
97:4: String formatting not allowed without gil
98:4: Discarding owned Python object not allowed without gil
98:4: String formatting not allowed without gil
"""
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