diff options
author | Thomas Heller <theller@ctypes.org> | 2006-07-27 18:39:55 (GMT) |
---|---|---|
committer | Thomas Heller <theller@ctypes.org> | 2006-07-27 18:39:55 (GMT) |
commit | 09a6f6aad26ddda9a8b8ffe186fb48d4235e7e0d (patch) | |
tree | dfadf8110a58fb93ad7caf3ed143754321837ecb | |
parent | 9dd8dc3fee7970cbc40b4686957aa3eaf15f91f0 (diff) | |
download | cpython-09a6f6aad26ddda9a8b8ffe186fb48d4235e7e0d.zip cpython-09a6f6aad26ddda9a8b8ffe186fb48d4235e7e0d.tar.gz cpython-09a6f6aad26ddda9a8b8ffe186fb48d4235e7e0d.tar.bz2 |
Remove code that is no longer used (ctypes.com).
Fix the DllGetClassObject and DllCanUnloadNow so that they forward the
call to the comtypes.server.inprocserver module.
The latter was never documented, never used by published code, and
didn't work anyway, so I think it does not deserve a NEWS entry (but I
might be wrong).
-rw-r--r-- | Lib/ctypes/__init__.py | 45 |
1 files changed, 7 insertions, 38 deletions
diff --git a/Lib/ctypes/__init__.py b/Lib/ctypes/__init__.py index b7d1733..a4e3c36 100644 --- a/Lib/ctypes/__init__.py +++ b/Lib/ctypes/__init__.py @@ -464,52 +464,21 @@ else: return _wstring_at(ptr, size) -if _os.name == "nt": # COM stuff +if _os.name in ("nt", "ce"): # COM stuff def DllGetClassObject(rclsid, riid, ppv): - # First ask ctypes.com.server than comtypes.server for the - # class object. - - # trick py2exe by doing dynamic imports - result = -2147221231 # CLASS_E_CLASSNOTAVAILABLE try: - ctcom = __import__("ctypes.com.server", globals(), locals(), ['*']) + ccom = __import__("comtypes.server.inprocserver", globals(), locals(), ['*']) except ImportError: - pass + return -2147221231 # CLASS_E_CLASSNOTAVAILABLE else: - result = ctcom.DllGetClassObject(rclsid, riid, ppv) - - if result == -2147221231: # CLASS_E_CLASSNOTAVAILABLE - try: - ccom = __import__("comtypes.server", globals(), locals(), ['*']) - except ImportError: - pass - else: - result = ccom.DllGetClassObject(rclsid, riid, ppv) - - return result + return ccom.DllGetClassObject(rclsid, riid, ppv) def DllCanUnloadNow(): - # First ask ctypes.com.server than comtypes.server if we can unload or not. - # trick py2exe by doing dynamic imports - result = 0 # S_OK - try: - ctcom = __import__("ctypes.com.server", globals(), locals(), ['*']) - except ImportError: - pass - else: - result = ctcom.DllCanUnloadNow() - if result != 0: # != S_OK - return result - try: - ccom = __import__("comtypes.server", globals(), locals(), ['*']) + ccom = __import__("comtypes.server.inprocserver", globals(), locals(), ['*']) except ImportError: - return result - try: - return ccom.DllCanUnloadNow() - except AttributeError: - pass - return result + return 0 # S_OK + return ccom.DllCanUnloadNow() from ctypes._endian import BigEndianStructure, LittleEndianStructure |