From: Joseph Sutton Date: Mon, 13 Mar 2023 22:50:17 +0000 (+1300) Subject: python:ndr: Use f-string to format exception message X-Git-Tag: talloc-2.4.1~1404 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7e7c692adbce9f82828f0754a3fa79602b84337b;p=thirdparty%2Fsamba.git 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 Reviewed-by: Andrew Bartlett --- diff --git a/python/samba/ndr.py b/python/samba/ndr.py index 35b2414e8ae..314e57b7f8e 100644 --- a/python/samba/ndr.py +++ b/python/samba/ndr.py @@ -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()