Skip to content

Commit b04620b

Browse files
committed
Fix error_kind
1 parent 4468bcd commit b04620b

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

mypyc/primitives/misc_ops.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from mypyc.ir.ops import ERR_FALSE, ERR_MAGIC, ERR_NEVER
5+
from mypyc.ir.ops import ERR_FALSE, ERR_MAGIC, ERR_MAGIC_OVERLAPPING, ERR_NEVER
66
from mypyc.ir.rtypes import (
77
KNOWN_NATIVE_TYPES,
88
bit_rprimitive,
@@ -430,13 +430,13 @@
430430
arg_types=[object_rprimitive, uint8_rprimitive],
431431
return_type=none_rprimitive,
432432
c_function_name="write_tag_internal",
433-
error_kind=ERR_MAGIC,
433+
error_kind=ERR_MAGIC_OVERLAPPING,
434434
)
435435

436436
function_op(
437437
name="native_internal.read_tag",
438438
arg_types=[object_rprimitive],
439439
return_type=uint8_rprimitive,
440440
c_function_name="read_tag_internal",
441-
error_kind=ERR_MAGIC,
441+
error_kind=ERR_MAGIC_OVERLAPPING,
442442
)

mypyc/test-data/run-classes.test

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2721,6 +2721,7 @@ from native_internal import (
27212721
Tag = u8
27222722
TAG_A: Final[Tag] = 33
27232723
TAG_B: Final[Tag] = 255
2724+
TAG_SPECIAL: Final[Tag] = 239
27242725

27252726
def test_buffer_basic() -> None:
27262727
b = Buffer(b"foo")
@@ -2736,6 +2737,7 @@ def test_buffer_roundtrip() -> None:
27362737
write_int(b, 0)
27372738
write_int(b, 1)
27382739
write_tag(b, TAG_A)
2740+
write_tag(b, TAG_SPECIAL)
27392741
write_tag(b, TAG_B)
27402742
write_int(b, 2)
27412743
write_int(b, 2 ** 85)
@@ -2750,6 +2752,7 @@ def test_buffer_roundtrip() -> None:
27502752
assert read_int(b) == 0
27512753
assert read_int(b) == 1
27522754
assert read_tag(b) == TAG_A
2755+
assert read_tag(b) == TAG_SPECIAL
27532756
assert read_tag(b) == TAG_B
27542757
assert read_int(b) == 2
27552758
assert read_int(b) == 2 ** 85
@@ -2775,6 +2778,7 @@ def test_buffer_roundtrip_interpreted() -> None:
27752778
write_int(b, 0)
27762779
write_int(b, 1)
27772780
write_tag(b, 33)
2781+
write_tag(b, 239)
27782782
write_tag(b, 255)
27792783
write_int(b, 2)
27802784
write_int(b, 2 ** 85)
@@ -2789,6 +2793,7 @@ def test_buffer_roundtrip_interpreted() -> None:
27892793
assert read_int(b) == 0
27902794
assert read_int(b) == 1
27912795
assert read_tag(b) == 33
2796+
assert read_tag(b) == 239
27922797
assert read_tag(b) == 255
27932798
assert read_int(b) == 2
27942799
assert read_int(b) == 2 ** 85

0 commit comments

Comments
 (0)