lib.io: add a deprecation warning on Pin.eq.

This will stop working once `Pin` is no longer inheriting from
`Record`.
This commit is contained in:
Catherine 2023-09-05 13:33:05 +00:00
parent 1d3a62093b
commit a9d03805ff

View file

@ -130,3 +130,9 @@ class Pin(Record):
@property @property
def signature(self): def signature(self):
return _pin_signature(self.width, self.dir, self.xdr) return _pin_signature(self.width, self.dir, self.xdr)
def eq(self, other):
first_field, _, _ = next(iter(Pin(1, dir="o").layout))
warnings.warn(f"`pin.eq(...)` is deprecated; use `pin.{first_field}.eq(...)` here",
DeprecationWarning, stacklevel=2)
return super().eq(other)