diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2016-04-06 19:55:31 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2016-04-06 19:55:31 (GMT) |
commit | 026110f0a2ce027a781e429ee9a0ed14f9b2bc4a (patch) | |
tree | 0ff108ac20407420155b9883641be1ee998c15b5 | |
parent | 765c635dc85d3b3e8049dc644b99a20d79338018 (diff) | |
download | cpython-026110f0a2ce027a781e429ee9a0ed14f9b2bc4a.zip cpython-026110f0a2ce027a781e429ee9a0ed14f9b2bc4a.tar.gz cpython-026110f0a2ce027a781e429ee9a0ed14f9b2bc4a.tar.bz2 |
Issue #26671: Fixed #ifdef indentation.
-rw-r--r-- | Modules/posixmodule.c | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index e6704ac..bc41d93 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -884,11 +884,11 @@ path_converter(PyObject *o, void *p) #endif } else if (PyObject_CheckBuffer(o)) { -# ifdef MS_WINDOWS +#ifdef MS_WINDOWS if (win32_warn_bytes_api()) { return 0; } -# endif +#endif bytes = PyBytes_FromObject(o); if (!bytes) { return 0; @@ -905,6 +905,30 @@ path_converter(PyObject *o, void *p) return 1; } else { + PyObject *pathattr; + _Py_IDENTIFIER(path); + + pathattr = _PyObject_GetAttrId(o, &PyId_path); + if (pathattr == NULL) { + PyErr_Clear(); + } + else if (PyUnicode_Check(pathattr) || PyObject_CheckBuffer(pathattr)) { + if (!path_converter(pathattr, path)) { + Py_DECREF(pathattr); + return 0; + } + if (path->cleanup == NULL) { + path->cleanup = pathattr; + } + else { + Py_DECREF(pathattr); + } + return Py_CLEANUP_SUPPORTED; + } + else { + Py_DECREF(pathattr); + } + PyErr_Format(PyExc_TypeError, "%s%s%s should be %s, not %.200s", path->function_name ? path->function_name : "", path->function_name ? ": " : "", |