1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

python:ndr: Use f-string to format exception message

If 'object' happened to be a tuple, we would get one of the following
errors:

TypeError: not enough arguments for format string
TypeError: not all arguments converted during string formatting

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Joseph Sutton 2023-03-14 11:50:17 +13:00 committed by Andrew Bartlett
parent 795bab5629
commit 7e7c692adb

View File

@ -52,7 +52,7 @@ def ndr_unpack(cls, data, allow_remaining=False):
def ndr_print(object):
ndr_print = getattr(object, "__ndr_print__", None)
if ndr_print is None:
raise TypeError("%r is not a NDR object" % object)
raise TypeError(f"{object} is not a NDR object")
return ndr_print()