mirror of
https://github.com/python/cpython.git
synced 2025-09-27 02:39:58 +00:00
Issue #25414: Remove unnecessary tests that can never succeed.
This commit is contained in:
parent
6731774216
commit
20151f50f6
1 changed files with 1 additions and 15 deletions
|
@ -110,12 +110,6 @@ static PyTypeObject deque_type;
|
||||||
#define CHECK_NOT_END(link)
|
#define CHECK_NOT_END(link)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* To prevent len from overflowing PY_SSIZE_T_MAX, we refuse to
|
|
||||||
allocate new blocks if the current len is nearing overflow.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define MAX_DEQUE_LEN (PY_SSIZE_T_MAX - 3*BLOCKLEN)
|
|
||||||
|
|
||||||
/* A simple freelisting scheme is used to minimize calls to the memory
|
/* A simple freelisting scheme is used to minimize calls to the memory
|
||||||
allocator. It accommodates common use cases where new blocks are being
|
allocator. It accommodates common use cases where new blocks are being
|
||||||
added at about the same rate as old blocks are being freed.
|
added at about the same rate as old blocks are being freed.
|
||||||
|
@ -128,11 +122,6 @@ static block *freeblocks[MAXFREEBLOCKS];
|
||||||
static block *
|
static block *
|
||||||
newblock(Py_ssize_t len) {
|
newblock(Py_ssize_t len) {
|
||||||
block *b;
|
block *b;
|
||||||
if (len >= MAX_DEQUE_LEN) {
|
|
||||||
PyErr_SetString(PyExc_OverflowError,
|
|
||||||
"cannot add more blocks to the deque");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
if (numfreeblocks) {
|
if (numfreeblocks) {
|
||||||
numfreeblocks--;
|
numfreeblocks--;
|
||||||
return freeblocks[numfreeblocks];
|
return freeblocks[numfreeblocks];
|
||||||
|
@ -676,9 +665,6 @@ deque_inplace_repeat(dequeobject *deque, Py_ssize_t n)
|
||||||
if (deque->maxlen >= 0 && n > deque->maxlen)
|
if (deque->maxlen >= 0 && n > deque->maxlen)
|
||||||
n = deque->maxlen;
|
n = deque->maxlen;
|
||||||
|
|
||||||
if (n > MAX_DEQUE_LEN)
|
|
||||||
return PyErr_NoMemory();
|
|
||||||
|
|
||||||
deque->state++;
|
deque->state++;
|
||||||
for (i = 0 ; i < n-1 ; ) {
|
for (i = 0 ; i < n-1 ; ) {
|
||||||
if (deque->rightindex == BLOCKLEN - 1) {
|
if (deque->rightindex == BLOCKLEN - 1) {
|
||||||
|
@ -709,7 +695,7 @@ deque_inplace_repeat(dequeobject *deque, Py_ssize_t n)
|
||||||
return (PyObject *)deque;
|
return (PyObject *)deque;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((size_t)size > MAX_DEQUE_LEN / (size_t)n) {
|
if ((size_t)size > PY_SSIZE_T_MAX / (size_t)n) {
|
||||||
return PyErr_NoMemory();
|
return PyErr_NoMemory();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue