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
27b36693
Commit
27b36693
authored
Jan 24, 2008
by
Thomas Heller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace Py_BuildValue with PyTuple_Pack because it is faster.
Also add a missing DECREF.
parent
b830f78f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
7 deletions
+10
-7
Modules/_ctypes/_ctypes.c
Modules/_ctypes/_ctypes.c
+10
-7
No files found.
Modules/_ctypes/_ctypes.c
View file @
27b36693
...
...
@@ -2523,7 +2523,7 @@ _CData_set(CDataObject *dst, PyObject *type, SETFUNC setfunc, PyObject *value,
only it's object list. So we create a tuple, containing
b_objects list PLUS the array itself, and return that!
*/
return
Py
_BuildValue
(
"(OO)"
,
keep
,
value
);
return
Py
Tuple_Pack
(
2
,
keep
,
value
);
}
PyErr_Format
(
PyExc_TypeError
,
"incompatible types, %s instance instead of %s instance"
,
...
...
@@ -4228,17 +4228,18 @@ CreateArrayType(PyObject *itemtype, Py_ssize_t length)
PyObject
*
key
;
PyObject
*
result
;
char
name
[
256
];
PyObject
*
len
;
if
(
cache
==
NULL
)
{
cache
=
PyDict_New
();
if
(
cache
==
NULL
)
return
NULL
;
}
#if (PY_VERSION_HEX < 0x02050000)
key
=
Py_BuildValue
(
"(Oi)"
,
itemtype
,
length
);
#else
key
=
Py
_BuildValue
(
"(On)"
,
itemtype
,
length
);
#endif
len
=
PyInt_FromSsize_t
(
length
);
if
(
len
==
NULL
)
return
NULL
;
key
=
Py
Tuple_Pack
(
2
,
itemtype
,
len
);
Py_DECREF
(
len
);
if
(
!
key
)
return
NULL
;
result
=
PyDict_GetItemProxy
(
cache
,
key
);
...
...
@@ -4274,8 +4275,10 @@ CreateArrayType(PyObject *itemtype, Py_ssize_t length)
"_type_"
,
itemtype
);
if
(
!
result
)
if
(
result
==
NULL
)
{
Py_DECREF
(
key
);
return
NULL
;
}
if
(
-
1
==
PyDict_SetItemProxy
(
cache
,
key
,
result
))
{
Py_DECREF
(
key
);
Py_DECREF
(
result
);
...
...
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