[3.13] gh-123228: fix return type for _ReadlineWrapper.get_line_buffer() (GH-123281) (#123293)

gh-123228: fix return type for _ReadlineWrapper.get_line_buffer() (GH-123281)
(cherry picked from commit ca18ff2a34)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Co-authored-by: Carl Friedrich Bolz-Tereick <cfbolz@gmx.de>
This commit is contained in:
Miss Islington (bot) 2024-08-24 18:11:17 +02:00 committed by GitHub
parent a65fe07db4
commit 31fae8c94f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 13 additions and 5 deletions

View file

@ -479,15 +479,14 @@ class _ReadlineWrapper:
def set_startup_hook(self, function: Callback | None = None) -> None:
self.startup_hook = function
def get_line_buffer(self) -> bytes:
buf_str = self.get_reader().get_unicode()
return buf_str.encode(ENCODING)
def get_line_buffer(self) -> str:
return self.get_reader().get_unicode()
def _get_idxs(self) -> tuple[int, int]:
start = cursor = self.get_reader().pos
buf = self.get_line_buffer()
for i in range(cursor - 1, -1, -1):
if str(buf[i]) in self.get_completer_delims():
if buf[i] in self.get_completer_delims():
break
start = i
return start, cursor