ctypes-commit Mailing List for ctypes (Page 38)
Brought to you by:
theller
You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
|
Apr
(8) |
May
(90) |
Jun
(143) |
Jul
(106) |
Aug
(94) |
Sep
(84) |
Oct
(163) |
Nov
(60) |
Dec
(58) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(128) |
Feb
(79) |
Mar
(227) |
Apr
(192) |
May
(179) |
Jun
(41) |
Jul
(53) |
Aug
(103) |
Sep
(28) |
Oct
(38) |
Nov
(81) |
Dec
(17) |
2006 |
Jan
(184) |
Feb
(111) |
Mar
(188) |
Apr
(67) |
May
(58) |
Jun
(123) |
Jul
(73) |
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
From: Thomas H. <th...@us...> - 2005-10-18 18:56:56
|
Update of /cvsroot/ctypes/ctypes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29888 Modified Files: Tag: branch_1_0 ChangeLog Log Message: Index: ChangeLog =================================================================== RCS file: /cvsroot/ctypes/ctypes/ChangeLog,v retrieving revision 1.86.2.21 retrieving revision 1.86.2.22 diff -C2 -d -r1.86.2.21 -r1.86.2.22 *** ChangeLog 14 Oct 2005 19:53:43 -0000 1.86.2.21 --- ChangeLog 18 Oct 2005 18:56:45 -0000 1.86.2.22 *************** *** 1,2 **** --- 1,6 ---- + 2005-10-18 Thomas Heller <th...@py...> + + * source\_ctypes.c: Implemented __nonzero__ for simple types. + 2005-10-14 Thomas Heller <th...@py...> |
From: Thomas H. <th...@us...> - 2005-10-18 18:14:00
|
Update of /cvsroot/ctypes/ctypes/unittests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19328 Modified Files: Tag: branch_1_0 test_paramflags.py Log Message: *** empty log message *** Index: test_paramflags.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/unittests/test_paramflags.py,v retrieving revision 1.6.2.1 retrieving revision 1.6.2.2 diff -C2 -d -r1.6.2.1 -r1.6.2.2 *** test_paramflags.py 29 Sep 2005 12:38:36 -0000 1.6.2.1 --- test_paramflags.py 18 Oct 2005 18:13:52 -0000 1.6.2.2 *************** *** 91,95 **** def checker(*args): ! print "checker", args proto = CFUNCTYPE(c_int, c_long, POINTER(RECT)) --- 91,96 ---- def checker(*args): ! ## print "checker", args ! checker.got_args = args proto = CFUNCTYPE(c_int, c_long, POINTER(RECT)) *************** *** 98,101 **** --- 99,105 ---- func.errcheck = checker func(32) + + self.failUnlessEqual(checker.got_args[:2], (0, func)) + self.failUnlessEqual(checker.got_args[2][0], 32) if os.name == "nt": |
From: Thomas H. <th...@us...> - 2005-10-18 18:08:40
|
Update of /cvsroot/ctypes/ctypes/unittests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17642 Modified Files: Tag: branch_1_0 test_prototypes.py Log Message: Index: test_prototypes.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/unittests/test_prototypes.py,v retrieving revision 1.6.6.3 retrieving revision 1.6.6.4 diff -C2 -d -r1.6.6.3 -r1.6.6.4 *** test_prototypes.py 19 Aug 2005 18:47:16 -0000 1.6.6.3 --- test_prototypes.py 18 Oct 2005 18:08:24 -0000 1.6.6.4 *************** *** 172,176 **** func.argtypes = c_int * 8, ! print func((c_int * 8)(1, 2, 3, 4, 5, 6, 7, 8)) # This did crash before: --- 172,179 ---- func.argtypes = c_int * 8, ! arg = (c_int * 8)(1, 2, 3, 4, 5, 6, 7, 8) ! result = func(arg) ! ! self.failUnlessEqual(result[:8], [1, 2, 3, 4, 5, 6, 7, 8]) # This did crash before: |
From: Thomas H. <th...@us...> - 2005-10-18 07:36:09
|
Update of /cvsroot/ctypes/ctypes/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24904 Modified Files: Tag: branch_1_0 _ctypes.c Log Message: Implement __nonzero__ for simple types. Index: _ctypes.c =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/_ctypes.c,v retrieving revision 1.226.2.30 retrieving revision 1.226.2.31 diff -C2 -d -r1.226.2.30 -r1.226.2.31 *** _ctypes.c 6 Sep 2005 11:15:02 -0000 1.226.2.30 --- _ctypes.c 18 Oct 2005 07:36:01 -0000 1.226.2.31 *************** *** 1830,1834 **** 0, /* tp_weaklistoffset */ 0, /* tp_iter */ ! 0, /* tp_iternext */ CData_methods, /* tp_methods */ CData_members, /* tp_members */ 0, /* tp_getset */ --- 1830,1835 ---- 0, /* tp_weaklistoffset */ 0, /* tp_iter */ ! 0, /* tp_iternext */ ! CData_methods, /* tp_methods */ CData_members, /* tp_members */ 0, /* tp_getset */ *************** *** 3676,3679 **** --- 3677,3699 ---- }; + static int Simple_nonzero(CDataObject *self) + { + return memcmp(self->b_ptr, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", self->b_size); + } + + static PyNumberMethods Simple_as_number = { + 0, /* nb_add */ + 0, /* nb_subtract */ + 0, /* nb_multiply */ + 0, /* nb_divide */ + 0, /* nb_remainder */ + 0, /* nb_divmod */ + 0, /* nb_power */ + 0, /* nb_negative */ + 0, /* nb_positive */ + 0, /* nb_absolute */ + (inquiry)Simple_nonzero, /* nb_nonzero */ + }; + static PyTypeObject Simple_Type = { PyObject_HEAD_INIT(NULL) *************** *** 3688,3692 **** 0, /* tp_compare */ 0, /* tp_repr */ ! 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ --- 3708,3712 ---- 0, /* tp_compare */ 0, /* tp_repr */ ! &Simple_as_number, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ |
From: Thomas H. <th...@us...> - 2005-10-14 20:10:01
|
Update of /cvsroot/ctypes/ctypes/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7187 Modified Files: Tag: branch_1_0 callbacks.c Log Message: Remove the unused pre-GILSTATE stuff. Index: callbacks.c =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/callbacks.c,v retrieving revision 1.71.2.3 retrieving revision 1.71.2.4 diff -C2 -d -r1.71.2.3 -r1.71.2.4 *** callbacks.c 14 Oct 2005 19:52:52 -0000 1.71.2.3 --- callbacks.c 14 Oct 2005 20:09:53 -0000 1.71.2.4 *************** *** 9,45 **** #include "ctypes.h" - /* For 2.3, use the PyGILState_ calls, see PEP 311 */ - #if (PY_VERSION_HEX >= 0x02030000) - #define CTYPES_USE_GILSTATE - #endif - - #ifndef CTYPES_USE_GILSTATE - static PyInterpreterState *g_interp; /* need this to create new thread states */ - - static void EnterPython(void) - { - PyThreadState *pts; - if (!g_interp) - Py_FatalError("_ctypes: no interpreter state"); - PyEval_AcquireLock(); - pts = PyThreadState_New(g_interp); - if (!pts) - Py_FatalError("_ctypes: Could not allocate ThreadState"); - if (NULL != PyThreadState_Swap(pts)) - Py_FatalError("_ctypes (EnterPython): thread state not == NULL?"); - } - - static void LeavePython(void) - { - PyThreadState *pts = PyThreadState_Get(); - if (!pts) - Py_FatalError("_ctypes (LeavePython): ThreadState is NULL?"); - PyThreadState_Clear(pts); - pts = PyThreadState_Swap(NULL); - PyThreadState_Delete(pts); - PyEval_ReleaseLock(); - } - #endif - static void PrintError(char *msg, ...) --- 9,12 ---- *************** *** 157,166 **** PyObject *arglist = NULL; int nArgs; - - #ifdef CTYPES_USE_GILSTATE PyGILState_STATE state = PyGILState_Ensure(); - #else - EnterPython(); - #endif nArgs = PySequence_Length(converters); --- 124,128 ---- *************** *** 283,292 **** Done: Py_XDECREF(arglist); - - #ifdef CTYPES_USE_GILSTATE PyGILState_Release(state); - #else - LeavePython(); - #endif } --- 245,249 ---- *************** *** 400,407 **** if (PyType_Ready((PyTypeObject *)&PyType_Type) < 0) return; - - #ifndef CTYPES_USE_GILSTATE - g_interp = PyThreadState_Get()->interp; - #endif } --- 357,360 ---- *************** *** 506,522 **** PyEval_InitThreads(); Py_Initialize(); - } else { - #ifndef CTYPES_USE_GILSTATE - /* Python is already initialized. - We assume we don't have the lock. - */ - if (!g_interp) { - g_interp = PyInterpreterState_Head(); - if(PyInterpreterState_Next(g_interp)) - Py_FatalError("_ctypes: more than one interpreter state"); - } - EnterPython(); - #endif - return; } } --- 459,462 ---- *************** *** 561,579 **** { long result; - - #ifdef CTYPES_USE_GILSTATE PyGILState_STATE state; LoadPython(); state = PyGILState_Ensure(); - #else - LoadPython(); /* calls EnterPython itself */ - #endif result = Call_GetClassObject(rclsid, riid, ppv); - - #ifdef CTYPES_USE_GILSTATE PyGILState_Release(state); - #else - LeavePython(); - #endif return result; } --- 501,509 ---- *************** *** 618,636 **** { long result; - #ifdef CTYPES_USE_GILSTATE PyGILState_STATE state = PyGILState_Ensure(); - #else - if (!Py_IsInitialized()) { - LoadPython(); - LeavePython(); - } - EnterPython(); - #endif result = Call_CanUnloadNow(); - #ifdef CTYPES_USE_GILSTATE PyGILState_Release(state); - #else - LeavePython(); - #endif return result; } --- 548,554 ---- |
From: Thomas H. <th...@us...> - 2005-10-14 19:53:53
|
Update of /cvsroot/ctypes/ctypes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3389 Modified Files: Tag: branch_1_0 ChangeLog Log Message: Fixed a refcount leak in callbacks. Index: ChangeLog =================================================================== RCS file: /cvsroot/ctypes/ctypes/ChangeLog,v retrieving revision 1.86.2.20 retrieving revision 1.86.2.21 diff -C2 -d -r1.86.2.20 -r1.86.2.21 *** ChangeLog 6 Sep 2005 12:00:29 -0000 1.86.2.20 --- ChangeLog 14 Oct 2005 19:53:43 -0000 1.86.2.21 *************** *** 1,2 **** --- 1,6 ---- + 2005-10-14 Thomas Heller <th...@py...> + + * source\callbacks.c: Fixed a refcount leak in callbacks. + 2005-09-06 Thomas Heller <th...@py...> |
From: Thomas H. <th...@us...> - 2005-10-14 19:53:04
|
Update of /cvsroot/ctypes/ctypes/unittests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3133 Modified Files: Tag: branch_1_0 test_refcounts.py Log Message: Fixed a refcount leak in callbacks. Index: test_refcounts.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/unittests/test_refcounts.py,v retrieving revision 1.16 retrieving revision 1.16.6.1 diff -C2 -d -r1.16 -r1.16.6.1 *** test_refcounts.py 14 Oct 2004 13:16:13 -0000 1.16 --- test_refcounts.py 14 Oct 2005 19:52:57 -0000 1.16.6.1 *************** *** 82,85 **** --- 82,97 ---- self.failUnlessEqual(grc(func), 2) + class AnotherLeak(unittest.TestCase): + def test_callback(self): + import sys + + proto = ctypes.CFUNCTYPE(ctypes.c_int, ctypes.c_int, ctypes.c_int) + def func(a, b): + return a * b * 2 + f = proto(func) + + a = sys.getrefcount(ctypes.c_int) + f(1, 2) + self.failUnlessEqual(sys.getrefcount(ctypes.c_int), a) if __name__ == '__main__': |
From: Thomas H. <th...@us...> - 2005-10-14 19:53:00
|
Update of /cvsroot/ctypes/ctypes/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3112 Modified Files: Tag: branch_1_0 callbacks.c Log Message: Fixed a refcount leak in callbacks. Index: callbacks.c =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/callbacks.c,v retrieving revision 1.71.2.2 retrieving revision 1.71.2.3 diff -C2 -d -r1.71.2.2 -r1.71.2.3 *** callbacks.c 17 Aug 2005 15:54:24 -0000 1.71.2.2 --- callbacks.c 14 Oct 2005 19:52:52 -0000 1.71.2.3 *************** *** 193,196 **** --- 193,197 ---- if (!v) { PrintError("create argument %d:\n", i); + Py_DECREF(cnv); goto Done; } *************** *** 206,213 **** --- 207,216 ---- if (!obj) { PrintError("create argument %d:\n", i); + Py_DECREF(cnv); goto Done; } if (!CDataObject_Check(obj)) { Py_DECREF(obj); + Py_DECREF(cnv); PrintError("unexpected result of create argument %d:\n", i); goto Done; *************** *** 222,227 **** --- 225,232 ---- "cannot build parameter"); PrintError("Parsing argument %d\n", i); + Py_DECREF(cnv); goto Done; } + Py_DECREF(cnv); /* XXX error handling! */ pArgs++; |
From: Thomas H. <th...@us...> - 2005-10-11 14:08:39
|
Update of /cvsroot/ctypes/ctypes/comtypes/client In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31756 Modified Files: Tag: branch_1_0 __init__.py Log Message: Removed invalid documentation. Index: __init__.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/comtypes/client/Attic/__init__.py,v retrieving revision 1.1.2.8 retrieving revision 1.1.2.9 diff -C2 -d -r1.1.2.8 -r1.1.2.9 *** __init__.py 11 Oct 2005 13:09:53 -0000 1.1.2.8 --- __init__.py 11 Oct 2005 14:08:46 -0000 1.1.2.9 *************** *** 1,73 **** '''High level client level COM support module. - - CreateObject(progid, # which object to create - clsctx=None, # how to create the object - machine=None, # where to create the object - interface=None, # the interface we want - modulename=None, # alias name for the typelib wrapper - sink=None, # where to send events - sourceinterface=None) # the event interface we want - - - Create a COM object and return an interface pointer to it. - - - wrap(comobj, wrapper=None) - - GetModule(typelib, modulename=None) - - Generate a Python wrapper for a COM typelibrary, import and return - the module. - - - gen_dir - - The directory where modules are created, this is the usually the - 'comtypes.gen' package directory. In a frozen exe, gen_dir is set - to None, and modules are only created in memory. - - CoGetObject(displayname, ...) - - Python wrappers for typelibraries are generated on demand in the - comtypes/gen directory. The names of these modules are derived from - typelibrary attributes - file names look like this - - _00020430_0000_0000_C000_000000000046_0_2_0.py - - so they are not really human readable. - - - The modulename optional argument to the CreateObject() and the - GetModule() functions specifies the name for an alias module which - will contain everything that the typelib wrapper contains, but the - import statement could be written much easier. The friendly name must - be a valid Python module name, and the module is also created inside - the comtypes.gen package. - - For example, calling - - GetModule("stdole2.tlb", modulename="stdole2_tlb") - - would generate the modules - comtypes.gen._00020430_0000_0000_C000_000000000046_0_2_0 - and - comtypes.gen.stdole2_tlb - - Another example uses the CreateObject function to create an instance - of Internet Explorer, generates the typelib wrapper for it, and makes - it available as comtypes.gen.IE_typelib module: - - obj = CreateObject("InternetExplorer.Application", - modulename="IE_typelib") - from comtypes.gen import IE_typelib - - The imported typelib wrapper can be used to access COM constants, for - example, and has also the advantage that py2exe would pick up the - typelib to include it in the executable. - - It is possible to create an exe file without importing the typelib - with a friendly name. py2exe includes the typelib parser and code - generation stuff into the executable, so the typelib wrapper would - then be generated at runtime, but only in memory. ''' --- 1,3 ---- *************** *** 172,182 **** (libid, wMajorVerNum, wMinorVerNum, lcid=0) - 'modulename' allows to specify a name for an alias module which - will also be created on demand inside the comtypes.gen package. - If 'modulename' is given and the module corresponding to that can - be imported it is returned without trying to load the type - library, so it CAN work without the type library actually being - present. - This function determines the module name from the typelib attributes, then tries to import it. If that fails because the --- 102,105 ---- *************** *** 194,204 **** Example: ! GetModule("shdocvw.dll", ! modulename="IE_typelib") would create modules named comtypes.gen._EAB22AC0_30C1_11CF_A7EB_0000C05BAE0B_0_1_1 ! comtypes.gen.IE_typelib containing the Python wrapper code for the type library used by --- 117,126 ---- Example: ! GetModule("shdocvw.dll") would create modules named comtypes.gen._EAB22AC0_30C1_11CF_A7EB_0000C05BAE0B_0_1_1 ! comtypes.gen.SHDocVw containing the Python wrapper code for the type library used by |
From: Thomas H. <th...@us...> - 2005-10-11 13:11:22
|
Update of /cvsroot/ctypes/ctypes/comtypes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16712 Modified Files: Tag: branch_1_0 ChangeLog Log Message: Index: ChangeLog =================================================================== RCS file: /cvsroot/ctypes/ctypes/comtypes/Attic/ChangeLog,v retrieving revision 1.1.2.3 retrieving revision 1.1.2.4 diff -C2 -d -r1.1.2.3 -r1.1.2.4 *** ChangeLog 11 Oct 2005 12:42:45 -0000 1.1.2.3 --- ChangeLog 11 Oct 2005 13:11:27 -0000 1.1.2.4 *************** *** 2,6 **** * client\__init__.py: Renamed CreateModule() into GetModule(). ! Suggestion from Bruce Dodson. 2005-09-29 Thomas Heller <th...@py...> --- 2,9 ---- * client\__init__.py: Renamed CreateModule() into GetModule(). ! Removed the 'modulename' parameter from all the function calls - ! the typelib wrapper alias name is now taken from the typelib ! library name. ! Suggestions from Bruce Dodson. 2005-09-29 Thomas Heller <th...@py...> |
From: Thomas H. <th...@us...> - 2005-10-11 13:09:56
|
Update of /cvsroot/ctypes/ctypes/comtypes/unittests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16245 Modified Files: Tag: branch_1_0 test_ie.py test_client.py Log Message: Removed the 'modulename' parameter from all the functions. The typelib wrapper alias name is now taken from the library name of the typelib. Suggested by Bruce Dodson. Documentation still has to be updated. Index: test_ie.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/comtypes/unittests/Attic/test_ie.py,v retrieving revision 1.1.2.5 retrieving revision 1.1.2.6 diff -C2 -d -r1.1.2.5 -r1.1.2.6 *** test_ie.py 23 Aug 2005 19:44:15 -0000 1.1.2.5 --- test_ie.py 11 Oct 2005 13:09:59 -0000 1.1.2.6 *************** *** 65,70 **** def test_default_eventinterface(self): sink = EventSink() ! ie = CreateObject("InternetExplorer.Application", ! modulename="shdocvw_tlb", sink=sink) ie.Visible = True --- 65,69 ---- def test_default_eventinterface(self): sink = EventSink() ! ie = CreateObject("InternetExplorer.Application") sink=sink) ie.Visible = True *************** *** 88,94 **** def test_nondefault_eventinterface(self): sink = EventSink() ! ie = CreateObject("InternetExplorer.Application", ! modulename="shdocvw_tlb") ! import comtypes.gen.shdocvw_tlb as mod GetEvents(ie, sink, interface=mod.DWebBrowserEvents) --- 87,92 ---- def test_nondefault_eventinterface(self): sink = EventSink() ! ie = CreateObject("InternetExplorer.Application") ! import comtypes.gen.SHDocVw as mod GetEvents(ie, sink, interface=mod.DWebBrowserEvents) Index: test_client.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/comtypes/unittests/Attic/test_client.py,v retrieving revision 1.1.2.5 retrieving revision 1.1.2.6 diff -C2 -d -r1.1.2.5 -r1.1.2.6 *** test_client.py 11 Oct 2005 12:40:22 -0000 1.1.2.5 --- test_client.py 11 Oct 2005 13:09:59 -0000 1.1.2.6 *************** *** 4,9 **** # create the typelib wrapper and import it ! comtypes.client.GetModule("msscript.ocx", modulename="msscript") ! from comtypes.gen import msscript class Test(ut.TestCase): --- 4,9 ---- # create the typelib wrapper and import it ! comtypes.client.GetModule("msscript.ocx") ! from comtypes.gen import MSScriptControl class Test(ut.TestCase): *************** *** 11,25 **** # create from ProgID obj = comtypes.client.CreateObject("MSScriptControl.ScriptControl") ! self.failUnless(isinstance(obj, POINTER(msscript.IScriptControl))) def test_clsid(self): # create from the CoClass' clsid ! obj = comtypes.client.CreateObject(msscript.ScriptControl) ! self.failUnless(isinstance(obj, POINTER(msscript.IScriptControl))) def test_clsid_string(self): # create from string clsid ! comtypes.client.CreateObject(unicode(msscript.ScriptControl._reg_clsid_)) ! comtypes.client.CreateObject(str(msscript.ScriptControl._reg_clsid_)) def test_remote(self): --- 11,25 ---- # create from ProgID obj = comtypes.client.CreateObject("MSScriptControl.ScriptControl") ! self.failUnless(isinstance(obj, POINTER(MSScriptControl.IScriptControl))) def test_clsid(self): # create from the CoClass' clsid ! obj = comtypes.client.CreateObject(MSScriptControl.ScriptControl) ! self.failUnless(isinstance(obj, POINTER(MSScriptControl.IScriptControl))) def test_clsid_string(self): # create from string clsid ! comtypes.client.CreateObject(unicode(MSScriptControl.ScriptControl._reg_clsid_)) ! comtypes.client.CreateObject(str(MSScriptControl.ScriptControl._reg_clsid_)) def test_remote(self): |
From: Thomas H. <th...@us...> - 2005-10-11 13:09:53
|
Update of /cvsroot/ctypes/ctypes/comtypes/client In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16224 Modified Files: Tag: branch_1_0 __init__.py Log Message: Removed the 'modulename' parameter from all the functions. The typelib wrapper alias name is now taken from the library name of the typelib. Suggested by Bruce Dodson. Documentation still has to be updated. Index: __init__.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/comtypes/client/Attic/__init__.py,v retrieving revision 1.1.2.7 retrieving revision 1.1.2.8 diff -C2 -d -r1.1.2.7 -r1.1.2.8 *** __init__.py 11 Oct 2005 12:40:15 -0000 1.1.2.7 --- __init__.py 11 Oct 2005 13:09:53 -0000 1.1.2.8 *************** *** 163,167 **** return "comtypes.gen." + modname ! def GetModule(tlib, modulename=None): """Create a module wrapping a COM typelibrary on demand. --- 163,167 ---- return "comtypes.gen." + modname ! def GetModule(tlib): """Create a module wrapping a COM typelibrary on demand. *************** *** 206,214 **** latter is a short stub loading the former. """ - if modulename: - try: - return _my_import("comtypes.gen." + modulename) - except: - pass if isinstance(tlib, basestring): # we accept filenames as well --- 206,209 ---- *************** *** 220,225 **** --- 215,222 ---- # create and import the module mod = _CreateWrapper(tlib, fullname) + modulename = tlib.GetDocumentation(-1)[0] if modulename is None: return mod + modulename = modulename.encode("mbcs") # create and import the friendly-named module *************** *** 290,294 **** # XXX rename this! ! def wrap(punk, modulename=None): """Try to QueryInterface a COM pointer to the 'most useful' interface. --- 287,291 ---- # XXX rename this! ! def wrap(punk): """Try to QueryInterface a COM pointer to the 'most useful' interface. *************** *** 333,337 **** # import the wrapper, generating it on demand ! mod = GetModule(tlib, modulename) # Python interface class interface = getattr(mod, itf_name) --- 330,334 ---- # import the wrapper, generating it on demand ! mod = GetModule(tlib) # Python interface class interface = getattr(mod, itf_name) *************** *** 488,492 **** def GetActiveObject(progid, interface=None, # the interface we want - modulename=None, # alias name for the typelib wrapper sink=None, # where to send events sourceinterface=None): # the event interface we want --- 485,488 ---- *************** *** 495,514 **** return _manage(obj, clsid, interface=interface, - modulename=modulename, sink=sink, sourceinterface=sourceinterface) ! def _manage(obj, clsid, ! interface, modulename , sink, sourceinterface): if interface is None: ! obj = wrap(obj, modulename) ! elif modulename: ! # XXX fix me. ! # wrap(obj, modulename) should be refactored into: ! # - tlib = get_typelib(obj) ! # - GetModule(tlib, modulename) ! # - obj.QueryInterface(...) ! wrap(obj, modulename) if sink is not None: if sourceinterface is None: --- 491,501 ---- return _manage(obj, clsid, interface=interface, sink=sink, sourceinterface=sourceinterface) ! def _manage(obj, clsid, interface, sink, sourceinterface): if interface is None: ! obj = wrap(obj) if sink is not None: if sourceinterface is None: *************** *** 523,527 **** machine=None, # where to create the object interface=None, # the interface we want - modulename=None, # alias name for the typelib wrapper sink=None, # where to send events sourceinterface=None): # the event interface we want --- 510,513 ---- *************** *** 535,539 **** 'clsctx' specifies how to create the object, use the CLSCTX_... constants. 'machine' allows to specify a remote machine to create the object on. - 'modulename' allows to specify a readable alias name for the typelib wrapper. 'sink' specifies an optional object to receive COM events. 'sourceinterface' is the interface that sends events. If not specified, --- 521,524 ---- *************** *** 549,553 **** return _manage(obj, clsid, interface=interface, - modulename=modulename, sink=sink, sourceinterface=sourceinterface) --- 534,537 ---- *************** *** 555,559 **** def CoGetObject(displayname, interface=None, # the interface we want - modulename=None, # alias name for the typelib wrapper sink=None, # where to send events sourceinterface=None): # the event interface we want --- 539,542 ---- *************** *** 566,570 **** clsid=None, interface=interface, - modulename=modulename, sink=sink, sourceinterface=sourceinterface) --- 549,552 ---- |
From: Thomas H. <th...@us...> - 2005-10-11 12:42:42
|
Update of /cvsroot/ctypes/ctypes/comtypes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8785 Modified Files: Tag: branch_1_0 ChangeLog Log Message: Renamed comtypes.client CreateModule() into GetModule(). Index: ChangeLog =================================================================== RCS file: /cvsroot/ctypes/ctypes/comtypes/Attic/ChangeLog,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -C2 -d -r1.1.2.2 -r1.1.2.3 *** ChangeLog 29 Sep 2005 13:50:06 -0000 1.1.2.2 --- ChangeLog 11 Oct 2005 12:42:45 -0000 1.1.2.3 *************** *** 1,2 **** --- 1,7 ---- + 2005-10-11 Thomas Heller <th...@py...> + + * client\__init__.py: Renamed CreateModule() into GetModule(). + Suggestion from Bruce Dodson. + 2005-09-29 Thomas Heller <th...@py...> |
From: Thomas H. <th...@us...> - 2005-10-11 12:40:18
|
Update of /cvsroot/ctypes/ctypes/comtypes/unittests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8315 Modified Files: Tag: branch_1_0 test_createwrappers.py test_client.py Log Message: Renamed comtypes.client CreateModule() into GetModule(). Index: test_createwrappers.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/comtypes/unittests/Attic/test_createwrappers.py,v retrieving revision 1.1.2.3 retrieving revision 1.1.2.4 diff -C2 -d -r1.1.2.3 -r1.1.2.4 *** test_createwrappers.py 30 Aug 2005 06:31:56 -0000 1.1.2.3 --- test_createwrappers.py 11 Oct 2005 12:40:22 -0000 1.1.2.4 *************** *** 25,29 **** def test(self): try: ! comtypes.client.CreateModule(fname) except TypeError, detail: # work around the bug that arrays and simple pointer --- 25,29 ---- def test(self): try: ! comtypes.client.GetModule(fname) except TypeError, detail: # work around the bug that arrays and simple pointer *************** *** 32,36 **** raise ! test.__doc__ = "test CreateModule(%r)" % fname setattr(Test, "test_%d" % number, test) number += 1 --- 32,36 ---- raise ! test.__doc__ = "test GetModule(%r)" % fname setattr(Test, "test_%d" % number, test) number += 1 Index: test_client.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/comtypes/unittests/Attic/test_client.py,v retrieving revision 1.1.2.4 retrieving revision 1.1.2.5 diff -C2 -d -r1.1.2.4 -r1.1.2.5 *** test_client.py 29 Sep 2005 13:11:28 -0000 1.1.2.4 --- test_client.py 11 Oct 2005 12:40:22 -0000 1.1.2.5 *************** *** 4,8 **** # create the typelib wrapper and import it ! comtypes.client.CreateModule("msscript.ocx", modulename="msscript") from comtypes.gen import msscript --- 4,8 ---- # create the typelib wrapper and import it ! comtypes.client.GetModule("msscript.ocx", modulename="msscript") from comtypes.gen import msscript |
From: Thomas H. <th...@us...> - 2005-10-11 12:40:10
|
Update of /cvsroot/ctypes/ctypes/comtypes/client In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8230 Modified Files: Tag: branch_1_0 __init__.py Log Message: Renamed comtypes.client CreateModule() into GetModule(). Index: __init__.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/comtypes/client/Attic/__init__.py,v retrieving revision 1.1.2.6 retrieving revision 1.1.2.7 diff -C2 -d -r1.1.2.6 -r1.1.2.7 *** __init__.py 2 Sep 2005 16:54:03 -0000 1.1.2.6 --- __init__.py 11 Oct 2005 12:40:15 -0000 1.1.2.7 *************** *** 15,19 **** wrap(comobj, wrapper=None) ! CreateModule(typelib, modulename=None) Generate a Python wrapper for a COM typelibrary, import and return --- 15,19 ---- wrap(comobj, wrapper=None) ! GetModule(typelib, modulename=None) Generate a Python wrapper for a COM typelibrary, import and return *************** *** 39,43 **** The modulename optional argument to the CreateObject() and the ! CreateModule() functions specifies the name for an alias module which will contain everything that the typelib wrapper contains, but the import statement could be written much easier. The friendly name must --- 39,43 ---- The modulename optional argument to the CreateObject() and the ! GetModule() functions specifies the name for an alias module which will contain everything that the typelib wrapper contains, but the import statement could be written much easier. The friendly name must *************** *** 47,51 **** For example, calling ! CreateModule("stdole2.tlb", modulename="stdole2_tlb") would generate the modules --- 47,51 ---- For example, calling ! GetModule("stdole2.tlb", modulename="stdole2_tlb") would generate the modules *************** *** 98,102 **** __all__ = ["CreateObject", "GetActiveObject", "CoGetObject", ! "GetEvents", "ReleaseEvents", "CreateModule"] __verbose__ = __debug__ --- 98,102 ---- __all__ = ["CreateObject", "GetActiveObject", "CoGetObject", ! "GetEvents", "ReleaseEvents", "GetModule"] __verbose__ = __debug__ *************** *** 163,167 **** return "comtypes.gen." + modname ! def CreateModule(tlib, modulename=None): """Create a module wrapping a COM typelibrary on demand. --- 163,167 ---- return "comtypes.gen." + modname ! def GetModule(tlib, modulename=None): """Create a module wrapping a COM typelibrary on demand. *************** *** 194,198 **** Example: ! CreateModule("shdocvw.dll", modulename="IE_typelib") --- 194,198 ---- Example: ! GetModule("shdocvw.dll", modulename="IE_typelib") *************** *** 275,279 **** if __verbose__: print "# Generating comtypes.gen.%s" % modname ! generate_module(tlib, ofi, CreateModule, _name_module) if gen_dir is None: --- 275,279 ---- if __verbose__: print "# Generating comtypes.gen.%s" % modname ! generate_module(tlib, ofi, GetModule, _name_module) if gen_dir is None: *************** *** 333,337 **** # import the wrapper, generating it on demand ! mod = CreateModule(tlib, modulename) # Python interface class interface = getattr(mod, itf_name) --- 333,337 ---- # import the wrapper, generating it on demand ! mod = GetModule(tlib, modulename) # Python interface class interface = getattr(mod, itf_name) *************** *** 508,512 **** # wrap(obj, modulename) should be refactored into: # - tlib = get_typelib(obj) ! # - CreateModule(tlib, modulename) # - obj.QueryInterface(...) wrap(obj, modulename) --- 508,512 ---- # wrap(obj, modulename) should be refactored into: # - tlib = get_typelib(obj) ! # - GetModule(tlib, modulename) # - obj.QueryInterface(...) wrap(obj, modulename) |
From: Thomas H. <th...@us...> - 2005-10-11 12:33:00
|
Update of /cvsroot/ctypes/ctypes/comtypes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6815 Modified Files: Tag: branch_1_0 __init__.py Log Message: Index: __init__.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/comtypes/__init__.py,v retrieving revision 1.25.2.31 retrieving revision 1.25.2.32 diff -C2 -d -r1.25.2.31 -r1.25.2.32 *** __init__.py 29 Sep 2005 12:59:52 -0000 1.25.2.31 --- __init__.py 11 Oct 2005 12:33:01 -0000 1.25.2.32 *************** *** 23,28 **** ################################################################ # Readings: - # Larry Osterman: What are these threading models and why do I care? # http://blogs.msdn.com/larryosterman/archive/2004/04/28/122240.aspx ################################################################ --- 23,28 ---- ################################################################ # Readings: # http://blogs.msdn.com/larryosterman/archive/2004/04/28/122240.aspx + # http://www.microsoft.com/ntserver/techresources/appserv/COM/DCOM/5_ConcurrencyMgmt.asp ################################################################ |
From: Thomas H. <th...@us...> - 2005-09-30 10:09:57
|
Update of /cvsroot/ctypes/ctypes/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6842 Modified Files: Tag: branch_1_0 callproc.c Log Message: Fix build problem because compilers complained about assignment to an lvalue. Reported by Ganesan Rajagopal. Index: callproc.c =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/callproc.c,v retrieving revision 1.127.2.13 retrieving revision 1.127.2.14 diff -C2 -d -r1.127.2.13 -r1.127.2.14 *** callproc.c 2 Sep 2005 17:28:05 -0000 1.127.2.13 --- callproc.c 30 Sep 2005 10:09:32 -0000 1.127.2.14 *************** *** 939,943 **** */ if (rtype->size < sizeof(ffi_arg)) ! (char *)resbuf += sizeof(ffi_arg) - rtype->size; #endif --- 939,943 ---- */ if (rtype->size < sizeof(ffi_arg)) ! resbuf = (char *)resbuf + sizeof(ffi_arg) - rtype->size; #endif |
From: Thomas H. <th...@us...> - 2005-09-29 13:50:18
|
Update of /cvsroot/ctypes/ctypes/comtypes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5903 Modified Files: Tag: branch_1_0 ChangeLog Log Message: Index: ChangeLog =================================================================== RCS file: /cvsroot/ctypes/ctypes/comtypes/Attic/ChangeLog,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** ChangeLog 2 Sep 2005 20:02:09 -0000 1.1.2.1 --- ChangeLog 29 Sep 2005 13:50:06 -0000 1.1.2.2 *************** *** 1,2 **** --- 1,6 ---- + 2005-09-29 Thomas Heller <th...@py...> + + * GUID.py: Rename the GUID.progid() classmethod into GUID.as_progid(). + 2005-09-02 Thomas Heller <th...@py...> |
From: Thomas H. <th...@us...> - 2005-09-29 13:11:45
|
Update of /cvsroot/ctypes/ctypes/comtypes/unittests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28612 Modified Files: Tag: branch_1_0 test_client.py Log Message: Rename the GUID.progid() classmethod into GUID.as_progid(). Index: test_client.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/comtypes/unittests/Attic/test_client.py,v retrieving revision 1.1.2.3 retrieving revision 1.1.2.4 diff -C2 -d -r1.1.2.3 -r1.1.2.4 *** test_client.py 19 Aug 2005 19:43:55 -0000 1.1.2.3 --- test_client.py 29 Sep 2005 13:11:28 -0000 1.1.2.4 *************** *** 20,25 **** def test_clsid_string(self): # create from string clsid ! comtypes.client.CreateObject(unicode(msscript.ScriptControl._clsid_)) ! comtypes.client.CreateObject(str(msscript.ScriptControl._clsid_)) def test_remote(self): --- 20,25 ---- def test_clsid_string(self): # create from string clsid ! comtypes.client.CreateObject(unicode(msscript.ScriptControl._reg_clsid_)) ! comtypes.client.CreateObject(str(msscript.ScriptControl._reg_clsid_)) def test_remote(self): |
From: Thomas H. <th...@us...> - 2005-09-29 13:11:30
|
Update of /cvsroot/ctypes/ctypes/comtypes/tools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28593 Modified Files: Tag: branch_1_0 codegenerator.py Log Message: Rename the GUID.progid() classmethod into GUID.as_progid(). Index: codegenerator.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/comtypes/tools/codegenerator.py,v retrieving revision 1.6.2.19 retrieving revision 1.6.2.20 diff -C2 -d -r1.6.2.19 -r1.6.2.20 *** codegenerator.py 24 Aug 2005 12:35:50 -0000 1.6.2.19 --- codegenerator.py 29 Sep 2005 13:11:22 -0000 1.6.2.20 *************** *** 155,159 **** if doc: print >> self.stream, " %r" % doc ! print >> self.stream, " _clsid_ = GUID(%r)" % coclass.clsid print >> self.stream, " _idlflags_ = %s" % coclass.idlflags ##X print >> self.stream, "POINTER(%s).__ctypes_from_outparam__ = wrap" % coclass.name --- 155,159 ---- if doc: print >> self.stream, " %r" % doc ! print >> self.stream, " _reg_clsid_ = GUID(%r)" % coclass.clsid print >> self.stream, " _idlflags_ = %s" % coclass.idlflags ##X print >> self.stream, "POINTER(%s).__ctypes_from_outparam__ = wrap" % coclass.name |
From: Thomas H. <th...@us...> - 2005-09-29 13:11:28
|
Update of /cvsroot/ctypes/ctypes/comtypes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28545 Modified Files: Tag: branch_1_0 _meta.py GUID.py Log Message: Rename the GUID.progid() classmethod into GUID.as_progid(). Index: GUID.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/comtypes/GUID.py,v retrieving revision 1.6.2.4 retrieving revision 1.6.2.5 diff -C2 -d -r1.6.2.4 -r1.6.2.5 *** GUID.py 29 Sep 2005 12:43:03 -0000 1.6.2.4 --- GUID.py 29 Sep 2005 13:11:16 -0000 1.6.2.5 *************** *** 63,68 **** """Get guid from progid, ... """ ! if hasattr(progid, "_clsid_"): ! progid = progid._clsid_ if isinstance(progid, cls): return progid --- 63,68 ---- """Get guid from progid, ... """ ! if hasattr(progid, "_reg_clsid_"): ! progid = progid._reg_clsid_ if isinstance(progid, cls): return progid Index: _meta.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/comtypes/Attic/_meta.py,v retrieving revision 1.1.2.3 retrieving revision 1.1.2.4 diff -C2 -d -r1.1.2.3 -r1.1.2.4 *** _meta.py 29 Sep 2005 12:47:19 -0000 1.1.2.3 --- _meta.py 29 Sep 2005 13:11:16 -0000 1.1.2.4 *************** *** 36,42 **** if bases == (object,): return klass ! # XXX We should insist that a _clsid_ is present. ! if "_clsid_" in namespace: ! clsid = namespace["_clsid_"] comtypes.com_coclass_registry[str(clsid)] = klass PTR = _coclass_pointer_meta("POINTER(%s)" % klass.__name__, --- 36,42 ---- if bases == (object,): return klass ! # XXX We should insist that a _reg_clsid_ is present. ! if "_reg_clsid_" in namespace: ! clsid = namespace["_reg_clsid_"] comtypes.com_coclass_registry[str(clsid)] = klass PTR = _coclass_pointer_meta("POINTER(%s)" % klass.__name__, |
From: Thomas H. <th...@us...> - 2005-09-29 12:59:59
|
Update of /cvsroot/ctypes/ctypes/comtypes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25689 Modified Files: Tag: branch_1_0 __init__.py Log Message: Cosmetic changes. Index: __init__.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/comtypes/__init__.py,v retrieving revision 1.25.2.30 retrieving revision 1.25.2.31 diff -C2 -d -r1.25.2.30 -r1.25.2.31 *** __init__.py 2 Sep 2005 16:52:32 -0000 1.25.2.30 --- __init__.py 29 Sep 2005 12:59:52 -0000 1.25.2.31 *************** *** 628,632 **** except AttributeError: raise TypeError, "object is not callable" ! return self.Item(*args, **kw) # does this make sense? It seems that all standard typelibs I've --- 628,632 ---- except AttributeError: raise TypeError, "object is not callable" ! return mth(*args, **kw) # does this make sense? It seems that all standard typelibs I've *************** *** 854,867 **** inst._com_pointers_[hashcode] = pointer(pointer(vtbl)) _InterlockedIncrement = windll.kernel32.InterlockedIncrement _InterlockedDecrement = windll.kernel32.InterlockedDecrement - ################################################################ - class COMObject(object): _instances_ = {} ! def __new__(cls): ! self = super(COMObject, cls).__new__(cls) if isinstance(self, c_void_p): # We build the VTables only for direct instances of --- 854,871 ---- inst._com_pointers_[hashcode] = pointer(pointer(vtbl)) + ################################################################ + + ##import logging + ##logger = logging.getLogger("comtypes.server.object") + _InterlockedIncrement = windll.kernel32.InterlockedIncrement _InterlockedDecrement = windll.kernel32.InterlockedDecrement class COMObject(object): _instances_ = {} + _factory = None ! def __new__(cls, *args, **kw): ! self = super(COMObject, cls).__new__(cls, *args, **kw) if isinstance(self, c_void_p): # We build the VTables only for direct instances of *************** *** 875,903 **** # IUnknown methods implementations def IUnknown_AddRef(self, this): - # need _factory hooks here return _InterlockedIncrement(byref(self._refcnt)) def IUnknown_Release(self, this, _InterlockedDecrement=_InterlockedDecrement, ! byref=byref): ! # need _factory hooks here ! # If this is called at COM shutdown, byref() and # _InterlockedDecrement() must still be available, although # module level variables may have been deleted already - so we # supply them as default arguments. ! result = _InterlockedDecrement(byref(self._refcnt)) if result == 0: self._com_pointers_.clear() del self._instances_[self] return result def IUnknown_QueryInterface(self, this, riid, ppvObj): ! ptr = self._com_pointers_.get(riid[0].hashcode(), None) ! ## print "QI(%s) -> %s" % (riid[0], ptr) ! # XXX Can we switch to QueryInterface(self)? if ptr is not None: # CopyComPointer(src, dst) calls AddRef! return CopyComPointer(ptr, ppvObj) return E_NOINTERFACE --- 879,907 ---- # IUnknown methods implementations def IUnknown_AddRef(self, this): return _InterlockedIncrement(byref(self._refcnt)) def IUnknown_Release(self, this, _InterlockedDecrement=_InterlockedDecrement, ! _byref=byref): # If this is called at COM shutdown, byref() and # _InterlockedDecrement() must still be available, although # module level variables may have been deleted already - so we # supply them as default arguments. ! result = _InterlockedDecrement(_byref(self._refcnt)) if result == 0: self._com_pointers_.clear() del self._instances_[self] + if self._factory is not None: + self._factory.LockServer(None, 0) return result def IUnknown_QueryInterface(self, this, riid, ppvObj): ! iid = riid[0] ! ptr = self._com_pointers_.get(iid.hashcode(), None) if ptr is not None: # CopyComPointer(src, dst) calls AddRef! + ## logger.debug("%r.QueryInterface(%s) -> S_OK", self, iid) return CopyComPointer(ptr, ppvObj) + ## logger.debug("%r.QueryInterface(%s) -> E_NOINTERFACE", self, iid) return E_NOINTERFACE |
From: Thomas H. <th...@us...> - 2005-09-29 12:53:49
|
Update of /cvsroot/ctypes/ctypes/comtypes/unittests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24174 Modified Files: Tag: branch_1_0 test_GUID.py Log Message: Rename the GUID.progid() classmethod into GUID.as_progid(). Index: test_GUID.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/comtypes/unittests/test_GUID.py,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -C2 -d -r1.2.2.1 -r1.2.2.2 *** test_GUID.py 17 Aug 2005 16:32:07 -0000 1.2.2.1 --- test_GUID.py 29 Sep 2005 12:53:29 -0000 1.2.2.2 *************** *** 16,25 **** self.assertRaises(WindowsError, GUID.from_progid, "abc") ! self.assertRaises(WindowsError, lambda guid: guid.progid(), GUID("{00000000-0000-0000-C000-000000000046}")) self.failUnlessEqual(GUID.from_progid("InternetExplorer.Application"), GUID("{0002DF01-0000-0000-C000-000000000046}")) ! self.failUnlessEqual(GUID("{0002DF01-0000-0000-C000-000000000046}").progid(), u'InternetExplorer.Application.1') --- 16,25 ---- self.assertRaises(WindowsError, GUID.from_progid, "abc") ! self.assertRaises(WindowsError, lambda guid: guid.as_progid(), GUID("{00000000-0000-0000-C000-000000000046}")) self.failUnlessEqual(GUID.from_progid("InternetExplorer.Application"), GUID("{0002DF01-0000-0000-C000-000000000046}")) ! self.failUnlessEqual(GUID("{0002DF01-0000-0000-C000-000000000046}").as_progid(), u'InternetExplorer.Application.1') |
From: Thomas H. <th...@us...> - 2005-09-29 12:48:25
|
Update of /cvsroot/ctypes/ctypes/comtypes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22739 Modified Files: Tag: branch_1_0 automation.py Log Message: Add todo comment, fix a small bug. Index: automation.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/comtypes/automation.py,v retrieving revision 1.12.2.15 retrieving revision 1.12.2.16 diff -C2 -d -r1.12.2.15 -r1.12.2.16 *** automation.py 19 Aug 2005 18:51:26 -0000 1.12.2.15 --- automation.py 29 Sep 2005 12:48:17 -0000 1.12.2.16 *************** *** 152,155 **** --- 152,157 ---- def __del__(self): if self._b_needsfree_: + # XXX This does not work. _b_needsfree_ is never + # set because the buffer is internal to the object. _VariantClear(byref(self)) *************** *** 382,386 **** fetched = self.Next(1, byref(var)) if fetched: ! return var.value raise StopIteration --- 384,391 ---- fetched = self.Next(1, byref(var)) if fetched: ! result = var.value ! # XXX workaround for a bug in VARIANT.__del__ ! var.value = None ! return result raise StopIteration *************** *** 415,421 **** class tagEXCEPINFO(Structure): def __repr__(self): ! return "<EXCEPINFO %s %s %s %s>" % \ ! (self.bstrSource, self.bstrDescription, self.pfnDeferredFillIn, ! bool(self.pfnDeferredFillIn)) tagEXCEPINFO._fields_ = [ ('wCode', WORD), --- 420,426 ---- class tagEXCEPINFO(Structure): def __repr__(self): ! return "<EXCEPINFO %s>" % \ ! ((self.wCode, self.bstrSource, self.bstrDescription, self.bstrHelpFile, self.dwHelpContext, ! self.pfnDeferredFillIn, self.scode),) tagEXCEPINFO._fields_ = [ ('wCode', WORD), |
From: Thomas H. <th...@us...> - 2005-09-29 12:47:27
|
Update of /cvsroot/ctypes/ctypes/comtypes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22517 Modified Files: Tag: branch_1_0 _meta.py Log Message: Fix some pychecker warnings. Index: _meta.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/comtypes/Attic/_meta.py,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -C2 -d -r1.1.2.2 -r1.1.2.3 *** _meta.py 17 Aug 2005 16:29:37 -0000 1.1.2.2 --- _meta.py 29 Sep 2005 12:47:19 -0000 1.1.2.3 *************** *** 32,50 **** # will QueryInterface for the default interface: the first one on # the coclass' _com_interfaces_ list. ! def __new__(self, name, bases, namespace): ! cls = type.__new__(self, name, bases, namespace) if bases == (object,): ! return cls # XXX We should insist that a _clsid_ is present. if "_clsid_" in namespace: clsid = namespace["_clsid_"] ! comtypes.com_coclass_registry[str(clsid)] = cls ! PTR = _coclass_pointer_meta("POINTER(%s)" % cls.__name__, ! (cls, c_void_p), {"__ctypes_from_outparam__": _wrap_coclass}) from ctypes import _pointer_type_cache ! _pointer_type_cache[cls] = PTR ! return cls # will not work if we change the order of the two base classes! --- 32,50 ---- # will QueryInterface for the default interface: the first one on # the coclass' _com_interfaces_ list. ! def __new__(cls, name, bases, namespace): ! klass = type.__new__(cls, name, bases, namespace) if bases == (object,): ! return klass # XXX We should insist that a _clsid_ is present. if "_clsid_" in namespace: clsid = namespace["_clsid_"] ! comtypes.com_coclass_registry[str(clsid)] = klass ! PTR = _coclass_pointer_meta("POINTER(%s)" % klass.__name__, ! (klass, c_void_p), {"__ctypes_from_outparam__": _wrap_coclass}) from ctypes import _pointer_type_cache ! _pointer_type_cache[klass] = PTR ! return klass # will not work if we change the order of the two base classes! |