Remove some Python 3 #ifs

A recent patch from Kevin Buettner taught me that the PyBytes API is
available on Python 2.  This patch removes a couple of related #ifs in
the Python code.

Tested on x86-64 Fedora 29, using both Python 3.7 and Python 2.7.

gdb/ChangeLog
2019-03-05  Tom Tromey  <tromey@adacore.com>

	* python/py-prettyprint.c (print_string_repr): Remove #if.
	* python/py-utils.c (unicode_to_encoded_string): Remove #if.
This commit is contained in:
Tom Tromey 2019-03-05 14:58:24 -07:00
parent 06b5b831a0
commit ea38e5df77
3 changed files with 7 additions and 14 deletions

View file

@ -312,13 +312,8 @@ print_string_repr (PyObject *printer, const char *hint,
long length;
struct type *type;
#ifdef IS_PY3K
output = PyBytes_AS_STRING (string.get ());
length = PyBytes_GET_SIZE (string.get ());
#else
output = PyString_AsString (string.get ());
length = PyString_Size (string.get ());
#endif
type = builtin_type (gdbarch)->builtin_char;
if (hint && !strcmp (hint, "string"))