Subject: bug#60142: 28.1; python.el Incorrect region when python-shell-send-region from indented code

From: kobarity <[email-masked]>
Date: Mon, 19 Dec 2022 07:25:46 +0900

Pierre Mercatoris <[email-masked]>:

> > ```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.
>
>
Hi,

I could reproduce and workaround the bug.  But could you give me a few more
days to consider well and revise the patch?