]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
closes bpo-39684: Combine two if/thens and squash uninit var warning. (GH-18565)
authorAndy Lester <andy@petdance.com>
Fri, 21 Feb 2020 04:51:47 +0000 (22:51 -0600)
committerGitHub <noreply@github.com>
Fri, 21 Feb 2020 04:51:47 +0000 (20:51 -0800)
Objects/unicodeobject.c

index 4475eca9432dbb02ef3e4f22d5cc3333c3d54ac7..ee6d3dfd3945bd58b1a5a4e56ba6e15c78825b2c 100644 (file)
@@ -12209,20 +12209,15 @@ PyUnicode_IsIdentifier(PyObject *self)
 
     int kind = 0;
     void *data = NULL;
-    wchar_t *wstr;
+    const wchar_t *wstr = NULL;
+    Py_UCS4 ch;
     if (ready) {
         kind = PyUnicode_KIND(self);
         data = PyUnicode_DATA(self);
-    }
-    else {
-        wstr = _PyUnicode_WSTR(self);
-    }
-
-    Py_UCS4 ch;
-    if (ready) {
         ch = PyUnicode_READ(kind, data, 0);
     }
     else {
+        wstr = _PyUnicode_WSTR(self);
         ch = wstr[0];
     }
     /* PEP 3131 says that the first character must be in