Skip to content

Commit

Permalink
remove deprecated no_delay argument (#702)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nothing4You authored Jan 29, 2022
1 parent b47bef6 commit 1558b4a
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 36 deletions.
1 change: 1 addition & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ To be included in 1.0.0 (unreleased)
* Unix sockets are now internally considered secure, allowing sha256_password and caching_sha2_password auth methods to be used #695
* Test suite now also tests unix socket connections #696
* Fix SSCursor raising InternalError when last result was not fully retrieved #635
* Remove deprecated no_delay argument #702


0.0.22 (2021-11-14)
Expand Down
20 changes: 4 additions & 16 deletions aiomysql/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def connect(host="localhost", user=None, password="",
read_default_file=None, conv=decoders, use_unicode=None,
client_flag=0, cursorclass=Cursor, init_command=None,
connect_timeout=None, read_default_group=None,
no_delay=None, autocommit=False, echo=False,
autocommit=False, echo=False,
local_infile=False, loop=None, ssl=None, auth_plugin='',
program_name='', server_public_key=None):
"""See connections.Connection.__init__() for information about
Expand All @@ -68,7 +68,7 @@ def connect(host="localhost", user=None, password="",
init_command=init_command,
connect_timeout=connect_timeout,
read_default_group=read_default_group,
no_delay=no_delay, autocommit=autocommit, echo=echo,
autocommit=autocommit, echo=echo,
local_infile=local_infile, loop=loop, ssl=ssl,
auth_plugin=auth_plugin, program_name=program_name)
return _ConnectionContextManager(coro)
Expand Down Expand Up @@ -144,7 +144,7 @@ def __init__(self, host="localhost", user=None, password="",
read_default_file=None, conv=decoders, use_unicode=None,
client_flag=0, cursorclass=Cursor, init_command=None,
connect_timeout=None, read_default_group=None,
no_delay=None, autocommit=False, echo=False,
autocommit=False, echo=False,
local_infile=False, loop=None, ssl=None, auth_plugin='',
program_name='', server_public_key=None):
"""
Expand Down Expand Up @@ -175,7 +175,6 @@ def __init__(self, host="localhost", user=None, password="",
when connecting.
:param read_default_group: Group to read from in the configuration
file.
:param no_delay: Disable Nagle's algorithm on the socket
:param autocommit: Autocommit mode. None means use server default.
(default: False)
:param local_infile: boolean to enable the use of LOAD DATA LOCAL
Expand Down Expand Up @@ -211,19 +210,11 @@ def __init__(self, host="localhost", user=None, password="",
port = int(_config("port", fallback=port))
charset = _config("default-character-set", fallback=charset)

# pymysql port
if no_delay is not None:
warnings.warn("no_delay option is deprecated", DeprecationWarning)
no_delay = bool(no_delay)
else:
no_delay = True

self._host = host
self._port = port
self._user = user or DEFAULT_USER
self._password = password or ""
self._db = db
self._no_delay = no_delay
self._echo = echo
self._last_usage = self._loop.time()
self._client_auth_plugin = auth_plugin
Expand Down Expand Up @@ -544,11 +535,8 @@ async def _connect(self):
self._port),
timeout=self.connect_timeout)
self._set_keep_alive()
self.host_info = "socket %s:%d" % (self._host, self._port)

# do not set no delay in case of unix_socket
if self._no_delay and not self._unix_socket:
self._set_nodelay(True)
self.host_info = "socket %s:%d" % (self._host, self._port)

self._next_seq_id = 0

Expand Down
3 changes: 1 addition & 2 deletions docs/connection.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Example::
read_default_file=None, conv=decoders, use_unicode=None,
client_flag=0, cursorclass=Cursor, init_command=None,
connect_timeout=None, read_default_group=None,
no_delay=False, autocommit=False, echo=False,
autocommit=False, echo=False
ssl=None, auth_plugin='', program_name='',
server_public_key=None, loop=None)

Expand Down Expand Up @@ -79,7 +79,6 @@ Example::
when connecting.
:param str read_default_group: Group to read from in the configuration
file.
:param bool no_delay: disable Nagle's algorithm on the socket
:param autocommit: Autocommit mode. None means use server default.
(default: ``False``)
:param ssl: Optional SSL Context to force SSL
Expand Down
8 changes: 4 additions & 4 deletions tests/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def tearDown(self):
super(AIOPyMySQLTestCase, self).tearDown()

async def connect(self, host=None, user=None, password=None,
db=None, use_unicode=True, no_delay=None, port=None,
db=None, use_unicode=True, port=None,
**kwargs):
if host is None:
host = self.host
Expand All @@ -59,13 +59,13 @@ async def connect(self, host=None, user=None, password=None,
conn = await aiomysql.connect(loop=self.loop, host=host,
user=user, password=password,
db=db, use_unicode=use_unicode,
no_delay=no_delay, port=port,
port=port,
**kwargs)
self.addCleanup(conn.close)
return conn

async def create_pool(self, host=None, user=None, password=None,
db=None, use_unicode=True, no_delay=None,
db=None, use_unicode=True,
port=None, **kwargs):
if host is None:
host = self.host
Expand All @@ -80,7 +80,7 @@ async def create_pool(self, host=None, user=None, password=None,
pool = await aiomysql.create_pool(loop=self.loop, host=host,
user=user, password=password,
db=db, use_unicode=use_unicode,
no_delay=no_delay, port=port,
port=port,
**kwargs)
self.addCleanup(pool.close)
return pool
14 changes: 0 additions & 14 deletions tests/test_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,20 +242,6 @@ async def test___del__(connection_creator):
gc.collect()


@pytest.mark.run_loop
async def test_no_delay_warning(connection_creator):
with pytest.warns(DeprecationWarning):
conn = await connection_creator(no_delay=True)
conn.close()


@pytest.mark.run_loop
async def test_no_delay_default_arg(connection_creator):
conn = await connection_creator()
assert conn._no_delay is True
conn.close()


@pytest.mark.run_loop
async def test_previous_cursor_not_closed(connection_creator):
conn = await connection_creator()
Expand Down

0 comments on commit 1558b4a

Please sign in to comment.