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
9cb2af37
Commit
9cb2af37
authored
Apr 04, 2017
by
Jeroen Demeyer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow "cdef inline" with default values in .pxd
parent
bd0bd943
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
3 deletions
+13
-3
Cython/Compiler/Parsing.py
Cython/Compiler/Parsing.py
+2
-2
tests/run/inlinepxd.pyx
tests/run/inlinepxd.pyx
+10
-0
tests/run/inlinepxd_support.pxd
tests/run/inlinepxd_support.pxd
+1
-1
No files found.
Cython/Compiler/Parsing.py
View file @
9cb2af37
...
...
@@ -2952,7 +2952,7 @@ def p_c_arg_decl(s, ctx, in_pyfunc, cmethod_flag = 0, nonempty = 0,
annotation
=
p_test
(
s
)
if
s
.
sy
==
'='
:
s
.
next
()
if
'pxd'
in
ctx
.
level
:
if
'pxd'
in
ctx
.
level
and
'inline'
not
in
ctx
.
modifiers
:
if
s
.
sy
not
in
[
'*'
,
'?'
]:
error
(
pos
,
"default values cannot be specified in pxd files, use ? or *"
)
default
=
ExprNodes
.
BoolNode
(
1
)
...
...
@@ -3192,7 +3192,7 @@ def p_c_func_or_var_declaration(s, pos, ctx):
cmethod_flag
=
ctx
.
level
in
(
'c_class'
,
'c_class_pxd'
)
modifiers
=
p_c_modifiers
(
s
)
base_type
=
p_c_base_type
(
s
,
nonempty
=
1
,
templates
=
ctx
.
templates
)
declarator
=
p_c_declarator
(
s
,
ctx
,
cmethod_flag
=
cmethod_flag
,
declarator
=
p_c_declarator
(
s
,
ctx
(
modifiers
=
modifiers
)
,
cmethod_flag
=
cmethod_flag
,
assignable
=
1
,
nonempty
=
1
)
declarator
.
overridable
=
ctx
.
overridable
if
s
.
sy
==
'IDENT'
and
s
.
systring
==
'const'
and
ctx
.
level
==
'cpp_class'
:
...
...
tests/run/inlinepxd.pyx
View file @
9cb2af37
...
...
@@ -5,6 +5,10 @@ __doc__ = u"""
6
>>> h()
6
>>> i()
6
>>> j()
6
"""
cimport
inlinepxd_support
...
...
@@ -18,3 +22,9 @@ def g():
def
h
():
return
my_add3
(
1
,
2
,
3
)
def
i
():
return
my_add3
(
5
)
def
j
():
return
my_add3
(
2
,
4
)
tests/run/inlinepxd_support.pxd
View file @
9cb2af37
cdef
inline
int
my_add
(
int
a
,
int
b
,
int
c
):
cdef
inline
int
my_add
(
int
a
,
int
b
=
1
,
int
c
=
0
):
return
a
+
b
+
c
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