[Python-checkins] python/dist/src/Mac/Tools/IDE Wapplication.py,
1.22, 1.22.8.1
jackjansen at users.sourceforge.net
jackjansen at users.sourceforge.net
Thu Jun 3 09:34:44 EDT 2004
Update of /cvsroot/python/python/dist/src/Mac/Tools/IDE
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32276
Modified Files:
Tag: release23-maint
Wapplication.py
Log Message:
Backport of 1.23 and 1.24:
Very large scripts folders could crash the IDE, because it runs out
of Menu IDs (of which there are only 255 in Carbon). Fixed by stopping
examining the scripts folder when we allocate menu ID 200.
Fixes #959291.
Replace backticks with repr() or "%r"
>From SF patch #852334.
Index: Wapplication.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/Wapplication.py,v
retrieving revision 1.22
retrieving revision 1.22.8.1
diff -C2 -d -r1.22 -r1.22.8.1
*** Wapplication.py 6 May 2003 14:28:31 -0000 1.22
--- Wapplication.py 3 Jun 2004 13:34:41 -0000 1.22.8.1
***************
*** 119,123 ****
except:
import sys
! sys.stderr.write("exception in idle function %s; killed:\n" % `func`)
traceback.print_exc()
self._idlefuncs.remove(func)
--- 119,123 ----
except:
import sys
! sys.stderr.write("exception in idle function %r; killed:\n" % (func,))
traceback.print_exc()
self._idlefuncs.remove(func)
***************
*** 176,180 ****
return # here! we had a menukey!
#else:
! # print "XXX Command-" +`ch`
# See whether the front window wants it
if wid and self._windows.has_key(wid):
--- 176,180 ----
return # here! we had a menukey!
#else:
! # print "XXX Command-%r" % ch
# See whether the front window wants it
if wid and self._windows.has_key(wid):
***************
*** 276,283 ****
def scriptswalk(self, top, menu, done=None):
if done is None:
done = {}
if done.has_key(top):
! return
done[top] = 1
import os, string
--- 276,287 ----
def scriptswalk(self, top, menu, done=None):
+ if menu.id > 200:
+ import W
+ W.Message("Scripts folder not completely traversed: running out of menus")
+ return False
if done is None:
done = {}
if done.has_key(top):
! return True
done[top] = 1
import os, string
***************
*** 286,290 ****
except os.error:
FrameWork.MenuItem(menu, '(Scripts Folder not found)', None, None)
! return
savedir = os.getcwd()
os.chdir(top)
--- 290,294 ----
except os.error:
FrameWork.MenuItem(menu, '(Scripts Folder not found)', None, None)
! return True
savedir = os.getcwd()
os.chdir(top)
***************
*** 307,311 ****
elif isdir:
submenu = FrameWork.SubMenu(menu, name)
! self.scriptswalk(path, submenu, done)
else:
creator, type = MacOS.GetCreatorAndType(path)
--- 311,316 ----
elif isdir:
submenu = FrameWork.SubMenu(menu, name)
! if not self.scriptswalk(path, submenu, done):
! return False
else:
creator, type = MacOS.GetCreatorAndType(path)
***************
*** 317,320 ****
--- 322,326 ----
done[path] = 1
os.chdir(savedir)
+ return True
def domenu_script(self, id, item, window, event):
More information about the Python-checkins
mailing list