Author: fijal Branch: unicode-utf8 Changeset: r90457:572cc70c4d30 Date: 2017-03-01 17:24 +0100 http://bitbucket.org/pypy/pypy/changeset/572cc70c4d30/
Log: fix pyexpat. skip one failing test on os x diff --git a/pypy/module/pyexpat/interp_pyexpat.py b/pypy/module/pyexpat/interp_pyexpat.py --- a/pypy/module/pyexpat/interp_pyexpat.py +++ b/pypy/module/pyexpat/interp_pyexpat.py @@ -2,7 +2,7 @@ from pypy.interpreter.typedef import TypeDef, GetSetProperty from pypy.interpreter.gateway import interp2app, unwrap_spec, WrappedDefault from pypy.interpreter.error import OperationError, oefmt -from rpython.rlib import rgc, jit +from rpython.rlib import rgc, jit, rutf8 from rpython.rlib.objectmodel import specialize from rpython.rtyper.lltypesystem import rffi, lltype from rpython.rtyper.tool import rffi_platform @@ -487,8 +487,15 @@ def w_convert(self, space, s): if self.returns_unicode: - from pypy.interpreter.unicodehelper import decode_utf8 - return space.newunicode(decode_utf8(space, s)) + # I suppose this is a valid utf8, but there is noone to check + # and noone to catch an error either + try: + rutf8.str_check_utf8(s, len(s), final=True) + return space.newutf8(s, -1) + except rutf8.Utf8CheckError as e: + from pypy.interpreter import unicodehelper + unicodehelper.decode_error_handler(space)('strict', 'utf-8', + e.msg, s, e.startpos, e.endpos) else: return space.newtext(s) diff --git a/pypy/module/pyexpat/test/test_parser.py b/pypy/module/pyexpat/test/test_parser.py --- a/pypy/module/pyexpat/test/test_parser.py +++ b/pypy/module/pyexpat/test/test_parser.py @@ -192,6 +192,11 @@ spaceconfig = dict(usemodules=['pyexpat', 'itertools', '_socket', 'time', 'struct', 'binascii']) + def setup_class(cls): + import py, sys + if sys.platform != 'linux2': + py.test.skip("even if we add all the crazy includes to run ctypes, it ends with MallocMismatch") + def test_django_bug(self): xml_str = '<?xml version="1.0" standalone="no"?><!DOCTYPE example SYSTEM "http://example.com/example.dtd"><root/>' diff --git a/rpython/translator/platform/darwin.py b/rpython/translator/platform/darwin.py --- a/rpython/translator/platform/darwin.py +++ b/rpython/translator/platform/darwin.py @@ -59,12 +59,12 @@ def _include_dirs_for_openssl(self): return self._pkg_config("openssl", "--cflags-only-I", - ['/usr/include'], + ['/usr/include', '/usr/local/opt/openssl/include'], check_result_dir=True) def _library_dirs_for_openssl(self): return self._pkg_config("openssl", "--libs-only-L", - ['/usr/lib'], + ['/usr/lib', '/usr/local/opt/openssl/lib'], check_result_dir=True) def _frameworks(self, frameworks): _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit