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
fbcf1901
Commit
fbcf1901
authored
Oct 09, 2014
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix C warnings and C++ errors.
parent
b604debb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
16 deletions
+19
-16
Cython/Compiler/PyrexTypes.py
Cython/Compiler/PyrexTypes.py
+18
-16
Cython/Compiler/UtilityCode.py
Cython/Compiler/UtilityCode.py
+1
-0
No files found.
Cython/Compiler/PyrexTypes.py
View file @
fbcf1901
...
...
@@ -2664,27 +2664,29 @@ class CFuncType(CType):
self
.
type
=
type
self
.
type_name
=
'TYPE%s'
%
ix
self
.
type_cname
=
type
.
declaration_code
(
""
)
if
type
.
is_pyobject
:
self
.
type_name
=
'object'
if
self
.
type
.
is_extension_type
or
self
.
type
.
is_builtin_type
:
self
.
type_convert
=
'<%s>'
%
self
.
type_name
elif
type
.
is_pyobject
:
self
.
type_convert
=
''
else
:
self
.
type_name
=
'TYPE%s'
%
ix
self
.
type_convert
=
'%s_to_py'
%
self
.
type_name
def
declare_type_def
(
self
):
if
self
.
type
.
is_extension_type
:
return
'c
def PyTypeObject* TYPE%s "%s"'
%
(
self
.
ix
,
self
.
type
.
typeptr
_cname
)
if
self
.
type
.
is_extension_type
or
self
.
type
.
is_builtin_type
:
return
'c
typedef void* %s "%s"'
%
(
self
.
type_name
,
self
.
type
_cname
)
elif
self
.
type
.
is_pyobject
:
return
''
else
:
return
'ctypedef struct %s "%s"'
%
(
self
.
type_name
,
self
.
type_cname
)
def
declare_type_convert
(
self
):
if
not
self
.
type
.
is_pyobject
:
if
self
.
type
.
is_extension_type
or
self
.
type
.
is_builtin_type
:
return
'cdef PyTypeObject* %s_TYPE "%s"'
%
(
self
.
type_name
,
self
.
type
.
typeptr_cname
)
elif
self
.
type
.
is_pyobject
:
return
''
else
:
return
'cdef %s %s "%s"(object) except *'
%
(
self
.
type_name
,
self
.
type_convert
,
self
.
type
.
from_py_function
)
def
check_type
(
self
):
if
self
.
type
.
is_extension_type
:
return
'__Pyx_TypeTest(%s, TYPE%s)'
%
(
self
.
name
,
self
.
ix
)
elif
self
.
type
.
is_builtin_type
:
return
'__Pyx_TypeTest(%s, <PyTypeObject*>%s)'
%
(
self
.
name
,
self
.
type
.
name
)
if
self
.
type
.
is_extension_type
or
self
.
type
.
is_builtin_type
:
return
'__Pyx_TypeTest(<PyObject*>%s, %s_TYPE)'
%
(
self
.
name
,
self
.
type_name
)
if
self
.
return_type
is
c_void_type
:
return_type
=
'void'
declare_return_type
=
''
...
...
@@ -2692,19 +2694,19 @@ class CFuncType(CType):
maybe_return
=
''
except_clause
=
'except *'
elif
self
.
return_type
.
is_pyobject
:
return_type
=
'
object
'
declare_return_type
=
'
'
declare_return_type_convert
=
''
maybe_return
=
'return '
return_type
=
'
RETURN_TYPE
'
declare_return_type
=
'
ctypedef void* RETURN_TYPE "%s"'
%
self
.
return_type
.
declaration_code
(
''
)
declare_return_type_convert
=
'
cdef object RETURN_TYPE_from_py "(PyObject*)" (RETURN_TYPE)
'
maybe_return
=
'return
RETURN_TYPE_from_py
'
except_clause
=
''
else
:
if
not
self
.
return_type
.
create_to_py_utility_code
(
env
):
return
False
except_clause
=
'except *'
return_type
=
'RETURN_TYPE'
declare_return_type
=
'ctypedef struct RETURN_TYPE "%s"'
%
self
.
return_type
.
declaration_code
(
""
)
declare_return_type
=
'ctypedef struct RETURN_TYPE "%s"'
%
self
.
return_type
.
declaration_code
(
''
)
declare_return_type_convert
=
'cdef object RETURN_TYPE_from_py "%s" (RETURN_TYPE)'
%
self
.
return_type
.
to_py_function
maybe_return
=
'return RETURN_TYPE_from_py'
except_clause
=
'except *'
context
=
{
'cname'
:
self
.
to_py_function
,
'args'
:
[
Arg
(
ix
,
arg
.
type
)
for
ix
,
arg
in
enumerate
(
self
.
args
)],
...
...
Cython/Compiler/UtilityCode.py
View file @
fbcf1901
...
...
@@ -99,6 +99,7 @@ class CythonUtilityCode(Code.UtilityCodeBase):
context
.
prefix
=
self
.
prefix
context
.
cython_scope
=
cython_scope
#context = StringParseContext(self.name)
print
self
.
impl
tree
=
parse_from_strings
(
self
.
name
,
self
.
impl
,
context
=
context
,
allow_struct_enum_decorator
=
True
)
pipeline
=
Pipeline
.
create_pipeline
(
context
,
'pyx'
,
exclude_classes
=
excludes
)
...
...
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