From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stephen Berman via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#71797: 30.0.60; Face of variables and function parameters in Python Date: Thu, 27 Jun 2024 16:04:58 +0200 Message-ID: <87v81uscqd.fsf@gmx.net> Reply-To: Stephen Berman Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="21265"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) To: 71797@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jun 27 16:06:19 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 1sMplS-0005Hg-MD for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 27 Jun 2024 16:06:18 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMplC-0001r4-54; Thu, 27 Jun 2024 10:06:02 -0400 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 1sMplA-0001qX-G2 for bug-gnu-emacs@gnu.org; Thu, 27 Jun 2024 10:06:00 -0400 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 1sMplA-0003ao-7w for bug-gnu-emacs@gnu.org; Thu, 27 Jun 2024 10:06:00 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sMplC-0002V8-6l for bug-gnu-emacs@gnu.org; Thu, 27 Jun 2024 10:06:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stephen Berman Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 27 Jun 2024 14:06:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 71797 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.17194971219563 (code B ref -1); Thu, 27 Jun 2024 14:06:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 27 Jun 2024 14:05:21 +0000 Original-Received: from localhost ([127.0.0.1]:42999 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sMpkX-0002UA-1o for submit@debbugs.gnu.org; Thu, 27 Jun 2024 10:05:21 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:48848) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sMpkU-0002U2-Ur for submit@debbugs.gnu.org; Thu, 27 Jun 2024 10:05:19 -0400 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 1sMpkJ-0001eb-M4 for bug-gnu-emacs@gnu.org; Thu, 27 Jun 2024 10:05:10 -0400 Original-Received: from mout.gmx.net ([212.227.15.18]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sMpkF-00039x-Mr for bug-gnu-emacs@gnu.org; Thu, 27 Jun 2024 10:05:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.net; s=s31663417; t=1719497099; x=1720101899; i=stephen.berman@gmx.net; bh=b6kmFl7X28ehcYgpiJRdwbBElGXwk0/nDYf8b7lVi1A=; h=X-UI-Sender-Class:From:To:Subject:Date:Message-ID:MIME-Version: Content-Type:cc:content-transfer-encoding:content-type:date:from: message-id:mime-version:reply-to:subject:to; b=EJGR11Q+/7aBCdLsJGcfhBsowSbUfrezNBfT9Dg8ndHrc7FBgD7dCiDzh6Du/8ls 7l9jvg7u0wCMATNgBxICmcCIyz7OoumubSJBm0WJm2Csaiwhk9OayAjYCtD2YmbOC l2DJ6r6veMrCw3coovlUEvoUMUyKYyKGE/vprpi1z+kf508usCDGEDveQBXkP7AIK C8tw7HCveerQUmRYoPMZxDqvbe9x9B13ZIwuTSroBF+xIRHdCGkrPdE0BPCc1FBrQ Av3N7ru1qY2Vl6h+HASXfDmj8h96F+E/5xC5BN8hsFaHiAwa0jN0Ba9yf8bhMj3sD KhzfhNau4RHP/WsNaA== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Original-Received: from strobelfs ([94.134.95.193]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MFsUv-1s6ZXR3RKJ-001P6s for ; Thu, 27 Jun 2024 16:04:58 +0200 X-Provags-ID: V03:K1:4te3zRkQ/5pQjzZXwQtXBubltFIpi44506KQT0Y++X2Fvoe0HQX OB7KHoNDEuVQqNrLCtNAKMWVLQOH59T3X2hzswklKJkwUndT8o8MZfp6de2qgDaIGC/6LYx OYbEkcZQ8Y7B+WC7Ej/sRW5rNpRVOKbUXFV5bOQ38zxDbMDFZjYIHbg/FZCCJETelAuZfDF LvnBMVkn3QydmwtvE5uiQ== UI-OutboundReport: notjunk:1;M01:P0:is9USGE0nRM=;YECHmoCrmv/PVEp1Ca3nSuvJNj0 1cfY5rA42JQnoY7nInWjAD+t9RL19qPc5Vot9uORIr0GgE4dIrr+3UrVORU9lexZgTNi+xJbH kp+lK2j0ffb1a8kCYv51LDeqQLoRaAW4bMANGMQG06wujxene8SBaS9NdZN1+q4WvRRQZ9bG8 M77/aI/9UVZ8ah8rnf8QPv68Qd7MYD1ea8Oec2xBTIqhyGkwCp9ZaGDCjx3HjlDBggWj0IFEf s8e2f7XmBrhpLHtSeklttah4BQohz4bthTsMnCvTj2EQNjQj8U3uzU+Uc/jghTGVMC3+u/m/m TLMDLFiU7TmzYgNN/nyNGNw7pg+UBPzitJnWpVX1dObNALZcv2oYDCugzOs3kMIsI3oPp7XRk ZjqzNpQmfacw+eQHZTOlLsgcDi1bXCxMneYdeKOHIihx9XPc6b41uhcVLJ4ohQIiP0/A5xrXZ 3xZlvQiEoJl8t/vBVcAVZqqucQ3X+9038PHIJyCxAGl3aXyEPDx/NcqEhy1UmR14LPqyOZXj8 vUqe2bD65ho7h8gJH++i1B8J3vJrhezklko200YtEl/8VSN9uVxp8oQEXtrauUEcgY2qrSywd XNGT7WmFdMuIdx0rawbzspJxkc4j9T7ACghu8ukF3/MZkejkTqSJK7Jobl1084Ky+ptny2DmP 9EEM4h2Y83cruLGeUliWTQ0xYm684wja7SmlaK4ce4AxoLhx1a5bKipxJXCOWBeslBM5VBWBe OIjO2e1sW3+uJQ/3/6c7qmGi11a0kkMVvb0l38R3+Q5Pn1Vejn9T9p2fW9N6qvjiiRyBnC88 Received-SPF: pass client-ip=212.227.15.18; envelope-from=stephen.berman@gmx.net; helo=mout.gmx.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: 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:288021 Archived-At: --=-=-= Content-Type: text/plain 0. emacs -Q, where Emacs has been built with treesitter support and the treesitter Python grammar library is installed. 1. Visit the attached file "test.py", which contains examples in Python of variables and function parameters with type hints. The buffer is now in the default (non-treesitter) python-mode. 2. Notice that the initialized annotated variable `age' and the (unannotated) assigned to occurrences of `child' are fontified with font-lock-variable-name-face, while the uninitialized annotated variables `a' and `child' and the annotated function parameters `num', `num1' and `num2' are displayed in the default face. 3. M-x python-ts-mode. Now the uninitialized `age', `a' and `child' as well as the function parameters `num', `num1' and `num2' are all fontified with font-lock-variable-name-face. I don't know if this difference demonstrates a bug in python-mode or in python-ts-mode, but I assume only one of them is right. I note that in much online Python documentation variables in assignments or function parameters (with or without type hints) are mostly not fontified (e.g. in Python's own documentation and in https://mypy.readthedocs.io/en/stable/cheat_sheet_py3.html, which is where the examples in the attached file come from). On the other hand, I note that python-ts-mode also fontifies function parameters that lack type hints or default values with font-lock-variable-name-face (the default python-mode does not). In GNU Emacs 30.0.60 (build 3, x86_64-pc-linux-gnu, GTK+ Version 3.24.42, cairo version 1.18.0) of 2024-06-26 built on strobelfs Repository revision: 1809f6a93efe0ab3ac0f62743c92bd90860ff3ea Repository branch: emacs-30 Windowing system distributor 'The X.Org Foundation', version 11.0.12101013 System Description: Linux From Scratch r12.1-85 Configured using: 'configure -C 'CFLAGS=-Og -g3'' Configured features: ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG LCMS2 LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER WEBP X11 XDBE XIM XINPUT2 XPM GTK3 ZLIB Important settings: value of $LANG: en_US.UTF-8 locale-coding-system: utf-8-unix --=-=-= Content-Type: application/octet-stream Content-Disposition: attachment; filename=test.py Content-Transfer-Encoding: base64 IyBUaGlzIGlzIGhvdyB5b3UgZGVjbGFyZSB0aGUgdHlwZSBvZiBhIHZhcmlhYmxlCmFnZTogaW50 ID0gMQoKIyBZb3UgZG9uJ3QgbmVlZCB0byBpbml0aWFsaXplIGEgdmFyaWFibGUgdG8gYW5ub3Rh dGUgaXQKYTogaW50ICAjIE9rIChubyB2YWx1ZSBhdCBydW50aW1lIHVudGlsIGFzc2lnbmVkKQoK IyBEb2luZyBzbyBjYW4gYmUgdXNlZnVsIGluIGNvbmRpdGlvbmFsIGJyYW5jaGVzCmNoaWxkOiBi b29sCmlmIGFnZSA8IDE4OgogICAgY2hpbGQgPSBUcnVlCmVsc2U6CiAgICBjaGlsZCA9IEZhbHNl CgojIFRoaXMgaXMgaG93IHlvdSBhbm5vdGF0ZSBhIGZ1bmN0aW9uIGRlZmluaXRpb24KZGVmIHN0 cmluZ2lmeShudW06IGludCkgLT4gc3RyOgogICAgcmV0dXJuIHN0cihudW0pCgojIEFuZCBoZXJl J3MgaG93IHlvdSBzcGVjaWZ5IG11bHRpcGxlIGFyZ3VtZW50cwpkZWYgcGx1cyhudW0xOiBpbnQs IG51bTI6IGludCkgLT4gaW50OgogICAgcmV0dXJuIG51bTEgKyBudW0yCg== --=-=-=--