pywin32-checkins Mailing List for Python for Windows Extensions (Page 33)
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
(2) |
May
(1) |
Jun
(6) |
Jul
(50) |
Aug
(11) |
Sep
(24) |
Oct
(184) |
Nov
(118) |
Dec
(22) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(31) |
Feb
(25) |
Mar
(34) |
Apr
(105) |
May
(49) |
Jun
(38) |
Jul
(39) |
Aug
(7) |
Sep
(98) |
Oct
(79) |
Nov
(20) |
Dec
(17) |
2005 |
Jan
(66) |
Feb
(32) |
Mar
(43) |
Apr
(30) |
May
(58) |
Jun
(30) |
Jul
(16) |
Aug
(4) |
Sep
(21) |
Oct
(42) |
Nov
(11) |
Dec
(14) |
2006 |
Jan
(42) |
Feb
(30) |
Mar
(22) |
Apr
(1) |
May
(9) |
Jun
(15) |
Jul
(20) |
Aug
(9) |
Sep
(8) |
Oct
(1) |
Nov
(9) |
Dec
(43) |
2007 |
Jan
(52) |
Feb
(45) |
Mar
(20) |
Apr
(12) |
May
(59) |
Jun
(39) |
Jul
(35) |
Aug
(31) |
Sep
(17) |
Oct
(20) |
Nov
(4) |
Dec
(4) |
2008 |
Jan
(28) |
Feb
(111) |
Mar
(4) |
Apr
(27) |
May
(40) |
Jun
(27) |
Jul
(32) |
Aug
(94) |
Sep
(87) |
Oct
(153) |
Nov
(336) |
Dec
(331) |
2009 |
Jan
(298) |
Feb
(127) |
Mar
(20) |
Apr
(8) |
May
|
Jun
(10) |
Jul
(6) |
Aug
|
Sep
(2) |
Oct
(2) |
Nov
|
Dec
(1) |
2010 |
Jan
(7) |
Feb
(1) |
Mar
|
Apr
|
May
(15) |
Jun
(4) |
Jul
(3) |
Aug
(28) |
Sep
(1) |
Oct
(19) |
Nov
(16) |
Dec
(6) |
2011 |
Jan
(2) |
Feb
(18) |
Mar
(17) |
Apr
(12) |
May
(5) |
Jun
(11) |
Jul
(7) |
Aug
(2) |
Sep
(2) |
Oct
(4) |
Nov
(4) |
Dec
|
2012 |
Jan
(6) |
Feb
(2) |
Mar
|
Apr
(8) |
May
(4) |
Jun
(3) |
Jul
(13) |
Aug
(27) |
Sep
(8) |
Oct
(9) |
Nov
(3) |
Dec
(2) |
2013 |
Jan
|
Feb
(1) |
Mar
(5) |
Apr
(10) |
May
|
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
(9) |
2014 |
Jan
(2) |
Feb
(4) |
Mar
(4) |
Apr
(1) |
May
(4) |
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
(1) |
2015 |
Jan
(1) |
Feb
|
Mar
|
Apr
(6) |
May
(2) |
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
2016 |
Jan
(3) |
Feb
(2) |
Mar
|
Apr
(3) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2017 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
From: Mark H. <mha...@us...> - 2009-01-03 04:45:23
|
Update of /cvsroot/pywin32/pywin32/Pythonwin/pywin/idle In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv7676/pywin/idle Modified Files: Tag: py3k AutoIndent.py PyParse.py Log Message: merge various fixes and cleanups from bzr integration branch Index: PyParse.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/idle/PyParse.py,v retrieving revision 1.5.2.2 retrieving revision 1.5.2.3 diff -C2 -d -r1.5.2.2 -r1.5.2.3 *** PyParse.py 26 Nov 2008 07:17:38 -0000 1.5.2.2 --- PyParse.py 3 Jan 2009 04:45:17 -0000 1.5.2.3 *************** *** 103,106 **** --- 103,109 ---- for ch in "\"'\\\n#": _tran[ord(ch)] = ch + # We are called with unicode strings, and str.translate is one of the few + # py2k functions which can't 'do the right thing' - so take care to ensure + # _tran is full of unicode... _tran = ''.join(_tran) del ch Index: AutoIndent.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/idle/AutoIndent.py,v retrieving revision 1.3.2.7 retrieving revision 1.3.2.8 diff -C2 -d -r1.3.2.7 -r1.3.2.8 *** AutoIndent.py 28 Dec 2008 10:55:49 -0000 1.3.2.7 --- AutoIndent.py 3 Jan 2009 04:45:17 -0000 1.3.2.8 *************** *** 1,6 **** --- 1,17 ---- + import sys import string, tokenize from . import PyParse from pywin import default_scintilla_encoding + if sys.version_info < (3,): + # in py2k, tokenize() takes a 'token eater' callback, while + # generate_tokens is a generator that works with str objects. + token_generator = tokenize.generate_tokens + else: + # in py3k tokenize() is the generator working with 'byte' objects, and + # token_generator is the 'undocumented b/w compat' function that + # theoretically works with str objects - but actually seems to fail) + token_generator = tokenize.tokenize + class AutoIndent: *************** *** 488,491 **** --- 499,506 ---- else: val = self.text.get(mark, mark + " lineend+1c") + # hrm - not sure this is correct in py3k - the source code may have + # an encoding declared, but the data will *always* be in + # default_scintilla_encoding - so if anyone looks at the encoding decl + # in the source they will be wrong. I think. Maybe. Or something... return val.encode(default_scintilla_encoding) *************** *** 499,503 **** try: try: ! for (typ, token, start, end, line) in tokenize.generate_tokens(self.readline): if typ == NAME and token in OPENERS: self.blkopenline = line --- 514,518 ---- try: try: ! for (typ, token, start, end, line) in token_generator(self.readline): if typ == NAME and token in OPENERS: self.blkopenline = line |
From: Mark H. <mha...@us...> - 2009-01-03 04:45:23
|
Update of /cvsroot/pywin32/pywin32/Pythonwin In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv7676 Modified Files: Tag: py3k pythonpsheet.cpp win32assoc.cpp win32assoc.h win32cmdui.cpp win32template.cpp win32uimodule.cpp win32virt.cpp Log Message: merge various fixes and cleanups from bzr integration branch Index: win32assoc.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32assoc.cpp,v retrieving revision 1.9.2.4 retrieving revision 1.9.2.5 diff -C2 -d -r1.9.2.4 -r1.9.2.5 *** win32assoc.cpp 28 Dec 2008 12:53:32 -0000 1.9.2.4 --- win32assoc.cpp 3 Jan 2009 04:45:17 -0000 1.9.2.5 *************** *** 15,18 **** --- 15,24 ---- #include "stdafx.h" + #ifdef DEBUG + #define ASSERT_GIL_HELD {PyGILState_STATE s=PyGILState_Ensure();ASSERT(s==PyGILState_LOCKED);PyGILState_Release(s);} + #else + #define ASSERT_GIL_HELD + #endif + CAssocManager ui_assoc_object::handleMgr; *************** *** 48,52 **** ASSERT_VALID(&map); TRACE("CAssocManager cleaning up %d objects\n", map.GetCount()); - m_critsec.Lock(); CEnterLeavePython _celp; for(pos=map.GetStartPosition();pos;) { --- 54,57 ---- *************** *** 54,58 **** RemoveAssoc(assoc); } - m_critsec.Unlock(); } --- 59,62 ---- *************** *** 79,83 **** void CAssocManager::Assoc(void *handle, ui_assoc_object *object) { ! m_critsec.Lock(); ASSERT(handle); #ifdef DEBUG --- 83,87 ---- void CAssocManager::Assoc(void *handle, ui_assoc_object *object) { ! ASSERT_GIL_HELD; // we rely on the GIL to serialize access to our map... ASSERT(handle); #ifdef DEBUG *************** *** 104,108 **** } } - m_critsec.Unlock(); } --- 108,111 ---- *************** *** 113,118 **** { if (handle==NULL) return NULL; // no possible association for NULL! PyObject *weakref; - m_critsec.Lock(); #ifdef _DEBUG cacheLookups++; --- 116,121 ---- { if (handle==NULL) return NULL; // no possible association for NULL! + ASSERT_GIL_HELD; // we rely on the GIL to serialize access to our map... PyObject *weakref; #ifdef _DEBUG cacheLookups++; *************** *** 131,135 **** lastObjectWeakRef = weakref; } - m_critsec.Unlock(); if (weakref==NULL) return NULL; --- 134,137 ---- *************** *** 255,265 **** ui_assoc_object::~ui_assoc_object() { - KillAssoc(); - } - - // handle is invalid - therefore release all refs I am holding for it. - // ASSUMES WE HOLD THE PYTHON LOCK as for all Python object destruction. - void ui_assoc_object::KillAssoc() - { #ifdef TRACE_ASSOC CString rep = repr(); --- 257,260 ---- *************** *** 269,274 **** Py_CLEAR(virtualInst); // virtuals.DeleteAll(); ! handleMgr.Assoc(assoc, 0); ! SetAssocInvalid(); // let child do whatever to detect } --- 264,271 ---- Py_CLEAR(virtualInst); // virtuals.DeleteAll(); ! if (assoc) { ! handleMgr.Assoc(assoc, 0); ! SetAssocInvalid(); // let child do whatever to detect ! } } *************** *** 288,291 **** --- 285,289 ---- { ASSERT(search); // really only a C++ problem. + CEnterLeavePython _celp; ui_assoc_object* ret=NULL; if (!skipLookup) *************** *** 376,380 **** bManualDelete = FALSE; CObject *pO = (CObject *)GetGoodCppObject(&type); // get pointer before killing it. ! KillAssoc(); // stop recursion - disassociate now. if (!pO) PyErr_Clear(); --- 374,378 ---- bManualDelete = FALSE; CObject *pO = (CObject *)GetGoodCppObject(&type); // get pointer before killing it. ! ASSERT(!PyErr_Occurred()); // PyErr_Clear() is bogus????? if (!pO) PyErr_Clear(); Index: win32uimodule.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32uimodule.cpp,v retrieving revision 1.39.2.10 retrieving revision 1.39.2.11 diff -C2 -d -r1.39.2.10 -r1.39.2.11 *** win32uimodule.cpp 28 Dec 2008 10:55:49 -0000 1.39.2.10 --- win32uimodule.cpp 3 Jan 2009 04:45:17 -0000 1.39.2.11 *************** *** 561,579 **** void Python_delete_assoc( void *ob ) { - // Notify Python object of my attached object removal. - { - CVirtualHelper helper ("OnAttachedObjectDeath", ob); - helper.call(); - } if (bInFatalShutdown) { TRACE("Not destroying assoc - in fatal shutdown!\n"); return; } ! ui_assoc_object *pObj; ! if ((pObj=ui_assoc_object::GetAssocObject(ob))) { ! CEnterLeavePython _celp; // KillAssoc requires it is held! ! pObj->KillAssoc(); ! Py_DECREF(pObj); } } --- 561,576 ---- void Python_delete_assoc( void *ob ) { if (bInFatalShutdown) { TRACE("Not destroying assoc - in fatal shutdown!\n"); return; } ! { ! // Notify Python object of my attached object removal. ! CVirtualHelper helper ("OnAttachedObjectDeath", ob); ! helper.call(); } + // and remove the object from the map + CEnterLeavePython _celp; + ui_assoc_object::handleMgr.Assoc(ob, NULL); } Index: pythonpsheet.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pythonpsheet.cpp,v retrieving revision 1.4.2.1 retrieving revision 1.4.2.2 diff -C2 -d -r1.4.2.1 -r1.4.2.2 *** pythonpsheet.cpp 28 Dec 2008 10:55:48 -0000 1.4.2.1 --- pythonpsheet.cpp 3 Jan 2009 04:45:16 -0000 1.4.2.2 *************** *** 205,208 **** --- 205,209 ---- if (bInFatalShutdown) return; + CEnterLeavePython _celp; ui_assoc_object *py_bob = ui_assoc_object::handleMgr.GetAssocObject(this); if (py_bob==NULL) *************** *** 214,218 **** } if (py_bob->virtualInst) { - CEnterLeavePython _celp; PyObject *t, *v, *tb; PyErr_Fetch(&t,&v,&tb); --- 215,218 ---- Index: win32cmdui.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32cmdui.cpp,v retrieving revision 1.6.4.3 retrieving revision 1.6.4.4 diff -C2 -d -r1.6.4.3 -r1.6.4.4 *** win32cmdui.cpp 28 Dec 2008 10:55:49 -0000 1.6.4.3 --- win32cmdui.cpp 3 Jan 2009 04:45:17 -0000 1.6.4.4 *************** *** 67,74 **** CWnd *control = ((CWnd *)obj)->GetDlgItem(nID); PyCCmdTarget *pObj = (PyCCmdTarget *) ui_assoc_CObject::GetAssocObject(control); if (pObj && pObj->pOleEventHookList && pObj->pOleEventHookList->Lookup ((unsigned short)pEvent->m_dispid, (void *&)method)) { - CEnterLeavePython _celp; if (pfnMakeOlePythonCall==NULL) { pfnMakeOlePythonCall = (BOOL (*)(PyObject *, DISPPARAMS FAR* , VARIANT FAR* ,EXCEPINFO FAR* , UINT FAR*, PyObject * )) --- 67,74 ---- CWnd *control = ((CWnd *)obj)->GetDlgItem(nID); + CEnterLeavePython _celp; PyCCmdTarget *pObj = (PyCCmdTarget *) ui_assoc_CObject::GetAssocObject(control); if (pObj && pObj->pOleEventHookList && pObj->pOleEventHookList->Lookup ((unsigned short)pEvent->m_dispid, (void *&)method)) { if (pfnMakeOlePythonCall==NULL) { pfnMakeOlePythonCall = (BOOL (*)(PyObject *, DISPPARAMS FAR* , VARIANT FAR* ,EXCEPINFO FAR* , UINT FAR*, PyObject * )) *************** *** 95,98 **** --- 95,99 ---- #endif // !_AFX_NO_OCC_SUPPORT + CEnterLeavePython _celp; PyCCmdTarget *pObj = (PyCCmdTarget *) ui_assoc_CObject::GetAssocObject(obj); // Must exit via 'exit' from here... *************** *** 115,119 **** } { - CEnterLeavePython _celp; Python_callback (method, ob); if (PyErr_Occurred()) // if any Python exception, pretend it was OK --- 116,119 ---- *************** *** 145,149 **** if (method) { // perform the callback. - CEnterLeavePython _celp; rc = Python_callback (method, nID, nCode); // This is dodgy - we have to rely on -1 and can't check PyErr_Occurred(), --- 145,148 ---- Index: win32template.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32template.cpp,v retrieving revision 1.4.2.3 retrieving revision 1.4.2.4 diff -C2 -d -r1.4.2.3 -r1.4.2.4 *** win32template.cpp 28 Dec 2008 10:55:49 -0000 1.4.2.3 --- win32template.cpp 3 Jan 2009 04:45:17 -0000 1.4.2.4 *************** *** 43,48 **** return; // no more to do. RemoveDocTemplateFromApp(pTemp); - delete pTemp; - SetAssocInvalid(); } --- 43,46 ---- Index: win32assoc.h =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32assoc.h,v retrieving revision 1.2.4.2 retrieving revision 1.2.4.3 diff -C2 -d -r1.2.4.2 -r1.2.4.3 *** win32assoc.h 28 Dec 2008 12:53:32 -0000 1.2.4.2 --- win32assoc.h 3 Jan 2009 04:45:17 -0000 1.2.4.3 *************** *** 34,38 **** const void *lastLookup; PyObject *lastObjectWeakRef; - CCriticalSection m_critsec; #ifdef _DEBUG int cacheLookups; --- 34,37 ---- *************** *** 60,66 **** static void *GetGoodCppObject(PyObject *&self, ui_type *ui_type_check); - // Call this when the C++ object dies, or otherwise becomes invalid. - void KillAssoc(); // maps to a virtual with some protection wrapping. - // virtuals for Python support virtual CString repr(); --- 59,62 ---- *************** *** 79,87 **** void *GetGoodCppObject(ui_type *ui_type_check=NULL) const; virtual bool CheckCppObject(ui_type *ui_type_check) const {return true;} ! // Called during KillAssoc - normally zeroes association. ! // Override to keep handle after destruction (eg, the association ! // with a dialog is valid after the Window's window has closed). ! // XXX? bogus too? ! virtual void SetAssocInvalid() { assoc = 0; } ui_assoc_object(); // ctor/dtor --- 75,79 ---- void *GetGoodCppObject(ui_type *ui_type_check=NULL) const; virtual bool CheckCppObject(ui_type *ui_type_check) const {return true;} ! virtual void SetAssocInvalid() { assoc = 0; } // XXX - bogus - called during destruction??? ui_assoc_object(); // ctor/dtor Index: win32virt.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32virt.cpp,v retrieving revision 1.6.2.3 retrieving revision 1.6.2.4 diff -C2 -d -r1.6.2.3 -r1.6.2.4 *** win32virt.cpp 28 Dec 2008 10:55:49 -0000 1.6.2.3 --- win32virt.cpp 3 Jan 2009 04:45:17 -0000 1.6.2.4 *************** *** 28,35 **** if (bInFatalShutdown) return; ui_assoc_object *py_bob = ui_assoc_object::handleMgr.GetAssocObject( iassoc ); if (py_bob==NULL) return; - CEnterLeavePython _celp; if (!py_bob->is_uiobject( &ui_assoc_object::type)) { TRACE("CVirtualHelper::CVirtualHelper Error: Call object is not of required type\n"); --- 28,35 ---- if (bInFatalShutdown) return; + CEnterLeavePython _celp; ui_assoc_object *py_bob = ui_assoc_object::handleMgr.GetAssocObject( iassoc ); if (py_bob==NULL) return; if (!py_bob->is_uiobject( &ui_assoc_object::type)) { TRACE("CVirtualHelper::CVirtualHelper Error: Call object is not of required type\n"); |
From: Mark H. <mha...@us...> - 2009-01-03 04:45:22
|
Update of /cvsroot/pywin32/pywin32/Pythonwin/pywin/Demos/ocx In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv7676/pywin/Demos/ocx Modified Files: Tag: py3k webbrowser.py Log Message: merge various fixes and cleanups from bzr integration branch Index: webbrowser.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/Demos/ocx/webbrowser.py,v retrieving revision 1.1.4.1 retrieving revision 1.1.4.2 diff -C2 -d -r1.1.4.1 -r1.1.4.2 *** webbrowser.py 29 Aug 2008 06:16:06 -0000 1.1.4.1 --- webbrowser.py 3 Jan 2009 04:45:17 -0000 1.1.4.2 *************** *** 22,25 **** --- 22,27 ---- if url is None: self.url = regutil.GetRegisteredHelpFile("Main Python Documentation") + if self.url is None: + self.url = "http://www.python.org" else: self.url = url *************** *** 44,50 **** self.SetWindowText(title) ! def Demo(): ! url = None ! if len(sys.argv)>1: url = win32api.GetFullPathName(sys.argv[1]) f = BrowserFrame(url) --- 46,51 ---- self.SetWindowText(title) ! def Demo(url=None): ! if url is None and len(sys.argv)>1: url = win32api.GetFullPathName(sys.argv[1]) f = BrowserFrame(url) *************** *** 52,54 **** if __name__=='__main__': ! Demo() \ No newline at end of file --- 53,55 ---- if __name__=='__main__': ! Demo() |
From: Mark H. <mha...@us...> - 2009-01-03 04:45:22
|
Update of /cvsroot/pywin32/pywin32/Pythonwin/pywin/Demos In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv7676/pywin/Demos Modified Files: Tag: py3k guidemo.py Log Message: merge various fixes and cleanups from bzr integration branch Index: guidemo.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/Demos/guidemo.py,v retrieving revision 1.3.4.2 retrieving revision 1.3.4.3 diff -C2 -d -r1.3.4.2 -r1.3.4.3 *** guidemo.py 27 Nov 2008 11:31:03 -0000 1.3.4.2 --- guidemo.py 3 Jan 2009 04:45:17 -0000 1.3.4.3 *************** *** 19,23 **** ('OCX Control Demo', 'from ocx import ocxtest;ocxtest.demo()'), ('OCX Serial Port Demo', 'from ocx import ocxserialtest; ocxserialtest.test()'), ! ('IE4 Control Demo', 'from ocx import webbrowser; webbrowser.Demo()'), ] --- 19,23 ---- ('OCX Control Demo', 'from ocx import ocxtest;ocxtest.demo()'), ('OCX Serial Port Demo', 'from ocx import ocxserialtest; ocxserialtest.test()'), ! ('IE4 Control Demo', 'from ocx import webbrowser; webbrowser.Demo("http://www.python.org")'), ] |
From: Mark H. <mha...@us...> - 2009-01-02 00:01:25
|
Update of /cvsroot/pywin32/pywin32/win32/src/win32wnet In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv20681/win32/src/win32wnet Modified Files: win32wnet.cpp Log Message: Add win32wnet.WNetAddConnection3 Index: win32wnet.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32wnet/win32wnet.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** win32wnet.cpp 10 Dec 2008 11:13:51 -0000 1.16 --- win32wnet.cpp 2 Jan 2009 00:01:16 -0000 1.17 *************** *** 196,199 **** --- 196,246 ---- }; + // @pymethod |win32wnet|WNetAddConnection3|Creates a connection to a network resource. + // @comm Accepts keyword arguments. + // @pyseeapi WNetAddConnection3 + static PyObject *PyWNetAddConnection3 (PyObject *self, PyObject *args, PyObject *kwargs) + { + LPTSTR Username = NULL; + LPTSTR Password = NULL; + DWORD ErrorNo; // holds the returned error number, if any + DWORD flags = 0; + NETRESOURCE *pNetResource; + PyObject *obPassword=Py_None, *obUsername=Py_None, *ret=NULL; + PyObject *obhwnd, *obnr; + + static char *keywords[] = {"HwndOwner", "NetResource","Password","UserName","Flags", NULL}; + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO|OOk", keywords, + &obhwnd, // @pyparm int|hwnd||Handle to a parent window. + &obnr, // @pyparm <o PyNETRESOURCE>|NetResource||Describes the network resource for the connection. + &obPassword, // @pyparm str|Password|None|The password to use. Use None for default credentials. + &obUsername, // @pyparm str|UserName|None|The user name to connect as. Use None for default credentials. + &flags)) // @pyparm int|Flags|0|Combination win32netcon.CONNECT_* flags + return NULL; + + HWND hwnd; + if (!PyWinObject_AsHANDLE(obhwnd, (HANDLE *)hwnd)) + return NULL; + if (!PyWinObject_AsNETRESOURCE(obnr, &pNetResource, FALSE)) + return NULL; + + if (!PyWinObject_AsTCHAR(obPassword, &Password, TRUE) + || !PyWinObject_AsTCHAR(obUsername, &Username, TRUE)) + goto done; + + Py_BEGIN_ALLOW_THREADS + ErrorNo = WNetAddConnection3(hwnd, pNetResource, Password, Username, flags); + Py_END_ALLOW_THREADS + if (ErrorNo != NO_ERROR) + ReturnNetError("WNetAddConnection3", ErrorNo); + else{ + Py_INCREF(Py_None); + ret = Py_None; + } + done: + PyWinObject_FreeTCHAR(Password); + PyWinObject_FreeTCHAR(Username); + return ret; + }; + // @pymethod |win32wnet|WNetCancelConnection2|Closes network connections made by WNetAddConnection2 or 3 static *************** *** 634,637 **** --- 681,686 ---- // @pymeth WNetAddConnection2|Creates a connection to a network resource. {"WNetAddConnection2", (PyCFunction)PyWNetAddConnection2, METH_KEYWORDS|METH_VARARGS, "WNetAddConnection2(NetResource, Password, UserName, Flags)"}, + // @pymeth WNetAddConnection3|Creates a connection to a network resource. + {"WNetAddConnection3", (PyCFunction)PyWNetAddConnection3, METH_KEYWORDS|METH_VARARGS, "WNetAddConnection3(HwndParent, NetResource, Password, UserName, Flags)"}, // @pymeth WNetCancelConnection2|Closes network connections made by WNetAddConnection2 or 3 {"WNetCancelConnection2", PyWNetCancelConnection2, 1, "localname,dwflags,bforce"}, |
From: Mark H. <mha...@us...> - 2009-01-02 00:01:25
|
Update of /cvsroot/pywin32/pywin32 In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv20681 Modified Files: CHANGES.txt Log Message: Add win32wnet.WNetAddConnection3 Index: CHANGES.txt =================================================================== RCS file: /cvsroot/pywin32/pywin32/CHANGES.txt,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** CHANGES.txt 1 Jan 2009 22:43:36 -0000 1.40 --- CHANGES.txt 2 Jan 2009 00:01:16 -0000 1.41 *************** *** 9,12 **** --- 9,15 ---- ---------------- + * Added win32wnet.WNetAddConnection3 allowing a HWND to be specified for + authentication. + * isapi: * Refactored isapi.install primarily to support installing extensions into |
From: Mark H. <mha...@us...> - 2009-01-02 00:01:24
|
Update of /cvsroot/pywin32/pywin32/win32/Demos/win32wnet In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv20681/win32/Demos/win32wnet Modified Files: netresource.htm testwnet.py Log Message: Add win32wnet.WNetAddConnection3 Index: testwnet.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/Demos/win32wnet/testwnet.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** testwnet.py 10 Dec 2008 11:13:51 -0000 1.6 --- testwnet.py 2 Jan 2009 00:01:16 -0000 1.7 *************** *** 88,91 **** --- 88,95 ---- win32wnet.WNetCancelConnection2(localName, 0, 0) + # and one more time using WNetAddConnection3 + win32wnet.WNetAddConnection3(0, nr) + win32wnet.WNetCancelConnection2(localName, 0, 0) + # Only do the first share that succeeds. break Index: netresource.htm =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/Demos/win32wnet/netresource.htm,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** netresource.htm 2 Sep 1999 00:19:27 -0000 1.1 --- netresource.htm 2 Jan 2009 00:01:16 -0000 1.2 *************** *** 106,113 **** makes a connection to a network resource. The function can redirect a local device to the ! network resource. This function was written ! before the PyNETRESOURCE object was created and ! thus does not use PyNETRESOURCE in this release ! (this will be updated at a later date). The first four parameters correspond to the NETRESOURCE object that is being constructed for the Win32API --- 106,110 ---- makes a connection to a network resource. The function can redirect a local device to the ! network resource. The first four parameters correspond to the NETRESOURCE object that is being constructed for the Win32API *************** *** 121,124 **** --- 118,127 ---- WNetAddConnection3 is the only interface supported by Windows CE.</dd> + <dd>Note that this function has since been updated to optionally + accept a NETRESOURCE object making its signature almost + identical to the win32 version - see the pywin32 help for + more information. Also note that WNetAddConnection3 + is also implemented, which is similar to this function but + accepts a HWND as the first (or named) param. </dl> </dd> |
From: Mark H. <mha...@us...> - 2009-01-01 22:43:42
|
Update of /cvsroot/pywin32/pywin32 In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv18032 Modified Files: CHANGES.txt Log Message: new ISAPI changes Index: CHANGES.txt =================================================================== RCS file: /cvsroot/pywin32/pywin32/CHANGES.txt,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** CHANGES.txt 14 Dec 2008 23:19:12 -0000 1.39 --- CHANGES.txt 1 Jan 2009 22:43:36 -0000 1.40 *************** *** 9,14 **** ---------------- ! * Refactored isapi.install to expose some of the previously-encapsulated ! functionality in FindWebServer and CreateDirectory. * "Modernization" changes, instigated by py3k: --- 9,19 ---- ---------------- ! * isapi: ! * Refactored isapi.install primarily to support installing extensions into ! the root of a site (Jason R. Coombs) ! * New IIS6-only functionality HSE_REQ_EXEC_URL which avoids the need to use ! a filter in most cases, including new demos for this. ! * Other misc support functions (HSE_REQ_REPORT_UNHEALTHY, ! HSE_REQ_GET_ANONYMOUS_TOKEN, etc) * "Modernization" changes, instigated by py3k: |
From: Mark H. <mha...@us...> - 2009-01-01 22:40:08
|
Update of /cvsroot/pywin32/pywin32/isapi/samples In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv17883 Modified Files: advanced.py Log Message: Allow the query part of the URL to show variable values and demonstrate ReportUnhealthy() Index: advanced.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/isapi/samples/advanced.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** advanced.py 9 Sep 2006 03:29:30 -0000 1.2 --- advanced.py 1 Jan 2009 22:40:01 -0000 1.3 *************** *** 5,8 **** --- 5,16 ---- # .py implementation file changes.) # * Custom command-line handling - both additional options and commands. + # * Using a query string - any part of the URL after a '?' is assumed to + # be "variable names" separated by '&' - we will print the values of + # these server variables. + # * If the tail portion of the URL is "ReportUnhealthy", IIS will be + # notified we are unhealthy via a HSE_REQ_REPORT_UNHEALTHY request. + # Whether this is acted upon depends on if the IIS health-checking + # tools are installed, but you should always see the reason written + # to the Windows event log - see the IIS documentation for more. from isapi import isapicon *************** *** 107,112 **** --- 115,133 ---- raise InternalReloadException + url = ecb.GetServerVariable("URL") + if url.endswith("ReportUnhealthy"): + ecb.ReportUnhealthy("I'm a little sick") + ecb.SendResponseHeaders("200 OK", "Content-Type: text/html\r\n\r\n", 0) print >> ecb, "<HTML><BODY>" + + queries = ecb.GetServerVariable("QUERY_STRING").split("&") + if queries: + print >> ecb, "<PRE>" + for q in queries: + val = ecb.GetServerVariable(q) + print >> ecb, "%s=%r" % (q, val) + print >> ecb, "</PRE><P/>" + print >> ecb, "This module has been imported" print >> ecb, "%d times" % (reload_counter,) |
From: Mark H. <mha...@us...> - 2009-01-01 22:38:52
|
Update of /cvsroot/pywin32/pywin32/isapi/samples In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv17617 Modified Files: redirector.py Log Message: Demonstrate GetExecURLStatus Index: redirector.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/isapi/samples/redirector.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** redirector.py 30 Dec 2008 12:26:55 -0000 1.3 --- redirector.py 1 Jan 2009 22:38:46 -0000 1.4 *************** *** 21,24 **** --- 21,25 ---- import traceback import urllib + import win32api # sys.isapidllhandle will exist when we are loaded by the IIS framework. *************** *** 34,41 **** excludes = ["/iisstart.htm", "/welcome.png"] ! def io_callback(ecb, arg, cbIO, errcode): ! # called when our aynch request completes - there is nothing ! # more for us to do... ! print "IO callback", ecb, arg, cbIO, errcode ecb.DoneWithSession() --- 35,45 ---- excludes = ["/iisstart.htm", "/welcome.png"] ! # An "io completion" function, called when ecb.ExecURL completes... ! def io_callback(ecb, url, cbIO, errcode): ! # Get the status of our ExecURL ! httpstatus, substatus, win32 = ecb.GetExecURLStatus() ! print "ExecURL of %r finished with http status %d.%d, win32 status %d (%s)" % ( ! url, httpstatus, substatus, win32, win32api.FormatMessage(win32).strip()) ! # nothing more to do! ecb.DoneWithSession() *************** *** 55,59 **** if url.lower().startswith(exclude): print "excluding %s" % url ! ecb.ReqIOCompletion(io_callback) ecb.ExecURL(None, None, None, None, None, isapicon.HSE_EXEC_URL_IGNORE_CURRENT_INTERCEPTOR) return isapicon.HSE_STATUS_PENDING --- 59,63 ---- if url.lower().startswith(exclude): print "excluding %s" % url ! ecb.IOCompletion(io_callback, url) ecb.ExecURL(None, None, None, None, None, isapicon.HSE_EXEC_URL_IGNORE_CURRENT_INTERCEPTOR) return isapicon.HSE_STATUS_PENDING |
From: Mark H. <mha...@us...> - 2009-01-01 22:37:36
|
Update of /cvsroot/pywin32/pywin32/isapi/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv17518 Modified Files: PyExtensionObjects.cpp PyExtensionObjects.h Log Message: Add GetAnonymousToken, GetExecURLStatus and ReportUnhealthy, and rename the new ReqIOCompletion to IOCompletion. Index: PyExtensionObjects.h =================================================================== RCS file: /cvsroot/pywin32/pywin32/isapi/src/PyExtensionObjects.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** PyExtensionObjects.h 30 Dec 2008 12:20:20 -0000 1.7 --- PyExtensionObjects.h 1 Jan 2009 22:37:29 -0000 1.8 *************** *** 102,105 **** --- 102,106 ---- static PyObject * DoneWithSession(PyObject *self, PyObject * args); //HSE_REQ_DONE_WITH_SESSION static PyObject * GetImpersonationToken(PyObject *self, PyObject * args); // HSE_REQ_GET_IMPERSONATION_TOKEN + static PyObject * GetAnonymousToken(PyObject *self, PyObject * args); // HSE_REQ_GET_ANONYMOUS_TOKEN static PyObject * TransmitFile(PyObject *self, PyObject * args); // HSE_REQ_TRANSMIT_FILE static PyObject * MapURLToPath(PyObject *self, PyObject * args); // HSE_REQ_MAP_URL_TO_PATH *************** *** 107,111 **** static PyObject * SetFlushFlag(PyObject *self, PyObject * args); // HSE_REQ_SET_FLUSH_FLAG static PyObject * ExecURL(PyObject *self, PyObject * args); // HSE_REQ_EXEC_URL ! static PyObject * ReqIOCompletion(PyObject *self, PyObject * args); // HSE_REQ_IO_COMPLETION static PyObject * IsSessionActive(PyObject *self, PyObject * args); --- 108,114 ---- static PyObject * SetFlushFlag(PyObject *self, PyObject * args); // HSE_REQ_SET_FLUSH_FLAG static PyObject * ExecURL(PyObject *self, PyObject * args); // HSE_REQ_EXEC_URL ! static PyObject * GetExecURLStatus(PyObject *self, PyObject * args); // HSE_REQ_GET_EXEC_URL_STATUS ! static PyObject * IOCompletion(PyObject *self, PyObject * args); // HSE_REQ_IO_COMPLETION ! static PyObject * ReportUnhealthy(PyObject *self, PyObject * args); // HSE_REQ_REPORT_UNHEALTHY static PyObject * IsSessionActive(PyObject *self, PyObject * args); Index: PyExtensionObjects.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/isapi/src/PyExtensionObjects.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** PyExtensionObjects.cpp 30 Dec 2008 12:20:20 -0000 1.11 --- PyExtensionObjects.cpp 1 Jan 2009 22:37:29 -0000 1.12 *************** *** 253,260 **** {"Redirect", PyECB::Redirect,1}, // @pymeth Redirect| {"IsKeepAlive", PyECB::IsKeepAlive,1}, // @pymeth IsKeepAlive| {"GetImpersonationToken", PyECB::GetImpersonationToken, 1}, // @pymeth GetImpersonationToken| {"IsKeepConn", PyECB::IsKeepConn, 1}, // @pymeth IsKeepConn|Calls ServerSupportFunction with HSE_REQ_IS_KEEP_CONN {"ExecURL", PyECB::ExecURL, 1}, // @pymeth ExecURL|Calls ServerSupportFunction with HSE_REQ_EXEC_URL ! {"ReqIOCompletion", PyECB::ReqIOCompletion, 1}, // @pymeth ReqIOCompletion|Calls ServerSupportFunction with HSE_REQ_IO_COMPLETION {NULL} }; --- 253,263 ---- {"Redirect", PyECB::Redirect,1}, // @pymeth Redirect| {"IsKeepAlive", PyECB::IsKeepAlive,1}, // @pymeth IsKeepAlive| + {"GetAnonymousToken", PyECB::GetAnonymousToken, 1}, // @pymeth GetAnonymousToken|Calls ServerSupportFunction with HSE_REQ_GET_ANONYMOUS_TOKEN or HSE_REQ_GET_UNICODE_ANONYMOUS_TOKEN {"GetImpersonationToken", PyECB::GetImpersonationToken, 1}, // @pymeth GetImpersonationToken| {"IsKeepConn", PyECB::IsKeepConn, 1}, // @pymeth IsKeepConn|Calls ServerSupportFunction with HSE_REQ_IS_KEEP_CONN {"ExecURL", PyECB::ExecURL, 1}, // @pymeth ExecURL|Calls ServerSupportFunction with HSE_REQ_EXEC_URL ! {"GetExecURLStatus", PyECB::GetExecURLStatus, 1}, // @pymeth GetExecURLStatus|Calls ServerSupportFunction with HSE_REQ_GET_EXEC_URL_STATUS ! {"IOCompletion", PyECB::IOCompletion, 1}, // @pymeth IOCompletion|Calls ServerSupportFunction with HSE_REQ_IO_COMPLETION ! {"ReportUnhealthy", PyECB::ReportUnhealthy, 1}, // @pymeth ReportUnhealthy|Calls ServerSupportFunction with HSE_REQ_REPORT_UNHEALTHY {NULL} }; *************** *** 657,660 **** --- 660,695 ---- } + // @pymethod int|EXTENSION_CONTROL_BLOCK|GetAnonymousToken|Calls ServerSupportFunction with HSE_REQ_GET_ANONYMOUS_TOKEN or HSE_REQ_GET_UNICODE_ANONYMOUS_TOKEN + PyObject * PyECB::GetAnonymousToken(PyObject *self, PyObject *args) + { + PyECB * pecb = (PyECB *) self; + if (!pecb || !pecb->Check()) return NULL; + EXTENSION_CONTROL_BLOCK *ecb = pecb->m_pcb->GetECB(); + + PyObject *obStr; + // @pyparm string/unicode|metabase_path|| + if (!PyArg_ParseTuple(args, "O:GetImpersonationToken", &obStr)) + return NULL; + HANDLE handle; + BOOL bRes; + if (PyString_Check(obStr)) { + Py_BEGIN_ALLOW_THREADS + bRes = ecb->ServerSupportFunction(ecb->ConnID, HSE_REQ_GET_ANONYMOUS_TOKEN, + PyString_AS_STRING(obStr), + (DWORD *)&handle,NULL); + Py_END_ALLOW_THREADS + } else if (PyUnicode_Check(obStr)) { + Py_BEGIN_ALLOW_THREADS + bRes = ecb->ServerSupportFunction(ecb->ConnID, HSE_REQ_GET_UNICODE_ANONYMOUS_TOKEN, + PyUnicode_AS_UNICODE(obStr), + (DWORD *)&handle,NULL); + Py_END_ALLOW_THREADS + } else + return PyErr_Format(PyExc_TypeError, "must pass a string or unicode object (got %s)", obStr->ob_type->tp_name); + if (!bRes) + return SetPyECBError("ServerSupportFunction(HSE_REQ_GET_IMPERSONATION_TOKEN)"); + return PyLong_FromVoidPtr(handle); + } + // @pymethod int|EXTENSION_CONTROL_BLOCK|IsKeepConn|Calls ServerSupportFunction with HSE_REQ_IS_KEEP_CONN PyObject * PyECB::IsKeepConn(PyObject *self, PyObject *args) *************** *** 707,711 **** } ! // @pymethod int|EXTENSION_CONTROL_BLOCK|ReqIOCompletion|Set a callback that will be used for handling asynchronous I/O operations. // @comm If you call this multiple times, the previous callback will be discarded. // @comm A reference to the callback and args are held until <om --- 742,767 ---- } ! // @pymethod int|EXTENSION_CONTROL_BLOCK|GetExecURLStatus|Calls ServerSupportFunction with HSE_REQ_GET_EXEC_URL_STATUS ! PyObject * PyECB::GetExecURLStatus(PyObject *self, PyObject *args) ! { ! if (!PyArg_ParseTuple(args, ":GetExecURLStatus")) ! return NULL; ! ! PyECB * pecb = (PyECB *) self; ! EXTENSION_CONTROL_BLOCK *ecb = pecb->m_pcb->GetECB(); ! if (!pecb || !pecb->Check()) return NULL; ! BOOL bRes; ! HSE_EXEC_URL_STATUS status; ! Py_BEGIN_ALLOW_THREADS ! bRes = ecb->ServerSupportFunction(ecb->ConnID, HSE_REQ_GET_EXEC_URL_STATUS, &status, NULL,NULL); ! Py_END_ALLOW_THREADS ! if (!bRes) ! return SetPyECBError("ServerSupportFunction(HSE_REQ_GET_EXEC_URL_STATUS)"); ! // @rdesc The result of a tuple of 3 integers - (uHttpStatusCode, uHttpSubStatus, dwWin32Error) ! // @seeapi HSE_EXEC_URL_STATUS ! return Py_BuildValue("HHk", status.uHttpStatusCode, status.uHttpSubStatus, status.dwWin32Error); ! } ! ! // @pymethod int|EXTENSION_CONTROL_BLOCK|IOCompletion|Set a callback that will be used for handling asynchronous I/O operations. // @comm If you call this multiple times, the previous callback will be discarded. // @comm A reference to the callback and args are held until <om *************** *** 713,717 **** // function fails, DoneWithSession(HSE_STATUS_ERROR) will automatically be // called and no further callbacks for the ECB will be made. ! PyObject * PyECB::ReqIOCompletion(PyObject *self, PyObject *args) { PyECB * pecb = (PyECB *) self; --- 769,773 ---- // function fails, DoneWithSession(HSE_STATUS_ERROR) will automatically be // called and no further callbacks for the ECB will be made. ! PyObject * PyECB::IOCompletion(PyObject *self, PyObject *args) { PyECB * pecb = (PyECB *) self; *************** *** 721,725 **** PyObject *obCallback; PyObject *obArg = NULL; ! if (!PyArg_ParseTuple(args, "O|O:ReqIOCompletion", &obCallback, // @pyparm callable|func||The function to call. &obArg)) --- 777,781 ---- PyObject *obCallback; PyObject *obArg = NULL; ! if (!PyArg_ParseTuple(args, "O|O:IOCompletion", &obCallback, // @pyparm callable|func||The function to call. &obArg)) *************** *** 742,745 **** --- 798,821 ---- } + // @pymethod int|EXTENSION_CONTROL_BLOCK|ReportUnhealthy|Calls ServerSupportFunction with HSE_REQ_REPORT_UNHEALTHY + PyObject * PyECB::ReportUnhealthy(PyObject *self, PyObject *args) + { + char *reason = NULL; + if (!PyArg_ParseTuple(args, "|z:ReportUnhealthy", + &reason)) // @pyparm string|reason|None|An optional reason to be written to the log. + return NULL; + + PyECB * pecb = (PyECB *) self; + EXTENSION_CONTROL_BLOCK *ecb = pecb->m_pcb->GetECB(); + if (!pecb || !pecb->Check()) return NULL; + BOOL bRes; + Py_BEGIN_ALLOW_THREADS + bRes = ecb->ServerSupportFunction(ecb->ConnID, HSE_REQ_REPORT_UNHEALTHY, reason, NULL,NULL); + Py_END_ALLOW_THREADS + if (!bRes) + return SetPyECBError("ServerSupportFunction(HSE_REQ_REPORT_UNHEALTHY)"); + Py_RETURN_NONE; + } + class PyTFD { public: |
From: Mark H. <mha...@us...> - 2008-12-30 12:33:15
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv25832 Modified Files: win32trace.cpp Log Message: Hopefully fix win32trace global/local detection on vista Index: win32trace.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32trace.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** win32trace.cpp 8 Dec 2008 13:16:38 -0000 1.18 --- win32trace.cpp 30 Dec 2008 12:33:10 -0000 1.19 *************** *** 651,658 **** // no local one exists - see if we can create it globally - if // we can, we go global, else we stick with local. HANDLE h2 = CreateFileMapping((HANDLE)-1, &sa, PAGE_READWRITE, 0, BUFFER_SIZE, FixupObjectName(MAP_OBJECT_NAME)); ! use_global_namespace = h2 != NULL && GetLastError() == ERROR_ACCESS_DENIED; if (h2) CloseHandle(h2); --- 651,659 ---- // no local one exists - see if we can create it globally - if // we can, we go global, else we stick with local. + use_global_namespace = TRUE; HANDLE h2 = CreateFileMapping((HANDLE)-1, &sa, PAGE_READWRITE, 0, BUFFER_SIZE, FixupObjectName(MAP_OBJECT_NAME)); ! use_global_namespace = h2 != NULL; if (h2) CloseHandle(h2); |
From: Mark H. <mha...@us...> - 2008-12-30 12:27:01
|
Update of /cvsroot/pywin32/pywin32/isapi/samples In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv25481 Modified Files: redirector.py Added Files: redirector_asynch.py redirector_with_filter.py Log Message: restructure samples and demonstrate both "execurl" and io completion callbacks. Index: redirector.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/isapi/samples/redirector.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** redirector.py 12 Oct 2006 01:48:44 -0000 1.2 --- redirector.py 30 Dec 2008 12:26:55 -0000 1.3 *************** *** 1,4 **** ! # This is a sample configuration file for an ISAPI filter and extension ! # written in Python. # # Please see README.txt in this directory, and specifically the --- 1,3 ---- ! # This is a sample ISAPI extension written in Python. # # Please see README.txt in this directory, and specifically the *************** *** 10,33 **** # this module and create your Extension and Filter objects. ! # This sample provides a very simple redirector. ! # It is implemented by a filter and an extension. ! # * The filter is installed globally, as all filters are. ! # * A Virtual Directory named "python" is setup. This dir has our ISAPI ! # extension as the only application, mapped to file-extension '*'. Thus, our ! # extension handles *all* requests in this directory. ! # The basic process is that the filter does URL rewriting, redirecting every ! # URL to our Virtual Directory. Our extension then handles this request, ! # forwarding the data from the proxied site. ! # So, the process is: ! # * URL of "index.html" comes in. ! # * Filter rewrites this to "/python/index.html" ! # * Our extension sees the full "/python/index.html", removes the leading ! # portion, and opens and forwards the remote URL. ! ! # This sample is very small - it avoid most error handling, etc. It is for ! # demonstration purposes only. from isapi import isapicon, threaded_extension - from isapi.simple import SimpleFilter import sys import traceback --- 9,21 ---- # this module and create your Extension and Filter objects. ! # This is the simplest possible redirector (or proxy) we can write. The ! # extension installs with a mask of '*' in the root of the site. ! # As an added bonus though, we optionally show how, on IIS6 and later, we ! # can use HSE_ERQ_EXEC_URL to ignore certain requests - in IIS5 and earlier ! # we can only do this with an ISAPI filter - see redirector_with_filter for ! # an example. If this sample is run on IIS5 or earlier it simply ignores ! # any excludes. from isapi import isapicon, threaded_extension import sys import traceback *************** *** 41,49 **** # The site we are proxying. proxy = "http://www.python.org" - # The name of the virtual directory we install in, and redirect from. - virtualdir = "/python" ! # The ISAPI extension - handles requests in our virtual dir, and sends the ! # response to the client. class Extension(threaded_extension.ThreadPoolExtension): "Python sample Extension" --- 29,44 ---- # The site we are proxying. proxy = "http://www.python.org" ! # Urls we exclude (ie, allow IIS to handle itself) - all are lowered, ! # and these entries exist by default on Vista... ! excludes = ["/iisstart.htm", "/welcome.png"] ! ! def io_callback(ecb, arg, cbIO, errcode): ! # called when our aynch request completes - there is nothing ! # more for us to do... ! print "IO callback", ecb, arg, cbIO, errcode ! ecb.DoneWithSession() ! ! # The ISAPI extension - handles all requests in the site. class Extension(threaded_extension.ThreadPoolExtension): "Python sample Extension" *************** *** 54,122 **** #print 'IIS dispatching "%s"' % (ecb.GetServerVariable("URL"),) url = ecb.GetServerVariable("URL") ! if url.startswith(virtualdir): ! new_url = proxy + url[len(virtualdir):] ! print "Opening", new_url ! fp = urllib.urlopen(new_url) ! headers = fp.info() ! ecb.SendResponseHeaders("200 OK", str(headers) + "\r\n", False) ! ecb.WriteClient(fp.read()) ! ecb.DoneWithSession() ! print "Returned data from '%s'!" % (new_url,) else: ! # this should never happen - we should only see requests that ! # start with our virtual directory name. ! print "Not proxying '%s'" % (url,) ! ! ! # The ISAPI filter. ! class Filter(SimpleFilter): ! "Sample Python Redirector" ! filter_flags = isapicon.SF_NOTIFY_PREPROC_HEADERS | \ ! isapicon.SF_NOTIFY_ORDER_DEFAULT ! ! def HttpFilterProc(self, fc): ! #print "Filter Dispatch" ! nt = fc.NotificationType ! if nt != isapicon.SF_NOTIFY_PREPROC_HEADERS: ! return isapicon.SF_STATUS_REQ_NEXT_NOTIFICATION ! pp = fc.GetData() ! url = pp.GetHeader("url") ! #print "URL is '%s'" % (url,) ! prefix = virtualdir ! if not url.startswith(prefix): ! new_url = prefix + url ! print "New proxied URL is '%s'" % (new_url,) ! pp.SetHeader("url", new_url) ! # For the sake of demonstration, show how the FilterContext ! # attribute is used. It always starts out life as None, and ! # any assignments made are automatically decref'd by the ! # framework during a SF_NOTIFY_END_OF_NET_SESSION notification. ! if fc.FilterContext is None: ! fc.FilterContext = 0 ! fc.FilterContext += 1 ! print "This is request number", fc.FilterContext, "on this connection" ! return isapicon.SF_STATUS_REQ_HANDLED_NOTIFICATION ! else: ! print "Filter ignoring URL '%s'" % (url,) ! ! # Some older code that handled SF_NOTIFY_URL_MAP. ! #~ print "Have URL_MAP notify" ! #~ urlmap = fc.GetData() ! #~ print "URI is", urlmap.URL ! #~ print "Path is", urlmap.PhysicalPath ! #~ if urlmap.URL.startswith("/UC/"): ! #~ # Find the /UC/ in the physical path, and nuke it (except ! #~ # as the path is physical, it is \) ! #~ p = urlmap.PhysicalPath ! #~ pos = p.index("\\UC\\") ! #~ p = p[:pos] + p[pos+3:] ! #~ p = r"E:\src\pyisapi\webroot\PyTest\formTest.htm" ! #~ print "New path is", p ! #~ urlmap.PhysicalPath = p # The entry points for the ISAPI extension. - def __FilterFactory__(): - return Filter() def __ExtensionFactory__(): return Extension() --- 49,73 ---- #print 'IIS dispatching "%s"' % (ecb.GetServerVariable("URL"),) url = ecb.GetServerVariable("URL") ! if ecb.Version < 0x60000: ! print "IIS5 or earlier - can't do 'excludes'" else: ! for exclude in excludes: ! if url.lower().startswith(exclude): ! print "excluding %s" % url ! ecb.ReqIOCompletion(io_callback) ! ecb.ExecURL(None, None, None, None, None, isapicon.HSE_EXEC_URL_IGNORE_CURRENT_INTERCEPTOR) ! return isapicon.HSE_STATUS_PENDING ! new_url = proxy + url ! print "Opening %s" % new_url ! fp = urllib.urlopen(new_url) ! headers = fp.info() ! ecb.SendResponseHeaders("200 OK", str(headers) + "\r\n", False) ! ecb.WriteClient(fp.read()) ! ecb.DoneWithSession() ! print "Returned data from '%s'!" % (new_url,) ! return isapicon.HSE_STATUS_SUCCESS # The entry points for the ISAPI extension. def __ExtensionFactory__(): return Extension() *************** *** 126,134 **** from isapi.install import * params = ISAPIParameters() - # Setup all filters - these are global to the site. - params.Filters = [ - FilterParameters(Name="PythonRedirector", - Description=Filter.__doc__), - ] # Setup the virtual directories - this is a list of directories our # extension uses - in this case only 1. --- 77,80 ---- *************** *** 138,142 **** ScriptMapParams(Extension="*", Flags=0) ] ! vd = VirtualDirParameters(Name=virtualdir[1:], Description = Extension.__doc__, ScriptMaps = sm, --- 84,88 ---- ScriptMapParams(Extension="*", Flags=0) ] ! vd = VirtualDirParameters(Name="/", Description = Extension.__doc__, ScriptMaps = sm, --- NEW FILE: redirector_asynch.py --- # This is a sample ISAPI extension written in Python. # This is like the other 'redirector' samples, but uses asnch IO when writing # back to the client (it does *not* use asynch io talking to the remote # server!) from isapi import isapicon, threaded_extension import sys import traceback import urllib # sys.isapidllhandle will exist when we are loaded by the IIS framework. # In this case we redirect our output to the win32traceutil collector. if hasattr(sys, "isapidllhandle"): import win32traceutil # The site we are proxying. proxy = "http://www.python.org" # We synchronously read chunks of this size then asynchronously write them. CHUNK_SIZE=8192 # The callback made when IIS completes the asynch write. def io_callback(ecb, fp, cbIO, errcode): print "IO callback", ecb, fp, cbIO, errcode chunk = fp.read(CHUNK_SIZE) if chunk: ecb.WriteClient(chunk, isapicon.HSE_IO_ASYNC) # and wait for the next callback to say this chunk is done. else: # eof - say we are complete. fp.close() ecb.DoneWithSession() # The ISAPI extension - handles all requests in the site. class Extension(threaded_extension.ThreadPoolExtension): "Python sample proxy server - asynch version." def Dispatch(self, ecb): print 'IIS dispatching "%s"' % (ecb.GetServerVariable("URL"),) url = ecb.GetServerVariable("URL") new_url = proxy + url print "Opening %s" % new_url fp = urllib.urlopen(new_url) headers = fp.info() ecb.SendResponseHeaders("200 OK", str(headers) + "\r\n", False) # now send the first chunk asynchronously ecb.ReqIOCompletion(io_callback, fp) chunk = fp.read(CHUNK_SIZE) if chunk: ecb.WriteClient(chunk, isapicon.HSE_IO_ASYNC) return isapicon.HSE_STATUS_PENDING # no data - just close things now. ecb.DoneWithSession() return isapicon.HSE_STATUS_SUCCESS # The entry points for the ISAPI extension. def __ExtensionFactory__(): return Extension() if __name__=='__main__': # If run from the command-line, install ourselves. from isapi.install import * params = ISAPIParameters() # Setup the virtual directories - this is a list of directories our # extension uses - in this case only 1. # Each extension has a "script map" - this is the mapping of ISAPI # extensions. sm = [ ScriptMapParams(Extension="*", Flags=0) ] vd = VirtualDirParameters(Name="/", Description = Extension.__doc__, ScriptMaps = sm, ScriptMapUpdate = "replace" ) params.VirtualDirs = [vd] HandleCommandLine(params) --- NEW FILE: redirector_with_filter.py --- # This is a sample configuration file for an ISAPI filter and extension # written in Python. # # Please see README.txt in this directory, and specifically the # information about the "loader" DLL - installing this sample will create # "_redirector_with_filter.dll" in the current directory. The readme explains # this. # Executing this script (or any server config script) will install the extension # into your web server. As the server executes, the PyISAPI framework will load # this module and create your Extension and Filter objects. # This sample provides sample redirector: # It is implemented by a filter and an extension, so that some requests can # be ignored. Compare with 'redirector_simple' which avoids the filter, but # is unable to selectively ignore certain requests. # The process is sample uses is: # * The filter is installed globally, as all filters are. # * A Virtual Directory named "python" is setup. This dir has our ISAPI # extension as the only application, mapped to file-extension '*'. Thus, our # extension handles *all* requests in this directory. # The basic process is that the filter does URL rewriting, redirecting every # URL to our Virtual Directory. Our extension then handles this request, # forwarding the data from the proxied site. # For example: # * URL of "index.html" comes in. # * Filter rewrites this to "/python/index.html" # * Our extension sees the full "/python/index.html", removes the leading # portion, and opens and forwards the remote URL. # This sample is very small - it avoid most error handling, etc. It is for # demonstration purposes only. from isapi import isapicon, threaded_extension from isapi.simple import SimpleFilter import sys import traceback import urllib # sys.isapidllhandle will exist when we are loaded by the IIS framework. # In this case we redirect our output to the win32traceutil collector. if hasattr(sys, "isapidllhandle"): import win32traceutil # The site we are proxying. proxy = "http://www.python.org" # The name of the virtual directory we install in, and redirect from. virtualdir = "/python" # The key feature of this redirector over the simple redirector is that it # can choose to ignore certain responses by having the filter not rewrite them # to our virtual dir. For this sample, we just exclude the IIS help directory. # The ISAPI extension - handles requests in our virtual dir, and sends the # response to the client. class Extension(threaded_extension.ThreadPoolExtension): "Python sample Extension" def Dispatch(self, ecb): # Note that our ThreadPoolExtension base class will catch exceptions # in our Dispatch method, and write the traceback to the client. # That is perfect for this sample, so we don't catch our own. #print 'IIS dispatching "%s"' % (ecb.GetServerVariable("URL"),) url = ecb.GetServerVariable("URL") if url.startswith(virtualdir): new_url = proxy + url[len(virtualdir):] print "Opening", new_url fp = urllib.urlopen(new_url) headers = fp.info() ecb.SendResponseHeaders("200 OK", str(headers) + "\r\n", False) ecb.WriteClient(fp.read()) ecb.DoneWithSession() print "Returned data from '%s'!" % (new_url,) else: # this should never happen - we should only see requests that # start with our virtual directory name. print "Not proxying '%s'" % (url,) # The ISAPI filter. class Filter(SimpleFilter): "Sample Python Redirector" filter_flags = isapicon.SF_NOTIFY_PREPROC_HEADERS | \ isapicon.SF_NOTIFY_ORDER_DEFAULT def HttpFilterProc(self, fc): #print "Filter Dispatch" nt = fc.NotificationType if nt != isapicon.SF_NOTIFY_PREPROC_HEADERS: return isapicon.SF_STATUS_REQ_NEXT_NOTIFICATION pp = fc.GetData() url = pp.GetHeader("url") #print "URL is '%s'" % (url,) prefix = virtualdir if not url.startswith(exclude) and not url.startswith(prefix): new_url = prefix + url print "New proxied URL is '%s'" % (new_url,) pp.SetHeader("url", new_url) # For the sake of demonstration, show how the FilterContext # attribute is used. It always starts out life as None, and # any assignments made are automatically decref'd by the # framework during a SF_NOTIFY_END_OF_NET_SESSION notification. if fc.FilterContext is None: fc.FilterContext = 0 fc.FilterContext += 1 print "This is request number %d on this connection" % fc.FilterContext return isapicon.SF_STATUS_REQ_HANDLED_NOTIFICATION else: print "Filter ignoring URL '%s'" % (url,) # Some older code that handled SF_NOTIFY_URL_MAP. #~ print "Have URL_MAP notify" #~ urlmap = fc.GetData() #~ print "URI is", urlmap.URL #~ print "Path is", urlmap.PhysicalPath #~ if urlmap.URL.startswith("/UC/"): #~ # Find the /UC/ in the physical path, and nuke it (except #~ # as the path is physical, it is \) #~ p = urlmap.PhysicalPath #~ pos = p.index("\\UC\\") #~ p = p[:pos] + p[pos+3:] #~ p = r"E:\src\pyisapi\webroot\PyTest\formTest.htm" #~ print "New path is", p #~ urlmap.PhysicalPath = p # The entry points for the ISAPI extension. def __FilterFactory__(): return Filter() def __ExtensionFactory__(): return Extension() if __name__=='__main__': # If run from the command-line, install ourselves. from isapi.install import * params = ISAPIParameters() # Setup all filters - these are global to the site. params.Filters = [ FilterParameters(Name="PythonRedirector", Description=Filter.__doc__), ] # Setup the virtual directories - this is a list of directories our # extension uses - in this case only 1. # Each extension has a "script map" - this is the mapping of ISAPI # extensions. sm = [ ScriptMapParams(Extension="*", Flags=0) ] vd = VirtualDirParameters(Name=virtualdir[1:], Description = Extension.__doc__, ScriptMaps = sm, ScriptMapUpdate = "replace" ) params.VirtualDirs = [vd] HandleCommandLine(params) |
From: Mark H. <mha...@us...> - 2008-12-30 12:20:25
|
Update of /cvsroot/pywin32/pywin32/isapi/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv25245 Modified Files: PyExtensionObjects.cpp PyExtensionObjects.h Log Message: add support for io completion callbacks and fix HSE_EXEC_URL_INFO support Index: PyExtensionObjects.h =================================================================== RCS file: /cvsroot/pywin32/pywin32/isapi/src/PyExtensionObjects.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** PyExtensionObjects.h 29 Sep 2008 13:00:37 -0000 1.6 --- PyExtensionObjects.h 30 Dec 2008 12:20:20 -0000 1.7 *************** *** 28,32 **** --- 28,37 ---- #include "ControlBlock.h" + #ifdef WRITE_RESTRICTED + #undef WRITE_RESTRICTED + #endif #include "structmember.h" + // avoid anyone accidently using the wrong WRITE_RESTRICTED... + #undef WRITE_RESTRICTED #include "tupleobject.h" *************** *** 101,105 **** static PyObject * IsKeepConn(PyObject *self, PyObject * args); // HSE_REQ_IS_KEEP_CONN static PyObject * SetFlushFlag(PyObject *self, PyObject * args); // HSE_REQ_SET_FLUSH_FLAG ! static PyObject * ExecURLInfo(PyObject *self, PyObject * args); // HSE_REQ_EXEC_URL static PyObject * IsSessionActive(PyObject *self, PyObject * args); --- 106,111 ---- static PyObject * IsKeepConn(PyObject *self, PyObject * args); // HSE_REQ_IS_KEEP_CONN static PyObject * SetFlushFlag(PyObject *self, PyObject * args); // HSE_REQ_SET_FLUSH_FLAG ! static PyObject * ExecURL(PyObject *self, PyObject * args); // HSE_REQ_EXEC_URL ! static PyObject * ReqIOCompletion(PyObject *self, PyObject * args); // HSE_REQ_IO_COMPLETION static PyObject * IsSessionActive(PyObject *self, PyObject * args); Index: PyExtensionObjects.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/isapi/src/PyExtensionObjects.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** PyExtensionObjects.cpp 29 Sep 2008 13:00:37 -0000 1.10 --- PyExtensionObjects.cpp 30 Dec 2008 12:20:20 -0000 1.11 *************** *** 29,32 **** --- 29,128 ---- #include "PythonEng.h" + // Asynch IO callbacks are a little tricky, as we never know how many + // callbacks a single connection might make (often each callback will trigger + // another IO request.) So we keep the Python objects used by the callback + // mechanism in a map, keyed by connection ID, of asynch callback handlers. + // Each element is a tuple of (callback, user_args). This is done rather than + // using the 'pContext' param of the callback to ensure lifetimes of the + // callback and the 'user arg' are maintained correctly. The item is removed + // as the HSE_REQ_DONE_WITH_SESSION callback is made, or of the callback + // raises an exception. + static PyObject *g_callbackMap = NULL; + + BOOL SetupIOCallback(EXTENSION_CONTROL_BLOCK *ecb, PyObject *ob) + { + if (!g_callbackMap) { + if (!(g_callbackMap = PyDict_New())) + return FALSE; + } + PyObject *key = PyLong_FromVoidPtr(ecb->ConnID); + if (!key) + return FALSE; + if (0!=PyDict_SetItem(g_callbackMap, key, ob)) { + Py_DECREF(key); + return FALSE; + } + Py_DECREF(key); + return TRUE; + } + + void CleanupIOCallback(EXTENSION_CONTROL_BLOCK *ecb) + { + if (!g_callbackMap) + return; + PyObject *key = PyLong_FromVoidPtr(ecb->ConnID); + if (!key) + return; // ack - not much more we can do. + if (!PyDict_DelItem(g_callbackMap, key)) + PyErr_Clear(); + Py_DECREF(key); + return; + } + + #define CALLBACK_ERROR(msg) {ExtensionError(NULL, msg);goto done;} + + extern "C" void WINAPI DoIOCallback(EXTENSION_CONTROL_BLOCK *ecb, PVOID pContext, DWORD cbIO, DWORD dwError) + { + CEnterLeavePython _celp; + CControlBlock * pcb = NULL; + PyECB *pyECB = NULL; + BOOL worked = FALSE; + if (!g_callbackMap) + CALLBACK_ERROR("Callback when no callback map exists"); + + PyObject *key = PyLong_FromVoidPtr(ecb->ConnID); + if (!key) + CALLBACK_ERROR("Failed to create map key from connection ID"); + PyObject *ob = PyDict_GetItem(g_callbackMap, key); + if (!ob) + CALLBACK_ERROR("Failed to locate map entry for this commID"); + // get the Python ECB object... + pcb = new CControlBlock(ecb); + pyECB = new PyECB(pcb); + if (!pyECB || !pcb) + CALLBACK_ERROR("Failed to create Python oject for ECB"); + + // this should be impossible... + if (!PyTuple_Check(ob) || (PyTuple_Size(ob)!=1 && PyTuple_Size(ob)!=2)) + CALLBACK_ERROR("Object in callback map not a tuple of correct size?"); + + PyObject *callback = PyTuple_GET_ITEM(ob, 0); + PyObject *user_arg = PyTuple_Size(ob)==2 ? PyTuple_GET_ITEM(ob, 1) : Py_None; + PyObject *args = Py_BuildValue("(OOkk)", pyECB, user_arg, cbIO, dwError); + if (!args) + CALLBACK_ERROR("Failed to build callback args"); + PyObject *result = PyObject_Call(callback, args, NULL); + Py_DECREF(args); + if (!result) + CALLBACK_ERROR("Callback failed"); + Py_DECREF(result); + worked = TRUE; + done: + // If the callback failed, then its likely this request will end + // up hanging. So on error we nuke ourselves from the map then + // call DoneWithSession. We still hold the GIL, so we should be + // safe from races... + Py_XDECREF(pyECB); + if (!worked) { + // free the item from the map. + CleanupIOCallback(ecb); + // clobber the callback. + ecb->ServerSupportFunction(ecb->ConnID, HSE_REQ_IO_COMPLETION, NULL, NULL,NULL); + // and tell IIS there we are done with an error. + DWORD status = HSE_STATUS_ERROR; + ecb->ServerSupportFunction(ecb->ConnID, HSE_REQ_DONE_WITH_SESSION, &status, NULL, 0); + } + } + // @doc // @object HSE_VERSION_INFO|An object used by ISAPI GetExtensionVersion *************** *** 124,128 **** // EXTENSION_CONTROL_BLOCK. struct memberlist PyECB::PyECB_memberlist[] = { ! {"Version", T_INT, ECBOFF(m_version), READONLY}, {"ConnID", T_INT, ECBOFF(m_connID), READONLY}, --- 220,225 ---- // EXTENSION_CONTROL_BLOCK. struct memberlist PyECB::PyECB_memberlist[] = { ! {"Version", T_INT, ECBOFF(m_version), READONLY}, ! // XXX - ConnID 64bit issue? {"ConnID", T_INT, ECBOFF(m_connID), READONLY}, *************** *** 158,162 **** {"GetImpersonationToken", PyECB::GetImpersonationToken, 1}, // @pymeth GetImpersonationToken| {"IsKeepConn", PyECB::IsKeepConn, 1}, // @pymeth IsKeepConn|Calls ServerSupportFunction with HSE_REQ_IS_KEEP_CONN ! {"ExecURLInfo", PyECB::ExecURLInfo, 1}, // @pymeth ExecURLInfo|Calls ServerSupportFunction with HSE_REQ_EXEC_URL {NULL} }; --- 255,260 ---- {"GetImpersonationToken", PyECB::GetImpersonationToken, 1}, // @pymeth GetImpersonationToken| {"IsKeepConn", PyECB::IsKeepConn, 1}, // @pymeth IsKeepConn|Calls ServerSupportFunction with HSE_REQ_IS_KEEP_CONN ! {"ExecURL", PyECB::ExecURL, 1}, // @pymeth ExecURL|Calls ServerSupportFunction with HSE_REQ_EXEC_URL ! {"ReqIOCompletion", PyECB::ReqIOCompletion, 1}, // @pymeth ReqIOCompletion|Calls ServerSupportFunction with HSE_REQ_IO_COMPLETION {NULL} }; *************** *** 576,585 **** } ! // @pymethod int|EXTENSION_CONTROL_BLOCK|ExecURLInfo|Calls ServerSupportFunction with HSE_REQ_EXEC_URL ! PyObject * PyECB::ExecURLInfo(PyObject *self, PyObject *args) { PyObject *obInfo, *obEntity; HSE_EXEC_URL_INFO i; ! if (!PyArg_ParseTuple(args, "zzzOOi:ExecURLInfo", &i.pszUrl, // @pyparm string|url|| &i.pszMethod, // @pyparm string|method|| --- 674,685 ---- } ! // @pymethod int|EXTENSION_CONTROL_BLOCK|ExecURL|Calls ServerSupportFunction with HSE_REQ_EXEC_URL ! // @comm This function is only available in IIS6 and later. ! PyObject * PyECB::ExecURL(PyObject *self, PyObject *args) { PyObject *obInfo, *obEntity; HSE_EXEC_URL_INFO i; ! memset(&i, 0, sizeof(i)); // to be sure, to be sure... ! if (!PyArg_ParseTuple(args, "zzzOOi:ExecURL", &i.pszUrl, // @pyparm string|url|| &i.pszMethod, // @pyparm string|method|| *************** *** 598,610 **** EXTENSION_CONTROL_BLOCK *ecb = pecb->m_pcb->GetECB(); if (!pecb || !pecb->Check()) return NULL; ! BOOL bRes, bIs; Py_BEGIN_ALLOW_THREADS bRes = ecb->ServerSupportFunction(ecb->ConnID, HSE_REQ_EXEC_URL, &i, NULL,NULL); Py_END_ALLOW_THREADS if (!bRes) ! return SetPyECBError("ServerSupportFunction(HSE_REQ_EXEC_URL)"); ! return PyBool_FromLong(bIs); } class PyTFD { --- 698,744 ---- EXTENSION_CONTROL_BLOCK *ecb = pecb->m_pcb->GetECB(); if (!pecb || !pecb->Check()) return NULL; ! BOOL bRes; Py_BEGIN_ALLOW_THREADS bRes = ecb->ServerSupportFunction(ecb->ConnID, HSE_REQ_EXEC_URL, &i, NULL,NULL); Py_END_ALLOW_THREADS if (!bRes) ! return SetPyECBError("ServerSupportFunction(HSE_REQ_EXEC_URL)"); ! Py_RETURN_NONE; } + // @pymethod int|EXTENSION_CONTROL_BLOCK|ReqIOCompletion|Set a callback that will be used for handling asynchronous I/O operations. + // @comm If you call this multiple times, the previous callback will be discarded. + // @comm A reference to the callback and args are held until <om + // EXTENSION_CONTROL_BLOCK.DoneWithSession> is called. If the callback + // function fails, DoneWithSession(HSE_STATUS_ERROR) will automatically be + // called and no further callbacks for the ECB will be made. + PyObject * PyECB::ReqIOCompletion(PyObject *self, PyObject *args) + { + PyECB * pecb = (PyECB *) self; + if (!pecb || !pecb->Check()) return NULL; + EXTENSION_CONTROL_BLOCK *ecb = pecb->m_pcb->GetECB(); + + PyObject *obCallback; + PyObject *obArg = NULL; + if (!PyArg_ParseTuple(args, "O|O:ReqIOCompletion", + &obCallback, // @pyparm callable|func||The function to call. + &obArg)) + return NULL; + + if (!PyCallable_Check(obCallback)) + return PyErr_Format(PyExc_TypeError, "first param must be callable"); + // now we have checked the params just ignore them! Stick args itself + // in our map. + if (!SetupIOCallback(ecb, args)) + return NULL; + + BOOL bRes; + Py_BEGIN_ALLOW_THREADS + bRes = ecb->ServerSupportFunction(ecb->ConnID, HSE_REQ_IO_COMPLETION, DoIOCallback, NULL, NULL); + Py_END_ALLOW_THREADS + if (!bRes) + return SetPyECBError("ServerSupportFunction(HSE_REQ_IO_COMPLETION)"); + Py_RETURN_NONE; + } class PyTFD { *************** *** 761,764 **** --- 895,902 ---- return NULL; + // Free any resources we've allocated on behalf of this ECB - this + // currently means just the io-completion callback. + CleanupIOCallback(pecb->m_pcb->GetECB()); + Py_BEGIN_ALLOW_THREADS pecb->m_pcb->DoneWithSession(status); |
From: Mark H. <mha...@us...> - 2008-12-30 12:18:40
|
Update of /cvsroot/pywin32/pywin32/isapi/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv25168/src Modified Files: PyFilterObjects.h Log Message: avoid WRITE_RESTRICTED warnings Index: PyFilterObjects.h =================================================================== RCS file: /cvsroot/pywin32/pywin32/isapi/src/PyFilterObjects.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** PyFilterObjects.h 22 Feb 2008 23:03:06 -0000 1.6 --- PyFilterObjects.h 30 Dec 2008 12:18:34 -0000 1.7 *************** *** 28,32 **** --- 28,37 ---- #include "FilterContext.h" + #ifdef WRITE_RESTRICTED + #undef WRITE_RESTRICTED + #endif #include "structmember.h" + // avoid anyone accidently using the wrong WRITE_RESTRICTED... + #undef WRITE_RESTRICTED #include "tupleobject.h" |
From: Mark H. <mha...@us...> - 2008-12-30 12:08:06
|
Update of /cvsroot/pywin32/pywin32/isapi In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv24579 Modified Files: isapicon.py Log Message: new HSE_EXEC_* constants Index: isapicon.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/isapi/isapicon.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** isapicon.py 12 Oct 2006 07:00:37 -0000 1.2 --- isapicon.py 30 Dec 2008 12:06:59 -0000 1.3 *************** *** 112,113 **** --- 112,120 ---- HSE_IO_FINAL_SEND = 0x00000010 HSE_IO_CACHE_RESPONSE = 0x00000020 + + HSE_EXEC_URL_NO_HEADERS = 0x02 + HSE_EXEC_URL_IGNORE_CURRENT_INTERCEPTOR = 0x04 + HSE_EXEC_URL_IGNORE_VALIDATION_AND_RANGE = 0x10 + HSE_EXEC_URL_DISABLE_CUSTOM_ERROR = 0x20 + HSE_EXEC_URL_SSI_CMD = 0x40 + HSE_EXEC_URL_HTTP_CACHE_ELIGIBLE = 0x80 |
From: Mark H. <mha...@us...> - 2008-12-30 12:08:05
|
Update of /cvsroot/pywin32/pywin32/isapi In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv24547 Modified Files: install.py Log Message: assert against deleting the root Index: install.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/isapi/install.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** install.py 19 Dec 2008 03:17:33 -0000 1.18 --- install.py 30 Dec 2008 12:06:32 -0000 1.19 *************** *** 240,243 **** --- 240,244 ---- # Also seen the Class change to a generic IISObject - so nuke # *any* existing object, regardless of Class + assert name.strip("/"), "mustn't delete the root!" iis_dir.Delete('', name) log(2, "Deleted old directory '%s'" % (name,)) *************** *** 343,346 **** --- 344,348 ---- # As for VirtualDir, delete an existing one. + assert filterParams.Name.strip("/"), "mustn't delete the root!" try: filters.Delete(_IIS_FILTER, filterParams.Name) *************** *** 375,378 **** --- 377,381 ---- return try: + assert filterParams.Name.strip("/"), "mustn't delete the root!" filters.Delete(_IIS_FILTER, filterParams.Name) log(2, "Deleted ISAPI filter '%s'" % (filterParams.Name,)) |
From: Mark H. <mha...@us...> - 2008-12-28 12:53:41
|
Update of /cvsroot/pywin32/pywin32/Pythonwin In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv12579 Modified Files: Tag: py3k win32assoc.cpp win32assoc.h win32cmd.cpp win32cmd.h win32dlg.cpp win32dlg.h win32gdi.cpp win32hl.h win32prop.h win32win.cpp Log Message: remove DoKillAssoc and 3rd param to Assoc() Index: win32assoc.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32assoc.cpp,v retrieving revision 1.9.2.3 retrieving revision 1.9.2.4 diff -C2 -d -r1.9.2.3 -r1.9.2.4 *** win32assoc.cpp 28 Dec 2008 10:55:48 -0000 1.9.2.3 --- win32assoc.cpp 28 Dec 2008 12:53:32 -0000 1.9.2.4 *************** *** 77,111 **** } ! void CAssocManager::Assoc(void *handle, ui_assoc_object *object, void *oldHandle) { m_critsec.Lock(); ! if (oldHandle) { ! // if window previously closed, this may fail when the Python object ! // destructs - but this is not a problem. ! RemoveAssoc(oldHandle); ! } ! if (handle) { #ifdef DEBUG ! // overwriting an existing entry probably means we are failing to ! // detect the death of the old object and its address has been reused. ! if (object) { // might just be nuking ours, so we expect to find outself! ! PyObject *existing_weakref; ! if (map.Lookup(handle, (void *&)existing_weakref)) { ! TRACE("CAssocManager::Assoc overwriting existing assoc\n"); ! // DebugBreak(); ! } } #endif ! RemoveAssoc(handle); ! if (object) { ! PyObject *weakref = PyWeakref_NewRef(object, NULL); ! if (weakref) ! // reference owned by the map. ! map.SetAt(handle, weakref); ! else { ! TRACE("Failed to create weakref\n"); ! gui_print_error(); ! DebugBreak(); ! } } } --- 77,105 ---- } ! void CAssocManager::Assoc(void *handle, ui_assoc_object *object) { m_critsec.Lock(); ! ASSERT(handle); #ifdef DEBUG ! // overwriting an existing entry probably means we are failing to ! // detect the death of the old object and its address has been reused. ! if (object) { // might just be nuking ours, so we expect to find outself! ! PyObject *existing_weakref; ! if (map.Lookup(handle, (void *&)existing_weakref)) { ! TRACE("CAssocManager::Assoc overwriting existing assoc\n"); ! DebugBreak(); } + } #endif ! RemoveAssoc(handle); ! if (object) { ! PyObject *weakref = PyWeakref_NewRef(object, NULL); ! if (weakref) ! // reference owned by the map. ! map.SetAt(handle, weakref); ! else { ! TRACE("Failed to create weakref\n"); ! gui_print_error(); ! DebugBreak(); } } *************** *** 273,305 **** TRACE("Destroying association with %p and %s",this,szRep); #endif ! // note that _any_ of these may cause this to be deleted, as the reference ! // count may drop to zero. If any one dies, and later ones will fail. Therefore ! // I incref first, and decref at the end. ! // Note that this _always_ recurses when this happens as the destructor also ! // calls us to cleanup. Forcing an INCREF/DODECREF in that situation causes death ! // by recursion, as each dec back to zero causes a delete. ! // (*sob* - but in that case, the INCREF of the object shouldn't be necessary - ! // if anyone touches a refcount of our dead object we will end up crashing - and ! // if noone does touch the refcount, we should not need to bump it for the duration.) ! BOOL bDestructing = ob_refcnt==0; ! if (!bDestructing) ! Py_INCREF(this); ! DoKillAssoc(bDestructing); // kill all map entries, etc. ! SetAssocInvalid(); // let child do whatever to detect ! if (!bDestructing) ! DODECREF(this); ! } ! // the virtual version... ! // ASSUMES WE HOLD THE PYTHON LOCK as for all Python object destruction. ! void ui_assoc_object::DoKillAssoc( BOOL bDestructing /*= FALSE*/ ) ! { ! // In Python debug builds, this can get recursive - ! // Python temporarily increments the refcount of the dieing ! // object - this object death will attempt to use the dieing object. ! PyObject *vi = virtualInst; ! virtualInst = NULL; ! Py_XDECREF(vi); // virtuals.DeleteAll(); ! handleMgr.Assoc(0,this,assoc); } --- 267,274 ---- TRACE("Destroying association with %p and %s",this,szRep); #endif ! Py_CLEAR(virtualInst); // virtuals.DeleteAll(); ! handleMgr.Assoc(assoc, 0); ! SetAssocInvalid(); // let child do whatever to detect } Index: win32win.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32win.cpp,v retrieving revision 1.21.2.2 retrieving revision 1.21.2.3 diff -C2 -d -r1.21.2.2 -r1.21.2.3 *** win32win.cpp 28 Dec 2008 10:55:49 -0000 1.21.2.2 --- win32win.cpp 28 Dec 2008 12:53:32 -0000 1.21.2.3 *************** *** 610,622 **** if (pWnd) { if (bDidSubclass) { - // pWnd->Detach(); pWnd->UnsubclassWindow(); bDidSubclass = FALSE; } - // DONT detach - bDidSubclass is only logic needed. - // if (pWnd->GetSafeHwnd()) { - // TRACE("Warning - DoKillAssoc detaching from existing window\n"); - // pWnd->Detach(); - // } if (bManualDelete) { // Release the lock while we destroy the object. --- 610,616 ---- Index: win32cmd.h =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32cmd.h,v retrieving revision 1.1.4.1 retrieving revision 1.1.4.2 diff -C2 -d -r1.1.4.1 -r1.1.4.2 *** win32cmd.h 28 Dec 2008 10:55:49 -0000 1.1.4.1 --- win32cmd.h 28 Dec 2008 12:53:32 -0000 1.1.4.2 *************** *** 15,20 **** CMapWordToPtr *pCommandUpdateHookList; - virtual void DoKillAssoc( BOOL bDestructing = FALSE ); - // virtuals for Python support virtual CString repr(); --- 15,18 ---- Index: win32dlg.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32dlg.cpp,v retrieving revision 1.10.2.3 retrieving revision 1.10.2.4 diff -C2 -d -r1.10.2.3 -r1.10.2.4 *** win32dlg.cpp 28 Dec 2008 10:55:49 -0000 1.10.2.3 --- win32dlg.cpp 28 Dec 2008 12:53:32 -0000 1.10.2.4 *************** *** 175,194 **** } - PyCWnd::DoKillAssoc(TRUE); ui_assoc_object::SetAssocInvalid(); // must call this explicitely, as I ignore SetAssocInvalid ! Py_XDECREF(ddlist); ! Py_XDECREF(dddict); ! } ! void PyCDialog::DoKillAssoc(BOOL bDestructing /*=FALSE*/ ) ! { ! // we can not have the pointer deleted at window destruction time // for a dialog (as MFC still needs it after the dialog has completed BOOL bManDeleteSave = bManualDelete; ! if (!bDestructing) ! bManualDelete = FALSE; ! PyCWnd::DoKillAssoc(bDestructing); ! if (!bDestructing) ! bManualDelete = bManDeleteSave; } PyObject * PyCDialog::getattro(PyObject *obname) --- 175,185 ---- } ui_assoc_object::SetAssocInvalid(); // must call this explicitely, as I ignore SetAssocInvalid ! Py_XDECREF(ddlist); // we can not have the pointer deleted at window destruction time // for a dialog (as MFC still needs it after the dialog has completed BOOL bManDeleteSave = bManualDelete; ! Py_XDECREF(dddict); } + PyObject * PyCDialog::getattro(PyObject *obname) Index: win32assoc.h =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32assoc.h,v retrieving revision 1.2.4.1 retrieving revision 1.2.4.2 diff -C2 -d -r1.2.4.1 -r1.2.4.2 *** win32assoc.h 28 Dec 2008 10:55:48 -0000 1.2.4.1 --- win32assoc.h 28 Dec 2008 12:53:32 -0000 1.2.4.2 *************** *** 23,27 **** CAssocManager(); ~CAssocManager(); ! void Assoc(void *assoc, ui_assoc_object *PyObject, void *oldAssoc=NULL); ui_assoc_object *GetAssocObject(void * handle); --- 23,27 ---- CAssocManager(); ~CAssocManager(); ! void Assoc(void *assoc, ui_assoc_object *PyObject); ui_assoc_object *GetAssocObject(void * handle); *************** *** 79,87 **** void *GetGoodCppObject(ui_type *ui_type_check=NULL) const; virtual bool CheckCppObject(ui_type *ui_type_check) const {return true;} - // Does the actual killing. - virtual void DoKillAssoc( BOOL bDestructing = FALSE ); // does the actual work. // Called during KillAssoc - normally zeroes association. // Override to keep handle after destruction (eg, the association // with a dialog is valid after the Window's window has closed). virtual void SetAssocInvalid() { assoc = 0; } --- 79,86 ---- void *GetGoodCppObject(ui_type *ui_type_check=NULL) const; virtual bool CheckCppObject(ui_type *ui_type_check) const {return true;} // Called during KillAssoc - normally zeroes association. // Override to keep handle after destruction (eg, the association // with a dialog is valid after the Window's window has closed). + // XXX? bogus too? virtual void SetAssocInvalid() { assoc = 0; } Index: win32gdi.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32gdi.cpp,v retrieving revision 1.2.4.1 retrieving revision 1.2.4.2 diff -C2 -d -r1.2.4.1 -r1.2.4.2 *** win32gdi.cpp 28 Dec 2008 10:55:49 -0000 1.2.4.1 --- win32gdi.cpp 28 Dec 2008 12:53:32 -0000 1.2.4.2 *************** *** 39,43 **** PyCGdiObject::~PyCGdiObject() { - //DoKillAssoc(TRUE); } --- 39,42 ---- Index: win32cmd.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32cmd.cpp,v retrieving revision 1.5.2.2 retrieving revision 1.5.2.3 diff -C2 -d -r1.5.2.2 -r1.5.2.3 *** win32cmd.cpp 28 Dec 2008 10:55:48 -0000 1.5.2.2 --- win32cmd.cpp 28 Dec 2008 12:53:32 -0000 1.5.2.3 *************** *** 174,187 **** PyCCmdTarget::~PyCCmdTarget() { - } - - // handle is invalid - therefore release all refs I am holding for it. - void PyCCmdTarget::DoKillAssoc( BOOL bDestructing /*= FALSE*/ ) - { free_hook_list(this,&pNotifyHookList); free_hook_list(this,&pOleEventHookList); free_hook_list(this,&pCommandHookList); free_hook_list(this,&pCommandUpdateHookList); - ui_assoc_object::DoKillAssoc(bDestructing); } --- 174,181 ---- Index: win32prop.h =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32prop.h,v retrieving revision 1.1 retrieving revision 1.1.4.1 diff -C2 -d -r1.1 -r1.1.4.1 *** win32prop.h 1 Sep 1999 23:33:02 -0000 1.1 --- win32prop.h 28 Dec 2008 12:53:32 -0000 1.1.4.1 *************** *** 16,22 **** PyCPropertySheet(); virtual ~PyCPropertySheet(); - - // virtual void DoKillAssoc( BOOL bDestructing=FALSE); - // virtual void SetAssocInvalid() {return; }//ignore }; --- 16,19 ---- Index: win32dlg.h =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32dlg.h,v retrieving revision 1.1.4.1 retrieving revision 1.1.4.2 diff -C2 -d -r1.1.4.1 -r1.1.4.2 *** win32dlg.h 29 Aug 2008 05:53:29 -0000 1.1.4.1 --- win32dlg.h 28 Dec 2008 12:53:32 -0000 1.1.4.2 *************** *** 21,25 **** PyCDialog(); virtual ~PyCDialog(); - virtual void DoKillAssoc( BOOL bDestructing=FALSE); virtual void SetAssocInvalid() {return; }//ignore public: --- 21,24 ---- Index: win32hl.h =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32hl.h,v retrieving revision 1.1 retrieving revision 1.1.4.1 diff -C2 -d -r1.1 -r1.1.4.1 *** win32hl.h 1 Sep 1999 23:33:02 -0000 1.1 --- win32hl.h 28 Dec 2008 12:53:32 -0000 1.1.4.1 *************** *** 13,17 **** CPythonHierControl *GetListObject(); static CPythonHierControl *GetListObject(PyObject *self); - virtual void DoKillAssoc( BOOL bDestructing = FALSE ); static ui_type_CObject type; --- 13,16 ---- |
From: Mark H. <mha...@us...> - 2008-12-28 10:58:52
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv26979/win32/src Modified Files: Tag: py3k win32api_display.h Log Message: whitespace change from trunk Index: win32api_display.h =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32api_display.h,v retrieving revision 1.3.2.2 retrieving revision 1.3.2.3 diff -C2 -d -r1.3.2.2 -r1.3.2.3 *** win32api_display.h 6 Dec 2008 01:48:26 -0000 1.3.2.2 --- win32api_display.h 28 Dec 2008 10:58:48 -0000 1.3.2.3 *************** *** 45,49 **** static struct PyMemberDef members[]; static struct PyMethodDef methods[]; - static void deallocFunc(PyObject *ob); PyDISPLAY_DEVICE(PDISPLAY_DEVICE); --- 45,48 ---- |
From: Mark H. <mha...@us...> - 2008-12-28 10:58:16
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv26837/win32/src Modified Files: Tag: py3k win32apimodule.cpp Log Message: restore use of integer for RegQueryInfoKey from trunk Index: win32apimodule.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32apimodule.cpp,v retrieving revision 1.89.2.3 retrieving revision 1.89.2.4 diff -C2 -d -r1.89.2.3 -r1.89.2.4 *** win32apimodule.cpp 8 Dec 2008 13:41:06 -0000 1.89.2.3 --- win32apimodule.cpp 28 Dec 2008 10:58:11 -0000 1.89.2.4 *************** *** 3809,3813 **** )!=ERROR_SUCCESS) return ReturnAPIError("RegQueryInfoKey", rc); ! return Py_BuildValue("iiN",nSubKeys,nValues, PyWinObject_FromFILETIME(ft)); } --- 3809,3818 ---- )!=ERROR_SUCCESS) return ReturnAPIError("RegQueryInfoKey", rc); ! ULARGE_INTEGER l; ! l.LowPart = ft.dwLowDateTime; ! l.HighPart = ft.dwHighDateTime; ! PyObject *ret = Py_BuildValue("iiN",nSubKeys,nValues, ! PyWinObject_FromULARGE_INTEGER(l)); ! return ret; } *************** *** 5834,5837 **** --- 5839,5854 ---- } + // @pymethod int|win32api|GetKeyboardLayout|retrieves the active input locale identifier (formerly called the keyboard layout) for the specified thread. + // @comm If the idThread parameter is zero, the input locale identifier for the active thread is returned. + PyObject *PyGetKeyboardLayout(PyObject *self, PyObject *args) + { + int tid = 0; + // @pyparm int|threadId|0| + if (!PyArg_ParseTuple(args,"|i:GetKeyboardLayout", &tid)) + return NULL; + HKL hkl = ::GetKeyboardLayout((DWORD)tid); + return PyWinLong_FromVoidPtr(hkl); + } + // @pymethod (int,..)|win32api|GetKeyboardLayoutList|Returns a sequence of all locale ids currently loaded PyObject *PyGetKeyboardLayoutList(PyObject *self, PyObject *args) *************** *** 5848,5852 **** buflen=GetKeyboardLayoutList(buflen, buf); if (buflen==0) ! PyWin_SetAPIError("GetKeyboardLayout"); else{ ret=PyTuple_New(buflen); --- 5865,5869 ---- buflen=GetKeyboardLayoutList(buflen, buf); if (buflen==0) ! PyWin_SetAPIError("GetKeyboardLayoutList"); else{ ret=PyTuple_New(buflen); *************** *** 6086,6089 **** --- 6103,6107 ---- {"GetFullPathName", PyGetFullPathName,1}, // @pymeth GetFullPathName|Returns the full path of a (possibly relative) path {"GetHandleInformation", PyGetHandleInformation,1}, // @pymeth GetHandleInformation|Retrieves a handle's flags. + {"GetKeyboardLayout", PyGetKeyboardLayout, 1}, // @pymeth GetKeyboardLayout|Retrieves the active input locale identifier {"GetKeyboardLayoutList", PyGetKeyboardLayoutList, 1}, // @pymeth GetKeyboardLayoutList|Returns a sequence of all locale ids in the system {"GetKeyboardState", PyGetKeyboardState, 1}, // @pymeth GetKeyboardState|Retrieves the status of the 256 virtual keys on the keyboard. |
From: Mark H. <mha...@us...> - 2008-12-28 10:56:43
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv26534/win32/src Modified Files: Tag: py3k PythonService.cpp Log Message: merge PYUWIN#@_MODULE_* macro changes from trunk Index: PythonService.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/PythonService.cpp,v retrieving revision 1.24.2.4 retrieving revision 1.24.2.5 diff -C2 -d -r1.24.2.4 -r1.24.2.5 *** PythonService.cpp 19 Sep 2008 00:03:58 -0000 1.24.2.4 --- PythonService.cpp 28 Dec 2008 10:56:38 -0000 1.24.2.5 *************** *** 542,588 **** ! #define ADD_CONSTANT(tok) if (PyModule_AddIntConstant(module, #tok, tok) == -1) RETURN_ERROR; ! extern "C" __declspec(dllexport) ! #if (PY_VERSION_HEX < 0x03000000) ! void initservicemanager(void) ! #else ! PyObject *PyInit_servicemanager(void) ! #endif { ! ! PyObject *dict, *module; ! PyWinGlobals_Ensure(); ! ! #if (PY_VERSION_HEX < 0x03000000) ! #define RETURN_ERROR return; ! module = Py_InitModule("servicemanager", servicemanager_functions); ! if (!module) ! return; ! dict = PyModule_GetDict(module); ! if (!dict) ! return; ! #else ! ! #define RETURN_ERROR return NULL; ! static PyModuleDef servicemanager_def = { ! PyModuleDef_HEAD_INIT, ! "servicemanager", ! "A module that interfaces with the Windows Service Control Manager.", ! -1, ! servicemanager_functions ! }; ! module = PyModule_Create(&servicemanager_def); ! if (!module) ! return NULL; ! dict = PyModule_GetDict(module); ! if (!dict) ! return NULL; ! #endif ! HMODULE advapi32_module; servicemanager_startup_error = PyErr_NewException("servicemanager.startup_error", NULL, NULL); if (servicemanager_startup_error == NULL) ! RETURN_ERROR; PyDict_SetItemString(dict, "startup_error", servicemanager_startup_error); --- 542,555 ---- ! #define ADD_CONSTANT(tok) if (PyModule_AddIntConstant(module, #tok, tok) == -1) PYWIN_MODULE_INIT_RETURN_ERROR; ! PYWIN_MODULE_INIT_FUNC(servicemanager) { ! PYWIN_MODULE_INIT_PREPARE(servicemanager, servicemanager_functions, ! "A module that interfaces with the Windows Service Control Manager."); HMODULE advapi32_module; servicemanager_startup_error = PyErr_NewException("servicemanager.startup_error", NULL, NULL); if (servicemanager_startup_error == NULL) ! PYWIN_MODULE_INIT_RETURN_ERROR; PyDict_SetItemString(dict, "startup_error", servicemanager_startup_error); *************** *** 620,626 **** } ! #if (PY_VERSION_HEX >= 0x03000000) ! return module; ! #endif } --- 587,591 ---- } ! PYWIN_MODULE_INIT_RETURN_SUCCESS; } |
Update of /cvsroot/pywin32/pywin32/Pythonwin In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv26279/Pythonwin Modified Files: Tag: py3k ddeconv.cpp ddeitem.cpp ddeserver.cpp ddetopic.cpp pythonpsheet.cpp stdafx.h win32ImageList.cpp win32RichEdit.cpp win32RichEditDocTemplate.cpp win32app.cpp win32assoc.cpp win32assoc.h win32bitmap.cpp win32brush.cpp win32cmd.cpp win32cmd.h win32cmdui.cpp win32control.cpp win32control.h win32ctledit.cpp win32ctrlList.cpp win32ctrlRichEdit.cpp win32ctrlTree.cpp win32dc.cpp win32dc.h win32dlg.cpp win32dlgbar.cpp win32dll.cpp win32dll.h win32doc.cpp win32font.cpp win32gdi.cpp win32gdi.h win32menu.cpp win32notify.cpp win32oleDlgInsert.cpp win32oleDlgs.cpp win32pen.cpp win32prinfo.cpp win32prinfo.h win32prop.cpp win32rgn.cpp win32splitter.cpp win32template.cpp win32thread.cpp win32toolbar.cpp win32tooltip.cpp win32ui.h win32uimodule.cpp win32uioleClientItem.cpp win32uioledoc.cpp win32util.cpp win32view.cpp win32virt.cpp win32win.cpp win32win.h Log Message: merge lots of reference count leaks plus support for weakrefs Index: win32ctledit.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32ctledit.cpp,v retrieving revision 1.1.4.1 retrieving revision 1.1.4.2 diff -C2 -d -r1.1.4.1 -r1.1.4.2 *** win32ctledit.cpp 29 Aug 2008 05:53:29 -0000 1.1.4.1 --- win32ctledit.cpp 28 Dec 2008 10:55:49 -0000 1.1.4.2 *************** *** 424,427 **** --- 424,428 ---- RUNTIME_CLASS(CEdit), sizeof(PyCEdit), + PYOBJ_OFFSET(PyCEdit), PyCEdit_methods, GET_PY_CTOR(PyCEdit)); Index: win32app.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32app.cpp,v retrieving revision 1.6.2.1 retrieving revision 1.6.2.2 diff -C2 -d -r1.6.2.1 -r1.6.2.2 *** win32app.cpp 29 Aug 2008 05:53:29 -0000 1.6.2.1 --- win32app.cpp 28 Dec 2008 10:55:48 -0000 1.6.2.2 *************** *** 416,419 **** --- 416,420 ---- RUNTIME_CLASS(CWinApp), sizeof(PyCWinApp), + PYOBJ_OFFSET(PyCWinApp), PyCWinApp_methods, GET_PY_CTOR(PyCWinApp) ); Index: win32win.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32win.cpp,v retrieving revision 1.21.2.1 retrieving revision 1.21.2.2 diff -C2 -d -r1.21.2.1 -r1.21.2.2 *** win32win.cpp 29 Aug 2008 05:53:30 -0000 1.21.2.1 --- win32win.cpp 28 Dec 2008 10:55:49 -0000 1.21.2.2 *************** *** 70,75 **** BOOL Python_check_message(const MSG *msg) // TRUE if fully processed. { ! ! ui_assoc_object *pObj; PyObject *method; CWnd *pWnd = bInFatalShutdown ? NULL : CWnd::FromHandlePermanent(msg->hwnd); --- 70,75 ---- BOOL Python_check_message(const MSG *msg) // TRUE if fully processed. { ! BOOL ret; ! ui_assoc_object *pObj = NULL; PyObject *method; CWnd *pWnd = bInFatalShutdown ? NULL : CWnd::FromHandlePermanent(msg->hwnd); *************** *** 77,81 **** CEnterLeavePython _celp; if (pWnd && ! (pObj=ui_assoc_object::GetPyObject(pWnd)) && pObj->is_uiobject( &PyCWnd::type ) && ((PyCWnd *)pObj)->pMessageHookList && --- 77,81 ---- CEnterLeavePython _celp; if (pWnd && ! (pObj=ui_assoc_object::GetAssocObject(pWnd)) && pObj->is_uiobject( &PyCWnd::type ) && ((PyCWnd *)pObj)->pMessageHookList && *************** *** 87,93 **** // Our Python convention is TRUE means "pass it on" // CEnterLeavePython _celp; ! return Python_callback(method, msg)==0; ! } ! return FALSE; // dont want it. } --- 87,95 ---- // Our Python convention is TRUE means "pass it on" // CEnterLeavePython _celp; ! ret = Python_callback(method, msg)==0; ! } else ! ret = FALSE; // dont want it. ! Py_XDECREF(pObj); ! return ret; } *************** *** 95,104 **** { CEnterLeavePython _celp; ! ui_assoc_object *pObj; BOOL bPassOn = TRUE; CWnd *pWnd = msg->hwnd ? CWnd::FromHandlePermanent(msg->hwnd) : NULL; ! if (pWnd && (pObj=ui_assoc_object::GetPyObject(pWnd)) && pObj->is_uiobject( &PyCWnd::type )) bPassOn = ((PyCWnd*)pObj)->check_key_stroke(msg->wParam); return !bPassOn; } --- 97,107 ---- { CEnterLeavePython _celp; ! ui_assoc_object *pObj = NULL; BOOL bPassOn = TRUE; CWnd *pWnd = msg->hwnd ? CWnd::FromHandlePermanent(msg->hwnd) : NULL; ! if (pWnd && (pObj=ui_assoc_object::GetAssocObject(pWnd)) && pObj->is_uiobject( &PyCWnd::type )) bPassOn = ((PyCWnd*)pObj)->check_key_stroke(msg->wParam); + Py_XDECREF(pObj); return !bPassOn; } *************** *** 598,630 **** PyCWnd::~PyCWnd() { - DoKillAssoc(TRUE); - } - - BOOL PyCWnd::check_key_stroke(WPARAM ch) - { - PyObject *pythonObject; - BOOL bCallBase = TRUE; - if (obKeyStrokeHandler!= NULL) - bCallBase = Python_callback(obKeyStrokeHandler, ch); - - if (bCallBase && pKeyHookList && pKeyHookList->Lookup((WORD)ch, (void *&)pythonObject)) - bCallBase = Python_callback(pythonObject,ch); - return bCallBase; - } - - CWnd *PyCWnd::GetPythonGenericWnd(PyObject *self, ui_type_CObject *pType) - { - // Damn it - only pass PyCWnd::type so the RTTI check wont fail - // for builtin controls. - return (CWnd *)GetGoodCppObject( self, &type ); - } - - void PyCWnd::DoKillAssoc( BOOL bDestructing /*= FALSE*/ ) - { free_hook_list(this,&pMessageHookList); free_hook_list(this,&pKeyHookList); Py_XDECREF(obKeyStrokeHandler); obKeyStrokeHandler = NULL; - PyCCmdTarget::DoKillAssoc(bDestructing); if (bManualDelete || bDidSubclass) { // Can't use GetWndPtr(this) as ob_type has been nuked. --- 601,608 ---- *************** *** 651,654 **** --- 629,652 ---- } } + + BOOL PyCWnd::check_key_stroke(WPARAM ch) + { + PyObject *pythonObject; + BOOL bCallBase = TRUE; + if (obKeyStrokeHandler!= NULL) + bCallBase = Python_callback(obKeyStrokeHandler, ch); + + if (bCallBase && pKeyHookList && pKeyHookList->Lookup((WORD)ch, (void *&)pythonObject)) + bCallBase = Python_callback(pythonObject,ch); + return bCallBase; + } + + CWnd *PyCWnd::GetPythonGenericWnd(PyObject *self, ui_type_CObject *pType) + { + // Damn it - only pass PyCWnd::type so the RTTI check wont fail + // for builtin controls. + return (CWnd *)GetGoodCppObject( self, &type ); + } + /*static*/ PyCWnd *PyCWnd::make( ui_type_CObject &makeType, CWnd *pSearch, HWND wnd /*=NULL*/ ) { *************** *** 2719,2724 **** RETURN_ERR("BeginPaint failed"); PyObject *obDC = ui_assoc_object::make (ui_dc_object::type, pTemp)->GetGoodRet(); ! PyObject *obRet = Py_BuildValue("O(ii(iiii)iiN)", obDC, ! ps.hdc, ps.fErase, ps.rcPaint.left, ps.rcPaint.top, ps.rcPaint.right, ps.rcPaint.bottom, --- 2717,2722 ---- RETURN_ERR("BeginPaint failed"); PyObject *obDC = ui_assoc_object::make (ui_dc_object::type, pTemp)->GetGoodRet(); ! PyObject *obRet = Py_BuildValue("O(Ni(iiii)iiN)", obDC, ! PyWinLong_FromHANDLE(ps.hdc), ps.fErase, ps.rcPaint.left, ps.rcPaint.top, ps.rcPaint.right, ps.rcPaint.bottom, *************** *** 3195,3201 **** PyObject* ui_window_set_icon(PyObject* self, PyObject *args) { ! HICON hiconPrevIcon; BOOL bBigIcon = TRUE; ! if (!PyArg_ParseTuple(args, "ii:SetIcon", &hiconPrevIcon, &bBigIcon)) return NULL; CWnd *pWnd = GetWndPtr(self); --- 3193,3202 ---- PyObject* ui_window_set_icon(PyObject* self, PyObject *args) { ! PyObject *obiconprev; BOOL bBigIcon = TRUE; ! if (!PyArg_ParseTuple(args, "Oi:SetIcon", &obiconprev, &bBigIcon)) ! return NULL; ! HICON hiconprev; ! if (!PyWinObject_AsHANDLE(obiconprev, (HANDLE *)&hiconprev)) return NULL; CWnd *pWnd = GetWndPtr(self); *************** *** 3203,3209 **** return NULL; GUI_BGN_SAVE; ! HICON hiconRetVal = pWnd->SetIcon(hiconPrevIcon, bBigIcon); GUI_END_SAVE; ! return Py_BuildValue("i", hiconRetVal); } --- 3204,3210 ---- return NULL; GUI_BGN_SAVE; ! HICON hiconRetVal = pWnd->SetIcon(hiconprev, bBigIcon); GUI_END_SAVE; ! return PyWinLong_FromHANDLE(hiconRetVal); } *************** *** 3347,3350 **** --- 3348,3352 ---- RUNTIME_CLASS(CWnd), sizeof(PyCWnd), + PYOBJ_OFFSET(PyCWnd), PyCWnd_methods, GET_PY_CTOR(PyCWnd) ); *************** *** 3952,3955 **** --- 3954,3958 ---- RUNTIME_CLASS(CFrameWnd), sizeof(PyCFrameWnd), + PYOBJ_OFFSET(PyCFrameWnd), PyCFrameWnd_methods, GET_PY_CTOR(PyCFrameWnd)); *************** *** 4124,4127 **** --- 4127,4131 ---- RUNTIME_CLASS(CMDIFrameWnd), sizeof(PyCMDIFrameWnd), + PYOBJ_OFFSET(PyCMDIFrameWnd), PyCMDIFrameWnd_methods, GET_PY_CTOR(PyCMDIFrameWnd)); *************** *** 4310,4313 **** --- 4314,4318 ---- RUNTIME_CLASS(CMDIChildWnd), sizeof(PyCMDIChildWnd), + PYOBJ_OFFSET(PyCMDIChildWnd), PyCMDIChildWnd_methods, GET_PY_CTOR(PyCMDIChildWnd)); Index: win32assoc.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32assoc.cpp,v retrieving revision 1.9.2.2 retrieving revision 1.9.2.3 diff -C2 -d -r1.9.2.2 -r1.9.2.3 *** win32assoc.cpp 5 Sep 2008 07:12:35 -0000 1.9.2.2 --- win32assoc.cpp 28 Dec 2008 10:55:48 -0000 1.9.2.3 *************** *** 20,24 **** { lastLookup = NULL; ! lastObject = NULL; #ifdef _DEBUG cacheLookups = cacheHits = 0; --- 20,24 ---- { lastLookup = NULL; ! lastObjectWeakRef = NULL; #ifdef _DEBUG cacheLookups = cacheHits = 0; *************** *** 47,59 **** void *assoc; ASSERT_VALID(&map); m_critsec.Lock(); for(pos=map.GetStartPosition();pos;) { map.GetNextAssoc(pos, (void *&)assoc, (void *&)ob); ! ob->cleanup(); ! // not sure if I should do this!! ! //PyMem_DEL(ob); } m_critsec.Unlock(); } void CAssocManager::Assoc(void *handle, ui_assoc_object *object, void *oldHandle) { --- 47,80 ---- void *assoc; ASSERT_VALID(&map); + TRACE("CAssocManager cleaning up %d objects\n", map.GetCount()); m_critsec.Lock(); + CEnterLeavePython _celp; for(pos=map.GetStartPosition();pos;) { map.GetNextAssoc(pos, (void *&)assoc, (void *&)ob); ! RemoveAssoc(assoc); } m_critsec.Unlock(); } + + void CAssocManager::RemoveAssoc(void *handle) + { + // nuke any existing items. + PyObject *weakref; + if (map.Lookup(handle, (void *&)weakref)) { + PyObject *ob = PyWeakref_GetObject(weakref); + map.RemoveKey(handle); + if (ob != Py_None) + // The object isn't necessarily dead (ie, its refcount may + // not be about to hit zero), but its 'dead' from our POV, so + // let it free any MFC etc resources the object owns. + // XXX - this kinda sucks - just relying on the object + // destructor *should* be OK... + ((ui_assoc_object *)ob)->cleanup(); + Py_DECREF(weakref); + } + lastObjectWeakRef = 0; + lastLookup = 0; // set cache invalid. + } + void CAssocManager::Assoc(void *handle, ui_assoc_object *object, void *oldHandle) { *************** *** 62,73 **** // if window previously closed, this may fail when the Python object // destructs - but this is not a problem. ! map.RemoveKey(oldHandle); ! if (oldHandle==lastLookup) ! lastLookup = 0; // set cache invalid. } - if (handle) - map.SetAt(handle, object); - if (handle==lastLookup) - lastObject = object; m_critsec.Unlock(); } --- 83,113 ---- // if window previously closed, this may fail when the Python object // destructs - but this is not a problem. ! RemoveAssoc(oldHandle); ! } ! if (handle) { ! #ifdef DEBUG ! // overwriting an existing entry probably means we are failing to ! // detect the death of the old object and its address has been reused. ! if (object) { // might just be nuking ours, so we expect to find outself! ! PyObject *existing_weakref; ! if (map.Lookup(handle, (void *&)existing_weakref)) { ! TRACE("CAssocManager::Assoc overwriting existing assoc\n"); ! // DebugBreak(); ! } ! } ! #endif ! RemoveAssoc(handle); ! if (object) { ! PyObject *weakref = PyWeakref_NewRef(object, NULL); ! if (weakref) ! // reference owned by the map. ! map.SetAt(handle, weakref); ! else { ! TRACE("Failed to create weakref\n"); ! gui_print_error(); ! DebugBreak(); ! } ! } } m_critsec.Unlock(); } *************** *** 75,83 **** // // CAssocManager::GetAssocObject ! // ! ui_assoc_object *CAssocManager::GetAssocObject(const void * handle) { if (handle==NULL) return NULL; // no possible association for NULL! ! ui_assoc_object *ret; m_critsec.Lock(); #ifdef _DEBUG --- 115,123 ---- // // CAssocManager::GetAssocObject ! // Returns an object *with a new reference*. NULL is not an error return - it just means "no object" ! ui_assoc_object *CAssocManager::GetAssocObject(void * handle) { if (handle==NULL) return NULL; // no possible association for NULL! ! PyObject *weakref; m_critsec.Lock(); #ifdef _DEBUG *************** *** 86,90 **** // implement a basic 1 item cache. if (lastLookup==handle) { ! ret = lastObject; #ifdef _DEBUG ++cacheHits; --- 126,130 ---- // implement a basic 1 item cache. if (lastLookup==handle) { ! weakref = lastObjectWeakRef; #ifdef _DEBUG ++cacheHits; *************** *** 92,101 **** } else { ! if (!map.Lookup((void *)handle, (void *&)ret)) ! ret = NULL; lastLookup = handle; ! lastObject = ret; } m_critsec.Unlock(); return ret; } --- 132,161 ---- } else { ! if (!map.Lookup((void *)handle, (void *&)weakref)) ! weakref = NULL; lastLookup = handle; ! lastObjectWeakRef = weakref; } m_critsec.Unlock(); + if (weakref==NULL) + return NULL; + // convert the weakref object into a real object. + PyObject *ob = PyWeakref_GetObject(weakref); + if (ob == NULL) { + // an error - but a NULL return from us just means "no assoc" + // so print the error and ignore it, treating it as if the + // weak-ref target has died. + gui_print_error(); + ob = Py_None; + } + ui_assoc_object *ret; + if (ob == Py_None) { + // weak-ref target has died. Remove it from the map. + Assoc(handle, NULL); + ret = NULL; + } else { + ret = (ui_assoc_object *)ob; + Py_INCREF(ret); + } return ret; } *************** *** 190,193 **** --- 250,254 ---- &ui_base_class::type, sizeof(ui_assoc_object), + PYOBJ_OFFSET(ui_assoc_object), PyAssocObject_methods, NULL); *************** *** 218,221 **** --- 279,285 ---- // calls us to cleanup. Forcing an INCREF/DODECREF in that situation causes death // by recursion, as each dec back to zero causes a delete. + // (*sob* - but in that case, the INCREF of the object shouldn't be necessary - + // if anyone touches a refcount of our dead object we will end up crashing - and + // if noone does touch the refcount, we should not need to bump it for the duration.) BOOL bDestructing = ob_refcnt==0; if (!bDestructing) *************** *** 240,249 **** } - // return an object, given an association, if we have one. - /* static */ ui_assoc_object *ui_assoc_object::GetPyObject(void *search) - { - return (ui_assoc_object *)handleMgr.GetAssocObject(search); - } - PyObject *ui_assoc_object::GetGoodRet() { --- 304,307 ---- *************** *** 271,275 **** return NULL; } - DOINCREF( ret ); return ret; } --- 329,332 ---- *************** *** 282,287 **** TRACE_ASSOC (" Associating 0x%x with 0x%x", search, ret); #endif ! // if I have an existing handle, remove it. ! handleMgr.Assoc(search, ret,NULL); ret->assoc = search; } --- 339,343 ---- TRACE_ASSOC (" Associating 0x%x with 0x%x", search, ret); #endif ! handleMgr.Assoc(search, ret); ret->assoc = search; } *************** *** 337,340 **** --- 393,397 ---- RUNTIME_CLASS(CObject), sizeof(ui_assoc_CObject), + PYOBJ_OFFSET(ui_assoc_CObject), PyAssocCObject_methods, NULL); Index: win32ctrlRichEdit.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32ctrlRichEdit.cpp,v retrieving revision 1.4.2.1 retrieving revision 1.4.2.2 diff -C2 -d -r1.4.2.1 -r1.4.2.2 *** win32ctrlRichEdit.cpp 29 Aug 2008 05:53:29 -0000 1.4.2.1 --- win32ctrlRichEdit.cpp 28 Dec 2008 10:55:49 -0000 1.4.2.2 *************** *** 866,884 **** return NULL; CHECK_NO_ARGS2(args,GetSelText); ! long start=0, end=0; GUI_BGN_SAVE; ! pEdit->GetSel(start, end); GUI_END_SAVE; ! PyObject *ret; ! if (end-start) { ! ret = PyString_FromStringAndSize(NULL, end-start); ! char *buf = PyString_AsString(ret); ! GUI_BGN_SAVE; ! pEdit->GetSelText(buf); ! GUI_END_SAVE; ! } ! else ! ret = PyString_FromStringAndSize("", 0); ! return ret; } --- 866,874 ---- return NULL; CHECK_NO_ARGS2(args,GetSelText); ! CString str; GUI_BGN_SAVE; ! str = pEdit->GetSelText(); GUI_END_SAVE; ! return PyWinObject_FromTCHAR(str); } *************** *** 924,927 **** }; ! PyCCtrlView_Type PyCRichEditCtrl::type("PyCRichEditCtrl",&ui_control_object::type, &PyCRichEditCtrl::type, RUNTIME_CLASS(CRichEditCtrl), sizeof(PyCRichEditCtrl), PyCRichEditCtrl_methods, GET_PY_CTOR(PyCRichEditCtrl)); --- 914,924 ---- }; ! PyCCtrlView_Type PyCRichEditCtrl::type("PyCRichEditCtrl", ! &ui_control_object::type, ! &PyCRichEditCtrl::type, ! RUNTIME_CLASS(CRichEditCtrl), ! sizeof(PyCRichEditCtrl), ! PYOBJ_OFFSET(PyCRichEditCtrl), ! PyCRichEditCtrl_methods, ! GET_PY_CTOR(PyCRichEditCtrl)); Index: win32view.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32view.cpp,v retrieving revision 1.4.2.2 retrieving revision 1.4.2.3 diff -C2 -d -r1.4.2.2 -r1.4.2.3 *** win32view.cpp 4 Sep 2008 02:27:19 -0000 1.4.2.2 --- win32view.cpp 28 Dec 2008 10:55:49 -0000 1.4.2.3 *************** *** 410,413 **** --- 410,414 ---- RUNTIME_CLASS(CView), sizeof(PyCView), + PYOBJ_OFFSET(PyCView), PyCView_methods, NULL); *************** *** 626,629 **** --- 627,631 ---- RUNTIME_CLASS(CScrollView), sizeof(PyCScrollView), + PYOBJ_OFFSET(PyCScrollView), PyCScrollView_methods, GET_PY_CTOR(PyCScrollView)); *************** *** 684,687 **** --- 686,690 ---- RUNTIME_CLASS(CCtrlView), sizeof(PyCCtrlView), + PYOBJ_OFFSET(PyCCtrlView), PyCCtrlView_methods, GET_PY_CTOR(PyCCtrlView)); *************** *** 942,946 **** // @base PyCEditView|PyCCtrlView ! PyCCtrlView_Type PyCEditView::type("PyCEditView", &PyCCtrlView::type, &PyCEdit::type, RUNTIME_CLASS(CEditView), sizeof(PyCEditView), ui_edit_window_methods, GET_PY_CTOR(PyCEditView)); ///////////////////////////////////////////////////////////////////// --- 945,956 ---- // @base PyCEditView|PyCCtrlView ! PyCCtrlView_Type PyCEditView::type("PyCEditView", ! &PyCCtrlView::type, ! &PyCEdit::type, ! RUNTIME_CLASS(CEditView), ! sizeof(PyCEditView), ! PYOBJ_OFFSET(PyCEditView), ! ui_edit_window_methods, ! GET_PY_CTOR(PyCEditView)); ///////////////////////////////////////////////////////////////////// *************** *** 1023,1026 **** --- 1033,1037 ---- RUNTIME_CLASS(CListView), sizeof(PyCListView), + PYOBJ_OFFSET(PyCListView), ui_list_view_methods, GET_PY_CTOR(PyCListView)); *************** *** 1104,1107 **** --- 1115,1119 ---- RUNTIME_CLASS(CTreeView), sizeof(PyCTreeView), + PYOBJ_OFFSET(PyCTreeView), ui_tree_view_methods, GET_PY_CTOR(PyCTreeView)); *************** *** 1165,1168 **** --- 1177,1181 ---- RUNTIME_CLASS(CFormView), sizeof(PyCFormView), + PYOBJ_OFFSET(PyCFormView), PyCFormView_methods, GET_PY_CTOR(PyCFormView)); Index: win32rgn.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32rgn.cpp,v retrieving revision 1.2 retrieving revision 1.2.4.1 diff -C2 -d -r1.2 -r1.2.4.1 *** win32rgn.cpp 1 Jul 2002 15:09:40 -0000 1.2 --- win32rgn.cpp 28 Dec 2008 10:55:49 -0000 1.2.4.1 *************** *** 180,183 **** --- 180,184 ---- RUNTIME_CLASS(CRgn), sizeof(PyCRgn), + PYOBJ_OFFSET(PyCRgn), PyCRgn_methods, GET_PY_CTOR(PyCRgn)); Index: win32dlg.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32dlg.cpp,v retrieving revision 1.10.2.2 retrieving revision 1.10.2.3 diff -C2 -d -r1.10.2.2 -r1.10.2.3 *** win32dlg.cpp 4 Dec 2008 00:07:22 -0000 1.10.2.2 --- win32dlg.cpp 28 Dec 2008 10:55:49 -0000 1.10.2.3 *************** *** 216,219 **** --- 216,220 ---- static PyObject *do_exchange_edit( int id, int index, char *type, PyObject *oldVal, PyObject *o1, PyObject *o2, CDataExchange *pDX ) { + // Note use of funky exception handlers to ensure thread-state remains correct even when MFC exception is thrown. PyObject *newOb; switch (type[0]) { *************** *** 222,228 **** if (oldVal) intVal = (int)PyInt_AsLong(oldVal); ! GUI_BGN_SAVE; ! DDX_Text(pDX, id, intVal); ! GUI_END_SAVE; if (o1 && o2) { if (PyInt_Check(o1) && PyInt_Check(o2)) --- 223,238 ---- if (oldVal) intVal = (int)PyInt_AsLong(oldVal); ! PyThreadState *_save = PyEval_SaveThread(); ! TRY ! { ! DDX_Text(pDX, id, intVal); ! PyEval_RestoreThread(_save); ! } ! CATCH_ALL(e) ! { ! PyEval_RestoreThread(_save); ! THROW(e); ! } ! END_CATCH_ALL if (o1 && o2) { if (PyInt_Check(o1) && PyInt_Check(o2)) *************** *** 245,251 **** csVal=_T(""); } ! GUI_BGN_SAVE; ! DDX_Text(pDX, id, csVal); ! GUI_END_SAVE; if (o1 && o2) { if (PyInt_Check(o1) && o2==NULL) --- 255,270 ---- csVal=_T(""); } ! PyThreadState *_save = PyEval_SaveThread(); ! TRY ! { ! DDX_Text(pDX, id, csVal); ! PyEval_RestoreThread(_save); ! } ! CATCH_ALL(e) ! { ! PyEval_RestoreThread(_save); ! THROW(e); ! } ! END_CATCH_ALL if (o1 && o2) { if (PyInt_Check(o1) && o2==NULL) *************** *** 400,404 **** { CEnterLeavePython _celp; ! PyCDialog *dob = (PyCDialog *) ui_assoc_object::GetPyObject(pDlg); if (!dob) { TRACE("do_exchange called on dialog with no Python object!\n"); --- 419,423 ---- { CEnterLeavePython _celp; ! PyCDialog *dob = (PyCDialog *) ui_assoc_object::GetAssocObject(pDlg); if (!dob) { TRACE("do_exchange called on dialog with no Python object!\n"); *************** *** 447,450 **** --- 466,470 ---- if (PyErr_Occurred()) gui_print_error(); + Py_DECREF(dob); } *************** *** 732,735 **** --- 752,756 ---- RUNTIME_CLASS(CDialog), sizeof(PyCDialog), + PYOBJ_OFFSET(PyCDialog), ui_dialog_methods, GET_PY_CTOR(PyCDialog)); *************** *** 744,747 **** --- 765,769 ---- NULL, // CCommonDialog doesnt have RTTI??? sizeof(PyCCommonDialog), + PYOBJ_OFFSET(PyCCommonDialog), ui_common_dialog_methods, NULL); *************** *** 966,969 **** --- 988,992 ---- RUNTIME_CLASS(CFileDialog), sizeof(PyCFileDialog), + PYOBJ_OFFSET(PyCFileDialog), ui_file_dialog_methods, GET_PY_CTOR(PyCFileDialog)); *************** *** 1175,1178 **** --- 1198,1202 ---- RUNTIME_CLASS(CFontDialog), sizeof(PyCFontDialog), + PYOBJ_OFFSET(PyCFontDialog), ui_font_dialog_methods, GET_PY_CTOR(PyCFontDialog)); *************** *** 1332,1335 **** --- 1356,1360 ---- RUNTIME_CLASS(CColorDialog), sizeof(PyCColorDialog), + PYOBJ_OFFSET(PyCColorDialog), ui_color_dialog_methods, GET_PY_CTOR(PyCColorDialog)); *************** *** 1436,1439 **** --- 1461,1465 ---- RUNTIME_CLASS(CPrintDialog), sizeof(PyCPrintDialog), + PYOBJ_OFFSET(PyCPrintDialog), ui_print_dialog_methods, GET_PY_CTOR(PyCPrintDialog)); Index: win32ctrlTree.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32ctrlTree.cpp,v retrieving revision 1.6.2.3 retrieving revision 1.6.2.4 diff -C2 -d -r1.6.2.3 -r1.6.2.4 *** win32ctrlTree.cpp 4 Sep 2008 02:27:19 -0000 1.6.2.3 --- win32ctrlTree.cpp 28 Dec 2008 10:55:49 -0000 1.6.2.4 *************** *** 857,860 **** --- 857,861 ---- RUNTIME_CLASS(CTreeCtrl), sizeof(PyCTreeCtrl), + PYOBJ_OFFSET(PyCTreeCtrl), PyCTreeCtrl_methods, GET_PY_CTOR(PyCTreeCtrl)); Index: stdafx.h =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/stdafx.h,v retrieving revision 1.2 retrieving revision 1.2.4.1 diff -C2 -d -r1.2 -r1.2.4.1 *** stdafx.h 14 Mar 2000 23:29:09 -0000 1.2 --- stdafx.h 28 Dec 2008 10:55:48 -0000 1.2.4.1 *************** *** 4,10 **** // - //#define HIER_LIST Yay - no more - tree control now used! #define WIN32_LEAN_AND_MEAN #include <afxwin.h> // MFC core and standard components --- 4,15 ---- // #define WIN32_LEAN_AND_MEAN + #ifndef WINVER + // we don't need this, but vs2009 makes noise without it set to something - + // and this is what we currently use... + #define WINVER 0x0600 + #endif + #include <afxwin.h> // MFC core and standard components Index: win32virt.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32virt.cpp,v retrieving revision 1.6.2.2 retrieving revision 1.6.2.3 diff -C2 -d -r1.6.2.2 -r1.6.2.3 *** win32virt.cpp 6 Dec 2008 01:48:26 -0000 1.6.2.2 --- win32virt.cpp 28 Dec 2008 10:55:49 -0000 1.6.2.3 *************** *** 19,23 **** extern BOOL bInFatalShutdown; ! CVirtualHelper::CVirtualHelper(const char *iname, const void *iassoc, EnumVirtualErrorHandling veh/* = VEH_PRINT_ERROR */) { handler=NULL; --- 19,23 ---- extern BOOL bInFatalShutdown; ! CVirtualHelper::CVirtualHelper(const char *iname, void *iassoc, EnumVirtualErrorHandling veh/* = VEH_PRINT_ERROR */) { handler=NULL; *************** *** 26,35 **** csHandlerName = iname; vehErrorHandling = veh; ui_assoc_object *py_bob = ui_assoc_object::handleMgr.GetAssocObject( iassoc ); ! if (bInFatalShutdown || py_bob==NULL) return; CEnterLeavePython _celp; if (!py_bob->is_uiobject( &ui_assoc_object::type)) { TRACE("CVirtualHelper::CVirtualHelper Error: Call object is not of required type\n"); return; } --- 26,38 ---- csHandlerName = iname; vehErrorHandling = veh; + if (bInFatalShutdown) + return; ui_assoc_object *py_bob = ui_assoc_object::handleMgr.GetAssocObject( iassoc ); ! if (py_bob==NULL) return; CEnterLeavePython _celp; if (!py_bob->is_uiobject( &ui_assoc_object::type)) { TRACE("CVirtualHelper::CVirtualHelper Error: Call object is not of required type\n"); + Py_DECREF(py_bob); return; } *************** *** 53,58 **** } py_ob = py_bob; ! Py_INCREF(py_ob); } CVirtualHelper::~CVirtualHelper() { --- 56,62 ---- } py_ob = py_bob; ! // reference on 'py_bob' now owned by 'py_ob' } + CVirtualHelper::~CVirtualHelper() { Index: win32splitter.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32splitter.cpp,v retrieving revision 1.2.4.1 retrieving revision 1.2.4.2 diff -C2 -d -r1.2.4.1 -r1.2.4.2 *** win32splitter.cpp 29 Aug 2008 05:53:29 -0000 1.2.4.1 --- win32splitter.cpp 28 Dec 2008 10:55:49 -0000 1.2.4.2 *************** *** 246,249 **** --- 246,250 ---- RUNTIME_CLASS(CSplitterWnd), sizeof(PyCSplitterWnd), + PYOBJ_OFFSET(PyCSplitterWnd), ui_splitter_window_methods, GET_PY_CTOR(PyCSplitterWnd)); Index: ddeconv.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/ddeconv.cpp,v retrieving revision 1.1.4.2 retrieving revision 1.1.4.3 diff -C2 -d -r1.1.4.2 -r1.1.4.3 *** ddeconv.cpp 6 Dec 2008 01:48:26 -0000 1.1.4.2 --- ddeconv.cpp 28 Dec 2008 10:55:48 -0000 1.1.4.3 *************** *** 131,134 **** --- 131,135 ---- RUNTIME_CLASS(CDDEConv), sizeof(PyDDEConv), + PYOBJ_OFFSET(PyDDEConv), PyDDEConv_methods, GET_PY_CTOR(PyDDEConv)); Index: win32thread.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32thread.cpp,v retrieving revision 1.9.2.1 retrieving revision 1.9.2.2 diff -C2 -d -r1.9.2.1 -r1.9.2.2 *** win32thread.cpp 29 Aug 2008 05:53:29 -0000 1.9.2.1 --- win32thread.cpp 28 Dec 2008 10:55:49 -0000 1.9.2.2 *************** *** 331,334 **** --- 331,335 ---- RUNTIME_CLASS(CWinThread), sizeof(PyCWinThread), + PYOBJ_OFFSET(PyCWinThread), PyCWinThread_methods, GET_PY_CTOR(PyCWinThread) ); Index: win32doc.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32doc.cpp,v retrieving revision 1.5.4.1 retrieving revision 1.5.4.2 diff -C2 -d -r1.5.4.1 -r1.5.4.2 *** win32doc.cpp 29 Aug 2008 05:53:29 -0000 1.5.4.1 --- win32doc.cpp 28 Dec 2008 10:55:49 -0000 1.5.4.2 *************** *** 443,446 **** --- 443,447 ---- RUNTIME_CLASS(CDocument), sizeof(PyCDocument), + PYOBJ_OFFSET(PyCDocument), ui_doc_methods, GET_PY_CTOR(PyCDocument) ); Index: win32prop.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32prop.cpp,v retrieving revision 1.3.2.1 retrieving revision 1.3.2.2 diff -C2 -d -r1.3.2.1 -r1.3.2.2 *** win32prop.cpp 29 Aug 2008 05:53:29 -0000 1.3.2.1 --- win32prop.cpp 28 Dec 2008 10:55:49 -0000 1.3.2.2 *************** *** 106,122 **** { } - /******** - TRACE("PropSheet object destructing\n"); - CPythonPropertySheet *pSheet = GetPythonPropSheet(this); - ASSERT(pSheet); - PyCWnd::DoKillAssoc(TRUE); - ui_assoc_object::SetAssocInvalid(); // must call this explicitely, as I ignore SetAssocInvalid - } - - void PyCPropertySheet::DoKillAssoc(BOOL bDestructing ) - { - return; - } - *************/ // @pymethod <o PyCPropertySheet>|win32ui|CreatePropertySheet|Creates a property sheet object. PyObject *PyCPropertySheet::create( PyObject *self, PyObject *args ) --- 106,109 ---- *************** *** 581,584 **** --- 568,572 ---- RUNTIME_CLASS(CPropertySheet), sizeof(PyCPropertySheet), + PYOBJ_OFFSET(PyCPropertySheet), ui_propsheet_methods, GET_PY_CTOR(PyCPropertySheet)); *************** *** 862,865 **** --- 850,854 ---- RUNTIME_CLASS(CPropertyPage), sizeof(PyCPropertyPage), + PYOBJ_OFFSET(PyCPropertyPage), ui_proppage_methods, GET_PY_CTOR(PyCPropertyPage)); *************** *** 938,941 **** --- 927,931 ---- RUNTIME_CLASS(CTabCtrl), sizeof(ui_tabctrl_object), + PYOBJ_OFFSET(ui_tabctrl_object), ui_tabctrl_methods, GET_PY_CTOR(ui_tabctrl_object)); Index: win32notify.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32notify.cpp,v retrieving revision 1.7.2.3 retrieving revision 1.7.2.4 diff -C2 -d -r1.7.2.3 -r1.7.2.4 *** win32notify.cpp 13 Nov 2008 05:02:23 -0000 1.7.2.3 --- win32notify.cpp 28 Dec 2008 10:55:49 -0000 1.7.2.4 *************** *** 240,250 **** Python_OnNotify (CWnd *pFrom, WPARAM, LPARAM lParam, LRESULT *pResult) { - CEnterLeavePython _celp; - PyCCmdTarget *pPyWnd = (PyCCmdTarget *) ui_assoc_CObject::GetPyObject(pFrom); NMHDR *pHdr = (NMHDR *)lParam; - if (pHdr==NULL) return FALSE; // bad data passed? UINT code = pHdr->code; if (pPyWnd==NULL) return FALSE; // no object. --- 240,249 ---- Python_OnNotify (CWnd *pFrom, WPARAM, LPARAM lParam, LRESULT *pResult) { NMHDR *pHdr = (NMHDR *)lParam; if (pHdr==NULL) return FALSE; // bad data passed? UINT code = pHdr->code; + CEnterLeavePython _celp; + PyCCmdTarget *pPyWnd = (PyCCmdTarget *) ui_assoc_CObject::GetAssocObject(pFrom); if (pPyWnd==NULL) return FALSE; // no object. *************** *** 253,258 **** if (!pPyWnd->pNotifyHookList || ! !pPyWnd->pNotifyHookList->Lookup (code, (void *&)method)) return FALSE; // no hook installed. // have method to call. Build arguments. --- 252,260 ---- if (!pPyWnd->pNotifyHookList || ! !pPyWnd->pNotifyHookList->Lookup (code, (void *&)method)) { ! Py_DECREF(pPyWnd); return FALSE; // no hook installed. + } + Py_DECREF(pPyWnd); // have method to call. Build arguments. Index: win32oleDlgInsert.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32oleDlgInsert.cpp,v retrieving revision 1.1.4.2 retrieving revision 1.1.4.3 diff -C2 -d -r1.1.4.2 -r1.1.4.3 *** win32oleDlgInsert.cpp 13 Nov 2008 05:02:23 -0000 1.1.4.2 --- win32oleDlgInsert.cpp 28 Dec 2008 10:55:49 -0000 1.1.4.3 *************** *** 217,220 **** --- 217,221 ---- RUNTIME_CLASS(COleInsertDialog), sizeof(PyCOleInsertDialog), + PYOBJ_OFFSET(PyCOleInsertDialog), PyCOleInsertDialog_methods, GET_PY_CTOR(PyCOleInsertDialog) ); Index: win32font.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32font.cpp,v retrieving revision 1.4 retrieving revision 1.4.2.1 diff -C2 -d -r1.4 -r1.4.2.1 *** win32font.cpp 3 Jun 2007 12:35:58 -0000 1.4 --- win32font.cpp 28 Dec 2008 10:55:49 -0000 1.4.2.1 *************** *** 62,66 **** } } ! return ui_assoc_object::make (PyCFont::type, pFont); } --- 62,69 ---- } } ! PyCFont *ret = (PyCFont *)ui_assoc_object::make (PyCFont::type, pFont, TRUE); ! if (ret) ! ret->bManualDelete = TRUE; ! return ret; } *************** *** 87,90 **** --- 90,94 ---- RUNTIME_CLASS(CFont), sizeof(PyCFont), + PYOBJ_OFFSET(PyCFont), ui_font_methods, GET_PY_CTOR(PyCFont)); Index: win32ImageList.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32ImageList.cpp,v retrieving revision 1.3.2.2 retrieving revision 1.3.2.3 diff -C2 -d -r1.3.2.2 -r1.3.2.3 *** win32ImageList.cpp 5 Oct 2008 22:46:24 -0000 1.3.2.2 --- win32ImageList.cpp 28 Dec 2008 10:55:48 -0000 1.3.2.3 *************** *** 276,280 **** &ui_assoc_CObject::type, RUNTIME_CLASS(CImageList), ! sizeof(PyCImageList), PyCImageList_methods, GET_PY_CTOR(PyCImageList)); --- 276,281 ---- &ui_assoc_CObject::type, RUNTIME_CLASS(CImageList), ! sizeof(PyCImageList), ! PYOBJ_OFFSET(PyCImageList), PyCImageList_methods, GET_PY_CTOR(PyCImageList)); Index: win32assoc.h =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32assoc.h,v retrieving revision 1.2 retrieving revision 1.2.4.1 diff -C2 -d -r1.2 -r1.2.4.1 *** win32assoc.h 7 Sep 2004 02:26:20 -0000 1.2 --- win32assoc.h 28 Dec 2008 10:55:48 -0000 1.2.4.1 *************** *** 24,34 **** ~CAssocManager(); void Assoc(void *assoc, ui_assoc_object *PyObject, void *oldAssoc=NULL); ! ui_assoc_object *GetAssocObject(const void * handle); void cleanup(void); // only to be called at the _very_ end private: CMapPtrToPtr map; const void *lastLookup; ! ui_assoc_object *lastObject; CCriticalSection m_critsec; #ifdef _DEBUG --- 24,37 ---- ~CAssocManager(); void Assoc(void *assoc, ui_assoc_object *PyObject, void *oldAssoc=NULL); ! ui_assoc_object *GetAssocObject(void * handle); void cleanup(void); // only to be called at the _very_ end private: + void RemoveAssoc(void *handle); + // A "map" of weak-references to Python objects. Now we use weakrefs + // this really should be a regular Python dict... CMapPtrToPtr map; const void *lastLookup; ! PyObject *lastObjectWeakRef; CCriticalSection m_critsec; #ifdef _DEBUG *************** *** 47,51 **** // Given a C++ object, return a PyObject associated (map lookup) ! static ui_assoc_object *GetPyObject(void *search); // Return the C++ object associated with this Python object. --- 50,56 ---- // Given a C++ object, return a PyObject associated (map lookup) ! static ui_assoc_object *GetAssocObject(void *search) { ! return ui_assoc_object::handleMgr.GetAssocObject(search); ! } // Return the C++ object associated with this Python object. Index: win32control.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32control.cpp,v retrieving revision 1.6.2.1 retrieving revision 1.6.2.2 diff -C2 -d -r1.6.2.1 -r1.6.2.2 *** win32control.cpp 29 Aug 2008 05:53:29 -0000 1.6.2.1 --- win32control.cpp 28 Dec 2008 10:55:49 -0000 1.6.2.2 *************** *** 59,62 **** --- 59,63 ---- RUNTIME_CLASS(CObject), sizeof(ui_control_object), + PYOBJ_OFFSET(ui_control_object), ui_control_object_methods, NULL); *************** *** 265,268 **** --- 266,270 ---- RUNTIME_CLASS(CButton), sizeof(PyCButton), + PYOBJ_OFFSET(PyCButton), PyCButton_methods, GET_PY_CTOR(PyCButton)); *************** *** 879,882 **** --- 881,885 ---- RUNTIME_CLASS(CListBox), sizeof(PyCListBox), + PYOBJ_OFFSET(PyCListBox), PyCListBox_methods, GET_PY_CTOR(PyCListBox)); *************** *** 1317,1320 **** --- 1320,1324 ---- RUNTIME_CLASS(CComboBox), sizeof(PyCComboBox), + PYOBJ_OFFSET(PyCComboBox), PyCComboBox_methods, GET_PY_CTOR(PyCComboBox)); *************** *** 1476,1479 **** --- 1480,1484 ---- RUNTIME_CLASS(CProgressCtrl), sizeof(PyCProgressCtrl), + PYOBJ_OFFSET(PyCProgressCtrl), PyCProgressCtrl_methods, GET_PY_CTOR(PyCProgressCtrl)); *************** *** 1991,1994 **** --- 1996,2000 ---- RUNTIME_CLASS(CSliderCtrl), sizeof(PyCSliderCtrl), + PYOBJ_OFFSET(PyCSliderCtrl), PyCSliderCtrl_methods, GET_PY_CTOR(PyCSliderCtrl)); *************** *** 2438,2441 **** --- 2444,2448 ---- RUNTIME_CLASS(CStatusBarCtrl), sizeof(PyCStatusBarCtrl), + PYOBJ_OFFSET(PyCStatusBarCtrl), PyCStatusBarCtrl_methods, GET_PY_CTOR(PyCStatusBarCtrl)); *************** *** 2526,2529 **** --- 2533,2537 ---- RUNTIME_CLASS(CSpinButtonCtrl), sizeof(PyCSpinButtonCtrl), + PYOBJ_OFFSET(PyCSpinButtonCtrl), PyCSpinButtonCtrl_methods, GET_PY_CTOR(PyCSpinButtonCtrl)); Index: win32pen.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32pen.cpp,v retrieving revision 1.1 retrieving revision 1.1.4.1 diff -C2 -d -r1.1 -r1.1.4.1 *** win32pen.cpp 1 Sep 1999 23:33:02 -0000 1.1 --- win32pen.cpp 28 Dec 2008 10:55:49 -0000 1.1.4.1 *************** *** 53,56 **** --- 53,57 ---- RUNTIME_CLASS(CPen), sizeof(ui_pen_object), + PYOBJ_OFFSET(ui_pen_object), ui_pen_methods, GET_PY_CTOR(ui_pen_object)); Index: win32ctrlList.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32ctrlList.cpp,v retrieving revision 1.3.2.3 retrieving revision 1.3.2.4 diff -C2 -d -r1.3.2.3 -r1.3.2.4 *** win32ctrlList.cpp 4 Sep 2008 02:27:19 -0000 1.3.2.3 --- win32ctrlList.cpp 28 Dec 2008 10:55:49 -0000 1.3.2.4 *************** *** 835,838 **** --- 835,839 ---- RUNTIME_CLASS(CListCtrl), sizeof(PyCListCtrl), + PYOBJ_OFFSET(PyCListCtrl), PyCListCtrl_methods, GET_PY_CTOR(PyCListCtrl)); Index: win32gdi.h =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32gdi.h,v retrieving revision 1.1 retrieving revision 1.1.4.1 diff -C2 -d -r1.1 -r1.1.4.1 *** win32gdi.h 1 Sep 1999 23:33:02 -0000 1.1 --- win32gdi.h 28 Dec 2008 10:55:49 -0000 1.1.4.1 *************** *** 16,30 **** static CBitmap *GetBitmap (PyObject *self) { return (CBitmap *)GetGdiObject(self, OBJ_BITMAP); } CBitmap *GetBitmap() { return GetBitmap (this); } - BOOL m_deleteObject; protected: PyCGdiObject() - : m_deleteObject(TRUE) { } ~PyCGdiObject(); - virtual void DoKillAssoc( BOOL bDestructing = FALSE ); virtual bool CheckCppObject(ui_type *ui_type_check) const; ! // virtuals for the Python interface. ! virtual CString repr(); }; --- 16,30 ---- static CBitmap *GetBitmap (PyObject *self) { return (CBitmap *)GetGdiObject(self, OBJ_BITMAP); } CBitmap *GetBitmap() { return GetBitmap (this); } protected: PyCGdiObject() { } ~PyCGdiObject(); virtual bool CheckCppObject(ui_type *ui_type_check) const; ! // XXX - PyCGDIObject used to have an 'm_deleteObject' attribute - but all ! // it did was cause a normal 'delete' of the object - ie, identical to the ! // base-class bManualDelete. Its likely the original intent was for the new ! // attribute to determine if ::DeleteObject() should have been called, but ! // that apparently has never happened... }; Index: win32RichEdit.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32RichEdit.cpp,v retrieving revision 1.2.4.1 retrieving revision 1.2.4.2 diff -C2 -d -r1.2.4.1 -r1.2.4.2 *** win32RichEdit.cpp 29 Aug 2008 05:53:29 -0000 1.2.4.1 --- win32RichEdit.cpp 28 Dec 2008 10:55:48 -0000 1.2.4.2 *************** *** 83,86 **** --- 83,87 ---- RUNTIME_CLASS(CRichEditDoc), sizeof(PyCRichEditDoc), + PYOBJ_OFFSET(PyCRichEditDoc), PyCRichEditDoc_methods, GET_PY_CTOR(PyCRichEditDoc) ); *************** *** 227,230 **** }; ! PyCCtrlView_Type PyCRichEditView::type("PyCRichEditView", &PyCCtrlView::type, &PyCRichEditCtrl::type, RUNTIME_CLASS(CRichEditView), sizeof(PyCRichEditView), PyCRichEditView_methods, GET_PY_CTOR(PyCRichEditView)); --- 228,238 ---- }; ! PyCCtrlView_Type PyCRichEditView::type("PyCRichEditView", ! &PyCCtrlView::type, ! &PyCRichEditCtrl::type, ! RUNTIME_CLASS(CRichEditView), ! sizeof(PyCRichEditView), ! PYOBJ_OFFSET(PyCRichEditView), ! PyCRichEditView_methods, ! GET_PY_CTOR(PyCRichEditView)); Index: win32prinfo.h =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32prinfo.h,v retrieving revision 1.2 retrieving revision 1.2.4.1 diff -C2 -d -r1.2 -r1.2.4.1 *** win32prinfo.h 28 Oct 1999 01:38:31 -0000 1.2 --- win32prinfo.h 28 Dec 2008 10:55:49 -0000 1.2.4.1 *************** *** 5,9 **** ~ui_prinfo_object(); virtual void SetAssocInvalid(); - virtual void DoKillAssoc( BOOL bDestructing = FALSE ); virtual void *GetGoodCppObject(ui_type *ui_type_check=NULL) const; --- 5,8 ---- Index: win32dlgbar.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32dlgbar.cpp,v retrieving revision 1.1.4.1 retrieving revision 1.1.4.2 diff -C2 -d -r1.1.4.1 -r1.1.4.2 *** win32dlgbar.cpp 29 Aug 2008 05:53:29 -0000 1.1.4.1 --- win32dlgbar.cpp 28 Dec 2008 10:55:49 -0000 1.1.4.2 *************** *** 85,88 **** --- 85,89 ---- RUNTIME_CLASS(CDialogBar), sizeof(PyCDialogBar), + PYOBJ_OFFSET(PyCDialogBar), PyCDialogBar_methods, GET_PY_CTOR(PyCDialogBar)); Index: win32uioleClientItem.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32uioleClientItem.cpp,v retrieving revision 1.1.4.1 retrieving revision 1.1.4.2 diff -C2 -d -r1.1.4.1 -r1.1.4.2 *** win32uioleClientItem.cpp 29 Aug 2008 05:53:30 -0000 1.1.4.1 --- win32uioleClientItem.cpp 28 Dec 2008 10:55:49 -0000 1.1.4.2 *************** *** 370,373 **** --- 370,374 ---- RUNTIME_CLASS(COleClientItem), sizeof(PyCOleClientItem), + PYOBJ_OFFSET(PyCOleClientItem), PyCOleClientItem_methods, GET_PY_CTOR(PyCOleClientItem) ); Index: win32dll.h =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32dll.h,v retrieving revision 1.1 retrieving revision 1.1.4.1 diff -C2 -d -r1.1 -r1.1.4.1 *** win32dll.h 1 Sep 1999 23:33:01 -0000 1.1 --- win32dll.h 28 Dec 2008 10:55:49 -0000 1.1.4.1 *************** *** 15,19 **** dll_object(); ~dll_object(); - virtual void DoKillAssoc( BOOL bDestructing = FALSE ); virtual CString repr(); private: --- 15,18 ---- Index: win32cmd.h =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32cmd.h,v retrieving revision 1.1 retrieving revision 1.1.4.1 diff -C2 -d -r1.1 -r1.1.4.1 *** win32cmd.h 1 Sep 1999 23:33:00 -0000 1.1 --- win32cmd.h 28 Dec 2008 10:55:49 -0000 1.1.4.1 *************** *** 8,12 **** // class PYW_EXPORT PyCCmdTarget : public ui_assoc_CObject{ ! friend CVirtualHelper::CVirtualHelper(const char *iname, const void *iassoc, EnumVirtualErrorHandling veh); public: // some probably shouldnt be, but... CMapWordToPtr *pNotifyHookList; --- 8,12 ---- // class PYW_EXPORT PyCCmdTarget : public ui_assoc_CObject{ ! friend CVirtualHelper::CVirtualHelper(const char *iname, void *iassoc, EnumVirtualErrorHandling veh); public: // some probably shouldnt be, but... CMapWordToPtr *pNotifyHookList; Index: win32brush.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32brush.cpp,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -C2 -d -r1.2 -r1.2.2.1 *** win32brush.cpp 3 Jun 2007 12:35:57 -0000 1.2 --- win32brush.cpp 28 Dec 2008 10:55:48 -0000 1.2.2.1 *************** *** 26,31 **** PyObject *ui_get_halftone_brush(PyObject *self, PyObject *args) { ! PyCBrush *pb = (PyCBrush *)ui_assoc_object::make (PyCBrush::type, CDC::GetHalftoneBrush()); ! pb->m_deleteObject = FALSE; // this is a temp object return pb; } --- 26,31 ---- PyObject *ui_get_halftone_brush(PyObject *self, PyObject *args) { ! PyCBrush *pb = (PyCBrush *)ui_assoc_object::make (PyCBrush::type, CDC::GetHalftoneBrush(), true); ! pb->bManualDelete = FALSE; // this is a temp object return pb; } *************** *** 39,46 **** long cr_color; LOGBRUSH lp; ! // Quick exist to make a empty brush if (PyArg_ParseTuple(args, "")) { // @comm If called with no arguments, an uninitialized brush is created. ! return ui_assoc_object::make (PyCBrush::type, new CBrush); } PyErr_Clear(); --- 39,48 ---- long cr_color; LOGBRUSH lp; ! // Quick exit to make a empty brush if (PyArg_ParseTuple(args, "")) { // @comm If called with no arguments, an uninitialized brush is created. ! PyCBrush *ret = (PyCBrush *)ui_assoc_object::make (PyCBrush::type, new CBrush); ! ret->bManualDelete = TRUE; ! return ret; } PyErr_Clear(); *************** *** 59,63 **** RETURN_ERR ("CreateBrushIndirect call failed"); } ! return ui_assoc_object::make (PyCBrush::type, pBrush); } --- 61,67 ---- RETURN_ERR ("CreateBrushIndirect call failed"); } ! PyCBrush *ret = (PyCBrush *)ui_assoc_object::make (PyCBrush::type, pBrush); ! ret->bManualDelete = TRUE; ! return ret; } *************** *** 95,98 **** --- 99,103 ---- RUNTIME_CLASS(CBrush), sizeof(PyCBrush), + PYOBJ_OFFSET(PyCBrush), PyCBrush_methods, GET_PY_CTOR(PyCBrush)); Index: win32win.h =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32win.h,v retrieving revision 1.3.2.1 retrieving revision 1.3.2.2 diff -C2 -d -r1.3.2.1 -r1.3.2.2 *** win32win.h 29 Aug 2008 05:53:30 -0000 1.3.2.1 --- win32win.h 28 Dec 2008 10:55:49 -0000 1.3.2.2 *************** *** 17,21 **** PyCWnd(); ~PyCWnd(); - virtual void DoKillAssoc( BOOL bDestructing = FALSE ); public: static CWnd *GetPythonGenericWnd(PyObject *self, ui_type_CObject *pType = &type); --- 17,20 ---- Index: ddetopic.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/ddetopic.cpp,v retrieving revision 1.1 retrieving revision 1.1.4.1 diff -C2 -d -r1.1 -r1.1.4.1 *** ddetopic.cpp 10 Nov 2003 04:39:44 -0000 1.1 --- ddetopic.cpp 28 Dec 2008 10:55:48 -0000 1.1.4.1 *************** *** 55,58 **** --- 55,59 ---- RUNTIME_CLASS(CDDETopic), sizeof(PyDDETopic), + PYOBJ_OFFSET(PyDDETopic), PyDDETopic_methods, GET_PY_CTOR(PyDDETopic)); *************** *** 73,76 **** --- 74,78 ---- RUNTIME_CLASS(CDDEServerSystemTopic), sizeof(PyDDEServerSystemTopic), + PYOBJ_OFFSET(PyDDEServerSystemTopic), PyDDEServerSystemTopic_methods, GET_PY_CTOR(PyDDEServerSystemTopic)); Index: win32template.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32template.cpp,v retrieving revision 1.4.2.2 retrieving revision 1.4.2.3 diff -C2 -d -r1.4.2.2 -r1.4.2.3 *** win32template.cpp 13 Nov 2008 05:02:23 -0000 1.4.2.2 --- win32template.cpp 28 Dec 2008 10:55:49 -0000 1.4.2.3 *************** *** 413,416 **** --- 413,417 ---- RUNTIME_CLASS(CDocTemplate), sizeof(PyCDocTemplate), + PYOBJ_OFFSET(PyCDocTemplate), PyCDocTemplate_methods, GET_PY_CTOR(PyCDocTemplate) ); Index: win32dll.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32dll.cpp,v retrieving revision 1.1.4.1 retrieving revision 1.1.4.2 diff -C2 -d -r1.1.4.1 -r1.1.4.2 *** win32dll.cpp 29 Aug 2008 05:53:29 -0000 1.1.4.1 --- win32dll.cpp 28 Dec 2008 10:55:49 -0000 1.1.4.2 *************** *** 22,28 **** dll_object::~dll_object() { ! if (bDidLoadLibrary) ! dll_object::DoKillAssoc(TRUE); // must explicitly call, as virtuals dont work in dtors! } // @pymethod <o PyDLL>|win32ui|LoadLibrary|Creates a DLL object, and loads a Windows DLL into the object. PyObject * --- 22,37 ---- dll_object::~dll_object() { ! if (bDidLoadLibrary = TRUE) { ! ::FreeLibrary (GetDll()); ! TRACE("Python object freeing DLL reference\n"); ! } ! if (pMFCExt) { ! AfxTermExtensionModule(*pMFCExt); // this deletes the DLL. ! delete pMFCExt; ! pMFCExt = NULL; ! pCDLL = NULL; ! } } + // @pymethod <o PyDLL>|win32ui|LoadLibrary|Creates a DLL object, and loads a Windows DLL into the object. PyObject * *************** *** 62,79 **** return ret; } - void dll_object::DoKillAssoc( BOOL bDestructing /*= FALSE*/ ) - { - if (bDidLoadLibrary = TRUE) { - ::FreeLibrary (GetDll()); - TRACE("Python object freeing DLL reference\n"); - ui_assoc_object::DoKillAssoc(bDestructing); - } - if (pMFCExt) { - AfxTermExtensionModule(*pMFCExt); // this deletes the DLL. - delete pMFCExt; - pMFCExt = NULL; - pCDLL = NULL; - } - } // @pymethod |PyDLL|AttachToMFC|Attaches the DLL object to the MFC list of DLL's. // @comm After calling this method, MFC will search this DLL when looking for resources. --- 71,74 ---- *************** *** 151,154 **** --- 146,150 ---- &ui_assoc_object::type, sizeof(dll_object), + PYOBJ_OFFSET(dll_object), dll_methods, GET_PY_CTOR(dll_object)); Index: ddeserver.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/ddeserver.cpp,v retrieving revision 1.1.4.1 retrieving revision 1.1.4.2 diff -C2 -d -r1.1.4.1 -r1.1.4.2 *** ddeserver.cpp 29 Aug 2008 05:53:29 -0000 1.1.4.1 --- ddeserver.cpp 28 Dec 2008 10:55:48 -0000 1.1.4.2 *************** *** 142,145 **** --- 142,146 ---- RUNTIME_CLASS(CDDEServer), sizeof(PyDDEServer), + PYOBJ_OFFSET(PyDDEServer), PyDDEServer_methods, GET_PY_CTOR(PyDDEServer)); Index: win32ui.h =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32ui.h,v retrieving revision 1.7.2.5 retrieving revision 1.7.2.6 diff -C2 -d -r1.7.2.5 -r1.7.2.6 *** win32ui.h 6 Dec 2008 01:48:26 -0000 1.7.2.5 --- win32ui.h 28 Dec 2008 10:55:49 -0000 1.7.2.6 *************** *** 135,153 **** class PYW_EXPORT ui_type : public PyTypeObject { public: ! ui_type( const char *name, ui_type *pBaseType, int typeSize, struct PyMethodDef* methodList, ui_base_class * (* thector)() ); ~ui_type(); public: - // ui_type *base; struct PyMethodDef* methods; ui_base_class * (* ctor)(); }; // helper typeCObject class. class PYW_EXPORT ui_type_CObject : public ui_type { public: ! ui_type_CObject( const char *name, ui_type *pBaseType, CRuntimeClass *pRT, int typeSize, struct PyMethodDef* methodList, ui_base_class * (* thector)() ); ~ui_type_CObject(); public: - ui_type *base; CRuntimeClass *pCObjectClass; // A map of CRuntimeClass to these objects. Populated by the ctor. --- 135,155 ---- class PYW_EXPORT ui_type : public PyTypeObject { public: ! ui_type( const char *name, ui_type *pBaseType, int typeSize, int pyobjOffset, struct PyMethodDef* methodList, ui_base_class * (* thector)() ); ~ui_type(); public: struct PyMethodDef* methods; ui_base_class * (* ctor)(); }; + // a helper to calculate the offset from a ui_base_class child with a PyObject. + // Use a pointer value of 1 - can't use zero as casting NULL always ends up NULL. + #define PYOBJ_OFFSET(klass) ((BYTE *)(PyObject *)(klass *)1 - (BYTE *)(klass *)1) + // helper typeCObject class. class PYW_EXPORT ui_type_CObject : public ui_type { public: ! ui_type_CObject( const char *name, ui_type *pBaseType, CRuntimeClass *pRT, int typeSize, int pyobjOffset, struct PyMethodDef* methodList, ui_base_class * (* thector)() ); ~ui_type_CObject(); public: CRuntimeClass *pCObjectClass; // A map of CRuntimeClass to these objects. Populated by the ctor. *************** *** 214,219 **** public: static BOOL is_uiobject( PyObject *&, ui_type *which); - static BOOL ui_base_class::is_nativeuiobject(PyObject *ob, ui_type *which); - BOOL is_uiobject(ui_type *which); static void sui_dealloc(PyObject *ob); --- 216,219 ---- *************** *** 225,228 **** --- 225,229 ---- virtual void Dump( CDumpContext &dc ) const; #endif + PyObject *weakreflist; /* List of weak references */ private: char sig[sizeof(SIG)]; *************** *** 272,276 **** { public: ! CVirtualHelper(const char *iname, const void *iassoc, EnumVirtualErrorHandling veh = VEH_PRINT_ERROR); ~CVirtualHelper(); --- 273,277 ---- { public: ! CVirtualHelper(const char *iname, void *iassoc, EnumVirtualErrorHandling veh = VEH_PRINT_ERROR); ~CVirtualHelper(); Index: win32prinfo.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32prinfo.cpp,v retrieving revision 1.4 retrieving revision 1.4.2.1 diff -C2 -d -r1.4 -r1.4.2.1 *** win32prinfo.cpp 3 Jun 2007 12:35:58 -0000 1.4 --- win32prinfo.cpp 28 Dec 2008 10:55:49 -0000 1.4.2.1 *************** *** 72,76 **** } ! void ui_prinfo_object::DoKillAssoc( BOOL bDestructing /*= FALSE*/ ) { if (m_deletePrInfo) { --- 72,76 ---- } ! ui_prinfo_object::~ui_prinfo_object() { if (m_deletePrInfo) { *************** *** 87,96 **** }; } - ui_assoc_object::DoKillAssoc(bDestructing); - } - - ui_prinfo_object::~ui_prinfo_object() - { - DoKillAssoc(TRUE); } --- 87,90 ---- *************** *** 857,860 **** --- 851,855 ---- &ui_assoc_object::type, sizeof(ui_prinfo_object), + PYOBJ_OFFSET(ui_prinfo_object), ui_prinfo_methods, GET_PY_CTOR(ui_prinfo_object)); Index: pythonpsheet.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pythonpsheet.cpp,v retrieving revision 1.4 retrieving revision 1.4.2.1 diff -C2 -d -r1.4 -r1.4.2.1 *** pythonpsheet.cpp 24 May 2007 12:50:50 -0000 1.4 --- pythonpsheet.cpp 28 Dec 2008 10:55:48 -0000 1.4.2.1 *************** *** 203,212 **** m_customizeFont = FALSE; ! ui_assoc_object *py_bob = ui_assoc_object::handleMgr.GetAssocObject(this); ! if (bInFatalShutdown || py_bob==NULL) return; if (!py_bob->is_uiobject(&ui_assoc_object::type)) { TRACE("CVirtualHelper::CVirtualHelper Error: Call object is not of required type\n"); return; } --- 203,214 ---- m_customizeFont = FALSE; ! if (bInFatalShutdown) ! return; ui_assoc_object *py_bob = ui_assoc_object::handleMgr.GetAssocObject(this); ! if (py_bob==NULL) return; if (!py_bob->is_uiobject(&ui_assoc_object::type)) { TRACE("CVirtualHelper::CVirtualHelper Error: Call object is not of required type\n"); + Py_DECREF(py_bob); return; } *************** *** 223,226 **** --- 225,229 ---- PyErr_Restore(t,v,tb); } + Py_DECREF(py_bob); if (!m_customizeFont) { Index: win32dc.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32dc.cpp,v retrieving revision 1.4.2.1 retrieving revision 1.4.2.2 diff -C2 -d -r1.4.2.1 -r1.4.2.2 *** win32dc.cpp 29 Aug 2008 05:53:29 -0000 1.4.2.1 --- win32dc.cpp 28 Dec 2008 10:55:49 -0000 1.4.2.2 *************** *** 113,117 **** return; // do nothing. Dont call base as dont want my handle wiped. } ! void ui_dc_object::DoKillAssoc( BOOL bDestructing /*= FALSE*/ ) { if (m_deleteDC) { --- 113,118 ---- return; // do nothing. Dont call base as dont want my handle wiped. } ! ! ui_dc_object::~ui_dc_object() { if (m_deleteDC) { *************** *** 120,129 **** ::DeleteDC (pDC->m_hDC); } - ui_assoc_object::DoKillAssoc(bDestructing); - } - - ui_dc_object::~ui_dc_object() - { - DoKillAssoc(TRUE); } --- 121,124 ---- *************** *** 135,139 **** CDC *pDC = new CDC; ui_dc_object *dc = ! (ui_dc_object *) ui_assoc_object::make (ui_dc_object::type, pDC)->GetGoodRet(); return dc; } --- 130,136 ---- CDC *pDC = new CDC; ui_dc_object *dc = ! (ui_dc_object *) ui_assoc_object::make (ui_dc_object::type, pDC, true)->GetGoodRet(); ! if (dc) ! dc->bManualDelete= true; return dc; } *************** *** 1340,1347 **** RETURN_ERR ("Select font object failed"); else { ! PyCFont *ret = (PyCFont *)ui_assoc_object::make (PyCFont::type, cFont ); ! if (ret && ret->ob_refcnt == 1) // only set m_delete if new object ! ret->m_deleteObject = FALSE; ! return ret; } } else if (ui_base_class::is_uiobject (v, &ui_b... [truncated message content] |
From: Mark H. <mha...@us...> - 2008-12-28 10:55:53
|
Update of /cvsroot/pywin32/pywin32/Pythonwin/pywin/idle In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv26279/Pythonwin/pywin/idle Modified Files: Tag: py3k AutoIndent.py Log Message: merge lots of reference count leaks plus support for weakrefs Index: AutoIndent.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/idle/AutoIndent.py,v retrieving revision 1.3.2.6 retrieving revision 1.3.2.7 diff -C2 -d -r1.3.2.6 -r1.3.2.7 *** AutoIndent.py 26 Nov 2008 07:17:38 -0000 1.3.2.6 --- AutoIndent.py 28 Dec 2008 10:55:49 -0000 1.3.2.7 *************** *** 499,503 **** try: try: ! for (typ, token, start, end, line) in tokenize.tokenize(self.readline): if typ == NAME and token in OPENERS: self.blkopenline = line --- 499,503 ---- try: try: ! for (typ, token, start, end, line) in tokenize.generate_tokens(self.readline): if typ == NAME and token in OPENERS: self.blkopenline = line |
From: Mark H. <mha...@us...> - 2008-12-28 10:51:58
|
Update of /cvsroot/pywin32/pywin32/SWIG In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv25389/SWIG Added Files: Tag: py3k swig_py3k.exe Log Message: 2 different swigs for now --- NEW FILE: swig_py3k.exe --- (This appears to be a binary file; contents omitted.) |
From: Mark H. <mha...@us...> - 2008-12-28 10:51:57
|
Update of /cvsroot/pywin32/pywin32 In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv25389 Modified Files: Tag: py3k setup.py Log Message: 2 different swigs for now Index: setup.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/setup.py,v retrieving revision 1.81.2.11 retrieving revision 1.81.2.12 diff -C2 -d -r1.81.2.11 -r1.81.2.12 *** setup.py 16 Dec 2008 08:58:49 -0000 1.81.2.11 --- setup.py 28 Dec 2008 10:51:53 -0000 1.81.2.12 *************** *** 1137,1141 **** else: # We know where our swig is ! swig = os.path.abspath(r"swig\swig.exe") lib = os.path.join(os.path.dirname(swig), "swig_lib") os.environ["SWIG_LIB"] = lib --- 1137,1144 ---- else: # We know where our swig is ! if is_py3k: ! swig = os.path.abspath(r"swig\swig_py3k.exe") ! else: ! swig = os.path.abspath(r"swig\swig.exe") lib = os.path.join(os.path.dirname(swig), "swig_lib") os.environ["SWIG_LIB"] = lib |