Re: [nft PATCH v4 5/6] py: extract flags helper functions for set_debug()/get_debug()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Aug 03, 2023 at 09:35:22PM +0200, Thomas Haller wrote:
> Will be re-used for nft_ctx_input_set_flags() and
> nft_ctx_input_get_flags().
> 
> There are changes in behavior here.
> 
> - when passing an unrecognized string (e.g. `ctx.set_debug('foo')` or
>   `ctx.set_debug(['foo'])`), a ValueError is now raised instead of a
>   KeyError.
> 
> - when passing an out-of-range integer, now a ValueError is no raised.
>   Previously the integer was truncated to 32bit.
> 
> Changing the exception is an API change, but most likely nobody will
> care or try to catch a KeyError to find out whether a flag is supported.
> Especially, since such a check would be better performed via `'foo' in
> ctx.debug_flags`.
> 
> In other cases, a TypeError is raised as before.
> 
> Signed-off-by: Thomas Haller <thaller@xxxxxxxxxx>

Reviewed-by: Phil Sutter <phil@xxxxxx>



[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux