Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
4c9dfc86
Commit
4c9dfc86
authored
Mar 16, 2006
by
Thomas Heller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes from Neal Norwitz, plus other small fixes.
parent
12755163
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
8 deletions
+18
-8
Modules/_ctypes/_ctypes.c
Modules/_ctypes/_ctypes.c
+18
-8
No files found.
Modules/_ctypes/_ctypes.c
View file @
4c9dfc86
...
...
@@ -285,6 +285,7 @@ CDataType_from_param(PyObject *type, PyObject *value)
if
(
PyCArg_CheckExact
(
value
))
{
PyCArgObject
*
p
=
(
PyCArgObject
*
)
value
;
PyObject
*
ob
=
p
->
obj
;
const
char
*
ob_name
;
StgDictObject
*
dict
;
dict
=
PyType_stgdict
(
type
);
...
...
@@ -296,10 +297,10 @@ CDataType_from_param(PyObject *type, PyObject *value)
Py_INCREF
(
value
);
return
value
;
}
ob_name
=
(
ob
)
?
ob
->
ob_type
->
tp_name
:
"???"
;
PyErr_Format
(
PyExc_TypeError
,
"expected %s instance instead of pointer to %s"
,
((
PyTypeObject
*
)
type
)
->
tp_name
,
ob
->
ob_type
->
tp_name
);
((
PyTypeObject
*
)
type
)
->
tp_name
,
ob_name
);
return
NULL
;
}
#if 1
...
...
@@ -506,12 +507,12 @@ size property/method, and the sequence protocol.
static
int
PointerType_SetProto
(
StgDictObject
*
stgdict
,
PyObject
*
proto
)
{
if
(
proto
&&
!
PyType_Check
(
proto
))
{
if
(
!
proto
||
!
PyType_Check
(
proto
))
{
PyErr_SetString
(
PyExc_TypeError
,
"_type_ must be a type"
);
return
-
1
;
}
if
(
proto
&&
!
PyType_stgdict
(
proto
))
{
if
(
!
PyType_stgdict
(
proto
))
{
PyErr_SetString
(
PyExc_TypeError
,
"_type_ must have storage info"
);
return
-
1
;
...
...
@@ -1264,10 +1265,14 @@ static PyObject *CreateSwappedType(PyTypeObject *type, PyObject *args, PyObject
PyTypeObject
*
result
;
StgDictObject
*
stgdict
;
PyObject
*
name
=
PyTuple_GET_ITEM
(
args
,
0
);
PyObject
*
swapped_args
=
PyTuple_New
(
PyTuple_GET_SIZE
(
args
))
;
PyObject
*
swapped_args
;
static
PyObject
*
suffix
;
int
i
;
swapped_args
=
PyTuple_New
(
PyTuple_GET_SIZE
(
args
));
if
(
!
swapped_args
)
return
NULL
;
if
(
suffix
==
NULL
)
#ifdef WORDS_BIGENDIAN
suffix
=
PyString_FromString
(
"_le"
);
...
...
@@ -2781,7 +2786,7 @@ _get_arg(int *pindex, char *name, PyObject *defval, PyObject *inargs, PyObject *
static
PyObject
*
_build_callargs
(
CFuncPtrObject
*
self
,
PyObject
*
argtypes
,
PyObject
*
inargs
,
PyObject
*
kwds
,
int
*
poutmask
,
int
*
pinoutmask
,
int
*
pnumretvals
)
int
*
poutmask
,
int
*
pinoutmask
,
unsigned
int
*
pnumretvals
)
{
PyObject
*
paramflags
=
self
->
paramflags
;
PyObject
*
callargs
;
...
...
@@ -2836,6 +2841,7 @@ _build_callargs(CFuncPtrObject *self, PyObject *argtypes,
switch
(
flag
&
(
PARAMFLAG_FIN
|
PARAMFLAG_FOUT
|
PARAMFLAG_FLCID
))
{
case
PARAMFLAG_FIN
|
PARAMFLAG_FLCID
:
/* ['in', 'lcid'] parameter. Always taken from defval */
assert
(
defval
);
Py_INCREF
(
defval
);
PyTuple_SET_ITEM
(
callargs
,
i
,
defval
);
break
;
...
...
@@ -2939,9 +2945,10 @@ _build_callargs(CFuncPtrObject *self, PyObject *argtypes,
*/
static
PyObject
*
_build_result
(
PyObject
*
result
,
PyObject
*
callargs
,
int
outmask
,
int
inoutmask
,
int
numretvals
)
int
outmask
,
int
inoutmask
,
unsigned
int
numretvals
)
{
int
i
,
index
,
bit
;
unsigned
int
i
,
index
;
int
bit
;
PyObject
*
tup
=
NULL
;
if
(
callargs
==
NULL
)
...
...
@@ -2952,6 +2959,7 @@ _build_result(PyObject *result, PyObject *callargs,
}
Py_DECREF
(
result
);
/* tup will not be allocated if numretvals == 1 */
/* allocate tuple to hold the result */
if
(
numretvals
>
1
)
{
tup
=
PyTuple_New
(
numretvals
);
...
...
@@ -3275,6 +3283,8 @@ Struct_init(PyObject *self, PyObject *args, PyObject *kwds)
if
(
!
fields
)
{
PyErr_Clear
();
fields
=
PyTuple_New
(
0
);
if
(
!
fields
)
return
-
1
;
}
if
(
PyTuple_GET_SIZE
(
args
)
>
PySequence_Length
(
fields
))
{
...
...
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