◐ Shell
clean mode source ↗

__hash__ to slot_wrapper by youknowone · Pull Request #6480 · RustPython/RustPython

9-10: LGTM!

The import of HashFunc is properly added to support the new SlotFunc::Hash variant.


395-411: LGTM! Well-designed type-erased slot function abstraction.

The SlotFunc enum effectively type-erases different slot function signatures, mirroring CPython's void* d_wrapped approach. The Clone and Copy derives are appropriate for function pointers, and the Debug implementation is helpful without exposing internal details.


468-486: LGTM! Proper integration with SlotFunc.

The PySlotWrapper::call implementation correctly:

  1. Extracts the first argument as self
  2. Validates the type of self against the expected type
  3. Delegates to SlotFunc::call with the remaining arguments

The unified dispatch mechanism is well-implemented.


543-549: LGTM! Bound method-wrapper correctly uses SlotFunc.

The PyMethodWrapper::call implementation properly delegates to SlotFunc::call with the bound object and arguments, maintaining consistency with the slot wrapper mechanism.