[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v20210701 06/40] tools: fix Python3.4 TypeError in format string


  • To: Olaf Hering <olaf@xxxxxxxxx>
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Mon, 5 Jul 2021 10:47:22 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=iUtEilgZoF8dQmmEdjYe8oevo8CDCXJko0OWxJ4UjF0=; b=kHqsCQGeJwLcvtqVzXb6V3HJflwU0VUKOegrMu9tSeEXUVX4tcIvkuYwlaN/qZKQvKSFlrMBI+cq4hUgs5G2OgYsKqIWtKeDlSIujuy0ui2EEB6nRXOnYc3ef9rIXw4XBdQhp1eGTK4p2n85Ad9V36NKllsBn8quZJyMjhdVElLHkP/VTcfXp4Lq33NJOM1bUkJeeuMlb7o8lng+Bs1o6OXFk7LfHM94uIy5dU7Czx54T9gHQrqHa0OcLjYNZpRwgiuvn2ve9XgVZkZQ8o4pFBLaVV5ZDBYhd27VeOwoBnVYk6y6k/K89ySZXv9qXAn0BplEQeE/ijpKewAfbmlwAQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZFAhf0F0Uu9DtQyuF8ZwpptS2bIRP0K2k2oWhl4G6ku5WzbLVycE29vrEdtMM6vcDRVZ3bS+qqNHNW9R3WKoKpW78y0ofBcu5JuQsqyTuaM3wQP5GofxJmxaBcRouoCrfMGCGVSZ/8AkNwO/KcqHQBQyds5ADmguFIKwKmZzqq61oppv/E9JzpThpLU9Z58fO/QdkJyl98hfvmUVaTPjAlFPfVmb7Pw6ycMo4OlpnJ1fintNC+LmnIe0OME7B+c92kag25Yihgsm2KHcD+cvbhCx819myJX4KZ+itBlBehYuswf/UIlSN4JSg8NGKlky+xc6DQkAGEEiHgQXQNNENg==
  • Authentication-results: esa3.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Ian Jackson <iwj@xxxxxxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Mon, 05 Jul 2021 09:47:41 +0000
  • Ironport-hdrordr: A9a23:N3KXM6Br1RucqonlHehHsceALOsnbusQ8zAXPh9KJiC9I/b1qy nxppkmPH/P6Qr4WBkb6LW90dq7MAzhHPlOkPUs1NaZLXTbUQ6TQr2KgrGSuwEIdxeOkdK1kJ 0QCZSWa+eAfmSS7/yKmTVQeuxIqLLskNHK9JLjJjVWPGVXgslbnndE422gYytLrWd9dPgE/d anl7F6T23KQwVnUi33PAhIY8Hz4/nw0L72ax8PABAqrCGIkDOT8bb/VzyVxA0XXT9jyaortT GtqX222oyT99WAjjPM3W7a6Jpb3PPn19t4HcSJzuwYMC/lhAqEbJloH5eCoDc2iuey70tCqq iCnz4Qe+BIr1/BdGC8phXgnyP61iw11nPkwViExVP+vM3QXlsBeol8rLMcViGcx1srvdl63q 4O9XmerYBrARTJmzm4z8TUVittilG/rRMZ4K4uZkRkIM4jgYJq3MgiFBs/KuZGIMu60vFnLA BWNrCf2B4MGmnqKUww1wJUsa6RtndaJGbMfqFNgL3N79FspgEP86Iv/r1Wop4xzuNId3B63Z WzDk1JrsAFciZEV9MxOA8+KfHHQ1AlFii8Tl56Z26XTJ06Bw==
  • Ironport-sdr: wdPBSu6NDlD1ib6zE6ZAWrajWYg5BTXeOo9a3xYPpCToVg+BkniB+8BSBHl17/Ii0nuZ3tDzvi kaAzUUOUN9jcTLsXvu+BLqVwIhjQq13ICwRZd2nQsE5fzGh4vE7+6AXeWeI5uW/RZEm1BY9OsG aCwk5WfrmP7xf5QDUis0IkNOQrQzjOZkxaAMvlKibDs5m0Gcst32eYGRm/hrTzncjmX2CfPK0q haEoTV9rqBm+6NXF5Ob6tRk8n6dY+PcV2jsoLnJNlDsLKr1ChPso+lQzwp6Zm0e03tlJugB5+7 UCg=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 05/07/2021 09:18, Olaf Hering wrote:
> Am Fri, 2 Jul 2021 17:39:54 +0100
> schrieb Andrew Cooper <andrew.cooper3@xxxxxxxxxx>:
>
>> However, the % (phys, ) with the trailing comma is deliberate to work
>> around a common python error, so wants to remain if you're keeping the
>> %-formatting.
> What error is that?

>>> def p1(arg):
...     print("%s" % arg)
>>> def p2(arg):
...     print("%s" % (arg, ))

>>> p1("foo")
foo
>>> p2("foo")
foo

>>> p1(("foo", "bar"))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<stdin>", line 2, in p1
TypeError: not all arguments converted during string formatting

>>> p2(("foo", "bar"))
('foo', 'bar')


The % operator has some type ambiguity with how it works.  (foo, )
forces arg to be a 1-tuple as far as formatting is concerned.

~Andrew




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.