Skip to content

Commit f5f1cfc

Browse files
committed
gnatdbg.strings._fetch_string: make the encoding argument mandatory
Change-Id: I986b2078aa74f99de420925dd8b409f29773f1ab TN: RC14-025
1 parent 02124a6 commit f5f1cfc

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

gnatdbg/strings.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@
99
from gnatdbg.utils import ada_string_repr
1010

1111

12-
def _fetch_string(array_access, length, encoding=None, errors=None):
12+
def _fetch_string(array_access, length, encoding, errors=None):
1313
"""
1414
Fetch the string value in `array_access`.
1515
1616
:param gdb.Value array_access: Value that is a pointer to the array that
1717
represents the string.
1818
:param int length: Length of the string to fetch.
19-
:param str|None encoding: Encoding used to decode the string. Same meaning
20-
as in str.decode().
19+
:param str encoding: Encoding used to decode the string. Same meaning as in
20+
str.decode().
2121
:param str|None errors: Error handling for string decoding. Same meaning
2222
as in str.decode().
2323
:rtype: str
@@ -28,9 +28,7 @@ def _fetch_string(array_access, length, encoding=None, errors=None):
2828
ptr_to_elt_type = array_access.type.target().target().pointer()
2929
ptr_to_first = array_access.cast(ptr_to_elt_type)
3030

31-
kwargs = {'length': length}
32-
if encoding:
33-
kwargs['encoding'] = encoding
31+
kwargs = {'length': length, 'encoding': encoding}
3432
if errors:
3533
kwargs['errors'] = errors
3634
return ptr_to_first.string(**kwargs)

0 commit comments

Comments
 (0)