From unknown Wed Jun 18 00:25:47 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#67529 <67529@debbugs.gnu.org> To: bug#67529 <67529@debbugs.gnu.org> Subject: Status: 29.1; Python: syntax category of code in f-strings marked as string Reply-To: bug#67529 <67529@debbugs.gnu.org> Date: Wed, 18 Jun 2025 07:25:47 +0000 retitle 67529 29.1; Python: syntax category of code in f-strings marked as = string reassign 67529 emacs submitter 67529 Daniel Fleischer severity 67529 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Wed Nov 29 11:26:45 2023 Received: (at submit) by debbugs.gnu.org; 29 Nov 2023 16:26:45 +0000 Received: from localhost ([127.0.0.1]:50851 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r8NOf-0000jJ-0u for submit@debbugs.gnu.org; Wed, 29 Nov 2023 11:26:45 -0500 Received: from lists.gnu.org ([2001:470:142::17]:47470) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r8NOb-0000iz-Th for submit@debbugs.gnu.org; Wed, 29 Nov 2023 11:26:43 -0500 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 1r8NOL-000097-K0 for bug-gnu-emacs@gnu.org; Wed, 29 Nov 2023 11:26:27 -0500 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r8NOG-0000Ra-VL for bug-gnu-emacs@gnu.org; Wed, 29 Nov 2023 11:26:24 -0500 Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-3330fd19820so1364196f8f.1 for ; Wed, 29 Nov 2023 08:26:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701275176; x=1701879976; darn=gnu.org; h=mime-version:message-id:date:subject:to:from:user-agent:from:to:cc :subject:date:message-id:reply-to; bh=ArxyVMj369DOKPU19+qAIHsWDJDgbtngI3IRMUsB5m4=; b=Dl+2zbpXc3SmL3J5U/MCVjbek/9o7G/OOzstZju/CbksoEws2R0r/BLbWB3VbMMiKU ZqRQZbkrVPNKOJ/jnWbkct00BLsXlKu6SwncINT03ye7JQgUejew5HTO3/fW6Y62Cc1x e3M8y8dB5VbsxIlog9FGHjBG+ApnCj/pGgrBCr17qhAF/sdajcOfFsVuL5nvIvy0+gwS Aiz3ULbuqST15ldTquZyZIjjJSN11e0bz5GEoX0hlT7T8WonQw8M5I14dfqN6tRKDzkf aiq7jDF2+W50M3tb54gyEMpsqEKL2Eev3TuuADCJ39pwcP9+XPmFz7fd6dSX04jOLjVh dTzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701275176; x=1701879976; h=mime-version:message-id:date:subject:to:from:user-agent :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ArxyVMj369DOKPU19+qAIHsWDJDgbtngI3IRMUsB5m4=; b=eBAUiz33lO3u/brwyDXqU0eOYxmEVJRtimyjN6DW/D1c71p6Ou3JkuCK8/RIXZYfhr 6Ly4kZYcruRHodDcYPFpsMgSXTAAsuZkbVMiWfORURabsQw7jJQ2DpoCNXLHMdr3Yj+R snfwokE0mhdZlZn1cgcBbWzz+oy5OVMvJ/ClWY3dnGpejhplB+neGTnyWtAxhU4bW40K YLRE+FYTBzIUgDS3O3GDl8114tHBVP/SH+mzwI4GbD2rOEoSjZMsli6SNfeOzYA1gLFn 2eapaL2CSW5DpMaQ8b2c0f2xx1whpXsfaFJy5wyyswyiz66L4NnUAQE/zxZTLGhpia7t zRrA== X-Gm-Message-State: AOJu0YyWX9sQbaSpjXoglL2CQ13TFCFSy4myX3ZwsVFIrSR0F+jMSfdB soOJnaMNpU3qn7x5INeKXZQFjmAXAjw= X-Google-Smtp-Source: AGHT+IH33F4+RsvKkasNrdzYzJXXhZ4R0X1mr3VBL9RdHnfnQUvQac8Xe/sFP6J/stXZjAh5neyYtA== X-Received: by 2002:adf:fc0a:0:b0:332:f97d:5a55 with SMTP id i10-20020adffc0a000000b00332f97d5a55mr8693524wrr.13.1701275175736; Wed, 29 Nov 2023 08:26:15 -0800 (PST) Received: from Home-Mac ([37.46.46.220]) by smtp.gmail.com with ESMTPSA id g7-20020a05600c4ec700b0040b34409d43sm2706928wmq.11.2023.11.29.08.26.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 08:26:15 -0800 (PST) User-agent: mu4e 1.11.22; emacs 29.1 From: Daniel Fleischer To: bug-gnu-emacs@gnu.org Subject: 29.1; Python: syntax category of code in f-strings marked as string Date: Wed, 29 Nov 2023 18:10:23 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; format=flowed Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=danflscr@gmail.com; helo=mail-wr1-x434.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.0 (+) X-Debbugs-Envelope-To: submit 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: -0.0 (/) Hi, in python f-strings can have python code inside them: f"Two plus two is {2+2}" f"The value of a is {a}" f"The first item in arr is {arr[0]}" The function `python--font-lock-f-strings` correctly fontify what's inside the {} as code. However syntax analysis show the content inside {} as string; run `(syntax-ppss-context (syntax-ppss (point)))` to see. This has semantic implications, for example the package `smart-scan` can jump between occurrences of a symbol but it won't identify the symbol in a string/comment. Maybe there are other packages which use this syntax information. Daniel