Skip to content

json/yaml typed loads pass the library's exception text through — the error names CLR types (Sharpy.List`1[J1.AppCfg], System.String) #2135

Description

@antonsynd

Found by /verify-implementation plan-0ca7b7 (2026-09-26), measured @ 61bf20f with the built sharpyc; pre-existing at BASE acd1d40 unless noted.

json.loads[list[app_cfg]]('[{"name": 1, "max_conn": "x"}]') prints Err(Sharpy.JSONDecodeError: The JSON value could not be converted to System.String. Path: $[0].name | LineNumber: 0 | BytePositionInLine: 11.: line 1 column 12 (char 11)). The typed doors (Json.cs, Yaml.cs) wrap System.Text.Json / YamlDotNet ex.Message verbatim, and that text spells CLR type names (System.String, Sharpy.List1[J1.AppCfg], J1.AppCfg). The class contract from #2035/P11f is that every runtime message names a type through PyFormat.PyTypeName` (43f2d3a routed the missing-field message). The fix is to translate the library exception (type + path) into a python-named message rather than pass it through. TypeNameMessageSourceScan can't see this because the names come from the BCL at runtime.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    lane:messageOnly the wording, location, steer or code of a diagnostic or exceptionreach:programAn ordinary program a Python programmer would write hits it

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions