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
0846423a
Commit
0846423a
authored
Oct 09, 2014
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup.
parent
fbcf1901
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
17 deletions
+14
-17
Cython/Compiler/PyrexTypes.py
Cython/Compiler/PyrexTypes.py
+14
-16
Cython/Compiler/UtilityCode.py
Cython/Compiler/UtilityCode.py
+0
-1
No files found.
Cython/Compiler/PyrexTypes.py
View file @
0846423a
...
...
@@ -2652,6 +2652,7 @@ class CFuncType(CType):
import
re
safe_typename
=
re
.
sub
(
'[^a-zA-Z0-9]'
,
'__'
,
self
.
declaration_code
(
""
,
pyrex
=
1
))
self
.
to_py_function
=
"__Pyx_CFunc_%s_to_py"
%
safe_typename
for
arg
in
self
.
args
:
if
not
arg
.
type
.
is_pyobject
and
not
arg
.
type
.
create_from_py_utility_code
(
env
):
return
False
...
...
@@ -2671,12 +2672,8 @@ class CFuncType(CType):
else
:
self
.
type_convert
=
'%s_to_py'
%
self
.
type_name
def
declare_type_def
(
self
):
if
self
.
type
.
is_extension_type
or
self
.
type
.
is_builtin_type
:
if
self
.
type
.
is_extension_type
or
self
.
type
.
is_builtin_type
or
not
self
.
type
.
is_pyobject
:
return
'ctypedef 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
self
.
type
.
is_extension_type
or
self
.
type
.
is_builtin_type
:
return
'cdef PyTypeObject* %s_TYPE "%s"'
%
(
self
.
type_name
,
self
.
type
.
typeptr_cname
)
...
...
@@ -2687,26 +2684,27 @@ class CFuncType(CType):
def
check_type
(
self
):
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
=
''
declare_return_type_convert
=
''
maybe_return
=
''
except_clause
=
'except *'
elif
self
.
return_type
.
is_pyobject
:
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
if
self
.
return_type
.
is_pyobject
:
to_py
=
'(PyObject*)'
except_clause
=
''
else
:
if
not
self
.
return_type
.
create_to_py_utility_code
(
env
):
return
False
to_py
=
self
.
return_type
.
to_py_function
except_clause
=
'except *'
return_type
=
'RETURN_TYPE'
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
declare_return_type
=
'ctypedef
void*
RETURN_TYPE "%s"'
%
self
.
return_type
.
declaration_code
(
''
)
declare_return_type_convert
=
'cdef object RETURN_TYPE_from_py "%s" (RETURN_TYPE)'
%
to_py
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 @
0846423a
...
...
@@ -99,7 +99,6 @@ 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