On Wed, Jun 09, 2010 at 10:19:39PM +0000, Sandro Tosi wrote:
> We are not sure your package is impacted, since the exception raise
> can be in a dead or very rare branch of the code, and so simply never
> being executed. We would like to leverage your package maintainer
> status and the relationship with upstream authors to inspect more
> deeply the issue and act accordingly (that includes: making this bug
> release critical, closing it as irrelevant, tagging it 'wontfix', or
> whatever is appropriate).
It looks to me like these exceptions aren't in "important" code paths
for wxPython - they're mostly cases where the API has been passed an
invalid parameter. And I can't see a single bug report filed about
the breakage this has caused.
But we should address this - I've prepared a patch to just wrap each
such string in an exception object, which I'll forward to upstream.
This may not be the best approach but it will at least show upstream
where to look.
Cheers,
Olly
diff --git a/wxPython/wx/lib/evtmgr.py b/wxPython/wx/lib/evtmgr.py
index 5741622..9427984 100644
--- a/wxPython/wx/lib/evtmgr.py
+++ b/wxPython/wx/lib/evtmgr.py
@@ -82,7 +82,7 @@ class EventManager:
# 1. Check if the 'event' is actually one of the multi-
# event macros.
if _macroInfo.isMultiEvent(event):
- raise 'Cannot register the macro, '+`event`+'. Register instead the individual events.'
+ raise Exception, 'Cannot register the macro, '+`event`+'. Register instead the individual events.'
# Support a more OO API. This allows the GUI widget itself to
# be specified, and the id to be retrieved from the system,
diff --git a/wxPython/wx/lib/ogl/_basic.py b/wxPython/wx/lib/ogl/_basic.py
index f0be159..a1aa09d 100644
--- a/wxPython/wx/lib/ogl/_basic.py
+++ b/wxPython/wx/lib/ogl/_basic.py
@@ -1717,7 +1717,7 @@ class Shape(ShapeEvtHandler):
shoulder1[1] = neck[1] - totalBranchLength / 2.0
shoulder2[1] = neck[1] + totalBranchLength / 2.0
else:
- raise "Unrecognised attachment point in GetBranchingAttachmentInfo"
+ raise Exception, "Unrecognised attachment point in GetBranchingAttachmentInfo"
return root, neck, shoulder1, shoulder2
def GetBranchingAttachmentPoint(self, attachment, n):
@@ -1752,7 +1752,7 @@ class Shape(ShapeEvtHandler):
stemPt[0] = neck[0]
stemPt[1] = pt[1]
else:
- raise "Unrecognised attachment point in GetBranchingAttachmentPoint"
+ raise Exception, "Unrecognised attachment point in GetBranchingAttachmentPoint"
return pt, stemPt
@@ -1788,7 +1788,7 @@ class Shape(ShapeEvtHandler):
root[0] = self.GetX() - width / 2.0
root[1] = self.GetY()
else:
- raise "Unrecognised attachment point in GetBranchingAttachmentRoot"
+ raise Exception, "Unrecognised attachment point in GetBranchingAttachmentRoot"
return root
diff --git a/wxPython/wx/lib/ogl/_lines.py b/wxPython/wx/lib/ogl/_lines.py
index 302cee1..eef160b 100644
--- a/wxPython/wx/lib/ogl/_lines.py
+++ b/wxPython/wx/lib/ogl/_lines.py
@@ -752,7 +752,7 @@ class LineShape(Shape):
elif x2 > x1 and y2 < y1:
theta = 2 * math.pi + math.atan((y2 - y1) / (x2 - x1))
else:
- raise "Unknown arrowhead rotation case"
+ raise Exception, "Unknown arrowhead rotation case"
# Rotate about the centre of the object, then place
# the object on the line.
diff --git a/wxPython/wx/lib/pubsub/pubsub1/pub.py b/wxPython/wx/lib/pubsub/pubsub1/pub.py
index 9c84733..28575aa 100644
--- a/wxPython/wx/lib/pubsub/pubsub1/pub.py
+++ b/wxPython/wx/lib/pubsub/pubsub1/pub.py
@@ -112,7 +112,7 @@ def _paramMinCount(callableObject):
try:
return _paramMinCountFunc(callableObject)
except exc:
- raise 'Cannot determine type of callable: %s' % repr(callableObject)
+ raise Exception, 'Cannot determine type of callable: %s' % repr(callableObject)
min, d = _paramMinCountFunc(func)
return min-1, d
diff --git a/wxPython/wx/lib/rpcMixin.py b/wxPython/wx/lib/rpcMixin.py
index 7a0c342..a053a4a 100644
--- a/wxPython/wx/lib/rpcMixin.py
+++ b/wxPython/wx/lib/rpcMixin.py
@@ -261,7 +261,7 @@ class rpcMixin:
self.rpcPort = -1
if self.rpcPort == -1:
- raise 'RPCMixinError','Cannot initialize server'
+ raise Exception, 'RPCMixinError: Cannot initialize server'
self.servThread = _ServerThread(xmlServ,verbose=self.verbose)
self.servThread.setName('XML-RPC Server')
self.servThread.start()