summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
Diffstat (limited to 'Objects')
-rw-r--r--Objects/exceptions.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/Objects/exceptions.c b/Objects/exceptions.c
index 69a6b5c..ca917b4 100644
--- a/Objects/exceptions.c
+++ b/Objects/exceptions.c
@@ -9,7 +9,7 @@
#include "pycore_initconfig.h"
#include "pycore_object.h"
#include "structmember.h" // PyMemberDef
-#include "osdefs.h"
+#include "osdefs.h" // SEP
/* Compatibility aliases */
@@ -1435,11 +1435,13 @@ my_basename(PyObject *name)
size = PyUnicode_GET_LENGTH(name);
offset = 0;
for(i=0; i < size; i++) {
- if (PyUnicode_READ(kind, data, i) == SEP)
+ if (PyUnicode_READ(kind, data, i) == SEP) {
offset = i + 1;
+ }
}
- if (offset != 0)
+ if (offset != 0) {
return PyUnicode_Substring(name, offset, size);
+ }
else {
Py_INCREF(name);
return name;