Skip to content

Commit

Permalink
catch OSError from getpass.getuser (#2960)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidism authored Oct 24, 2024
2 parents 5661b96 + e6b4cce commit e28a245
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ Unreleased
- Logging works with client addresses containing an IPv6 scope :issue:`2952`
- Ignore invalid authorization parameters. :issue:`2955`
- Improve type annotation fore ``SharedDataMiddleware``. :issue:`2958`
- Compatibility with Python 3.13 when generating debugger pin and the current
UID does not have an associated name. :issue:`2957`


Version 3.0.4
Expand Down
3 changes: 2 additions & 1 deletion src/werkzeug/debug/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,8 @@ def get_pin_and_cookie_name(
# App Engine. It may also raise a KeyError if the UID does not
# have a username, such as in Docker.
username = getpass.getuser()
except (ImportError, KeyError):
# Python >= 3.13 only raises OSError
except (ImportError, KeyError, OSError):
username = None

mod = sys.modules.get(modname)
Expand Down

0 comments on commit e28a245

Please sign in to comment.