GNU bug report logs - #71797
30.0.60; Face of variables and function parameters in Python

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Stephen Berman <stephen.berman@HIDDEN>; dated Thu, 27 Jun 2024 14:06:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 27 Jun 2024 14:05:21 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jun 27 10:05:21 2024
Received: from localhost ([127.0.0.1]:42999 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sMpkX-0002UA-1o
	for submit <at> debbugs.gnu.org; Thu, 27 Jun 2024 10:05:21 -0400
Received: from lists.gnu.org ([209.51.188.17]:48848)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <stephen.berman@HIDDEN>) id 1sMpkU-0002U2-Ur
 for submit <at> debbugs.gnu.org; Thu, 27 Jun 2024 10:05:19 -0400
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 <stephen.berman@HIDDEN>)
 id 1sMpkJ-0001eb-M4
 for bug-gnu-emacs@HIDDEN; Thu, 27 Jun 2024 10:05:10 -0400
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 <stephen.berman@HIDDEN>)
 id 1sMpkF-00039x-Mr
 for bug-gnu-emacs@HIDDEN; 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@HIDDEN;
 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
Received: from strobelfs ([94.134.95.193]) by mail.gmx.net (mrgmx005
 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MFsUv-1s6ZXR3RKJ-001P6s for
 <bug-gnu-emacs@HIDDEN>; Thu, 27 Jun 2024 16:04:58 +0200
From: Stephen Berman <stephen.berman@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 30.0.60; Face of variables and function parameters in Python
Date: Thu, 27 Jun 2024 16:04:58 +0200
Message-ID: <87v81uscqd.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Provags-ID: V03:K1:4te3zRkQ/5pQjzZXwQtXBubltFIpi44506KQT0Y++X2Fvoe0HQX
 OB7KHoNDEuVQqNrLCtNAKMWVLQOH59T3X2hzswklKJkwUndT8o8MZfp6de2qgDaIGC/6LYx
 OYbEkcZQ8Y7B+WC7Ej/sRW5rNpRVOKbUXFV5bOQ38zxDbMDFZjYIHbg/FZCCJETelAuZfDF
 LvnBMVkn3QydmwtvE5uiQ==
X-Spam-Flag: NO
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+Q5Pn1Vejn9T9p2fW9N6qvjiiRyBnC88O
 VO7V9LP7MFxTKAIEauR2k1YGkEUGyWBz8XVhGGwpeG6XI=
Received-SPF: pass client-ip=212.227.15.18;
 envelope-from=stephen.berman@HIDDEN; 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-Spam-Score: -1.1 (-)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

--=-=-=
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==
--=-=-=--




Acknowledgement sent to Stephen Berman <stephen.berman@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#71797; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Thu, 27 Jun 2024 14:15:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.