summaryrefslogtreecommitdiff
path: root/chromium/third_party/pyelftools/elftools/common/utils.py
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2017-08-01 11:44:21 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2017-08-01 09:49:25 +0000
commit9a05d0e4db172168e429f30bc8ed62b695006490 (patch)
tree6a7a6b2f7e3410bb9ddc3ef9a200156f2bf623e1 /chromium/third_party/pyelftools/elftools/common/utils.py
parent6ec7b8da05d21a3878bd21c691b41e675d74bb1c (diff)
downloadqtwebengine-chromium-9a05d0e4db172168e429f30bc8ed62b695006490.tar.gz
BASELINE: Update Chromium to 60.0.3112.78
Change-Id: I58f9d14bddb9104a666b6ef869944111ee7eadb8 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/third_party/pyelftools/elftools/common/utils.py')
-rw-r--r--chromium/third_party/pyelftools/elftools/common/utils.py15
1 files changed, 7 insertions, 8 deletions
diff --git a/chromium/third_party/pyelftools/elftools/common/utils.py b/chromium/third_party/pyelftools/elftools/common/utils.py
index a2c9edbe356..2daed04c51c 100644
--- a/chromium/third_party/pyelftools/elftools/common/utils.py
+++ b/chromium/third_party/pyelftools/elftools/common/utils.py
@@ -31,8 +31,8 @@ def struct_parse(struct, stream, stream_pos=None):
stream.seek(stream_pos)
return struct.parse_stream(stream)
except ConstructError as e:
- raise ELFParseError(str(e))
-
+ raise ELFParseError(e.message)
+
def parse_cstring_from_stream(stream, stream_pos=None):
""" Parse a C-string from the given stream. The string is returned without
@@ -41,8 +41,6 @@ def parse_cstring_from_stream(stream, stream_pos=None):
If stream_pos is provided, the stream is seeked to this position before
the parsing is done. Otherwise, the current position of the stream is
used.
- Note: a bytes object is returned here, because this is what's read from
- the binary file.
"""
if stream_pos is not None:
stream.seek(stream_pos)
@@ -78,10 +76,11 @@ def dwarf_assert(cond, msg=''):
@contextmanager
def preserve_stream_pos(stream):
""" Usage:
- # stream has some position FOO (return value of stream.tell())
- with preserve_stream_pos(stream):
- # do stuff that manipulates the stream
- # stream still has position FOO
+
+ # stream has some position FOO (return value of stream.tell())
+ with preserve_stream_pos(stream):
+ # do stuff that manipulates the stream
+ # stream still has position FOO
"""
saved_pos = stream.tell()
yield