Comment 4 for bug 192892

Revision history for this message
Apport retracing service (apport) wrote :

Ah, I got it, I think:

    def __init__(self, subject=None, text=None, attachments=set()):

This usually does not what you want in Python. You should do "attachments=None" and explicitly check for None in the function body:

--- /home/ubuntu-archive/apport-retracer-i386/apport/launchpadbugs/commentsbase.py.orig 2008-02-18 12:26:38.000000000 +0000
+++ /home/ubuntu-archive/apport-retracer-i386/apport/launchpadbugs/commentsbase.py 2008-02-18 12:27:13.000000000 +0000
@@ -4,10 +4,11 @@

 class LPComment(object):
- def __init__(self, subject=None, text=None, attachments=set()):
+ def __init__(self, subject=None, text=None, attachments=None):
         self.subject = subject
         self.text = text
- self.__attachments = set()
+ if attachments is None:
+ attachments = set()
         if isinstance(attachments, LPAttachment):
             self.__attachments = set([attachments])
         else:

(This removes the redundant self.__attachments = set(), too, since it's assigned in both the then and else clause further down).