GeezerVison is showing github.com — Fix: · yahalit/python@7782c4b
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: Lib/decimal.py +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -5061,7 +5061,7 @@ def _dlog10(c, e, p): | 5061 | 5061 | log_tenpower = f*M # exact | 5062 | 5062 | else: | 5063 | 5063 | log_d = 0 # error < 2.31 | 5064 | | - log_tenpower = div_nearest(f, 10**-p) # error < 0.5 | | 5064 | + log_tenpower = _div_nearest(f, 10**-p) # error < 0.5 | 5065 | 5065 |
| 5066 | 5066 | return _div_nearest(log_tenpower+log_d, 100) | 5067 | 5067 |
| |
Collapse file Copy file name to clipboardExpand all lines: Misc/NEWS +8Lines changed: 8 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -12,6 +12,14 @@ What's New in Python 2.6 release candidate 1? | 12 | 12 | Core and Builtins | 13 | 13 | ----------------- | 14 | 14 |
| | 15 | +- Fix crashes on memory allocation failure found with failmalloc. | | 16 | + | | 17 | +- Fix memory leaks found with valgrind and update suppressions file. | | 18 | + | | 19 | +- Fix compiler warnings in opt mode which would lead to invalid memory reads. | | 20 | + | | 21 | +- Fix problem using wrong name in decimal module reported by pychecker. | | 22 | + | 15 | 23 | - Issue #3642: Changed type of numarenas from uint to size_t | 16 | 24 | in order to silence a compilier warning on 64bit OSes. | 17 | 25 |
| |
Collapse file Copy file name to clipboardExpand all lines: Misc/valgrind-python.supp +33Lines changed: 33 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 46 | 46 | # Will need to fix that. | 47 | 47 | # | 48 | 48 |
| | 49 | +{ | | 50 | + Suppress leaking the GIL. Happens once per process, see comment in ceval.c. | | 51 | + Memcheck:Leak | | 52 | + fun:malloc | | 53 | + fun:PyThread_allocate_lock | | 54 | + fun:PyEval_InitThreads | | 55 | +} | | 56 | + | | 57 | +{ | | 58 | + Suppress leaking the GIL after a fork. | | 59 | + Memcheck:Leak | | 60 | + fun:malloc | | 61 | + fun:PyThread_allocate_lock | | 62 | + fun:PyEval_ReInitThreads | | 63 | +} | | 64 | + | | 65 | +{ | | 66 | + Suppress leaking the autoTLSkey. This looks like it shouldn't leak though. | | 67 | + Memcheck:Leak | | 68 | + fun:malloc | | 69 | + fun:PyThread_create_key | | 70 | + fun:_PyGILState_Init | | 71 | + fun:Py_InitializeEx | | 72 | + fun:Py_Main | | 73 | +} | | 74 | + | | 75 | +{ | | 76 | + Hmmm, is this a real leak or like the GIL? | | 77 | + Memcheck:Leak | | 78 | + fun:malloc | | 79 | + fun:PyThread_ReInitTLS | | 80 | +} | | 81 | + | 49 | 82 | { | 50 | 83 | Handle PyMalloc confusing valgrind (possibly leaked) | 51 | 84 | Memcheck:Leak | |
Collapse file Copy file name to clipboardExpand all lines: Modules/_ctypes/stgdict.c +3Lines changed: 3 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -416,6 +416,7 @@ StructUnionType_update_stgdict(PyObject *type, PyObject *fields, int isStruct) | 416 | 416 | ffi_ofs = 0; | 417 | 417 | } | 418 | 418 |
| | 419 | + assert(stgdict->format == NULL); | 419 | 420 | if (isStruct && !isPacked) { | 420 | 421 | stgdict->format = alloc_format_string(NULL, "T{"); | 421 | 422 | } else { | @@ -539,7 +540,9 @@ StructUnionType_update_stgdict(PyObject *type, PyObject *fields, int isStruct) | 539 | 540 | #undef realdict | 540 | 541 |
| 541 | 542 | if (isStruct && !isPacked) { | | 543 | + char *ptr = stgdict->format; | 542 | 544 | stgdict->format = alloc_format_string(stgdict->format, "}"); | | 545 | + PyMem_Free(ptr); | 543 | 546 | if (stgdict->format == NULL) | 544 | 547 | return -1; | 545 | 548 | } | |
Collapse file Copy file name to clipboardExpand all lines: Modules/_fileio.c +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -278,6 +278,7 @@ fileio_init(PyObject *oself, PyObject *args, PyObject *kwds) | 278 | 278 | ret = -1; | 279 | 279 |
| 280 | 280 | done: | | 281 | + PyMem_Free(name); | 281 | 282 | return ret; | 282 | 283 | } | 283 | 284 |
| |
Collapse file Copy file name to clipboardExpand all lines: Modules/signalmodule.c +2-1Lines changed: 2 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -784,7 +784,8 @@ initsignal(void) | 784 | 784 | #if defined (HAVE_SETITIMER) || defined (HAVE_GETITIMER) | 785 | 785 | ItimerError = PyErr_NewException("signal.ItimerError", | 786 | 786 | PyExc_IOError, NULL); | 787 | | - PyDict_SetItemString(d, "ItimerError", ItimerError); | | 787 | + if (ItimerError != NULL) | | 788 | + PyDict_SetItemString(d, "ItimerError", ItimerError); | 788 | 789 | #endif | 789 | 790 |
| 790 | 791 | if (!PyErr_Occurred()) | |
Collapse file Copy file name to clipboardExpand all lines: Objects/stringlib/formatter.h +4-1Lines changed: 4 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -641,7 +641,10 @@ format_int_or_long_internal(PyObject *value, const InternalFormatSpec *format, | 641 | 641 | /* We know this can't fail, since we've already | 642 | 642 | reserved enough space. */ | 643 | 643 | STRINGLIB_CHAR *pstart = p + n_leading_chars; | 644 | | - int r = STRINGLIB_GROUPING(pstart, n_digits, n_digits, | | 644 | +#ifndef NDEBUG | | 645 | + int r = | | 646 | +#endif | | 647 | + STRINGLIB_GROUPING(pstart, n_digits, n_digits, | 645 | 648 | spec.n_total+n_grouping_chars-n_leading_chars, | 646 | 649 | NULL, 0); | 647 | 650 | assert(r); | |
Collapse file Copy file name to clipboardExpand all lines: Objects/structseq.c +14-6Lines changed: 14 additions & 6 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -32,6 +32,8 @@ PyStructSequence_New(PyTypeObject *type) | 32 | 32 | PyStructSequence *obj; | 33 | 33 |
| 34 | 34 | obj = PyObject_New(PyStructSequence, type); | | 35 | + if (obj == NULL) | | 36 | + return NULL; | 35 | 37 | Py_SIZE(obj) = VISIBLE_SIZE_TP(type); | 36 | 38 |
| 37 | 39 | return (PyObject*) obj; | @@ -522,10 +524,16 @@ PyStructSequence_InitType(PyTypeObject *type, PyStructSequence_Desc *desc) | 522 | 524 | Py_INCREF(type); | 523 | 525 |
| 524 | 526 | dict = type->tp_dict; | 525 | | - PyDict_SetItemString(dict, visible_length_key, | 526 | | - PyInt_FromLong((long) desc->n_in_sequence)); | 527 | | - PyDict_SetItemString(dict, real_length_key, | 528 | | - PyInt_FromLong((long) n_members)); | 529 | | - PyDict_SetItemString(dict, unnamed_fields_key, | 530 | | - PyInt_FromLong((long) n_unnamed_members)); | | 527 | +#define SET_DICT_FROM_INT(key, value) \ | | 528 | + do { \ | | 529 | + PyObject *v = PyInt_FromLong((long) value); \ | | 530 | + if (v != NULL) { \ | | 531 | + PyDict_SetItemString(dict, key, v); \ | | 532 | + Py_DECREF(v); \ | | 533 | + } \ | | 534 | + } while (0) | | 535 | + | | 536 | + SET_DICT_FROM_INT(visible_length_key, desc->n_in_sequence); | | 537 | + SET_DICT_FROM_INT(real_length_key, n_members); | | 538 | + SET_DICT_FROM_INT(unnamed_fields_key, n_unnamed_members); | 531 | 539 | } |
Collapse file Copy file name to clipboardExpand all lines: Python/getargs.c +7-3Lines changed: 7 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -1312,7 +1312,7 @@ convertbuffer(PyObject *arg, void **p, char **errmsg) | 1312 | 1312 | } | 1313 | 1313 |
| 1314 | 1314 | static int | 1315 | | -getbuffer(PyObject *arg, Py_buffer *view, char**errmsg) | | 1315 | +getbuffer(PyObject *arg, Py_buffer *view, char **errmsg) | 1316 | 1316 | { | 1317 | 1317 | void *buf; | 1318 | 1318 | Py_ssize_t count; | @@ -1322,8 +1322,10 @@ getbuffer(PyObject *arg, Py_buffer *view, char**errmsg) | 1322 | 1322 | return -1; | 1323 | 1323 | } | 1324 | 1324 | if (pb->bf_getbuffer) { | 1325 | | - if (pb->bf_getbuffer(arg, view, 0) < 0) | | 1325 | + if (pb->bf_getbuffer(arg, view, 0) < 0) { | | 1326 | + *errmsg = "convertible to a buffer"; | 1326 | 1327 | return -1; | | 1328 | + } | 1327 | 1329 | if (!PyBuffer_IsContiguous(view, 'C')) { | 1328 | 1330 | *errmsg = "contiguous buffer"; | 1329 | 1331 | return -1; | @@ -1332,8 +1334,10 @@ getbuffer(PyObject *arg, Py_buffer *view, char**errmsg) | 1332 | 1334 | } | 1333 | 1335 |
| 1334 | 1336 | count = convertbuffer(arg, &buf, errmsg); | 1335 | | - if (count < 0) | | 1337 | + if (count < 0) { | | 1338 | + *errmsg = "convertible to a buffer"; | 1336 | 1339 | return count; | | 1340 | + } | 1337 | 1341 | PyBuffer_FillInfo(view, NULL, buf, count, 1, 0); | 1338 | 1342 | return 0; | 1339 | 1343 | } | |
Collapse file Copy file name to clipboardExpand all lines: Python/pythonrun.c +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -132,8 +132,8 @@ Py_InitializeEx(int install_sigs) | 132 | 132 | PyThreadState *tstate; | 133 | 133 | PyObject *bimod, *sysmod; | 134 | 134 | char *p; | 135 | | - char *icodeset; /* On Windows, input codeset may theoretically | 136 | | - differ from output codeset. */ | | 135 | + char *icodeset = NULL; /* On Windows, input codeset may theoretically | | 136 | + differ from output codeset. */ | 137 | 137 | char *codeset = NULL; | 138 | 138 | char *errors = NULL; | 139 | 139 | int free_codeset = 0; | |
|