From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Pierre Mercatoris Newsgroups: gmane.emacs.bugs Subject: bug#60142: 28.1; python.el Incorrect region when python-shell-send-region from indented code Date: Sun, 18 Dec 2022 16:04:54 +0100 Message-ID: References: <83mt7lf12y.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="0000000000001bbf1e05f01b87e7" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5861"; mail-complaints-to="usenet@ciao.gmane.io" Cc: kobarity , Augusto Stoffel , 60142@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Dec 18 16:06:18 2022 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 1p6vF3-0001JU-TI for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 18 Dec 2022 16:06:18 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p6vEq-0001w1-HY; Sun, 18 Dec 2022 10:06:04 -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 1p6vEo-0001vZ-HI for bug-gnu-emacs@gnu.org; Sun, 18 Dec 2022 10:06:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p6vEo-0006k8-5Z for bug-gnu-emacs@gnu.org; Sun, 18 Dec 2022 10:06:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p6vEo-0006Xn-0m for bug-gnu-emacs@gnu.org; Sun, 18 Dec 2022 10:06:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Pierre Mercatoris Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 18 Dec 2022 15:06:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60142 X-GNU-PR-Package: emacs Original-Received: via spool by 60142-submit@debbugs.gnu.org id=B60142.167137591225132 (code B ref 60142); Sun, 18 Dec 2022 15:06:01 +0000 Original-Received: (at 60142) by debbugs.gnu.org; 18 Dec 2022 15:05:12 +0000 Original-Received: from localhost ([127.0.0.1]:34382 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6vE0-0006XI-DP for submit@debbugs.gnu.org; Sun, 18 Dec 2022 10:05:12 -0500 Original-Received: from mail-ej1-f42.google.com ([209.85.218.42]:33387) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6vDy-0006X8-Te for 60142@debbugs.gnu.org; Sun, 18 Dec 2022 10:05:11 -0500 Original-Received: by mail-ej1-f42.google.com with SMTP id n20so16476361ejh.0 for <60142@debbugs.gnu.org>; Sun, 18 Dec 2022 07:05:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=aceXH8cXOVCz1ckXIOAM88iHsmJaAdD+sqbspP4hTSg=; b=Ck8j8GAFkAFTzKVT6qZxBS7m5tf9mFcG98L0XoY6d4QHvDs+lZfuw2nnLwkRAVzVuQ oHnt5PO0hcUVXN5n94AqR4mgl9SLKQE0vWNPkkYRQ24rud9+G2iow+dMpPxcIgLtSeNU uStxZ2rQPR61j5si3+/1A3HaS/lz8zUTNkEBX6+VNnSDXMQ4TA8Kk9egGJphq4u64LL1 6F7Q5FP9rVmGP/6Dil+bC49V10xyK8L34TbZPjVupJ4BQkwFjFkV8ZpBJaE3qq+bz3Ox kqNru1c3H09UboobVG4inu1IZXkb/tb8Y9a4mThxQpygCyoLx+JrE4Nq60WhXYkv5NF9 8cZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=aceXH8cXOVCz1ckXIOAM88iHsmJaAdD+sqbspP4hTSg=; b=mRAVqqRRE1igYTo9L6iFKO4P2Y2QcRnS+Q6bksWJybfAa253lRLkRP5aRri3q6NyuG kGCEuwx2BFqA8Clp3VW6cBoXYZz7cJ6NzupgQdQLg5aGk0UGqXcOgeayvbuBwEEQDHWF 8WtUnOrF6CkQRGbWaupiAKzTETL4T1YmKKUU/594u+SIB73VhDdSFRNm5WODUBdSifmJ hGe2NzN5E3ttGAQjLZ1fLiddBxwDSd4BDcn8LWCJQxPJTwPWhcnPz0H+mivuAI5TqhHv pR7Th9zgiMY0drUTZVskVp6xN6v8qZY8wLjxk8Ru5foZsb4eM2UyjIiKrhXVK8rV4iec 2JiQ== X-Gm-Message-State: ANoB5pmsE2flQ7ZwRATDby+N92Rb5gli6GFCVKJRcuXSXnf+dwc7tYfj bY1Ec0StEUglTeTpQ1KBC+xkWR6MNk3nPDzB2/rr1vJi X-Google-Smtp-Source: AA0mqf4yE7yye7aEqAxndsjcmV2Ryi/Sfgw/76JeazLqh75j+KVtCsadtisjQV3FRv7AJvAXQruUQnEpuTAIWhRKR0s= X-Received: by 2002:a17:907:774e:b0:7ae:39b4:7208 with SMTP id kx14-20020a170907774e00b007ae39b47208mr17821960ejc.766.1671375905077; Sun, 18 Dec 2022 07:05:05 -0800 (PST) In-Reply-To: <83mt7lf12y.fsf@gnu.org> 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:251368 Archived-At: --0000000000001bbf1e05f01b87e7 Content-Type: text/plain; charset="UTF-8" I wanted to give more details. But I basically get the same issue with Emacs -Q and the default python console. On Sun, 18 Dec 2022 at 11:38, Eli Zaretskii wrote: > > Date: Fri, 16 Dec 2022 23:54:23 +0100 > > From: pmercatoris > > > > I am unable to get correct behavious when sending a region from indented > code > > to the python shell. Consider this python code: > > > > ```python > > if True: > > if True: > > a = "test" > > ``` > > > > If I select the first `True` and `python-shell-send-region`, it will > > correctly send it to the consol and print `True`. > > > > Now if I do the same thing with the second `True` it will throw an > > error: `IndentationError: expected an indented block after 'if' > > statement on line 1` Although it would also reffer to unexpected block > > after `if` even it it were `for`, `try`, ... > > > > If I select the `a` or `a = "test"` it will correctly send it to the > > console, however it won't echo the evaluation of the statement. > > > > If I select the string "test" and send, it will throw the same error as > > the second True. > > > > My python config is very minimal: > > > > (use-package python > > :ensure nil > > :mode > > ("\\.py\\'" . python-mode) > > > > :init > > (setq-default indent-tabs-mode nil) > > > > :config > > (setq python-indent-offset 4 > > python-indent-guess-indent-offset-verbose nil > > ) > > > > (setq python-shell-interpreter "jupyter" > > python-shell-interpreter-args "console --simple-prompt" > > python-shell-prompt-detect-failure-warning nil) > > > > (add-to-list 'python-shell-completion-native-disabled-interpreters > > "jupyter")) > > Could you two please look into this? It sounds to me like Emacs works > as expected here, but I'm not an expert on Python and our interfaces > with it. > > Thanks. > --0000000000001bbf1e05f01b87e7 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I wanted to give more details. But I basically get the sa= me issue with Emacs -Q and the default python console.=C2=A0

