From nobody Thu Mar 28 14:57:50 2024 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 1552340110218321.2092967987851; Mon, 11 Mar 2019 14:35:10 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BC2E486674; Mon, 11 Mar 2019 21:35:07 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4379F1001947; Mon, 11 Mar 2019 21:35:07 +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 D8FB7181A136; Mon, 11 Mar 2019 21:35:05 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x2BLZ4At029175 for ; Mon, 11 Mar 2019 17:35:04 -0400 Received: by smtp.corp.redhat.com (Postfix) id 58BCA60146; Mon, 11 Mar 2019 21:35:04 +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 EACDE600CD; Mon, 11 Mar 2019 21:35:01 +0000 (UTC) Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) (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 E8FD0C04D29A; Mon, 11 Mar 2019 21:35:00 +0000 (UTC) Received: by mail-wr1-f67.google.com with SMTP id o9so456327wrv.9; Mon, 11 Mar 2019 14:35:00 -0700 (PDT) Received: from lean.com (46-116-64-66.bb.netvision.net.il. [46.116.64.66]) by smtp.gmail.com with ESMTPSA id t3sm827036wmc.20.2019.03.11.14.34.56 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Mar 2019 14:34:57 -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; bh=TjQ+Dx2wPhODasbC0hQBsSpn5iXWKzGxEmIx/6oeT9U=; b=Ji0arNjnXihRuBI0Euoon8KhFQw37rWNBfZy+6Ny2xZscVTL+vzU+ImvlOjRSYOwxv UcZssb4UZJzHqF/xIbyNDU1ryeke+A5+fifZvpfpEIZpoPfwhmYx0o96vjKnyFG2inIS fDaPOyOsOvO5kmdlwPNUoTS0trFa97k7pZawFw4RjCTjjTUbIYD7a5fLUeJTmrcgAeLY 0egscp4WA8gE1YoIfkd/oMDAF5W3VzR80l5ro30mpKnJ/LWgLJfc0SAw3Rw7KVgruNCy 9yhUWPGPNI7teSjJGnyytxPd4XbM1jFCHiIOEa8LA1nsAVzVmj1hjzEZDScG19CNpIiS gu7Q== 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; bh=TjQ+Dx2wPhODasbC0hQBsSpn5iXWKzGxEmIx/6oeT9U=; b=hLmJ2Wqq+Z6MW7JmlITLHOS7+cCnHGxXFMUZQYQRGh+Z/9m6BSLCejdT6EsEPz6i1M RxalWLr3/lYe8XpLuTIUKlBMPZ5Mwn1sYlxtZYhp2zoRPw4eLOZT5qwnOFe+DMWRq7Lx 7U+Eqy9klQ7gdTU/cgUVSQJX7piRA50Knj/QcN2pMQNYKZ6sFNSAApHJIwMZF1vI4ZAM dPXU+SLvw+7XupuXYUGL440lb8+RqU8vqehR1q33vRO5nYx3YCkYCcn/CLpZXt5Aqn65 Q3IlCzbCkLbRPtTIdb/Uh8EW96fHusFSVoCWgLXkdRegFntWsfhUGko06M51nXPvFBeO 1Fwg== X-Gm-Message-State: APjAAAXn0A+4Dz2gByhmpBO1drQx5oOCjRlalcqW0SnygsY6p4qFXUr2 SI+ILUmfyRc2//Ukab10fnKK4iPs X-Google-Smtp-Source: APXvYqxXvNFv7aDBzAgu1lNYFHTRRlK05o7t+A6+VxfuUht26Km9TmEvlZiqn4AhgIlgqFjIGdb8Jw== X-Received: by 2002:adf:d08e:: with SMTP id y14mr21492062wrh.306.1552340099126; Mon, 11 Mar 2019 14:34:59 -0700 (PDT) From: Nir Soffer X-Google-Original-From: Nir Soffer To: libvir-list@redhat.com Date: Mon, 11 Mar 2019 23:34:50 +0200 Message-Id: <20190311213450.4929-1-nsoffer@redhat.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Mon, 11 Mar 2019 21:35:01 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Mon, 11 Mar 2019 21:35:01 +0000 (UTC) for IP:'209.85.221.67' DOMAIN:'mail-wr1-f67.google.com' HELO:'mail-wr1-f67.google.com' FROM:'nirsof@gmail.com' RCPT:'' X-RedHat-Spam-Score: -0.111 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_PASS) 209.85.221.67 mail-wr1-f67.google.com 209.85.221.67 mail-wr1-f67.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.31 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: Nir Soffer , phrdina@redhat.com Subject: [libvirt] [PATCH python v2] Fix handling of optional params in blockCopy() 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.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Mon, 11 Mar 2019 21:35:08 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Commit 2b4bd07e0a22 (Add check for params, nparams being a dictionary) changed the way the optional params argument is treated. If libvirt.virDomain.blockCopy() is called without specifying params, params is None, and the call will fail with: TypeError: block params must be a dictionary This is wrong as params is defined as kwarg, breaking existing libvirt users like oVirt. Add a check for Py_None, so we accept either a dict or None and fail with TypeError with anything else. Resolves: https://bugzilla.redhat.com/1687114 Signed-off-by: Nir Soffer --- libvirt-override.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libvirt-override.c b/libvirt-override.c index 857c018..c5e2908 100644 --- a/libvirt-override.c +++ b/libvirt-override.c @@ -8835,11 +8835,11 @@ libvirt_virDomainBlockCopy(PyObject *self ATTRIBUTE= _UNUSED, if (virPyDictToTypedParams(pyobj_dict, ¶ms, &nparams, virPyDomainBlockCopyParams, VIR_N_ELEMENTS(virPyDomainBlockCopyPara= ms)) < 0) { return NULL; } - } else { + } else if (pyobj_dict !=3D Py_None) { PyErr_Format(PyExc_TypeError, "block params must be a dictionary"); return NULL; } =20 dom =3D (virDomainPtr) PyvirDomain_Get(pyobj_dom); --=20 2.17.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list