Skip to content

Commit 256c5b0

Browse files
committed
fix: handle OSError from getpass.getuser on Python 3.13+
Python 3.13 changed getpass.getuser() to raise OSError instead of KeyError when the UID has no matching username entry (e.g. in containers with numeric UIDs). Catch both for compatibility.
1 parent 1aa9cfc commit 256c5b0

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

aiomysql/connection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040

4141
try:
4242
DEFAULT_USER = getpass.getuser()
43-
except KeyError:
43+
except (KeyError, OSError):
4444
DEFAULT_USER = "unknown"
4545

4646

0 commit comments

Comments
 (0)