| 394 | return bool(self.cond(pkt)) |
| 395 | |
| 396 | def any2i(self, pkt, x): |
| 397 | # type: (Optional[Packet], Any) -> Any |
| 398 | # BACKWARD COMPATIBILITY |
| 399 | # Note: we shouldn't need this function. (it's not correct) |
| 400 | # However, having i2h implemented (#2364), it changes the default |
| 401 | # behavior and broke all packets that wrongly use two ConditionalField |
| 402 | # with the same name. Those packets are the problem: they are wrongly |
| 403 | # built (they should either be reusing the same conditional field, or |
| 404 | # using a MultipleTypeField). |
| 405 | # But I don't want to dive into fixing all of them just yet, |
| 406 | # so for now, let's keep this this way, even though it's not correct. |
| 407 | if type(self.fld) is Field: |
| 408 | return x |
| 409 | return self.fld.any2i(pkt, x) |
| 410 | |
| 411 | def i2h(self, pkt, val): |
| 412 | # type: (Optional[Packet], Any) -> Any |