[Python-checkins] cpython: Issue #26671: Fixed #ifdef indentation.

serhiy.storchaka python-checkins at python.org
Wed Apr 6 15:55:50 EDT 2016


https://hg.python.org/cpython/rev/8dc144e47252
changeset:   100863:8dc144e47252
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Wed Apr 06 22:55:31 2016 +0300
summary:
  Issue #26671: Fixed #ifdef indentation.

files:
  Modules/posixmodule.c |  28 ++++++++++++++++++++++++++--
  1 files changed, 26 insertions(+), 2 deletions(-)


diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -884,11 +884,11 @@
 #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 @@
         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 ? ": "                : "",

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list