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
5d953184
Commit
5d953184
authored
May 16, 2012
by
Stefan Krah
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #14779: Get sizeof(void *) directly rather than relying on sysconfig.
parent
e34a2095
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
4 deletions
+9
-4
Lib/test/test_buffer.py
Lib/test/test_buffer.py
+2
-4
Modules/_testbuffer.c
Modules/_testbuffer.c
+7
-0
No files found.
Lib/test/test_buffer.py
View file @
5d953184
...
...
@@ -747,10 +747,8 @@ if SHORT_TEST:
class
TestBufferProtocol
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
sizeof_void_p
=
get_config_var
(
'SIZEOF_VOID_P'
)
\
if
sys
.
platform
!=
'darwin'
else
None
if
not
self
.
sizeof_void_p
:
self
.
sizeof_void_p
=
8
if
sys
.
maxsize
>
2
**
32
else
4
# The suboffsets tests need sizeof(void *).
self
.
sizeof_void_p
=
get_sizeof_void_p
()
def
verify
(
self
,
result
,
obj
=-
1
,
itemsize
=
{
1
},
fmt
=-
1
,
readonly
=
{
1
},
...
...
Modules/_testbuffer.c
View file @
5d953184
...
...
@@ -2337,6 +2337,12 @@ out:
return
ret
;
}
static
PyObject
*
get_sizeof_void_p
(
PyObject
*
self
)
{
return
PyLong_FromSize_t
(
sizeof
(
void
*
));
}
static
char
get_ascii_order
(
PyObject
*
order
)
{
...
...
@@ -2726,6 +2732,7 @@ static PyTypeObject StaticArray_Type = {
static
struct
PyMethodDef
_testbuffer_functions
[]
=
{
{
"slice_indices"
,
slice_indices
,
METH_VARARGS
,
NULL
},
{
"get_pointer"
,
get_pointer
,
METH_VARARGS
,
NULL
},
{
"get_sizeof_void_p"
,
(
PyCFunction
)
get_sizeof_void_p
,
METH_NOARGS
,
NULL
},
{
"get_contiguous"
,
get_contiguous
,
METH_VARARGS
,
NULL
},
{
"is_contiguous"
,
is_contiguous
,
METH_VARARGS
,
NULL
},
{
"cmp_contig"
,
cmp_contig
,
METH_VARARGS
,
NULL
},
...
...
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