|
223 | 223 | "zip",
|
224 | 224 | ]
|
225 | 225 |
|
226 |
| -# Additional QSTRs that must have index <255 because they are stored in |
227 |
| -# `mp_binary_op_method_name` and `mp_unary_op_method_name` (see py/objtype.c). |
| 226 | +# Additional QSTRs that must have index <255 because they are stored as `byte` values. |
228 | 227 | # These are not part of the .mpy compatibility list, but we place them in the
|
229 | 228 | # fixed unsorted pool (i.e. QDEF0) to ensure their indices are small.
|
230 |
| -operator_qstr_list = { |
| 229 | +unsorted_qstr_list = { |
| 230 | + # From py/objtype.c: used in the `mp_binary_op_method_name` and `mp_unary_op_method_name` tables. |
231 | 231 | "__bool__",
|
232 | 232 | "__pos__",
|
233 | 233 | "__neg__",
|
|
286 | 286 | "__get__",
|
287 | 287 | "__set__",
|
288 | 288 | "__delete__",
|
| 289 | + # From py/scope.c: used in `scope_simple_name_table` table. |
| 290 | + # Note: "<module>" is already in `static_qstr_list`. |
| 291 | + "<lambda>", |
| 292 | + "<listcomp>", |
| 293 | + "<dictcomp>", |
| 294 | + "<setcomp>", |
| 295 | + "<genexpr>", |
289 | 296 | }
|
290 | 297 |
|
291 | 298 |
|
@@ -404,10 +411,10 @@ def print_qstr_data(qcfgs, qstrs):
|
404 | 411 | print("QDEF0(MP_QSTR_%s, %s)" % (qstr_escape(qstr), qbytes))
|
405 | 412 |
|
406 | 413 | # add remaining qstrs to the sorted (by value) pool (unless they're in
|
407 |
| - # operator_qstr_list, in which case add them to the unsorted pool) |
| 414 | + # unsorted_qstr_list, in which case add them to the unsorted pool) |
408 | 415 | for ident, qstr in sorted(qstrs.values(), key=lambda x: x[1]):
|
409 | 416 | qbytes = make_bytes(cfg_bytes_len, cfg_bytes_hash, qstr)
|
410 |
| - pool = 0 if qstr in operator_qstr_list else 1 |
| 417 | + pool = 0 if qstr in unsorted_qstr_list else 1 |
411 | 418 | print("QDEF%d(MP_QSTR_%s, %s)" % (pool, ident, qbytes))
|
412 | 419 |
|
413 | 420 |
|
|
0 commit comments