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
94938586
Commit
94938586
authored
Sep 02, 2015
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix static methods declared in pxd files.
parent
061b132e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
2 deletions
+17
-2
CHANGES.rst
CHANGES.rst
+2
-0
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+2
-2
tests/run/static_methods.pyx
tests/run/static_methods.pyx
+13
-0
No files found.
CHANGES.rst
View file @
94938586
...
@@ -23,6 +23,8 @@ Bugs fixed
...
@@ -23,6 +23,8 @@ Bugs fixed
* ``ino_t`` in ``posix.types`` was not declared as ``unsigned``.
* ``ino_t`` in ``posix.types`` was not declared as ``unsigned``.
* Static cdef methods can now be declared in .pxd files.
0.23.1 (2015-08-22)
0.23.1 (2015-08-22)
===================
===================
...
...
Cython/Compiler/Nodes.py
View file @
94938586
...
@@ -1327,13 +1327,13 @@ class CVarDefNode(StatNode):
...
@@ -1327,13 +1327,13 @@ class CVarDefNode(StatNode):
error
(
declarator
.
pos
,
"Missing name in declaration."
)
error
(
declarator
.
pos
,
"Missing name in declaration."
)
return
return
if
type
.
is_cfunction
:
if
type
.
is_cfunction
:
if
'staticmethod'
in
env
.
directives
:
type
.
is_static_method
=
True
self
.
entry
=
dest_scope
.
declare_cfunction
(
name
,
type
,
declarator
.
pos
,
self
.
entry
=
dest_scope
.
declare_cfunction
(
name
,
type
,
declarator
.
pos
,
cname
=
cname
,
visibility
=
self
.
visibility
,
in_pxd
=
self
.
in_pxd
,
cname
=
cname
,
visibility
=
self
.
visibility
,
in_pxd
=
self
.
in_pxd
,
api
=
self
.
api
,
modifiers
=
self
.
modifiers
,
overridable
=
self
.
overridable
)
api
=
self
.
api
,
modifiers
=
self
.
modifiers
,
overridable
=
self
.
overridable
)
if
self
.
entry
is
not
None
:
if
self
.
entry
is
not
None
:
self
.
entry
.
directive_locals
=
copy
.
copy
(
self
.
directive_locals
)
self
.
entry
.
directive_locals
=
copy
.
copy
(
self
.
directive_locals
)
if
'staticmethod'
in
env
.
directives
:
type
.
is_static_method
=
True
if
create_extern_wrapper
:
if
create_extern_wrapper
:
self
.
entry
.
type
.
create_to_py_utility_code
(
env
)
self
.
entry
.
type
.
create_to_py_utility_code
(
env
)
self
.
entry
.
create_wrapper
=
True
self
.
entry
.
create_wrapper
=
True
...
...
tests/run/static_methods.pyx
View file @
94938586
...
@@ -50,3 +50,16 @@ def call_static_cdef(int x):
...
@@ -50,3 +50,16 @@ def call_static_cdef(int x):
# ('cpdef', 2)
# ('cpdef', 2)
# """
# """
# return A.static_cpdef(x)
# return A.static_cpdef(x)
cdef
class
FromPxd
:
@
staticmethod
cdef
static_cdef
(
int
*
x
):
return
'pxd_cdef'
,
x
[
0
]
def
call_static_pxd_cdef
(
int
x
):
"""
>>> call_static_pxd_cdef(2)
('pxd_cdef', 2)
"""
cdef
int
*
x_ptr
=
&
x
return
FromPxd
.
static_cdef
(
x_ptr
)
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