summaryrefslogtreecommitdiff
path: root/Objects/unicodeobject.c
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2009-05-29 14:47:46 +0000
committerMartin v. Löwis <martin@v.loewis.de>2009-05-29 14:47:46 +0000
commite2fd38a07e53dec4ec12ccee6eef7c7dc8df23d1 (patch)
treef711b92923e61cf0de76b46da15ba13d0be3d795 /Objects/unicodeobject.c
parentb29447d2433e521a4d8c351fe7deec646a5b8ba9 (diff)
downloadcpython-e2fd38a07e53dec4ec12ccee6eef7c7dc8df23d1.tar.gz
Issue #6012: Add cleanup support to O& argument parsing.
Diffstat (limited to 'Objects/unicodeobject.c')
-rw-r--r--Objects/unicodeobject.c6
1 files changed, 5 insertions, 1 deletions
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;
}