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
d0762282
Commit
d0762282
authored
Jul 12, 2007
by
Thomas Heller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change the StgDictObject's proto member to a PyUnicode_Object (was a
PyStringObject before).
parent
2c5e9646
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
17 deletions
+9
-17
Modules/_ctypes/_ctypes.c
Modules/_ctypes/_ctypes.c
+9
-17
No files found.
Modules/_ctypes/_ctypes.c
View file @
d0762282
...
...
@@ -414,6 +414,7 @@ StructType_setattro(PyObject *self, PyObject *key, PyObject *value)
return
-
1
;
if
(
value
&&
PyUnicode_Check
(
key
)
&&
/* XXX struni PyUnicode_AsString can fail (also in other places)! */
0
==
strcmp
(
PyUnicode_AsString
(
key
),
"_fields_"
))
return
StructUnionType_update_stgdict
(
self
,
value
,
1
);
return
0
;
...
...
@@ -1339,10 +1340,10 @@ c_void_p_from_param(PyObject *type, PyObject *value)
}
/* c_char_p, c_wchar_p */
stgd
=
PyObject_stgdict
(
value
);
if
(
stgd
&&
CDataObject_Check
(
value
)
&&
stgd
->
proto
&&
Py
String
_Check
(
stgd
->
proto
))
{
if
(
stgd
&&
CDataObject_Check
(
value
)
&&
stgd
->
proto
&&
Py
Unicode
_Check
(
stgd
->
proto
))
{
PyCArgObject
*
parg
;
switch
(
Py
String_AS_STRING
(
stgd
->
proto
)[
0
])
{
switch
(
Py
Unicode_AsString
(
stgd
->
proto
)[
0
])
{
case
'z'
:
/* c_char_p */
case
'Z'
:
/* c_wchar_p */
parg
=
new_CArgObject
();
...
...
@@ -1511,16 +1512,7 @@ SimpleType_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
goto
error
;
proto_str
=
PyString_AS_STRING
(
v
);
proto_len
=
PyString_GET_SIZE
(
v
);
}
else
if
(
PyString_Check
(
proto
))
{
proto_str
=
PyString_AS_STRING
(
proto
);
proto_len
=
PyString_GET_SIZE
(
proto
);
}
else
if
(
PyBytes_Check
(
proto
))
{
proto_str
=
PyBytes_AS_STRING
(
proto
);
proto_len
=
PyBytes_GET_SIZE
(
proto
);
}
else
{
}
else
{
PyErr_SetString
(
PyExc_TypeError
,
"class must define a '_type_' string attribute"
);
goto
error
;
...
...
@@ -2681,9 +2673,9 @@ _check_outarg_type(PyObject *arg, Py_ssize_t index)
dict
=
PyType_stgdict
(
arg
);
if
(
dict
/* simple pointer types, c_void_p, c_wchar_p, BSTR, ... */
&&
Py
String
_Check
(
dict
->
proto
)
&&
Py
Unicode
_Check
(
dict
->
proto
)
/* We only allow c_void_p, c_char_p and c_wchar_p as a simple output parameter type */
&&
(
strchr
(
"PzZ"
,
Py
String_AS_STRING
(
dict
->
proto
)[
0
])))
{
&&
(
strchr
(
"PzZ"
,
Py
Unicode_AsString
(
dict
->
proto
)[
0
])))
{
return
1
;
}
...
...
@@ -3183,7 +3175,7 @@ _build_callargs(CFuncPtrObject *self, PyObject *argtypes,
"NULL stgdict unexpected"
);
goto
error
;
}
if
(
Py
String
_Check
(
dict
->
proto
))
{
if
(
Py
Unicode
_Check
(
dict
->
proto
))
{
PyErr_Format
(
PyExc_TypeError
,
"%s 'out' parameter must be passed as default value"
,
...
...
@@ -4594,8 +4586,8 @@ cast_check_pointertype(PyObject *arg)
return
1
;
dict
=
PyType_stgdict
(
arg
);
if
(
dict
)
{
if
(
Py
String
_Check
(
dict
->
proto
)
&&
(
strchr
(
"sPzUZXO"
,
Py
String_AS_STRING
(
dict
->
proto
)[
0
])))
{
if
(
Py
Unicode
_Check
(
dict
->
proto
)
&&
(
strchr
(
"sPzUZXO"
,
Py
Unicode_AsString
(
dict
->
proto
)[
0
])))
{
/* simple pointer types, c_void_p, c_wchar_p, BSTR, ... */
return
1
;
}
...
...
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