From nobody Sat Jul 5 15:57:00 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1521296742400224.42969448437748; Sat, 17 Mar 2018 07:25:42 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0674B85359; Sat, 17 Mar 2018 14:25:41 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C10C97EE2E; Sat, 17 Mar 2018 14:25:40 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 833D24CA9E; Sat, 17 Mar 2018 14:25:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w2HEO2BQ000592 for ; Sat, 17 Mar 2018 10:24:02 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0E56077D48; Sat, 17 Mar 2018 14:24:02 +0000 (UTC) Received: from mx1.redhat.com (ext-mx07.extmail.prod.ext.phx2.redhat.com [10.5.110.31]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 063BA80E97 for ; Sat, 17 Mar 2018 14:24:02 +0000 (UTC) Received: from mail-wm0-f68.google.com (mail-wm0-f68.google.com [74.125.82.68]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 540E1C047B65 for ; Sat, 17 Mar 2018 14:24:01 +0000 (UTC) Received: by mail-wm0-f68.google.com with SMTP id q83so7978542wme.5 for ; Sat, 17 Mar 2018 07:24:01 -0700 (PDT) Received: from rst.Home ([2a02:c7d:692a:c500:1ebc:73f3:5f60:b131]) by smtp.gmail.com with ESMTPSA id i66sm11060550wmd.0.2018.03.17.07.23.58 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 17 Mar 2018 07:23:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=p2xYohaYySNV35tkP6K+PasiPFHThmzLn7qGfW5m5UA=; b=I6qcrwEK+xl5N+A7KnxTv/Uyv+hAhQvYoWXYMt9X8Tl2Yb5sJcG+1rekrYA7FVnNnM M5x+SzcVt+h2xClEJWZriqCsBSpJ27GbfCT8Z6YAnAlKPLSG7BxoeuybU9ORux6Bf6Qm rQ1IoRko43R+HUygFAnfIj9cvub529e5tNy11UOiNxVSxbQCwlrb0vdUSaejf9r0af5p 9mHjTW1fM1cOfAYjQESWablrHnBujvV0apGw0U3QabH+m/iT1N7Ge7nCOZ1sqneeWxN1 Ztcy1v/ac9jNHDQ4BUrgUkT7QRvIrpw8sQThc3uFiXnkazKGjxNBrfosoUUgf3MjY8cG IKag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=p2xYohaYySNV35tkP6K+PasiPFHThmzLn7qGfW5m5UA=; b=YJGyq8Je7NH1vPXHPYiQM0wIYE7Opq4c4FO/1ZTInp9nsW5mOMspUxLrUnwL/BnXOT BZ3yBeKXtxkRKWvw0DNEGEDHipyBnB9VHE8wtNIy4mBdYRwoZZWLkK9Xp2X6aY15MJZx yIRG8pSLL6TOYjrAtcgBuFB6y0TnWtqvbU1+gCmU01Qf3RYCdti4sPpJfl8WevZvvt1h 5CgAn6zvh5UqpBQHXuOlWS6LH5Gspptshkdk3KBZjr93jouFWysXcOEMpY7kNK0lb/DO ENbVf3vH1oWcspJpbd5vfU+PrK+eFW88+X0aiqOiqZzH466PZbi53XeQNC1SI2G9snEZ gtJw== X-Gm-Message-State: AElRT7GC8Ent7qJdkbNcXcJszkH+vpRZms0pJOrCzPzrmXCyvn8Nn1VS PzG1FMpNUOR/3qWnYB2jU3HCLU6S X-Google-Smtp-Source: AG47ELsyxiv9AOvobJJ1oCM9dD6ypJsEMj5Xvsixfnk2OGdRSuKpDU+stEhl+oREjSf8wESKUgamjw== X-Received: by 10.28.181.16 with SMTP id e16mr2341008wmf.97.1521296639736; Sat, 17 Mar 2018 07:23:59 -0700 (PDT) From: Radostin Stoyanov To: libvir-list@redhat.com Date: Sat, 17 Mar 2018 14:23:29 +0000 Message-Id: <20180317142340.11653-12-rstoyanov1@gmail.com> In-Reply-To: <20180317142340.11653-1-rstoyanov1@gmail.com> References: <20180317142340.11653-1-rstoyanov1@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Sat, 17 Mar 2018 14:24:01 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Sat, 17 Mar 2018 14:24:01 +0000 (UTC) for IP:'74.125.82.68' DOMAIN:'mail-wm0-f68.google.com' HELO:'mail-wm0-f68.google.com' FROM:'rstoyanov1@gmail.com' RCPT:'' X-RedHat-Spam-Score: 0.12 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_PASS) 74.125.82.68 mail-wm0-f68.google.com 74.125.82.68 mail-wm0-f68.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.31 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: Radostin Stoyanov Subject: [libvirt] [PATCH 11/22] WmiClass: Don't share "versions" between instances X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Sat, 17 Mar 2018 14:25:41 +0000 (UTC) X-ZohoMail-DKIM: fail (Computed bodyhash is different from the expected one) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Lists in Python are mutable and when used as a default value of a parameter for class constructor, its value will be shared between all class instances. Example: class Test: def __init__(self, mylist=3D[]): self.mylist =3D mylist A =3D Test() B =3D Test() A.mylist.append("mylist from instance A") print(B.mylist) # Will print ['mylist from instance A'] Signed-off-by: Radostin Stoyanov Reviewed-by: Daniel P. Berrang=C3=A9 --- src/hyperv/hyperv_wmi_generator.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hyperv/hyperv_wmi_generator.py b/src/hyperv/hyperv_wmi_gen= erator.py index f98a77562..acb9e5440 100755 --- a/src/hyperv/hyperv_wmi_generator.py +++ b/src/hyperv/hyperv_wmi_generator.py @@ -44,9 +44,9 @@ class WmiClass: to. """ =20 - def __init__(self, name, versions =3D []): + def __init__(self, name, versions=3DNone): self.name =3D name - self.versions =3D versions + self.versions =3D versions if versions else list() self.common =3D None =20 =20 --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list