cpython: ba1c48f8b571 (original) (raw)

Mercurial > cpython

changeset 78603:ba1c48f8b571 2.7

Issue #15604: Update uses of PyObject_IsTrue() to check for and handle errors correctly. Patch by Serhiy Storchaka. [#15604]

Antoine Pitrou solipsis@pitrou.net
date Wed, 15 Aug 2012 23:16:51 +0200
parents 59f520542c1c
children 78b0f294674c
files Misc/NEWS Modules/_csv.c Modules/_io/textio.c Modules/_ssl.c Modules/cStringIO.c Modules/itertoolsmodule.c Modules/parsermodule.c Modules/pyexpat.c Objects/typeobject.c Python/bltinmodule.c Python/import.c
diffstat 11 files changed, 112 insertions(+), 52 deletions(-)[+] [-] Misc/NEWS 3 Modules/_csv.c 8 Modules/_io/textio.c 5 Modules/_ssl.c 6 Modules/cStringIO.c 6 Modules/itertoolsmodule.c 17 Modules/parsermodule.c 18 Modules/pyexpat.c 54 Objects/typeobject.c 12 Python/bltinmodule.c 22 Python/import.c 13

line wrap: on

line diff

--- a/Misc/NEWS +++ b/Misc/NEWS @@ -9,6 +9,9 @@ What's New in Python 2.7.4 Core and Builtins ----------------- +- Issue #15604: Update uses of PyObject_IsTrue() to check for and handle

--- a/Modules/_csv.c +++ b/Modules/_csv.c @@ -208,8 +208,12 @@ static int { if (src == NULL) *target = dflt;

--- a/Modules/_io/textio.c +++ b/Modules/_io/textio.c @@ -1013,8 +1013,11 @@ textiowrapper_init(textio *self, PyObjec res = PyObject_CallMethod(buffer, "seekable", NULL); if (res == NULL) goto error;

self->encoding_start_of_stream = 0; if (self->seekable && self->encoder) {

--- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -1005,6 +1005,7 @@ PySSL_peercert(PySSLObject *self, PyObje int len; int verification; PyObject *binary_mode = Py_None;

if (!PyArg_ParseTuple(args, "|O:peer_certificate", &binary_mode)) return NULL; @@ -1012,7 +1013,10 @@ PySSL_peercert(PySSLObject *self, PyObje if (!self->peer_cert) Py_RETURN_NONE;

unsigned char *bytes_buf = NULL;

--- a/Modules/cStringIO.c +++ b/Modules/cStringIO.c @@ -127,12 +127,16 @@ IO_cgetval(PyObject *self) { static PyObject * IO_getval(IOobject *self, PyObject *args) { PyObject *use_pos=Py_None;

--- a/Modules/itertoolsmodule.c +++ b/Modules/itertoolsmodule.c @@ -903,11 +903,13 @@ dropwhile_next(dropwhileobject *lz) } ok = PyObject_IsTrue(good); Py_DECREF(good);

--- a/Modules/parsermodule.c +++ b/Modules/parsermodule.c @@ -350,10 +350,14 @@ parser_st2tuple(PyST_Object *self, PyObj int lineno = 0; int col_offset = 0; if (line_option != NULL) {

@@ -401,10 +405,14 @@ parser_st2list(PyST_Object *self, PyObje int lineno = 0; int col_offset = 0; if (line_option != 0) {

--- a/Modules/pyexpat.c +++ b/Modules/pyexpat.c @@ -1174,13 +1174,16 @@ static PyObject * xmlparse_UseForeignDTD(xmlparseobject *self, PyObject *args) { PyObject *flagobj = NULL;

@@ -1568,39 +1574,39 @@ xmlparse_setattr(xmlparseobject *self, c return 0; } if (strcmp(name, "namespace_prefixes") == 0) {

#ifndef Py_USING_UNICODE

-#else

#endif

--- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -327,11 +327,15 @@ type_set_abstractmethods(PyTypeObject *t abc.ABCMeta.new, so this function doesn't do anything special to update subclasses. */

@@ -340,12 +344,10 @@ type_set_abstractmethods(PyTypeObject *t } if (res == 0) { PyType_Modified(type);

--- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -313,7 +313,7 @@ builtin_filter(PyObject *self, PyObject ok = PyObject_IsTrue(good); Py_DECREF(good); }

@@ -324,8 +324,11 @@ builtin_filter(PyObject *self, PyObject } ++j; }

@@ -2917,6 +2923,8 @@ filterstring(PyObject *func, PyObject *s } } Py_DECREF(item);

@@ -3032,6 +3040,8 @@ filterunicode(PyObject *func, PyObject * } } Py_DECREF(item);

--- a/Python/import.c +++ b/Python/import.c @@ -1043,7 +1043,10 @@ load_source_module(char *name, char *pat name, pathname); if (cpathname) { PyObject *ro = PySys_GetObject("dont_write_bytecode");