Skip to content

Commit e28a245

Browse files
authored
catch OSError from getpass.getuser (#2960)
2 parents 5661b96 + e6b4cce commit e28a245

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

CHANGES.rst

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ Unreleased
99
- Logging works with client addresses containing an IPv6 scope :issue:`2952`
1010
- Ignore invalid authorization parameters. :issue:`2955`
1111
- Improve type annotation fore ``SharedDataMiddleware``. :issue:`2958`
12+
- Compatibility with Python 3.13 when generating debugger pin and the current
13+
UID does not have an associated name. :issue:`2957`
1214

1315

1416
Version 3.0.4

src/werkzeug/debug/__init__.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,8 @@ def get_pin_and_cookie_name(
173173
# App Engine. It may also raise a KeyError if the UID does not
174174
# have a username, such as in Docker.
175175
username = getpass.getuser()
176-
except (ImportError, KeyError):
176+
# Python >= 3.13 only raises OSError
177+
except (ImportError, KeyError, OSError):
177178
username = None
178179

179180
mod = sys.modules.get(modname)

0 commit comments

Comments
 (0)