You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Constructs that gt4py.next rejects via the _UNSUPPORTED_FEATURE_HINTS catalogue in ffront/dialect_parser.py only produce their friendly diagnostic when they do not reference an external name. If the construct names a symbol (e.g. an exception type), closure-variable resolution runs first and fails with an unrelated, internal-sounding message.
DSLTypeError: Unexpected object 'ValueError' of type '<class 'type'>' encountered. (wrong)
Why
ValueError is collected as a closure variable and converted to a FOAST symbol before the AST is visited, so DialectParser.generic_visit — which consults the catalogue — is never reached.
Impact
try / except X is the common spelling; the catalogued ast.Try message is effectively only reachable via the rare try / finally form.
ast.Raise is likely affected in the same way (raise ValueError(...)).
The user-visible effect is that a plain unsupported-syntax error is reported as an internal type error with no actionable hint.
Possible direction
Visit the AST for unsupported constructs before (or independently of) resolving closure variables, so syntax-level rejections win over symbol-level ones. Adding a test for the try / except X spelling in tests/next_tests/unit_tests/ffront_tests/test_diagnostic_messages.py would pin the fix.
Found while removing the Python 3.10 shims in #2755.
Constructs that
gt4py.nextrejects via the_UNSUPPORTED_FEATURE_HINTScatalogue inffront/dialect_parser.pyonly produce their friendly diagnostic when they do not reference an external name. If the construct names a symbol (e.g. an exception type), closure-variable resolution runs first and fails with an unrelated, internal-sounding message.Reproduction
Results:
try_finallyUnsupportedPythonFeatureError: Unsupported Python syntax: 'try' statement.(correct)try_exceptDSLTypeError: Unexpected object 'ValueError' of type '<class 'type'>' encountered.(wrong)Why
ValueErroris collected as a closure variable and converted to a FOAST symbol before the AST is visited, soDialectParser.generic_visit— which consults the catalogue — is never reached.Impact
try/except Xis the common spelling; the cataloguedast.Trymessage is effectively only reachable via the raretry/finallyform.ast.TryStaris entirely unreachable:try*grammatically requires anexcept*handler, which must name an exception type. The catalogue entry added in fix[cartesian, eve, next]: latent bugs and deprecated typing shims surfaced by the Python 3.12 floor #2755 is therefore pinned at the catalogue level rather than end-to-end, with a comment explaining why.ast.Raiseis likely affected in the same way (raise ValueError(...)).The user-visible effect is that a plain unsupported-syntax error is reported as an internal type error with no actionable hint.
Possible direction
Visit the AST for unsupported constructs before (or independently of) resolving closure variables, so syntax-level rejections win over symbol-level ones. Adding a test for the
try/except Xspelling intests/next_tests/unit_tests/ffront_tests/test_diagnostic_messages.pywould pin the fix.Found while removing the Python 3.10 shims in #2755.