[8.0.x] Catch `OSError` from `getpass.getuser()` (#11876)

Co-authored-by: Russell Martin <russell@rjm.li>
This commit is contained in:
github-actions[bot] 2024-01-29 02:25:18 +00:00 committed by GitHub
parent 169d775eec
commit 8b70bb64d3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 3 additions and 1 deletions

View File

@ -338,6 +338,7 @@ Ronny Pfannschmidt
Ross Lawley
Ruaridh Williamson
Russel Winder
Russell Martin
Ryan Puddephatt
Ryan Wooden
Sadra Barikbin

View File

@ -0,0 +1 @@
Correctly handle errors from :func:`getpass.getuser` in Python 3.13.

View File

@ -203,7 +203,7 @@ def get_user() -> Optional[str]:
import getpass
return getpass.getuser()
except (ImportError, KeyError):
except (ImportError, OSError, KeyError):
return None