Author: Ronan Lamy <[email protected]>
Branch:
Changeset: r94532:0a8401a58e9f
Date: 2018-05-12 18:04 +0100
http://bitbucket.org/pypy/pypy/changeset/0a8401a58e9f/
Log: backport a couple cosmetic changes from branch unicode-utf8
diff --git a/pypy/interpreter/gateway.py b/pypy/interpreter/gateway.py
--- a/pypy/interpreter/gateway.py
+++ b/pypy/interpreter/gateway.py
@@ -499,6 +499,7 @@
def visit_truncatedint_w(self, typ):
self.unwrap.append("space.truncatedint_w(%s)" % (self.nextarg(),))
+ @staticmethod
def make_fastfunc(unwrap_spec, func):
unwrap_info = UnwrapSpec_FastFunc_Unwrap()
unwrap_info.apply_over(unwrap_spec)
@@ -529,7 +530,6 @@
exec compile2(source) in unwrap_info.miniglobals, d
fastfunc = d['fastfunc_%s_%d' % (func.__name__.replace('-', '_'),
narg)]
return narg, fastfunc
- make_fastfunc = staticmethod(make_fastfunc)
def int_unwrapping_space_method(typ):
diff --git a/pypy/module/__builtin__/operation.py
b/pypy/module/__builtin__/operation.py
--- a/pypy/module/__builtin__/operation.py
+++ b/pypy/module/__builtin__/operation.py
@@ -27,11 +27,9 @@
@unwrap_spec(code=int)
def unichr(space, code):
"Return a Unicode string of one character with the given ordinal."
- # XXX range checking!
- try:
- c = UNICHR(code)
- except ValueError:
+ if code < 0 or code > 0x10FFFF:
raise oefmt(space.w_ValueError, "unichr() arg out of range")
+ c = UNICHR(code)
return space.newunicode(c)
def len(space, w_obj):
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit