Commit 88b05883 authored by Neal Norwitz's avatar Neal Norwitz

strxfrm and strcoll are conditionally defined, alwsy provide some impl

parent 1804b2c0
...@@ -26,6 +26,18 @@ __all__ = ["getlocale", "getdefaultlocale", "getpreferredencoding", "Error", ...@@ -26,6 +26,18 @@ __all__ = ["getlocale", "getdefaultlocale", "getpreferredencoding", "Error",
"normalize", "LC_CTYPE", "LC_COLLATE", "LC_TIME", "LC_MONETARY", "normalize", "LC_CTYPE", "LC_COLLATE", "LC_TIME", "LC_MONETARY",
"LC_NUMERIC", "LC_ALL", "CHAR_MAX"] "LC_NUMERIC", "LC_ALL", "CHAR_MAX"]
def _strcoll(a,b):
""" strcoll(string,string) -> int.
Compares two strings according to the locale.
"""
return cmp(a,b)
def _strxfrm(s):
""" strxfrm(string) -> string.
Returns a string that behaves for cmp locale-aware.
"""
return s
try: try:
from _locale import * from _locale import *
...@@ -76,17 +88,11 @@ except ImportError: ...@@ -76,17 +88,11 @@ except ImportError:
raise Error('_locale emulation only supports "C" locale') raise Error('_locale emulation only supports "C" locale')
return 'C' return 'C'
def strcoll(a,b): # These may or may not exist in _locale, so be sure to set them.
""" strcoll(string,string) -> int. if 'strxfrm' not in globals():
Compares two strings according to the locale. strxfrm = _strxfrm
""" if 'strcoll' not in globals():
return cmp(a,b) strcoll = _strcoll
def strxfrm(s):
""" strxfrm(string) -> string.
Returns a string that behaves for cmp locale-aware.
"""
return s
### Number formatting APIs ### Number formatting APIs
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment