From: Daniele Varrazzo Date: Tue, 7 Apr 2020 06:43:00 +0000 (+1200) Subject: Dropped accepting None as Transformer.cast() input X-Git-Tag: 3.0.dev0~602 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=07661056a9e109a6a4c4c169abfb565a4d84387b;p=thirdparty%2Fpsycopg.git Dropped accepting None as Transformer.cast() input More efficient if we only accept non-null results. --- diff --git a/psycopg3/adapt.py b/psycopg3/adapt.py index 5de79c86f..5bfd3375c 100644 --- a/psycopg3/adapt.py +++ b/psycopg3/adapt.py @@ -287,9 +287,7 @@ class Transformer: v = func(v) yield v - def cast( - self, data: Optional[bytes], oid: int, format: Format = Format.TEXT - ) -> Any: + def cast(self, data: bytes, oid: int, format: Format = Format.TEXT) -> Any: if data is not None: f = self.get_cast_function(oid, format) return f(data)