Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

uint and int refuse values past the JavaScript safe-integer ceiling

Offen
#20 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Anfängerfreundlichkeit
75/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
python
Bereich
backend

Rechercherichtung

Start with src/compact_encoding/integer.py and read how MAX_SAFE_INTEGER is applied to integer codecs. Run the conformance cases int-past-range, int-past-range-min, uint-decode-ceiling, and uint56-decode-ceiling. Done means Python integers beyond the JavaScript safe-integer ceiling encode and decode according to the expected corpus results instead of being refused.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

Found by running the compact-encoding-test conformance corpus against this port.

uint, int and the fixed-width codecs refuse values above 9007199254740991, the largest integer a JavaScript double holds exactly:

import compact_encoding as c

c.encode(c.int, 4503599627370496)                                   # ValueError: integer is greater than the maximum safe integer
c.uint.decode(c.State(bytes.fromhex('ff0000000000002000')))         # ValueError: uint is greater than the maximum safe integer
c.uint56.decode(c.State(bytes.fromhex('00000000000020')))           # ValueError: uint is greater than the maximum safe integer

The ceiling comes from MAX_SAFE_INTEGER in src/compact_encoding/integer.py, mirroring the reference. The corpus treats it as the reference's limit rather than the format's: per holepunchto/compact-encoding-test#120 and #128, int writes 4503599627370496 as ff0000000000002000 and -4503599627370497 as ff0100000000002000, and both decodes return 9007199254740992. An implementation may refuse a value its number type cannot hold (the unrepresentable outcome), but Python's int holds all of them, so the refusal is a divergence (holepunchto/compact-encoding-test#19).

The corpus cases are int-past-range and int-past-range-min (rule signed-range), and uint-decode-ceiling and uint56-decode-ceiling (rule decode-ceiling).

Vorherrschende Sprache
Python
Sterne
1
Forks
1
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Entwicklungsumgebung

Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus holepunchto/compact-encoding-python

Alle Issues in holepunchto/compact-encoding-python

Ähnliche Issues

Weitere Issues zu Python

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.