Passing an empty list (or any mutable object) in as a default arg is sort of a no-no. The default value for reject_list is allocated when the class is created, not when it's called.

I think it would be better to leave it as None, but then in __init__, check for None:

def __init__(self, .... reject_list=None, .....):

<....>
    if reject_list is None:
        reject_list = list()


This way we're protected.

I know the odds of us hitting something here is low, but I'd be safe than sorry. If you do decide to take up this change, no follow-up webrev is necessary.

-Drew



On 4/24/12 4:30 PM, Darren Kenny wrote:
Hi,

Could I please get a quick review for this fix for the bug:

        7164012 putback of 7145997 breaks text-installs

The code changes are below, no need for a webrev really.

I'm in the process of testing this fix now - I've already seen that it
fixes the TI install, but I need to test other images (being built now) too.

I don't expect this to have any impact on AI since the code-path differs in
that the from_xml is used to process the<software_data>  and thus
initializes things to a list(), which is why it's to_xml() didn't crash.

Thanks,

Darren

-------------------------------------------------------------------------

diff -r 15ba29ecb4ed -r 8af35f2241c7 usr/src/lib/install_transfer/info.py
--- a/usr/src/lib/install_transfer/info.py      Tue Apr 24 11:31:32 2012 -0600
+++ b/usr/src/lib/install_transfer/info.py      Tue Apr 24 23:19:31 2012 +0100
@@ -633,7 +633,7 @@ class IPSSpec(DataObject):
      INSTALL = "install"
      UNINSTALL = "uninstall"

-    def __init__(self, action=None, contents=None, reject_list=None,
+    def __init__(self, action=None, contents=None, reject_list=list(),
                   app_callback=None, purge_history=False):
          super(IPSSpec, self).__init__(IPSSpec.IPS_TRANSFER_LABEL)
          self.action = action
        
_______________________________________________
caiman-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/caiman-discuss
_______________________________________________
caiman-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/caiman-discuss

Reply via email to