Skip to content

Commit 4867413

Browse files
committed
Simplify detection of quote characters in mp_str_print_quoted.
Once a double quote has been found, the subsequent discovery of a single quote won't change behaviour at all, so don't bother looking for one.
1 parent 29bf739 commit 4867413

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

py/objstr.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ void mp_str_print_quoted(void (*print)(void *env, const char *fmt, ...), void *e
6868
// this escapes characters, but it will be very slow to print (calling print many times)
6969
bool has_single_quote = false;
7070
bool has_double_quote = false;
71-
for (const byte *s = str_data, *top = str_data + str_len; (!has_single_quote || !has_double_quote) && s < top; s++) {
71+
for (const byte *s = str_data, *top = str_data + str_len; !has_double_quote && s < top; s++) {
7272
if (*s == '\'') {
7373
has_single_quote = true;
7474
} else if (*s == '"') {

0 commit comments

Comments
 (0)