pywin32-checkins Mailing List for Python for Windows Extensions (Page 57)
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...> - 2008-11-14 00:22:31
|
Update of /cvsroot/pywin32/pywin32/Pythonwin/pywin/idle In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv24802/Pythonwin/pywin/idle Modified Files: PyParse.py Log Message: Various modernizations to .py code via the py3k branch. Index: PyParse.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/idle/PyParse.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** PyParse.py 9 Aug 2008 16:47:07 -0000 1.5 --- PyParse.py 14 Nov 2008 00:22:25 -0000 1.6 *************** *** 3,13 **** import sys - try: - from types import UnicodeType - except ImportError: - from pywintypes import UnicodeType - # Reason last stmt is continued (or C_NONE if it's not). ! C_NONE, C_BACKSLASH, C_STRING, C_BRACKET = range(4) if 0: # for throwaway debugging output --- 3,8 ---- import sys # Reason last stmt is continued (or C_NONE if it's not). ! C_NONE, C_BACKSLASH, C_STRING, C_BRACKET = list(range(4)) if 0: # for throwaway debugging output *************** *** 119,135 **** def set_str(self, str): assert len(str) == 0 or str[-1] == '\n', "Oops - have str %r" % (str,) - if type(str) == UnicodeType: - # The parse functions have no idea what to do with Unicode, so - # replace all Unicode characters with "x". This is "safe" - # so long as the only characters germane to parsing the structure - # of Python are 7-bit ASCII. It's *necessary* because Unicode - # strings don't have a .translate() method that supports - # deletechars. - uniphooey = str - str = [] - push = str.append - for raw in map(ord, uniphooey): - push(raw < 127 and chr(raw) or "x") - str = "".join(str) self.str = str self.study_level = 0 --- 114,117 ---- |
From: Mark H. <mha...@us...> - 2008-11-14 00:22:31
|
Update of /cvsroot/pywin32/pywin32/Pythonwin/pywin/mfc In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv24802/Pythonwin/pywin/mfc Modified Files: activex.py afxres.py object.py Log Message: Various modernizations to .py code via the py3k branch. Index: object.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/mfc/object.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** object.py 1 Oct 2008 14:44:53 -0000 1.4 --- object.py 14 Nov 2008 00:22:25 -0000 1.5 *************** *** 31,35 **** self._obj_ = None def close(self): ! if self.__dict__.has_key('_obj_'): if self._obj_ is not None: self._obj_.AttachObject(None) --- 31,35 ---- self._obj_ = None def close(self): ! if '_obj_' in self.__dict__: if self._obj_ is not None: self._obj_.AttachObject(None) Index: activex.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/mfc/activex.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** activex.py 18 Apr 2005 13:36:47 -0000 1.3 --- activex.py 14 Nov 2008 00:22:25 -0000 1.4 *************** *** 29,33 **** def HookOleEvents(self): dict = self._GetEventMap() ! for dispid, methodName in dict.items(): if hasattr(self, methodName): self._obj_.HookOleEvent( getattr(self, methodName), dispid ) --- 29,33 ---- def HookOleEvents(self): dict = self._GetEventMap() ! for dispid, methodName in dict.iteritems(): if hasattr(self, methodName): self._obj_.HookOleEvent( getattr(self, methodName), dispid ) Index: afxres.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/mfc/afxres.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** afxres.py 10 Jan 2006 04:28:40 -0000 1.2 --- afxres.py 14 Nov 2008 00:22:25 -0000 1.3 *************** *** 54,58 **** AFX_IDW_DOCKBAR_BOTTOM = 0xE81E AFX_IDW_DOCKBAR_FLOAT = 0xE81F ! def AFX_CONTROLBAR_MASK(nIDC): return (1L << (nIDC - AFX_IDW_CONTROLBAR_FIRST)) AFX_IDW_PANE_FIRST = 0xE900 --- 54,58 ---- AFX_IDW_DOCKBAR_BOTTOM = 0xE81E AFX_IDW_DOCKBAR_FLOAT = 0xE81F ! def AFX_CONTROLBAR_MASK(nIDC): return (1 << (nIDC - AFX_IDW_CONTROLBAR_FIRST)) AFX_IDW_PANE_FIRST = 0xE900 |
From: Mark H. <mha...@us...> - 2008-11-14 00:22:31
|
Update of /cvsroot/pywin32/pywin32/Pythonwin/pywin/tools In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv24802/Pythonwin/pywin/tools Modified Files: browseProjects.py browser.py hierlist.py regpy.py Log Message: Various modernizations to .py code via the py3k branch. Index: regpy.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/tools/regpy.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** regpy.py 1 Sep 1999 23:33:57 -0000 1.1 --- regpy.py 14 Nov 2008 00:22:25 -0000 1.2 *************** *** 52,53 **** --- 52,56 ---- ps.AddPage(RegistryPage()) ps.DoModal() + + if __name__=='__main__': + t() Index: hierlist.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/tools/hierlist.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** hierlist.py 2 Oct 2008 13:03:55 -0000 1.8 --- hierlist.py 14 Nov 2008 00:22:25 -0000 1.9 *************** *** 14,18 **** # to provide maximum flexibility (but with extra work). ! import win32ui import win32con --- 14,18 ---- # to provide maximum flexibility (but with extra work). ! import sys import win32ui import win32con *************** *** 49,53 **** class HierList(object.Object): def __init__(self, root, bitmapID = win32ui.IDB_HIERFOLDERS, listBoxId = None, bitmapMask = None): # used to create object. ! self.list = None self.bitmapID = bitmapID self.root = root --- 49,53 ---- class HierList(object.Object): def __init__(self, root, bitmapID = win32ui.IDB_HIERFOLDERS, listBoxId = None, bitmapMask = None): # used to create object. ! self.listControl = None self.bitmapID = bitmapID self.root = root *************** *** 57,61 **** self.bitmapMask = bitmapMask def __getattr__(self, attr): ! l = self.__dict__['list'] if l is not None: return getattr(l, attr) --- 57,61 ---- self.bitmapMask = bitmapMask def __getattr__(self, attr): ! l = self.__dict__['listControl'] if l is not None: return getattr(l, attr) *************** *** 63,67 **** return self.itemHandleMap[handle] def SetStyle(self, newStyle): ! hwnd = self.list.GetSafeHwnd() style = win32api.GetWindowLong(hwnd, win32con.GWL_STYLE); win32api.SetWindowLong(hwnd, win32con.GWL_STYLE, (style | newStyle) ) --- 63,67 ---- return self.itemHandleMap[handle] def SetStyle(self, newStyle): ! hwnd = self.listControl.GetSafeHwnd() style = win32api.GetWindowLong(hwnd, win32con.GWL_STYLE); win32api.SetWindowLong(hwnd, win32con.GWL_STYLE, (style | newStyle) ) *************** *** 77,90 **** if listControl is None: if self.listBoxId is None: self.listBoxId = win32ui.IDC_LIST1 ! self.list = parent.GetDlgItem(self.listBoxId) else: ! self.list = listControl lbid = listControl.GetDlgCtrlID() assert self.listBoxId is None or self.listBoxId == lbid, "An invalid listbox control ID has been specified (specified as %s, but exists as %s)" % (self.listBoxId, lbid) self.listBoxId = lbid ! self.list.SetImageList(self.imageList, commctrl.LVSIL_NORMAL) # self.list.AttachObject(self) ! parent.HookNotify(self.OnTreeItemExpanding, commctrl.TVN_ITEMEXPANDING) ! parent.HookNotify(self.OnTreeItemSelChanged, commctrl.TVN_SELCHANGED) parent.HookNotify(self.OnTreeItemDoubleClick, commctrl.NM_DBLCLK) self.notify_parent = parent --- 77,97 ---- if listControl is None: if self.listBoxId is None: self.listBoxId = win32ui.IDC_LIST1 ! self.listControl = parent.GetDlgItem(self.listBoxId) else: ! self.listControl = listControl lbid = listControl.GetDlgCtrlID() assert self.listBoxId is None or self.listBoxId == lbid, "An invalid listbox control ID has been specified (specified as %s, but exists as %s)" % (self.listBoxId, lbid) self.listBoxId = lbid ! self.listControl.SetImageList(self.imageList, commctrl.LVSIL_NORMAL) # self.list.AttachObject(self) ! ! ## ??? Need a better way to do this - either some way to detect if it's compiled with UNICODE ! ## defined, and/or a way to switch the constants based on UNICODE ??? ! if sys.version_info[0] < 3: ! parent.HookNotify(self.OnTreeItemExpanding, commctrl.TVN_ITEMEXPANDINGA) ! parent.HookNotify(self.OnTreeItemSelChanged, commctrl.TVN_SELCHANGEDA) ! else: ! parent.HookNotify(self.OnTreeItemExpanding, commctrl.TVN_ITEMEXPANDINGW) ! parent.HookNotify(self.OnTreeItemSelChanged, commctrl.TVN_SELCHANGEDW) parent.HookNotify(self.OnTreeItemDoubleClick, commctrl.NM_DBLCLK) self.notify_parent = parent *************** *** 94,98 **** def DeleteAllItems(self): ! self.list.DeleteAllItems() self.root = None self.itemHandleMap = {} --- 101,105 ---- def DeleteAllItems(self): ! self.listControl.DeleteAllItems() self.root = None self.itemHandleMap = {} *************** *** 102,110 **** # Dont want notifies as we kill the list. parent = self.notify_parent # GetParentFrame() ! parent.HookNotify(None, commctrl.TVN_ITEMEXPANDING) ! parent.HookNotify(None, commctrl.TVN_SELCHANGED) parent.HookNotify(None, commctrl.NM_DBLCLK) self.DeleteAllItems() ! self.list = None self.notify_parent = None # Break a possible cycle --- 109,122 ---- # Dont want notifies as we kill the list. parent = self.notify_parent # GetParentFrame() ! if sys.version_info[0] < 3: ! parent.HookNotify(None, commctrl.TVN_ITEMEXPANDINGA) ! parent.HookNotify(None, commctrl.TVN_SELCHANGEDA) ! else: ! parent.HookNotify(None, commctrl.TVN_ITEMEXPANDINGW) ! parent.HookNotify(None, commctrl.TVN_SELCHANGEDW) parent.HookNotify(None, commctrl.NM_DBLCLK) + self.DeleteAllItems() ! self.listControl = None self.notify_parent = None # Break a possible cycle *************** *** 112,116 **** (hwndFrom, idFrom, code) = info if idFrom != self.listBoxId: return None ! item = self.itemHandleMap[self.list.GetSelectedItem()] self.TakeDefaultAction(item) return 1 --- 124,128 ---- (hwndFrom, idFrom, code) = info if idFrom != self.listBoxId: return None ! item = self.itemHandleMap[self.listControl.GetSelectedItem()] self.TakeDefaultAction(item) return 1 *************** *** 121,125 **** action, itemOld, itemNew, pt = extra itemHandle = itemNew[0] ! if not self.filledItemHandlesMap.has_key(itemHandle): item = self.itemHandleMap[itemHandle] self.AddSubList(itemHandle, self.GetSubList(item)) --- 133,137 ---- action, itemOld, itemNew, pt = extra itemHandle = itemNew[0] ! if itemHandle not in self.filledItemHandlesMap: item = self.itemHandleMap[itemHandle] self.AddSubList(itemHandle, self.GetSubList(item)) *************** *** 149,155 **** bitmapSel = self.GetSelectedBitmapColumn(item) if bitmapSel is None: bitmapSel = bitmapCol ! if type(text) is unicode: ! text = text.encode("mbcs") ! hitem = self.list.InsertItem(parentHandle, hInsertAfter, (None, None, None, text, bitmapCol, bitmapSel, cItems, 0)) self.itemHandleMap[hitem] = item return hitem --- 161,167 ---- bitmapSel = self.GetSelectedBitmapColumn(item) if bitmapSel is None: bitmapSel = bitmapCol ! ## if type(text) is str: ! ## text = text.encode("mbcs") ! hitem = self.listControl.InsertItem(parentHandle, hInsertAfter, (None, None, None, text, bitmapCol, bitmapSel, cItems, 0)) self.itemHandleMap[hitem] = item return hitem *************** *** 158,165 **** ret = [] try: ! handle = self.list.GetChildItem(handle) while 1: ret.append(handle) ! handle = self.list.GetNextItem(handle, commctrl.TVGN_NEXT) except win32ui.error: # out of children --- 170,177 ---- ret = [] try: ! handle = self.listControl.GetChildItem(handle) while 1: ret.append(handle) ! handle = self.listControl.GetNextItem(handle, commctrl.TVGN_NEXT) except win32ui.error: # out of children *************** *** 173,182 **** # (ie, the selected item, expanded items, etc) if hparent is None: hparent = commctrl.TVI_ROOT ! if not self.filledItemHandlesMap.has_key(hparent): # This item has never been expanded, so no refresh can possibly be required. return root_item = self.itemHandleMap[hparent] old_handles = self._GetChildHandles(hparent) ! old_items = map( self.ItemFromHandle, old_handles ) new_items = self.GetSubList(root_item) # Now an inefficient technique for synching the items. --- 185,194 ---- # (ie, the selected item, expanded items, etc) if hparent is None: hparent = commctrl.TVI_ROOT ! if hparent not in self.filledItemHandlesMap: # This item has never been expanded, so no refresh can possibly be required. return root_item = self.itemHandleMap[hparent] old_handles = self._GetChildHandles(hparent) ! old_items = list(map( self.ItemFromHandle, old_handles )) new_items = self.GetSubList(root_item) # Now an inefficient technique for synching the items. *************** *** 201,205 **** # And recursively refresh iold hold = old_handles[iold] ! if self.filledItemHandlesMap.has_key(hold): self.Refresh(hold) else: --- 213,217 ---- # And recursively refresh iold hold = old_handles[iold] ! if hold in self.filledItemHandlesMap: self.Refresh(hold) else: *************** *** 210,216 **** for hchild in self._GetChildHandles(hdelete): del self.itemHandleMap[hchild] ! if self.filledItemHandlesMap.has_key(hchild): del self.filledItemHandlesMap[hchild] ! self.list.DeleteItem(hdelete) hAfter = old_handles[iold] # Fill any remaining new items: --- 222,228 ---- for hchild in self._GetChildHandles(hdelete): del self.itemHandleMap[hchild] ! if hchild in self.filledItemHandlesMap: del self.filledItemHandlesMap[hchild] ! self.listControl.DeleteItem(hdelete) hAfter = old_handles[iold] # Fill any remaining new items: *************** *** 219,223 **** self.AddItem(hparent, newItem) def AcceptRoot(self, root): ! self.list.DeleteAllItems() self.itemHandleMap = {commctrl.TVI_ROOT : root} self.filledItemHandlesMap = {commctrl.TVI_ROOT : root} --- 231,235 ---- self.AddItem(hparent, newItem) def AcceptRoot(self, root): ! self.listControl.DeleteAllItems() self.itemHandleMap = {commctrl.TVI_ROOT : root} self.filledItemHandlesMap = {commctrl.TVI_ROOT : root} *************** *** 237,241 **** def CheckChangedChildren(self): ! return self.list.CheckChangedChildren() def GetText(self,item): return GetItemText(item) --- 249,253 ---- def CheckChangedChildren(self): ! return self.listControl.CheckChangedChildren() def GetText(self,item): return GetItemText(item) Index: browser.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/tools/browser.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** browser.py 9 Aug 2008 16:47:08 -0000 1.10 --- browser.py 14 Nov 2008 00:22:25 -0000 1.11 *************** *** 66,70 **** ret = [] try: ! for (key, ob) in self.myobject.__dict__.items(): if key not in special_names: ret.append(MakeHLI( ob, key ) ) --- 66,70 ---- ret = [] try: ! for (key, ob) in self.myobject.__dict__.iteritems(): if key not in special_names: ret.append(MakeHLI( ob, key ) ) *************** *** 95,99 **** return 1 try: ! for key in self.myobject.__dict__.keys(): if key not in special_names: return 1 --- 95,99 ---- return 1 try: ! for key in self.myobject.__dict__.iterkeys(): if key not in special_names: return 1 *************** *** 243,247 **** def GetSubList(self): ret = [] ! keys = self.myobject.keys() keys.sort() for key in keys: --- 243,247 ---- def GetSubList(self): ret = [] ! keys = list(self.myobject.keys()) keys.sort() for key in keys: *************** *** 365,369 **** root = MakeHLI (ob, 'root') if not root.IsExpandable(): ! raise TypeError, "Browse() argument must have __dict__ attribute, or be a Browser supported type" dlg = dynamic_browser (root) --- 365,369 ---- root = MakeHLI (ob, 'root') if not root.IsExpandable(): ! raise TypeError("Browse() argument must have __dict__ attribute, or be a Browser supported type") dlg = dynamic_browser (root) *************** *** 398,402 **** self.SetTitle("Browser: " + root.name) def OnOpenDocument (self, name): ! raise TypeError, "This template can not open files" return 0 --- 398,402 ---- self.SetTitle("Browser: " + root.name) def OnOpenDocument (self, name): ! raise TypeError("This template can not open files") return 0 *************** *** 423,427 **** root = MakeHLI(ob, repr(ob)) if not root.IsExpandable(): ! raise TypeError, "Browse() argument must have __dict__ attribute, or be a Browser supported type" template.OpenObject(root) --- 423,427 ---- root = MakeHLI(ob, repr(ob)) if not root.IsExpandable(): ! raise TypeError("Browse() argument must have __dict__ attribute, or be a Browser supported type") template.OpenObject(root) Index: browseProjects.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/tools/browseProjects.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** browseProjects.py 1 Oct 2008 14:44:53 -0000 1.4 --- browseProjects.py 14 Nov 2008 00:22:25 -0000 1.5 *************** *** 57,61 **** for c in self.super: ret.append(HLICLBRClass(c, " (Parent class)")) ! for meth, lineno in self.methods.items(): ret.append(HLICLBRMethod(meth, self.file, lineno, " (method)")) return ret --- 57,61 ---- for c in self.super: ret.append(HLICLBRClass(c, " (Parent class)")) ! for meth, lineno in self.methods.iteritems(): ret.append(HLICLBRMethod(meth, self.file, lineno, " (method)")) return ret *************** *** 104,108 **** if data: ret = [] ! for item in data.values(): if item.__class__ != pyclbr.Class: # ie, it is a pyclbr Function instance (only introduced post 1.5.2) ret.append(HLICLBRFunction( item, " (function)" ) ) --- 104,108 ---- if data: ret = [] ! for item in data.itervalues(): if item.__class__ != pyclbr.Class: # ie, it is a pyclbr Function instance (only introduced post 1.5.2) ret.append(HLICLBRFunction( item, " (function)" ) ) *************** *** 166,170 **** ret = MakePathSubList(pathList[0]) else: ! ret = map( HLIDirectoryItem, pathList ) return ret --- 166,170 ---- ret = MakePathSubList(pathList[0]) else: ! ret = list(map( HLIDirectoryItem, pathList )) return ret |
From: Mark H. <mha...@us...> - 2008-11-14 00:22:31
|
Update of /cvsroot/pywin32/pywin32/Pythonwin/pywin/debugger In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv24802/Pythonwin/pywin/debugger Modified Files: __init__.py debugger.py Log Message: Various modernizations to .py code via the py3k branch. Index: debugger.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/debugger/debugger.py,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** debugger.py 1 Oct 2008 14:44:52 -0000 1.20 --- debugger.py 14 Nov 2008 00:22:25 -0000 1.21 *************** *** 58,62 **** if not name or name == '?' : # See if locals has a '__name__' (ie, a module) ! if self.myobject.f_locals.has_key('__name__'): name = str(self.myobject.f_locals['__name__']) + " module" else: --- 58,62 ---- if not name or name == '?' : # See if locals has a '__name__' (ie, a module) ! if '__name__' in self.myobject.f_locals: name = str(self.myobject.f_locals['__name__']) + " module" else: *************** *** 315,319 **** from bdb import Breakpoint ! for bplist in Breakpoint.bplist.values(): for bp in bplist: if id(bp)==item_id: --- 315,319 ---- from bdb import Breakpoint ! for bplist in Breakpoint.bplist.itervalues(): for bp in bplist: if id(bp)==item_id: *************** *** 329,333 **** item_id = self.GetItem(num)[6] from bdb import Breakpoint ! for bplist in Breakpoint.bplist.values(): for bp in bplist: if id(bp)==item_id: --- 329,333 ---- item_id = self.GetItem(num)[6] from bdb import Breakpoint ! for bplist in Breakpoint.bplist.itervalues(): for bp in bplist: if id(bp)==item_id: *************** *** 339,353 **** def RespondDebuggerData(self): ! list = self ! list.DeleteAllItems() index = -1 from bdb import Breakpoint ! for bplist in Breakpoint.bplist.values(): for bp in bplist: baseName = os.path.split(bp.file)[1] cond = bp.cond item = index+1, 0, 0, 0, str(cond), 0, id(bp) ! index = list.InsertItem(item) ! list.SetItemText(index, 1, "%s: %s" % (baseName, bp.line)) class DebuggerWatchWindow(DebuggerListViewWindow): --- 339,353 ---- def RespondDebuggerData(self): ! l = self ! l.DeleteAllItems() index = -1 from bdb import Breakpoint ! for bplist in Breakpoint.bplist.itervalues(): for bp in bplist: baseName = os.path.split(bp.file)[1] cond = bp.cond item = index+1, 0, 0, 0, str(cond), 0, id(bp) ! index = l.InsertItem(item) ! l.SetItemText(index, 1, "%s: %s" % (baseName, bp.line)) class DebuggerWatchWindow(DebuggerListViewWindow): *************** *** 583,589 **** self.interaction(frame, None) ! def user_exception(self, frame, (exc_type, exc_value, exc_traceback)): # This function is called if an exception occurs, # but only if we are to stop at or just below this level if self.get_option(OPT_STOP_EXCEPTIONS): frame.f_locals['__exception__'] = exc_type, exc_value --- 583,590 ---- self.interaction(frame, None) ! def user_exception(self, frame, exc_info): # This function is called if an exception occurs, # but only if we are to stop at or just below this level + (exc_type, exc_value, exc_traceback) = exc_info if self.get_option(OPT_STOP_EXCEPTIONS): frame.f_locals['__exception__'] = exc_type, exc_value *************** *** 711,715 **** # '_debugger_stop_frame_', and we dont go past it # (everything above this is Pythonwin framework code) ! if frame.f_locals.has_key("_debugger_stop_frame_"): self.userbotframe = frame break --- 712,716 ---- # '_debugger_stop_frame_', and we dont go past it # (everything above this is Pythonwin framework code) ! if "_debugger_stop_frame_" in frame.f_locals: self.userbotframe = frame break Index: __init__.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/debugger/__init__.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** __init__.py 23 Oct 2008 03:39:13 -0000 1.6 --- __init__.py 14 Nov 2008 00:22:25 -0000 1.7 *************** *** 64,68 **** def runcall(*args): ! return apply(_GetCurrentDebugger().runcall, args) def set_trace(): --- 64,68 ---- def runcall(*args): ! return _GetCurrentDebugger().runcall(*args) def set_trace(): *************** *** 100,104 **** sys.settrace(None) p.reset() ! while t.tb_next <> None: t = t.tb_next p.bAtPostMortem = 1 p.prep_run(None) --- 100,104 ---- sys.settrace(None) p.reset() ! while t.tb_next != None: t = t.tb_next p.bAtPostMortem = 1 p.prep_run(None) |
From: Mark H. <mha...@us...> - 2008-11-14 00:22:31
|
Update of /cvsroot/pywin32/pywin32/Pythonwin/pywin/Demos In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv24802/Pythonwin/pywin/Demos Modified Files: dibdemo.py fontdemo.py hiertest.py Log Message: Various modernizations to .py code via the py3k branch. Index: hiertest.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/Demos/hiertest.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** hiertest.py 1 Sep 1999 23:33:35 -0000 1.1 --- hiertest.py 14 Nov 2008 00:22:25 -0000 1.2 *************** *** 17,21 **** def GetSubList(self, item): if os.path.isdir(item): ! ret = map(lambda path, base=item: os.path.join(base, path), os.listdir(item)) else: ret = None --- 17,21 ---- def GetSubList(self, item): if os.path.isdir(item): ! ret = [os.path.join(item, fname) for fname in os.listdir(item)] else: ret = None *************** *** 102,104 **** demoboth() else: ! demodlg() \ No newline at end of file --- 102,104 ---- demoboth() else: ! demodlg() Index: dibdemo.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/Demos/dibdemo.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** dibdemo.py 9 Aug 2008 16:46:41 -0000 1.2 --- dibdemo.py 14 Nov 2008 00:22:25 -0000 1.3 *************** *** 38,44 **** if len(bPBM)>0: magic=f.readline() ! if magic <> "P6\n": print "The file is not a PBM format file" ! raise "Failed" # check magic? rowcollist=f.readline().split() --- 38,44 ---- if len(bPBM)>0: magic=f.readline() ! if magic != "P6\n": print "The file is not a PBM format file" ! raise ValueError("Failed - The file is not a PBM format file") # check magic? rowcollist=f.readline().split() Index: fontdemo.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/Demos/fontdemo.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** fontdemo.py 1 Sep 1999 23:33:35 -0000 1.1 --- fontdemo.py 14 Nov 2008 00:22:25 -0000 1.2 *************** *** 61,65 **** self.width = right - left self.height = bottom - top ! x, y = self.width / 2, self.height / 2 dc.TextOut (x, y, self.text) --- 61,65 ---- self.width = right - left self.height = bottom - top ! x, y = self.width // 2, self.height // 2 dc.TextOut (x, y, self.text) |
From: Mark H. <mha...@us...> - 2008-11-14 00:22:31
|
Update of /cvsroot/pywin32/pywin32/Pythonwin/pywin/dialogs In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv24802/Pythonwin/pywin/dialogs Modified Files: ideoptions.py list.py Log Message: Various modernizations to .py code via the py3k branch. Index: list.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/dialogs/list.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** list.py 1 Sep 1999 23:33:43 -0000 1.1 --- list.py 14 Nov 2008 00:22:25 -0000 1.2 *************** *** 45,51 **** def OnListItemChange(self,std, extra): (hwndFrom, idFrom, code), (itemNotify, sub, newState, oldState, change, point, lparam) = std, extra ! oldSel = (oldState & commctrl.LVIS_SELECTED)<>0 ! newSel = (newState & commctrl.LVIS_SELECTED)<>0 ! if oldSel <> newSel: try: self.selecteditem = itemNotify --- 45,51 ---- def OnListItemChange(self,std, extra): (hwndFrom, idFrom, code), (itemNotify, sub, newState, oldState, change, point, lparam) = std, extra ! oldSel = (oldState & commctrl.LVIS_SELECTED)!=0 ! newSel = (newState & commctrl.LVIS_SELECTED)!=0 ! if oldSel != newSel: try: self.selecteditem = itemNotify Index: ideoptions.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/dialogs/ideoptions.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ideoptions.py 11 Mar 2000 00:57:53 -0000 1.2 --- ideoptions.py 14 Nov 2008 00:22:25 -0000 1.3 *************** *** 88,92 **** def ChangeFormat(self, fmtAttribute, fmt): dlg = win32ui.CreateFontDialog(fmt) ! if dlg.DoModal() <> win32con.IDOK: return None return dlg.GetCharFormat() --- 88,92 ---- def ChangeFormat(self, fmtAttribute, fmt): dlg = win32ui.CreateFontDialog(fmt) ! if dlg.DoModal() != win32con.IDOK: return None return dlg.GetCharFormat() |
Update of /cvsroot/pywin32/pywin32/com/win32com/client In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv24802/com/win32com/client Modified Files: CLSIDToClass.py __init__.py build.py gencache.py genpy.py makepy.py selecttlb.py Log Message: Various modernizations to .py code via the py3k branch. Index: makepy.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/client/makepy.py,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** makepy.py 1 Jul 2008 00:17:41 -0000 1.25 --- makepy.py 14 Nov 2008 00:22:25 -0000 1.26 *************** *** 218,223 **** if bForDemand and file is not None: ! raise RuntimeError, "You can only perform a demand-build when the output goes to the gen_py directory" ! if type(typelibInfo)==type(()): # Tuple typelibCLSID, lcid, major, minor = typelibInfo --- 218,223 ---- if bForDemand and file is not None: ! raise RuntimeError("You can only perform a demand-build when the output goes to the gen_py directory") ! if isinstance(typelibInfo, tuple): # Tuple typelibCLSID, lcid, major, minor = typelibInfo *************** *** 226,230 **** spec.FromTypelib(tlb, str(typelibCLSID)) typelibs = [(tlb, spec)] ! elif type(typelibInfo)==types.InstanceType: if typelibInfo.dll is None: # Version numbers not always reliable if enumerated from registry. --- 226,230 ---- spec.FromTypelib(tlb, str(typelibCLSID)) typelibs = [(tlb, spec)] ! elif isinstance(typelibInfo, selecttlb.TypelibSpec): if typelibInfo.dll is None: # Version numbers not always reliable if enumerated from registry. *************** *** 235,238 **** --- 235,240 ---- elif hasattr(typelibInfo, "GetLibAttr"): # A real typelib object! + # Could also use isinstance(typelibInfo, PyITypeLib) instead, but PyITypeLib is not directly exposed by pythoncom. + # pythoncom.TypeIIDs[pythoncom.IID_ITypeLib] seems to work tla = typelibInfo.GetLibAttr() guid = tla[0] *************** *** 287,291 **** fileUse.close() os.rename(outputName + ".temp", outputName) - if bToGenDir: progress.SetDescription("Importing module") --- 289,292 ---- Index: __init__.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/client/__init__.py,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** __init__.py 3 Oct 2008 01:03:56 -0000 1.35 --- __init__.py 14 Nov 2008 00:22:25 -0000 1.36 *************** *** 6,18 **** # dispatch object, the known class will be used. This contrasts # with dynamic.Dispatch behaviour, where dynamic objects are always used. - import __builtin__ - # For some bizarre reason, __builtins__ fails with attribute error on __dict__ here? - NeedUnicodeConversions = not hasattr(__builtin__, "unicode") ! import dynamic, gencache, pythoncom import sys import pywintypes ! from types import TupleType ! from pywintypes import UnicodeType _PyIDispatchType = pythoncom.TypeIIDs[pythoncom.IID_IDispatch] --- 6,18 ---- # dispatch object, the known class will be used. This contrasts # with dynamic.Dispatch behaviour, where dynamic objects are always used. ! # This can go away ! NeedUnicodeConversions = False ! ! import pythoncom ! import dynamic, gencache import sys import pywintypes ! _PyIDispatchType = pythoncom.TypeIIDs[pythoncom.IID_IDispatch] *************** *** 66,70 **** if (Pathname is None and Class is None) or \ (Pathname is not None and Class is not None): ! raise ValueError, "You must specify a value for Pathname or Class, but not both." if Class is not None: --- 66,70 ---- if (Pathname is None and Class is None) or \ (Pathname is not None and Class is not None): ! raise ValueError("You must specify a value for Pathname or Class, but not both.") if Class is not None: *************** *** 128,136 **** if hasattr(target, "index"): # string like # for now, we assume makepy for this to work. ! if not ob.__class__.__dict__.has_key("CLSID"): # Eeek - no makepy support - try and build it. ob = gencache.EnsureDispatch(ob) ! if not ob.__class__.__dict__.has_key("CLSID"): ! raise ValueError, "Must be a makepy-able object for this to work" clsid = ob.CLSID # Lots of hoops to support "demand-build" - ie, generating --- 128,136 ---- if hasattr(target, "index"): # string like # for now, we assume makepy for this to work. ! if "CLSID" not in ob.__class__.__dict__: # Eeek - no makepy support - try and build it. ob = gencache.EnsureDispatch(ob) ! if "CLSID" not in ob.__class__.__dict__: ! raise ValueError("Must be a makepy-able object for this to work") clsid = ob.CLSID # Lots of hoops to support "demand-build" - ie, generating *************** *** 148,153 **** target_clsid = mod.NamesToIIDMap.get(target) if target_clsid is None: ! raise ValueError, "The interface name '%s' does not appear in the " \ ! "same library as object '%r'" % (target, ob) mod = gencache.GetModuleForCLSID(target_clsid) target_class = getattr(mod, target) --- 148,153 ---- target_clsid = mod.NamesToIIDMap.get(target) if target_clsid is None: ! raise ValueError("The interface name '%s' does not appear in the " \ ! "same library as object '%r'" % (target, ob)) mod = gencache.GetModuleForCLSID(target_clsid) target_class = getattr(mod, target) *************** *** 155,159 **** target_class = getattr(target_class, "default_interface", target_class) return target_class(ob) # auto QI magic happens ! raise ValueError, "This object can not be cast" class Constants: --- 155,159 ---- target_class = getattr(target_class, "default_interface", target_class) return target_class(ob) # auto QI magic happens ! raise ValueError class Constants: *************** *** 164,170 **** def __getattr__(self, a): for d in self.__dicts__: ! if d.has_key(a): return d[a] ! raise AttributeError, a # And create an instance. --- 164,170 ---- def __getattr__(self, a): for d in self.__dicts__: ! if a in d: return d[a] ! raise AttributeError(a) # And create an instance. *************** *** 252,256 **** disp_class = gencache.GetClassForProgID(str(disp_clsid)) except pythoncom.com_error: ! raise TypeError, "This COM object can not automate the makepy process - please run makepy manually for this object" else: disp_class = disp.__class__ --- 252,256 ---- disp_class = gencache.GetClassForProgID(str(disp_clsid)) except pythoncom.com_error: ! raise TypeError("This COM object can not automate the makepy process - please run makepy manually for this object") else: disp_class = disp.__class__ *************** *** 261,265 **** events_class = getevents(clsid) if events_class is None: ! raise ValueError, "This COM object does not support events." result_class = new.classobj("COMEventClass", (disp_class, events_class, user_event_class), {"__setattr__" : _event_setattr_}) instance = result_class(disp._oleobj_) # This only calls the first base class __init__. --- 261,265 ---- events_class = getevents(clsid) if events_class is None: ! raise ValueError("This COM object does not support events.") result_class = new.classobj("COMEventClass", (disp_class, events_class, user_event_class), {"__setattr__" : _event_setattr_}) instance = result_class(disp._oleobj_) # This only calls the first base class __init__. *************** *** 304,308 **** disp_class = gencache.GetClassForProgID(str(disp_clsid)) except pythoncom.com_error: ! raise TypeError, "This COM object can not automate the makepy process - please run makepy manually for this object" else: disp_class = disp.__class__ --- 304,308 ---- disp_class = gencache.GetClassForProgID(str(disp_clsid)) except pythoncom.com_error: ! raise TypeError("This COM object can not automate the makepy process - please run makepy manually for this object") else: disp_class = disp.__class__ *************** *** 314,318 **** events_class = getevents(clsid) if events_class is None: ! raise ValueError, "This COM object does not support events." result_class = new.classobj("COMEventClass", (events_class, user_event_class), {}) instance = result_class(disp) # This only calls the first base class __init__. --- 314,318 ---- events_class = getevents(clsid) if events_class is None: ! raise ValueError("This COM object does not support events.") result_class = new.classobj("COMEventClass", (events_class, user_event_class), {}) instance = result_class(disp) # This only calls the first base class __init__. *************** *** 401,406 **** struct_guid = package.RecordMap[name] except KeyError: ! raise ValueError, "The structure '%s' is not defined in module '%s'" % (name, package) ! return pythoncom.GetRecordFromGuids(module.CLSID, module.MajorVersion, module.MinorVersion, module.LCID, struct_guid) --- 401,405 ---- struct_guid = package.RecordMap[name] except KeyError: ! raise ValueError("The structure '%s' is not defined in module '%s'" % (name, package)) return pythoncom.GetRecordFromGuids(module.CLSID, module.MajorVersion, module.MinorVersion, module.LCID, struct_guid) *************** *** 442,464 **** return cmp(self._oleobj_, other) ! def _ApplyTypes_(self, dispid, wFlags, retType, argTypes, user, ! resultCLSID, *args): return self._get_good_object_( ! self._oleobj_.InvokeTypes( ! dispid, 0, wFlags, retType, argTypes, *args), ! user, resultCLSID) def __getattr__(self, attr): args=self._prop_map_get_.get(attr) if args is None: ! raise AttributeError, "'%s' object has no attribute '%s'" % (repr(self), attr) return self._ApplyTypes_(*args) def __setattr__(self, attr, value): ! if self.__dict__.has_key(attr): self.__dict__[attr] = value; return try: args, defArgs=self._prop_map_put_[attr] except KeyError: ! raise AttributeError, "'%s' object has no attribute '%s'" % (repr(self), attr) self._oleobj_.Invoke(*(args + (value,) + defArgs)) def _get_good_single_object_(self, obj, obUserName=None, resultCLSID=None): --- 441,461 ---- return cmp(self._oleobj_, other) ! def _ApplyTypes_(self, dispid, wFlags, retType, argTypes, user, resultCLSID, *args): return self._get_good_object_( ! self._oleobj_.InvokeTypes(dispid, 0, wFlags, retType, argTypes, *args), ! user, resultCLSID) def __getattr__(self, attr): args=self._prop_map_get_.get(attr) if args is None: ! raise AttributeError("'%s' object has no attribute '%s'" % (repr(self), attr)) return self._ApplyTypes_(*args) def __setattr__(self, attr, value): ! if attr in self.__dict__: self.__dict__[attr] = value; return try: args, defArgs=self._prop_map_put_[attr] except KeyError: ! raise AttributeError("'%s' object has no attribute '%s'" % (repr(self), attr)) self._oleobj_.Invoke(*(args + (value,) + defArgs)) def _get_good_single_object_(self, obj, obUserName=None, resultCLSID=None): *************** *** 471,476 **** if _PyIDispatchType==type(obj): return Dispatch(obj, obUserName, resultCLSID, UnicodeToString=NeedUnicodeConversions) - elif NeedUnicodeConversions and UnicodeType==type(obj): - return str(obj) return obj --- 468,471 ---- *************** *** 478,482 **** if obj is None: return None ! elif type(obj)==TupleType: obUserNameTuple = (obUserName,) * len(obj) resultCLSIDTuple = (resultCLSID,) * len(obj) --- 473,477 ---- if obj is None: return None ! elif isinstance(obj, tuple): obUserNameTuple = (obUserName,) * len(obj) resultCLSIDTuple = (resultCLSID,) * len(obj) *************** *** 495,501 **** d=self.__dict__["_dispobj_"] if d is not None: return getattr(d, attr) ! raise AttributeError, attr def __setattr__(self, attr, value): ! if self.__dict__.has_key(attr): self.__dict__[attr] = value; return try: d=self.__dict__["_dispobj_"] --- 490,496 ---- d=self.__dict__["_dispobj_"] if d is not None: return getattr(d, attr) ! raise AttributeError(attr) def __setattr__(self, attr, value): ! if attr in self.__dict__: self.__dict__[attr] = value; return try: d=self.__dict__["_dispobj_"] Index: build.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/client/build.py,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** build.py 3 Oct 2008 01:03:56 -0000 1.32 --- build.py 14 Nov 2008 00:22:25 -0000 1.33 *************** *** 121,125 **** else: deleteExisting = 1 # No good to us ! if self.mapFuncs.has_key(key) or self.propMapGet.has_key(key): newKey = "Set" + key else: --- 121,125 ---- else: deleteExisting = 1 # No good to us ! if key in self.mapFuncs or key in self.propMapGet: newKey = "Set" + key else: *************** *** 138,142 **** else: deleteExisting = 1 # No good to us ! if self.mapFuncs.has_key(key): newKey = "Get" + key else: --- 138,142 ---- else: deleteExisting = 1 # No good to us ! if key in self.mapFuncs: newKey = "Get" + key else: *************** *** 257,266 **** if typeinfo is None: return # Loop over all methods ! for j in xrange(attr[6]): fdesc = typeinfo.GetFuncDesc(j) self._AddFunc_(typeinfo,fdesc,bForUser) # Loop over all variables (ie, properties) ! for j in xrange(attr[7]): fdesc = typeinfo.GetVarDesc(j) self._AddVar_(typeinfo,fdesc,bForUser) --- 257,266 ---- if typeinfo is None: return # Loop over all methods ! for j in range(attr[6]): fdesc = typeinfo.GetFuncDesc(j) self._AddFunc_(typeinfo,fdesc,bForUser) # Loop over all variables (ie, properties) ! for j in range(attr[7]): fdesc = typeinfo.GetVarDesc(j) self._AddVar_(typeinfo,fdesc,bForUser) *************** *** 269,276 **** # that have arguments, we must turn them into methods. If a method # of the same name already exists, change the name. ! for key, item in self.propMapGet.items(): self._propMapGetCheck_(key,item) ! for key, item in self.propMapPut.items(): self._propMapPutCheck_(key,item) --- 269,276 ---- # that have arguments, we must turn them into methods. If a method # of the same name already exists, change the name. ! for key, item in list(self.propMapGet.items()): self._propMapGetCheck_(key,item) ! for key, item in list(self.propMapPut.items()): self._propMapPutCheck_(key,item) *************** *** 316,319 **** --- 316,320 ---- defOutArg = "pythoncom.Missing" id = fdesc[0] + s = linePrefix + 'def ' + name + '(self' + BuildCallList(fdesc, names, defNamedOptArg, defNamedNotOptArg, defUnnamedArg, defOutArg) + '):' ret.append(s) *************** *** 330,347 **** # Strip the default values from the arg desc retDesc = fdesc[8][:2] ! argsDesc = tuple(map(lambda what: what[:2], fdesc[2])) # The runtime translation of the return types is expensive, so when we know the # return type of the function, there is no need to check the type at runtime. # To qualify, this function must return a "simple" type, and have no byref args. # Check if we have byrefs or anything in the args which mean we still need a translate. ! param_flags = map(lambda what: what[1], fdesc[2]) ! bad_params = filter(lambda flag: flag & (pythoncom.PARAMFLAG_FOUT | pythoncom.PARAMFLAG_FRETVAL)!=0, param_flags) s = None if len(bad_params)==0 and len(retDesc)==2 and retDesc[1]==0: rd = retDesc[0] ! if NoTranslateMap.has_key(rd): s = '%s\treturn self._oleobj_.InvokeTypes(%d, LCID, %s, %s, %s%s)' % (linePrefix, id, fdesc[4], retDesc, argsDesc, _BuildArgList(fdesc, names)) elif rd in [pythoncom.VT_DISPATCH, pythoncom.VT_UNKNOWN]: ! s = '%s\tret = self._oleobj_.InvokeTypes(%d, LCID, %s, %s, %s%s)\n' % (linePrefix, id, fdesc[4], retDesc, `argsDesc`, _BuildArgList(fdesc, names)) s = s + '%s\tif ret is not None:\n' % (linePrefix,) if rd == pythoncom.VT_UNKNOWN: --- 331,348 ---- # Strip the default values from the arg desc retDesc = fdesc[8][:2] ! argsDesc = tuple([what[:2] for what in fdesc[2]]) # The runtime translation of the return types is expensive, so when we know the # return type of the function, there is no need to check the type at runtime. # To qualify, this function must return a "simple" type, and have no byref args. # Check if we have byrefs or anything in the args which mean we still need a translate. ! param_flags = [what[1] for what in fdesc[2]] ! bad_params = [flag for flag in param_flags if flag & (pythoncom.PARAMFLAG_FOUT | pythoncom.PARAMFLAG_FRETVAL)!=0] s = None if len(bad_params)==0 and len(retDesc)==2 and retDesc[1]==0: rd = retDesc[0] ! if rd in NoTranslateMap: s = '%s\treturn self._oleobj_.InvokeTypes(%d, LCID, %s, %s, %s%s)' % (linePrefix, id, fdesc[4], retDesc, argsDesc, _BuildArgList(fdesc, names)) elif rd in [pythoncom.VT_DISPATCH, pythoncom.VT_UNKNOWN]: ! s = '%s\tret = self._oleobj_.InvokeTypes(%d, LCID, %s, %s, %s%s)\n' % (linePrefix, id, fdesc[4], retDesc, repr(argsDesc), _BuildArgList(fdesc, names)) s = s + '%s\tif ret is not None:\n' % (linePrefix,) if rd == pythoncom.VT_UNKNOWN: *************** *** 351,366 **** s = s + "%s\t\texcept pythoncom.error:\n" % (linePrefix,) s = s + "%s\t\t\treturn ret\n" % (linePrefix,) ! s = s + '%s\t\tret = Dispatch(ret, %s, %s, UnicodeToString=%d)\n' % (linePrefix,`name`, resclsid, NeedUnicodeConversions) s = s + '%s\treturn ret' % (linePrefix) elif rd == pythoncom.VT_BSTR: if NeedUnicodeConversions: s = "%s\t# Result is a Unicode object - perform automatic string conversion\n" % (linePrefix,) ! s = s + '%s\treturn str(self._oleobj_.InvokeTypes(%d, LCID, %s, %s, %s%s))' % (linePrefix, id, fdesc[4], retDesc, `argsDesc`, _BuildArgList(fdesc, names)) else: s = "%s\t# Result is a Unicode object - return as-is for this version of Python\n" % (linePrefix,) ! s = s + '%s\treturn self._oleobj_.InvokeTypes(%d, LCID, %s, %s, %s%s)' % (linePrefix, id, fdesc[4], retDesc, `argsDesc`, _BuildArgList(fdesc, names)) # else s remains None if s is None: ! s = '%s\treturn self._ApplyTypes_(%d, %s, %s, %s, %s, %s%s)' % (linePrefix, id, fdesc[4], retDesc, argsDesc, `name`, resclsid, _BuildArgList(fdesc, names)) ret.append(s) --- 352,367 ---- s = s + "%s\t\texcept pythoncom.error:\n" % (linePrefix,) s = s + "%s\t\t\treturn ret\n" % (linePrefix,) ! s = s + '%s\t\tret = Dispatch(ret, %s, %s, UnicodeToString=%d)\n' % (linePrefix,repr(name), resclsid, NeedUnicodeConversions) s = s + '%s\treturn ret' % (linePrefix) elif rd == pythoncom.VT_BSTR: if NeedUnicodeConversions: s = "%s\t# Result is a Unicode object - perform automatic string conversion\n" % (linePrefix,) ! s = s + '%s\treturn str(self._oleobj_.InvokeTypes(%d, LCID, %s, %s, %s%s))' % (linePrefix, id, fdesc[4], retDesc, repr(argsDesc), _BuildArgList(fdesc, names)) else: s = "%s\t# Result is a Unicode object - return as-is for this version of Python\n" % (linePrefix,) ! s = s + '%s\treturn self._oleobj_.InvokeTypes(%d, LCID, %s, %s, %s%s)' % (linePrefix, id, fdesc[4], retDesc, repr(argsDesc), _BuildArgList(fdesc, names)) # else s remains None if s is None: ! s = '%s\treturn self._ApplyTypes_(%d, %s, %s, %s, %s, %s%s)' % (linePrefix, id, fdesc[4], retDesc, argsDesc, repr(name), resclsid, _BuildArgList(fdesc, names)) ret.append(s) *************** *** 398,402 **** return cmp(m1.desc[7], m2.desc[7]) ! meth_list = self.mapFuncs.values() + self.propMapGet.values() + self.propMapPut.values() meth_list.sort( cmp_vtable_off ) --- 399,403 ---- return cmp(m1.desc[7], m2.desc[7]) ! meth_list = list(self.mapFuncs.values()) + list(self.propMapGet.values()) + list(self.propMapPut.values()) meth_list.sort( cmp_vtable_off ) *************** *** 425,429 **** # Resolve VT_USERDEFINED (often aliases or typed IDispatches) ! if type(typerepr)==types.TupleType: indir_vt, subrepr = typerepr if indir_vt == pythoncom.VT_PTR: --- 426,430 ---- # Resolve VT_USERDEFINED (often aliases or typed IDispatches) ! if type(typerepr)==tuple: indir_vt, subrepr = typerepr if indir_vt == pythoncom.VT_PTR: *************** *** 435,439 **** # only when "somehandle" is an object. # but (VT_PTR, (VT_USERDEFINED, otherhandle)) doesnt get the indirection dropped. ! was_user = type(subrepr)==types.TupleType and subrepr[0]==pythoncom.VT_USERDEFINED subrepr, sub_clsid, sub_doc = _ResolveType(subrepr, itypeinfo) if was_user and subrepr in [pythoncom.VT_DISPATCH, pythoncom.VT_UNKNOWN, pythoncom.VT_RECORD]: --- 436,440 ---- # only when "somehandle" is an object. # but (VT_PTR, (VT_USERDEFINED, otherhandle)) doesnt get the indirection dropped. ! was_user = type(subrepr)==tuple and subrepr[0]==pythoncom.VT_USERDEFINED subrepr, sub_clsid, sub_doc = _ResolveType(subrepr, itypeinfo) if was_user and subrepr in [pythoncom.VT_DISPATCH, pythoncom.VT_UNKNOWN, pythoncom.VT_RECORD]: *************** *** 493,497 **** i = names.index(None) names[i] = "arg%d" % (i,) ! names = map(MakePublicAttributeName, names[1:]) name_num = 0 while len(names) < numArgs: --- 494,498 ---- i = names.index(None) names[i] = "arg%d" % (i,) ! names = list(map(MakePublicAttributeName, names[1:])) name_num = 0 while len(names) < numArgs: *************** *** 502,506 **** for i in range(0, len(names), 5): names[i] = names[i] + "\n\t\t\t" ! return "," + string.join(names, ", ") valid_identifier_chars = string.ascii_letters + string.digits + "_" --- 503,507 ---- for i in range(0, len(names), 5): names[i] = names[i] + "\n\t\t\t" ! return "," + ", ".join(names) valid_identifier_chars = string.ascii_letters + string.digits + "_" *************** *** 526,535 **** return demunge_leading_underscores(className) elif iskeyword(className): # all keywords are lower case ! return string.capitalize(className) elif className == 'None': # assign to None is evil (and SyntaxError in 2.4) - note # that if it was a global it would get picked up below className = 'NONE' ! elif is_global and __builtins__.has_key(className): # builtins may be mixed case. If capitalizing it doesn't change it, # force to all uppercase (eg, "None", "True" become "NONE", "TRUE" --- 527,536 ---- return demunge_leading_underscores(className) elif iskeyword(className): # all keywords are lower case ! return className.capitalize() elif className == 'None': # assign to None is evil (and SyntaxError in 2.4) - note # that if it was a global it would get picked up below className = 'NONE' ! elif is_global and hasattr(__builtins__, className): # builtins may be mixed case. If capitalizing it doesn't change it, # force to all uppercase (eg, "None", "True" become "NONE", "TRUE" *************** *** 539,543 **** return ret # Strip non printable chars ! return filter( lambda char: char in valid_identifier_chars, className) # Given a default value passed by a type library, return a string with --- 540,544 ---- return ret # Strip non printable chars ! return ''.join([char for char in className if char in valid_identifier_chars]) # Given a default value passed by a type library, return a string with Index: genpy.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/client/genpy.py,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** genpy.py 1 Jul 2008 00:11:14 -0000 1.55 --- genpy.py 14 Nov 2008 00:22:25 -0000 1.56 *************** *** 16,20 **** import os import sys - import string import time import win32com --- 16,19 ---- *************** *** 78,82 **** def MakeMapLineEntry(dispid, wFlags, retType, argTypes, user, resultCLSID): # Strip the default value ! argTypes = tuple(map(lambda what: what[:2], argTypes)) return '(%s, %d, %s, %s, "%s", %s)' % \ (dispid, wFlags, retType[:2], argTypes, user, resultCLSID) --- 77,81 ---- def MakeMapLineEntry(dispid, wFlags, retType, argTypes, user, resultCLSID): # Strip the default value ! argTypes = tuple([what[:2] for what in argTypes]) return '(%s, %d, %s, %s, "%s", %s)' % \ (dispid, wFlags, retType[:2], argTypes, user, resultCLSID) *************** *** 105,109 **** return ret def __repr__(self): ! return "OleItem: doc=%s, order=%d" % (`self.doc`, self.order) --- 104,108 ---- return ret def __repr__(self): ! return "OleItem: doc=%s, order=%d" % (repr(self.doc), self.order) *************** *** 129,133 **** # (no longer necessary for new style code, but still used for old code. def WriteAliasesForItem(item, aliasItems, stream): ! for alias in aliasItems.values(): if item.doc and alias.aliasDoc and (alias.aliasDoc[0]==item.doc[0]): alias.WriteAliasItem(aliasItems, stream) --- 128,132 ---- # (no longer necessary for new style code, but still used for old code. def WriteAliasesForItem(item, aliasItems, stream): ! for alias in aliasItems.itervalues(): if item.doc and alias.aliasDoc and (alias.aliasDoc[0]==item.doc[0]): alias.WriteAliasItem(aliasItems, stream) *************** *** 159,163 **** if self.aliasDoc: depName = self.aliasDoc[0] ! if aliasDict.has_key(depName): aliasDict[depName].WriteAliasItem(aliasDict, stream) print >> stream, self.doc[0] + " = " + depName --- 158,162 ---- if self.aliasDoc: depName = self.aliasDoc[0] ! if depName in aliasDict: aliasDict[depName].WriteAliasItem(aliasDict, stream) print >> stream, self.doc[0] + " = " + depName *************** *** 199,203 **** enumName = self.doc[0] # Write in name alpha order ! names = self.mapVars.keys() names.sort() for name in names: --- 198,202 ---- enumName = self.doc[0] # Write in name alpha order ! names = list(self.mapVars.keys()) names.sort() for name in names: *************** *** 383,388 **** continue # Dont build this one now! else: ! lkey = string.lower(name) ! if specialItems.has_key(lkey) and specialItems[lkey] is None: # remember if a special one. specialItems[lkey] = (entry, entry.desc[4], None) if generator.bBuildHidden or not entry.hidden: --- 382,387 ---- continue # Dont build this one now! else: ! lkey = name.lower() ! if lkey in specialItems and specialItems[lkey] is None: # remember if a special one. specialItems[lkey] = (entry, entry.desc[4], None) if generator.bBuildHidden or not entry.hidden: *************** *** 402,406 **** if resultName: print >> stream, "\t\t# Property '%s' is an object of type '%s'" % (key, resultName) ! lkey = string.lower(key) details = entry.desc resultDesc = details[2] --- 401,405 ---- if resultName: print >> stream, "\t\t# Property '%s' is an object of type '%s'" % (key, resultName) ! lkey = key.lower() details = entry.desc resultDesc = details[2] *************** *** 413,418 **** lkey = "_newenum" else: ! lkey = string.lower(key) ! if specialItems.has_key(lkey) and specialItems[lkey] is None: # remember if a special one. specialItems[lkey] = (entry, pythoncom.DISPATCH_PROPERTYGET, mapEntry) # All special methods, except _newenum, are written --- 412,417 ---- lkey = "_newenum" else: ! lkey = key.lower() ! if lkey in specialItems and specialItems[lkey] is None: # remember if a special one. specialItems[lkey] = (entry, pythoncom.DISPATCH_PROPERTYGET, mapEntry) # All special methods, except _newenum, are written *************** *** 429,433 **** print >> stream, "\t\t# Method '%s' returns object of type '%s'" % (key, entry.GetResultName()) details = entry.desc ! lkey = string.lower(key) argDesc = details[2] resultDesc = details[8] --- 428,432 ---- print >> stream, "\t\t# Method '%s' returns object of type '%s'" % (key, entry.GetResultName()) details = entry.desc ! lkey = key.lower() argDesc = details[2] resultDesc = details[8] *************** *** 438,443 **** lkey = "_newenum" else: ! lkey = string.lower(key) ! if specialItems.has_key(lkey) and specialItems[lkey] is None: # remember if a special one. specialItems[lkey]=(entry, pythoncom.DISPATCH_PROPERTYGET, mapEntry) # All special methods, except _newenum, are written --- 437,442 ---- lkey = "_newenum" else: ! lkey = key.lower() ! if lkey in specialItems and specialItems[lkey] is None: # remember if a special one. specialItems[lkey]=(entry, pythoncom.DISPATCH_PROPERTYGET, mapEntry) # All special methods, except _newenum, are written *************** *** 451,459 **** print >> stream, "\t_prop_map_put_ = {" # These are "Invoke" args ! names = self.propMap.keys(); names.sort() for key in names: entry = self.propMap[key] if generator.bBuildHidden or not entry.hidden: ! lkey=string.lower(key) details = entry.desc # If default arg is None, write an empty tuple --- 450,458 ---- print >> stream, "\t_prop_map_put_ = {" # These are "Invoke" args ! names = list(self.propMap.keys()); names.sort() for key in names: entry = self.propMap[key] if generator.bBuildHidden or not entry.hidden: ! lkey=key.lower() details = entry.desc # If default arg is None, write an empty tuple *************** *** 465,469 **** print >> stream, '\t\t"%s" : ((%s, LCID, %d, 0),(%s)),' % (build.MakePublicAttributeName(key), details[0], pythoncom.DISPATCH_PROPERTYPUT, defArgDesc) ! names = self.propMapPut.keys(); names.sort() for key in names: entry = self.propMapPut[key] --- 464,468 ---- print >> stream, '\t\t"%s" : ((%s, LCID, %d, 0),(%s)),' % (build.MakePublicAttributeName(key), details[0], pythoncom.DISPATCH_PROPERTYPUT, defArgDesc) ! names = list(self.propMapPut.keys()); names.sort() for key in names: entry = self.propMapPut[key] *************** *** 501,505 **** resultCLSID = enumEntry.GetResultCLSIDStr() # If we dont have a good CLSID for the enum result, assume it is the same as the Item() method. ! if resultCLSID == "None" and self.mapFuncs.has_key("Item"): resultCLSID = self.mapFuncs["Item"].GetResultCLSIDStr() # "Native" Python iterator support --- 500,504 ---- resultCLSID = enumEntry.GetResultCLSIDStr() # If we dont have a good CLSID for the enum result, assume it is the same as the Item() method. ! if resultCLSID == "None" and "Item" in self.mapFuncs: resultCLSID = self.mapFuncs["Item"].GetResultCLSIDStr() # "Native" Python iterator support *************** *** 685,689 **** (refAttr.typekind == pythoncom.TKIND_INTERFACE and refAttr[11] & pythoncom.TYPEFLAG_FDISPATCHABLE): clsid = refAttr[0] ! if oleItems.has_key(clsid): dispItem = oleItems[clsid] else: --- 684,688 ---- (refAttr.typekind == pythoncom.TKIND_INTERFACE and refAttr[11] & pythoncom.TYPEFLAG_FDISPATCHABLE): clsid = refAttr[0] ! if clsid in oleItems: dispItem = oleItems[clsid] else: *************** *** 697,701 **** interfaces[dispItem.clsid] = (dispItem, flags) # If dual interface, make do that too. ! if not vtableItems.has_key(clsid) and refAttr[11] & pythoncom.TYPEFLAG_FDUAL: refType = refType.GetRefTypeInfo(refType.GetRefTypeOfImplType(-1)) refAttr = refType.GetTypeAttr() --- 696,700 ---- interfaces[dispItem.clsid] = (dispItem, flags) # If dual interface, make do that too. ! if clsid not in vtableItems and refAttr[11] & pythoncom.TYPEFLAG_FDUAL: refType = refType.GetRefTypeInfo(refType.GetRefTypeOfImplType(-1)) refAttr = refType.GetTypeAttr() *************** *** 703,708 **** vtableItem = VTableItem(refType, refAttr, doc) vtableItems[clsid] = vtableItem ! coclass.sources = sources.values() ! coclass.interfaces = interfaces.values() def _Build_Interface(self, type_info_tuple): --- 702,707 ---- vtableItem = VTableItem(refType, refAttr, doc) vtableItems[clsid] = vtableItem ! coclass.sources = list(sources.values()) ! coclass.interfaces = list(interfaces.values()) def _Build_Interface(self, type_info_tuple): *************** *** 742,746 **** # hidden, assuming that you only ever use them via the CoClass) elif infotype in [pythoncom.TKIND_DISPATCH, pythoncom.TKIND_INTERFACE]: ! if not oleItems.has_key(clsid): oleItem, vtableItem = self._Build_Interface(type_info_tuple) oleItems[clsid] = oleItem # Even "None" goes in here. --- 741,745 ---- # hidden, assuming that you only ever use them via the CoClass) elif infotype in [pythoncom.TKIND_DISPATCH, pythoncom.TKIND_INTERFACE]: ! if clsid not in oleItems: oleItem, vtableItem = self._Build_Interface(type_info_tuple) oleItems[clsid] = oleItem # Even "None" goes in here. Index: gencache.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/client/gencache.py,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** gencache.py 22 Jan 2007 22:18:44 -0000 1.32 --- gencache.py 14 Nov 2008 00:22:25 -0000 1.33 *************** *** 21,25 **** Maybe an OLE2 compound file, or a bsddb file? """ ! import pywintypes, os, string, sys import pythoncom import win32com, win32com.client --- 21,25 ---- Maybe an OLE2 compound file, or a bsddb file? """ ! import pywintypes, os, sys import pythoncom import win32com, win32com.client *************** *** 49,52 **** --- 49,57 ---- demandGeneratedTypeLibraries = {} + try: + import cPickle as pickle + except ImportError: + import pickle + def __init__(): # Initialize the module. Called once explicitly at module import below. *************** *** 59,68 **** def _SaveDicts(): if is_readonly: ! raise RuntimeError, "Trying to write to a readonly gencache ('%s')!" \ ! % win32com.__gen_path__ ! import cPickle f = open(os.path.join(GetGeneratePath(), "dicts.dat"), "wb") try: ! p = cPickle.Pickler(f) p.dump(pickleVersion) p.dump(clsidToTypelib) --- 64,72 ---- def _SaveDicts(): if is_readonly: ! raise RuntimeError("Trying to write to a readonly gencache ('%s')!" \ ! % win32com.__gen_path__) f = open(os.path.join(GetGeneratePath(), "dicts.dat"), "wb") try: ! p = pickle.Pickler(f) p.dump(pickleVersion) p.dump(clsidToTypelib) *************** *** 71,78 **** def _LoadDicts(): - import cPickle # Load the dictionary from a .zip file if that is where we live. if hasattr(win32com, "__loader__"): ! import cStringIO loader = win32com.__loader__ arc_path = loader.archive --- 75,84 ---- def _LoadDicts(): # Load the dictionary from a .zip file if that is where we live. if hasattr(win32com, "__loader__"): ! try: ! import cStringIO as io ! except ImportError: ! import io loader = win32com.__loader__ arc_path = loader.archive *************** *** 101,110 **** # the dict) return ! f = cStringIO.StringIO(data) else: # NOTE: IOError on file open must be caught by caller. f = open(os.path.join(win32com.__gen_path__, "dicts.dat"), "rb") try: ! p = cPickle.Unpickler(f) version = p.load() global clsidToTypelib --- 107,116 ---- # the dict) return ! f = io.StringIO(data) else: # NOTE: IOError on file open must be caught by caller. f = open(os.path.join(win32com.__gen_path__, "dicts.dat"), "rb") try: ! p = pickle.Unpickler(f) version = p.load() global clsidToTypelib *************** *** 118,127 **** the file name (no extension) providing this support. """ ! return string.upper(str(clsid))[1:-1] + "x%sx%sx%s" % (lcid, major, minor) def SplitGeneratedFileName(fname): """Reverse of GetGeneratedFileName() """ ! return tuple(string.split(fname,'x',4)) def GetGeneratePath(): --- 124,133 ---- the file name (no extension) providing this support. """ ! return str(clsid).upper()[1:-1] + "x%sx%sx%s" % (lcid, major, minor) def SplitGeneratedFileName(fname): """Reverse of GetGeneratedFileName() """ ! return tuple(fname.split('x',4)) def GetGeneratePath(): *************** *** 235,239 **** # Force the generation. If this typelibrary has explicitly been added, # use it (it may not be registered, causing a lookup by clsid to fail) ! if demandGeneratedTypeLibraries.has_key(info): info = demandGeneratedTypeLibraries[info] import makepy --- 241,245 ---- # Force the generation. If this typelibrary has explicitly been added, # use it (it may not be registered, causing a lookup by clsid to fail) ! if info in demandGeneratedTypeLibraries: info = demandGeneratedTypeLibraries[info] import makepy *************** *** 259,265 **** # If the import worked, it doesn't mean we have actually added this # module to our cache though - check that here. ! if not mod.__dict__.has_key("_in_gencache_"): AddModuleToCache(typelibCLSID, lcid, major, minor) ! assert mod.__dict__.has_key("_in_gencache_") return mod --- 265,271 ---- # If the import worked, it doesn't mean we have actually added this # module to our cache though - check that here. ! if "_in_gencache_" not in mod.__dict__: AddModuleToCache(typelibCLSID, lcid, major, minor) ! assert "_in_gencache_" in mod.__dict__ return mod *************** *** 362,366 **** print "ForgetAboutTypelibInterface:: Warning - type library with info %s is not being remembered!" % (info,) # and drop any version redirects to it ! for key, val in versionRedirectMap.items(): if val==info: del versionRedirectMap[key] --- 368,372 ---- print "ForgetAboutTypelibInterface:: Warning - type library with info %s is not being remembered!" % (info,) # and drop any version redirects to it ! for key, val in list(versionRedirectMap.items()): if val==info: del versionRedirectMap[key] *************** *** 541,545 **** disp = disp_class(disp._oleobj_) except pythoncom.com_error: ! raise TypeError, "This COM object can not automate the makepy process - please run makepy manually for this object" return disp --- 547,551 ---- disp = disp_class(disp._oleobj_) except pythoncom.com_error: ! raise TypeError("This COM object can not automate the makepy process - please run makepy manually for this object") return disp *************** *** 554,574 **** dict = mod.CLSIDToClassMap info = str(typelibclsid), lcid, major, minor ! for clsid, cls in dict.items(): clsidToTypelib[clsid] = info dict = mod.CLSIDToPackageMap ! for clsid, name in dict.items(): clsidToTypelib[clsid] = info dict = mod.VTablesToClassMap ! for clsid, cls in dict.items(): clsidToTypelib[clsid] = info dict = mod.VTablesToPackageMap ! for clsid, cls in dict.items(): clsidToTypelib[clsid] = info # If this lib was previously redirected, drop it ! if versionRedirectMap.has_key(info): del versionRedirectMap[info] if bFlushNow: --- 560,580 ---- dict = mod.CLSIDToClassMap info = str(typelibclsid), lcid, major, minor ! for clsid, cls in dict.iteritems(): clsidToTypelib[clsid] = info dict = mod.CLSIDToPackageMap ! for clsid, name in dict.iteritems(): clsidToTypelib[clsid] = info dict = mod.VTablesToClassMap ! for clsid, cls in dict.iteritems(): clsidToTypelib[clsid] = info dict = mod.VTablesToPackageMap ! for clsid, cls in dict.iteritems(): clsidToTypelib[clsid] = info # If this lib was previously redirected, drop it ! if info in versionRedirectMap: del versionRedirectMap[info] if bFlushNow: *************** *** 578,582 **** zip_pos = win32com.__gen_path__.find(".zip\\") if zip_pos >= 0: ! import zipfile, cStringIO zip_file = win32com.__gen_path__[:zip_pos+4] zip_path = win32com.__gen_path__[zip_pos+5:].replace("\\", "/") --- 584,588 ---- zip_pos = win32com.__gen_path__.find(".zip\\") if zip_pos >= 0: ! import zipfile zip_file = win32com.__gen_path__[:zip_pos+4] zip_path = win32com.__gen_path__[zip_pos+5:].replace("\\", "/") *************** *** 600,604 **** infos[(iid, lcid, major, minor)] = 1 zf.close() ! return infos.keys() else: # on the file system --- 606,610 ---- infos[(iid, lcid, major, minor)] = 1 zf.close() ! return list(infos.keys()) else: # on the file system *************** *** 610,614 **** name = os.path.splitext(os.path.split(file)[1])[0] try: ! iid, lcid, major, minor = string.split(name, "x") iid = pywintypes.IID("{" + iid + "}") lcid = int(lcid) --- 616,620 ---- name = os.path.splitext(os.path.split(file)[1])[0] try: ! iid, lcid, major, minor = name.split("x") iid = pywintypes.IID("{" + iid + "}") lcid = int(lcid) *************** *** 653,659 **** # Build a unique dir d = {} ! for clsid, (typelibCLSID, lcid, major, minor) in clsidToTypelib.items(): d[typelibCLSID, lcid, major, minor] = None ! for typelibCLSID, lcid, major, minor in d.keys(): mod = GetModuleForTypelib(typelibCLSID, lcid, major, minor) print "%s - %s" % (mod.__doc__, typelibCLSID) --- 659,665 ---- # Build a unique dir d = {} ! for clsid, (typelibCLSID, lcid, major, minor) in clsidToTypelib.iteritems(): d[typelibCLSID, lcid, major, minor] = None ! for typelibCLSID, lcid, major, minor in d.iterkeys(): mod = GetModuleForTypelib(typelibCLSID, lcid, major, minor) print "%s - %s" % (mod.__doc__, typelibCLSID) Index: selecttlb.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/client/selecttlb.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** selecttlb.py 17 Oct 2007 03:51:57 -0000 1.10 --- selecttlb.py 14 Nov 2008 00:22:25 -0000 1.11 *************** *** 2,6 **** """ ! import win32api, win32con, string, pythoncom class TypelibSpec: --- 2,6 ---- """ ! import win32api, win32con, pythoncom class TypelibSpec: *************** *** 22,30 **** if item==0: return self.ver_desc ! raise IndexError, "Cant index me!" def __cmp__(self, other): ! rc = cmp(string.lower(self.ver_desc or ""), string.lower(other.ver_desc or "")) if rc==0: ! rc = cmp(string.lower(self.desc), string.lower(other.desc)) if rc==0: rc = cmp(self.major, other.major) --- 22,30 ---- if item==0: return self.ver_desc ! raise IndexError("Cant index me!") def __cmp__(self, other): ! rc = cmp((self.ver_desc or "").lower(), (other.ver_desc or "").lower()) if rc==0: ! rc = cmp(self.desc.lower(), other.desc.lower()) if rc==0: rc = cmp(self.major, other.major) *************** *** 85,89 **** continue for version, tlbdesc in EnumKeys(key2): ! major_minor = string.split(version, '.', 1) if len(major_minor) < 2: major_minor.append('0') --- 85,89 ---- continue for version, tlbdesc in EnumKeys(key2): ! major_minor = version.split('.', 1) if len(major_minor) < 2: major_minor.append('0') Index: CLSIDToClass.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/client/CLSIDToClass.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** CLSIDToClass.py 23 Oct 2008 03:40:36 -0000 1.2 --- CLSIDToClass.py 14 Nov 2008 00:22:25 -0000 1.3 *************** *** 51,53 **** clsid -- the string CLSID to check """ ! return mapCLSIDToClass.has_key(clsid) --- 51,53 ---- clsid -- the string CLSID to check """ ! return clsid in mapCLSIDToClass |
From: Mark H. <mha...@us...> - 2008-11-14 00:22:30
|
Update of /cvsroot/pywin32/pywin32/Pythonwin/pywin In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv24802/Pythonwin/pywin Modified Files: __init__.py Log Message: Various modernizations to .py code via the py3k branch. Index: __init__.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/__init__.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** __init__.py 26 Jan 2004 04:09:13 -0000 1.4 --- __init__.py 14 Nov 2008 00:22:25 -0000 1.5 *************** *** 1,5 **** # See if we run in Unicode mode. # This may be referenced all over the place, so we save it globally. ! import win32api, win32con, __builtin__ # This doesn't seem to work correctly on NT - see bug 716708 --- 1,5 ---- # See if we run in Unicode mode. # This may be referenced all over the place, so we save it globally. ! import win32api, win32con # This doesn't seem to work correctly on NT - see bug 716708 *************** *** 9,11 **** default_scintilla_encoding = "utf-8" # Scintilla _only_ supports this ATM ! del win32api, win32con, __builtin__ --- 9,11 ---- default_scintilla_encoding = "utf-8" # Scintilla _only_ supports this ATM ! del win32api, win32con |
From: Mark H. <mha...@us...> - 2008-11-14 00:22:30
|
Update of /cvsroot/pywin32/pywin32/win32/test In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv24802/win32/test Modified Files: testall.py Log Message: Various modernizations to .py code via the py3k branch. Index: testall.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/test/testall.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** testall.py 29 May 2007 12:22:28 -0000 1.6 --- testall.py 14 Nov 2008 00:22:25 -0000 1.7 *************** *** 6,10 **** ui_demos = """GetSaveFileName print_desktop win32cred_demo win32gui_demo win32gui_dialog win32gui_menu win32gui_taskbar ! win32rcparser_demo winprocess win32console_demo""".split() # Other demos known as 'bad' (or at least highly unlikely to work) # cerapi: no CE module is built (CE via pywin32 appears dead) --- 6,12 ---- ui_demos = """GetSaveFileName print_desktop win32cred_demo win32gui_demo win32gui_dialog win32gui_menu win32gui_taskbar ! win32rcparser_demo winprocess win32console_demo ! win32gui_devicenotify ! NetValidatePasswordPolicy""".split() # Other demos known as 'bad' (or at least highly unlikely to work) # cerapi: no CE module is built (CE via pywin32 appears dead) |
From: Roger U. <ru...@us...> - 2008-11-13 15:12:53
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv7256 Modified Files: Tag: py3k win32file.i Log Message: Fix buffer resizing for Py3k Index: win32file.i =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32file.i,v retrieving revision 1.93.2.3 retrieving revision 1.93.2.4 diff -C2 -d -r1.93.2.3 -r1.93.2.4 *** win32file.i 13 Oct 2008 06:47:14 -0000 1.93.2.3 --- win32file.i 13 Nov 2008 15:12:49 -0000 1.93.2.4 *************** *** 327,331 **** // @pyparm <o PyUnicode>|fileName||The filename to delete ! /* %{ // @pyswig str/buffer|DeviceIoControl|Sends a control code to a device or file system driver --- 327,331 ---- // @pyparm <o PyUnicode>|fileName||The filename to delete ! %{ // @pyswig str/buffer|DeviceIoControl|Sends a control code to a device or file system driver *************** *** 429,434 **** if (bBuffer){ // Create a view of existing buffer with actual output size ! // Reimplement by using ob->tp_as_buffer->getbuffer, but there's no way to specify an offset ! PyObject *resized=PyBuffer_FromReadWriteObject(ret, 0, numRead); Py_DECREF(ret); ret=resized; --- 429,438 ---- if (bBuffer){ // Create a view of existing buffer with actual output size ! // Memoryview object in py3k supports slicing ! #if (PY_VERSION_HEX >= 0x03000000) ! PyObject *resized=PySequence_GetSlice(ret, 0, numRead); ! #else ! PyObject *resized=PyBuffer_FromReadWriteObject(ret, 0, numRead); ! #endif Py_DECREF(ret); ret=resized; *************** *** 442,446 **** %} %native(DeviceIoControl) pfnpy_DeviceIoControl; ! */ %native (OVERLAPPED) PyWinMethod_NewOVERLAPPED; --- 446,450 ---- %} %native(DeviceIoControl) pfnpy_DeviceIoControl; ! %native (OVERLAPPED) PyWinMethod_NewOVERLAPPED; *************** *** 650,656 **** BOOLAPI GetFileTime( HANDLE handle, // @pyparm <o PyHANDLE>|handle||Handle to the file. ! FILETIME *OUTPUT, // @pyparm <o PyTime>|creationTime|| ! FILETIME *OUTPUT, // @pyparm <o PyTime>|accessTime|| ! FILETIME *OUTPUT // @pyparm <o PyTime>|writeTime|| ); --- 654,660 ---- BOOLAPI GetFileTime( HANDLE handle, // @pyparm <o PyHANDLE>|handle||Handle to the file. ! FILETIME *OUTPUT, ! FILETIME *OUTPUT, ! FILETIME *OUTPUT ); |
From: Roger U. <ru...@us...> - 2008-11-13 14:55:01
|
Update of /cvsroot/pywin32/pywin32/win32/Lib In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv5090 Modified Files: Tag: py3k winioctlcon.py Log Message: Remove L suffix from constants Index: winioctlcon.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/Lib/winioctlcon.py,v retrieving revision 1.3 retrieving revision 1.3.2.1 diff -C2 -d -r1.3 -r1.3.2.1 *** winioctlcon.py 17 Feb 2007 05:32:55 -0000 1.3 --- winioctlcon.py 13 Nov 2008 14:54:55 -0000 1.3.2.1 *************** *** 7,11 **** def DEVICE_TYPE_FROM_CTL_CODE(ctrlCode): ! return (ctrlCode & 0xffff0000L) >> 16 FILE_DEVICE_BEEP = 0x00000001 --- 7,11 ---- def DEVICE_TYPE_FROM_CTL_CODE(ctrlCode): ! return (ctrlCode & 0xffff0000) >> 16 FILE_DEVICE_BEEP = 0x00000001 *************** *** 86,92 **** WRITE_COMPRESSION_INFO_VALID = 0x00000010 READ_COMPRESSION_INFO_VALID = 0x00000020 ! TAPE_RETURN_STATISTICS = 0L ! TAPE_RETURN_ENV_INFO = 1L ! TAPE_RESET_STATISTICS = 2L MEDIA_ERASEABLE = 0x00000001 MEDIA_WRITE_ONCE = 0x00000002 --- 86,92 ---- WRITE_COMPRESSION_INFO_VALID = 0x00000010 READ_COMPRESSION_INFO_VALID = 0x00000020 ! TAPE_RETURN_STATISTICS = 0 ! TAPE_RETURN_ENV_INFO = 1 ! TAPE_RESET_STATISTICS = 2 MEDIA_ERASEABLE = 0x00000001 MEDIA_WRITE_ONCE = 0x00000002 *************** *** 94,98 **** MEDIA_READ_WRITE = 0x00000008 MEDIA_WRITE_PROTECTED = 0x00000100 ! MEDIA_CURRENTLY_MOUNTED = 0x80000000L IOCTL_DISK_BASE = FILE_DEVICE_DISK PARTITION_ENTRY_UNUSED = 0x00 --- 94,98 ---- MEDIA_READ_WRITE = 0x00000008 MEDIA_WRITE_PROTECTED = 0x00000100 ! MEDIA_CURRENTLY_MOUNTED = 0x80000000 IOCTL_DISK_BASE = FILE_DEVICE_DISK PARTITION_ENTRY_UNUSED = 0x00 *************** *** 203,218 **** CHANGER_DRIVE_EMPTY_ON_DOOR_ACCESS = 0x20000000 ! CHANGER_RESERVED_BIT = 0x80000000L ! CHANGER_PREDISMOUNT_ALIGN_TO_SLOT = 0x80000001L ! CHANGER_PREDISMOUNT_ALIGN_TO_DRIVE = 0x80000002L ! CHANGER_CLEANER_AUTODISMOUNT = 0x80000004L ! CHANGER_TRUE_EXCHANGE_CAPABLE = 0x80000008L ! CHANGER_SLOTS_USE_TRAYS = 0x80000010L ! CHANGER_RTN_MEDIA_TO_ORIGINAL_ADDR = 0x80000020L ! CHANGER_CLEANER_OPS_NOT_SUPPORTED = 0x80000040L ! CHANGER_IEPORT_USER_CONTROL_OPEN = 0x80000080L ! CHANGER_IEPORT_USER_CONTROL_CLOSE = 0x80000100L ! CHANGER_MOVE_EXTENDS_IEPORT = 0x80000200L ! CHANGER_MOVE_RETRACTS_IEPORT = 0x80000400L --- 203,218 ---- CHANGER_DRIVE_EMPTY_ON_DOOR_ACCESS = 0x20000000 ! CHANGER_RESERVED_BIT = 0x80000000 ! CHANGER_PREDISMOUNT_ALIGN_TO_SLOT = 0x80000001 ! CHANGER_PREDISMOUNT_ALIGN_TO_DRIVE = 0x80000002 ! CHANGER_CLEANER_AUTODISMOUNT = 0x80000004 ! CHANGER_TRUE_EXCHANGE_CAPABLE = 0x80000008 ! CHANGER_SLOTS_USE_TRAYS = 0x80000010 ! CHANGER_RTN_MEDIA_TO_ORIGINAL_ADDR = 0x80000020 ! CHANGER_CLEANER_OPS_NOT_SUPPORTED = 0x80000040 ! CHANGER_IEPORT_USER_CONTROL_OPEN = 0x80000080 ! CHANGER_IEPORT_USER_CONTROL_CLOSE = 0x80000100 ! CHANGER_MOVE_EXTENDS_IEPORT = 0x80000200 ! CHANGER_MOVE_RETRACTS_IEPORT = 0x80000400 *************** *** 248,252 **** ERROR_TRAY_MALFUNCTION = 0x00000010 ERROR_INIT_STATUS_NEEDED = 0x00000011 ! ERROR_UNHANDLED_ERROR = 0xFFFFFFFFL SEARCH_ALL = 0x0 SEARCH_PRIMARY = 0x1 --- 248,252 ---- ERROR_TRAY_MALFUNCTION = 0x00000010 ERROR_INIT_STATUS_NEEDED = 0x00000011 ! ERROR_UNHANDLED_ERROR = 0xFFFFFFFF SEARCH_ALL = 0x0 SEARCH_PRIMARY = 0x1 *************** *** 283,287 **** USN_REASON_STREAM_CHANGE = 0x00200000 USN_REASON_TRANSACTED_CHANGE = 0x00400000 ! USN_REASON_CLOSE = 0x80000000L USN_DELETE_FLAG_DELETE = 0x00000001 USN_DELETE_FLAG_NOTIFY = 0x00000002 --- 283,287 ---- USN_REASON_STREAM_CHANGE = 0x00200000 USN_REASON_TRANSACTED_CHANGE = 0x00400000 ! USN_REASON_CLOSE = 0x80000000 USN_DELETE_FLAG_DELETE = 0x00000001 USN_DELETE_FLAG_NOTIFY = 0x00000002 |
From: Vern C. <kf...@ya...> - 2008-11-13 13:02:21
|
Argh! I'm still struggling with version control -- learning three at once. My personal & commercial stuff is on Bazaar so I only use CVS for pywin32 and am not too good with it. I intended that this checkin be applied to the py3k fork only. It was supposed to update that branch with the same changes I already applied to the trunk as version 2.2.2. (Please tell me that one made it.) I used python 2.6 for testing because I needed to import pythoncom and win32com, which work on 2.6 and I assumed were not yet ready on py3k. (If I had compiled them would they have worked?) This code merges your changes and mine from the trunk, and Roger Upole's from the py3k fork, and a bit of new work for compatibility. I updated the version number to 2.2.3 to reflect the changes that let it work with either 2.6 or 3.0. (It has to use "buffer" in 2.6 and "memoryview" in 3.0) I dropped the 2.3 specific code as superfluous in that fork. So these changes are known to work on 2.6 and may (hopefully) work in py3k and some future IronPython 3.0. Would you be so kind as to make sure that this update is in the py3k fork where it belongs? I don't want to make things worse by fumbling with it. -- Vernon --- On Wed, 11/12/08, Mark Hammond <mha...@sk...> wrote: > From: Mark Hammond <mha...@sk...> > Subject: RE: [pywin32-checkins] pywin32/adodbapi adodbapi.py,1.2.2.1,1.2.2.2 > To: "'Vernon Cole'" <kf...@us...>, pyw...@li... > Date: Wednesday, November 12, 2008, 9:46 PM > > + version 2.2.3 update for Python 3, require python > 2.6 or later > > Ack - the rest of pywin32 will support 2.3 and up, and will > stick with a 2.x > syntax, in the interests of avoid a "fork" into 2 > incompatible code-bases. > I'm slowly going through the py3k branch and reverting > all the 3k specific > things - is there any chance we can revert all non 2.4 > compatible changes > and apply them only to the trunk? > > Thanks, > > Mark |
From: Mark H. <mha...@us...> - 2008-11-13 11:12:09
|
Update of /cvsroot/pywin32/pywin32/win32/src/win32print In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv9817/win32/src/win32print Modified Files: win32print.cpp Log Message: Yet more TCHAR/64bit and other misc changes from py3k branch. Index: win32print.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32print/win32print.cpp,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** win32print.cpp 10 Feb 2008 13:35:33 -0000 1.30 --- win32print.cpp 13 Nov 2008 11:11:58 -0000 1.31 *************** *** 1030,1041 **** JOB_INFO_2 *job2; JOB_INFO_3 *job3; ! SYSTEMTIME localSubmitted; ! PyObject *pylocalsubmitted, *ret; switch (level){ case 1:{ job1= (JOB_INFO_1 *)buf; ! SystemTimeToTzSpecificLocalTime(NULL, &(job1->Submitted), &localSubmitted); ! pylocalsubmitted= new PyTime(localSubmitted); ! ret= Py_BuildValue("{s:k, s:N, s:N, s:N, s:N, s:N, s:N, s:k, s:k, s:k, s:k, s:k, s:O}", "JobId", job1->JobId, "pPrinterName", PyWinObject_FromTCHAR(job1->pPrinterName), --- 1030,1038 ---- JOB_INFO_2 *job2; JOB_INFO_3 *job3; ! PyObject *ret; switch (level){ case 1:{ job1= (JOB_INFO_1 *)buf; ! ret= Py_BuildValue("{s:k, s:N, s:N, s:N, s:N, s:N, s:N, s:k, s:k, s:k, s:k, s:k, s:N}", "JobId", job1->JobId, "pPrinterName", PyWinObject_FromTCHAR(job1->pPrinterName), *************** *** 1050,1062 **** "TotalPages", job1->TotalPages, "PagesPrinted", job1->PagesPrinted, ! "Submitted", pylocalsubmitted); ! Py_XDECREF(pylocalsubmitted); return ret; } case 2:{ job2=(JOB_INFO_2 *)buf; ! SystemTimeToTzSpecificLocalTime(NULL, &(job2->Submitted), &localSubmitted); ! pylocalsubmitted= new PyTime(localSubmitted); ! ret= Py_BuildValue("{s:k, s:N, s:N, s:N, s:N, s:N, s:N, s:N, s:N, s:N, s:N, s:N, s:N, s:k, s:k, s:k, s:k, s:k, s:k, s:k, s:O, s:k, s:k}", "JobId", job2->JobId, "pPrinterName", PyWinObject_FromTCHAR(job2->pPrinterName), --- 1047,1056 ---- "TotalPages", job1->TotalPages, "PagesPrinted", job1->PagesPrinted, ! "Submitted", PyWinObject_FromSYSTEMTIME(job1->Submitted)); return ret; } case 2:{ job2=(JOB_INFO_2 *)buf; ! ret= Py_BuildValue("{s:k, s:N, s:N, s:N, s:N, s:N, s:N, s:N, s:N, s:N, s:N, s:N, s:N, s:k, s:k, s:k, s:k, s:k, s:k, s:k, s:N, s:k, s:k}", "JobId", job2->JobId, "pPrinterName", PyWinObject_FromTCHAR(job2->pPrinterName), *************** *** 1079,1086 **** "TotalPages", job2->TotalPages, "Size", job2->Size, ! "Submitted", pylocalsubmitted, "Time", job2->Time, "PagesPrinted", job2->PagesPrinted); - Py_XDECREF(pylocalsubmitted); return ret; } --- 1073,1079 ---- "TotalPages", job2->TotalPages, "Size", job2->Size, ! "Submitted", PyWinObject_FromSYSTEMTIME(job2->Submitted), "Time", job2->Time, "PagesPrinted", job2->PagesPrinted); return ret; } *************** *** 2585,2589 **** /* List of functions exported by this module */ ! // @module win32print|A module, encapsulating the Windows Win32 API. static struct PyMethodDef win32print_functions[] = { {"OpenPrinter", PyOpenPrinter, 1}, // @pymeth OpenPrinter|Retrieves a handle to a printer. --- 2578,2582 ---- /* List of functions exported by this module */ ! // @module win32print|A module encapsulating the Windows printing API. static struct PyMethodDef win32print_functions[] = { {"OpenPrinter", PyOpenPrinter, 1}, // @pymeth OpenPrinter|Retrieves a handle to a printer. *************** *** 2837,2839 **** dummy_tuple=PyTuple_New(0); } - --- 2830,2831 ---- |
Update of /cvsroot/pywin32/pywin32/win32/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv9817/win32/src Modified Files: PySECURITY_DESCRIPTOR.cpp PySID.cpp PyWinObjects.h PyWinTypesmodule.cpp PythonService.cpp _win32sysloader.cpp _winxptheme.i mmapfilemodule.cpp win2krasmodule.cpp win32event.i win32file_comm.cpp win32helpmodule.cpp win32process.i win32service.i win32trace.cpp Log Message: Yet more TCHAR/64bit and other misc changes from py3k branch. Index: win32process.i =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32process.i,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** win32process.i 13 Nov 2008 04:04:51 -0000 1.34 --- win32process.i 13 Nov 2008 11:11:58 -0000 1.35 *************** *** 191,205 **** return gethandle(pO->m_obStdErr, pO->m_startupinfo.hStdError); // @prop string/None|lpDesktop| ! if (strcmp("lpDesktop", name)==0) { ! PyObject *rc = pO->m_obDesktop ? pO->m_obDesktop : Py_None; ! Py_INCREF(rc); ! return rc; ! } // @prop string/None|lpTitle| ! if (strcmp("lpTitle", name)==0) { ! PyObject *rc = pO->m_obTitle ? pO->m_obTitle : Py_None; ! Py_INCREF(rc); ! return rc; ! } return PyMember_Get((char *)self, memberlist, name); } --- 191,199 ---- return gethandle(pO->m_obStdErr, pO->m_startupinfo.hStdError); // @prop string/None|lpDesktop| ! if (strcmp("lpDesktop", name)==0) ! return PyWinObject_FromTCHAR(pO->m_startupinfo.lpDesktop); // @prop string/None|lpTitle| ! if (strcmp("lpTitle", name)==0) ! return PyWinObject_FromTCHAR(pO->m_startupinfo.lpTitle); return PyMember_Get((char *)self, memberlist, name); } *************** *** 238,258 **** if (strcmp("lpDesktop", name)==0) { ! if (PyWinObject_AsTCHAR(v, &pO->m_startupinfo.lpDesktop, TRUE)) { ! Py_XDECREF(pO->m_obDesktop); ! pO->m_obDesktop = v; ! Py_INCREF(v); ! return 0; ! } else return -1; ! } if (strcmp("lpTitle", name)==0) { ! if (PyWinObject_AsTCHAR(v, &pO->m_startupinfo.lpTitle, TRUE)) { ! Py_XDECREF(pO->m_obTitle); ! pO->m_obTitle = v; ! Py_INCREF(v); ! return 0; ! } else return -1; ! } return PyMember_Set((char *)self, memberlist, name, v); } --- 232,251 ---- if (strcmp("lpDesktop", name)==0) { ! TCHAR *val; ! if (!PyWinObject_AsTCHAR(v, &val, TRUE)) return -1; ! PyWinObject_FreeTCHAR(pO->m_startupinfo.lpDesktop); ! pO->m_startupinfo.lpDesktop = val; ! return 0; ! } ! if (strcmp("lpTitle", name)==0) { ! TCHAR *val; ! if (!PyWinObject_AsTCHAR(v, &val, TRUE)) return -1; ! PyWinObject_FreeTCHAR(pO->m_startupinfo.lpTitle); ! pO->m_startupinfo.lpTitle=val; ! return 0; ! } return PyMember_Set((char *)self, memberlist, name, v); } Index: win32trace.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32trace.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** win32trace.cpp 30 Oct 2008 02:38:55 -0000 1.15 --- win32trace.cpp 13 Nov 2008 11:11:58 -0000 1.16 *************** *** 41,48 **** const unsigned long BUFFER_SIZE = 0x20000; // Includes size integer. ! const char *MAP_OBJECT_NAME = "Global\\PythonTraceOutputMapping"; ! const char *MUTEX_OBJECT_NAME = "Global\\PythonTraceOutputMutex"; ! const char *EVENT_OBJECT_NAME = "Global\\PythonTraceOutputEvent"; ! const char *EVENT_EMPTY_OBJECT_NAME = "Global\\PythonTraceOutputEmptyEvent"; // Global\\ etc goodness: --- 41,48 ---- const unsigned long BUFFER_SIZE = 0x20000; // Includes size integer. ! const TCHAR *MAP_OBJECT_NAME = _T("Global\\PythonTraceOutputMapping"); ! const TCHAR *MUTEX_OBJECT_NAME = _T("Global\\PythonTraceOutputMutex"); ! const TCHAR *EVENT_OBJECT_NAME = _T("Global\\PythonTraceOutputEvent"); ! const TCHAR *EVENT_EMPTY_OBJECT_NAME = _T("Global\\PythonTraceOutputEmptyEvent"); // Global\\ etc goodness: *************** *** 72,79 **** BOOL use_global_namespace = FALSE; ! static const char *FixupObjectName(const char *global_name) { if (!use_global_namespace) ! return strchr(global_name, '\\')+1; // global prefix is ok. return global_name; --- 72,79 ---- BOOL use_global_namespace = FALSE; ! static const TCHAR *FixupObjectName(const TCHAR *global_name) { if (!use_global_namespace) ! return _tcschr(global_name, '\\')+1; // global prefix is ok. return global_name; *************** *** 175,179 **** static PyMethodDef PyTraceObject_methods[] = { ! {"blockingread", PyTraceObject_blockingread, METH_VARARGS}, // @pytmeth blockingread {"read", PyTraceObject_read, METH_VARARGS }, // @pymeth read| {"write", PyTraceObject_write, METH_VARARGS }, // @pymeth write| --- 175,179 ---- static PyMethodDef PyTraceObject_methods[] = { ! {"blockingread", PyTraceObject_blockingread, METH_VARARGS}, // @pymeth blockingread {"read", PyTraceObject_read, METH_VARARGS }, // @pymeth read| {"write", PyTraceObject_write, METH_VARARGS }, // @pymeth write| *************** *** 611,619 **** PyObject *dict; PyObject* pModMe = Py_InitModule("win32trace", win32trace_functions); if (!pModMe) return; dict = PyModule_GetDict(pModMe); if (!dict) return; - Py_INCREF(PyWinExc_ApiError); PyDict_SetItemString(dict, "error", PyWinExc_ApiError); --- 611,619 ---- PyObject *dict; PyObject* pModMe = Py_InitModule("win32trace", win32trace_functions); + #define RETURN_ERROR return // towards py3k if (!pModMe) return; dict = PyModule_GetDict(pModMe); if (!dict) return; PyDict_SetItemString(dict, "error", PyWinExc_ApiError); *************** *** 671,675 **** if (hMutex==NULL) { PyWin_SetAPIError("CreateMutex"); ! return ; } assert (hEvent==NULL); --- 671,675 ---- if (hMutex==NULL) { PyWin_SetAPIError("CreateMutex"); ! RETURN_ERROR ; } assert (hEvent==NULL); *************** *** 677,681 **** if (hEvent==NULL) { PyWin_SetAPIError("CreateEvent"); ! return ; } assert (hEventEmpty==NULL); --- 677,681 ---- if (hEvent==NULL) { PyWin_SetAPIError("CreateEvent"); ! RETURN_ERROR; } assert (hEventEmpty==NULL); *************** *** 683,687 **** if (hEventEmpty==NULL) { PyWin_SetAPIError("CreateEvent"); ! return ; } } --- 683,687 ---- if (hEventEmpty==NULL) { PyWin_SetAPIError("CreateEvent"); ! RETURN_ERROR ; } } Index: PyWinObjects.h =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/PyWinObjects.h,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** PyWinObjects.h 25 May 2008 00:34:23 -0000 1.14 --- PyWinObjects.h 13 Nov 2008 11:11:58 -0000 1.15 *************** *** 3,55 **** #define __PYWINTYPES_H__ - - #ifndef PYWIN_USE_PYUNICODE - - class PYWINTYPES_EXPORT PyUnicode : public PyObject - { - public: - BSTR m_bstrValue; - - PyUnicode(void); - PyUnicode(const char *value); - PyUnicode(const char *value, unsigned int numBytes); - PyUnicode(const OLECHAR *value); - PyUnicode(const OLECHAR *value, int numChars); - PyUnicode(const BSTR value, BOOL takeOwnership=FALSE); - PyUnicode(PyObject *value); - ~PyUnicode(); - - /* Python support */ - int compare(PyObject *ob); - PyObject * concat(PyObject *ob); - PyObject * repeat(int count); - PyObject * item(int index); - PyObject * slice(int start, int end); - PyObject * getattr(char *name); - long hash(void); - PyObject *asStr(void); - int print(FILE *fp, int flags); - PyObject *repr(); - PyObject * upper(void); - PyObject * lower(void); - - static void deallocFunc(PyObject *ob); - static int compareFunc(PyObject *ob1, PyObject *ob2); - static long hashFunc(PyObject *ob); - static PyObject * strFunc(PyObject *ob); - static int printFunc(PyObject *ob, FILE *fp, int flags); - static PyObject * reprFunc(PyObject *ob); - static int lengthFunc(PyObject *ob); - static PyObject * concatFunc(PyObject *ob1, PyObject *ob2); - static PyObject * repeatFunc(PyObject *ob1, int count); - static PyObject * itemFunc(PyObject *ob1, int index); - static PyObject * sliceFunc(PyObject *ob1, int start, int end); - static PyObject * getattrFunc(PyObject *ob, char *name); - static PyObject * upperFunc(PyObject *ob, PyObject *args); - static PyObject * lowerFunc(PyObject *ob, PyObject *args); - }; - - #endif // PYWIN_USE_PYUNICODE - #ifndef NO_PYWINTYPES_IID // NOTE - In general, you should not use "new PyIID", but use the --- 3,6 ---- *************** *** 190,193 **** --- 141,145 ---- static int nonzeroFunc(PyObject *ob); static long hashFunc(PyObject *ob); + static PyObject * strFunc(PyObject *ob); static PyObject * intFunc(PyObject *ob); Index: win32file_comm.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32file_comm.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** win32file_comm.cpp 21 May 2001 12:42:42 -0000 1.5 --- win32file_comm.cpp 13 Nov 2008 11:11:58 -0000 1.6 *************** *** 19,23 **** PyObject *PyWinObject_FromCOMMTIMEOUTS( COMMTIMEOUTS *p) { ! return Py_BuildValue("iiiii", p->ReadIntervalTimeout, p->ReadTotalTimeoutMultiplier, --- 19,23 ---- PyObject *PyWinObject_FromCOMMTIMEOUTS( COMMTIMEOUTS *p) { ! return Py_BuildValue("kkkkk", p->ReadIntervalTimeout, p->ReadTotalTimeoutMultiplier, *************** *** 29,33 **** BOOL PyWinObject_AsCOMMTIMEOUTS( PyObject *ob, COMMTIMEOUTS *p) { ! return PyArg_ParseTuple(ob, "iiiii", &p->ReadIntervalTimeout, &p->ReadTotalTimeoutMultiplier, --- 29,33 ---- BOOL PyWinObject_AsCOMMTIMEOUTS( PyObject *ob, COMMTIMEOUTS *p) { ! return PyArg_ParseTuple(ob, "kkkkk", &p->ReadIntervalTimeout, &p->ReadTotalTimeoutMultiplier, Index: _winxptheme.i =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/_winxptheme.i,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** _winxptheme.i 3 Jun 2007 14:53:07 -0000 1.3 --- _winxptheme.i 13 Nov 2008 11:11:58 -0000 1.4 *************** *** 85,97 **** } ! %apply long {HTHEME}; ! typedef long HTHEME; ! ! ! %apply HWND {long}; ! typedef long HWND ! %apply HDC {long}; ! typedef long HDC %typemap(python,ignore) RECT *OUTPUT(RECT temp) --- 85,96 ---- } ! %apply HANDLE {HTHEME}; ! typedef HANDLE HTHEME; ! typedef float HDC; ! %typemap(python, in) HDC{ ! if (!PyWinObject_AsHANDLE($source, (HANDLE *)&$target)) ! return NULL; ! } %typemap(python,ignore) RECT *OUTPUT(RECT temp) Index: win32event.i =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32event.i,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** win32event.i 2 Oct 2008 01:31:28 -0000 1.10 --- win32event.i 13 Nov 2008 11:11:58 -0000 1.11 *************** *** 238,244 **** DWORD rc; - // Do a LoadLibrary, as the Ex version does not exist on NT3.x, Win95 // @comm This method will no longer raise a COM E_NOTIMPL exception ! // as it is no longer dynamically loaded. Py_BEGIN_ALLOW_THREADS rc = MsgWaitForMultipleObjectsEx(numItems, pItems, dwMilliseconds, dwWakeMask, dwFlags); --- 238,243 ---- DWORD rc; // @comm This method will no longer raise a COM E_NOTIMPL exception ! // as it is no longer dynamically loaded. Py_BEGIN_ALLOW_THREADS rc = MsgWaitForMultipleObjectsEx(numItems, pItems, dwMilliseconds, dwWakeMask, dwFlags); *************** *** 254,258 **** %} - // @pyswig <o PyHANDLE>|OpenEvent|Returns a handle of an existing named event object. PyHANDLE OpenEvent( --- 253,256 ---- Index: PyWinTypesmodule.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/PyWinTypesmodule.cpp,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** PyWinTypesmodule.cpp 13 Nov 2008 04:04:51 -0000 1.44 --- PyWinTypesmodule.cpp 13 Nov 2008 11:11:58 -0000 1.45 *************** *** 875,878 **** --- 875,879 ---- // @tupleitem 3|None/int|argerror|The index of the argument in error, or (usually) None or -1 } + return 0; } Index: PythonService.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/PythonService.cpp,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** PythonService.cpp 10 Feb 2008 13:34:49 -0000 1.24 --- PythonService.cpp 13 Nov 2008 11:11:58 -0000 1.25 *************** *** 32,36 **** PYSERVICE_EXPORT BOOL PythonService_PrepareToHostMultiple(const TCHAR *service_name, PyObject *klass); PYSERVICE_EXPORT BOOL PythonService_StartServiceCtrlDispatcher(); ! PYSERVICE_EXPORT int PythonService_main(int argc, char **argv); TCHAR g_szEventSourceName[MAX_PATH] = _T("Python Service"); --- 32,36 ---- PYSERVICE_EXPORT BOOL PythonService_PrepareToHostMultiple(const TCHAR *service_name, PyObject *klass); PYSERVICE_EXPORT BOOL PythonService_StartServiceCtrlDispatcher(); ! PYSERVICE_EXPORT int PythonService_main(int argc, TCHAR **argv); TCHAR g_szEventSourceName[MAX_PATH] = _T("Python Service"); *************** *** 121,129 **** static PY_SERVICE_TABLE_ENTRY *FindPythonServiceEntry(LPCTSTR svcName); ! static PyObject *LoadPythonServiceClass(char *svcInitString); static PyObject *LoadPythonServiceInstance(PyObject *, DWORD dwArgc, LPTSTR *lpszArgv ); ! static BOOL LocatePythonServiceClassString( TCHAR *svcName, char *buf, int cchBuf); --- 121,129 ---- static PY_SERVICE_TABLE_ENTRY *FindPythonServiceEntry(LPCTSTR svcName); ! static PyObject *LoadPythonServiceClass(TCHAR *svcInitString); static PyObject *LoadPythonServiceInstance(PyObject *, DWORD dwArgc, LPTSTR *lpszArgv ); ! static BOOL LocatePythonServiceClassString( TCHAR *svcName, TCHAR *buf, int cchBuf); *************** *** 541,557 **** }; - static int AddConstant(PyObject *dict, const char *key, long value) - { - PyObject *oval = PyInt_FromLong(value); - if (!oval) - { - return 1; - } - int rc = PyDict_SetItemString(dict, (char*)key, oval); - Py_DECREF(oval); - return rc; - } ! #define ADD_CONSTANT(tok) AddConstant(dict, #tok, tok) extern "C" __declspec(dllexport) void --- 541,546 ---- }; ! #define ADD_CONSTANT(tok) if (PyModule_AddIntConstant(module, #tok, tok) == -1) RETURN_ERROR; extern "C" __declspec(dllexport) void *************** *** 561,564 **** --- 550,554 ---- PyObject *dict, *module; module = Py_InitModule("servicemanager", servicemanager_functions); + #define RETURN_ERROR return // towards py3k if (!module) /* Eeek - some serious error! */ return; *************** *** 567,571 **** servicemanager_startup_error = PyErr_NewException("servicemanager.startup_error", NULL, NULL); ! if (servicemanager_startup_error == NULL) return; PyDict_SetItemString(dict, "startup_error", servicemanager_startup_error); --- 557,562 ---- 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); *************** *** 835,840 **** pe = PythonServiceTable; if (!pe->klass) { ! char svcInitBuf[256]; ! LocatePythonServiceClassString(lpszArgv[0], svcInitBuf, sizeof(svcInitBuf)); pe->klass = LoadPythonServiceClass(svcInitBuf); } --- 826,831 ---- pe = PythonServiceTable; if (!pe->klass) { ! TCHAR svcInitBuf[256]; ! LocatePythonServiceClassString(lpszArgv[0], svcInitBuf, sizeof(svcInitBuf)/sizeof(svcInitBuf[0])); pe->klass = LoadPythonServiceClass(svcInitBuf); } *************** *** 1042,1046 **** // the service has stopped, so exit. // ! int PythonService_main(int argc, char **argv) { // Note that we don't know the service name we are hosting yet! --- 1033,1037 ---- // the service has stopped, so exit. // ! int PythonService_main(int argc, TCHAR **argv) { // Note that we don't know the service name we are hosting yet! *************** *** 1081,1086 **** { #ifndef BUILD_FREEZE ! if ( _stricmp( "register", argv[1]+1 ) == 0 || ! _stricmp( "install", argv[1]+1 ) == 0 ) { // Get out of here. --- 1072,1077 ---- { #ifndef BUILD_FREEZE ! if ( _tcsicmp( _T("register"), argv[1]+1 ) == 0 || ! _tcsicmp( _T("install"), argv[1]+1 ) == 0 ) { // Get out of here. *************** *** 1088,1092 **** } #endif ! if ( _stricmp( "debug", argv[1]+1 ) == 0 ) { /* Debugging the service. If this EXE has a service name embedded in it, use it, otherwise insist one is passed on the --- 1079,1083 ---- } #endif ! if ( _tcsicmp( _T("debug"), argv[1]+1 ) == 0 ) { /* Debugging the service. If this EXE has a service name embedded in it, use it, otherwise insist one is passed on the *************** *** 1149,1161 **** // Given the string in form [path\]module.ClassName, return // an instance of the class ! PyObject *LoadPythonServiceClass(char *svcInitString) { ! char valueBuf[512]; // Initialize Python PyService_InitPython(); ! strncpy(valueBuf, svcInitString, sizeof(valueBuf)); // Find the last "\\" ! char *sep = strrchr(valueBuf, '\\'); ! char *fname; if (sep) { *sep = '\0'; --- 1140,1152 ---- // Given the string in form [path\]module.ClassName, return // an instance of the class ! PyObject *LoadPythonServiceClass(TCHAR *svcInitString) { ! TCHAR valueBuf[512]; // Initialize Python PyService_InitPython(); ! _tcsncpy(valueBuf, svcInitString, sizeof(valueBuf)/sizeof(valueBuf[0])); // Find the last "\\" ! TCHAR *sep = _tcsrchr(valueBuf, _T('\\')); ! TCHAR *fname; if (sep) { *sep = '\0'; *************** *** 1167,1171 **** return NULL; } ! PyObject *obNew = PyString_FromString(valueBuf); if (obNew==NULL) { ReportPythonError(PYS_E_NO_MEMORY_FOR_SYS_PATH); --- 1158,1162 ---- return NULL; } ! PyObject *obNew = PyWinObject_FromTCHAR(valueBuf); if (obNew==NULL) { ReportPythonError(PYS_E_NO_MEMORY_FOR_SYS_PATH); *************** *** 1178,1182 **** } // Find the last "." in the name, and assume it is a module name. ! char *classNamePos = strrchr(fname, '.'); if (classNamePos==NULL) { ReportError(PYS_E_CANT_LOCATE_MODULE_NAME); --- 1169,1173 ---- } // Find the last "." in the name, and assume it is a module name. ! TCHAR *classNamePos = _tcsrchr(fname, _T('.')); if (classNamePos==NULL) { ReportError(PYS_E_CANT_LOCATE_MODULE_NAME); *************** *** 1187,1196 **** // PyImport_ImportModule("foo.bar") will return 'foo', not bar. *classNamePos++ = '\0'; ! module = PyImport_ImportModule(fname); if (module==NULL) { ReportPythonError(E_PYS_NO_MODULE); return NULL; } ! PyObject *pyclass = PyObject_GetAttrString(module, classNamePos); Py_DECREF(module); if (pyclass==NULL) { --- 1178,1191 ---- // PyImport_ImportModule("foo.bar") will return 'foo', not bar. *classNamePos++ = '\0'; ! PyObject *obname=PyWinObject_FromTCHAR(fname); ! module = PyImport_Import(obname); ! Py_DECREF(obname); if (module==NULL) { ReportPythonError(E_PYS_NO_MODULE); return NULL; } ! PyObject *obclassName=PyWinObject_FromTCHAR(classNamePos); ! PyObject *pyclass = PyObject_GetAttr(module, obclassName); ! Py_DECREF(obclassName); Py_DECREF(module); if (pyclass==NULL) { *************** *** 1240,1251 **** } ! BOOL LocatePythonServiceClassString( TCHAR *svcName, char *buf, int cchBuf) { ! char keyName[1024]; // If not error loading, and not an empty string // (NOTE: Embedding a resource to specify the service name is // deprecated) ! if (LoadStringA(GetModuleHandle(NULL), RESOURCE_SERVICE_NAME, buf, cchBuf)>1) // Get out of here now! return TRUE; --- 1235,1246 ---- } ! BOOL LocatePythonServiceClassString( TCHAR *svcName, TCHAR *buf, int cchBuf) { ! TCHAR keyName[1024]; // If not error loading, and not an empty string // (NOTE: Embedding a resource to specify the service name is // deprecated) ! if (LoadString(GetModuleHandle(NULL), RESOURCE_SERVICE_NAME, buf, cchBuf)>1) // Get out of here now! return TRUE; *************** *** 1253,1264 **** HKEY key = NULL; BOOL ok = TRUE; ! wsprintfA(keyName, "System\\CurrentControlSet\\Services\\%S\\PythonClass", svcName); ! if (RegOpenKeyA(HKEY_LOCAL_MACHINE, keyName, &key) != ERROR_SUCCESS) { ReportAPIError(PYS_E_API_CANT_LOCATE_PYTHON_CLASS); return FALSE; } DWORD dataType; ! DWORD valueBufSize = cchBuf; ! if ((RegQueryValueExA(key, "", 0, &dataType, (LPBYTE)buf, &valueBufSize)!=ERROR_SUCCESS) || (dataType != REG_SZ)) { ReportAPIError(PYS_E_API_CANT_LOCATE_PYTHON_CLASS); --- 1248,1261 ---- HKEY key = NULL; BOOL ok = TRUE; ! _sntprintf(keyName, sizeof(keyName)/sizeof(keyName[0]), ! _T("System\\CurrentControlSet\\Services\\%s\\PythonClass"), ! svcName); ! if (RegOpenKey(HKEY_LOCAL_MACHINE, keyName, &key) != ERROR_SUCCESS) { ReportAPIError(PYS_E_API_CANT_LOCATE_PYTHON_CLASS); return FALSE; } DWORD dataType; ! DWORD valueBufSize = cchBuf * sizeof(TCHAR); ! if ((RegQueryValueEx(key, NULL, 0, &dataType, (LPBYTE)buf, &valueBufSize)!=ERROR_SUCCESS) || (dataType != REG_SZ)) { ReportAPIError(PYS_E_API_CANT_LOCATE_PYTHON_CLASS); *************** *** 1353,1428 **** } - #define GPEM_ERROR(what) {errorMsg = "<Error getting traceback - " ## what ## ">";goto done;} - static char *GetPythonTraceback(PyObject *exc_tb) - { - char *result = NULL; - char *errorMsg = NULL; - PyObject *modStringIO = NULL; - PyObject *modTB = NULL; - PyObject *obFuncStringIO = NULL; - PyObject *obStringIO = NULL; - PyObject *obFuncTB = NULL; - PyObject *argsTB = NULL; - PyObject *obResult = NULL; - - /* Import the modules we need - cStringIO and traceback */ - modStringIO = PyImport_ImportModule("cStringIO"); - if (modStringIO==NULL) GPEM_ERROR("cant import cStringIO"); - modTB = PyImport_ImportModule("traceback"); - if (modTB==NULL) GPEM_ERROR("cant import traceback"); - - /* Construct a cStringIO object */ - obFuncStringIO = PyObject_GetAttrString(modStringIO, "StringIO"); - if (obFuncStringIO==NULL) GPEM_ERROR("cant find cStringIO.StringIO"); - obStringIO = PyObject_CallObject(obFuncStringIO, NULL); - if (obStringIO==NULL) GPEM_ERROR("cStringIO.StringIO() failed"); - - /* Get the traceback.print_exception function, and call it. */ - obFuncTB = PyObject_GetAttrString(modTB, "print_tb"); - if (obFuncTB==NULL) GPEM_ERROR("cant find traceback.print_tb"); - argsTB = Py_BuildValue("OOO", - exc_tb ? exc_tb : Py_None, - Py_None, - obStringIO); - if (argsTB==NULL) GPEM_ERROR("cant make print_tb arguments"); - - obResult = PyObject_CallObject(obFuncTB, argsTB); - if (obResult==NULL) GPEM_ERROR("traceback.print_tb() failed"); - - /* Now call the getvalue() method in the StringIO instance */ - Py_DECREF(obFuncStringIO); - obFuncStringIO = PyObject_GetAttrString(obStringIO, "getvalue"); - if (obFuncStringIO==NULL) GPEM_ERROR("cant find getvalue function"); - Py_DECREF(obResult); - obResult = PyObject_CallObject(obFuncStringIO, NULL); - if (obResult==NULL) GPEM_ERROR("getvalue() failed."); - - /* And it should be a string all ready to go - duplicate it. */ - if (!PyString_Check(obResult)) - GPEM_ERROR("getvalue() did not return a string"); - result = strdup(PyString_AsString(obResult)); - done: - if (result==NULL && errorMsg != NULL) - result = strdup(errorMsg); - Py_XDECREF(modStringIO); - Py_XDECREF(modTB); - Py_XDECREF(obFuncStringIO); - Py_XDECREF(obStringIO); - Py_XDECREF(obFuncTB); - Py_XDECREF(argsTB); - Py_XDECREF(obResult); - return result; - } - static void ReportPythonError(DWORD code) { if (PyErr_Occurred()) { ! LPTSTR inserts[4]; ! inserts[3] = NULL; // terminate array PyObject *type, *value, *traceback; PyErr_Fetch(&type, &value, &traceback); ! WCHAR *szTracebackUse = L"<No memory!>"; // default. ! WCHAR *szTraceback = NULL; // to be freed. ! char *szmbTraceback = GetPythonTraceback(traceback); if (szmbTraceback) { int tb_len = strlen(szmbTraceback) + 1; --- 1350,1362 ---- } static void ReportPythonError(DWORD code) { if (PyErr_Occurred()) { ! LPTSTR inserts[4] = {NULL, NULL, NULL, NULL}; PyObject *type, *value, *traceback; PyErr_Fetch(&type, &value, &traceback); ! TCHAR *szTracebackUse = L"<No memory!>"; // default. ! TCHAR *szTraceback = NULL; // to be freed. ! char *szmbTraceback = GetPythonTraceback(type, value, traceback); if (szmbTraceback) { int tb_len = strlen(szmbTraceback) + 1; *************** *** 1437,1450 **** } inserts[0] = szTracebackUse; - PyObject *obStr = PyObject_Str(type); - PyWinObject_AsWCHAR(obStr, inserts+1); - Py_XDECREF(obStr); - obStr = PyObject_Str(value); - PyWinObject_AsWCHAR(PyObject_Str(obStr), inserts+2); - Py_XDECREF(obStr); ReportError(code, (LPCTSTR *)inserts); if (szTraceback) free(szTraceback); ! PyWinObject_FreeWCHAR(inserts[1]); ! PyWinObject_FreeWCHAR(inserts[2]); if (bServiceDebug) { // If debugging, restore for traceback print, PyErr_Restore(type, value, traceback); --- 1371,1377 ---- } inserts[0] = szTracebackUse; ReportError(code, (LPCTSTR *)inserts); if (szTraceback) free(szTraceback); ! if (bServiceDebug) { // If debugging, restore for traceback print, PyErr_Restore(type, value, traceback); *************** *** 1578,1582 **** // Our EXE entry point. ! int main(int argc, char **argv) { PyObject *module, *f; --- 1505,1509 ---- // Our EXE entry point. ! int _tmain(int argc, TCHAR **argv) { PyObject *module, *f; *************** *** 1591,1600 **** Py_DECREF(module); if (!f) goto failed; ! if (!PyString_Check(f)) { ! PyErr_SetString(PyExc_TypeError, "servicemanager.__file__ is not a string!"); goto failed; } ! // now get the handle to the DLL, and call the main function. ! hmod = GetModuleHandleA(PyString_AsString(f)); Py_DECREF(f); if (!hmod) { --- 1518,1532 ---- Py_DECREF(module); if (!f) goto failed; ! ! // now get the handle to the DLL, and call the main function. ! if (PyString_Check(f)) ! hmod = GetModuleHandleA(PyString_AsString(f)); ! else if (PyUnicode_Check(f)) ! hmod = GetModuleHandleW(PyUnicode_AsUnicode(f)); ! else{ ! PyErr_SetString(PyExc_TypeError, "servicemanager.__file__ is not a string or unicode !"); goto failed; } ! Py_DECREF(f); if (!hmod) { *************** *** 1612,1617 **** PyEval_ReleaseThread(threadState); ! typedef int (* FNPythonService_main)(int argc, char **argv); ! return ((FNPythonService_main)proc)(argc, argv); failed: fprintf(stderr, "PythonService was unable to locate the service manager. " --- 1544,1549 ---- PyEval_ReleaseThread(threadState); ! typedef int (* FNPythonService_main)(int argc, TCHAR **argv); ! return (*(FNPythonService_main)proc)(argc, argv); failed: fprintf(stderr, "PythonService was unable to locate the service manager. " Index: win32service.i =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32service.i,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** win32service.i 10 Jun 2008 21:34:56 -0000 1.17 --- win32service.i 13 Nov 2008 11:11:58 -0000 1.18 *************** *** 25,29 **** %init %{ // All errors raised by this module are of this type. - Py_INCREF(PyWinExc_ApiError); PyDict_SetItemString(d, "error", PyWinExc_ApiError); PyDict_SetItemString(d, "HWINSTAType", (PyObject *)&PyHWINSTAType); --- 25,28 ---- Index: _win32sysloader.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/_win32sysloader.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** _win32sysloader.cpp 21 Oct 2005 02:25:49 -0000 1.1 --- _win32sysloader.cpp 13 Nov 2008 11:11:58 -0000 1.2 *************** *** 15,50 **** static PyObject *PyGetModuleFilename(PyObject *self, PyObject *args) { ! char *modName; ! if (!PyArg_ParseTuple(args, "s", &modName)) return NULL; HINSTANCE hinst = GetModuleHandle(modName); ! if (hinst == NULL) { Py_INCREF(Py_None); return Py_None; } ! char buf[_MAX_PATH]; ! if (GetModuleFileName(hinst, buf, sizeof(buf))==0) { Py_INCREF(Py_None); return Py_None; } ! return PyString_FromString(buf); } static PyObject *PyLoadModule(PyObject *self, PyObject *args) { ! char *modName; ! if (!PyArg_ParseTuple(args, "s", &modName)) return NULL; HINSTANCE hinst = LoadLibrary(modName); if (hinst == NULL) { Py_INCREF(Py_None); return Py_None; } ! char buf[_MAX_PATH]; ! if (GetModuleFileName(hinst, buf, sizeof(buf))==0) { Py_INCREF(Py_None); return Py_None; } ! return PyString_FromString(buf); } --- 15,71 ---- static PyObject *PyGetModuleFilename(PyObject *self, PyObject *args) { ! // For py3k, will be built with UNICODE defined ! #ifdef UNICODE ! static char *fmt="u"; ! #else ! static char *fmt="s"; ! #endif ! ! TCHAR *modName=NULL; ! if (!PyArg_ParseTuple(args, fmt, &modName)) return NULL; HINSTANCE hinst = GetModuleHandle(modName); ! if (hinst == NULL) { Py_INCREF(Py_None); return Py_None; } ! TCHAR buf[_MAX_PATH]; ! if (GetModuleFileName(hinst, buf, sizeof(buf)/sizeof(buf[0]))==0) { Py_INCREF(Py_None); return Py_None; } ! #ifdef UNICODE ! return PyUnicode_FromUnicode(buf, wcslen(buf)); ! #else ! return PyString_FromString(buf); ! #endif } static PyObject *PyLoadModule(PyObject *self, PyObject *args) { ! #ifdef UNICODE ! static char *fmt="u"; ! #else ! static char *fmt="s"; ! #endif ! TCHAR *modName=NULL; ! if (!PyArg_ParseTuple(args, fmt, &modName)) return NULL; HINSTANCE hinst = LoadLibrary(modName); + if (hinst == NULL) { Py_INCREF(Py_None); return Py_None; } ! TCHAR buf[_MAX_PATH]; ! if (GetModuleFileName(hinst, buf, sizeof(buf)/sizeof(buf[0]))==0) { Py_INCREF(Py_None); return Py_None; } ! #ifdef UNICODE ! return PyUnicode_FromUnicode(buf, wcslen(buf)); ! #else ! return PyString_FromString(buf); ! #endif } Index: win32helpmodule.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32helpmodule.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** win32helpmodule.cpp 27 May 2007 13:25:42 -0000 1.4 --- win32helpmodule.cpp 13 Nov 2008 11:11:58 -0000 1.5 *************** *** 22,26 **** #include "PyWinTypes.h" - #define DllExport _declspec(dllexport) --- 22,25 ---- *************** *** 45,97 **** static PyObject *PyWinHelp(PyObject *self, PyObject *args) { [...968 lines suppressed...] // Module constants: + #define ADD_CONSTANT(tok) if (rc=PyModule_AddIntConstant(module, #tok, tok)) return rc ! int AddConstants(PyObject *module) { int rc; *************** *** 3312,3316 **** dict = PyModule_GetDict(module); if (!dict) return; /* Another serious error!*/ ! AddConstants(dict); PyDict_SetItemString(dict, "__version__", PyString_FromString("$Revision$")); --- 3144,3148 ---- dict = PyModule_GetDict(module); if (!dict) return; /* Another serious error!*/ ! AddConstants(module); PyDict_SetItemString(dict, "__version__", PyString_FromString("$Revision$")); Index: win2krasmodule.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win2krasmodule.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** win2krasmodule.cpp 3 Jun 2007 14:53:07 -0000 1.6 --- win2krasmodule.cpp 13 Nov 2008 11:11:58 -0000 1.7 *************** *** 96,100 **** }; - PyRASEAPUSERIDENTITY::PyRASEAPUSERIDENTITY(RASEAPUSERIDENTITY *identity) { --- 96,99 ---- *************** *** 132,142 **** PyRasGetEapUserIdentity( PyObject *self, PyObject *args ) { ! char *phoneBook, *entry; int flags; ! HWND hwnd; ! PyObject *obhwnd=Py_None; ! if (!PyArg_ParseTuple(args, "zsi|O:GetEapUserIdentity", ! &phoneBook, // @pyparm string|phoneBook||string containing the full path of the phone-book (PBK) file. If this parameter is None, the function will use the system phone book. ! &entry,// @pyparm string|entry||string containing an existing entry name. &flags, // @pyparm int|flags||Specifies zero or more of the following flags that qualify the authentication process. // @flagh Flag|Description --- 131,142 ---- PyRasGetEapUserIdentity( PyObject *self, PyObject *args ) { ! TCHAR *phoneBook=NULL, *entry=NULL; ! PyObject *obphoneBook, *obentry; int flags; ! HWND hwnd=NULL; ! PyObject *ret=NULL; ! if (!PyArg_ParseTuple(args, "OOi|O&:GetEapUserIdentity", ! &obphoneBook, // @pyparm string|phoneBook||string containing the full path of the phone-book (PBK) file. If this parameter is None, the function will use the system phone book. ! &obentry,// @pyparm string|entry||string containing an existing entry name. &flags, // @pyparm int|flags||Specifies zero or more of the following flags that qualify the authentication process. // @flagh Flag|Description *************** *** 144,161 **** // @flag RASEAPF_Logon|Specifies that the user data is obtained from Winlogon. // @flag RASEAPF_Preview|Specifies that the user should be prompted for identity information before dialing. ! &obhwnd)) // @pyparm <o PyHANDLE>|hwnd|None|Handle to the parent window for the UI dialog. ! return NULL; ! if (!PyWinObject_AsHANDLE(obhwnd, (HANDLE *)&hwnd)) return NULL; ! // @pyseeapi RasGetEapUserIdentity ! DWORD rc; ! RASEAPUSERIDENTITY *identity; ! Py_BEGIN_ALLOW_THREADS ! rc = RasGetEapUserIdentity(phoneBook, entry, flags, hwnd, &identity); ! Py_END_ALLOW_THREADS ! if (rc != 0) ! return ReturnRasError("RasGetEapUserIdentity",rc); ! return PyWinObject_FromRASEAPUSERIDENTITY(identity); } --- 144,166 ---- // @flag RASEAPF_Logon|Specifies that the user data is obtained from Winlogon. // @flag RASEAPF_Preview|Specifies that the user should be prompted for identity information before dialing. ! PyWinObject_AsHANDLE, &hwnd)) // @pyparm <o PyHANDLE>|hwnd|None|Handle to the parent window for the UI dialog. return NULL; ! if (PyWinObject_AsTCHAR(obphoneBook, &phoneBook, TRUE) ! && PyWinObject_AsTCHAR(obentry, &entry, FALSE)){ ! // @pyseeapi RasGetEapUserIdentity ! DWORD rc; ! RASEAPUSERIDENTITY *identity; ! Py_BEGIN_ALLOW_THREADS ! rc = RasGetEapUserIdentity(phoneBook, entry, flags, hwnd, &identity); ! Py_END_ALLOW_THREADS ! if (rc != 0) ! ReturnRasError("RasGetEapUserIdentity",rc); ! else ! ret = PyWinObject_FromRASEAPUSERIDENTITY(identity); ! } ! PyWinObject_FreeTCHAR(phoneBook); ! PyWinObject_FreeTCHAR(entry); ! return ret; } *************** *** 167,188 **** }; - int AddConstant(PyObject *dict, char *key, long value) - { - PyObject *okey = PyString_FromString(key); - PyObject *oval = PyInt_FromLong(value); - if (!okey || !oval) { - Py_XDECREF(okey); - Py_XDECREF(oval); - return 1; - } - int rc = PyDict_SetItem(dict,okey, oval); - Py_XDECREF(okey); - Py_XDECREF(oval); - return rc; - } ! #define ADD_CONSTANT(tok) if (rc=AddConstant(dict,#tok, tok)) return rc ! static int AddConstants(PyObject *dict) { int rc; --- 172,179 ---- }; ! #define ADD_CONSTANT(tok) if (rc=PyModule_AddIntConstant(module, #tok, tok)) return rc ! static int AddConstants(PyObject *module) { int rc; *************** *** 198,201 **** --- 189,193 ---- PyWinGlobals_Ensure(); PyObject *dict, *module; + #define RETURN_ERROR return // towards py3k module = Py_InitModule("win2kras", win2kras_functions); if (!module) /* Eeek - some serious error! */ *************** *** 203,211 **** dict = PyModule_GetDict(module); if (!dict) return; /* Another serious error!*/ ! AddConstants(dict); #ifdef _DEBUG ! const char *modName = "win32ras_d.pyd"; #else ! const char *modName = "win32ras.pyd"; #endif // We insist on win32ras being imported - but the least we --- 195,203 ---- dict = PyModule_GetDict(module); if (!dict) return; /* Another serious error!*/ ! AddConstants(module); #ifdef _DEBUG ! const TCHAR *modName = _T("win32ras_d.pyd"); #else ! const TCHAR *modName = _T("win32ras.pyd"); #endif // We insist on win32ras being imported - but the least we *************** *** 219,228 **** if (hmod==NULL) { PyErr_SetString(PyExc_RuntimeError, "You must import 'win32ras' before importing this module"); ! return; } FARPROC fp = GetProcAddress(hmod, "ReturnRasError"); if (fp==NULL) { PyErr_SetString(PyExc_RuntimeError, "Could not locate 'ReturnRasError' in 'win32ras'"); ! return; } pfnReturnRasError = (PFNReturnRasError)fp; --- 211,220 ---- if (hmod==NULL) { PyErr_SetString(PyExc_RuntimeError, "You must import 'win32ras' before importing this module"); ! RETURN_ERROR; } FARPROC fp = GetProcAddress(hmod, "ReturnRasError"); if (fp==NULL) { PyErr_SetString(PyExc_RuntimeError, "Could not locate 'ReturnRasError' in 'win32ras'"); ! RETURN_ERROR; } pfnReturnRasError = (PFNReturnRasError)fp; Index: PySID.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/PySID.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** PySID.cpp 24 May 2007 06:01:05 -0000 1.12 --- PySID.cpp 13 Nov 2008 11:11:58 -0000 1.13 *************** *** 106,110 **** return NULL; PySID *This = (PySID *)self; ! return PyInt_FromLong( IsValidSid(This->GetSID()) ); } --- 106,110 ---- return NULL; PySID *This = (PySID *)self; ! return PyBool_FromLong( IsValidSid(This->GetSID()) ); } *************** *** 175,179 **** SID_IDENTIFIER_AUTHORITY *psia; //wtf is this thing ? Give it back to the user, let *him* figure it out psia = ::GetSidIdentifierAuthority(This->GetSID()); ! return Py_BuildValue("(iiiiii)",psia->Value[0],psia->Value[1],psia->Value[2],psia->Value[3],psia->Value[4],psia->Value[5]); } --- 175,179 ---- SID_IDENTIFIER_AUTHORITY *psia; //wtf is this thing ? Give it back to the user, let *him* figure it out psia = ::GetSidIdentifierAuthority(This->GetSID()); ! return Py_BuildValue("(BBBBBB)",psia->Value[0],psia->Value[1],psia->Value[2],psia->Value[3],psia->Value[4],psia->Value[5]); } *************** *** 391,400 **** } // Space for the "PySID:" prefix. ! const char *prefix = "PySID:"; ! char *buf = (char *)malloc(strlen(prefix)+bufSize); if (buf==NULL) return PyErr_NoMemory(); ! strcpy(buf, prefix); ! GetTextualSid(psid, buf+strlen(prefix), &bufSize); ! PyObject *ret = PyString_FromString(buf); free(buf); return ret; --- 391,400 ---- } // Space for the "PySID:" prefix. ! TCHAR *prefix = _T("PySID:"); ! TCHAR *buf = (TCHAR *)malloc((_tcslen(prefix)+bufSize) * sizeof(TCHAR)); if (buf==NULL) return PyErr_NoMemory(); ! _tcscpy(buf, prefix); ! GetTextualSid(psid, buf+_tcslen(prefix), &bufSize); ! PyObject *ret = PyWinObject_FromTCHAR(buf); free(buf); return ret; Index: mmapfilemodule.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/mmapfilemodule.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** mmapfilemodule.cpp 28 Jun 2007 08:23:14 -0000 1.4 --- mmapfilemodule.cpp 13 Nov 2008 11:11:58 -0000 1.5 *************** *** 208,214 **** CHECK_VALID; ! if (!PyArg_ParseTuple (args, "c", &value)) // @pyparm str|char||Single byte to be placed in buffer ! return(NULL); // read and write methods can leave pos = size, technically past end of buffer --- 208,214 ---- CHECK_VALID; ! if (!PyArg_ParseTuple (args, "c:write_byte", &value)) // @pyparm str|char||Single byte to be placed in buffer ! return NULL; // read and write methods can leave pos = size, technically past end of buffer *************** *** 500,505 **** { mmapfile_object * m_obj; ! char * filename; ! PyObject *obtagname, *obview_size=Py_None; PSECURITY_ATTRIBUTES psa=NULL; // Not accepted as a parameter yet --- 500,505 ---- { mmapfile_object * m_obj; ! TCHAR * filename; ! PyObject *obfilename, *obtagname, *obview_size=Py_None; PSECURITY_ATTRIBUTES psa=NULL; // Not accepted as a parameter yet *************** *** 518,523 **** static char *keywords[]={"File", "Name", "MaximumSize", "FileOffset", "NumberOfBytesToMap", NULL}; ! if (!PyArg_ParseTupleAndKeywords(args, kwargs, "zO|KKO", keywords, ! &filename, // @pyparm str|File||Name of file. Use None or '' when opening an existing named mapping, or to use system pagefile. &obtagname, // @pyparm str|Name||Name of mapping object to create or open, can be None &m_obj->mapping_size.QuadPart, // @pyparm int|MaximumSize|0|Size of file mapping to create, should be specified as a multiple --- 518,523 ---- static char *keywords[]={"File", "Name", "MaximumSize", "FileOffset", "NumberOfBytesToMap", NULL}; ! if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO|KKO", keywords, ! &obfilename, // @pyparm str|File||Name of file. Use None or '' when opening an existing named mapping, or to use system pagefile. &obtagname, // @pyparm str|Name||Name of mapping object to create or open, can be None &m_obj->mapping_size.QuadPart, // @pyparm int|MaximumSize|0|Size of file mapping to create, should be specified as a multiple *************** *** 536,543 **** --- 536,548 ---- return NULL; } + if (!PyWinObject_AsTCHAR(obfilename, &filename, TRUE)){ + Py_DECREF(m_obj); + return NULL; + } if (obview_size!=Py_None){ m_obj->size=PyInt_AsSsize_t(obview_size); if (m_obj->size==-1 && PyErr_Occurred()){ Py_DECREF(m_obj); + PyWinObject_FreeTCHAR(filename); return NULL; } *************** *** 545,557 **** // if an actual filename has been specified ! if (filename && strlen(filename)){ m_obj->file_handle = CreateFile (filename, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, psa, OPEN_ALWAYS, 0, NULL); if (m_obj->file_handle == INVALID_HANDLE_VALUE){ Py_DECREF(m_obj); return PyWin_SetAPIError("CreateFile"); } } ! // If mapping size was not specified, use existing file size if ((!m_obj->mapping_size.QuadPart) && (m_obj->file_handle != INVALID_HANDLE_VALUE)){ --- 550,564 ---- // if an actual filename has been specified ! if (filename && _tcslen(filename)){ m_obj->file_handle = CreateFile (filename, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, psa, OPEN_ALWAYS, 0, NULL); if (m_obj->file_handle == INVALID_HANDLE_VALUE){ Py_DECREF(m_obj); + PyWinObject_FreeTCHAR(filename); return PyWin_SetAPIError("CreateFile"); } } ! PyWinObject_FreeTCHAR(filename); ! // If mapping size was not specified, use existing file size if ((!m_obj->mapping_size.QuadPart) && (m_obj->file_handle != INVALID_HANDLE_VALUE)){ Index: PySECURITY_DESCRIPTOR.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/PySECURITY_DESCRIPTOR.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** PySECURITY_DESCRIPTOR.cpp 24 May 2007 06:01:05 -0000 1.19 --- PySECURITY_DESCRIPTOR.cpp 13 Nov 2008 11:11:58 -0000 1.20 *************** *** 102,109 **** if (!PyArg_ParseTuple(args, "O:SECURITY_DESCRIPTOR", &obsd)) return NULL; ! if (PyObject_AsReadBuffer(obsd, (const void **)&psd, &buf_len)==-1){ ! PyErr_SetString(PyExc_TypeError,"Object has no data buffer"); return NULL; - } if (!IsValidSecurityDescriptor(psd)){ PyErr_SetString(PyExc_ValueError,"Data is not a valid security descriptor"); --- 102,107 ---- if (!PyArg_ParseTuple(args, "O:SECURITY_DESCRIPTOR", &obsd)) return NULL; ! if (PyObject_AsReadBuffer(obsd, (const void **)&psd, &buf_len)==-1) return NULL; if (!IsValidSecurityDescriptor(psd)){ PyErr_SetString(PyExc_ValueError,"Data is not a valid security descriptor"); |
From: Mark H. <mha...@us...> - 2008-11-13 11:12:06
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/ifilter/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv9817/com/win32comext/ifilter/src Modified Files: PyIFilter.cpp Log Message: Yet more TCHAR/64bit and other misc changes from py3k branch. Index: PyIFilter.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/ifilter/src/PyIFilter.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** PyIFilter.cpp 2 Mar 2005 02:25:02 -0000 1.6 --- PyIFilter.cpp 13 Nov 2008 11:11:58 -0000 1.7 *************** *** 283,287 **** #define ADD_IID(tok) AddIID(dict, #tok, tok) ! // @object PyIFilter|Description of the interface static struct PyMethodDef PyIFilter_methods[] = { --- 283,287 ---- #define ADD_IID(tok) AddIID(dict, #tok, tok) ! // @object PyIFilter|Wraps the interfaces used with Indexing Service filtering static struct PyMethodDef PyIFilter_methods[] = { *************** *** 334,338 **** // Tell pywintypes that IFilter error messages can be extracted from // query.dll ! HMODULE hmod = GetModuleHandle("query.dll"); if (hmod) // According to FiltErr.h, "Codes 0x1700-0x172F are reserved for FILTER" --- 334,338 ---- // Tell pywintypes that IFilter error messages can be extracted from // query.dll ! HMODULE hmod = GetModuleHandle(_T("query.dll")); if (hmod) // According to FiltErr.h, "Codes 0x1700-0x172F are reserved for FILTER" *************** *** 380,382 **** ADD_CONSTANT(FILTER_S_LAST_TEXT); // NOTE: New constants should go in ifiltercon.py ! } \ No newline at end of file --- 380,382 ---- ADD_CONSTANT(FILTER_S_LAST_TEXT); // NOTE: New constants should go in ifiltercon.py ! } |
From: Mark H. <mha...@us...> - 2008-11-13 11:12:06
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/axdebug/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv9817/com/win32comext/axdebug/src Modified Files: AXDebug.cpp Log Message: Yet more TCHAR/64bit and other misc changes from py3k branch. Index: AXDebug.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/axdebug/src/AXDebug.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** AXDebug.cpp 10 Mar 2003 01:01:40 -0000 1.4 --- AXDebug.cpp 13 Nov 2008 11:11:58 -0000 1.5 *************** *** 207,211 **** } /* List of module functions */ ! // @module axdebug|A module, encapsulating the ActiveX Debugging static struct PyMethodDef axdebug_methods[]= { --- 207,211 ---- } /* List of module functions */ ! // @module axdebug|A module, encapsulating the ActiveX Debugging interfaces static struct PyMethodDef axdebug_methods[]= { *************** *** 216,232 **** }; - static int AddConstant(PyObject *dict, const char *key, long value) - { - PyObject *oval = PyInt_FromLong(value); - if (!oval) - { - return 1; - } - int rc = PyDict_SetItemString(dict, (char*)key, oval); - Py_DECREF(oval); - return rc; - } - - #define ADD_CONSTANT(tok) AddConstant(dict, #tok, tok) // The list of interfaces and gateways we support. --- 216,219 ---- *************** *** 293,296 **** --- 280,284 ---- }; + #define ADD_CONSTANT(tok) if (PyModule_AddIntConstant(module, #tok, tok) == -1) RETURN_ERROR; /* Module initialisation */ *************** *** 308,318 **** if (!dict) return; /* Another serious error!*/ ! // Add some symbolic constants to the module ! axdebug_Error = PyString_FromString("error"); if (axdebug_Error == NULL || PyDict_SetItemString(dict, "error", axdebug_Error) != 0) ! { ! PyErr_SetString(PyExc_MemoryError, "can't define error"); ! return; ! } // AX-Debugging interface registration --- 296,303 ---- if (!dict) return; /* Another serious error!*/ ! // Add some symbolic constants to the module ! axdebug_Error = PyErr_NewException("axdebug.error", NULL, NULL); if (axdebug_Error == NULL || PyDict_SetItemString(dict, "error", axdebug_Error) != 0) ! RETURN_ERROR; // AX-Debugging interface registration *************** *** 400,405 **** ADD_CONSTANT(TEXT_DOC_ATTR_READONLY); // @const axdebug|TEXT_DOC_ATTR_READONLY|Indicates that the document is read-only. - - // ADD_CONSTANT(); - } --- 385,387 ---- |
From: Mark H. <mha...@us...> - 2008-11-13 11:12:06
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/axcontrol/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv9817/com/win32comext/axcontrol/src Modified Files: AXControl.cpp Log Message: Yet more TCHAR/64bit and other misc changes from py3k branch. Index: AXControl.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/axcontrol/src/AXControl.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** AXControl.cpp 2 Nov 2008 11:47:47 -0000 1.9 --- AXControl.cpp 13 Nov 2008 11:11:58 -0000 1.10 *************** *** 401,417 **** }; - static int AddConstant(PyObject *dict, const char *key, long value) - { - PyObject *oval = PyInt_FromLong(value); - if (!oval) - { - return 1; - } - int rc = PyDict_SetItemString(dict, (char*)key, oval); - Py_DECREF(oval); - return rc; - } ! #define ADD_CONSTANT(tok) AddConstant(dict, #tok, tok) static const PyCom_InterfaceSupportInfo g_interfaceSupportData[] = --- 401,406 ---- }; ! #define ADD_CONSTANT(tok) if (PyModule_AddIntConstant(module, #tok, tok) == -1) RETURN_ERROR; static const PyCom_InterfaceSupportInfo g_interfaceSupportData[] = *************** *** 440,449 **** { char *modName = "axcontrol"; ! PyObject *oModule; // Create the module and add the functions ! oModule = Py_InitModule(modName, axcontrol_methods); ! if (!oModule) /* Eeek - some serious error! */ return; ! PyObject *dict = PyModule_GetDict(oModule); if (!dict) return; /* Another serious error!*/ --- 429,439 ---- { char *modName = "axcontrol"; ! PyObject *module; // Create the module and add the functions ! module = Py_InitModule(modName, axcontrol_methods); ! #define RETURN_ERROR return // towards py3k ! if (!module) /* Eeek - some serious error! */ return; ! PyObject *dict = PyModule_GetDict(module); if (!dict) return; /* Another serious error!*/ |
From: Mark H. <mha...@us...> - 2008-11-13 11:12:04
|
Update of /cvsroot/pywin32/pywin32/win32/src/PerfMon In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv9817/win32/src/PerfMon Modified Files: MappingManager.cpp PyPerfMon.cpp Log Message: Yet more TCHAR/64bit and other misc changes from py3k branch. Index: MappingManager.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/PerfMon/MappingManager.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** MappingManager.cpp 5 Mar 2005 04:50:47 -0000 1.3 --- MappingManager.cpp 13 Nov 2008 11:11:58 -0000 1.4 *************** *** 60,64 **** _tcscat(szGlobalMapping, szMappingName); ! m_hMappedObject = CreateFileMapping((HANDLE)0xFFFFFFFF, NULL, PAGE_READWRITE, --- 60,64 ---- _tcscat(szGlobalMapping, szMappingName); ! m_hMappedObject = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, Index: PyPerfMon.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/PerfMon/PyPerfMon.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PyPerfMon.cpp 9 Feb 2001 07:35:59 -0000 1.2 --- PyPerfMon.cpp 13 Nov 2008 11:11:58 -0000 1.3 *************** *** 86,90 **** /* List of functions exported by this module */ ! // @module perfmon|A module which supports common Windows types. static struct PyMethodDef perfmon_functions[] = { {"LoadPerfCounterTextStrings", PyLoadPerfCounterTextStrings, 1}, // @pymeth LoadPerfCounterTextStrings| --- 86,90 ---- /* List of functions exported by this module */ ! // @module perfmon|A module which wraps Performance Monitor functions. static struct PyMethodDef perfmon_functions[] = { {"LoadPerfCounterTextStrings", PyLoadPerfCounterTextStrings, 1}, // @pymeth LoadPerfCounterTextStrings| |
From: Mark H. <mha...@us...> - 2008-11-13 11:12:03
|
Update of /cvsroot/pywin32/pywin32/com/win32com/src/extensions In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv9817/com/win32com/src/extensions Modified Files: PyGEnumVariant.cpp PyIType.cpp Log Message: Yet more TCHAR/64bit and other misc changes from py3k branch. Index: PyIType.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/extensions/PyIType.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** PyIType.cpp 5 Jul 2001 08:08:13 -0000 1.9 --- PyIType.cpp 13 Nov 2008 11:11:58 -0000 1.10 *************** *** 404,412 **** { // XXX - todo - merge this code with PyIDispatch::GetIDsOfNames UINT i; ! ! int argc = PyObject_Length(args); ! if ( argc == -1 ) ! return NULL; if ( argc < 1 ) { PyErr_SetString(PyExc_TypeError, "At least one argument must be supplied"); --- 404,411 ---- { // XXX - todo - merge this code with PyIDispatch::GetIDsOfNames + ITypeInfo *pti = PyITypeInfo::GetI(self); + if (pti==NULL) return NULL; UINT i; ! int argc = PyTuple_GET_SIZE(args); if ( argc < 1 ) { PyErr_SetString(PyExc_TypeError, "At least one argument must be supplied"); *************** *** 417,430 **** if ( argc > 1 ) { ! PyObject *ob = PySequence_GetItem(args, 0); ! if ( !ob ) ! return NULL; ! if ( PyInt_Check(ob) ) ! { ! lcid = PyInt_AS_LONG((PyIntObject *)ob); ! if ( lcid == -1 ) ! return NULL; offset = 1; - } } --- 416,427 ---- if ( argc > 1 ) { ! PyObject *ob = PyTuple_GET_ITEM(args, 0); ! lcid=PyLong_AsLong(ob); ! if (lcid==-1 && PyErr_Occurred()){ ! PyErr_Clear(); ! lcid=LOCALE_SYSTEM_DEFAULT; ! } ! else offset = 1; } *************** *** 434,445 **** for ( i = 0 ; i < cNames; ++i ) { ! PyObject *ob = PySequence_GetItem(args, i + offset); ! if ( !ob ) ! { ! for (;i>0;i--) ! PyWinObject_FreeBstr(rgszNames[i-1]); ! delete [] rgszNames; ! return NULL; ! } if (!PyWinObject_AsBstr(ob, rgszNames+i)) { for (;i>0;i--) --- 431,435 ---- for ( i = 0 ; i < cNames; ++i ) { ! PyObject *ob = PyTuple_GET_ITEM(args, i + offset); if (!PyWinObject_AsBstr(ob, rgszNames+i)) { for (;i>0;i--) *************** *** 448,466 **** return NULL; } - Py_DECREF(ob); } DISPID FAR* rgdispid = new DISPID[cNames]; - ITypeInfo *pti = PyITypeInfo::GetI(self); - if (pti==NULL) return NULL; PY_INTERFACE_PRECALL; HRESULT hr = pti->GetIDsOfNames(rgszNames, cNames, rgdispid); PY_INTERFACE_POSTCALL; delete [] rgszNames; ! if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pti, IID_ITypeInfo); ! PyObject *result; --- 438,456 ---- return NULL; } } DISPID FAR* rgdispid = new DISPID[cNames]; PY_INTERFACE_PRECALL; HRESULT hr = pti->GetIDsOfNames(rgszNames, cNames, rgdispid); PY_INTERFACE_POSTCALL; + for (i=0;i<cNames;i++) + PyWinObject_FreeBstr(rgszNames[i]); delete [] rgszNames; ! if ( FAILED(hr) ){ ! delete [] rgdispid; return PyCom_BuildPyException(hr, pti, IID_ITypeInfo); ! } PyObject *result; Index: PyGEnumVariant.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/extensions/PyGEnumVariant.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PyGEnumVariant.cpp 19 Nov 1999 04:03:23 -0000 1.2 --- PyGEnumVariant.cpp 13 Nov 2008 11:11:58 -0000 1.3 *************** *** 4,10 **** #include "PyIEnumVARIANT.h" - extern void PyCom_LogF(const TCHAR *fmt, ...); - #define LogF PyCom_LogF - STDMETHODIMP PyGEnumVARIANT::Next( /* [in] */ ULONG celt, --- 4,7 ---- *************** *** 52,56 **** error: PyErr_Clear(); // just in case ! LogF(_T("PyGEnumVariant::Next got a bad return value")); Py_DECREF(result); return PyCom_SetCOMErrorFromSimple(E_FAIL, IID_IEnumVARIANT, "Next() did not return a sequence of objects"); --- 49,53 ---- error: PyErr_Clear(); // just in case ! PyCom_LogF("PyGEnumVariant::Next got a bad return value"); Py_DECREF(result); return PyCom_SetCOMErrorFromSimple(E_FAIL, IID_IEnumVARIANT, "Next() did not return a sequence of objects"); |
From: Mark H. <mha...@us...> - 2008-11-13 11:12:03
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/taskscheduler/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv9817/com/win32comext/taskscheduler/src Modified Files: PyIProvideTaskPage.cpp PyITask.cpp Log Message: Yet more TCHAR/64bit and other misc changes from py3k branch. Index: PyIProvideTaskPage.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/taskscheduler/src/PyIProvideTaskPage.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PyIProvideTaskPage.cpp 18 Apr 2004 22:01:11 -0000 1.1 --- PyIProvideTaskPage.cpp 13 Nov 2008 11:11:58 -0000 1.2 *************** *** 36,40 **** // @pyparm bool|PersistChanges||Indicates if changes should be saved automatically HPROPSHEETPAGE phPage; ! BOOL bPersistChanges=FALSE; if ( !PyArg_ParseTuple(args, "ii:GetPage", &tpType, &bPersistChanges)) return NULL; --- 36,40 ---- // @pyparm bool|PersistChanges||Indicates if changes should be saved automatically HPROPSHEETPAGE phPage; ! BOOL bPersistChanges; if ( !PyArg_ParseTuple(args, "ii:GetPage", &tpType, &bPersistChanges)) return NULL; *************** *** 47,51 **** if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIPTP, IID_IProvideTaskPage ); ! return new PyHANDLE(phPage); } --- 47,51 ---- if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIPTP, IID_IProvideTaskPage ); ! return PyWinLong_FromHANDLE(phPage); } Index: PyITask.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/taskscheduler/src/PyITask.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PyITask.cpp 4 May 2008 13:02:08 -0000 1.3 --- PyITask.cpp 13 Nov 2008 11:11:58 -0000 1.4 *************** *** 35,45 **** if ( !PyArg_ParseTuple(args, "O:SetApplicationName", &obpwszApplicationName) ) return NULL; ! BOOL bPythonIsHappy = TRUE; ! if (bPythonIsHappy && !PyWinObject_AsBstr(obpwszApplicationName, &pwszApplicationName)) bPythonIsHappy = FALSE; ! if (!bPythonIsHappy) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pIT->SetApplicationName( pwszApplicationName ); ! SysFreeString(pwszApplicationName); PY_INTERFACE_POSTCALL; --- 35,44 ---- if ( !PyArg_ParseTuple(args, "O:SetApplicationName", &obpwszApplicationName) ) return NULL; ! if (!PyWinObject_AsWCHAR(obpwszApplicationName, &pwszApplicationName)) ! return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pIT->SetApplicationName( pwszApplicationName ); ! PyWinObject_FreeWCHAR(pwszApplicationName); PY_INTERFACE_POSTCALL; *************** *** 87,97 **** if ( !PyArg_ParseTuple(args, "O:SetParameters", &obpwszParameters) ) return NULL; ! BOOL bPythonIsHappy = TRUE; ! if (bPythonIsHappy && !PyWinObject_AsBstr(obpwszParameters, &pwszParameters)) bPythonIsHappy = FALSE; ! if (!bPythonIsHappy) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pIT->SetParameters( pwszParameters ); ! SysFreeString(pwszParameters); PY_INTERFACE_POSTCALL; --- 86,95 ---- if ( !PyArg_ParseTuple(args, "O:SetParameters", &obpwszParameters) ) return NULL; ! if (!PyWinObject_AsWCHAR(obpwszParameters, &pwszParameters)) ! return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pIT->SetParameters( pwszParameters ); ! PyWinObject_FreeWCHAR(pwszParameters); PY_INTERFACE_POSTCALL; *************** *** 139,149 **** if ( !PyArg_ParseTuple(args, "O:SetWorkingDirectory", &obpwszWorkingDirectory) ) return NULL; ! BOOL bPythonIsHappy = TRUE; ! if (bPythonIsHappy && !PyWinObject_AsBstr(obpwszWorkingDirectory, &pwszWorkingDirectory)) bPythonIsHappy = FALSE; ! if (!bPythonIsHappy) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pIT->SetWorkingDirectory( pwszWorkingDirectory ); ! SysFreeString(pwszWorkingDirectory); PY_INTERFACE_POSTCALL; --- 137,146 ---- if ( !PyArg_ParseTuple(args, "O:SetWorkingDirectory", &obpwszWorkingDirectory) ) return NULL; ! if (!PyWinObject_AsWCHAR(obpwszWorkingDirectory, &pwszWorkingDirectory)) ! return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pIT->SetWorkingDirectory( pwszWorkingDirectory ); ! PyWinObject_FreeWCHAR(pwszWorkingDirectory); PY_INTERFACE_POSTCALL; |
Update of /cvsroot/pywin32/pywin32/com/win32com/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv9817/com/win32com/src Modified Files: ErrorUtils.cpp PyGatewayBase.cpp PyIDispatch.cpp PyIUnknown.cpp PyStorage.cpp dllmain.cpp univgw_dataconv.cpp Log Message: Yet more TCHAR/64bit and other misc changes from py3k branch. Index: PyGatewayBase.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/PyGatewayBase.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** PyGatewayBase.cpp 4 Sep 2007 10:53:29 -0000 1.17 --- PyGatewayBase.cpp 13 Nov 2008 11:11:58 -0000 1.18 *************** *** 14,22 **** extern PyObject *g_obMissing; - extern void PyCom_LogF(const char *fmt, ...); - #define LogF PyCom_LogF - #include <malloc.h> ! #if _MSC_VER < 1400 // _malloca is the new 'safe' one #define _malloca _alloca --- 14,22 ---- extern PyObject *g_obMissing; #include <malloc.h> ! // When building with the 2003 Platform SDK 64-bit compiloer, _MSC_VER is 1400, ! // but _malloca is not defined ! // #if _MSC_VER < 1400 ! #ifndef _malloca // _malloca is the new 'safe' one #define _malloca _alloca *************** *** 97,101 **** #ifdef DEBUG_FULL ! LogF("PyGatewayBase: created %s", m_pPyObject ? m_pPyObject->ob_type->tp_name : "<NULL>"); #endif } --- 97,101 ---- #ifdef DEBUG_FULL ! PyCom_LogF("PyGatewayBase: created %s", m_pPyObject ? m_pPyObject->ob_type->tp_name : "<NULL>"); #endif } *************** *** 105,109 **** InterlockedDecrement(&cGateways); #ifdef DEBUG_FULL ! LogF("PyGatewayBase: deleted %s", m_pPyObject ? m_pPyObject->ob_type->tp_name : "<NULL>"); #endif --- 105,109 ---- InterlockedDecrement(&cGateways); #ifdef DEBUG_FULL ! PyCom_LogF("PyGatewayBase: deleted %s", m_pPyObject ? m_pPyObject->ob_type->tp_name : "<NULL>"); #endif *************** *** 136,140 **** // Only for a special debug build, don't worry about error checking WideCharToMultiByte(CP_ACP, 0, oleRes, -1, cRes, 256, NULL, NULL); ! LogF("PyGatewayBase::QueryInterface: %s", cRes); } #endif --- 136,140 ---- // Only for a special debug build, don't worry about error checking WideCharToMultiByte(CP_ACP, 0, oleRes, -1, cRes, 256, NULL, NULL); ! PyCom_LogF("PyGatewayBase::QueryInterface: %s", cRes); } #endif *************** *** 388,392 **** { #ifdef DEBUG_FULL ! LogF("PyGatewayBase::GetIDsOfNames"); #endif --- 388,392 ---- { #ifdef DEBUG_FULL ! PyCom_LogF("PyGatewayBase::GetIDsOfNames"); #endif *************** *** 735,739 **** { #ifdef DEBUG_FULL ! LogF("PyGatewayBase::Invoke; dispid=%ld", dispid); #endif --- 735,739 ---- { #ifdef DEBUG_FULL ! PyCom_LogF("PyGatewayBase::Invoke; dispid=%ld", dispid); #endif *************** *** 775,779 **** { #ifdef DEBUG_FULL ! LogF("PyGatewayBase::GetDispID"); #endif PY_GATEWAY_METHOD; --- 775,779 ---- { #ifdef DEBUG_FULL ! PyCom_LogF("PyGatewayBase::GetDispID"); #endif PY_GATEWAY_METHOD; *************** *** 798,802 **** { #ifdef DEBUG_FULL ! LogF("PyGatewayBase::InvokeEx; dispid=%ld", id); #endif --- 798,802 ---- { #ifdef DEBUG_FULL ! PyCom_LogF("PyGatewayBase::InvokeEx; dispid=%ld", id); #endif *************** *** 840,844 **** { #ifdef DEBUG_FULL ! LogF("PyGatewayBase::DeleteMemberByName"); #endif PY_GATEWAY_METHOD; --- 840,844 ---- { #ifdef DEBUG_FULL ! PyCom_LogF("PyGatewayBase::DeleteMemberByName"); #endif PY_GATEWAY_METHOD; *************** *** 858,862 **** { #ifdef DEBUG_FULL ! LogF("PyGatewayBase::DeleteMemberByDispID"); #endif PY_GATEWAY_METHOD; --- 858,862 ---- { #ifdef DEBUG_FULL ! PyCom_LogF("PyGatewayBase::DeleteMemberByDispID"); #endif PY_GATEWAY_METHOD; *************** *** 872,876 **** { #ifdef DEBUG_FULL ! LogF("PyGatewayBase::GetMemberProperties"); #endif PY_GATEWAY_METHOD; --- 872,876 ---- { #ifdef DEBUG_FULL ! PyCom_LogF("PyGatewayBase::GetMemberProperties"); #endif PY_GATEWAY_METHOD; *************** *** 892,896 **** { #ifdef DEBUG_FULL ! LogF("PyGatewayBase::GetMemberName"); #endif PY_GATEWAY_METHOD; --- 892,896 ---- { #ifdef DEBUG_FULL ! PyCom_LogF("PyGatewayBase::GetMemberName"); #endif PY_GATEWAY_METHOD; *************** *** 909,913 **** { #ifdef DEBUG_FULL ! LogF("PyGatewayBase::GetNextDispID"); #endif PY_GATEWAY_METHOD; --- 909,913 ---- { #ifdef DEBUG_FULL ! PyCom_LogF("PyGatewayBase::GetNextDispID"); #endif PY_GATEWAY_METHOD; *************** *** 929,933 **** { #ifdef DEBUG_FULL ! LogF("PyGatewayBase::GetNameSpaceParent"); #endif PY_GATEWAY_METHOD; --- 929,933 ---- { #ifdef DEBUG_FULL ! PyCom_LogF("PyGatewayBase::GetNameSpaceParent"); #endif PY_GATEWAY_METHOD; Index: PyIUnknown.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/PyIUnknown.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** PyIUnknown.cpp 4 Jul 2007 18:03:18 -0000 1.12 --- PyIUnknown.cpp 13 Nov 2008 11:11:58 -0000 1.13 *************** *** 6,12 **** #include "PythonCOMServer.h" - extern void PyCom_LogF(const char *fmt, ...); - #define LogF PyCom_LogF - char *PyIUnknown::szErrMsgObjectReleased = "The COM object has been released."; --- 6,9 ---- *************** *** 37,43 **** { // @comm The repr of this object displays both the object's address, and its attached IUnknown's address ! TCHAR buf[80]; ! wsprintf(buf, _T("<%hs at 0x%0lp with obj at 0x%0lp>"),ob_type->tp_name, this, m_obj); ! return PyString_FromTCHAR(buf); } --- 34,44 ---- { // @comm The repr of this object displays both the object's address, and its attached IUnknown's address ! char buf[256]; ! _snprintf(buf, 256, "<%hs at 0x%0lp with obj at 0x%0lp>", ob_type->tp_name, this, m_obj); ! #if (PY_VERSION_HEX < 0x03000000) ! return PyString_FromString(buf); ! #else ! return PyUnicode_FromString(buf); ! #endif } *************** *** 46,50 **** #ifdef _DEBUG int numInMap = m_obTrackList ? PyMapping_Length(m_obTrackList) : 0; ! LogF("Cleaning up %d COM objects...", numInMap); OLECHAR FAR *pythonOb = L"pythonObject"; #endif --- 47,51 ---- #ifdef _DEBUG int numInMap = m_obTrackList ? PyMapping_Length(m_obTrackList) : 0; ! PyCom_LogF("Cleaning up %d COM objects...", numInMap); OLECHAR FAR *pythonOb = L"pythonObject"; #endif *************** *** 60,64 **** #ifdef NOPE_DEBUG const char *relDesc = pLook->m_obj ? "NOT RELEASED" : "released"; ! LogF(" object <%s> at 0x%0lx, m_obj at 0x%0lx, ob_refcnt=%d, %s", pLook->ob_type->tp_name, pLook, pLook->m_obj, pLook->ob_refcnt, relDesc); if ( pLook->m_obj ) { --- 61,65 ---- #ifdef NOPE_DEBUG const char *relDesc = pLook->m_obj ? "NOT RELEASED" : "released"; ! PyCom_LogF(" object <%s> at 0x%0lx, m_obj at 0x%0lx, ob_refcnt=%d, %s", pLook->ob_type->tp_name, pLook, pLook->m_obj, pLook->ob_refcnt, relDesc); if ( pLook->m_obj ) { *************** *** 80,88 **** if ( PyInstance_Check(ob) ) { ! LogF(" object is a Python class instance of: %s", PyString_AsString(((PyInstanceObject *)ob)->in_class->cl_name)); } else { ! LogF(" object is a Python object of type: %s", ob->ob_type->tp_name); } } --- 81,89 ---- if ( PyInstance_Check(ob) ) { ! PyCom_LogF(" object is a Python class instance of: %s", PyString_AsString(((PyInstanceObject *)ob)->in_class->cl_name)); } else { ! PyCom_LogF(" object is a Python object of type: %s", ob->ob_type->tp_name); } } *************** *** 106,110 **** } #ifdef _DEBUG ! LogF("COM object cleanup complete."); #endif } --- 107,111 ---- } #ifdef _DEBUG ! PyCom_LogF("COM object cleanup complete."); #endif } *************** *** 140,144 **** #ifdef _DEBUG_LIFETIMES ! LogF(buf, " SafeRelease(%ld) -> %s at 0x%0lx, IUnknown at 0x%0lx - Release() returned %ld",GetCurrentThreadId(), ob->ob_type->tp_name,ob, ob->m_obj,rcnt); #endif ob->m_obj = NULL; --- 141,145 ---- #ifdef _DEBUG_LIFETIMES ! PyCom_LogF(buf, " SafeRelease(%ld) -> %s at 0x%0lx, IUnknown at 0x%0lx - Release() returned %ld",GetCurrentThreadId(), ob->ob_type->tp_name,ob, ob->m_obj,rcnt); #endif ob->m_obj = NULL; *************** *** 147,151 **** { PyEval_RestoreThread(_save); ! LogF(_T("Win32 exception occurred releasing IUnknown at 0x%08x"), ob->m_obj); ob->m_obj = NULL; #ifdef _DEBUG --- 148,152 ---- { PyEval_RestoreThread(_save); ! PyCom_LogF("Win32 exception occurred releasing IUnknown at 0x%08x", ob->m_obj); ob->m_obj = NULL; #ifdef _DEBUG *************** *** 182,186 **** { PyObject *obiid; ! PyObject *obUseIID = NULL; // @pyparm IID|iid||The IID requested. // @pyparm IID|useIID|None|If provided and not None, will return an --- 183,187 ---- { PyObject *obiid; ! PyObject *obUseIID = Py_None; // @pyparm IID|iid||The IID requested. // @pyparm IID|useIID|None|If provided and not None, will return an *************** *** 208,227 **** return NULL; ! IID useIID; /* used if obUseIID != NULL */ ! if ( obUseIID != NULL ) ! { ! if ( obUseIID == Py_None ) ! obUseIID = NULL; ! else if ( PyInt_Check(obUseIID) ) ! { ! if ( PyInt_AS_LONG((PyIntObject *)obUseIID) ) ! useIID = IID_IUnknown; ! else ! obUseIID = NULL; ! } ! else if ( !PyWinObject_AsIID(obUseIID, &useIID) ) return NULL; - } IUnknown *pMyUnknown = GetI(self); --- 209,219 ---- return NULL; ! IID useIID; /* used if obUseIID != Py_None */ ! // This used to allow an int, with 1 indicating IUnknown ! // Doesn't seem to be used anywhere, so it has been removed ! if (obUseIID != Py_None) ! if ( !PyWinObject_AsIID(obUseIID, &useIID) ) return NULL; IUnknown *pMyUnknown = GetI(self); *************** *** 244,248 **** /* we may have been asked to use a different interface */ ! if ( rc == NULL && obUseIID != NULL ) { PyErr_Clear(); --- 236,243 ---- /* we may have been asked to use a different interface */ ! /* ??? useIID will be ignored if interface successfully created ??? ! Apparently true and relies on a final QI somewhere? :() ! */ ! if ( rc == NULL && obUseIID != Py_None) { PyErr_Clear(); Index: PyStorage.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/PyStorage.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** PyStorage.cpp 4 Jul 2007 18:40:46 -0000 1.12 --- PyStorage.cpp 13 Nov 2008 11:11:58 -0000 1.13 *************** *** 254,258 **** myStgOpenStorageEx = (PFNStgOpenStorageEx)-1; if (ole32==NULL) ! ole32=GetModuleHandle("Ole32.dll"); if (ole32!=NULL){ FARPROC fp = GetProcAddress(ole32,"StgOpenStorageEx"); --- 254,258 ---- myStgOpenStorageEx = (PFNStgOpenStorageEx)-1; if (ole32==NULL) ! ole32=GetModuleHandle(_T("Ole32.dll")); if (ole32!=NULL){ FARPROC fp = GetProcAddress(ole32,"StgOpenStorageEx"); *************** *** 315,319 **** if (!pfnchecked){ if (ole32==NULL) ! ole32=GetModuleHandle("Ole32.dll"); if (ole32!=NULL) pfnFmtIdToPropStgName = (PFNFmtIdToPropStgName)GetProcAddress(ole32, "FmtIdToPropStgName"); --- 315,319 ---- if (!pfnchecked){ if (ole32==NULL) ! ole32=GetModuleHandle(_T("Ole32.dll")); if (ole32!=NULL) pfnFmtIdToPropStgName = (PFNFmtIdToPropStgName)GetProcAddress(ole32, "FmtIdToPropStgName"); *************** *** 352,356 **** if (!pfnchecked){ if (ole32==NULL) ! ole32=GetModuleHandle("Ole32.dll"); if (ole32!=NULL) pfnPropStgNameToFmtId = (PFNPropStgNameToFmtId)GetProcAddress(ole32, "PropStgNameToFmtId"); --- 352,356 ---- if (!pfnchecked){ if (ole32==NULL) ! ole32=GetModuleHandle(_T("Ole32.dll")); if (ole32!=NULL) pfnPropStgNameToFmtId = (PFNPropStgNameToFmtId)GetProcAddress(ole32, "PropStgNameToFmtId"); Index: dllmain.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/dllmain.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** dllmain.cpp 23 Mar 2006 06:59:20 -0000 1.15 --- dllmain.cpp 13 Nov 2008 11:11:58 -0000 1.16 *************** *** 185,189 **** // Do a LoadLibrary, as the Ex version may not always exist // on Win95. ! HMODULE hMod = GetModuleHandle("ole32.dll"); if (hMod==0) return E_HANDLE; FARPROC fp = GetProcAddress(hMod, "CoInitializeEx"); --- 185,189 ---- // Do a LoadLibrary, as the Ex version may not always exist // on Win95. ! HMODULE hMod = GetModuleHandle(_T("ole32.dll")); if (hMod==0) return E_HANDLE; FARPROC fp = GetProcAddress(hMod, "CoInitializeEx"); Index: PyIDispatch.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/PyIDispatch.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** PyIDispatch.cpp 13 Feb 2006 01:17:01 -0000 1.11 --- PyIDispatch.cpp 13 Nov 2008 11:11:58 -0000 1.12 *************** *** 56,62 **** // @pyparmalt1 [string, ...]|[name, ...]||A sequence of string names to query // @comm Currently the LCID can not be specified, and LOCALE_SYSTEM_DEFAULT is used. ! int argc = PyObject_Length(args); ! if ( argc == -1 ) ! return NULL; if ( argc < 1 ) return PyErr_Format(PyExc_TypeError, "At least one argument must be supplied"); --- 56,60 ---- // @pyparmalt1 [string, ...]|[name, ...]||A sequence of string names to query // @comm Currently the LCID can not be specified, and LOCALE_SYSTEM_DEFAULT is used. ! int argc = PyTuple_GET_SIZE(args); if ( argc < 1 ) return PyErr_Format(PyExc_TypeError, "At least one argument must be supplied"); *************** *** 64,79 **** LCID lcid = LOCALE_SYSTEM_DEFAULT; UINT offset = 0; ! if ( argc > 1 ) ! { ! PyObject *ob = PySequence_GetItem(args, 0); ! if ( !ob ) ! return NULL; ! if ( PyInt_Check(ob) ) ! { ! lcid = PyInt_AS_LONG((PyIntObject *)ob); offset = 1; } - Py_DECREF(ob); - } UINT cNames = argc - offset; --- 62,75 ---- LCID lcid = LOCALE_SYSTEM_DEFAULT; UINT offset = 0; ! if ( argc > 1 ){ ! PyObject *ob = PyTuple_GET_ITEM(args, 0); ! lcid=PyLong_AsLong(ob); ! if (lcid==-1 && PyErr_Occurred()){ ! PyErr_Clear(); ! lcid=LOCALE_SYSTEM_DEFAULT; ! } ! else offset = 1; } UINT cNames = argc - offset; Index: univgw_dataconv.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/univgw_dataconv.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** univgw_dataconv.cpp 13 Feb 2006 01:23:48 -0000 1.10 --- univgw_dataconv.cpp 13 Nov 2008 11:11:58 -0000 1.11 *************** *** 191,197 **** BYTE *pbArgs; BYTE *pbArg; ! UINT cArgs; UINT uiIndirectionLevel = 0; ! UINT i; if (!PyArg_ParseTuple(args, "OOO:WriteFromOutTuple", &obRetValues, &obArgTypes, &obPtr)) --- 191,197 ---- BYTE *pbArgs; BYTE *pbArg; ! Py_ssize_t cArgs; UINT uiIndirectionLevel = 0; ! Py_ssize_t i; if (!PyArg_ParseTuple(args, "OOO:WriteFromOutTuple", &obRetValues, &obArgTypes, &obPtr)) *************** *** 615,619 **** BYTE *pb; BYTE *pbArg; ! UINT cArgs, i; PyObject *obArgs = NULL; PyObject *obArg; --- 615,619 ---- BYTE *pb; BYTE *pbArg; ! Py_ssize_t cArgs, i; PyObject *obArgs = NULL; PyObject *obArg; Index: ErrorUtils.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/ErrorUtils.cpp,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** ErrorUtils.cpp 4 Sep 2007 10:32:03 -0000 1.30 --- ErrorUtils.cpp 13 Nov 2008 11:11:58 -0000 1.31 *************** *** 14,20 **** void GetScodeString(SCODE sc, TCHAR *buf, int bufSize); ! LPCSTR GetScodeRangeString(SCODE sc); ! LPCSTR GetSeverityString(SCODE sc); ! LPCSTR GetFacilityString(SCODE sc); static PyObject *PyCom_PyObjectFromIErrorInfo(IErrorInfo *, HRESULT errorhr); --- 14,20 ---- void GetScodeString(SCODE sc, TCHAR *buf, int bufSize); ! LPCTSTR GetScodeRangeString(SCODE sc); ! LPCTSTR GetSeverityString(SCODE sc); ! LPCTSTR GetFacilityString(SCODE sc); static PyObject *PyCom_PyObjectFromIErrorInfo(IErrorInfo *, HRESULT errorhr); *************** *** 465,469 **** { #ifndef MS_WINCE ! OutputDebugString(pszMessageText); #else NKDbgPrintfW(pszMessageText); --- 465,469 ---- { #ifndef MS_WINCE ! OutputDebugStringA(pszMessageText); #else NKDbgPrintfW(pszMessageText); *************** *** 481,494 **** PyErr_Restore(typ, val, tb); } BOOL VLogF_Logger(PyObject *logger, const char *log_method, ! const TCHAR *prefix, const TCHAR *fmt, va_list argptr) { // Protected by Python lock ! static TCHAR buff[8196]; ! int buf_len = sizeof(buff) / sizeof(buff[0]); ! int prefix_len = strlen(prefix); ! assert(prefix_len<100); ! strcpy(buff, prefix); ! wvsprintf(buff+prefix_len, fmt, argptr); PyObject *exc_typ = NULL, *exc_val = NULL, *exc_tb = NULL; --- 481,494 ---- PyErr_Restore(typ, val, tb); } + BOOL VLogF_Logger(PyObject *logger, const char *log_method, ! const char *prefix, const char *fmt, va_list argptr) { // Protected by Python lock ! static char buff[8196]; ! size_t buf_len = sizeof(buff) / sizeof(buff[0]); ! size_t prefix_len = strlen(prefix); ! strncpy(buff, prefix, buf_len); ! vsnprintf(buff+prefix_len, buf_len-prefix_len, fmt, argptr); PyObject *exc_typ = NULL, *exc_val = NULL, *exc_tb = NULL; *************** *** 525,538 **** } ! void VLogF(const TCHAR *fmt, va_list argptr) { ! static TCHAR buff[8196]; // protected by Python lock ! wvsprintf(buff, fmt, argptr); PyCom_StreamMessage(buff); } ! PYCOM_EXPORT void PyCom_LogF(const TCHAR *fmt, ...) { va_list marker; --- 525,538 ---- } ! void VLogF(const char *fmt, va_list argptr) { ! static char buff[8196]; // protected by Python lock ! vsnprintf(buff, 8196, fmt, argptr); PyCom_StreamMessage(buff); } ! void PyCom_LogF(const char *fmt, ...) { va_list marker; *************** *** 705,709 **** Py_INCREF(Py_None); } ! PyObject *evalue = Py_BuildValue("isOO", errorhr, scodeStringBuf, obEI, Py_None); Py_DECREF(obEI); --- 705,709 ---- Py_INCREF(Py_None); } ! PyObject *evalue = Py_BuildValue("iNOO", errorhr, PyWinObject_FromTCHAR(scodeStringBuf), obEI, Py_None); Py_DECREF(obEI); *************** *** 720,724 **** TCHAR buf[512]; GetScodeString(hr, buf, sizeof(buf)/sizeof(TCHAR)); ! PyObject *obScodeString = PyString_FromTCHAR(buf); PyObject *evalue; PyObject *obArg; --- 720,724 ---- TCHAR buf[512]; GetScodeString(hr, buf, sizeof(buf)/sizeof(TCHAR)); ! PyObject *obScodeString = PyWinObject_FromTCHAR(buf); PyObject *evalue; PyObject *obArg; *************** *** 1181,1185 **** return; } ! // Next see if this particular error code is registerd as being supplied // by a specific DLL. HINSTANCE hi = PyWin_GetErrorMessageModule(hr); --- 1181,1185 ---- return; } ! // Next see if this particular error code is registered as being supplied // by a specific DLL. HINSTANCE hi = PyWin_GetErrorMessageModule(hr); *************** *** 1208,1212 **** } ! LPCSTR GetScodeRangeString(HRESULT hr) { struct RANGE_ENTRY --- 1208,1212 ---- } ! LPCTSTR GetScodeRangeString(HRESULT hr) { struct RANGE_ENTRY *************** *** 1214,1222 **** HRESULT hrFirst; HRESULT hrLast; ! LPCSTR lpszName; }; #define MAKE_RANGE_ENTRY(hrRange) \ { hrRange##_FIRST, hrRange##_LAST, \ ! #hrRange "_FIRST..." #hrRange "_LAST" } static const RANGE_ENTRY hrRangeTable[] = --- 1214,1222 ---- HRESULT hrFirst; HRESULT hrLast; ! LPCTSTR lpszName; }; #define MAKE_RANGE_ENTRY(hrRange) \ { hrRange##_FIRST, hrRange##_LAST, \ ! _T(#hrRange) _T("_FIRST...") _T(#hrRange) _T("_LAST") } static const RANGE_ENTRY hrRangeTable[] = *************** *** 1269,1313 **** } ! LPCSTR GetSeverityString(HRESULT hr) { ! static LPCSTR rgszSEVERITY[] = { ! "SEVERITY_SUCCESS", ! "SEVERITY_ERROR", }; return rgszSEVERITY[HRESULT_SEVERITY(hr)]; } ! LPCSTR GetFacilityString(HRESULT hr) { ! static LPCSTR rgszFACILITY[] = { ! "FACILITY_NULL", ! "FACILITY_RPC", ! "FACILITY_DISPATCH", ! "FACILITY_STORAGE", ! "FACILITY_ITF", ! "FACILITY_ADSI", ! "FACILITY_0x06", ! "FACILITY_WIN32", ! "FACILITY_WINDOWS", ! "FACILITY_SSPI/FACILITY_MQ", // SSPI from ADSERR.H, MQ from mq.h ! "FACILITY_CONTROL", ! "FACILITY_EDK", ! "FACILITY_INTERNET", ! "FACILITY_MEDIASERVER", ! "FACILITY_MSMQ", ! "FACILITY_SETUPAPI", }; if (HRESULT_FACILITY(hr) >= _countof(rgszFACILITY)) switch (HRESULT_FACILITY(hr)) { case 0x7FF: ! return "FACILITY_BACKUP"; case 0x800: ! return "FACILITY_EDB"; case 0x900: ! return "FACILITY_MDSI"; default: ! return "<Unknown Facility>"; } return rgszFACILITY[HRESULT_FACILITY(hr)]; --- 1269,1313 ---- } ! LPCTSTR GetSeverityString(HRESULT hr) { ! static LPCTSTR rgszSEVERITY[] = { ! _T("SEVERITY_SUCCESS"), ! _T("SEVERITY_ERROR"), }; return rgszSEVERITY[HRESULT_SEVERITY(hr)]; } ! LPCTSTR GetFacilityString(HRESULT hr) { ! static LPCTSTR rgszFACILITY[] = { ! _T("FACILITY_NULL"), ! _T("FACILITY_RPC"), ! _T("FACILITY_DISPATCH"), ! _T("FACILITY_STORAGE"), ! _T("FACILITY_ITF"), ! _T("FACILITY_ADSI"), ! _T("FACILITY_0x06"), ! _T("FACILITY_WIN32"), ! _T("FACILITY_WINDOWS"), ! _T("FACILITY_SSPI/FACILITY_MQ"), // SSPI from ADSERR.H, MQ from mq.h ! _T("FACILITY_CONTROL"), ! _T("FACILITY_EDK"), ! _T("FACILITY_INTERNET"), ! _T("FACILITY_MEDIASERVER"), ! _T("FACILITY_MSMQ"), ! _T("FACILITY_SETUPAPI"), }; if (HRESULT_FACILITY(hr) >= _countof(rgszFACILITY)) switch (HRESULT_FACILITY(hr)) { case 0x7FF: ! return _T("FACILITY_BACKUP"); case 0x800: ! return _T("FACILITY_EDB"); case 0x900: ! return _T("FACILITY_MDSI"); default: ! return _T("<Unknown Facility>"); } return rgszFACILITY[HRESULT_FACILITY(hr)]; |
From: Mark H. <mha...@us...> - 2008-11-13 11:12:01
|
Update of /cvsroot/pywin32/pywin32/com/win32com/src/include In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv9817/com/win32com/src/include Modified Files: PythonCOM.h Log Message: Yet more TCHAR/64bit and other misc changes from py3k branch. Index: PythonCOM.h =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/include/PythonCOM.h,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** PythonCOM.h 2 Nov 2008 12:42:58 -0000 1.28 --- PythonCOM.h 13 Nov 2008 11:11:58 -0000 1.29 *************** *** 741,743 **** --- 741,745 ---- PYCOM_EXPORT PyObject *MakeOLECHARToObj(const OLECHAR * str); + PYCOM_EXPORT void PyCom_LogF(const char *fmt, ...); + #endif // __PYTHONCOM_H__ |
From: Mark H. <mha...@us...> - 2008-11-13 10:29:57
|
Update of /cvsroot/pywin32/pywin32 In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv1137 Modified Files: setup.py Log Message: define _CRT_SECURE_NO_WARNINGS - those warnings are obscuring the far more important warnings that might be generated by py3k work. Index: setup.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/setup.py,v retrieving revision 1.84 retrieving revision 1.85 diff -C2 -d -r1.84 -r1.85 *** setup.py 2 Nov 2008 11:47:47 -0000 1.84 --- setup.py 13 Nov 2008 10:29:53 -0000 1.85 *************** *** 269,272 **** --- 269,273 ---- define_macros = define_macros or [] define_macros.append(("DISTUTILS_BUILD", None)) + define_macros.append(("_CRT_SECURE_NO_WARNINGS", None)) self.pch_header = pch_header self.extra_swig_commands = extra_swig_commands or [] |
From: Mark H. <mha...@us...> - 2008-11-13 09:48:04
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv22575/win32/src Modified Files: stddde.h Log Message: More TCHAR fixes from py3k branch for dde support Index: stddde.h =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/stddde.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** stddde.h 2 Sep 1999 00:19:37 -0000 1.1 --- stddde.h 13 Nov 2008 09:48:01 -0000 1.2 *************** *** 71,77 **** public: CHSZ(); ! CHSZ(CDDEServer* pServer, const char* szName); virtual ~CHSZ(); ! void Create(CDDEServer* pServer, const char* szName); void Destroy(); operator HSZ() {return m_hsz;} --- 71,77 ---- public: CHSZ(); ! CHSZ(CDDEServer* pServer, const TCHAR* szName); virtual ~CHSZ(); ! void Create(CDDEServer* pServer, const TCHAR* szName); void Destroy(); operator HSZ() {return m_hsz;} *************** *** 95,104 **** CDDEItem(); virtual ~CDDEItem(); ! void Create(const char* pszName); void PostAdvise(); virtual BOOL Request(UINT wFmt, void** ppData, DWORD* pdwSize); //CT BEGIN ! virtual BOOL NSRequest(const char* szItem, void** ppData, DWORD* pdwSize); ! virtual BOOL NSPoke(const char* szItem, void* pData, DWORD dwSize); virtual BOOL Poke(void* pData, DWORD dwSize); //CT END --- 95,104 ---- CDDEItem(); virtual ~CDDEItem(); ! void Create(const TCHAR* pszName); void PostAdvise(); virtual BOOL Request(UINT wFmt, void** ppData, DWORD* pdwSize); //CT BEGIN ! virtual BOOL NSRequest(const TCHAR* szItem, void** ppData, DWORD* pdwSize); ! virtual BOOL NSPoke(const TCHAR* szItem, void* pData, DWORD dwSize); virtual BOOL Poke(void* pData, DWORD dwSize); //CT END *************** *** 124,132 **** public: virtual void OnPoke(){;} ! virtual void SetData(const char* pszData); ! virtual const char* GetData() ! {return (const char*)m_strData;} ! operator const char*() ! {return (const char*)m_strData;} protected: --- 124,132 ---- public: virtual void OnPoke(){;} ! virtual void SetData(const TCHAR* pszData); ! virtual const TCHAR* GetData() ! {return (const TCHAR*)m_strData;} ! operator const TCHAR*() ! {return (const TCHAR*)m_strData;} protected: *************** *** 165,183 **** CDDETopic(); virtual ~CDDETopic(); ! void Create(const char* pszName); BOOL AddItem(CDDEItem* pItem); ! virtual BOOL Request(UINT wFmt, const char* pszItem, void** ppData, DWORD* pdwSize); //CT BEGIN ! virtual BOOL NSRequest(const char * szItem, void** ppData, DWORD* pdwSize); ! virtual BOOL NSPoke(const char * szItem, void* pData, DWORD dwSize); ! virtual BOOL Poke(const char* pszItem, void* pData, DWORD dwSize); //CT END ! virtual BOOL Poke(UINT wFmt, const char* pszItem, void* pData, DWORD dwSize); virtual BOOL Exec(void* pData, DWORD dwSize); ! virtual CDDEItem* FindItem(const char* pszItem); ! virtual BOOL CanAdvise(UINT wFmt, const char* pszItem); void PostAdvise(CDDEItem* pItem); --- 165,183 ---- CDDETopic(); virtual ~CDDETopic(); ! void Create(const TCHAR* pszName); BOOL AddItem(CDDEItem* pItem); ! virtual BOOL Request(UINT wFmt, const TCHAR* pszItem, void** ppData, DWORD* pdwSize); //CT BEGIN ! virtual BOOL NSRequest(const TCHAR * szItem, void** ppData, DWORD* pdwSize); ! virtual BOOL NSPoke(const TCHAR * szItem, void* pData, DWORD dwSize); ! virtual BOOL Poke(const TCHAR* pszItem, void* pData, DWORD dwSize); //CT END ! virtual BOOL Poke(UINT wFmt, const TCHAR* pszItem, void* pData, DWORD dwSize); virtual BOOL Exec(void* pData, DWORD dwSize); ! virtual CDDEItem* FindItem(const TCHAR* pszItem); ! virtual BOOL CanAdvise(UINT wFmt, const TCHAR* pszItem); void PostAdvise(CDDEItem* pItem); *************** *** 219,232 **** BOOL Connected() {return (m_hConv != NULL);} virtual ~CDDEConv(); ! virtual BOOL ConnectTo(const char* pszService, const char* pszTopic); virtual BOOL Terminate(); ! virtual BOOL AdviseData(UINT wFmt, const char* pszTopic, const char* pszItem, void* pData, DWORD dwSize); ! virtual BOOL Request(const char* pszItem, void** ppData, DWORD* pdwSize); ! virtual BOOL Advise(const char* pszItem); ! virtual BOOL Exec(const char* pszCmd); ! virtual BOOL Poke(UINT wFmt, const char* pszItem, void* pData, DWORD dwSize); //CT BEGIN ! virtual BOOL Poke(const char* pszItem, void* pData, DWORD dwSize); //CT END CDDEServer* m_pServer; --- 219,232 ---- BOOL Connected() {return (m_hConv != NULL);} virtual ~CDDEConv(); ! virtual BOOL ConnectTo(const TCHAR* pszService, const TCHAR* pszTopic); virtual BOOL Terminate(); ! virtual BOOL AdviseData(UINT wFmt, const TCHAR* pszTopic, const TCHAR* pszItem, void* pData, DWORD dwSize); ! virtual BOOL Request(const TCHAR* pszItem, void** ppData, DWORD* pdwSize); ! virtual BOOL Advise(const TCHAR* pszItem); ! virtual BOOL Exec(const TCHAR* pszCmd); ! virtual BOOL Poke(UINT wFmt, const TCHAR* pszItem, void* pData, DWORD dwSize); //CT BEGIN ! virtual BOOL Poke(const TCHAR* pszItem, void* pData, DWORD dwSize); //CT END CDDEServer* m_pServer; *************** *** 290,294 **** DECLARE_DYNCREATE(CDDEServerSystemTopic); protected: ! virtual BOOL Request(UINT wFmt, const char* pszItem, void** ppData, DWORD* pdwSize); --- 290,294 ---- DECLARE_DYNCREATE(CDDEServerSystemTopic); protected: ! virtual BOOL Request(UINT wFmt, const TCHAR* pszItem, void** ppData, DWORD* pdwSize); *************** *** 308,312 **** CDDEServer(); virtual ~CDDEServer(); ! BOOL Create(const char* pszServiceName, DWORD dwFilterFlags = 0, DWORD* pdwDDEInst = NULL); --- 308,312 ---- CDDEServer(); virtual ~CDDEServer(); ! BOOL Create(const TCHAR* pszServiceName, DWORD dwFilterFlags = 0, DWORD* pdwDDEInst = NULL); *************** *** 326,340 **** {return NULL;} ! virtual BOOL Request(UINT wFmt, const char* pszTopic, const char* pszItem, void** ppData, DWORD* pdwSize); ! virtual BOOL Poke(UINT wFmt, const char* pszTopic, const char* pszItem, void* pData, DWORD dwSize); ! virtual BOOL AdviseData(UINT wFmt, HCONV hConv, const char* pszTopic, const char* pszItem, void* pData, DWORD dwSize); ! virtual BOOL Exec(const char* pszTopic, void* pData, DWORD dwSize); ! virtual void Status(const char* pszFormat, ...) {;} virtual BOOL AddTopic(CDDETopic* pTopic); CString StringFromHsz(HSZ hsz); ! virtual BOOL CanAdvise(UINT wFmt, const char* pszTopic, const char* pszItem); void PostAdvise(CDDETopic* pTopic, CDDEItem* pItem); CDDEConv* AddConversation(HCONV hConv, HSZ hszTopic); --- 326,340 ---- {return NULL;} ! virtual BOOL Request(UINT wFmt, const TCHAR* pszTopic, const TCHAR* pszItem, void** ppData, DWORD* pdwSize); ! virtual BOOL Poke(UINT wFmt, const TCHAR* pszTopic, const TCHAR* pszItem, void* pData, DWORD dwSize); ! virtual BOOL AdviseData(UINT wFmt, HCONV hConv, const TCHAR* pszTopic, const TCHAR* pszItem, void* pData, DWORD dwSize); ! virtual BOOL Exec(const TCHAR* pszTopic, void* pData, DWORD dwSize); ! virtual void Status(const TCHAR* pszFormat, ...) {;} virtual BOOL AddTopic(CDDETopic* pTopic); CString StringFromHsz(HSZ hsz); ! virtual BOOL CanAdvise(UINT wFmt, const TCHAR* pszTopic, const TCHAR* pszItem); void PostAdvise(CDDETopic* pTopic, CDDEItem* pItem); CDDEConv* AddConversation(HCONV hConv, HSZ hszTopic); *************** *** 360,364 **** HDDEDATA hData, HDDEDATA *phReturnData); ! CDDETopic* FindTopic(const char* pszTopic); private: --- 360,364 ---- HDDEDATA hData, HDDEDATA *phReturnData); ! CDDETopic* FindTopic(const TCHAR* pszTopic); private: *************** *** 407,410 **** --- 407,415 ---- }; + #ifdef UNICODE + #define DDE_STRING_CODEPAGE CP_WINUNICODE + #else + #define DDE_STRING_CODEPAGE CP_WINANSI + #endif #endif // _STDDDE_ |
From: Mark H. <mha...@us...> - 2008-11-13 09:48:04
|
Update of /cvsroot/pywin32/pywin32/Pythonwin In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv22575/Pythonwin Modified Files: stddde.cpp Log Message: More TCHAR fixes from py3k branch for dde support Index: stddde.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/stddde.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** stddde.cpp 13 Nov 2008 04:04:50 -0000 1.6 --- stddde.cpp 13 Nov 2008 09:48:01 -0000 1.7 *************** *** 9,16 **** #include "stdafxdde.h" - // ?? where does this come from? - #ifndef DDE_STRING_CODEPAGE - #define DDE_STRING_CODEPAGE CP_WINANSI - #endif // // Constants --- 9,12 ---- |