From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Liu Hui Newsgroups: gmane.emacs.bugs Subject: bug#68559: [PATCH] Improve Python shell completion Date: Wed, 21 Feb 2024 18:00:00 +0800 Message-ID: References: <6BAFD8BF-8F18-4D9F-9DB3-A185AEF2EBCA@gmail.com> <867cj5wuo6.fsf@gnu.org> <865xypwu5e.fsf@gnu.org> <87il2kvbh5.fsf@epfl.ch> <878r3fz37e.fsf@epfl.ch> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="000000000000127fb90611e1641c" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27968"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , kobarity@gmail.com, mattias.engdegard@gmail.com, 68559@debbugs.gnu.org To: "Basil L. Contovounesios" Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Feb 21 16:50:22 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rcorJ-0006VW-1y for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 21 Feb 2024 16:50:09 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rcoZd-0002s4-KP; Wed, 21 Feb 2024 10:31:53 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rcoOy-0004UD-Ux for bug-gnu-emacs@gnu.org; Wed, 21 Feb 2024 10:20:53 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rcjQ3-0000En-VV for bug-gnu-emacs@gnu.org; Wed, 21 Feb 2024 05:01:39 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rcjQQ-000880-5T for bug-gnu-emacs@gnu.org; Wed, 21 Feb 2024 05:02:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Liu Hui Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 21 Feb 2024 10:02:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68559 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 68559-submit@debbugs.gnu.org id=B68559.170850969531206 (code B ref 68559); Wed, 21 Feb 2024 10:02:02 +0000 Original-Received: (at 68559) by debbugs.gnu.org; 21 Feb 2024 10:01:35 +0000 Original-Received: from localhost ([127.0.0.1]:47913 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rcjPy-00087F-Rx for submit@debbugs.gnu.org; Wed, 21 Feb 2024 05:01:35 -0500 Original-Received: from mail-vk1-f182.google.com ([209.85.221.182]:53444) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rcjPx-000872-1I for 68559@debbugs.gnu.org; Wed, 21 Feb 2024 05:01:34 -0500 Original-Received: by mail-vk1-f182.google.com with SMTP id 71dfb90a1353d-4d051349124so28637e0c.2 for <68559@debbugs.gnu.org>; Wed, 21 Feb 2024 02:01:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708509604; x=1709114404; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=BNAsy29jgxQKP3tAzUMjksM5zN9/OPyXIx7aRoz94WY=; b=H/0RGAu/a9ylagL/1PB+QkmcqtwnUbEJ7R8PKaBNELWyVOMOBq8IFv21yfGxA+dvkF AotyT9/sHM4NcdqxAz9WYn5VMdJ7hMNoAzhc/pXvBRZvVNG/rM/4yauXmbzSCYjjaviR fRML5gPq4vTOvaDZY3Qo+PDGtW7gJGcMroM5l5qLEM0HLS7vw5KqPoT0EhMmkWV0BvPY a+fARVbpv85l138VGi2cIHNuSIEJL6tBnJuIv7JPtQ/R/Kq2FvO3J2K6WC0slW7013Z2 rXVJjQ92OagVVx/4SM24ZjbLckz6mLpf3mX036svNrDXLN+DmXS3exYygL5abuE3Ujiv wFYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708509604; x=1709114404; h=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=BNAsy29jgxQKP3tAzUMjksM5zN9/OPyXIx7aRoz94WY=; b=NzDE/FP3B0aLoHUU1yoUyI2wkzpe51jDShD43gLsr83QUoOW5ZSRb+0TXP50Kg13kH /mat7f3qI/iq8a+WBLRtUwGUBfroXr+MzGAC6zcHSxV5ZfSOb+5CXPahFNzZWR9uVaaQ NkCaFSC6KXEQQio4KXgWpFexMiUWrxTZRocjZS9x36G5BJAJlh0aUqhT6pfC8SH9n6/h M3Uk5LfAzrvSsRo+8x7wEwCYmsd+UL1G8By8N3/SCbr1fWH2mRo3n+X/roRYLngxDWbs VA1GFVScKKBJpr3rS5/jDi2khWJTfUE6hOIV+KxdueGeyaNej6c4rC+S3iVntxZxbotq /Ylw== X-Forwarded-Encrypted: i=1; AJvYcCWxD3OSnOJ+VjT8KFXcLimZzH2/3iOVnGaJM2veTbq/5RGHuB1bql7Vk7pQ+a7w9TSre6eg6IA+DhWaadIsVCz6FZex2ik= X-Gm-Message-State: AOJu0Ywr6xC0seJR7y55+SGnNmjNu+MgxKt1cMAuj+v9k5rXDLgTtmY3 1ZWSX9AVXRCHg3U06lbIQ79650wiOq2r35yT9/u9D8RmSG1VLFhMVv/PftDLa+CMFF/sNjwqSWT QImOeG38XC51j7MhrZgSbzuYHiS8= X-Google-Smtp-Source: AGHT+IE1OnKUySsyz9bM0kkRc5JinNePcIUCVWBWnS1ayYFSImfs6gABS7Wg1yCr7V3T2xL/O+tpubFTPpRxEjsMKZk= X-Received: by 2002:a1f:dd01:0:b0:4cd:5091:f151 with SMTP id u1-20020a1fdd01000000b004cd5091f151mr7851913vkg.13.1708509604499; Wed, 21 Feb 2024 02:00:04 -0800 (PST) In-Reply-To: <878r3fz37e.fsf@epfl.ch> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:280397 Archived-At: --000000000000127fb90611e1641c Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Feb 20, 2024 at 9:15=E2=80=AFPM Basil L. Contovounesios wrote: > > Liu Hui [2024-02-20 12:46 +0800] wrote: > > > On Mon, Feb 19, 2024 at 9:18=E2=80=AFPM Basil L. Contovounesios > > wrote: > >> > >> BTW, I have been seeing an IPython test failure on GNU/Linux: > >> Any pointers? > > > > I cannot reproduce the problem with Python 3.12 and IPython 8.21. Can > > you check the results with the following steps? Thanks. > > Thanks. These all work as expected in 'emacs -Q', which made me realise > what may be the problem: > > - the Emacs test suite runs under HOME=3D/nonexistent > - but PATH is unchanged > - I have the latest IPython installed locally using pipx: > $ ls -l $(which ipython) > lrwxrwxrwx 1 blc blc 53 Feb 20 11:46 > /home/blc/.local/bin/ipython -> > /home/blc/.local/share/pipx/venvs/ipython/bin/ipython > > This is confirmed by the following experiment: > > > Running 'make TEST_LOAD_EL=3Dno test/python-tests' now results in the > following output file: > > > In this case list(get_ipython().Completer.completions(...)) is empty. Thank you for the investigation! I didn't realize the problem is related to HOME=3D/nonexistent in 'make test'. Now I can also reproduce it. In fact, I found that the test failure was caused by Jedi, as it attempts to write cache to a non-existent directory. When Jedi is directly used as the completion backend, more test failures will be triggered: PYTHONSTARTUP=3D"$(python -m jedi repl)" make TEST_LOAD_EL=3Dno test/python= -tests If the cache directory is writable, all tests will pass: PYTHONSTARTUP=3D"$(python -m jedi repl)" XDG_CACHE_HOME=3D~/.cache make TEST_LOAD_EL=3Dno test/python-tests The attached patch should fix the problem. --000000000000127fb90611e1641c Content-Type: text/x-patch; charset="US-ASCII"; name="0001-Fix-Python-shell-completion-test-failures.patch" Content-Disposition: attachment; filename="0001-Fix-Python-shell-completion-test-failures.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_lsvlab530 RnJvbSBhNjc3MzI1OGNmNmZlMWFjYzU1MjBmNTZlZjk0OGJhNjk3NWNiZTMyIE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBMaXUgSHVpIDxsaXVodWkxNjEwQGdtYWlsLmNvbT4KRGF0ZTog V2VkLCAyMSBGZWIgMjAyNCAxMjo0MDowNiArMDgwMApTdWJqZWN0OiBbUEFUQ0hdIEZpeCBQeXRo b24gc2hlbGwgY29tcGxldGlvbiB0ZXN0IGZhaWx1cmVzCgoqIHRlc3QvbGlzcC9wcm9nbW9kZXMv cHl0aG9uLXRlc3RzLmVsCihweXRob24tdGVzdHMtd2l0aC10ZW1wLWJ1ZmZlci13aXRoLXNoZWxs KTogU2V0IFhER19DQUNIRV9IT01FCnRvIGEgdGVtcG9yYXJ5IGRpcmVjdG9yeS4gKGJ1ZyM2ODU1 OSkKLS0tCiB0ZXN0L2xpc3AvcHJvZ21vZGVzL3B5dGhvbi10Z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YWNoZSwgYnV0IHRoZQorICAgICAgICAgICA7OyAiL25vbmV4aXN0ZW50 IiBIT01FIGRpcmVjdG9yeSBpcyBub3Qgd3JpdGFibGUuCisgICAgICAgICAgIChlcnQtd2l0aC10 ZW1wLWRpcmVjdG9yeSBjYWNoZS1kaXIKKyAgICAgICAgICAgICAod2l0aC1lbnZpcm9ubWVudC12 YXJpYWJsZXMgKCgiWERHX0NBQ0hFX0hPTUUiIGNhY2hlLWRpcikpCisgICAgICAgICAgICAgICAo cnVuLXB5dGhvbiBuaWwgdCkKKyAgICAgICAgICAgICAgIChpbnNlcnQgLGNvbnRlbnRzKQorICAg ICAgICAgICAgICAgKGdvdG8tY2hhciAocG9pbnQtbWluKSkKKyAgICAgICAgICAgICAgIChweXRo b24tdGVzdHMtc2hlbGwtd2FpdC1mb3ItcHJvbXB0KQorICAgICAgICAgICAgICAgLEBib2R5KSkK ICAgICAgICAgICh3aGVuIChweXRob24tc2hlbGwtZ2V0LWJ1ZmZlcikKICAgICAgICAgICAgKHB5 dGhvbi1zaGVsbC13aXRoLXNoZWxsLWJ1ZmZlcgogICAgICAgICAgICAgIChsZXQgKGtpbGwtYnVm ZmVyLWhvb2sga2lsbC1idWZmZXItcXVlcnktZnVuY3Rpb25zKQotLSAKMi4yNS4xCgo= --000000000000127fb90611e1641c--