Skip to content

OverflowErrors when using u64s #125

@alec-deason

Description

@alec-deason

When I define a WIT record that includes u64 fields and try to access those fields from python I get OverflowErrors out of the componentize_py_to_canon_i64 function in the runtime. I believe that's happening because u64 and s64 are conflated in several places including https://github.com/bytecodealliance/componentize-py/blob/main/src/bindgen.rs#L602

Naively changing the return type of that function to u64 fixes the issue for me because I am exclusively using u64s but I assume it would break code that was using signed values. If I'm understanding things correctly then the real solution would be to create a new componentize-py#ToCanonU64 which returns u64 in the rust layer and is defined as returning NumType::I64 in IMPORT_SIGNATURES since wasm's internal i64 type seems to be used for both signed and unsigned data. If that sounds correct to you, I'm happy to write up a PR with the change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions