Skip to content

Commit 4cad823

Browse files
committed
fix: don't silently ignore WindowsError
Also, `pyerrors.h` was included through `Python.h`, removing it
1 parent 65fe625 commit 4cad823

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Lib/locale.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -571,8 +571,9 @@ def _getdefaultlocale(envvars=('LC_ALL', 'LC_CTYPE', 'LANG', 'LANGUAGE')):
571571
code, encoding = _locale._getdefaultlocale()
572572
except (ImportError, AttributeError):
573573
pass
574-
except OSError:
575-
return None
574+
except OSError as e:
575+
if sys.platform == "win32" and isinstance(e, WindowsError):
576+
raise
576577
else:
577578
# add other platform-specific processing here, if
578579
# necessary...

Modules/_localemodule.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ This software comes with no warranty. Use at your own risk.
2929
# define WIN32_LEAN_AND_MEAN
3030
# endif
3131
# include <windows.h>
32-
# include "pyerrors.h" // PyErr_SetFromWindowsErr()
3332
#endif
3433

3534
PyDoc_STRVAR(locale__doc__, "Support for POSIX locales.");

0 commit comments

Comments
 (0)