Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
2ede91a
builtins: add dict and set sizeof methods
youknowone Aug 9, 2026
1891103
collections: align OrderedDict public methods with 3.14
youknowone Aug 9, 2026
0b64e3d
builtins: expose Python 3.14 text signatures
youknowone Aug 9, 2026
2e77eea
bool: expose Python 3.14 text signatures
youknowone Aug 9, 2026
85ecc3e
functional: expose Python 3.14 text signatures
youknowone Aug 9, 2026
8334c03
property: expose Python 3.14 text signatures
youknowone Aug 10, 2026
cca0ff3
super: expose Python 3.14 text signatures
youknowone Aug 10, 2026
52a9780
slice: expose Python 3.14 text signatures
youknowone Aug 10, 2026
a3925af
range: expose Python 3.14 text signatures
youknowone Aug 10, 2026
a072724
tuple: expose Python 3.14 text signatures
youknowone Aug 10, 2026
9e96261
type: expose Python 3.14 text signatures
youknowone Aug 10, 2026
0f6a04e
list: expose Python 3.14 text signatures
youknowone Aug 10, 2026
7a5da10
dict: expose Python 3.14 text signatures
youknowone Aug 10, 2026
7bb68e7
set: expose Python 3.14 text signatures
youknowone Aug 10, 2026
689cee8
int: expose Python 3.14 text signatures
youknowone Aug 10, 2026
45aed77
float: expose Python 3.14 text signatures
youknowone Aug 10, 2026
6c43ce7
complex: match Python 3.14 metadata and zero signs
youknowone Aug 10, 2026
dfbe076
str: expose Python 3.14 text signatures
youknowone Aug 10, 2026
24cf766
bytes: expose Python 3.14 text signatures
youknowone Aug 10, 2026
1bb38df
bytearray: expose Python 3.14 text signatures
youknowone Aug 10, 2026
7d2af75
memoryview: expose Python 3.14 text signatures
youknowone Aug 10, 2026
a183e01
descriptors: expose Python 3.14 text signatures
youknowone Aug 10, 2026
7dee244
memoryview: port Python 3.14 tobytes order
youknowone Aug 10, 2026
6f69d9f
exceptions: port Python 3.14 syntax error offsets
youknowone Aug 10, 2026
e7d5754
runtime: install script context before codec lookup
youknowone Aug 10, 2026
dd23fda
exceptions: select nonascii bytes literal token
youknowone Aug 10, 2026
9d82733
exceptions: recurse into fstring diagnostics
youknowone Aug 10, 2026
42f1b9c
exceptions: prioritize indentation diagnostics
youknowone Aug 10, 2026
26f93b5
exceptions: restore global nonlocal conflict range
youknowone Aug 10, 2026
d94a0d6
exceptions: select generator for token in binary call
youknowone Aug 10, 2026
870b5dc
posix: implement forkpty lifecycle
youknowone Aug 10, 2026
34b7868
exceptions: name dict comprehension assignment targets
youknowone Aug 10, 2026
5d655d9
jit: classify raw shape pointers as integer words
youknowone Aug 10, 2026
814d3ac
frame: preserve inlined comprehension locals
youknowone Aug 10, 2026
fe4b496
exceptions: diagnose incompatible string prefixes
youknowone Aug 10, 2026
81b3146
exceptions: align f-string brace diagnostics
youknowone Aug 10, 2026
92feee0
exceptions: decode malformed unicode name escapes first
youknowone Aug 10, 2026
ec79672
exceptions: restore f-string comment diagnostics
youknowone Aug 10, 2026
0c0afed
exceptions: retain f-string delimiter mismatches
youknowone Aug 10, 2026
548eda3
exceptions: preserve unterminated f-string tokens
youknowone Aug 10, 2026
ea731d7
parity_tests: end the Python 3.14 fixtures with the runner's OK line
youknowone Aug 10, 2026
ae7d5b2
posix: keep forkpty out of sandbox builds
youknowone Aug 11, 2026
6cbd410
parity_tests: keep codec fixture output ASCII
youknowone Aug 11, 2026
4959bb5
jit: preserve MIFrame stack across branch aborts
youknowone Aug 11, 2026
8bd88f9
jit: resume branch aborts with consumed for-iter item
youknowone Aug 11, 2026
0ef4a58
jit: preserve live closure state across aborts
youknowone Aug 11, 2026
e57797e
tests: terminate recursive closure parity fixture
youknowone Aug 11, 2026
ccdf0cc
jit: keep abort continuations on their owning frame
youknowone Aug 11, 2026
238629c
bench: re-record list setslice performance gate
youknowone Aug 11, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions majit/majit-translate/src/codewriter/assembler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3283,6 +3283,8 @@ fn type_flag_from_str(
use majit_ir::descr::ArrayFlag;
let word = crate::layout::target_word_size();
match type_str {
// descr.py:241-254 raw Ptr parity; see call.rs::get_type_flag.
"*const u8" => (ArrayFlag::Unsigned, majit_ir::value::Type::Int, word),
s if s.starts_with('&')
|| s.starts_with("Box<")
|| s.starts_with("Arc<")
Expand Down
21 changes: 21 additions & 0 deletions majit/majit-translate/src/codewriter/call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7487,6 +7487,16 @@ pub(crate) fn get_type_flag(
) -> (majit_ir::descr::ArrayFlag, majit_ir::value::Type, usize) {
use majit_ir::descr::ArrayFlag;
match type_str {
// descr.py:241-254: Ptr whose pointee has `_gckind == 'raw'` is an
// unsigned, int-banked word. Pyre's mapdict shape pointers are erased
// to `*const u8`; they are immortal raw identities, not GC references.
// Keep `*mut PyObject` and other erased managed pointers on the
// conservative Ref fallback below.
"*const u8" => (
ArrayFlag::Unsigned,
majit_ir::value::Type::Int,
crate::layout::target_word_size(),
),
// RPython: isinstance(TYPE, lltype.Ptr) and TYPE.TO._gckind == 'gc' → FLAG_POINTER
s if s.starts_with('&')
|| s.starts_with("Box<")
Expand Down Expand Up @@ -9617,6 +9627,17 @@ mod tests {
assert!(!cc.is_known_struct("*mut PyObject"));
}

#[test]
fn raw_byte_identity_pointer_is_int_banked() {
use majit_ir::descr::ArrayFlag;
use majit_ir::value::Type;

let (flag, field_type, size) = get_type_flag("*const u8");
assert_eq!(flag, ArrayFlag::Unsigned);
assert_eq!(field_type, Type::Int);
assert_eq!(size, crate::layout::target_word_size());
}

#[derive(Debug)]
struct StubVInfo {
vtypeptr_id: usize,
Expand Down
4 changes: 3 additions & 1 deletion pyre/bench/synth/list_setslice.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# pyre-check: max-pypy-ratio=8
# pyre-check: max-pypy-ratio=1.4
# Re-recorded at twice the slowest native ratio: macOS 0.2x, Ubuntu 0.7x,
# Windows 0.5x. The lower ceiling also lowers the derived speed floor.
# Benchmark: integer list setslice (per-strategy ops)
# Exercises W_ListObject slice assignment: lst[a:b] = [...] on Integer strategy.
# PYPYLOG confirms: guard_class(IntegerListStrategy) + new_array(3, ArrayS 8).
Expand Down
25 changes: 25 additions & 0 deletions pyre/extra_tests/parity_tests/bool_text_signatures_python314.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
"""CPython 3.14 text signatures for bool's own descriptors."""

import inspect


EXPECTED = {
"__new__": "($type, *args, **kwargs)",
"__repr__": "($self, /)",
"__invert__": "($self, /)",
"__and__": "($self, value, /)",
"__rand__": "($self, value, /)",
"__or__": "($self, value, /)",
"__ror__": "($self, value, /)",
"__xor__": "($self, value, /)",
"__rxor__": "($self, value, /)",
}

for name, signature in EXPECTED.items():
descriptor = bool.__dict__[name]
assert descriptor.__text_signature__ == signature, name

assert str(inspect.signature(bool.__repr__)) == "(self, /)"
assert str(inspect.signature(bool.__and__)) == "(self, value, /)"

print("OK")
65 changes: 65 additions & 0 deletions pyre/extra_tests/parity_tests/builtin_text_signatures_python314.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
"""CPython 3.14 text signatures for functions in the builtins module."""

import builtins
import inspect


EXPECTED = {
"__import__": "($module, /, name, globals=None, locals=None, fromlist=(),\n level=0)",
"abs": "($module, x, /)",
"aiter": "($module, async_iterable, /)",
"all": "($module, iterable, /)",
"anext": "($module, aiterator, default=<unrepresentable>, /)",
"any": "($module, iterable, /)",
"ascii": "($module, obj, /)",
"bin": "($module, number, /)",
"breakpoint": "($module, /, *args, **kws)",
"callable": "($module, obj, /)",
"chr": "($module, i, /)",
"compile": "($module, /, source, filename, mode, flags=0,\n dont_inherit=False, optimize=-1, *, _feature_version=-1)",
"delattr": "($module, obj, name, /)",
"divmod": "($module, x, y, /)",
"eval": "($module, source, /, globals=None, locals=None)",
"exec": "($module, source, /, globals=None, locals=None, *, closure=None)",
"format": "($module, value, format_spec='', /)",
"globals": "($module, /)",
"hasattr": "($module, obj, name, /)",
"hash": "($module, obj, /)",
"hex": "($module, number, /)",
"id": "($module, obj, /)",
"input": "($module, prompt='', /)",
"isinstance": "($module, obj, class_or_tuple, /)",
"issubclass": "($module, cls, class_or_tuple, /)",
"len": "($module, obj, /)",
"locals": "($module, /)",
"oct": "($module, number, /)",
"open": "($module, /, file, mode='r', buffering=-1, encoding=None,\n errors=None, newline=None, closefd=True, opener=None)",
"ord": "($module, character, /)",
"pow": "($module, /, base, exp, mod=None)",
"print": "($module, /, *args, sep=' ', end='\\n', file=None, flush=False)",
"repr": "($module, obj, /)",
"round": "($module, /, number, ndigits=None)",
"setattr": "($module, obj, name, value, /)",
"sorted": "($module, iterable, /, *, key=None, reverse=False)",
"sum": "($module, iterable, /, start=0)",
}

for name, signature in EXPECTED.items():
assert getattr(builtins, name).__text_signature__ == signature, name

for name in ("__build_class__", "dir", "getattr", "iter", "max", "min", "next", "vars"):
assert getattr(builtins, name).__text_signature__ is None, name

assert str(inspect.signature(len)) == "(obj, /)"
assert str(inspect.signature(sorted)) == (
"(iterable, /, *, key=None, reverse=False)"
)
assert str(inspect.signature(open)) == (
"(file, mode='r', buffering=-1, encoding=None, errors=None, newline=None, "
"closefd=True, opener=None)"
)
assert str(inspect.signature(print)) == (
"(*args, sep=' ', end='\\n', file=None, flush=False)"
)

print("OK")
101 changes: 101 additions & 0 deletions pyre/extra_tests/parity_tests/bytearray_text_signatures_python314.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
"""CPython 3.14 text signatures for bytearray descriptors."""

import inspect


EXPECTED = {
"__new__": "($type, *args, **kwargs)",
"__repr__": "($self, /)",
"__str__": "($self, /)",
"__lt__": "($self, value, /)",
"__le__": "($self, value, /)",
"__eq__": "($self, value, /)",
"__ne__": "($self, value, /)",
"__gt__": "($self, value, /)",
"__ge__": "($self, value, /)",
"__iter__": "($self, /)",
"__init__": "($self, /, *args, **kwargs)",
"__buffer__": "($self, flags, /)",
"__release_buffer__": "($self, buffer, /)",
"__mod__": "($self, value, /)",
"__rmod__": "($self, value, /)",
"__len__": "($self, /)",
"__getitem__": "($self, key, /)",
"__setitem__": "($self, key, value, /)",
"__delitem__": "($self, key, /)",
"__add__": "($self, value, /)",
"__mul__": "($self, value, /)",
"__rmul__": "($self, value, /)",
"__contains__": "($self, key, /)",
"__iadd__": "($self, value, /)",
"__imul__": "($self, value, /)",
"__alloc__": "($self, /)",
"__reduce__": "($self, /)",
"__reduce_ex__": "($self, proto=0, /)",
"__sizeof__": "($self, /)",
"append": "($self, item, /)",
"capitalize": "($self, /)",
"center": "($self, width, fillchar=b' ', /)",
"clear": "($self, /)",
"copy": "($self, /)",
"count": "($self, sub[, start[, end]], /)",
"decode": "($self, /, encoding='utf-8', errors='strict')",
"endswith": "($self, suffix[, start[, end]], /)",
"expandtabs": "($self, /, tabsize=8)",
"extend": "($self, iterable_of_ints, /)",
"find": "($self, sub[, start[, end]], /)",
"hex": "($self, /, sep=<unrepresentable>, bytes_per_sep=1)",
"index": "($self, sub[, start[, end]], /)",
"insert": "($self, index, item, /)",
"isalnum": "($self, /)",
"isalpha": "($self, /)",
"isascii": "($self, /)",
"isdigit": "($self, /)",
"islower": "($self, /)",
"isspace": "($self, /)",
"istitle": "($self, /)",
"isupper": "($self, /)",
"join": "($self, iterable_of_bytes, /)",
"ljust": "($self, width, fillchar=b' ', /)",
"lower": "($self, /)",
"lstrip": "($self, bytes=None, /)",
"partition": "($self, sep, /)",
"pop": "($self, index=-1, /)",
"remove": "($self, value, /)",
"replace": "($self, old, new, count=-1, /)",
"removeprefix": "($self, prefix, /)",
"removesuffix": "($self, suffix, /)",
"resize": "($self, size, /)",
"reverse": "($self, /)",
"rfind": "($self, sub[, start[, end]], /)",
"rindex": "($self, sub[, start[, end]], /)",
"rjust": "($self, width, fillchar=b' ', /)",
"rpartition": "($self, sep, /)",
"rsplit": "($self, /, sep=None, maxsplit=-1)",
"rstrip": "($self, bytes=None, /)",
"split": "($self, /, sep=None, maxsplit=-1)",
"splitlines": "($self, /, keepends=False)",
"startswith": "($self, prefix[, start[, end]], /)",
"strip": "($self, bytes=None, /)",
"swapcase": "($self, /)",
"title": "($self, /)",
"translate": "($self, table, /, delete=b'')",
"upper": "($self, /)",
"zfill": "($self, width, /)",
}

for name, signature in EXPECTED.items():
assert bytearray.__dict__[name].__text_signature__ == signature, name

raw_maketrans = bytearray.__dict__["maketrans"]
assert not hasattr(raw_maketrans, "__text_signature__")
assert bytearray.maketrans.__text_signature__ == "(frm, to, /)"
assert bytearray.__dict__["fromhex"].__text_signature__ == "($type, string, /)"

assert str(inspect.signature(bytearray.decode)) == (
"(self, /, encoding='utf-8', errors='strict')"
)
assert str(inspect.signature(bytearray.resize)) == "(self, size, /)"
assert str(inspect.signature(bytearray.fromhex)) == "(string, /)"

print("OK")
85 changes: 85 additions & 0 deletions pyre/extra_tests/parity_tests/bytes_text_signatures_python314.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
"""CPython 3.14 text signatures for bytes descriptors."""

import inspect


EXPECTED = {
"__new__": "($type, *args, **kwargs)",
"__repr__": "($self, /)",
"__hash__": "($self, /)",
"__str__": "($self, /)",
"__lt__": "($self, value, /)",
"__le__": "($self, value, /)",
"__eq__": "($self, value, /)",
"__ne__": "($self, value, /)",
"__gt__": "($self, value, /)",
"__ge__": "($self, value, /)",
"__iter__": "($self, /)",
"__buffer__": "($self, flags, /)",
"__mod__": "($self, value, /)",
"__rmod__": "($self, value, /)",
"__len__": "($self, /)",
"__getitem__": "($self, key, /)",
"__add__": "($self, value, /)",
"__mul__": "($self, value, /)",
"__rmul__": "($self, value, /)",
"__contains__": "($self, key, /)",
"__getnewargs__": "($self, /)",
"__bytes__": "($self, /)",
"capitalize": "($self, /)",
"center": "($self, width, fillchar=b' ', /)",
"count": "($self, sub[, start[, end]], /)",
"decode": "($self, /, encoding='utf-8', errors='strict')",
"endswith": "($self, suffix[, start[, end]], /)",
"expandtabs": "($self, /, tabsize=8)",
"find": "($self, sub[, start[, end]], /)",
"hex": "($self, /, sep=<unrepresentable>, bytes_per_sep=1)",
"index": "($self, sub[, start[, end]], /)",
"isalnum": "($self, /)",
"isalpha": "($self, /)",
"isascii": "($self, /)",
"isdigit": "($self, /)",
"islower": "($self, /)",
"isspace": "($self, /)",
"istitle": "($self, /)",
"isupper": "($self, /)",
"join": "($self, iterable_of_bytes, /)",
"ljust": "($self, width, fillchar=b' ', /)",
"lower": "($self, /)",
"lstrip": "($self, bytes=None, /)",
"partition": "($self, sep, /)",
"replace": "($self, old, new, count=-1, /)",
"removeprefix": "($self, prefix, /)",
"removesuffix": "($self, suffix, /)",
"rfind": "($self, sub[, start[, end]], /)",
"rindex": "($self, sub[, start[, end]], /)",
"rjust": "($self, width, fillchar=b' ', /)",
"rpartition": "($self, sep, /)",
"rsplit": "($self, /, sep=None, maxsplit=-1)",
"rstrip": "($self, bytes=None, /)",
"split": "($self, /, sep=None, maxsplit=-1)",
"splitlines": "($self, /, keepends=False)",
"startswith": "($self, prefix[, start[, end]], /)",
"strip": "($self, bytes=None, /)",
"swapcase": "($self, /)",
"title": "($self, /)",
"translate": "($self, table, /, delete=b'')",
"upper": "($self, /)",
"zfill": "($self, width, /)",
}

for name, signature in EXPECTED.items():
assert bytes.__dict__[name].__text_signature__ == signature, name

raw_maketrans = bytes.__dict__["maketrans"]
assert not hasattr(raw_maketrans, "__text_signature__")
assert bytes.maketrans.__text_signature__ == "(frm, to, /)"
assert bytes.__dict__["fromhex"].__text_signature__ == "($type, string, /)"

assert str(inspect.signature(bytes.decode)) == (
"(self, /, encoding='utf-8', errors='strict')"
)
assert str(inspect.signature(bytes.replace)) == "(self, old, new, count=-1, /)"
assert str(inspect.signature(bytes.fromhex)) == "(string, /)"

print("OK")
38 changes: 38 additions & 0 deletions pyre/extra_tests/parity_tests/complex_text_signatures_python314.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
"""CPython 3.14 text signatures for complex descriptors."""

import inspect


VALUE_BINARY = {
name: "($self, value, /)"
for name in (
"__lt__", "__le__", "__eq__", "__ne__", "__gt__", "__ge__",
"__add__", "__radd__", "__sub__", "__rsub__", "__mul__", "__rmul__",
"__truediv__", "__rtruediv__",
)
}
SELF_ONLY = {
name: "($self, /)"
for name in (
"__repr__", "__hash__", "__neg__", "__pos__", "__abs__", "__bool__",
"conjugate", "__complex__", "__getnewargs__",
)
}
Comment on lines +6 to +20

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Replace the constant-valued dict comprehensions with dict.fromkeys.

Ruff reports C420 on both comprehensions. Each maps every key to the same constant string.

♻️ Proposed change
-VALUE_BINARY = {
-    name: "($self, value, /)"
-    for name in (
+VALUE_BINARY = dict.fromkeys(
+    (
         "__lt__", "__le__", "__eq__", "__ne__", "__gt__", "__ge__",
         "__add__", "__radd__", "__sub__", "__rsub__", "__mul__", "__rmul__",
         "__truediv__", "__rtruediv__",
-    )
-}
-SELF_ONLY = {
-    name: "($self, /)"
-    for name in (
+    ),
+    "($self, value, /)",
+)
+SELF_ONLY = dict.fromkeys(
+    (
         "__repr__", "__hash__", "__neg__", "__pos__", "__abs__", "__bool__",
         "conjugate", "__complex__", "__getnewargs__",
-    )
-}
+    ),
+    "($self, /)",
+)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
VALUE_BINARY = {
name: "($self, value, /)"
for name in (
"__lt__", "__le__", "__eq__", "__ne__", "__gt__", "__ge__",
"__add__", "__radd__", "__sub__", "__rsub__", "__mul__", "__rmul__",
"__truediv__", "__rtruediv__",
)
}
SELF_ONLY = {
name: "($self, /)"
for name in (
"__repr__", "__hash__", "__neg__", "__pos__", "__abs__", "__bool__",
"conjugate", "__complex__", "__getnewargs__",
)
}
VALUE_BINARY = dict.fromkeys(
(
"__lt__", "__le__", "__eq__", "__ne__", "__gt__", "__ge__",
"__add__", "__radd__", "__sub__", "__rsub__", "__mul__", "__rmul__",
"__truediv__", "__rtruediv__",
),
"($self, value, /)",
)
SELF_ONLY = dict.fromkeys(
(
"__repr__", "__hash__", "__neg__", "__pos__", "__abs__", "__bool__",
"conjugate", "__complex__", "__getnewargs__",
),
"($self, /)",
)
🧰 Tools
🪛 Ruff (0.16.1)

[warning] 6-13: Unnecessary dict comprehension for iterable; use dict.fromkeys instead

Replace with dict.fromkeys(iterable))

(C420)


[warning] 14-20: Unnecessary dict comprehension for iterable; use dict.fromkeys instead

Replace with dict.fromkeys(iterable))

(C420)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pyre/extra_tests/parity_tests/complex_text_signatures_python314.py` around
lines 6 - 20, Replace the VALUE_BINARY and SELF_ONLY constant-valued dict
comprehensions with dict.fromkeys, preserving their existing key collections and
mapped signature strings.

Source: Linters/SAST tools

EXPECTED = {
"__new__": "($type, *args, **kwargs)",
**VALUE_BINARY,
**SELF_ONLY,
"__pow__": "($self, value, mod=None, /)",
"__rpow__": "($self, value, mod=None, /)",
"from_number": "($type, number, /)",
"__format__": "($self, format_spec, /)",
}

for name, signature in EXPECTED.items():
assert complex.__dict__[name].__text_signature__ == signature, name

assert str(inspect.signature(complex.from_number)) == "(number, /)"
assert str(inspect.signature(complex.__pow__)) == "(self, value, mod=None, /)"
assert str(inspect.signature(complex.conjugate)) == "(self, /)"

print("OK")
18 changes: 18 additions & 0 deletions pyre/extra_tests/parity_tests/dict_set_sizeof_python314.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
"""Python 3.14 ``__sizeof__`` surface for dict and set-like types."""

for typ in (dict, set, frozenset):
assert "__sizeof__" in typ.__dict__
assert typ.__sizeof__.__text_signature__ == "($self, /)"

assert dict().__sizeof__() == 48
assert {0: None}.__sizeof__() == 208
assert {str(i): None for i in range(6)}.__sizeof__() == 256
assert dict.fromkeys(range(11)).__sizeof__() == 616

for typ in (set, frozenset):
assert typ().__sizeof__() == 200
assert typ(range(4)).__sizeof__() == 200
assert typ(range(5)).__sizeof__() == 712
assert typ(range(19)).__sizeof__() == 2248
Comment on lines +7 to +16

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Two parity fixtures hardcode 64-bit-specific integers. Both encode values that depend on the pointer width, so they fail on a 32-bit build and the runner attributes the failure to pyre rather than to the platform.

  • pyre/extra_tests/parity_tests/dict_set_sizeof_python314.py#L7-L16: the eight byte counts derive from size_of::<usize>() == 8; guard the block with a sys.maxsize > 2**32 check.
  • pyre/extra_tests/parity_tests/tuple_text_signatures_python314.py#L33-L35: 9223372036854775807 is the 64-bit sys.maxsize; build the expected string with an f-string over sys.maxsize.
🧰 Tools
🪛 Ruff (0.16.1)

[warning] 7-7: Unnecessary dict() call (rewrite as a literal)

Rewrite as a literal

(C408)

📍 Affects 2 files
  • pyre/extra_tests/parity_tests/dict_set_sizeof_python314.py#L7-L16 (this comment)
  • pyre/extra_tests/parity_tests/tuple_text_signatures_python314.py#L33-L35
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pyre/extra_tests/parity_tests/dict_set_sizeof_python314.py` around lines 7 -
16, Guard the size assertions in
pyre/extra_tests/parity_tests/dict_set_sizeof_python314.py lines 7-16 with a
sys.maxsize > 2**32 check, since all eight expected values are 64-bit-specific.
In pyre/extra_tests/parity_tests/tuple_text_signatures_python314.py lines 33-35,
replace the hardcoded 64-bit maximum with an f-string that uses sys.maxsize when
constructing the expected signature.


print("OK")
Loading
Loading