[BREAKING CHANGE] Writing magic method names as full name by youknowone · Pull Request #5842 · RustPython/RustPython
stdlib/src/zlib.rs (1)
407-407: LGTM! Consistent attribute update in commented code.
Good practice to update the commented attribute syntax to reflect the new explicit naming convention, maintaining consistency even in unimplemented code.
vm/src/import.rs (1)
214-214: LGTM! Consistent dunder method naming.
The change from traceback() to __traceback__() aligns with the systematic refactoring to use explicit Python dunder method names.
vm/src/coroutine.rs (2)
118-118: LGTM! Consistent exception cause setter naming.
The change from set_cause to set___cause__ aligns with the systematic refactoring to use explicit dunder method naming for exception handling.
124-124: LGTM! Consistent exception cause setter naming.
Same as above - the dunder method naming update maintains functionality while improving consistency.
vm/src/stdlib/ast/python.rs (1)
18-19: LGTM! Proper magic method conversion to explicit dunder naming.
The conversion from #[pymethod(magic)] with fn init to #[pymethod] with fn __init__ correctly implements the new explicit naming convention while preserving all functionality.
vm/src/suggestion.rs (1)
58-58: LGTM: Consistent with systematic magic method refactoring.
The change from exc.traceback()? to exc.__traceback__()? aligns with the codebase-wide refactoring to use explicit Python dunder method names instead of magic method shortcuts.
vm/src/builtins/module.rs (1)
171-172: LGTM: Systematic magic method refactoring applied correctly.
The change from #[pymethod(magic)] fn dir to #[pymethod] fn __dir__ follows the codebase-wide pattern of replacing magic method shortcuts with explicit Python dunder method names, while preserving the exact implementation logic.
vm/src/builtins/filter.rs (1)
37-38: LGTM: Systematic magic method refactoring applied correctly.
The change from #[pymethod(magic)] fn reduce to #[pymethod] fn __reduce__ is consistent with the codebase-wide refactoring to use explicit Python dunder method names, while maintaining the exact serialization protocol implementation.
vm/src/frame.rs (2)
386-386: LGTM: Consistent with systematic magic method refactoring.
The change from exception.traceback() to exception.__traceback__() aligns with the codebase-wide refactoring to use explicit Python dunder method names in exception handling.
1711-1711: LGTM: Systematic magic method refactoring applied correctly.
The change from exception.set_cause(cause) to exception.set___cause__(cause) follows the consistent pattern of replacing magic method shortcuts with explicit dunder method names throughout the codebase.
vm/src/stdlib/ctypes/base.rs (1)
264-267: LGTM! Correct magic method renaming.
The method is correctly renamed from mul with the magic attribute to the explicit Python special method name __mul__, consistent with the codebase-wide refactoring effort and Python's canonical naming conventions.
vm/src/builtins/weakref.rs (1)
55-58: LGTM! Correct magic method renaming.
The method is correctly renamed from class_getitem with the magic attribute to the explicit Python special method name __class_getitem__, following the standard pattern used across all builtin types for generic type subscription.
stdlib/src/pystruct.rs (1)
194-197: LGTM! Correct magic method renaming.
The method is correctly renamed from length_hint with the magic attribute to the explicit Python special method name __length_hint__, consistent with the pattern used across iterator types throughout the codebase.
vm/src/builtins/generator.rs (1)
40-48: LGTM! Correct magic attribute renaming.
The getter and setter for the __name__ attribute are correctly renamed from name/set_name with the magic attribute to the explicit Python special attribute names __name__/set___name__, consistent with the pattern used across coroutines, async generators, and functions.
vm/src/builtins/coroutine.rs (1)
37-45: LGTM! Correct magic attribute renaming.
The getter and setter for the __name__ attribute are correctly renamed from name/set_name with the magic attribute to the explicit Python special attribute names __name__/set___name__, consistent with the pattern used across generators, async generators, and functions.
vm/src/builtins/map.rs (2)
37-38: Correctly renamed magic method to use explicit dunder naming.
The method length_hint has been appropriately renamed to __length_hint__ and the magic attribute removed, aligning with Python's special method naming conventions.
46-47: Correctly renamed magic method to use explicit dunder naming.
The method reduce has been appropriately renamed to __reduce__ and the magic attribute removed, following Python's pickling protocol conventions.
vm/src/builtins/namespace.rs (2)
43-44: Correctly renamed magic method to use explicit dunder naming.
The method reduce has been appropriately renamed to __reduce__ and the magic attribute removed, consistent with Python's pickling protocol.
99-99: Good consistency in using the new dunder method naming internally.
The internal call has been updated from dict.len() to dict.__len__(), maintaining consistency with the new explicit dunder method naming convention throughout the codebase.
vm/src/stdlib/ctypes/function.rs (2)
202-203: Correctly renamed property getter to use explicit dunder naming.
The getter method name has been appropriately renamed to __name__ and the magic attribute removed, aligning with Python's standard __name__ attribute for callable objects.
207-208: Correctly renamed property setter to use explicit dunder naming.
The setter method set_name has been appropriately renamed to set___name__ and the magic attribute removed, maintaining consistency with the getter method naming.
vm/src/stdlib/thread.rs (2)
161-162: Correctly renamed context manager method to use explicit dunder naming.
The method exit has been appropriately renamed to __exit__ and the magic attribute removed, aligning with Python's context manager protocol.
247-248: Correctly renamed context manager method to use explicit dunder naming.
The method exit in RLock has been appropriately renamed to __exit__ and the magic attribute removed, maintaining consistency with Python's context manager protocol.
vm/src/builtins/super.rs (2)
138-139: Correctly renamed property getter to use explicit dunder naming.
The getter method thisclass has been appropriately renamed to __thisclass__ and the magic attribute removed, aligning with Python's special attributes for super objects.
143-144: Correctly renamed property getter to use explicit dunder naming.
The getter method self_class has been appropriately renamed to __self_class__ and the magic attribute removed, maintaining consistency with Python's special attributes for super objects.
vm/src/builtins/getset.rs (3)
133-136: LGTM: Correct standardization to dunder naming
The renaming from name to __name__ and removal of the magic flag correctly aligns with Python's data model for descriptor objects.
138-141: LGTM: Proper qualname attribute naming
The change from qualname to __qualname__ correctly follows Python's naming convention for qualified names in descriptors.
143-146: LGTM: Correct objclass attribute standardization
The renaming from objclass to __objclass__ properly implements the standard Python descriptor protocol.
vm/src/builtins/zip.rs (2)
46-60: LGTM: Correct pickle protocol method naming
The renaming from reduce to __reduce__ and removal of the magic flag correctly follows Python's pickle protocol conventions.
62-68: LGTM: Proper setstate method standardization
The change from setstate to __setstate__ correctly implements the standard Python pickle protocol method.
vm/src/builtins/slice.rs (2)
185-196: LGTM: Correct pickle protocol implementation for PySlice
The renaming from reduce to __reduce__ and removal of the magic flag correctly follows Python's pickle protocol for slice objects.
320-323: LGTM: Proper ellipsis pickle support
The change from reduce to __reduce__ correctly implements the standard Python pickle protocol for ellipsis objects.
vm/src/types/structseq.rs (2)
50-75: LGTM: Correct trait method standardization
The renaming from repr to __repr__ and removal of the magic flag correctly aligns the trait with Python's data model for string representation.
77-80: LGTM: Proper pickle protocol in trait
The change from reduce to __reduce__ correctly implements the standard Python pickle protocol in the trait interface.
vm/src/vm/mod.rs (3)
462-462: LGTM: Correct exception traceback access
The change from e.traceback() to e.__traceback__() correctly uses the standardized dunder method name.
832-839: LGTM: Consistent exception context handling
The method calls to __context__() and set___context__() are consistent with the standardized naming convention for exception context handling.
260-260: Verify triple underscore setter naming convention
The call to set___cause__ uses three underscores, which seems unusual. Please verify this is the correct naming convention for exception cause setters.
#!/bin/bash # Search for other triple underscore setter method definitions to verify naming convention rg -A 2 "set___" --type rust
stdlib/src/select.rs (2)
725-729: LGTM! Context manager protocol correctly implemented.
The method correctly implements the __enter__ protocol by returning self, which is standard behavior for context managers.
731-739: LGTM! Context manager exit protocol correctly implemented.
The __exit__ method properly calls close() to clean up resources, which is the expected behavior for the context manager protocol.
vm/src/builtins/iter.rs (3)
202-216: LGTM! Iterator length hint protocol correctly implemented.
The method properly implements the __length_hint__ protocol by returning the estimated number of remaining items in the sequence iterator.
218-221: LGTM! Pickling protocol correctly implemented.
The __reduce__ method properly enables pickling support for sequence iterators by delegating to the internal reduce implementation.
223-226: LGTM! Unpickling protocol correctly implemented.
The __setstate__ method properly enables unpickling support by restoring the iterator's internal state.
vm/src/builtins/singletons.rs (3)
47-50: LGTM! Boolean conversion protocol correctly implemented.
The method correctly implements __bool__ for PyNone, always returning false as expected for Python's None singleton.
98-101: LGTM! Boolean conversion protocol correctly implemented.
The method correctly implements __bool__ for PyNotImplemented, always returning true as expected for Python's NotImplemented singleton.
103-106: LGTM! Pickling protocol correctly implemented.
The __reduce__ method correctly returns the string name for NotImplemented, enabling proper pickling support for this singleton.
vm/src/stdlib/winreg.rs (3)
104-107: LGTM! Boolean conversion protocol correctly implemented.
The method correctly implements __bool__ by checking if the registry key handle is not null, which is the appropriate way to determine if a registry key is valid.
108-111: LGTM! Context manager entry protocol correctly implemented.
The __enter__ method correctly returns self, following the standard context manager pattern for registry keys.
112-115: LGTM! Context manager exit protocol correctly implemented.
The __exit__ method properly calls Close() to ensure the registry key is properly closed when exiting the context, providing proper resource management.
vm/src/stdlib/operator.rs (3)
359-365: LGTM! Pickling protocol correctly implemented for attrgetter.
The __reduce__ method properly returns a tuple containing the class and attribute names, enabling correct reconstruction during unpickling.
458-462: LGTM! Pickling protocol correctly implemented for itemgetter.
The __reduce__ method properly returns a tuple containing the class and items, enabling correct reconstruction during unpickling.
529-547: LGTM! Pickling protocol correctly implemented for methodcaller.
The __reduce__ method handles both simple cases (no kwargs) and complex cases (with kwargs using partial functions), ensuring proper reconstruction during unpickling.
vm/src/stdlib/functools.rs (2)
103-104: LGTM! Proper migration to explicit dunder method naming.
The change from #[pymethod(magic)] with setstate to #[pymethod] with __setstate__ correctly aligns with Python's special method naming conventions. The method implementation remains unchanged and properly handles the pickle protocol state restoration.
293-293: LGTM! Consistent use of explicit dunder method call.
The change from .module(vm) to .__module__(vm) is consistent with the broader refactoring to use explicit dunder method names throughout the codebase. This maintains the same functionality while following Python's special attribute naming conventions.
stdlib/src/sqlite.rs (2)
1320-1324: __enter__ looks good
The context-manager entry simply returns the Connection itself, which matches CPython’s sqlite3 behaviour.
No further action needed.
2093-2101: Blob context-manager implementation is fine
__enter__ returns self, and __exit__ closes the blob without attempting to suppress exceptions – identical to CPython’s behaviour.
No issues spotted.
vm/src/builtins/property.rs (3)
152-165: LGTM! Correct mapping to Python special method name.
The renaming of set_name to set___name__ properly reflects the Python __set_name__ descriptor protocol method, and removing the magic attribute makes the special method nature explicit.
240-272: LGTM! Proper abstract method attribute naming.
The changes correctly rename:
isabstractmethod→__isabstractmethod__set_isabstractmethod→set___isabstractmethod__
These align with Python's __isabstractmethod__ attribute convention for abstract methods.
292-292: LGTM! Consistent internal call update.
The update from qualname(vm) to __qualname__(vm) is consistent with the broader refactoring to use explicit dunder method names.
stdlib/src/contextvars.rs (3)
200-221: LGTM! Correct mapping to Python special methods.
The systematic renaming follows Python conventions correctly:
getitem→__getitem__(subscription protocol)len→__len__(length protocol)iter→__iter__(iteration protocol)
The multi-line parameter formatting also improves readability.
263-265: LGTM! Consistent internal call update.
The AsMapping implementation correctly updates the internal call to use __len__() instead of the old len() method name, maintaining consistency with the method renaming.
479-486: LGTM! Proper class method naming.
The renaming of class_getitem to __class_getitem__ correctly reflects Python's generic type subscripting protocol and removes the magic attribute appropriately.
vm/src/stdlib/os.rs (2)
584-596: LGTM! Correct path protocol and generic type methods.
The changes properly map to Python special methods:
fspath→__fspath__(PEP 519 path protocol)class_getitem→__class_getitem__(generic type subscripting)
Both follow Python conventions and maintain the original functionality.
644-652: LGTM! Proper context manager protocol methods.
The renaming correctly implements the context manager protocol:
enter→__enter__exit→__exit__
These are the standard Python dunder methods for context managers and the logic is preserved.
vm/src/builtins/bool.rs (3)
113-119: LGTM! Correct format method naming.
The renaming of format to __format__ properly reflects Python's string formatting protocol and removes the magic attribute appropriately.
122-167: LGTM! Proper bitwise operation methods.
The systematic renaming correctly maps to Python special methods:
or→__or__(bitwise OR)and→__and__(bitwise AND)xor→__xor__(bitwise XOR)
The internal calls on lines 131, 147, and 163 are consistently updated to use the new dunder method names.
173-179: LGTM! Consistent trait implementation update.
The AsNumber trait implementation correctly references the renamed dunder methods, maintaining consistency with the method name changes throughout the file.
vm/src/builtins/weakproxy.rs (2)
82-109: LGTM! Correct mapping to Python special methods.
The systematic renaming properly reflects Python protocols:
str→__str__(string representation)bool→__bool__(truthiness testing)bytes→__bytes__(bytes conversion)reversed→__reversed__(reverse iteration)contains→__contains__(membership testing)
All changes maintain the original functionality while making the special method nature explicit.
192-193: LGTM! Consistent internal call update.
The AsSequence trait implementation correctly updates the internal call to use __contains__(), maintaining consistency with the method renaming.
vm/src/builtins/enumerate.rs (5)
57-61: LGTM!
The change correctly updates the class method to use the explicit dunder name __class_getitem__ and removes the magic attribute.
65-71: LGTM!
The change correctly updates the method to use the explicit dunder name __reduce__ and removes the magic attribute.
109-118: LGTM!
The change correctly updates the method to use the explicit dunder name __length_hint__ and removes the magic attribute.
120-123: LGTM!
The change correctly updates the method to use the explicit dunder name __setstate__ and removes the magic attribute.
125-130: LGTM!
The change correctly updates the method to use the explicit dunder name __reduce__ and removes the magic attribute.
vm/src/stdlib/sre.rs (4)
499-506: LGTM!
The change correctly updates the class method to use the explicit dunder name __class_getitem__ and removes the magic attribute.
724-736: LGTM!
The change correctly updates the method to use the explicit dunder name __getitem__ and removes the magic attribute.
813-820: LGTM!
The change correctly updates the class method to use the explicit dunder name __class_getitem__ and removes the magic attribute.
827-831: LGTM!
The internal method call correctly updated to use the new dunder method name __getitem__.
vm/src/builtins/asyncgenerator.rs (5)
42-45: LGTM!
The change correctly updates the getter to use the explicit dunder name __name__ and removes the magic attribute.
47-50: LGTM!
The setter correctly uses the set___name__ naming convention and removes the magic attribute. The non-standard naming is handled by the automatic #[allow(non_snake_case)] addition in the derive macro.
69-72: LGTM!
The change correctly updates the class method to use the explicit dunder name __class_getitem__ and removes the magic attribute.
77-80: LGTM!
The change correctly updates the method to use the explicit dunder name __aiter__ and removes the magic attribute.
82-85: LGTM!
The change correctly updates the method to use the explicit dunder name __anext__ and removes the magic attribute.
vm/src/builtins/union.rs (6)
87-90: LGTM!
The change correctly updates the getter to use the explicit dunder name __parameters__ and removes the magic attribute.
92-95: LGTM!
The change correctly updates the getter to use the explicit dunder name __args__ and removes the magic attribute.
97-112: LGTM!
The change correctly updates the method to use the explicit dunder name __instancecheck__, removes the magic attribute, and properly updates the internal call to __args__().
114-129: LGTM!
The change correctly updates the method to use the explicit dunder name __subclasscheck__, removes the magic attribute, and properly updates the internal call to __args__().
131-135: LGTM!
The change correctly updates the method to use the explicit dunder name __or__ while maintaining the __ror__ alias, and removes the magic attribute.
236-243: LGTM!
The AsNumber trait implementation correctly updated to call the renamed __or__ method.
derive-impl/src/pyclass.rs (5)
1231-1231: LGTM!
Correctly removes "magic" from the allowed method attributes.
755-760: LGTM!
The automatic addition of #[allow(non_snake_case)] for setter methods with dunder names properly handles the naming convention.
791-796: LGTM!
Consistently applies the non_snake_case allowance for getset setters.
951-956: LGTM!
Consistently applies the non_snake_case allowance for member setters.
1386-1398: LGTM!
The slot name normalization correctly strips the double underscores to match the expected slot naming convention.
vm/src/stdlib/io.rs (8)
428-432: LGTM! Correct standardization of context manager entry method.
The change from #[pymethod(magic)] with method name enter to #[pymethod] with __enter__ properly follows Python's special method naming conventions for context managers.
434-438: LGTM! Correct standardization of context manager exit method.
The change from #[pymethod(magic)] with method name exit to #[pymethod] with __exit__ properly follows Python's special method naming conventions for context managers.
1413-1413: LGTM! Consistent with dunder method naming standardization.
The change from e.str(vm) to e.__str__(vm) aligns with the broader refactoring to use explicit Python dunder method names throughout the codebase.
1562-1565: LGTM! Correct standardization of string representation method.
The change from #[pymethod(magic)] with method name repr to #[pymethod] with __repr__ properly follows Python's special method naming conventions for object representation.
1604-1607: LGTM! Correct standardization of serialization method.
The change from #[pymethod(magic)] with method name reduce to #[pymethod] with __reduce__ properly follows Python's special method naming conventions for object serialization.
1683-1683: LGTM! Consistent with dunder method naming standardization.
The change from e.set_context(Some(e1)) to e.set___context__(Some(e1)) aligns with the broader refactoring to use explicit Python dunder method names for exception handling.
2997-3000: LGTM! Consistent serialization method standardization.
The change from #[pymethod(magic)] with method name reduce to #[pymethod] with __reduce__ maintains consistency with Python's special method naming conventions across all IO classes.
4506-4509: LGTM! Complete standardization across all IO classes.
The change from #[pymethod(magic)] with method name reduce to #[pymethod] with __reduce__ completes the consistent application of Python's special method naming conventions across all IO implementations.
vm/src/builtins/descriptor.rs (2)
112-143: LGTM! Excellent systematic refactoring to canonical Python dunder names.
The renaming from name, qualname, doc, text_signature, objclass, reduce to their canonical Python dunder equivalents (__name__, __qualname__, __doc__, __text_signature__, __objclass__, __reduce__) is correct and improves consistency. The removal of the magic attribute from the decorators aligns with the broader codebase refactoring.
246-262: LGTM! Consistent application of dunder naming pattern.
The PyMemberDescriptor changes follow the same pattern as PyMethodDescriptor, correctly renaming doc and qualname to __doc__ and __qualname__ respectively. The logic remains unchanged.
vm/src/builtins/mappingproxy.rs (2)
119-205: LGTM! Proper implementation of Python dunder method naming.
The systematic renaming from getitem, contains, len, etc. to their canonical Python dunder equivalents (__getitem__, __contains__, __len__, etc.) is correct. The removal of the magic attribute and use of plain #[pymethod] aligns with the codebase refactoring.
225-270: LGTM! Protocol implementations correctly updated.
The AsMapping and AsNumber trait implementations have been properly updated to call the renamed dunder methods (__len__, __getitem__, __or__, __ior__). This ensures consistency between the public Python interface and internal protocol usage.
vm/src/builtins/staticmethod.rs (2)
88-132: LGTM! Consistent property renaming to Python dunder conventions.
The systematic renaming of property getters from func, wrapped, module, qualname, name, annotations, isabstractmethod to their canonical Python dunder equivalents is correct and follows the established pattern. The logic for each property remains unchanged.
150-157: LGTM! Representable implementation correctly updated.
The calls to class.__qualname__(vm) and class.__module__(vm) correctly use the renamed dunder methods, ensuring consistency with the property renamings above.
vm/src/builtins/classmethod.rs (2)
127-171: LGTM! Consistent property renaming following Python conventions.
The systematic renaming of property getters mirrors the pattern established in staticmethod.rs and correctly implements canonical Python dunder names. The underlying logic for accessing the callable's attributes remains unchanged.
182-188: LGTM! Representable trait correctly updated.
The Representable implementation has been properly updated to call __qualname__ and __module__ instead of the old non-dunder names, maintaining consistency with the property renamings.
stdlib/src/mmap.rs (3)
419-454: LGTM! Protocol implementations correctly updated.
The AsBuffer, AsMapping, and AsSequence trait implementations have been properly updated to call the renamed dunder methods (__len__, getitem_inner, setitem_inner). The buffer descriptor correctly uses __len__() for size calculation.
499-924: LGTM! Comprehensive method renaming to Python dunder conventions.
The systematic renaming of methods from len, getitem, setitem, enter, exit to their canonical Python dunder equivalents (__len__, __getitem__, __setitem__, __enter__, __exit__) is correct. The context manager methods (__enter__/__exit__) properly follow Python's context manager protocol. All method implementations remain unchanged, only the names have been updated.
576-1084: LGTM! Internal calls consistently updated.
All internal method calls have been properly updated to use __len__() instead of len(), ensuring consistency throughout the implementation. The helper methods have been appropriately renamed from _getitem/_setitem to getitem_inner/setitem_inner, which follows better naming conventions for internal helpers.
vm/src/builtins/memory.rs (4)
644-695: LGTM! Excellent standardization of magic method names.
The systematic renaming of magic methods to their canonical Python dunder forms (__enter__, __exit__, __getitem__, __delitem__, __len__) improves code clarity by making the Python special method protocol explicit rather than relying on the magic attribute annotation.
842-883: LGTM! Consistent dunder method naming in PyMemoryView.
The renaming of setitem to __setitem__, reduce_ex to __reduce_ex__, and reduce to __reduce__ maintains the same functionality while following Python's canonical special method naming conventions.
966-990: LGTM! Updated internal calls to use new dunder method names.
The trait implementations correctly update their internal calls to use the renamed dunder methods (__len__(), __getitem__(), __setitem__()), ensuring consistency throughout the codebase.
1127-1148: LGTM! Iterator implementation updated consistently.
The PyMemoryViewIterator methods are properly renamed to __reduce__ and internal calls updated to use __len__(), maintaining consistency with the broader refactoring effort.
vm/src/builtins/genericalias.rs (4)
139-152: LGTM! Property names standardized to Python conventions.
The renaming of properties to their canonical dunder forms (__parameters__, __args__, __origin__) makes the code more consistent with Python's special attribute naming conventions.
154-212: LGTM! Magic methods properly renamed to dunder equivalents.
All magic methods are correctly renamed to their canonical Python forms (__getitem__, __dir__, __reduce__, __mro_entries__, __instancecheck__, __subclasscheck__, __ror__, __or__) while maintaining the same functionality.
324-343: LGTM! Trait implementations updated with new method names.
The AsMapping and AsNumber trait implementations correctly use the renamed dunder methods (__getitem__(), __or__()) in their function calls, ensuring consistency throughout the implementation.
362-402: LGTM! Comparison and attribute access traits updated consistently.
The Comparable and GetAttr trait implementations properly call the renamed dunder methods (__origin__(), __args__()) while maintaining the same comparison and attribute access logic.
vm/src/stdlib/collections.rs (4)
96-98: LGTM! Copy method properly dual-named.
The copy method correctly includes both the regular name and the __copy__ magic method name, following Python's copy protocol conventions.
253-420: LGTM! Comprehensive magic method standardization in PyDeque.
All magic methods are systematically renamed to their canonical dunder forms (__reversed__, __getitem__, __setitem__, __delitem__, __contains__, __mul__, __imul__, __len__, __bool__, __add__, __iadd__, __reduce__). The __class_getitem__ method is correctly annotated as #[pyclassmethod] for class-level generic typing support.
499-537: LGTM! Sequence trait implementation updated consistently.
The AsSequence trait implementation correctly calls the renamed dunder methods (__len__(), __mul__(), __getitem__(), __setitem__(), __delitem__(), __imul__()) in all its function mappings, maintaining consistency with the method renames.
631-717: LGTM! Iterator classes updated with dunder method naming.
Both PyDequeIterator and PyReverseDequeIterator are properly updated with dunder method names (__length_hint__, __reduce__) and their internal calls use the renamed methods (__len__(), __reversed__()), maintaining consistency throughout the iterator implementations.
vm/src/builtins/builtin_func.rs (2)
78-130: LGTM! Builtin function attributes standardized to dunder forms.
All special attributes and methods in PyNativeFunction are correctly renamed to their canonical Python forms (__module__, __name__, __qualname__, __doc__, __reduce__, __reduce_ex__, __text_signature__) while removing the magic attribute from annotations. This improves code clarity and follows Python conventions.
154-176: LGTM! PyNativeMethod updated consistently with dunder naming.
The PyNativeMethod class properly adopts the dunder naming convention for __qualname__ and __reduce__, maintaining consistency with the broader refactoring effort across builtin types.
vm/src/builtins/str.rs (7)
286-307: Magic-method renaming looks correct & keeps iterator semantics intact
__length_hint__, __setstate__, and __reduce__ are now exposed with their canonical dunder names and their bodies are unchanged, so behaviour as observed by user-code is preserved.
No issues spotted.
605-608: __sizeof__ omission is acceptable but document the deviation
CPython reports sys.getsizeof('') == 49 (64-bit) because it includes allocator
overhead and the implicit trailing nul.
Here we only return size_of::<Self>() + len, which will under-report.
That’s fine for RustPython, but worth a doc-comment so users don’t assume parity.
611-614: Alias strategy for __mul__ / __rmul__ is neat
Exposing the same body twice with #[pymethod(name = "__rmul__")] keeps code DRY
and fully matches CPython semantics.
Nicely done.
923-926: Correct CPython behaviour: return NotImplemented from __rmod__
CPython also returns NotImplemented for the RHS % on strings; implementation matches.
1434-1437: __getnewargs__ keeps pickling compatibility
Returning a 1-tuple of the underlying UTF-8 data is exactly what the pickle
protocol expects for str.
1456-1461: __str__ preserves subclass identity when possible
Using into_exact_or ensures subclasses don’t get collapsed to base str
unnecessarily. Good call.
1553-1555: Direct call to PyStr::__add__ matches CPython C-API semantics
PySequenceMethods::concat in CPython bypasses overridden __add__; your direct
Rust call does the same so behaviour is faithful.
vm/src/exceptions.rs (4)
97-97: LGTM: Exception accessor calls updated to use dunder methods.
The internal calls to exception properties have been correctly updated to use the new dunder method names (__cause__, __context__, __traceback__), maintaining consistency with the refactored method definitions.
Also applies to: 104-104, 135-135, 313-313
581-627: LGTM: Exception property methods properly renamed to dunder equivalents.
The exception property getters and setters have been correctly refactored:
- Removed
magicattributes from#[pygetset]annotations - Renamed methods to explicit dunder forms (
__traceback__,__cause__,__context__) - Renamed setters with triple underscores (
set___traceback__,set___cause__,set___context__)
This standardizes the naming convention and aligns with Python's canonical method naming.
639-683: LGTM: Base exception magic methods correctly refactored.
The magic methods have been properly updated:
- Removed
magicattribute from#[pymethod]annotations - Renamed methods to explicit dunder forms (
__str__,__reduce__,__setstate__) - Functionality and logic remain unchanged
This aligns with the PR objective of standardizing Python special method naming.
1361-1374: LGTM: Exception type magic methods systematically refactored.
All exception type magic methods have been consistently updated across the types module:
- Removed
magicattributes from method annotations - Renamed methods to explicit dunder forms (
__reduce__,__str__) - Internal calls to base exception methods updated to use dunder names (e.g.,
exc.__str__(vm))
The refactoring maintains consistency across all exception types and preserves the original functionality.
Also applies to: 1395-1406, 1482-1548, 1680-1725, 1798-1822, 1848-1873, 1898-1919
vm/src/builtins/tuple.rs (3)
231-348: LGTM: Tuple magic methods systematically refactored to dunder names.
All tuple magic methods have been correctly updated:
- Removed
magicattributes from#[pymethod]and#[pyclassmethod]annotations - Renamed methods to explicit dunder forms (
__add__,__bool__,__len__,__mul__,__getitem__,__contains__,__getnewargs__,__class_getitem__) - Functionality and method signatures remain unchanged
This standardizes the naming convention and improves code clarity by making Python special methods explicit.
367-370: LGTM: AsSequence trait updated to call renamed methods.
The trait implementation has been correctly updated to call the renamed dunder methods (__len__, __add__), maintaining consistency with the refactored method names.
467-484: LGTM: Tuple iterator magic methods consistently refactored.
The PyTupleIterator magic methods have been properly updated:
- Removed
magicattributes from#[pymethod]annotations - Renamed methods to explicit dunder forms (
__length_hint__,__setstate__,__reduce__)
This maintains consistency with the broader refactoring effort across the tuple module.
vm/src/builtins/range.rs (8)
228-262: LGTM: Explicit dunder method naming
The transition from #[pymethod(magic)] with shorthand name reversed to #[pymethod] with explicit __reversed__ name improves code clarity and follows Python's special method conventions. The internal call to __len__() is also correctly updated.
264-267: LGTM: Standard magic method rename
Correctly renames the length method to its explicit Python dunder name __len__.
269-272: LGTM: Boolean magic method rename
Correctly renames the boolean conversion method to its explicit Python dunder name __bool__.
274-310: LGTM: Pickling and item access methods
Both __reduce__ and __getitem__ method renames are correct and follow Python's special method conventions for object serialization and item access respectively.
340-343: LGTM: Container membership method
Correctly renames the containment check method to its explicit Python dunder name __contains__.
380-380: LGTM: Updated internal method calls
Internal method calls are correctly updated to use the new dunder method names (__len__() and __getitem__()), maintaining consistency with the renamed methods.
Also applies to: 393-393, 477-477
543-568: LGTM: Iterator magic methods for PyLongRangeIterator
All magic method renames (__length_hint__, __setstate__, __reduce__) are correctly implemented with explicit dunder names and proper attribute changes.
608-630: LGTM: Iterator magic methods for PyRangeIterator
Consistent magic method renames for the range iterator class, maintaining the same pattern as the long range iterator.
vm/src/types/slot.rs (4)
899-907: LGTM: Descriptor protocol method
Correctly renames the descriptor get method to its explicit Python dunder name __get__, improving consistency with Python's descriptor protocol.
1025-1077: LGTM: Rich comparison protocol methods
All comparison methods are correctly renamed to their explicit Python dunder equivalents (__eq__, __ne__, __lt__, __le__, __ge__, __gt__). This improves consistency with Python's rich comparison protocol.
1191-1194: LGTM: Attribute access method
Correctly renames the attribute getter method to its explicit Python dunder name __getattribute__.
1221-1235: LGTM: Attribute modification methods
Both __setattr__ and __delattr__ method renames are correct and follow Python's attribute access protocol for setting and deleting attributes.
vm/src/builtins/bytes.rs (5)
149-152: LGTM: Core sequence protocol methods
All fundamental sequence magic methods (__len__, __sizeof__, __contains__, __getitem__) are correctly renamed to their explicit Python dunder equivalents, improving consistency with Python's sequence protocol.
Also applies to: 164-167, 174-181, 188-191
169-172: LGTM: Arithmetic and special methods
Arithmetic operations (__add__, __mul__, __rmod__) and pickling support (__getnewargs__) methods are correctly renamed to their explicit Python dunder names.
Also applies to: 462-465, 473-476, 478-482
487-504: LGTM: Pickling and conversion methods
Pickling methods (__reduce_ex__, __reduce__) and type conversion (__bytes__) are correctly renamed. The internal call update on line 493 to use __reduce__() maintains consistency.
Also applies to: 509-516
607-607: LGTM: Updated protocol implementation
Internal call correctly updated to use the renamed __contains__() method, maintaining consistency with the method renames.
693-710: LGTM: Iterator magic methods
Iterator magic methods (__length_hint__, __reduce__, __setstate__) are correctly renamed to their explicit Python dunder names, maintaining consistency with the main bytes class.
vm/src/builtins/complex.rs (3)
258-268: LGTM: Arithmetic magic methods
All arithmetic magic methods (__abs__, __add__, __sub__, __rsub__, __mul__, __truediv__, __rtruediv__) are correctly renamed to their explicit Python dunder equivalents, following Python's numeric protocol for complex number operations.
Also applies to: 287-312, 320-345
347-355: LGTM: Unary and power operations
Unary operations (__pos__, __neg__) and power operations (__pow__, __rpow__) are correctly renamed to their explicit Python dunder names, maintaining the numeric protocol implementation.
Also applies to: 357-378
380-383: LGTM: Type conversion and special methods
Type conversion methods (__bool__, __complex__) and pickling support (__getnewargs__) are correctly renamed to their explicit Python dunder names, completing the comprehensive magic method refactoring for complex numbers.
Also applies to: 385-389, 394-401
vm/src/builtins/list.rs (8)
145-148: LGTM: Consistent magic method naming
The renaming from add to __add__ with removal of the magic attribute follows the project's standardization to explicit dunder method names.
160-169: LGTM: Consistent in-place addition method naming
The __iadd__ method renaming and implementation are correct and consistent with the refactoring pattern.
182-185: LGTM: Standard length method implementation
The renaming to __len__ properly exposes Python's length protocol method.
198-204: LGTM: Reversed iterator with updated internal call
The method renaming to __reversed__ and the internal call update on line 200 (zelf.__len__()) are both consistent with the refactoring.
216-219: LGTM: Indexing protocol methods properly renamed
The __getitem__, __setitem__, and __delitem__ method renamings correctly implement Python's indexing protocol.
Also applies to: 231-239, 315-318
241-250: LGTM: Multiplication methods consistently renamed
Both __mul__ and __imul__ method renamings follow the correct Python dunder naming convention.
404-404: LGTM: Internal calls updated consistently
All internal calls to __len__() in mapping/sequence implementations and repr method are correctly updated to use the new method name.
Also applies to: 424-424, 496-496
548-551: LGTM: Iterator methods consistently renamed
The iterator methods __length_hint__, __setstate__, and __reduce__ are properly renamed, and internal calls to __len__() on lines 550, 557, 595, and 602 are correctly updated.
Also applies to: 553-558, 593-596, 598-603, 605-610
vm/src/builtins/function.rs (4)
389-401: LGTM: Function attributes consistently renamed to dunder form
All function attributes (__code__, __defaults__, __kwdefaults__, __name__, __module__, __annotations__, __qualname__, __type_params__) are properly renamed with the magic attribute removed. The setter methods follow the correct naming pattern.
Also applies to: 403-410, 435-443, 465-473, 475-483, 485-504, 506-526
148-148: LGTM: Internal calls and error messages updated
All references to self.__qualname__() in error messages and self.__name__() in generator/coroutine creation are correctly updated to use the new dunder method names.
Also applies to: 183-183, 195-195, 203-203, 260-260, 365-365, 366-366, 367-367
529-539: LGTM: JIT method properly renamed
The __jit__ method renaming is consistent with the refactoring pattern and maintains the correct functionality.
572-572: LGTM: Bound method dunder methods consistently implemented
The __reduce__, __doc__, __func__, __module__, and __qualname__ methods for PyBoundMethod are properly renamed and implemented.
Also applies to: 739-748, 750-758, 765-771
vm/src/builtins/object.rs (5)
250-267: LGTM: Comparison methods properly renamed
All comparison methods (__eq__, __ne__, __lt__, __le__, __ge__, __gt__) are correctly renamed from their magic attribute form to explicit dunder names.
Also applies to: 270-287, 290-307
337-341: LGTM: Core object methods consistently renamed
The __str__, __repr__, __subclasshook__, __init_subclass__, __dir__, __format__, and __init__ methods are all properly renamed with the magic attribute removed.
Also applies to: 374-377, 379-382, 384-385, 387-390, 392-405, 407-411
138-138: LGTM: Internal calls updated to use dunder methods
The calls to slot_names.__len__() on lines 138 and 148 are correctly updated to use the new method name instead of the len() property.
Also applies to: 148-148
347-355: LGTM: Slot repr implementation updated
The calls to class.__qualname__(vm) and class.__module__(vm) are correctly updated to use the new dunder method names.
457-460: LGTM: Attribute and reduction methods renamed
The __getattribute__, __reduce__, __reduce_ex__, __hash__, and __sizeof__ methods are all properly renamed following the consistent pattern.
Also applies to: 462-465, 467-479, 487-490, 492-495
vm/src/builtins/bytearray.rs (6)
203-211: LGTM: Core bytearray methods consistently renamed
All core methods (__alloc__, __len__, __sizeof__, __add__, __contains__, __iadd__, __getitem__, __delitem__) are properly renamed from their magic attribute form to explicit dunder names.
Also applies to: 213-216, 218-221, 223-230, 232-242, 244-247, 249-252
548-551: LGTM: Arithmetic and item assignment methods renamed
The __mul__, __imul__, __rmod__, and __setitem__ methods are correctly renamed following the consistent pattern.
Also applies to: 553-557, 565-568, 578-586
641-648: LGTM: Pickle protocol methods consistently implemented
The __reduce_ex__ and __reduce__ methods are properly renamed, with the internal call on line 647 correctly updated.
Also applies to: 650-658
756-756: LGTM: Buffer implementation updated
The call to zelf.__len__() in the buffer descriptor creation is correctly updated to use the new method name.
774-776: LGTM: Protocol implementations consistently updated
All protocol method calls in AsMapping and AsSequence implementations are correctly updated to use the new dunder method names (__len__(), __getitem__(), __setitem__(), __delitem__(), __contains__(), __iadd__()).
Also applies to: 778-778, 783-783, 785-785, 796-796, 825-825, 830-830
894-897: LGTM: Iterator methods consistently renamed
The iterator methods __length_hint__, __reduce__, and __setstate__ are properly renamed, with internal calls to __len__() correctly updated on lines 896 and 909.
Also applies to: 898-903, 905-910
stdlib/src/array.rs (11)
910-910: LGTM: Consistent use of dunder method naming
The call to self.__len__() is consistent with the refactoring to use explicit dunder method names throughout the codebase.
979-987: Excellent refactoring of copy methods to explicit dunder names
The transformation from #[pymethod(magic)] fn copy to #[pymethod] fn __copy__ and similar for __deepcopy__ follows Python's standard magic method conventions. The internal call from __deepcopy__ to self.__copy__() is correctly updated.
989-999: Good refactoring of item access methods
The renaming from _getitem to getitem_inner and the explicit __getitem__ magic method wrapper follows a clear pattern that separates the internal implementation from the Python-exposed magic method.
1001-1046: Consistent refactoring of setitem implementation
The pattern of renaming internal methods to *_inner and creating explicit dunder magic method wrappers is applied consistently. The __setitem__ method properly delegates to setitem_inner.
1048-1058: Well-structured delitem refactoring
The same consistent pattern is applied to delitem - internal logic in delitem_inner with explicit __delitem__ magic method wrapper.
1060-1105: Comprehensive arithmetic method refactoring
All arithmetic magic methods (__add__, __iadd__, __mul__, __imul__) are consistently renamed from their short forms to explicit dunder names while preserving functionality.
1107-1110: Proper len method conversion
The conversion from len to __len__ maintains the pub(crate) visibility, indicating this method is used both as a Python magic method and internally by the Rust code.
1136-1180: Well-executed pickle method refactoring
Both __reduce_ex__ and __reduce__ are properly renamed and the internal call from __reduce_ex__ to Self::__reduce__ is correctly updated.
1182-1197: Consistent contains method refactoring
The contains method is properly renamed to __contains__ following the same pattern as other magic methods.
1306-1362: Trait implementations correctly updated
All trait implementations (AsMapping and AsSequence) are properly updated to use the new method names: __len__(), getitem_inner, setitem_inner, delitem_inner, __add__, __mul__, __contains__, __iadd__, and __imul__.
1395-1407: Iterator methods properly refactored
The iterator's __setstate__ and __reduce__ methods are consistently renamed and the internal call to obj.__len__() is correctly updated.
vm/src/builtins/float.rs (6)
207-230: Excellent conversion of format methods to explicit dunder names
Both __format__ and __getformat__ are properly converted from their magic attribute forms to explicit dunder method names. The #[pystaticmethod] attribute is correctly used for __getformat__.
232-235: Proper abs method conversion
The abs method is correctly renamed to __abs__ following Python's magic method conventions.
281-406: Comprehensive arithmetic method refactoring
All arithmetic magic methods are systematically converted to explicit dunder names: __add__, __bool__, __divmod__, __rdivmod__, __floordiv__, __rfloordiv__, __rmod__, __pos__, __neg__, __pow__, __rpow__, __sub__, __rsub__, __truediv__, __rtruediv__, and __mul__. The functionality is preserved while making the naming explicit.
408-451: Well-executed numeric conversion method refactoring
The numeric conversion and rounding methods (__trunc__, __floor__, __ceil__, __round__) are consistently renamed to their dunder equivalents while maintaining all the complex rounding logic.
453-461: Correct type conversion method updates
Both __int__ and __float__ are properly renamed, and the internal call in __int__ is correctly updated to use self.__trunc__(vm).
512-515: Proper getnewargs method conversion
The getnewargs method is correctly renamed to __getnewargs__ following the same pattern as all other magic methods.
vm/src/builtins/dict.rs (10)
192-192: LGTM: Consistent method call update
The call to __setitem__ correctly uses the renamed dunder method name.
205-208: LGTM: Proper magic method renaming
The method is correctly renamed from len to __len__ with the magic attribute removed from the decorator. This makes the Python special method name explicit.
215-218: LGTM: Consistent dunder method implementation
The __contains__ method properly follows the dunder naming convention and removes the magic attribute.
220-223: LGTM: Proper __delitem__ implementation
The method is correctly renamed to use the explicit Python dunder name.
230-238: LGTM: Explicit __setitem__ method
The method signature and naming follow Python's data model conventions correctly.
287-296: LGTM: Comprehensive magic method renaming
All the binary operation methods (__or__, __getitem__, __reversed__, __ior__, __ror__) are properly renamed to their explicit dunder equivalents with consistent decorator updates.
Also applies to: 368-372, 392-395, 397-401, 403-412
432-432: LGTM: Updated internal method calls
All internal calls to magic methods are correctly updated to use the new dunder names (__len__, __or__, __ior__).
Also applies to: 466-466, 473-476
743-750: LGTM: DictView trait method updates
The trait methods __len__ and __reversed__ are properly renamed with consistent decorator changes.
Also applies to: 778-780
840-843: LGTM: Iterator method renaming
The iterator special methods __length_hint__ and __reduce__ are correctly renamed to their dunder equivalents across all iterator classes.
Also applies to: 846-858, 916-929, 931-936
1026-1027: LGTM: Set operation methods
All set operation magic methods (__xor__, __and__, __or__, __sub__, __rsub__) are properly renamed with the magic attribute removed.
Also applies to: 1034-1035, 1042-1043, 1049-1050, 1056-1057
vm/src/builtins/type.rs (10)
479-488: LGTM: Type property getters renamed
The type properties (__bases__, __base__, __flags__, __basicsize__) are correctly renamed to their explicit dunder equivalents with proper decorator updates.
Also applies to: 544-547, 549-552, 554-557
577-592: LGTM: __qualname__ property implementation
Both the getter and setter methods for __qualname__ are properly renamed with consistent naming conventions (set___qualname__).
Also applies to: 594-620
622-674: LGTM: __annotations__ property methods
The getter and setter methods for __annotations__ follow the correct dunder naming pattern.
676-698: LGTM: Module and class methods renamed
The __module__, __prepare__, and __subclasses__ methods are properly renamed to their dunder equivalents.
Also applies to: 700-709, 711-721
723-731: LGTM: Binary operation and dict methods
The __ror__, __or__, and __dict__ methods are correctly renamed with proper decorator updates.
Also applies to: 733-743
761-778: LGTM: Name and signature properties
The set___name__ setter and __text_signature__ getter are properly renamed following the dunder convention.
Also applies to: 780-786
1029-1029: LGTM: Exception handling call update
The call to set___cause__ correctly uses the renamed exception attribute setter method.
1140-1187: LGTM: Documentation property methods
Both the __doc__ getter and set___doc__ setter are properly implemented with the dunder naming convention.
1189-1212: LGTM: Type introspection methods
The methods __dir__, __instancecheck__, __subclasscheck__, and __subclasshook__ are correctly renamed to their dunder equivalents.
1292-1292: LGTM: Updated method calls
All internal calls to the renamed methods (__module__, __qualname__, __basicsize__) are correctly updated.
Also applies to: 1301-1301, 1479-1479
vm/src/stdlib/itertools.rs (4)
65-72: LGTM: Excellent systematic refactoring of magic method naming.
The renaming of class_getitem to __class_getitem__ and removal of the magic attribute makes the Python special method explicit and aligns perfectly with Python's dunder naming conventions.
74-88: Well-executed standardization of __reduce__ method.
The explicit naming of the pickle reduction method follows Python conventions perfectly. The logic remains unchanged while improving code readability and explicitness.
90-119: Consistent and correct __setstate__ implementation.
The renaming maintains the exact same functionality while making the pickle state restoration method explicitly named according to Python standards.
204-210: Comprehensive and systematic magic method standardization.
This refactoring systematically renames all Python special methods across multiple iterator classes to their canonical dunder forms:
reduce→__reduce__setstate→__setstate__length_hint→__length_hint__copy→__copy__
The changes are consistent, maintain all existing functionality, and significantly improve code explicitness by removing the magic attribute flag in favor of explicit Python dunder naming conventions.
Also applies to: 277-280, 398-415, 477-483, 542-560, 629-647, 966-993, 1063-1069, 1133-1182, 1306-1312, 1393-1443, 1528-1554, 1769-1775, 1882-1904
vm/src/builtins/set.rs (5)
545-548: Excellent systematic refactoring of PySet magic methods.
The comprehensive renaming of magic methods to their canonical Python dunder forms significantly improves code explicitness:
len→__len__contains→__contains__or→__or__and→__and__sub→__sub__reduce→__reduce__class_getitem→__class_getitem__
All functionality is preserved while removing the implicit magic attribute in favor of explicit Python naming conventions.
Also applies to: 562-565, 607-618, 621-636, 638-653, 655-670, 673-688, 717-721, 741-746, 754-759, 772-777, 779-785, 787-790
810-810: Well-updated trait implementations with new dunder method calls.
The AsSequence and AsNumber trait implementations have been properly updated to call the new dunder method names (e.g., a.__sub__(...), a.__and__(...), etc.), maintaining consistency with the renamed methods.
Also applies to: 844-844, 851-851, 858-858, 865-865, 872-872, 880-880, 888-888, 896-896
971-974: Consistent refactoring applied to PyFrozenSet.
The same systematic approach is correctly applied to PyFrozenSet, ensuring consistency across both mutable and immutable set implementations. All magic methods follow the same dunder naming pattern.
Also applies to: 994-997, 1039-1050, 1053-1068, 1070-1085, 1087-1103, 1106-1121, 1123-1129, 1131-1134
1140-1140: Proper trait implementation updates for PyFrozenSet.
The AsSequence and AsNumber trait implementations for PyFrozenSet are correctly updated to use the new dunder method names, maintaining consistency with the PySet implementation.
Also applies to: 1197-1197, 1204-1204, 1211-1211, 1218-1218
1305-1308: Complete coverage with PySetIterator updates.
The refactoring extends to PySetIterator with proper __length_hint__ and __reduce__ method naming, ensuring comprehensive coverage of all Python special methods in the set module.
Also applies to: 1310-1327
vm/src/stdlib/typing.rs (6)
72-156: LGTM: Proper conversion to explicit dunder method naming
The systematic conversion of magic methods to explicit dunder names is correctly implemented:
#[pymethod(magic)]→#[pymethod]#[pygetset(magic)]→#[pygetset]- Method names explicitly use dunder notation (e.g.,
__mro_entries__,__name__,__reduce__)
This aligns with Python's data model and improves code clarity.
347-461: LGTM: Consistent dunder method naming for ParamSpec
The conversion follows the same correct pattern as other classes, with proper removal of magic attributes and explicit dunder method naming.
575-578: LGTM: Correct dunder method naming for NoDefault
The __reduce__ method conversion is properly implemented.
612-667: LGTM: TypeVarTuple dunder method conversion
All method renamings and decorator updates are correctly applied following the established pattern.
748-836: LGTM: ParamSpecArgs and ParamSpecKwargs dunder methods
The conversion of __mro_entries__ and __origin__ methods follows the correct pattern with proper decorator updates.
932-939: LGTM: Generic class method conversion
The __class_getitem__ class method is correctly converted to explicit dunder naming while maintaining the proper #[pyclassmethod] decorator.
vm/src/builtins/int.rs (5)
324-481: LGTM: Arithmetic method conversion to explicit dunder naming
The systematic conversion of arithmetic methods (__add__, __sub__, __mul__, __truediv__, etc.) correctly removes magic attributes and uses explicit dunder method names. The pattern is consistent throughout all arithmetic operations.
484-586: LGTM: Special method conversion
All unary and special methods are correctly converted to explicit dunder naming with proper decorator updates.
548-548: LGTM: Internal method call updates
The internal calls are correctly updated to use the new dunder method names (__int__) instead of the old plain names (int), maintaining consistency with the renamed methods.
Also applies to: 553-553, 558-558, 563-563, 600-600, 669-669, 679-679
694-697: LGTM: __getnewargs__ method conversion
The conversion follows the established pattern correctly.
702-708: LGTM: PyRef implementation consistency
The __int__ method in the PyRef implementation is correctly updated to maintain consistency with the overall dunder method naming pattern.