diff options
author | Éric Araujo <merwok@netwok.org> | 2011-03-21 02:17:12 (GMT) |
---|---|---|
committer | Éric Araujo <merwok@netwok.org> | 2011-03-21 02:17:12 (GMT) |
commit | 50dc1a23d8d2e24fe4f344416a8604c4a7c2f60b (patch) | |
tree | 6bfeabc9f7875e1313a42f4a1fee12dd8bc1cd1d | |
parent | f1a9d82e35e5800095c7df8931d712d8644860dc (diff) | |
parent | eda5583bdcab854f4fb5cd408b46d75efe3bb65e (diff) | |
download | cpython-50dc1a23d8d2e24fe4f344416a8604c4a7c2f60b.zip cpython-50dc1a23d8d2e24fe4f344416a8604c4a7c2f60b.tar.gz cpython-50dc1a23d8d2e24fe4f344416a8604c4a7c2f60b.tar.bz2 |
Branch merge
-rw-r--r-- | Doc/c-api/import.rst | 4 | ||||
-rw-r--r-- | Lib/getopt.py | 15 | ||||
-rw-r--r-- | Misc/NEWS | 3 |
3 files changed, 13 insertions, 9 deletions
diff --git a/Doc/c-api/import.rst b/Doc/c-api/import.rst index cf95486..b168751 100644 --- a/Doc/c-api/import.rst +++ b/Doc/c-api/import.rst @@ -112,7 +112,7 @@ Importing Modules .. c:function:: PyObject* PyImport_AddModule(const char *name) - Similar to :c:func:`PyImport_AddModuleObject`, but the name is an UTF-8 + Similar to :c:func:`PyImport_AddModuleObject`, but the name is a UTF-8 encoded string instead of a Unicode object. @@ -237,7 +237,7 @@ Importing Modules .. c:function:: int PyImport_ImportFrozenModule(char *name) - Similar to :c:func:`PyImport_ImportFrozenModuleObject`, but the name is an + Similar to :c:func:`PyImport_ImportFrozenModuleObject`, but the name is a UTF-8 encoded string instead of a Unicode object. diff --git a/Lib/getopt.py b/Lib/getopt.py index 980861d..e4cab75 100644 --- a/Lib/getopt.py +++ b/Lib/getopt.py @@ -19,7 +19,7 @@ option involved with the exception. # Gerrit Holl <gerrit@nl.linux.org> moved the string-based exceptions # to class-based exceptions. # -# Peter Ã
strand <astrand@lysator.liu.se> added gnu_getopt(). +# Peter Åstrand <astrand@lysator.liu.se> added gnu_getopt(). # # TODO for gnu_getopt(): # @@ -34,6 +34,7 @@ option involved with the exception. __all__ = ["GetoptError","error","getopt","gnu_getopt"] import os +from gettext import gettext as _ class GetoptError(Exception): opt = '' @@ -153,10 +154,10 @@ def do_longs(opts, opt, longopts, args): if has_arg: if optarg is None: if not args: - raise GetoptError('option --%s requires argument' % opt, opt) + raise GetoptError(_('option --%s requires argument') % opt, opt) optarg, args = args[0], args[1:] elif optarg is not None: - raise GetoptError('option --%s must not have an argument' % opt, opt) + raise GetoptError(_('option --%s must not have an argument') % opt, opt) opts.append(('--' + opt, optarg or '')) return opts, args @@ -166,7 +167,7 @@ def do_longs(opts, opt, longopts, args): def long_has_args(opt, longopts): possibilities = [o for o in longopts if o.startswith(opt)] if not possibilities: - raise GetoptError('option --%s not recognized' % opt, opt) + raise GetoptError(_('option --%s not recognized') % opt, opt) # Is there an exact match? if opt in possibilities: return False, opt @@ -176,7 +177,7 @@ def long_has_args(opt, longopts): if len(possibilities) > 1: # XXX since possibilities contains all valid continuations, might be # nice to work them into the error msg - raise GetoptError('option --%s not a unique prefix' % opt, opt) + raise GetoptError(_('option --%s not a unique prefix') % opt, opt) assert len(possibilities) == 1 unique_match = possibilities[0] has_arg = unique_match.endswith('=') @@ -190,7 +191,7 @@ def do_shorts(opts, optstring, shortopts, args): if short_has_arg(opt, shortopts): if optstring == '': if not args: - raise GetoptError('option -%s requires argument' % opt, + raise GetoptError(_('option -%s requires argument') % opt, opt) optstring, args = args[0], args[1:] optarg, optstring = optstring, '' @@ -203,7 +204,7 @@ def short_has_arg(opt, shortopts): for i in range(len(shortopts)): if opt == shortopts[i] != ':': return shortopts.startswith(':', i+1) - raise GetoptError('option -%s not recognized' % opt, opt) + raise GetoptError(_('option -%s not recognized') % opt, opt) if __name__ == '__main__': import sys @@ -81,6 +81,9 @@ Core and Builtins Library ------- +- Issue #11371: Mark getopt error messages as localizable. Patch by Filip + Gruszczyński. + - Issue #5537: Fix time2isoz() and time2netscape() functions of httplib.cookiejar for expiration year greater than 2038 on 32-bit systems. |