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
Gwenaël Samain
cython
Commits
bd56216a
Commit
bd56216a
authored
Feb 15, 2019
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '0.29.x'
parents
2f021123
d4ce52c0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
1 deletion
+39
-1
CHANGES.rst
CHANGES.rst
+6
-0
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+2
-1
tests/run/fused_def.pyx
tests/run/fused_def.pyx
+31
-0
No files found.
CHANGES.rst
View file @
bd56216a
...
...
@@ -98,6 +98,12 @@ Other changes
Bugs
fixed
----------
*
Fix
a
crash
when
accessing
the
``
__kwdefaults__
``
special
attribute
of
fused
functions
.
(
Github
issue
#
1470
)
*
Fix
the
parsing
of
buffer
format
strings
that
contain
numeric
sizes
,
which
could
lead
to
incorrect
input
rejections
.
(
Github
issue
#
2845
)
*
Avoid
a
C
#
pragma
in
old
gcc
versions
that
was
only
added
in
GCC
4.6
.
Patch
by
Michael
Anselmi
.
(
Github
issue
#
2838
)
...
...
Cython/Compiler/ExprNodes.py
View file @
bd56216a
...
...
@@ -9465,7 +9465,8 @@ class PyCFunctionNode(ExprNode, ModuleNameMixin):
if
self
.
defaults_kwdict
:
code
.
putln
(
'__Pyx_CyFunction_SetDefaultsKwDict(%s, %s);'
%
(
self
.
result
(),
self
.
defaults_kwdict
.
py_result
()))
if
def_node
.
defaults_getter
:
if
def_node
.
defaults_getter
and
not
self
.
specialized_cpdefs
:
# Fused functions do not support dynamic defaults, only their specialisations can have them for now.
code
.
putln
(
'__Pyx_CyFunction_SetDefaultsGetter(%s, %s);'
%
(
self
.
result
(),
def_node
.
defaults_getter
.
entry
.
pyfunc_cname
))
if
self
.
annotations_dict
:
...
...
tests/run/fused_def.pyx
View file @
bd56216a
...
...
@@ -58,12 +58,21 @@ def opt_func(fused_t obj, cython.floating myf = 1.2, cython.integral myi = 7):
>>> opt_func("spam", f, i)
str object double long
spam 5.60 9 5.60 9
>>> opt_func("spam", f, myi=i)
str object double long
spam 5.60 9 5.60 9
>>> opt_func("spam", myf=f, myi=i)
str object double long
spam 5.60 9 5.60 9
>>> opt_func[str, float, int]("spam", f, i)
str object float int
spam 5.60 9 5.60 9
>>> opt_func[str, cy.double, cy.long]("spam", f, i)
str object double long
spam 5.60 9 5.60 9
>>> opt_func[str, cy.double, cy.long]("spam", f, myi=i)
str object double long
spam 5.60 9 5.60 9
>>> opt_func[str, float, cy.int]("spam", f, i)
str object float int
spam 5.60 9 5.60 9
...
...
@@ -129,6 +138,28 @@ def test_opt_func():
opt_func
(
"ham"
,
f
,
entry4
)
def
test_opt_func_introspection
():
"""
>>> opt_func.__defaults__
(1.2, 7)
>>> opt_func.__kwdefaults__
>>> opt_func.__annotations__
{}
>>> opt_func[str, float, int].__defaults__
(1.2, 7)
>>> opt_func[str, float, int].__kwdefaults__
>>> opt_func[str, float, int].__annotations__
{}
>>> opt_func[str, cy.double, cy.long].__defaults__
(1.2, 7)
>>> opt_func[str, cy.double, cy.long].__kwdefaults__
>>> opt_func[str, cy.double, cy.long].__annotations__
{}
"""
def
func_with_object
(
fused_with_object
obj
,
cython
.
integral
myi
=
7
):
"""
>>> func_with_object(1)
...
...
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