=
On Sun, 18= Dec 2022 at 11:38, Eli Zaretskii <eliz@= gnu.org> wrote:
> Date: Fri, 16 Dec 202= 2 23:54:23 +0100
> From: pmercatoris <mercatorispierre@gmail.com>
>
> I am unable to get correct behavious when sending a region from indent= ed code
> to the python shell. Consider this python code:
>
> ```python
> if True:
>=C2=A0 =C2=A0 =C2=A0if True:
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0a =3D "test"
> ```
>
> If I select the first `True` and `python-shell-send-region`, it will > correctly send it to the consol and print `True`.
>
> Now if I do the same thing with the second `True` it will throw an
> error: `IndentationError: expected an indented block after 'if'= ;
> statement on line 1` Although it would also reffer to unexpected block=
> after `if` even it it were `for`, `try`, ...
>
> If I select the `a` or `a =3D "test"` it will correctly send= it to the
> console, however it won't echo the evaluation of the statement. >
> If I select the string "test" and send, it will throw the sa= me error as
> the second True.
>
> My python config is very minimal:
>
>=C2=A0 =C2=A0(use-package python
>=C2=A0 =C2=A0 =C2=A0:ensure nil
>=C2=A0 =C2=A0 =C2=A0:mode
>=C2=A0 =C2=A0 =C2=A0("\\.py\\'" . python-mode)
>
>=C2=A0 =C2=A0 =C2=A0:init
>=C2=A0 =C2=A0 =C2=A0(setq-default indent-tabs-mode nil)
>
>=C2=A0 =C2=A0 =C2=A0:config
>=C2=A0 =C2=A0 =C2=A0(setq python-indent-offset 4
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0python-indent-guess-indent-off= set-verbose nil
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0)
>
>=C2=A0 =C2=A0 =C2=A0(setq python-shell-interpreter "jupyter"<= br> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0python-shell-interpreter-args = "console --simple-prompt"
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0python-shell-prompt-detect-fai= lure-warning nil)
>
>=C2=A0 =C2=A0 =C2=A0(add-to-list 'python-shell-completion-native-di= sabled-interpreters
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 "ju= pyter"))

Could you two please look into this?=C2=A0 It sounds to me like Emacs works=
as expected here, but I'm not an expert on Python and our interfaces with it.

Thanks.
--0000000000001bbf1e05f01b87e7--