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
c99f5cf7
Commit
c99f5cf7
authored
Jan 11, 2011
by
Alexander Belopolsky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reverted r87944 - issue #5109 should not have been backported
parent
eb7047ad
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
29 deletions
+5
-29
Lib/test/test_array.py
Lib/test/test_array.py
+0
-10
Misc/NEWS
Misc/NEWS
+0
-3
Modules/arraymodule.c
Modules/arraymodule.c
+5
-16
No files found.
Lib/test/test_array.py
View file @
c99f5cf7
...
...
@@ -239,11 +239,6 @@ class BaseTest(unittest.TestCase):
if
a
.
itemsize
>
1
:
self
.
assertRaises
(
ValueError
,
b
.
fromstring
,
"x"
)
def
test_fromarray
(
self
):
a
=
array
.
array
(
self
.
typecode
,
self
.
example
)
b
=
array
.
array
(
self
.
typecode
,
a
)
self
.
assertEqual
(
a
,
b
)
def
test_repr
(
self
):
a
=
array
.
array
(
self
.
typecode
,
2
*
self
.
example
)
self
.
assertEqual
(
a
,
eval
(
repr
(
a
),
{
"array"
:
array
.
array
}))
...
...
@@ -963,11 +958,6 @@ class NumberTest(BaseTest):
self
.
assertRaises
(
AttributeError
,
setattr
,
a
,
"color"
,
"blue"
)
def
test_frombytearray
(
self
):
a
=
array
.
array
(
'b'
,
range
(
10
))
b
=
array
.
array
(
self
.
typecode
,
a
)
self
.
assertEqual
(
a
,
b
)
class
SignedNumberTest
(
NumberTest
):
example
=
[
-
1
,
0
,
1
,
42
,
0x7f
]
smallerexample
=
[
-
1
,
0
,
1
,
42
,
0x7e
]
...
...
Misc/NEWS
View file @
c99f5cf7
...
...
@@ -973,9 +973,6 @@ Library
Extension Modules
-----------------
- Issue #5109: array.array constructor will now use fast code when
initial data is provided in an array object with correct type.
- Issue #7384: If the system readline library is linked against ncurses,
the curses module must be linked against ncurses as well. Otherwise it
is not safe to load both the readline and curses modules in an application.
...
...
Modules/arraymodule.c
View file @
c99f5cf7
...
...
@@ -1925,10 +1925,7 @@ array_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
if
(
!
(
initial
==
NULL
||
PyList_Check
(
initial
)
||
PyString_Check
(
initial
)
||
PyTuple_Check
(
initial
)
||
PyTuple_Check
(
initial
)
||
((
c
==
'u'
)
&&
PyUnicode_Check
(
initial
))
||
(
array_Check
(
initial
)
&&
c
==
((
arrayobject
*
)
initial
)
->
ob_descr
->
typecode
)))
{
||
(
c
==
'u'
&&
PyUnicode_Check
(
initial
))))
{
it
=
PyObject_GetIter
(
initial
);
if
(
it
==
NULL
)
return
NULL
;
...
...
@@ -1944,20 +1941,17 @@ array_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
PyObject
*
a
;
Py_ssize_t
len
;
if
(
initial
==
NULL
)
if
(
initial
==
NULL
||
!
(
PyList_Check
(
initial
)
||
PyTuple_Check
(
initial
)))
len
=
0
;
else
if
(
PyList_Check
(
initial
))
len
=
PyList_GET_SIZE
(
initial
);
else
if
(
PyTuple_Check
(
initial
)
||
array_Check
(
initial
))
len
=
Py_SIZE
(
initial
);
else
len
=
0
;
len
=
PySequence_Size
(
initial
)
;
a
=
newarrayobject
(
type
,
len
,
descr
);
if
(
a
==
NULL
)
return
NULL
;
if
(
len
>
0
&&
!
array_Check
(
initial
)
)
{
if
(
len
>
0
)
{
Py_ssize_t
i
;
for
(
i
=
0
;
i
<
len
;
i
++
)
{
PyObject
*
v
=
...
...
@@ -2007,11 +2001,6 @@ array_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
}
#endif
}
else
if
(
initial
!=
NULL
&&
array_Check
(
initial
))
{
arrayobject
*
self
=
(
arrayobject
*
)
a
;
arrayobject
*
other
=
(
arrayobject
*
)
initial
;
memcpy
(
self
->
ob_item
,
other
->
ob_item
,
len
*
other
->
ob_descr
->
itemsize
);
}
if
(
it
!=
NULL
)
{
if
(
array_iter_extend
((
arrayobject
*
)
a
,
it
)
==
-
1
)
{
Py_DECREF
(
it
);
...
...
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