Subject: Re: bug#60466: 30.0.50; python-shell-send-region fails when the region starts in the middle of the first line

From: Eli Zaretskii <[email-masked]>
Date: Sat, 07 Jan 2023 10:59:06 +0200

> Date: Sun, 01 Jan 2023 21:22:44 +0900
> From: kobarity <[email-masked]>
> 
> `python-shell-send-region' fails with the following error when the
> region starts in the middle of the first line.
> 
> Wrong type argument: wholenump, -1
> 
> This is caused by the code to insert the coding cookie in
> `python-shell-buffer-substring'.  I think that the current code
> assumes that the region begins at line beginning position.  However,
> there are some use-cases where the region starts in the middle of the
> line as discussed in #60142.  So I think the special treatment in case
> of point-min should be extended to case of first line.  Attached is a
> patch to implement this.

Thanks, installed on the emacs-29 branch, and closing the bug.