Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp4767027rwr; Sun, 30 Apr 2023 15:00:26 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5KgzJHwqsqaSOpp65w2iTNvEF+52+pmiDasNvsIjBfcUwZpS6M4J3MMAuGFOnHqqrCNySX X-Received: by 2002:a17:90a:4fc3:b0:23c:ffbf:859e with SMTP id q61-20020a17090a4fc300b0023cffbf859emr12436910pjh.35.1682892026290; Sun, 30 Apr 2023 15:00:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682892026; cv=none; d=google.com; s=arc-20160816; b=djAANk/8licHLu8TY37wXf8Gjj3opcNanPU5nhIYpzPVGaXiQcY6+HxDirFn79ILEg aflJOuu/qsXIK22WHRYVHekI62kOIZVRzkeCFV6M3px6dtjviY8bomJhaEl7Frg+B6ot TxEHfSeJfrHr0o026XYNxDrE3CD6uv1mTAYJlJSovkGOxXgKrvQ7dZ++5F7l7/9CBy1e yZ3YoFYUcPiCBkKWlHlChUuVS/PWowZuqlIqr3Ke/EIjattsLGQ/Bz5wUewAkGhTFftc YL3KhLe7yfFJqFWzyNlI5iQBoT+CStx8s5kvkJU+skM9yCsGiNo4OIW1mlvIGPmPG8KI 1K+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=bXvWfcPwYE0l610o5narxo1kaxveEE8bMSO3FZe1UVo=; b=rgFQpTF/OIgVUHyMJc40YOOCU2EMLGKjSWJZkMCFS9IVM6celvefnzeee4ZVBtIwa5 OeaPa8rdQ1o/LheIuS7jKwh5IHAjB9CBBVnXKTgjU8GDIFLKQGuZtUMWmrM9ynV5bOdc BbtuQMNDq+OvpJnXDqaWjtUQoqBVXMfVmRNzo/yM/BiC1dbTVPIXVzcMBfPIgumbKq5x zRwIhN5M+bec9rxrJK35HY7ONqHNRtNCIsD1F/Bmbm/zWw8Tt8qgTkaURiCVRxO+jxz5 9jf/exwKCK+g6b4hyJEqcrZATFILjx37y6Rwh+LdYBRPnnpWSr13Zx1rIVyei65INBtH OQfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=hDMD+683; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 15-20020a63000f000000b0052c2904e37dsi324481pga.362.2023.04.30.15.00.13; Sun, 30 Apr 2023 15:00:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=hDMD+683; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229659AbjD3Ve0 (ORCPT + 99 others); Sun, 30 Apr 2023 17:34:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229531AbjD3VeZ (ORCPT ); Sun, 30 Apr 2023 17:34:25 -0400 Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8FF18E48 for ; Sun, 30 Apr 2023 14:34:21 -0700 (PDT) Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-1aaf702c3ccso18095ad.1 for ; Sun, 30 Apr 2023 14:34:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1682890461; x=1685482461; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=bXvWfcPwYE0l610o5narxo1kaxveEE8bMSO3FZe1UVo=; b=hDMD+683FV9awGOim+l3BgEF4meaq+TP43gjtapNGzLkLF5zY5YsesXkf7cRd4dD5S Iw8UMAZsf/7oUUoofWgWKdhivDRLbC6NpwgpNuwogs3zIkEUu42YsumVcan5J8iYnEYc UhiZQiveG08+Wf68OfDFL1xZNwfDfoCGV+exPdRJpb0z2xHPWSO2MT7ujT7eatyl2+mH OdvZkK5bPRy6xutc7aET2dU267ixeRr5CPC0c4vZdKDHPk0qSH9Npvtk82KM5gMJQcc7 e14DZSPQzOFuJKQVEYPcIWhHvozrIRyCilZW/srEDBcXv9bdHk80X5juPl9UZMl3NBV4 K7Sw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682890461; x=1685482461; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bXvWfcPwYE0l610o5narxo1kaxveEE8bMSO3FZe1UVo=; b=Y8Zixdgu8sJ+WzkVlSTq2G1D+EcRhiZbcrRk6lzYJLLDL0NDmnbZ1twA51YFutZrv2 NqEKTprwz6a8ddBpy7vVCxLf1rET47gu+C6RpUh89w4oq0++CqbI//xAFsdfJ+2MTqn8 5CKpct/fVLo0b1pIfpwyhnaBCrK9nGJwzDiH7oPROG122x3szyf6sHBJ26JpoSP4rIA7 fZPDZsNcH7gv/sicNFGwcaDos4I6UR7C2cZGypWxi73EnIzfmCnPYB5QEmdymuZ1r7MH qEVSfpBEaQg4NqxGP5DKqlugLOwzD9IZtJLB0KRRNt3sEulj0f/B2M2IQy6rEJaXmjKc 8Saw== X-Gm-Message-State: AC+VfDz0ExGhqK84ipyUnyROrZP8/V+ku7+5raE2z72BQK76EpAr3iUR M3e/dw3OsFzDCl8XFHb++wzVTwODtHt5SVT36BpX/U85cjfaI84X5t8glw== X-Received: by 2002:a17:902:b20a:b0:1a6:42f0:e575 with SMTP id t10-20020a170902b20a00b001a642f0e575mr299829plr.5.1682890460920; Sun, 30 Apr 2023 14:34:20 -0700 (PDT) MIME-Version: 1.0 References: <20230316220638.983743-1-dlatypov@google.com> <20230430181500.122664-1-sj@kernel.org> In-Reply-To: <20230430181500.122664-1-sj@kernel.org> From: Daniel Latypov Date: Sun, 30 Apr 2023 14:34:09 -0700 Message-ID: Subject: Re: [PATCH v2 1/3] kunit: tool: add subscripts for type annotations where appropriate To: SeongJae Park Cc: brendanhiggins@google.com, davidgow@google.com, rmoar@google.com, linux-kernel@vger.kernel.org, kunit-dev@googlegroups.com, linux-kselftest@vger.kernel.org, skhan@linuxfoundation.org, johannes@sipsolutions.net, Johannes Berg , regressions@lists.linux.dev Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Apr 30, 2023 at 11:15=E2=80=AFAM SeongJae Park wrot= e: > > Hi Daniel, > > On Thu, 16 Mar 2023 15:06:36 -0700 Daniel Latypov w= rote: > > > E.g. for subprocess.Popen, it can be opened in `text=3DTrue` mode where= it > > returns strings, or `text=3DFalse` where it returns bytes. > > To differentiate, you can annotate types as `Popen[str]` or > > `Popen[bytes]`. > > > > This patch should add subscripts in all the places we were missing them= . > > I just found this patch is in the latest mainline tree, and it causes kun= it > failure on my test machine like below. > > $ python3 --version > Python 3.8.10 > $ > $ ./tools/testing/kunit/kunit.py run --build_dir ../kunit.out/ > Traceback (most recent call last): > File "./tools/testing/kunit/kunit.py", line 24, in > import kunit_kernel > File "/home/sjpark/linux/tools/testing/kunit/kunit_kernel.py", line= 42, in > class LinuxSourceTreeOperations: > File "/home/sjpark/linux/tools/testing/kunit/kunit_kernel.py", line= 95, in LinuxSourceTreeOperations > def start(self, params: List[str], build_dir: str) -> subprocess.= Popen[str]: > TypeError: 'type' object is not subscriptable > $ > > I further confirmed reverting this patch makes it run again. Do you have= any > idea? It seems like support for the subscript wasn't added until Python 3.9. I know support for subscripting other types like re.Pattern was added in 3.9 per https://peps.python.org/pep-0585/ but it doesn't mention Popen there... This patch also added typing.IO[str] and concurrent.Future[None], so those might be problematic too. Can you check if the typing.IO and concurrent.Future[None] changes cause problems? (I don't have an easy way of testing against older Python versions currentl= y). If so, we should revert the patch. If not, we can undo just the Popen changes. And in either case, we'll need to update ./tools/testing/kunit/run_checks.p= y. Currently, it runs `mypy --strict` which will start failing if we revert any part of this patch. Thanks, Daniel