From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii 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 12:39:01 +0200 Message-ID: <83mt7lf12y.fsf@gnu.org> References: Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26006"; mail-complaints-to="usenet@ciao.gmane.io" Cc: pmercatoris , 60142@debbugs.gnu.org To: kobarity , Augusto Stoffel Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Dec 18 11:40: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 1p6r5d-0006ZI-Ui for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 18 Dec 2022 11:40:18 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p6r5P-0006Fz-SJ; Sun, 18 Dec 2022 05:40:03 -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 1p6r5O-0006FV-6U for bug-gnu-emacs@gnu.org; Sun, 18 Dec 2022 05:40: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 1p6r5N-0006HH-T0 for bug-gnu-emacs@gnu.org; Sun, 18 Dec 2022 05:40:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p6r5N-00076d-JZ for bug-gnu-emacs@gnu.org; Sun, 18 Dec 2022 05:40:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 18 Dec 2022 10:40: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.167135994127283 (code B ref 60142); Sun, 18 Dec 2022 10:40:01 +0000 Original-Received: (at 60142) by debbugs.gnu.org; 18 Dec 2022 10:39:01 +0000 Original-Received: from localhost ([127.0.0.1]:33187 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6r4O-00075v-R4 for submit@debbugs.gnu.org; Sun, 18 Dec 2022 05:39:01 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:59134) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6r4M-00075o-TY for 60142@debbugs.gnu.org; Sun, 18 Dec 2022 05:38:59 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p6r4H-00067j-L9; Sun, 18 Dec 2022 05:38:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=jDt7DHVihSkXozZWOkxPYrkEnICKbisg9yRw6PeoH6w=; b=ZWzfqQ4V937V Hs815NT85XZzjRnAPqi8dQnhp6U8xcs7qdOoCeFfQnF93ozGD51GsUyMkUwgbo++8IlsYcRfTvcIv f2YQv9ZNspB3PSjwhe7vwaO6cc0uH4ZSCD0ZXS98D6LHVw6cCDzPeSWW2XpyUDLPtdMmfQXpos0zS rfdIOJKHpakcAfJ8bS9JcVp97iFxOb2fkQJ6+DqXRpiWudjzn2bYvWCm/xNYGYwedqTkrK1rQPlGo f1PKBtsrUn4mjPIHbhojB9kYpNaDBuU2My+RjtCfgbfA/wEqbDP1cy2rPXOR1zJytMcc4ymW0Esbc IX2TrZXS5VJYhlp+i3866g==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p6r4H-000712-4R; Sun, 18 Dec 2022 05:38:53 -0500 In-Reply-To: (message from pmercatoris on Fri, 16 Dec 2022 23:54:23 +0100) 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:251350 Archived-At: > 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.