mirror of
https://github.com/python/cpython.git
synced 2025-09-12 19:57:40 +00:00
[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:
parent
a65fe07db4
commit
31fae8c94f
3 changed files with 13 additions and 5 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue