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
Xavier Thompson
cython
Commits
0d241078
Commit
0d241078
authored
Sep 17, 2020
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Detect syntax errors involving 'mutable' at parsing time
parent
99130c77
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
0 deletions
+5
-0
Cython/Compiler/Parsing.py
Cython/Compiler/Parsing.py
+5
-0
No files found.
Cython/Compiler/Parsing.py
View file @
0d241078
...
...
@@ -51,6 +51,7 @@ class Ctx(object):
namespace
=
None
templates
=
None
allow_struct_enum_decorator
=
False
modifiers
=
[]
def
__init__
(
self
,
**
kwds
):
self
.
__dict__
.
update
(
kwds
)
...
...
@@ -2861,6 +2862,8 @@ def p_c_func_declarator(s, pos, ctx, base, cmethod_flag):
exc_val
,
exc_check
=
p_exception_value_clause
(
s
)
with_gil
=
p_with_gil
(
s
)
is_const_method
=
p_cpp_const_method
(
s
,
ctx
)
if
'mutable'
in
ctx
.
modifiers
:
s
.
error
(
"Functions cannot be 'mutable'"
)
return
Nodes
.
CFuncDeclaratorNode
(
pos
,
base
=
base
,
args
=
args
,
has_varargs
=
ellipsis
,
exception_value
=
exc_val
,
exception_check
=
exc_check
,
...
...
@@ -3365,6 +3368,8 @@ def p_c_func_or_var_declaration(s, pos, ctx):
if
ctx
.
level
not
in
(
'module'
,
'c_class'
,
'module_pxd'
,
'c_class_pxd'
,
'cpp_class'
)
and
not
ctx
.
templates
:
s
.
error
(
"C function definition not allowed here"
)
doc
,
suite
=
p_suite_with_docstring
(
s
,
Ctx
(
level
=
'function'
))
if
'mutable'
in
modifiers
:
s
.
error
(
"Functions cannot be 'mutable'"
)
result
=
Nodes
.
CFuncDefNode
(
pos
,
visibility
=
ctx
.
visibility
,
base_type
=
base_type
,
...
...
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