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
4ac5d2cd
Commit
4ac5d2cd
authored
Sep 19, 2011
by
Mark Dickinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Backport issue #12973 list_repeat fix from 3.x.
parent
dbbed049
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
4 deletions
+6
-4
Misc/NEWS
Misc/NEWS
+3
-1
Objects/listobject.c
Objects/listobject.c
+3
-3
No files found.
Misc/NEWS
View file @
4ac5d2cd
...
...
@@ -12,7 +12,9 @@ Core and Builtins
- Issue #12973: Fix overflow checks that invoked undefined behaviour in
int.__pow__. These overflow checks were causing int.__pow__ to produce
incorrect results with recent versions of Clang, as a result of the
compiler optimizing the check away.
compiler optimizing the check away. Also fix similar overflow check
in list_repeat (which caused test_list to fail with recent versions
of Clang).
- Issue #12266: Fix str.capitalize() to correctly uppercase/lowercase
titlecased and cased non-letter characters.
...
...
Objects/listobject.c
View file @
4ac5d2cd
...
...
@@ -58,7 +58,7 @@ list_resize(PyListObject *self, Py_ssize_t newsize)
if
(
newsize
==
0
)
new_allocated
=
0
;
items
=
self
->
ob_item
;
if
(
new_allocated
<=
(
(
~
(
size_t
)
0
)
/
sizeof
(
PyObject
*
)))
if
(
new_allocated
<=
(
PY_SIZE_MAX
/
sizeof
(
PyObject
*
)))
PyMem_RESIZE
(
items
,
PyObject
*
,
new_allocated
);
else
items
=
NULL
;
...
...
@@ -551,9 +551,9 @@ list_repeat(PyListObject *a, Py_ssize_t n)
PyObject
*
elem
;
if
(
n
<
0
)
n
=
0
;
size
=
Py_SIZE
(
a
)
*
n
;
if
(
n
&&
size
/
n
!=
Py_SIZE
(
a
))
if
(
n
>
0
&&
Py_SIZE
(
a
)
>
PY_SSIZE_T_MAX
/
n
)
return
PyErr_NoMemory
();
size
=
Py_SIZE
(
a
)
*
n
;
if
(
size
==
0
)
return
PyList_New
(
0
);
np
=
(
PyListObject
*
)
PyList_New
(
size
);
...
...
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