[pypy-svn] r41166 - in pypy/dist/pypy/jit/codegen: . i386

arigo at codespeak.net arigo at codespeak.net
Fri Mar 23 13:40:40 CET 2007


Author: arigo
Date: Fri Mar 23 13:40:39 2007
New Revision: 41166

Modified:
   pypy/dist/pypy/jit/codegen/detect_cpu.py
   pypy/dist/pypy/jit/codegen/i386/codebuf_nt.py
Log:
(afa on pypy-dev):
    
* platform.machine() is empty on some Windows machine
* the codebuf_nt module is expected to export a type called PTR



Modified: pypy/dist/pypy/jit/codegen/detect_cpu.py
==============================================================================
--- pypy/dist/pypy/jit/codegen/detect_cpu.py	(original)
+++ pypy/dist/pypy/jit/codegen/detect_cpu.py	Fri Mar 23 13:40:39 2007
@@ -8,10 +8,13 @@
     pass
 
 def autodetect():
+    mach = None
     try:
         import platform
         mach = platform.machine()
     except ImportError:
+        pass
+    if not mach:
         platform = sys.platform.lower()
         if platform.startswith('win'):   # assume an Intel Windows
             return 'i386'

Modified: pypy/dist/pypy/jit/codegen/i386/codebuf_nt.py
==============================================================================
--- pypy/dist/pypy/jit/codegen/i386/codebuf_nt.py	(original)
+++ pypy/dist/pypy/jit/codegen/i386/codebuf_nt.py	Fri Mar 23 13:40:39 2007
@@ -19,24 +19,24 @@
 globals().update(ctypes_platform.configure(CConfig))
 
 # cannot use c_void_p as return value of functions :-(
-LPVOID = ctypes.POINTER(ctypes.c_char)
+PTR = ctypes.POINTER(ctypes.c_char)
 
 VirtualAlloc = ctypes.windll.kernel32.VirtualAlloc
-VirtualAlloc.argtypes = [LPVOID, SIZE_T, DWORD, DWORD]
-VirtualAlloc.restype = LPVOID
+VirtualAlloc.argtypes = [PTR, SIZE_T, DWORD, DWORD]
+VirtualAlloc.restype = PTR
 
 VirtualProtect = ctypes.windll.kernel32.VirtualProtect
-VirtualProtect.argtypes = [LPVOID, SIZE_T, DWORD, ctypes.POINTER(DWORD)]
+VirtualProtect.argtypes = [PTR, SIZE_T, DWORD, ctypes.POINTER(DWORD)]
 VirtualProtect.restype = BOOL
 
 VirtualFree = ctypes.windll.kernel32.VirtualFree
-VirtualFree.argtypes = [LPVOID, SIZE_T, DWORD]
+VirtualFree.argtypes = [PTR, SIZE_T, DWORD]
 VirtualFree.restype = BOOL
 
 # ____________________________________________________________
 
 def alloc(map_size):
-    res = VirtualAlloc(LPVOID(), map_size, MEM_COMMIT|MEM_RESERVE,
+    res = VirtualAlloc(PTR(), map_size, MEM_COMMIT|MEM_RESERVE,
                        PAGE_EXECUTE_READWRITE)
     if not res:
         raise MemoryError



More information about the Pypy-commit mailing list