From e2fd38a07e53dec4ec12ccee6eef7c7dc8df23d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20v=2E=20L=C3=B6wis?= Date: Fri, 29 May 2009 14:47:46 +0000 Subject: Issue #6012: Add cleanup support to O& argument parsing. --- Objects/unicodeobject.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'Objects/unicodeobject.c') diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 3bd1efd939..47e0933174 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -1539,6 +1539,10 @@ PyUnicode_FSConverter(PyObject* arg, void* addr) PyObject *output = NULL; Py_ssize_t size; void *data; + if (arg == NULL) { + Py_DECREF(*(PyObject**)addr); + return 1; + } if (PyBytes_Check(arg) || PyByteArray_Check(arg)) { output = arg; Py_INCREF(output); @@ -1573,7 +1577,7 @@ PyUnicode_FSConverter(PyObject* arg, void* addr) return 0; } *(PyObject**)addr = output; - return 1; + return Py_CLEANUP_SUPPORTED; } -- cgit v1.2.1