From unknown Tue Aug 19 09:32:20 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#54992 <54992@debbugs.gnu.org> To: bug#54992 <54992@debbugs.gnu.org> Subject: Status: 29.0.50; python.el: custom type hint in assignment statements is font-locked as a variable Reply-To: bug#54992 <54992@debbugs.gnu.org> Date: Tue, 19 Aug 2025 16:32:20 +0000 retitle 54992 29.0.50; python.el: custom type hint in assignment statements= is font-locked as a variable reassign 54992 emacs submitter 54992 kobarity severity 54992 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Sun Apr 17 11:57:10 2022 Received: (at submit) by debbugs.gnu.org; 17 Apr 2022 15:57:10 +0000 Received: from localhost ([127.0.0.1]:36995 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ng7Gw-0008Nf-Fy for submit@debbugs.gnu.org; Sun, 17 Apr 2022 11:57:10 -0400 Received: from lists.gnu.org ([209.51.188.17]:40104) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ng5p9-0001cx-Q7 for submit@debbugs.gnu.org; Sun, 17 Apr 2022 10:24:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38498) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ng5p9-000719-Gl for bug-gnu-emacs@gnu.org; Sun, 17 Apr 2022 10:24:23 -0400 Received: from mail-lj1-x236.google.com ([2a00:1450:4864:20::236]:47011) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ng5p7-0008A8-Qv for bug-gnu-emacs@gnu.org; Sun, 17 Apr 2022 10:24:23 -0400 Received: by mail-lj1-x236.google.com with SMTP id bj36so8451026ljb.13 for ; Sun, 17 Apr 2022 07:24:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:from:date:message-id:subject:to; bh=0WW9+RRg2VTKPrfSJ5JjeGZaa4mzV1jmeWHOvGHnb0I=; b=Qps7bovYSpAw1nMpJmIASRlYTPxzp6eua9vxPoYJw8YEPLVjTIpeMCQ2/lFeV7qhdQ 9VJ8xry6N+QWAvX6ezUnLcD9o/a1u9hTnIT9kzfQS9IeqteJC+FZn0lucZQIvYsSoMMJ 3lo6KIKn8h5Jpo+pj3BiNZqrKdkPocpQCKL8lVPk93UyOohwlS7gQehZN4HaQwnanTGe DKXP3IAaHDLzyNMM473tqqDD80FDKCEW5zLTnA5p+xJnFT6/d78niOGF7r0XZ4fp2kS0 8bzJJHfPGYMEaRBvk2MNnQsfAarhAnVLnLskFx0KQayWJOjymlPX4tWxQMJa8TLhE91V uUQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=0WW9+RRg2VTKPrfSJ5JjeGZaa4mzV1jmeWHOvGHnb0I=; b=Q0qVCIDxn4kPhzhi6xZEPnYSgYyxWl9Jn95+/GcFPg2anHe0a8BRuH0OlE5alSaUv1 n2pt5wfT8VR87BQlm1FmQFq1INdU1rEIwuovtxuJFcOXZEmg04pVH3uM+saB98R1Upw7 k/RndM3WL/HYs7BD9jToFgIGuK/rRLnaKBArEZAb1uFLFvt1BFcdfrxVaC1QW4Si1lNp WVsRL51h2UPloD0DgUNJ7O3H1aLRZ93GAvLkWqTdvvuP9l4u5qPJ7VI5aOXm0HxPjmUE Mzcw/ZXjdwOza1NtUfO6xnqoomQ/me05lCA91UDz924cKVNbxoaMY5voPdTZFPLju2cA chpg== X-Gm-Message-State: AOAM530KlT6Po76Z8eaERhYyW3T0cJ/OCUgaFl6JX2VOJruw5A146Tyb LjEdsYJGAxqt89clQrQz2E6YxDL9kCOMfoC2A80CUuh3+RY= X-Google-Smtp-Source: ABdhPJxqlg4p9neeyDHjKNGgNmyLI/iBfGLFYfa4AsZiio1HiXNSt0t7aqHeRh70CIjTdEdoIStHST5RC3Ax6pJSkaA= X-Received: by 2002:a17:907:1ca0:b0:6e9:9eef:a8d2 with SMTP id nb32-20020a1709071ca000b006e99eefa8d2mr5632575ejc.719.1650203904987; Sun, 17 Apr 2022 06:58:24 -0700 (PDT) MIME-Version: 1.0 From: kobarity Date: Sun, 17 Apr 2022 22:58:12 +0900 Message-ID: Subject: 29.0.50; python.el: custom type hint in assignment statements is font-locked as a variable To: bug-gnu-emacs@gnu.org Content-Type: text/plain; charset="UTF-8" Received-SPF: pass client-ip=2a00:1450:4864:20::236; envelope-from=kobarity@gmail.com; helo=mail-lj1-x236.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, 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-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Sun, 17 Apr 2022 11:57:09 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) X-Debbugs-CC: Dario Gjorgjevski Hi, This is a separation of bugs mentioned in #51362 Message #24. When the following file is loaded using emacs -Q and M-x find-file, CustomInt in the last line is font-locked as a variable name. #+begin_src python from typing import List CustomInt = int YS: List[CustomInt] = [] #+end_src Type hints should not be highlighted as variable names. This is caused by the font-lock rule for special cases of assignment statements such as '[a] = 5,'. I suggest applying the following patch to restrict the rule not to match type hints. diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index c4d8b123a8..f355055806 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -706,7 +706,8 @@ python-font-lock-keywords-maximum-decoration ;; [a] = 5 ;; [*a] = 5, 6 (,(python-font-lock-assignment-matcher - (python-rx (or "[" "(") (* space) + (python-rx (or line-start ?\;) (* space) + (or "[" "(") (* space) grouped-assignment-target (* space) (or ")" "]") (* space) assignment-operator)) In GNU Emacs 29.0.50 (build 3, x86_64-pc-linux-gnu) of 2022-04-16 built on ubuntu Repository revision: db416ae04982d7cf5c6af463d0c47c902f8d9119 Repository branch: master System Description: Ubuntu 21.10 Configured using: 'configure --without-x --with-gnutls=ifavailable' Configured features: ACL LIBXML2 MODULES NOTIFY INOTIFY PDUMPER SECCOMP SOUND SQLITE3 THREADS XIM ZLIB Important settings: value of $LANG: en_US.UTF-8 locale-coding-system: utf-8-unix Major mode: Lisp Interaction Minor modes in effect: tooltip-mode: t global-eldoc-mode: t eldoc-mode: t show-paren-mode: t electric-indent-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t line-number-mode: t indent-tabs-mode: t transient-mark-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t Load-path shadows: None found. Features: (shadow regexp-opt sort mail-extr emacsbug message mailcap yank-media rmc puny dired dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg rfc6068 epg-config gnus-util text-property-search time-date mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader cl-loaddefs cl-lib sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils term/screen term/xterm xterm seq gv subr-x byte-opt bytecomp byte-compile cconv iso-transl tooltip eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode tabulated-list replace newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select mouse jit-lock font-lock syntax font-core term/tty-colors frame minibuffer nadvice simple cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite emoji-zwj charscript charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs faces cus-face macroexp files window text-properties overlay sha1 md5 base64 format env code-pages mule custom widget keymap hashtable-print-readable backquote threads inotify multi-tty make-network-process emacs) Memory information: ((conses 16 45429 6400) (symbols 48 5661 1) (strings 32 15693 1667) (string-bytes 1 499770) (vectors 16 8641) (vector-slots 8 104321 5828) (floats 8 23 236) (intervals 56 202 0) (buffers 992 11)) From debbugs-submit-bounces@debbugs.gnu.org Sun Apr 17 13:28:47 2022 Received: (at 54992) by debbugs.gnu.org; 17 Apr 2022 17:28:47 +0000 Received: from localhost ([127.0.0.1]:37061 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ng8hb-0004VO-09 for submit@debbugs.gnu.org; Sun, 17 Apr 2022 13:28:47 -0400 Received: from quimby.gnus.org ([95.216.78.240]:44804) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ng8hY-0004VA-W2 for 54992@debbugs.gnu.org; Sun, 17 Apr 2022 13:28:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=mIq3p1zzxD/Y082Bj8G312Qpgg31AQrlQpJ2N74msyA=; b=Vtp68FepkXzOpLuJenLGQFb+XL EZzZp27/kWt1pGpL5Rx7GcuOisLXrE3i6IHj/MkO+VfXGkxkAt2N/XKheYxhxky4Y5rpRwOVXzD8o VGNeayRsSY2/PPSRLspiXxTtj/Yt/cNVnbIA2WYlViVKipiSxIs2Ar8x3zky7lIYX96c=; Received: from [84.212.220.105] (helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ng8hN-0008Al-Ri; Sun, 17 Apr 2022 19:28:38 +0200 From: Lars Ingebrigtsen To: kobarity Subject: Re: bug#54992: 29.0.50; python.el: custom type hint in assignment statements is font-locked as a variable References: Date: Sun, 17 Apr 2022 19:28:32 +0200 In-Reply-To: (kobarity@gmail.com's message of "Sun, 17 Apr 2022 22:58:12 +0900") Message-ID: <8735ibaabj.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: kobarity writes: > This is caused by the font-lock rule for special cases of assignment > statements such as '[a] = 5,'. I suggest applying the following patch > to restrict the rule not to match type hints. Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 54992 Cc: dario gjorgjevski , 54992@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) kobarity writes: > This is caused by the font-lock rule for special cases of assignment > statements such as '[a] = 5,'. I suggest applying the following patch > to restrict the rule not to match type hints. Makes sense to me; pushed to Emacs 29. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Sun Apr 17 13:28:52 2022 Received: (at control) by debbugs.gnu.org; 17 Apr 2022 17:28:52 +0000 Received: from localhost ([127.0.0.1]:37064 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ng8hg-0004Vh-6m for submit@debbugs.gnu.org; Sun, 17 Apr 2022 13:28:52 -0400 Received: from quimby.gnus.org ([95.216.78.240]:44818) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ng8he-0004VH-Pw for control@debbugs.gnu.org; Sun, 17 Apr 2022 13:28:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Subject:From:To:Message-Id:Date:Sender:Reply-To:Cc: MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=bJwgrGlX7eo/KPkGYJJheWE7qp/6RG5YsvSVy6fyC2k=; b=kjSAOtiftUAuBvI/IUyvitDUEP akYFXPlFRIzQuHScl6VVwgXwJVmv5ufBLewcT6IrEXTVcPV5LESOOnOJ9DVCYtbX2Ur4BaSuiAZYJ D/ixll1v3I364kKltkt3nwanU7YxPzEWcZZeNsgO2lRmDyMgOo+b+WV6IhEQubNEveMo=; Received: from [84.212.220.105] (helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ng8hV-0008Au-Ud for control@debbugs.gnu.org; Sun, 17 Apr 2022 19:28:44 +0200 Date: Sun, 17 Apr 2022 19:28:40 +0200 Message-Id: <871qxvaabb.fsf@gnus.org> To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #54992 X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: close 54992 29.1 quit Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) close 54992 29.1 quit From unknown Tue Aug 19 09:32:20 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Mon, 16 May 2022 11:24:08 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator