Skip to content

Commit 9ad6625

Browse files
committed
Remove the deprecated "binary" parameter from Connection.set_type_codec
set_type_codec(..., binary=True) was deprecated in 0.12.0.
1 parent d236954 commit 9ad6625

File tree

2 files changed

+3
-35
lines changed

2 files changed

+3
-35
lines changed

asyncpg/connection.py

+3-11
Original file line numberDiff line numberDiff line change
@@ -833,9 +833,6 @@ async def set_type_codec(self, typename, *,
833833
Callable accepting a single argument encoded according to *format*
834834
and returning a decoded Python object.
835835
836-
:param binary:
837-
**Deprecated**. Use *format* instead.
838-
839836
Example:
840837
841838
.. code-block:: pycon
@@ -876,17 +873,12 @@ async def set_type_codec(self, typename, *,
876873
The ``binary`` keyword argument is deprecated in favor of
877874
``format``.
878875
876+
.. versionchanged:: 0.13.0
877+
The ``binary`` keyword argument was removed in favor of
878+
``format``.
879879
"""
880880
self._check_open()
881881

882-
if binary is not None:
883-
format = 'binary' if binary else 'text'
884-
warnings.warn(
885-
"The `binary` keyword argument to "
886-
"set_type_codec() is deprecated and will be removed in "
887-
"asyncpg 0.13.0. Use the `format` keyword argument instead.",
888-
DeprecationWarning, stacklevel=2)
889-
890882
typeinfo = await self.fetchrow(
891883
introspection.TYPE_BY_NAME, typename, schema)
892884
if not typeinfo:

tests/test_codecs.py

-24
Original file line numberDiff line numberDiff line change
@@ -1129,30 +1129,6 @@ def _decoder(value):
11291129
finally:
11301130
await conn.close()
11311131

1132-
async def test_custom_codec_override_deprecation(self):
1133-
conn = await self.cluster.connect(database='postgres', loop=self.loop)
1134-
try:
1135-
def _encoder(value):
1136-
return value
1137-
1138-
def _decoder(value):
1139-
return value
1140-
1141-
with self.assertWarnsRegex(DeprecationWarning,
1142-
r"The `binary` keyword argument to "
1143-
r"set_type_codec\(\) is deprecated"):
1144-
await conn.set_type_codec(
1145-
'uuid', encoder=_encoder, decoder=_decoder,
1146-
schema='pg_catalog', binary=False
1147-
)
1148-
1149-
data = '14058ad9-0118-4b7e-ac15-01bc13e2ccd1'
1150-
res = await conn.fetchval('SELECT $1::uuid', data)
1151-
self.assertEqual(res, data)
1152-
1153-
finally:
1154-
await conn.close()
1155-
11561132
async def test_composites_in_arrays(self):
11571133
await self.con.execute('''
11581134
CREATE TYPE t AS (a text, b int);

0 commit comments

Comments
 (0)