File tree Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -583,6 +583,8 @@ void mp_lexer_to_next(mp_lexer_t *lex) {
583
583
// MP_TOKEN_END is used to indicate that this is the first string token
584
584
lex -> tok_kind = MP_TOKEN_END ;
585
585
586
+ bool saw_normal = false, saw_fstring = false;
587
+
586
588
// Loop to accumulate string/bytes literals
587
589
do {
588
590
// parse type codes
@@ -619,6 +621,17 @@ void mp_lexer_to_next(mp_lexer_t *lex) {
619
621
is_fstring = true;
620
622
}
621
623
624
+ if (is_fstring ) {
625
+ saw_fstring = true;
626
+ } else {
627
+ saw_normal = true;
628
+ }
629
+
630
+ if (saw_fstring && saw_normal ) {
631
+ // Can't concatenate f-string with normal string
632
+ break ;
633
+ }
634
+
622
635
// Set or check token kind
623
636
if (lex -> tok_kind == MP_TOKEN_END ) {
624
637
lex -> tok_kind = kind ;
Original file line number Diff line number Diff line change @@ -104,10 +104,10 @@ def foo():
104
104
x = 10
105
105
y = 'hi'
106
106
assert (f'h' f'i' ) == 'hi'
107
- assert (f'h' 'i' ) == 'hi'
108
- assert ('h' f'i' ) == 'hi'
107
+ # assert (f'h' 'i') == 'hi'
108
+ # assert ('h' f'i') == 'hi'
109
109
assert f'{ x :^4} ' == ' 10 '
110
- assert ('a' 'b' f'{ x } ' f'str<{ y :^4} >' 'd' 'e' ) == 'ab10str< hi >de'
110
+ # assert ('a' 'b' f'{x}' f'str<{y:^4}>' 'd' 'e') == 'ab10str< hi >de'
111
111
112
112
# Other tests
113
113
assert f'{{{ 4 * 10 } }}' == '{40}'
You can’t perform that action at this time.
0 commit comments