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
57edf105
Commit
57edf105
authored
Aug 18, 2007
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PyObject -> Py_ssize_t now uses __index__ rather than __int__ (even in function signatures)
parent
a51cac49
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
5 deletions
+25
-5
Cython/Compiler/ModuleNode.py
Cython/Compiler/ModuleNode.py
+2
-0
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+22
-4
Cython/Compiler/PyrexTypes.py
Cython/Compiler/PyrexTypes.py
+1
-1
No files found.
Cython/Compiler/ModuleNode.py
View file @
57edf105
...
@@ -173,6 +173,8 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
...
@@ -173,6 +173,8 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
code
.
putln
(
" #define PY_SSIZE_T_MIN INT_MIN"
)
code
.
putln
(
" #define PY_SSIZE_T_MIN INT_MIN"
)
code
.
putln
(
" #define PyInt_FromSsize_t(z) PyInt_FromLong(z)"
)
code
.
putln
(
" #define PyInt_FromSsize_t(z) PyInt_FromLong(z)"
)
code
.
putln
(
" #define PyInt_AsSsize_t(o) PyInt_AsLong(o)"
)
code
.
putln
(
" #define PyInt_AsSsize_t(o) PyInt_AsLong(o)"
)
code
.
putln
(
" #define PyNumber_Index(o) PyNumber_Int(o)"
)
code
.
putln
(
" #define PyIndex_Check(o) PyNumber_Check(o)"
)
code
.
putln
(
"#endif"
)
code
.
putln
(
"#endif"
)
self
.
generate_extern_c_macro_definition
(
code
)
self
.
generate_extern_c_macro_definition
(
code
)
code
.
putln
(
"%s double pow(double, double);"
%
Naming
.
extern_c_macro
)
code
.
putln
(
"%s double pow(double, double);"
%
Naming
.
extern_c_macro
)
...
...
Cython/Compiler/Nodes.py
View file @
57edf105
...
@@ -851,6 +851,12 @@ class DefNode(FuncDefNode):
...
@@ -851,6 +851,12 @@ class DefNode(FuncDefNode):
if
arg
.
is_generic
and
arg
.
type
.
is_extension_type
:
if
arg
.
is_generic
and
arg
.
type
.
is_extension_type
:
arg
.
needs_type_test
=
1
arg
.
needs_type_test
=
1
any_type_tests_needed
=
1
any_type_tests_needed
=
1
elif
arg
.
type
is
PyrexTypes
.
c_py_ssize_t_type
:
# Want to use __index__ rather than __int__ method
# that PyArg_ParseTupleAndKeywords calls
arg
.
needs_conversion
=
1
arg
.
hdr_type
=
PyrexTypes
.
py_object_type
arg
.
hdr_cname
=
Naming
.
arg_prefix
+
arg
.
name
if
any_type_tests_needed
:
if
any_type_tests_needed
:
env
.
use_utility_code
(
arg_type_test_utility_code
)
env
.
use_utility_code
(
arg_type_test_utility_code
)
...
@@ -980,8 +986,12 @@ class DefNode(FuncDefNode):
...
@@ -980,8 +986,12 @@ class DefNode(FuncDefNode):
def
generate_argument_declarations
(
self
,
env
,
code
):
def
generate_argument_declarations
(
self
,
env
,
code
):
for
arg
in
self
.
args
:
for
arg
in
self
.
args
:
if
arg
.
is_generic
:
# or arg.needs_conversion:
if
arg
.
is_generic
:
# or arg.needs_conversion:
if
arg
.
needs_conversion
:
code
.
putln
(
"PyObject *%s = 0;"
%
arg
.
hdr_cname
)
else
:
code
.
put_var_declaration
(
arg
.
entry
)
code
.
put_var_declaration
(
arg
.
entry
)
def
generate_keyword_list
(
self
,
code
):
def
generate_keyword_list
(
self
,
code
):
if
self
.
entry
.
signature
.
has_generic_args
:
if
self
.
entry
.
signature
.
has_generic_args
:
code
.
put
(
code
.
put
(
...
@@ -1015,6 +1025,10 @@ class DefNode(FuncDefNode):
...
@@ -1015,6 +1025,10 @@ class DefNode(FuncDefNode):
default_seen
=
1
default_seen
=
1
elif
default_seen
:
elif
default_seen
:
error
(
arg
.
pos
,
"Non-default argument following default argument"
)
error
(
arg
.
pos
,
"Non-default argument following default argument"
)
if
arg
.
needs_conversion
:
arg_addrs
.
append
(
"&"
+
arg
.
hdr_cname
)
format
=
arg
.
hdr_type
.
parsetuple_format
else
:
arg_addrs
.
append
(
"&"
+
arg_entry
.
cname
)
arg_addrs
.
append
(
"&"
+
arg_entry
.
cname
)
format
=
arg_entry
.
type
.
parsetuple_format
format
=
arg_entry
.
type
.
parsetuple_format
if
format
:
if
format
:
...
@@ -1088,7 +1102,9 @@ class DefNode(FuncDefNode):
...
@@ -1088,7 +1102,9 @@ class DefNode(FuncDefNode):
old_type
=
arg
.
hdr_type
old_type
=
arg
.
hdr_type
new_type
=
arg
.
type
new_type
=
arg
.
type
if
old_type
.
is_pyobject
:
if
old_type
.
is_pyobject
:
code
.
putln
(
"if (%s) {"
%
arg
.
hdr_cname
)
self
.
generate_arg_conversion_from_pyobject
(
arg
,
code
)
self
.
generate_arg_conversion_from_pyobject
(
arg
,
code
)
code
.
putln
(
"}"
)
elif
new_type
.
is_pyobject
:
elif
new_type
.
is_pyobject
:
self
.
generate_arg_conversion_to_pyobject
(
arg
,
code
)
self
.
generate_arg_conversion_to_pyobject
(
arg
,
code
)
else
:
else
:
...
@@ -2602,6 +2618,8 @@ typedef struct {const char *s; const void **p;} __Pyx_CApiTabEntry; /*proto*/
...
@@ -2602,6 +2618,8 @@ typedef struct {const char *s; const void **p;} __Pyx_CApiTabEntry; /*proto*/
typedef struct {PyObject **p; char *s;} __Pyx_InternTabEntry; /*proto*/
typedef struct {PyObject **p; char *s;} __Pyx_InternTabEntry; /*proto*/
typedef struct {PyObject **p; char *s; long n;} __Pyx_StringTabEntry; /*proto*/
typedef struct {PyObject **p; char *s; long n;} __Pyx_StringTabEntry; /*proto*/
#define __pyx_PyIndex_AsSsize_t(b) PyInt_AsSsize_t(PyNumber_Index(b))
#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
static INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
static INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
if (x == Py_True) return 1;
if (x == Py_True) return 1;
...
...
Cython/Compiler/PyrexTypes.py
View file @
57edf105
...
@@ -352,7 +352,7 @@ class CBIntType(CIntType):
...
@@ -352,7 +352,7 @@ class CBIntType(CIntType):
class
CPySSizeTType
(
CIntType
):
class
CPySSizeTType
(
CIntType
):
to_py_function
=
"PyInt_FromSsize_t"
to_py_function
=
"PyInt_FromSsize_t"
from_py_function
=
"
PyInt
_AsSsize_t"
from_py_function
=
"
__pyx_PyIndex
_AsSsize_t"
class
CUIntType
(
CIntType
):
class
CUIntType
(
CIntType
):
...
...
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