summaryrefslogtreecommitdiff
path: root/py/compile.c
diff options
context:
space:
mode:
authorJeff Epler <jepler@gmail.com>2020-11-19 16:18:52 -0600
committerJeff Epler <jepler@gmail.com>2020-11-19 16:18:52 -0600
commitb2b8520880e9d458adbd279a34b831f8d6b68d40 (patch)
tree8e29536c38518715bbeee0fbbebc6ef0c85889ea /py/compile.c
parentc06fc8e02dc7c17e827e3fe736dc7226d7819452 (diff)
Always use preprocessor for MICROPY_ERROR_REPORTING
This ensures that only the translate("") alternative that will be used is seen after preprocessing. Improves the quality of the Huffman encoding and reduces binary size slightly. Also makes one "enhanced" error message only occur when ERROR_REPORTING_DETAILED: Instead of the word-for-word python3 error message "Type object has no attribute '%q'", the message will be "'type' object has no attribute '%q'". Also reduces binary size. (that's rolled into this commit as it was right next to a change to use the preprocessor for MICROPY_ERROR_REPORTING) Note that the odd semicolon after "value_error:" in parsenum.c is necessary due to a detail of the C grammar, in which a declaration cannot follow a label directly.
Diffstat (limited to 'py/compile.c')
-rw-r--r--py/compile.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/py/compile.c b/py/compile.c
index 04bcf5bc1..b4d81ed44 100644
--- a/py/compile.c
+++ b/py/compile.c
@@ -2486,21 +2486,21 @@ STATIC void compile_atom_brace(compiler_t *comp, mp_parse_node_struct_t *pns) {
compile_node(comp, pn_i);
if (is_dict) {
if (!is_key_value) {
- if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) {
+ #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE
compile_syntax_error(comp, (mp_parse_node_t)pns, translate("invalid syntax"));
- } else {
+ #else
compile_syntax_error(comp, (mp_parse_node_t)pns, translate("expecting key:value for dict"));
- }
+ #endif
return;
}
EMIT(store_map);
} else {
if (is_key_value) {
- if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) {
+ #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE
compile_syntax_error(comp, (mp_parse_node_t)pns, translate("invalid syntax"));
- } else {
+ #else
compile_syntax_error(comp, (mp_parse_node_t)pns, translate("expecting just a value for set"));
- }
+ #endif
return;
}
}