]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-126357: Remove gettext import guards (GH-126358)
authorTomas R. <tomas.roun8@gmail.com>
Sun, 3 Nov 2024 16:54:42 +0000 (17:54 +0100)
committerGitHub <noreply@github.com>
Sun, 3 Nov 2024 16:54:42 +0000 (18:54 +0200)
Lib/getopt.py
Lib/optparse.py

index e5fd04fe12a7ee64d53a703c13d5ea874a0c5f75..1df5b96472a45cf8df6c3211bcf08e288b433824 100644 (file)
@@ -34,11 +34,8 @@ option involved with the exception.
 __all__ = ["GetoptError","error","getopt","gnu_getopt"]
 
 import os
-try:
-    from gettext import gettext as _
-except ImportError:
-    # Bootstrapping Python: gettext's dependencies not built yet
-    def _(s): return s
+from gettext import gettext as _
+
 
 class GetoptError(Exception):
     opt = ''
index 1c450c6fcbe3b62b2247c2fb25a8112f6abca6f6..04112eca37c801a4e7da278b113ec778a6d94130 100644 (file)
@@ -75,6 +75,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 import sys, os
 import textwrap
+from gettext import gettext as _, ngettext
+
 
 def _repr(self):
     return "<%s at 0x%x: %s>" % (self.__class__.__name__, id(self), self)
@@ -86,19 +88,6 @@ def _repr(self):
 #   Id: help.py 527 2006-07-23 15:21:30Z greg
 #   Id: errors.py 509 2006-04-20 00:58:24Z gward
 
-try:
-    from gettext import gettext, ngettext
-except ImportError:
-    def gettext(message):
-        return message
-
-    def ngettext(singular, plural, n):
-        if n == 1:
-            return singular
-        return plural
-
-_ = gettext
-
 
 class OptParseError (Exception):
     def __init__(self, msg):