From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id ONJsBpNQLmLwugAAgWs5BA (envelope-from ) for ; Sun, 13 Mar 2022 21:14:11 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id iGzuA5NQLmJQOgEA9RJhRA (envelope-from ) for ; Sun, 13 Mar 2022 21:14:11 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 8F8D13A2DF for ; Sun, 13 Mar 2022 21:14:10 +0100 (CET) Received: from localhost ([::1]:42886 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nTUbR-0002Fb-2F for larch@yhetil.org; Sun, 13 Mar 2022 16:14:09 -0400 Received: from eggs.gnu.org ([209.51.188.92]:50162) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nTUbK-0002FQ-3O for guix-patches@gnu.org; Sun, 13 Mar 2022 16:14:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:49442) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nTUbJ-0001VX-RA for guix-patches@gnu.org; Sun, 13 Mar 2022 16:14:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nTUbJ-0002yj-Mp for guix-patches@gnu.org; Sun, 13 Mar 2022 16:14:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#54376] [PATCH] gnu: python-mypy: Fix test errors on i686-linux. Resent-From: itd Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 13 Mar 2022 20:14:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 54376 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 54376@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.164720243411426 (code B ref -1); Sun, 13 Mar 2022 20:14:01 +0000 Received: (at submit) by debbugs.gnu.org; 13 Mar 2022 20:13:54 +0000 Received: from localhost ([127.0.0.1]:43339 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nTUbB-0002yD-Nd for submit@debbugs.gnu.org; Sun, 13 Mar 2022 16:13:54 -0400 Received: from lists.gnu.org ([209.51.188.17]:33352) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nTUbA-0002y6-Tz for submit@debbugs.gnu.org; Sun, 13 Mar 2022 16:13:53 -0400 Received: from eggs.gnu.org ([209.51.188.92]:50130) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nTUbA-0002F9-QH for guix-patches@gnu.org; Sun, 13 Mar 2022 16:13:52 -0400 Received: from mailout3.rbg.tum.de ([131.159.0.8]:41915) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nTUb7-0001UP-6y for guix-patches@gnu.org; Sun, 13 Mar 2022 16:13:52 -0400 Received: from mailrelay1.rbg.tum.de (mailrelay1.in.tum.de [131.159.254.14]) by mailout3.rbg.tum.de (Postfix) with ESMTPS id 9F7F81017C8 for ; Sun, 13 Mar 2022 21:08:04 +0100 (CET) Received: by mailrelay1.rbg.tum.de (Postfix, from userid 112) id 9BD6F77; Sun, 13 Mar 2022 21:08:04 +0100 (CET) Received: from mailrelay1.rbg.tum.de (localhost [127.0.0.1]) by mailrelay1.rbg.tum.de (Postfix) with ESMTP id 25B3C76 for ; Sun, 13 Mar 2022 21:08:04 +0100 (CET) Received: from mail.net.in.tum.de (mail.net.in.tum.de [IPv6:2001:4ca0:2001:14:216:3eff:fe52:ed14]) by mailrelay1.rbg.tum.de (Postfix) with ESMTP id 2418875 for ; Sun, 13 Mar 2022 21:08:04 +0100 (CET) Received: from amnesix.net.in.tum.de (amnesix.net.in.tum.de [IPv6:2001:4ca0:2001:11:e2d5:5eff:fea9:55ca]) by mail.net.in.tum.de (Postfix) with ESMTP id 02714282104F; Sun, 13 Mar 2022 21:08:03 +0100 (CET) From: itd Date: Sun, 13 Mar 2022 21:08:03 +0100 Message-ID: <87r1757h0c.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=131.159.0.8; envelope-from=itd@net.in.tum.de; helo=mailout3.rbg.tum.de X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1647202450; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:resent-cc:resent-from:resent-sender: resent-message-id:list-id:list-help:list-unsubscribe:list-subscribe: list-post; bh=DT9VG0Q5k37R7IJWwlNA01KcdAE+OtP92OL/SsUDnb8=; b=Y0CaAoKnNNzb3EdcypK+QtvBJT65VXQ2kAQy7caz9uXu4vu+H32+YHTyQ9ZFQHpEDlPTbK ggyna5AcM2zqByS0dnQHCZLNCJ+Mgt4B/xbg5/4ssYm0qEM39zkZKxtrDzlBkVOesrtYgk SOEVd4oEJqg5Vs0O2MAQONJ4qtMB+Pb5Ypjf1q3zF8RNujbCiVoRlblu354MEzqydVRK4s F824neIFe6MeCT0JkbyZQtPECAXkTCgzpiqPkJN0CijTtiIAUPKocrwKA9SDc8LiqyzlTz GmSWfcG6TrZilMn0ZDYHIieWdUeg+3NXHEffLwsWpswUa5EN90z7ZxZNSP6hNQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1647202450; a=rsa-sha256; cv=none; b=cLc8rBs9qfzvusItGcph8tvt29iAZ/+RS0x3ahKo3rqGWwzOe/yApSkR16YZp8ZZSmy7Y7 x0nymRpt+AMjfM1o9pSmyiSR8JQ3WEoeAJ9IrXsKTCmfp+tbNH72Q13OgkaktbWSyBHp6M rFc9229FiNt2Bjo2b2dQE28uI+AIrthzNEQz5tv0uboiX+QmwHixhlJfE9wdTj6Z1NzKdg NmVLOHG+PpySnNvZBUOundvm3r/7654VEMjkuxX601s/lDWbExII3VpT++fJ9UOgbf4Ok6 HVV7W3giBtCiRzIO92gDPtQeSDumijY2SXVAPIJyOPdh8OIACwkxrSqSg5irwQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=tum.de (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -0.47 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=tum.de (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 8F8D13A2DF X-Spam-Score: -0.47 X-Migadu-Scanner: scn0.migadu.com X-TUID: LoyZpHxLGlN9 >From a8de61a3f6ca50bf4a68222532029e8e9e84c510 Mon Sep 17 00:00:00 2001 * gnu/packages/patches/python-mypy-12332.patch: New patch. * gnu/local.mk (dist_patch_DATA): Add it. * gnu/packages/python-check.scm (python-mypy)[source]: Use patch "python-mypy-12332.patch" to avoid overflow issues resulting in test failures. --- Hi, currently, python-mypy on i686-linux does not build [0] due to test errors [1]. To my knowledge, the merged fix [2] is not part of a release yet. But, it [2] fixes the python-mypy build for me. Please consider applying it. Thanks! [0]: https://ci.guix.gnu.org/build/484670/details [1]: https://github.com/python/mypy/issues/11148 [2]: https://github.com/python/mypy/pull/12332 Regards itd gnu/local.mk | 1 + gnu/packages/patches/python-mypy-12332.patch | 68 ++++++++++++++++++++ gnu/packages/python-check.scm | 4 +- 3 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 gnu/packages/patches/python-mypy-12332.patch diff --git a/gnu/local.mk b/gnu/local.mk index 484757b207..05d01c858f 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1716,6 +1716,7 @@ dist_patch_DATA = \ %D%/packages/patches/python-versioneer-guix-support.patch \ %D%/packages/patches/python-waitress-fix-tests.patch \ %D%/packages/patches/python-werkzeug-tests.patch \ + %D%/packages/patches/python-mypy-12332.patch \ %D%/packages/patches/qemu-build-info-manual.patch \ %D%/packages/patches/qemu-glibc-2.27.patch \ %D%/packages/patches/qemu-glibc-2.30.patch \ diff --git a/gnu/packages/patches/python-mypy-12332.patch b/gnu/packages/patches/python-mypy-12332.patch new file mode 100644 index 0000000000..d43cf42ed1 --- /dev/null +++ b/gnu/packages/patches/python-mypy-12332.patch @@ -0,0 +1,68 @@ +From 518c864805dd93e62d59439e665a0ce9d6778419 Mon Sep 17 00:00:00 2001 +From: Ekin Dursun +Date: Thu, 10 Mar 2022 22:06:48 +0300 +Subject: [PATCH] mypyc: Fix overflow in id function (CPyTagged_Id) + +In CPython, the id of an object is its address. It's computed by +converting the pointer to an unsigned integer (PyLong_FromVoidPtr). A +similar logic is present here, pointer is converted to a Py_ssize_t and +CPyTagged_FromSsize_t is called with that integer. + +There is a problem with that approach: Py_ssize_t cannot hold every +pointer value. Sometimes overflow happens and CPyTagged_FromSsize_t is +called with a negative integer. + +With the new approach, the number is checked: If it fits in a +Py_ssize_t, CPyTagged_FromSsize_t is called. If not, it is directly +converted to a PyObject using PyLong_FromVoidPtr. +--- + mypyc/lib-rt/CPy.h | 1 + + mypyc/lib-rt/int_ops.c | 9 +++++++++ + mypyc/lib-rt/misc_ops.c | 2 +- + 3 files changed, 11 insertions(+), 1 deletion(-) + +diff --git a/mypyc/lib-rt/CPy.h b/mypyc/lib-rt/CPy.h +index 987819154ab..9f5ae52d4e4 100644 +--- a/mypyc/lib-rt/CPy.h ++++ b/mypyc/lib-rt/CPy.h +@@ -121,6 +121,7 @@ static inline size_t CPy_FindAttrOffset(PyTypeObject *trait, CPyVTableItem *vtab + + + CPyTagged CPyTagged_FromSsize_t(Py_ssize_t value); ++CPyTagged CPyTagged_FromVoidPtr(void *ptr); + CPyTagged CPyTagged_FromObject(PyObject *object); + CPyTagged CPyTagged_StealFromObject(PyObject *object); + CPyTagged CPyTagged_BorrowFromObject(PyObject *object); +diff --git a/mypyc/lib-rt/int_ops.c b/mypyc/lib-rt/int_ops.c +index 1275f2c1057..edf06314161 100644 +--- a/mypyc/lib-rt/int_ops.c ++++ b/mypyc/lib-rt/int_ops.c +@@ -26,6 +26,15 @@ CPyTagged CPyTagged_FromSsize_t(Py_ssize_t value) { + } + } + ++CPyTagged CPyTagged_FromVoidPtr(void *ptr) { ++ if ((uintptr_t)ptr > PY_SSIZE_T_MAX) { ++ PyObject *object = PyLong_FromVoidPtr(ptr); ++ return ((CPyTagged)object) | CPY_INT_TAG; ++ } else { ++ return CPyTagged_FromSsize_t((Py_ssize_t)ptr); ++ } ++} ++ + CPyTagged CPyTagged_FromObject(PyObject *object) { + int overflow; + // The overflow check knows about CPyTagged's width +diff --git a/mypyc/lib-rt/misc_ops.c b/mypyc/lib-rt/misc_ops.c +index cebd1cf997f..dcce89d9072 100644 +--- a/mypyc/lib-rt/misc_ops.c ++++ b/mypyc/lib-rt/misc_ops.c +@@ -437,7 +437,7 @@ CPyPickle_GetState(PyObject *obj) + } + + CPyTagged CPyTagged_Id(PyObject *o) { +- return CPyTagged_FromSsize_t((Py_ssize_t)o); ++ return CPyTagged_FromVoidPtr(o); + } + + #define MAX_INT_CHARS 22 diff --git a/gnu/packages/python-check.scm b/gnu/packages/python-check.scm index 05a378601f..5bbe544113 100644 --- a/gnu/packages/python-check.scm +++ b/gnu/packages/python-check.scm @@ -1658,7 +1658,9 @@ supported by the MyPy typechecker.") (file-name (git-file-name name version)) (sha256 (base32 - "1v83flrdxh8grcp40qw04q4hzjflih9xwib64078vsxv2w36f817")))) + "1v83flrdxh8grcp40qw04q4hzjflih9xwib64078vsxv2w36f817")) + (patches + (search-patches "python-mypy-12332.patch")))) (build-system python-build-system) (arguments `(#:phases -- 2.30.2