Skip to content

Commit 0a64588

Browse files
authored
Don't send sys.argv[0] as program_name to MySQL server by default (#681)
fixes #620, closes #621
1 parent c1c2fb5 commit 0a64588

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

CHANGES.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
Changes
22
-------
33

4+
To be included in 1.0.0 (unreleased)
5+
^^^^^^^^^^^^^^^^^^^
6+
7+
* Don't send sys.argv[0] as program_name to MySQL server by default #620
8+
9+
410
0.0.22 (2021-11-14)
511
^^^^^^^^^^^^^^^^^^^
612

aiomysql/connection.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def __init__(self, host="localhost", user=None, password="",
131131
when using IAM authentication with Amazon RDS.
132132
(default: Server Default)
133133
:param program_name: Program name string to provide when
134-
handshaking with MySQL. (default: sys.argv[0])
134+
handshaking with MySQL. (omitted by default)
135135
:param server_public_key: SHA256 authentication plugin public
136136
key value.
137137
:param loop: asyncio loop
@@ -185,8 +185,6 @@ def __init__(self, host="localhost", user=None, password="",
185185
}
186186
if program_name:
187187
self._connect_attrs["program_name"] = program_name
188-
elif sys.argv:
189-
self._connect_attrs["program_name"] = sys.argv[0]
190188

191189
self._unix_socket = unix_socket
192190
if charset:

docs/connection.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,9 @@ Example::
8888
when using IAM authentication with Amazon RDS.
8989
(default: Server Default)
9090
:param program_name: Program name string to provide when
91-
handshaking with MySQL. (default: sys.argv[0])
91+
handshaking with MySQL. (omitted by default)
92+
.. versionchanged:: 1.0
93+
``sys.argv[0]`` is no longer passed by default
9294
:param server_public_key: SHA256 authenticaiton plugin public key value.
9395
:param loop: asyncio event loop instance or ``None`` for default one.
9496
:returns: :class:`Connection` instance.

0 commit comments

Comments
 (0)