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
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
f6fb2ff5
Commit
f6fb2ff5
authored
Aug 24, 2013
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Conversion for extern int types.
parent
5b8971df
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
18 deletions
+22
-18
Cython/Compiler/PyrexTypes.py
Cython/Compiler/PyrexTypes.py
+22
-18
No files found.
Cython/Compiler/PyrexTypes.py
View file @
f6fb2ff5
...
...
@@ -368,11 +368,12 @@ class CTypedefType(BaseType):
if
not
self
.
to_py_utility_code
:
base_type
=
self
.
typedef_base_type
if
type
(
base_type
)
is
CIntType
:
# Various subclasses have special methods
# that should be inherited.
self
.
to_py_utility_code
,
self
.
to_py_function
=
\
self
.
_create_utility_code
(
c_typedef_int_to_py_function
,
'__Pyx_PyInt_to_py_%s'
)
self
.
from_py_function
=
"__Pyx_PyInt_from_py_"
+
self
.
specialization_name
()
env
.
use_utility_code
(
TempitaUtilityCode
.
load
(
"CIntFromPy"
,
"TypeConversion.c"
,
context
=
{
"TYPE"
:
self
.
declaration_code
(
''
),
"FROM_PY_FUNCTION"
:
self
.
from_py_function
}))
return
True
elif
base_type
.
is_float
:
pass
# XXX implement!
elif
base_type
.
is_complex
:
...
...
@@ -389,11 +390,12 @@ class CTypedefType(BaseType):
if
not
self
.
from_py_utility_code
:
base_type
=
self
.
typedef_base_type
if
type
(
base_type
)
is
CIntType
:
# Various subclasses have special methods
# that should be inherited.
self
.
from_py_utility_code
,
self
.
from_py_function
=
\
self
.
_create_utility_code
(
c_typedef_int_from_py_function
,
'__Pyx_PyInt_from_py_%s'
)
self
.
to_py_function
=
"__Pyx_PyInt_to_py_"
+
self
.
specialization_name
()
env
.
use_utility_code
(
TempitaUtilityCode
.
load
(
"CIntToPy"
,
"TypeConversion.c"
,
context
=
{
"TYPE"
:
self
.
declaration_code
(
''
),
"TO_PY_FUNCTION"
:
self
.
to_py_function
}))
return
True
elif
base_type
.
is_float
:
pass
# XXX implement!
elif
base_type
.
is_complex
:
...
...
@@ -1565,18 +1567,20 @@ class CIntType(CNumericType):
# Inject specializatioin used elsewhere.
self
.
get_from_py_type_conversion
()
def
create_from_py_utility_code
(
self
,
env
):
self
.
from_py_function
=
"__Pyx_PyInt_from_py_"
+
self
.
specialization_name
()
env
.
use_utility_code
(
TempitaUtilityCode
.
load
(
"CIntFromPy"
,
"TypeConversion.c"
,
context
=
{
"TYPE"
:
self
.
declaration_code
(
''
),
"FROM_PY_FUNCTION"
:
self
.
from_py_function
}))
return
True
def
create_to_py_utility_code
(
self
,
env
):
self
.
to_py_function
=
"__Pyx_PyInt_to_py_"
+
self
.
specialization_name
()
env
.
use_utility_code
(
TempitaUtilityCode
.
load
(
"CIntToPy"
,
"TypeConversion.c"
,
context
=
{
"TYPE"
:
self
.
declaration_code
(
''
),
"TO_PY_FUNCTION"
:
self
.
to_py_function
}))
context
=
{
"TYPE"
:
self
.
declaration_code
(
''
),
"TO_PY_FUNCTION"
:
self
.
to_py_function
}))
return
True
def
create_from_py_utility_code
(
self
,
env
):
self
.
from_py_function
=
"__Pyx_PyInt_from_py_"
+
self
.
specialization_name
()
env
.
use_utility_code
(
TempitaUtilityCode
.
load
(
"CIntFromPy"
,
"TypeConversion.c"
,
context
=
{
"TYPE"
:
self
.
declaration_code
(
''
),
"FROM_PY_FUNCTION"
:
self
.
from_py_function
}))
return
True
def
get_to_py_type_conversion
(
self
):
...
...
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