Skip to content

Commit 1558b4a

Browse files
authored
remove deprecated no_delay argument (#702)
1 parent b47bef6 commit 1558b4a

File tree

5 files changed

+10
-36
lines changed

5 files changed

+10
-36
lines changed

CHANGES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ To be included in 1.0.0 (unreleased)
1313
* Unix sockets are now internally considered secure, allowing sha256_password and caching_sha2_password auth methods to be used #695
1414
* Test suite now also tests unix socket connections #696
1515
* Fix SSCursor raising InternalError when last result was not fully retrieved #635
16+
* Remove deprecated no_delay argument #702
1617

1718

1819
0.0.22 (2021-11-14)

aiomysql/connection.py

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def connect(host="localhost", user=None, password="",
5555
read_default_file=None, conv=decoders, use_unicode=None,
5656
client_flag=0, cursorclass=Cursor, init_command=None,
5757
connect_timeout=None, read_default_group=None,
58-
no_delay=None, autocommit=False, echo=False,
58+
autocommit=False, echo=False,
5959
local_infile=False, loop=None, ssl=None, auth_plugin='',
6060
program_name='', server_public_key=None):
6161
"""See connections.Connection.__init__() for information about
@@ -68,7 +68,7 @@ def connect(host="localhost", user=None, password="",
6868
init_command=init_command,
6969
connect_timeout=connect_timeout,
7070
read_default_group=read_default_group,
71-
no_delay=no_delay, autocommit=autocommit, echo=echo,
71+
autocommit=autocommit, echo=echo,
7272
local_infile=local_infile, loop=loop, ssl=ssl,
7373
auth_plugin=auth_plugin, program_name=program_name)
7474
return _ConnectionContextManager(coro)
@@ -144,7 +144,7 @@ def __init__(self, host="localhost", user=None, password="",
144144
read_default_file=None, conv=decoders, use_unicode=None,
145145
client_flag=0, cursorclass=Cursor, init_command=None,
146146
connect_timeout=None, read_default_group=None,
147-
no_delay=None, autocommit=False, echo=False,
147+
autocommit=False, echo=False,
148148
local_infile=False, loop=None, ssl=None, auth_plugin='',
149149
program_name='', server_public_key=None):
150150
"""
@@ -175,7 +175,6 @@ def __init__(self, host="localhost", user=None, password="",
175175
when connecting.
176176
:param read_default_group: Group to read from in the configuration
177177
file.
178-
:param no_delay: Disable Nagle's algorithm on the socket
179178
:param autocommit: Autocommit mode. None means use server default.
180179
(default: False)
181180
:param local_infile: boolean to enable the use of LOAD DATA LOCAL
@@ -211,19 +210,11 @@ def __init__(self, host="localhost", user=None, password="",
211210
port = int(_config("port", fallback=port))
212211
charset = _config("default-character-set", fallback=charset)
213212

214-
# pymysql port
215-
if no_delay is not None:
216-
warnings.warn("no_delay option is deprecated", DeprecationWarning)
217-
no_delay = bool(no_delay)
218-
else:
219-
no_delay = True
220-
221213
self._host = host
222214
self._port = port
223215
self._user = user or DEFAULT_USER
224216
self._password = password or ""
225217
self._db = db
226-
self._no_delay = no_delay
227218
self._echo = echo
228219
self._last_usage = self._loop.time()
229220
self._client_auth_plugin = auth_plugin
@@ -544,11 +535,8 @@ async def _connect(self):
544535
self._port),
545536
timeout=self.connect_timeout)
546537
self._set_keep_alive()
547-
self.host_info = "socket %s:%d" % (self._host, self._port)
548-
549-
# do not set no delay in case of unix_socket
550-
if self._no_delay and not self._unix_socket:
551538
self._set_nodelay(True)
539+
self.host_info = "socket %s:%d" % (self._host, self._port)
552540

553541
self._next_seq_id = 0
554542

docs/connection.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Example::
4545
read_default_file=None, conv=decoders, use_unicode=None,
4646
client_flag=0, cursorclass=Cursor, init_command=None,
4747
connect_timeout=None, read_default_group=None,
48-
no_delay=False, autocommit=False, echo=False,
48+
autocommit=False, echo=False
4949
ssl=None, auth_plugin='', program_name='',
5050
server_public_key=None, loop=None)
5151

@@ -79,7 +79,6 @@ Example::
7979
when connecting.
8080
:param str read_default_group: Group to read from in the configuration
8181
file.
82-
:param bool no_delay: disable Nagle's algorithm on the socket
8382
:param autocommit: Autocommit mode. None means use server default.
8483
(default: ``False``)
8584
:param ssl: Optional SSL Context to force SSL

tests/base.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def tearDown(self):
4444
super(AIOPyMySQLTestCase, self).tearDown()
4545

4646
async def connect(self, host=None, user=None, password=None,
47-
db=None, use_unicode=True, no_delay=None, port=None,
47+
db=None, use_unicode=True, port=None,
4848
**kwargs):
4949
if host is None:
5050
host = self.host
@@ -59,13 +59,13 @@ async def connect(self, host=None, user=None, password=None,
5959
conn = await aiomysql.connect(loop=self.loop, host=host,
6060
user=user, password=password,
6161
db=db, use_unicode=use_unicode,
62-
no_delay=no_delay, port=port,
62+
port=port,
6363
**kwargs)
6464
self.addCleanup(conn.close)
6565
return conn
6666

6767
async def create_pool(self, host=None, user=None, password=None,
68-
db=None, use_unicode=True, no_delay=None,
68+
db=None, use_unicode=True,
6969
port=None, **kwargs):
7070
if host is None:
7171
host = self.host
@@ -80,7 +80,7 @@ async def create_pool(self, host=None, user=None, password=None,
8080
pool = await aiomysql.create_pool(loop=self.loop, host=host,
8181
user=user, password=password,
8282
db=db, use_unicode=use_unicode,
83-
no_delay=no_delay, port=port,
83+
port=port,
8484
**kwargs)
8585
self.addCleanup(pool.close)
8686
return pool

tests/test_connection.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -242,20 +242,6 @@ async def test___del__(connection_creator):
242242
gc.collect()
243243

244244

245-
@pytest.mark.run_loop
246-
async def test_no_delay_warning(connection_creator):
247-
with pytest.warns(DeprecationWarning):
248-
conn = await connection_creator(no_delay=True)
249-
conn.close()
250-
251-
252-
@pytest.mark.run_loop
253-
async def test_no_delay_default_arg(connection_creator):
254-
conn = await connection_creator()
255-
assert conn._no_delay is True
256-
conn.close()
257-
258-
259245
@pytest.mark.run_loop
260246
async def test_previous_cursor_not_closed(connection_creator):
261247
conn = await connection_creator()

0 commit comments

Comments
 (0)