if PY3:
- import io
-
- StringIO = io.StringIO
- BytesIO = io.BytesIO
-
# Functions for acting on bytestrings and strings. In Python 2 and 3,
# strings and bytes are the same and chr/ord can be used to convert between
# numeric byte values and their string representations. In Python 3, bytes
def byte2int(b): return b
else:
- import cStringIO
- import os
-
- StringIO = BytesIO = cStringIO.StringIO
-
def bytes2str(b): return b
def str2bytes(s): return s
int2byte = chr
# This code is in the public domain
#-------------------------------------------------------------------------------
from collections import namedtuple
+from io import BytesIO
-from ..common.py3compat import BytesIO
from ..common.utils import struct_parse, bytelist2string, read_blob
# This code is in the public domain
#-------------------------------------------------------------------------------
import io
+from io import BytesIO
import os
import struct
import zlib
# Jython
PAGESIZE = 4096
-from ..common.py3compat import BytesIO
from ..common.exceptions import ELFError, ELFParseError
from ..common.utils import struct_parse, elf_assert
from .structs import ELFStructs
# This code is in the public domain
#-------------------------------------------------------------------------------
import os
+from io import BytesIO
import sys
import unittest
-from elftools.common.py3compat import BytesIO
from elftools.elf.elffile import ELFFile
from elftools.elf.relocation import RelocationHandler
# This code is in the public domain
#-------------------------------------------------------------------------------
import unittest
+from io import BytesIO
-from elftools.common.py3compat import BytesIO
from elftools.dwarf.callframe import (
CallFrameInfo, CIE, FDE, instruction_name, CallFrameInstruction,
RegisterRule, DecodedCallFrameTable, CFARule)
# This code is in the public domain
#-------------------------------------------------------------------------------
import unittest
+from io import BytesIO
-from elftools.common.py3compat import BytesIO
from elftools.dwarf.lineprogram import LineProgram, LineState, LineProgramEntry
from elftools.dwarf.structs import DWARFStructs
from elftools.dwarf.constants import *
import os
+from io import BytesIO
import sys
import unittest
-from elftools.common.py3compat import BytesIO
from elftools.elf.elffile import ELFFile
from elftools.elf.dynamic import DynamicSegment, DynamicSection
# This code is in the public domain
#-------------------------------------------------------------------------------
import unittest
+from io import BytesIO
from random import randint
-from elftools.common.py3compat import int2byte, BytesIO
+from elftools.common.py3compat import int2byte
from elftools.common.utils import (parse_cstring_from_stream, merge_dicts,
preserve_stream_pos)