cpython: a45407fa4a5b (original) (raw)
Mercurial > cpython
changeset 84519:a45407fa4a5b
Issue #18408: Fix PyCode_Optimize(): raise a MemoryError on memory allocation failure. [#18408]
Victor Stinner victor.stinner@gmail.com | |
---|---|
date | Tue, 09 Jul 2013 00:32:04 +0200 |
parents | 2ef2edfd1a4c |
children | ed0c9d77e179 |
files | Python/peephole.c |
diffstat | 1 files changed, 6 insertions(+), 2 deletions(-)[+] [-] Python/peephole.c 8 |
line wrap: on
line diff
--- a/Python/peephole.c +++ b/Python/peephole.c @@ -381,8 +381,10 @@ PyCode_Optimize(PyObject code, PyObject / Make a modifiable copy of the code string */ codestr = (unsigned char *)PyMem_Malloc(codelen);
- if (codestr == NULL) {
PyErr_NoMemory();[](#l1.9) goto exitError;[](#l1.10)
- } codestr = (unsigned char *)memcpy(codestr, PyBytes_AS_STRING(code), codelen);
@@ -396,8 +398,10 @@ PyCode_Optimize(PyObject code, PyObject / Mapping to new jump targets after NOPs are removed */ addrmap = (int *)PyMem_Malloc(codelen * sizeof(int));