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
468cc9c1
Commit
468cc9c1
authored
Oct 12, 2014
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix wrapping of pointer types.
Of course it's "cdef char *foo()" not "cdef char* foo()"
parent
1cd370dc
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
7 deletions
+22
-7
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+5
-6
Cython/Compiler/PyrexTypes.py
Cython/Compiler/PyrexTypes.py
+4
-1
tests/run/cpdef_extern_func.pxd
tests/run/cpdef_extern_func.pxd
+3
-0
tests/run/cpdef_extern_func.pyx
tests/run/cpdef_extern_func.pyx
+10
-0
No files found.
Cython/Compiler/Nodes.py
View file @
468cc9c1
...
...
@@ -1271,13 +1271,12 @@ class CVarDefNode(StatNode):
"Non-trivial type declarators in shared declaration (e.g. mix of pointers and values). "
+
"Each pointer declaration should be on its own line."
,
1
)
create_extern_wrapper
=
False
if
isinstance
(
declarator
,
CFuncDeclaratorNode
):
create_extern_wrapper
=
(
self
.
overridable
and
self
.
visibility
==
'extern'
and
env
.
is_module_scope
)
if
create_extern_wrapper
:
declarator
.
overridable
=
False
if
isinstance
(
declarator
,
CFuncDeclaratorNode
):
name_declarator
,
type
=
declarator
.
analyse
(
base_type
,
env
,
directive_locals
=
self
.
directive_locals
)
else
:
name_declarator
,
type
=
declarator
.
analyse
(
base_type
,
env
)
...
...
Cython/Compiler/PyrexTypes.py
View file @
468cc9c1
...
...
@@ -1236,6 +1236,9 @@ class CConstType(BaseType):
def
declaration_code
(
self
,
entity_code
,
for_display
=
0
,
dll_linkage
=
None
,
pyrex
=
0
):
if
for_display
or
pyrex
:
return
"const "
+
self
.
const_base_type
.
declaration_code
(
entity_code
,
for_display
,
dll_linkage
,
pyrex
)
else
:
return
self
.
const_base_type
.
declaration_code
(
"const %s"
%
entity_code
,
for_display
,
dll_linkage
,
pyrex
)
def
specialize
(
self
,
values
):
...
...
tests/run/cpdef_extern_func.pxd
View file @
468cc9c1
# cython: c_string_type=str
# cython: c_string_encoding=ascii
cdef
extern
from
"math.h"
:
cpdef
double
pxd_sqrt
"sqrt"
(
double
)
tests/run/cpdef_extern_func.pyx
View file @
468cc9c1
# cython: c_string_type=str
# cython: c_string_encoding=ascii
__doc__
=
"""
>>> sqrt(1)
1.0
...
...
@@ -7,10 +10,17 @@ __doc__ = """
3.0
>>> log(10)
Traceback (most recent call last):
...
NameError: name 'log' is not defined
>>> strchr('abcabc', ord('c'))
'cabc'
"""
cdef
extern
from
"math.h"
:
cpdef
double
sqrt
(
double
)
cpdef
double
pyx_sqrt
"sqrt"
(
double
)
cdef
double
log
(
double
)
# not wrapped
cdef
extern
from
"string.h"
:
cpdef
char
*
strchr
(
const
char
*
haystack
,
int
needle
);
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