[pypy-svn] r54473 - pypy/dist/pypy/lib/_ctypes

antocuni at codespeak.net antocuni at codespeak.net
Tue May 6 14:10:34 CEST 2008


Author: antocuni
Date: Tue May  6 14:10:31 2008
New Revision: 54473

Modified:
   pypy/dist/pypy/lib/_ctypes/pointer.py
Log:
allow None as a null pointer value for _cast_addr (test following)



Modified: pypy/dist/pypy/lib/_ctypes/pointer.py
==============================================================================
--- pypy/dist/pypy/lib/_ctypes/pointer.py	(original)
+++ pypy/dist/pypy/lib/_ctypes/pointer.py	Tue May  6 14:10:31 2008
@@ -119,6 +119,9 @@
         result = tp()
         result._buffer[0] = obj
         return result
+    if obj is None:
+        result = tp()
+        return result
     if not (isinstance(obj, _CData) and type(obj)._is_pointer_like()):
         raise TypeError("cast() argument 1 must be a pointer, not %s"
                         % (type(obj),))



More information about the Pypy-commit mailing list