diff options
author | Simon Marchi <simon.marchi@ericsson.com> | 2014-12-15 11:30:20 -0500 |
---|---|---|
committer | Simon Marchi <simon.marchi@ericsson.com> | 2014-12-15 11:40:00 -0500 |
commit | 89ed8ea187a460bc746a41f08fa8ee986716743b (patch) | |
tree | 0173b7098816e6896c3e77a9ae1da87b256fad09 /gdb/python/lib | |
parent | 263ddf68020ee659a221af45319984b4e73e8efe (diff) | |
download | gdb-89ed8ea187a460bc746a41f08fa8ee986716743b.zip gdb-89ed8ea187a460bc746a41f08fa8ee986716743b.tar.gz gdb-89ed8ea187a460bc746a41f08fa8ee986716743b.tar.bz2 |
python extended prompt: Use os.getcwd() instead of os.getcwdu()
It seems like using os.getcwdu() here is wrong both for Python 2 and Python 3.
For Python 2, this returns a 'unicode' object, which tries to get concatenated
to a 'str' object in substitute_prompt. The implicit conversion works when the
unicode string contains no accent. When it does contain an accent though,
displaying the prompt results in the following error:
(gdb) set extended-prompt \w
...
File "/home/simark/build/binutils-gdb-python2/gdb/data-directory/python/gdb/prompt.py", line 138, in substitute_prompt
result += str(cmd(arg))
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 49: ordinal not in range(128)
When using os.getcwd() instead, it works correctly. I suppose that Python does
the necessary decoding internally.
For Python 3, this method simply does not exist. It works fine with os.getcwd().
gdb/ChangeLog:
* python/lib/gdb/prompt.py (_prompt_pwd): Use os.getcwd() instead of
os.getcwdu().
Diffstat (limited to 'gdb/python/lib')
-rw-r--r-- | gdb/python/lib/gdb/prompt.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/gdb/python/lib/gdb/prompt.py b/gdb/python/lib/gdb/prompt.py index d99f2ea..04adbfb 100644 --- a/gdb/python/lib/gdb/prompt.py +++ b/gdb/python/lib/gdb/prompt.py @@ -21,7 +21,7 @@ import os def _prompt_pwd(ignore): "The current working directory." - return os.getcwdu() + return os.getcwd() def _prompt_object_attr(func, what, attr, nattr): """Internal worker for fetching GDB attributes.""" |