Skip to content

Commit

Permalink
PyPy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
poke1024 committed May 27, 2016
1 parent 78dda28 commit 2bb4ec6
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions mathics/builtin/strings.py
Original file line number Diff line number Diff line change
Expand Up @@ -1431,10 +1431,14 @@ def apply(self, a, b, evaluation, options):
py_a = a.get_string_value()
py_b = b.get_string_value()
if options['System`IgnoreCase'] == Symbol('True'):
def normalize(c):
return unicodedata.normalize("NFKD", c.casefold())
py_a = [normalize(c) for c in py_a]
py_b = [normalize(c) for c in py_b]
if hasattr(str, 'casefold'):
def normalize(c):
return unicodedata.normalize("NFKD", c.casefold())
py_a = [normalize(c) for c in py_a]
py_b = [normalize(c) for c in py_b]
else: # python2, PyPy
py_a = py_a.lower()
py_b = py_b.lower()
return Integer(self._distance(
py_a, py_b, lambda u, v: u == v))
elif a.get_head_name() == 'System`List' and b.get_head_name() == 'System`List':
Expand Down

0 comments on commit 2bb4ec6

Please sign in to comment.