[pypy-commit] pypy default: Refuse to translate the pyexpat module using the UTF-16 version of expat

arigo pypy.commits at gmail.com
Thu Sep 7 16:55:39 EDT 2017


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r92344:4589c72f2f47
Date: 2017-09-07 22:54 +0200
http://bitbucket.org/pypy/pypy/changeset/4589c72f2f47/

Log:	Refuse to translate the pyexpat module using the UTF-16 version of
	expat

diff --git a/pypy/module/pyexpat/__init__.py b/pypy/module/pyexpat/__init__.py
--- a/pypy/module/pyexpat/__init__.py
+++ b/pypy/module/pyexpat/__init__.py
@@ -51,6 +51,13 @@
                  'XML_PARAM_ENTITY_PARSING_ALWAYS']:
         interpleveldefs[name] = 'space.wrap(interp_pyexpat.%s)' % (name,)
 
+    def __init__(self, space, w_name):
+        "NOT_RPYTHON"
+        super(Module, self).__init__(space, w_name)
+        ver = space.unwrap(interp_pyexpat.get_expat_version(space))
+        assert len(ver) >= 5, (
+            "Cannot compile with the wide (UTF-16) version of Expat")
+
     def startup(self, space):
         from pypy.module.pyexpat import interp_pyexpat
         w_ver = interp_pyexpat.get_expat_version(space)


More information about the pypy-commit mailing list