diff options
| author | shadchin <[email protected]> | 2023-12-13 02:43:57 +0300 |
|---|---|---|
| committer | shadchin <[email protected]> | 2023-12-13 03:08:48 +0300 |
| commit | 5b48aabc614c6d407f885f3b228dc484ad4c5ba9 (patch) | |
| tree | 602eb5cc5d85bf730c1de1fa50a13c2ee552830d /contrib/tools/python3/src/Lib/gettext.py | |
| parent | 35d7049b38602e8cbfcd3f96257329a1abce947e (diff) | |
Update Python 3 to 3.11.7
Diffstat (limited to 'contrib/tools/python3/src/Lib/gettext.py')
| -rw-r--r-- | contrib/tools/python3/src/Lib/gettext.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/contrib/tools/python3/src/Lib/gettext.py b/contrib/tools/python3/src/Lib/gettext.py index 318f609548b..e665b3ecedc 100644 --- a/contrib/tools/python3/src/Lib/gettext.py +++ b/contrib/tools/python3/src/Lib/gettext.py @@ -46,6 +46,7 @@ internationalized, to the local language and cultural habits. # find this format documented anywhere. +import operator import os import re import sys @@ -171,14 +172,21 @@ def _parse(tokens, priority=-1): def _as_int(n): try: - i = round(n) + round(n) except TypeError: raise TypeError('Plural value must be an integer, got %s' % (n.__class__.__name__,)) from None + import warnings + frame = sys._getframe(1) + stacklevel = 2 + while frame.f_back is not None and frame.f_globals.get('__name__') == __name__: + stacklevel += 1 + frame = frame.f_back warnings.warn('Plural value must be an integer, got %s' % (n.__class__.__name__,), - DeprecationWarning, 4) + DeprecationWarning, + stacklevel) return n @@ -205,7 +213,7 @@ def c2py(plural): elif c == ')': depth -= 1 - ns = {'_as_int': _as_int} + ns = {'_as_int': _as_int, '__name__': __name__} exec('''if True: def func(n): if not isinstance(n, int): |
