cpython: 56dc7b09f390 (original) (raw)

Mercurial > cpython

changeset 78604:56dc7b09f390 3.2

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🔞25 +0200
parents fa9eedea0b48
children b878df1d23b1 8ff172a1b679
files Misc/NEWS Modules/_csv.c Modules/_io/textio.c Modules/_posixsubprocess.c Modules/_ssl.c Modules/itertoolsmodule.c Modules/parsermodule.c Modules/pyexpat.c Objects/typeobject.c Python/bltinmodule.c Python/import.c
diffstat 11 files changed, 87 insertions(+), 39 deletions(-)[+] [-] Misc/NEWS 3 Modules/_csv.c 8 Modules/_io/textio.c 5 Modules/_posixsubprocess.c 2 Modules/_ssl.c 6 Modules/itertoolsmodule.c 13 Modules/parsermodule.c 18 Modules/pyexpat.c 42 Objects/typeobject.c 12 Python/bltinmodule.c 4 Python/import.c 13

line wrap: on

line diff

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

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

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

self->has_read1 = PyObject_HasAttrString(buffer, "read1");

--- a/Modules/_posixsubprocess.c +++ b/Modules/_posixsubprocess.c @@ -525,6 +525,8 @@ subprocess_fork_exec(PyObject* self, PyO return NULL; close_fds = PyObject_IsTrue(py_close_fds);

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

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

unsigned char *bytes_buf = NULL;

--- 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 @@ -401,10 +401,14 @@ parser_st2tuple(PyST_Object *self, PyObj int lineno = 0; int col_offset = 0; if (line_option != NULL) {

@@ -444,10 +448,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 @@ -1033,13 +1033,16 @@ static PyObject * xmlparse_UseForeignDTD(xmlparseobject *self, PyObject *args) { PyObject *flagobj = NULL;

@@ -1416,25 +1422,25 @@ xmlparse_setattro(xmlparseobject *self, return 0; } if (PyUnicode_CompareWithASCIIString(name, "namespace_prefixes") == 0) {

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

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

--- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -428,9 +428,11 @@ filter_next(filterobject *lz) ok = PyObject_IsTrue(good); Py_DECREF(good); }

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