Skip to content

Commit ae9c82d

Browse files
committed
objstr: str_uni_istype(): Spurious whitespace on empty lines.
1 parent f69b9d3 commit ae9c82d

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

py/objstr.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1506,14 +1506,14 @@ enum { IS_SPACE, IS_ALPHA, IS_DIGIT, IS_UPPER, IS_LOWER };
15061506

15071507
STATIC mp_obj_t str_uni_istype(int type, mp_obj_t self_in) {
15081508
GET_STR_DATA_LEN(self_in, self_data, self_len);
1509-
1509+
15101510
if (self_len == 0) {
15111511
return mp_const_false; // default to False for empty str
15121512
}
1513-
1513+
15141514
typedef bool (*check_function)(unichar);
15151515
check_function f;
1516-
1516+
15171517
if (type != IS_UPPER && type != IS_LOWER) {
15181518
switch (type) {
15191519
case IS_SPACE: f = &unichar_isspace; break;
@@ -1522,7 +1522,7 @@ STATIC mp_obj_t str_uni_istype(int type, mp_obj_t self_in) {
15221522
default:
15231523
nlr_raise(mp_obj_new_exception_msg(&mp_type_TypeError, "unknown type provided for str_uni_istype"));
15241524
}
1525-
1525+
15261526
for (int i = 0; i < self_len; i++) {
15271527
if (!f(*self_data++)) {
15281528
return mp_const_false;
@@ -1535,9 +1535,9 @@ STATIC mp_obj_t str_uni_istype(int type, mp_obj_t self_in) {
15351535
default:
15361536
nlr_raise(mp_obj_new_exception_msg(&mp_type_TypeError, "unknown type provided for str_uni_istype"));
15371537
}
1538-
1538+
15391539
bool contains_alpha = false;
1540-
1540+
15411541
for (int i = 0; i < self_len; i++) { // only check alphanumeric characters
15421542
if (unichar_isalpha(*self_data++)) {
15431543
contains_alpha = true;
@@ -1546,7 +1546,7 @@ STATIC mp_obj_t str_uni_istype(int type, mp_obj_t self_in) {
15461546
}
15471547
}
15481548
}
1549-
1549+
15501550
if (!contains_alpha) {
15511551
return mp_const_false;
15521552
}

0 commit comments

Comments
 (0)