mirror of
				https://github.com/python/cpython.git
				synced 2025-11-03 19:34:08 +00:00 
			
		
		
		
	merge 3.3
This commit is contained in:
		
						commit
						ff0f322edb
					
				
					 2 changed files with 12 additions and 16 deletions
				
			
		| 
						 | 
					@ -91,6 +91,8 @@ Library
 | 
				
			||||||
- Issue #23796: peek and read1 methods of BufferedReader now raise ValueError
 | 
					- Issue #23796: peek and read1 methods of BufferedReader now raise ValueError
 | 
				
			||||||
  if they called on a closed object. Patch by John Hergenroeder.
 | 
					  if they called on a closed object. Patch by John Hergenroeder.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- Fix possible integer overflows in the pickle module.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- Issue #22931: Allow '[' and ']' in cookie values.
 | 
					- Issue #22931: Allow '[' and ']' in cookie values.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- Issue #20274: Remove ignored and erroneous "kwargs" parameters from three
 | 
					- Issue #20274: Remove ignored and erroneous "kwargs" parameters from three
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -428,9 +428,7 @@ Pdata_grow(Pdata *self)
 | 
				
			||||||
    if (new_allocated > PY_SSIZE_T_MAX - allocated)
 | 
					    if (new_allocated > PY_SSIZE_T_MAX - allocated)
 | 
				
			||||||
        goto nomemory;
 | 
					        goto nomemory;
 | 
				
			||||||
    new_allocated += allocated;
 | 
					    new_allocated += allocated;
 | 
				
			||||||
    if (new_allocated > (PY_SSIZE_T_MAX / sizeof(PyObject *)))
 | 
					    PyMem_RESIZE(data, PyObject *, new_allocated);
 | 
				
			||||||
        goto nomemory;
 | 
					 | 
				
			||||||
    data = PyMem_REALLOC(data, new_allocated * sizeof(PyObject *));
 | 
					 | 
				
			||||||
    if (data == NULL)
 | 
					    if (data == NULL)
 | 
				
			||||||
        goto nomemory;
 | 
					        goto nomemory;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -660,7 +658,7 @@ PyMemoTable_Copy(PyMemoTable *self)
 | 
				
			||||||
    /* The table we get from _New() is probably smaller than we wanted.
 | 
					    /* The table we get from _New() is probably smaller than we wanted.
 | 
				
			||||||
       Free it and allocate one that's the right size. */
 | 
					       Free it and allocate one that's the right size. */
 | 
				
			||||||
    PyMem_FREE(new->mt_table);
 | 
					    PyMem_FREE(new->mt_table);
 | 
				
			||||||
    new->mt_table = PyMem_MALLOC(self->mt_allocated * sizeof(PyMemoEntry));
 | 
					    new->mt_table = PyMem_NEW(PyMemoEntry, self->mt_allocated);
 | 
				
			||||||
    if (new->mt_table == NULL) {
 | 
					    if (new->mt_table == NULL) {
 | 
				
			||||||
        PyMem_FREE(new);
 | 
					        PyMem_FREE(new);
 | 
				
			||||||
        PyErr_NoMemory();
 | 
					        PyErr_NoMemory();
 | 
				
			||||||
| 
						 | 
					@ -755,7 +753,7 @@ _PyMemoTable_ResizeTable(PyMemoTable *self, Py_ssize_t min_size)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* Allocate new table. */
 | 
					    /* Allocate new table. */
 | 
				
			||||||
    oldtable = self->mt_table;
 | 
					    oldtable = self->mt_table;
 | 
				
			||||||
    self->mt_table = PyMem_MALLOC(new_size * sizeof(PyMemoEntry));
 | 
					    self->mt_table = PyMem_NEW(PyMemoEntry, new_size);
 | 
				
			||||||
    if (self->mt_table == NULL) {
 | 
					    if (self->mt_table == NULL) {
 | 
				
			||||||
        self->mt_table = oldtable;
 | 
					        self->mt_table = oldtable;
 | 
				
			||||||
        PyErr_NoMemory();
 | 
					        PyErr_NoMemory();
 | 
				
			||||||
| 
						 | 
					@ -1261,16 +1259,14 @@ static int
 | 
				
			||||||
_Unpickler_ResizeMemoList(UnpicklerObject *self, Py_ssize_t new_size)
 | 
					_Unpickler_ResizeMemoList(UnpicklerObject *self, Py_ssize_t new_size)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    Py_ssize_t i;
 | 
					    Py_ssize_t i;
 | 
				
			||||||
    PyObject **memo;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert(new_size > self->memo_size);
 | 
					    assert(new_size > self->memo_size);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    memo = PyMem_REALLOC(self->memo, new_size * sizeof(PyObject *));
 | 
					    PyMem_RESIZE(self->memo, PyObject *, new_size);
 | 
				
			||||||
    if (memo == NULL) {
 | 
					    if (self->memo == NULL) {
 | 
				
			||||||
        PyErr_NoMemory();
 | 
					        PyErr_NoMemory();
 | 
				
			||||||
        return -1;
 | 
					        return -1;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    self->memo = memo;
 | 
					 | 
				
			||||||
    for (i = self->memo_size; i < new_size; i++)
 | 
					    for (i = self->memo_size; i < new_size; i++)
 | 
				
			||||||
        self->memo[i] = NULL;
 | 
					        self->memo[i] = NULL;
 | 
				
			||||||
    self->memo_size = new_size;
 | 
					    self->memo_size = new_size;
 | 
				
			||||||
| 
						 | 
					@ -1314,7 +1310,7 @@ _Unpickler_MemoPut(UnpicklerObject *self, Py_ssize_t idx, PyObject *value)
 | 
				
			||||||
static PyObject **
 | 
					static PyObject **
 | 
				
			||||||
_Unpickler_NewMemo(Py_ssize_t new_size)
 | 
					_Unpickler_NewMemo(Py_ssize_t new_size)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    PyObject **memo = PyMem_MALLOC(new_size * sizeof(PyObject *));
 | 
					    PyObject **memo = PyMem_NEW(PyObject *, new_size);
 | 
				
			||||||
    if (memo == NULL) {
 | 
					    if (memo == NULL) {
 | 
				
			||||||
        PyErr_NoMemory();
 | 
					        PyErr_NoMemory();
 | 
				
			||||||
        return NULL;
 | 
					        return NULL;
 | 
				
			||||||
| 
						 | 
					@ -5963,7 +5959,6 @@ load_mark(UnpicklerObject *self)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if ((self->num_marks + 1) >= self->marks_size) {
 | 
					    if ((self->num_marks + 1) >= self->marks_size) {
 | 
				
			||||||
        size_t alloc;
 | 
					        size_t alloc;
 | 
				
			||||||
        Py_ssize_t *marks;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /* Use the size_t type to check for overflow. */
 | 
					        /* Use the size_t type to check for overflow. */
 | 
				
			||||||
        alloc = ((size_t)self->num_marks << 1) + 20;
 | 
					        alloc = ((size_t)self->num_marks << 1) + 20;
 | 
				
			||||||
| 
						 | 
					@ -5974,15 +5969,14 @@ load_mark(UnpicklerObject *self)
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (self->marks == NULL)
 | 
					        if (self->marks == NULL)
 | 
				
			||||||
            marks = (Py_ssize_t *) PyMem_Malloc(alloc * sizeof(Py_ssize_t));
 | 
					            self->marks = PyMem_NEW(Py_ssize_t, alloc);
 | 
				
			||||||
        else
 | 
					        else
 | 
				
			||||||
            marks = (Py_ssize_t *) PyMem_Realloc(self->marks,
 | 
					            PyMem_RESIZE(self->marks, Py_ssize_t, alloc);
 | 
				
			||||||
                                                 alloc * sizeof(Py_ssize_t));
 | 
					        if (self->marks == NULL) {
 | 
				
			||||||
        if (marks == NULL) {
 | 
					            self->marks_size = 0;
 | 
				
			||||||
            PyErr_NoMemory();
 | 
					            PyErr_NoMemory();
 | 
				
			||||||
            return -1;
 | 
					            return -1;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        self->marks = marks;
 | 
					 | 
				
			||||||
        self->marks_size = (Py_ssize_t)alloc;
 | 
					        self->marks_size = (Py_ssize_t)alloc;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue