[pypy-commit] pypy unicode-utf8: fast path for unicode, bytes
Author: Matti Picus Branch: unicode-utf8 Changeset: r95515:3b46fe8d4d44 Date: 2018-12-16 22:24 +0200 http://bitbucket.org/pypy/pypy/changeset/3b46fe8d4d44/ Log:fast path for unicode, bytes diff --git a/pypy/objspace/std/unicodeobject.py b/pypy/objspace/std/unicodeobject.py --- a/pypy/objspace/std/unicodeobject.py +++ b/pypy/objspace/std/unicodeobject.py @@ -,7 +,11 @@ unicodehelper.check_ascii_or_raise(space, s) return space.newutf8(s, len(s)) if encoding == 'utf-8' or encoding == 'utf8': -s = space.charbuf_w(w_obj) +if (space.isinstance_w(w_obj, space.w_unicode) or +space.isinstance_w(w_obj, space.w_bytes)): +s = space.utf8_w(w_obj) +else: +s = space.charbuf_w(w_obj) lgt = unicodehelper.check_utf8_or_raise(space, s) return space.newutf8(s, lgt) w_codecs = space.getbuiltinmodule("_codecs") ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy unicode-utf8: fast path for unicode, also raises on non-ascii strings
Author: Matti Picus Branch: unicode-utf8 Changeset: r95516:72d83a806c67 Date: 2018-12-20 13:25 +0200 http://bitbucket.org/pypy/pypy/changeset/72d83a806c67/ Log:fast path for unicode, also raises on non-ascii strings diff --git a/pypy/interpreter/baseobjspace.py b/pypy/interpreter/baseobjspace.py --- a/pypy/interpreter/baseobjspace.py +++ b/pypy/interpreter/baseobjspace.py @@ -1671,6 +1671,8 @@ # needed because CPython has the same issue. (Well, it's # unclear if there is any use at all for getting the bytes in # the unicode buffer.) +if self.isinstance_w(w_obj, self.w_unicode): +return w_obj.charbuf_w(self) try: return self.bytes_w(w_obj) except OperationError as e: ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.6: solve 32bit _blake2 compilation on linux, still need win32, arm fixes
Author: Matti Picus Branch: py3.6 Changeset: r95517:e7b2b377385e Date: 2018-12-20 20:34 +0200 http://bitbucket.org/pypy/pypy/changeset/e7b2b377385e/ Log:solve 32bit _blake2 compilation on linux, still need win32, arm fixes diff --git a/lib_pypy/_blake2/_blake2_build.py b/lib_pypy/_blake2/_blake2_build.py --- a/lib_pypy/_blake2/_blake2_build.py +++ b/lib_pypy/_blake2/_blake2_build.py @@ -1,8 +1,18 @@ import os import sys +import platform from cffi import FFI +IS_ARM = platform.machine().startswith('arm') +if IS_ARM: +# XXX Choose neon accelaration +define_macros = [] +else: +define_macros = [('__SSE2__', '1')] + + + blake_cdef = """ #define BLAKE_OUTBYTES ... #define BLAKE_SALTBYTES ... @@ -72,6 +82,7 @@ sources=[os.path.join(_libdir, 'blake2b.c'), ], include_dirs=[_libdir], +define_macros=define_macros, ) def _replace_b2s(src): @@ -87,6 +98,7 @@ sources=[os.path.join(_libdir, 'blake2s.c'), ], include_dirs=[_libdir], +define_macros=define_macros, ) if __name__ == '__main__': ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit