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
0558bdb4
Commit
0558bdb4
authored
Apr 08, 2017
by
Robert Bradshaw
Committed by
GitHub
Apr 08, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1659 from jdemeyer/pxd_inline_default
Allow "cdef inline" with default values in .pxd
parents
d4f05879
9cb2af37
Changes
3
Hide 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 @
0558bdb4
...
...
@@ -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 @
0558bdb4
...
...
@@ -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 @
0558bdb4
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