Skip to content

in longlong build, can't directly write the constant -9223372036854775808 #17932

@jepler

Description

@jepler

Port, board and/or hardware

unix, coverage build, x86_64 linx

MicroPython version

v1.27.0-preview-32-g141f7d0c35

Reproduction

  1. Build the unix "longlong variant"
  2. in the repl, type int("-9223372036854775808")
  3. in the repl, type -9223372036854775808

Expected behaviour

The integer constant can be parsed.

Observed behaviour

Each case results in OverflowError: result overflows long long storage. However, they're slightly different:

  • the first one reaches mp_parse_num_integer with the string argument "-9223372036854775808". This may be relatively straightforward to fix.
  • the second reaches mp_parse_num_integer with the string argument "9223372036854775808" (no leading "-"). Fixing this would require making the byte compiler recognize unary negation of an integer constant as special.

Additional Information

No, I've provided everything above.

Code of Conduct

Yes, I agree

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions