uint and int refuse values past the JavaScript safe-integer ceiling
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Anfängerfreundlichkeit
- 75/100
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
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus holepunchto/compact-encoding-python
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 74/100
Alle Issues in holepunchto/compact-encoding-python
Ähnliche Issues
-
bug needs-triage priority:medium
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 86/100
yeongseon/azure-functions-logging-python#583 ·
Maintainer antworten meist innerhalb von 1 Tag
-
documentation needs-triage priority:medium
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 85/100
yeongseon/azure-functions-validation-python#546 ·
Maintainer antworten meist innerhalb von 1 Tag
-
PHP workflow streaming requests buffer the full SSE responseEvtl. vergeben @Winoren hat das heute übernommen. Offenreview: medium
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 84/100
langgenius/dify#44270 · 1 Kommentar · 1 Reaktion ·
Maintainer antworten meist innerhalb von 1 Tag
-
P4: low
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
jeffknupp/association#523 ·
-
bug help wanted
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 65/100
DarkStarSystems/pcons#229 ·
Maintainer antworten meist innerhalb von 1 Tag