Commit 202803a0 authored by Benjamin Peterson's avatar Benjamin Peterson

c_encoding can never be NULL, which allows some code simplification

parent 7812dbcc
......@@ -4002,9 +4002,6 @@ decode_unicode(struct compiling *c, const char *s, size_t len, const char *encod
char *p;
const char *end;
if (encoding == NULL) {
u = NULL;
} else {
/* check for integer overflow */
if (len > PY_SIZE_MAX / 6)
return NULL;
......@@ -4050,7 +4047,7 @@ decode_unicode(struct compiling *c, const char *s, size_t len, const char *encod
}
len = p - buf;
s = buf;
}
v = PyUnicode_DecodeUnicodeEscape(s, len, NULL);
Py_XDECREF(u);
return v;
......@@ -4994,8 +4991,7 @@ parsestr(struct compiling *c, const node *n, int *bytesmode, int *fmode)
}
}
}
need_encoding = (!*bytesmode && c->c_encoding != NULL &&
strcmp(c->c_encoding, "utf-8") != 0);
need_encoding = !*bytesmode && strcmp(c->c_encoding, "utf-8") != 0;
if (rawmode || strchr(s, '\\') == NULL) {
if (need_encoding) {
PyObject *v, *u = PyUnicode_DecodeUTF8(s, len, NULL);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment