AlenkaF commented on PR #55264:
URL: https://github.com/apache/arrow/pull/55264#issuecomment-6573442111

   I added two additional changes connected to `__hash__` in `__lib/types.pyi` 
(https://github.com/apache/arrow/pull/55264/commits/4b7096919782182f7c259ff8d50719b670d7323b):
 
   
   * `ExtensionType` and `KeyValueMetadata` are unhashable at runtime, but the 
stubs treated them as hashable.
     I added `__hash__: ClassVar[None]  # type: ignore[assignment]` to both 
classes, following [typeshed's pattern for list, dict and 
set](https://github.com/python/typeshed/blob/main/stdlib/builtins.pyi#L1359C5-L1359C57).
 I also added `KeyValueMetadata` case to `test_invalid_usage`.
   
     Note: pyright checks hashability (`reportUnhashable`) but mypy doesn't, 
Claude suggested the use of `Hashable` so both checkers will error.
   
   * `__hash__` from `DataType`, `Field` and `Schema` (and `Schema.__sizeof__`) 
seem redundant.
     They have the same signature as [object in 
typeshed](https://github.com/python/typeshed/blob/7039f14737e659dfbd71de0e1dabe737c4f0d6db/stdlib/builtins.pyi#L123)
 plus the stubs don't declare `__eq__`. Added `test_data_type_hashable` for 
this.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to