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
5817f8f7
Commit
5817f8f7
authored
Dec 09, 1996
by
Roger E. Masse
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed some unneeded header files and reedited with a fixed-width font
from emacs as per recomendation from GvR
parent
8c0710fd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
14 deletions
+19
-14
Modules/arraymodule.c
Modules/arraymodule.c
+19
-14
No files found.
Modules/arraymodule.c
View file @
5817f8f7
...
...
@@ -35,8 +35,7 @@ PERFORMANCE OF THIS SOFTWARE.
The item type is restricted to simple C types like int or float */
#include "Python.h"
#include "modsupport.h"
#include "ceval.h"
#ifdef STDC_HEADERS
#include <stddef.h>
#else
...
...
@@ -327,7 +326,8 @@ ins1(self, where, v)
if
((
*
self
->
ob_descr
->
setitem
)(
self
,
-
1
,
v
)
<
0
)
return
-
1
;
items
=
self
->
ob_item
;
PyMem_RESIZE
(
items
,
char
,
(
self
->
ob_size
+
1
)
*
self
->
ob_descr
->
itemsize
);
PyMem_RESIZE
(
items
,
char
,
(
self
->
ob_size
+
1
)
*
self
->
ob_descr
->
itemsize
);
if
(
items
==
NULL
)
{
PyErr_NoMemory
();
return
-
1
;
...
...
@@ -780,7 +780,8 @@ array_remove(self, args)
}
for (i = 0; i < self->ob_size; i++) {
if (PyObject_Compare(self->ob_item[i], args) == 0) {
if (array_ass_slice(self, i, i+1, (PyObject *)NULL) != 0)
if (array_ass_slice(self, i, i+1,
(PyObject *)NULL) != 0)
return NULL;
Py_INCREF(Py_None);
return Py_None;
...
...
@@ -945,7 +946,8 @@ array_fromstring(self, args)
}
self
->
ob_item
=
item
;
self
->
ob_size
+=
n
;
memcpy
(
item
+
(
self
->
ob_size
-
n
)
*
itemsize
,
str
,
itemsize
*
n
);
memcpy
(
item
+
(
self
->
ob_size
-
n
)
*
itemsize
,
str
,
itemsize
*
n
);
}
Py_INCREF
(
Py_None
);
return
Py_None
;
...
...
@@ -997,8 +999,10 @@ array_getattr(a, name)
if
(
strcmp
(
name
,
"__members__"
)
==
0
)
{
PyObject
*
list
=
PyList_New
(
2
);
if
(
list
)
{
PyList_SetItem
(
list
,
0
,
PyString_FromString
(
"typecode"
));
PyList_SetItem
(
list
,
1
,
PyString_FromString
(
"itemsize"
));
PyList_SetItem
(
list
,
0
,
PyString_FromString
(
"typecode"
));
PyList_SetItem
(
list
,
1
,
PyString_FromString
(
"itemsize"
));
if
(
PyErr_Occurred
())
{
Py_DECREF
(
list
);
list
=
NULL
;
...
...
@@ -1082,10 +1086,10 @@ array_repr(a)
}
static
PySequenceMethods
array_as_sequence
=
{
(
inquiry
)
array_length
,
/*sq_length*/
(
binaryfunc
)
array_concat
,
/*sq_concat*/
(
inquiry
)
array_length
,
/*sq_length*/
(
binaryfunc
)
array_concat
,
/*sq_concat*/
(
intargfunc
)
array_repeat
,
/*sq_repeat*/
(
intargfunc
)
array_item
,
/*sq_item*/
(
intargfunc
)
array_item
,
/*sq_item*/
(
intintargfunc
)
array_slice
,
/*sq_slice*/
(
intobjargproc
)
array_ass_item
,
/*sq_ass_item*/
(
intintobjargproc
)
array_ass_slice
,
/*sq_ass_slice*/
...
...
@@ -1097,9 +1101,9 @@ statichere PyTypeObject Arraytype = {
"array"
,
sizeof
(
arrayobject
),
0
,
(
destructor
)
array_dealloc
,
/*tp_dealloc*/
(
destructor
)
array_dealloc
,
/*tp_dealloc*/
(
printfunc
)
array_print
,
/*tp_print*/
(
getattrfunc
)
array_getattr
,
/*tp_getattr*/
(
getattrfunc
)
array_getattr
,
/*tp_getattr*/
0
,
/*tp_setattr*/
(
cmpfunc
)
array_compare
,
/*tp_compare*/
(
reprfunc
)
array_repr
,
/*tp_repr*/
...
...
@@ -1123,7 +1127,7 @@ a_array(self, args)
return
NULL
;
if
(
!
PyList_Check
(
initial
)
&&
!
PyString_Check
(
initial
))
{
PyErr_SetString
(
PyExc_TypeError
,
"array initializer must be list or string"
);
"array initializer must be list or string"
);
return
NULL
;
}
}
...
...
@@ -1161,7 +1165,8 @@ a_array(self, args)
return
a
;
}
}
PyErr_SetString
(
PyExc_ValueError
,
"bad typecode (must be c, b, h, l, f or d)"
);
PyErr_SetString
(
PyExc_ValueError
,
"bad typecode (must be c, b, h, l, f or d)"
);
return
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