Trivial issue: 1ej returns 1j (expected a Syntax Error or similar...)
As the title suggests, this really is a trivial item. (We happened to notice it in our MicroPython fork, and thought we'd pass it on.)
(In case it matters, I'm running a 64-bit release build of MicroPython 1.14, built from code pulled from GitHub at 14:42 CDT on 23 March 2021.)
Within the REPL, entering 1ej returns 1j, rather than throwing a SyntaxError (or similar):
>>> 1ej
1j
For reference, CPython 3.7.5 throws a SyntaxError here:
>>> 1ej
File "<stdin>", line 1
1ej
^
SyntaxError: invalid syntax
Incorrect exception type raised when MICROPY_ERROR_REPORTING_TERSE is selected
Hi,
While running the tests on the WiPy I have seen that some of the basic ones fail. I don't know if the best is to raise tickets or submit PRs or both, so please advice. Here's the first one: int1.py
At some point the test expects a ValueError raised, but SyntaxError is thrown instead. Because in parsenum.c line 144:
value_error:
// if lex!=NULL then the parser called us and we need to make a SyntaxError with traceback
if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) {
mp_obj_t exc = mp_obj_new_exception_msg(&mp_type_SyntaxError,
"invalid syntax for integer");
raise_exc(exc, lex);
} else {
mp_obj_t exc = mp_obj_new_exception_msg_varg(&mp_type_ValueError,
"invalid syntax for integer with base %d: '%.*s'", base, top - str_val_start, str_val_start);
raise_exc(exc, lex);
}
I guess that in both cases it should be mp_type_ValueError, right?