[pypy-svn] r62783 - pypy/trunk/pypy/module/bz2

afa at codespeak.net afa at codespeak.net
Tue Mar 10 00:38:10 CET 2009


Author: afa
Date: Tue Mar 10 00:38:07 2009
New Revision: 62783

Modified:
   pypy/trunk/pypy/module/bz2/interp_bz2.py
Log:
CPython on Windows comes with a "bz2.lib" file which is NOT a bz2 library,
but the import library of the bz2.pyd extension module;
it contains only the init_bz2 function!

TODO: really handle external libraries on Windows.
Meanwhile, we check and skip the library if it does not match.


Modified: pypy/trunk/pypy/module/bz2/interp_bz2.py
==============================================================================
--- pypy/trunk/pypy/module/bz2/interp_bz2.py	(original)
+++ pypy/trunk/pypy/module/bz2/interp_bz2.py	Tue Mar 10 00:38:07 2009
@@ -18,6 +18,8 @@
     )
     calling_conv = 'c'
 
+    CHECK_LIBRARY = platform.Has('dump("x", (int)&BZ2_bzCompress)')
+
     off_t = platform.SimpleType("off_t", rffi.LONGLONG)
     size_t = platform.SimpleType("size_t", rffi.ULONG)
     BUFSIZ = platform.ConstantInteger("BUFSIZ")
@@ -56,6 +58,8 @@
     pass
 for k, v in platform.configure(CConfig).items():
     setattr(cConfig, k, v)
+if not cConfig.CHECK_LIBRARY:
+    raise ImportError("Invalid bz2 library")
 
 for name in constant_names:
     value = getattr(cConfig, name)



More information about the Pypy-commit mailing list