diff options
Diffstat (limited to 'Python')
-rw-r--r-- | Python/bltinmodule.c | 7 | ||||
-rw-r--r-- | Python/ceval.c | 6 | ||||
-rw-r--r-- | Python/dynload_win.c | 9 |
3 files changed, 20 insertions, 2 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index a5b9716..2a0376a 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -1008,11 +1008,14 @@ min_max(PyObject *args, PyObject *kwds, int op) "%s() got an unexpected keyword argument", name); return NULL; } + Py_INCREF(keyfunc); } it = PyObject_GetIter(v); - if (it == NULL) + if (it == NULL) { + Py_XDECREF(keyfunc); return NULL; + } maxitem = NULL; /* the result */ maxval = NULL; /* the value associated with the result */ @@ -1061,6 +1064,7 @@ min_max(PyObject *args, PyObject *kwds, int op) else Py_DECREF(maxval); Py_DECREF(it); + Py_XDECREF(keyfunc); return maxitem; Fail_it_item_and_val: @@ -1071,6 +1075,7 @@ Fail_it: Py_XDECREF(maxval); Py_XDECREF(maxitem); Py_DECREF(it); + Py_XDECREF(keyfunc); return NULL; } diff --git a/Python/ceval.c b/Python/ceval.c index 778bbe0..10f2db4 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -1833,6 +1833,7 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag) "__import__ not found"); break; } + Py_INCREF(x); v = POP(); u = TOP(); if (PyLong_AsLong(u) != -1 || PyErr_Occurred()) @@ -1854,11 +1855,14 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag) Py_DECREF(u); if (w == NULL) { u = POP(); + Py_DECREF(x); x = NULL; break; } READ_TIMESTAMP(intr0); - x = PyEval_CallObject(x, w); + v = x; + x = PyEval_CallObject(v, w); + Py_DECREF(v); READ_TIMESTAMP(intr1); Py_DECREF(w); SET_TOP(x); diff --git a/Python/dynload_win.c b/Python/dynload_win.c index 39c091b..4db12c4 100644 --- a/Python/dynload_win.c +++ b/Python/dynload_win.c @@ -171,11 +171,16 @@ dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname, HINSTANCE hDLL = NULL; char pathbuf[260]; LPTSTR dummy; + unsigned int old_mode; /* We use LoadLibraryEx so Windows looks for dependent DLLs in directory of pathname first. However, Windows95 can sometimes not work correctly unless the absolute path is used. If GetFullPathName() fails, the LoadLibrary will certainly fail too, so use its error code */ + + /* Don't display a message box when Python can't load a DLL */ + old_mode = SetErrorMode(SEM_FAILCRITICALERRORS); + if (GetFullPathName(pathname, sizeof(pathbuf), pathbuf, @@ -183,6 +188,10 @@ dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname, /* XXX This call doesn't exist in Windows CE */ hDLL = LoadLibraryEx(pathname, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); + + /* restore old error mode settings */ + SetErrorMode(old_mode); + if (hDLL==NULL){ PyObject *message; unsigned int errorCode; |