mirror of
https://github.com/python/cpython.git
synced 2025-08-30 13:38:43 +00:00
Issue #6012: Add cleanup support to O& argument parsing.
This commit is contained in:
parent
2703fd9134
commit
c15bdef819
9 changed files with 120 additions and 11 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue