|
89 | 89 | dict_values_op,
|
90 | 90 | )
|
91 | 91 | from mypyc.primitives.list_ops import new_list_set_item_op
|
92 |
| -from mypyc.primitives.tuple_ops import new_tuple_set_item_op |
93 | 92 | from mypyc.primitives.str_ops import (
|
94 |
| - str_encode_utf8_strict, |
95 | 93 | str_encode_ascii_strict,
|
96 | 94 | str_encode_latin1_strict,
|
| 95 | + str_encode_utf8_strict, |
97 | 96 | )
|
| 97 | +from mypyc.primitives.tuple_ops import new_tuple_set_item_op |
98 | 98 |
|
99 | 99 | # Specializers are attempted before compiling the arguments to the
|
100 | 100 | # function. Specializers can return None to indicate that they failed
|
@@ -716,11 +716,20 @@ def str_encode_fast_path(builder: IRBuilder, expr: CallExpr, callee: RefExpr) ->
|
716 | 716 | encoding = expr.args[0].value.lower().replace("-", "_")
|
717 | 717 |
|
718 | 718 | # Specialized encodings and their accepted aliases
|
719 |
| - if encoding in ['u8', 'utf', 'utf8', 'utf_8', 'cp65001']: |
| 719 | + if encoding in ["u8", "utf", "utf8", "utf_8", "cp65001"]: |
720 | 720 | return builder.call_c(str_encode_utf8_strict, [builder.accept(callee.expr)], expr.line)
|
721 | 721 | elif encoding in ["ascii", "646", "us_ascii"]:
|
722 | 722 | return builder.call_c(str_encode_ascii_strict, [builder.accept(callee.expr)], expr.line)
|
723 |
| - elif encoding in ['iso_8859_1', 'iso8859_1', '8859', 'cp819', 'latin', 'latin1', 'latin_1', 'l1']: |
| 723 | + elif encoding in [ |
| 724 | + "iso_8859_1", |
| 725 | + "iso8859_1", |
| 726 | + "8859", |
| 727 | + "cp819", |
| 728 | + "latin", |
| 729 | + "latin1", |
| 730 | + "latin_1", |
| 731 | + "l1", |
| 732 | + ]: |
724 | 733 | return builder.call_c(str_encode_latin1_strict, [builder.accept(callee.expr)], expr.line)
|
725 | 734 |
|
726 | 735 | return None
|
|
0 commit comments