Skip to content

Commit

Permalink
Change IOError to OSError
Browse files Browse the repository at this point in the history
IOError is an alias of OSError (PEP 3151).
Also remove unneeded explicit inheritance of object by SignatureDatabase.
  • Loading branch information
j-t-1 authored Jun 5, 2024
1 parent 80535f5 commit 7f8b0d0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions pefile.py
Original file line number Diff line number Diff line change
Expand Up @@ -3120,7 +3120,7 @@ def __parse__(self, fname, data, fast_load):
if not self.FILE_HEADER:
raise PEFormatError("File Header missing")

# Set the image's flags according the the Characteristics member
# Set the image's flags according to the Characteristics member
set_flags(self.FILE_HEADER, self.FILE_HEADER.Characteristics, image_flags)

optional_header_offset = nt_headers_offset + 4 + self.FILE_HEADER.sizeof()
Expand Down Expand Up @@ -3232,7 +3232,7 @@ def __parse__(self, fname, data, fast_load):
DLL_CHARACTERISTICS, "IMAGE_DLLCHARACTERISTICS_"
)

# Set the Dll Characteristics flags according the the DllCharacteristics member
# Set the Dll Characteristics flags according to the DllCharacteristics member
set_flags(
self.OPTIONAL_HEADER,
self.OPTIONAL_HEADER.DllCharacteristics,
Expand Down Expand Up @@ -3640,7 +3640,7 @@ def parse_sections(self, offset):

section_flags = retrieve_flags(SECTION_CHARACTERISTICS, "IMAGE_SCN_")

# Set the section's flags according the the Characteristics member
# Set the section's flags according to the Characteristics member
set_flags(section, section.Characteristics, section_flags)

if section.__dict__.get(
Expand Down Expand Up @@ -5458,7 +5458,7 @@ def length_until_eof(rva):

# If the function's RVA points within the export directory
# it will point to a string with the forwarded symbol's string
# instead of pointing the the function start address.
# instead of pointing to the function start address.
if symbol_address >= rva and symbol_address < rva + size:
forwarder_str = self.get_string_at_rva(symbol_address)
try:
Expand Down Expand Up @@ -6304,7 +6304,7 @@ def get_memory_mapped_image(self, max_virtual_address=0x10000000, ImageBase=None
return mapped_data

def get_resources_strings(self):
"""Returns a list of all the strings found withing the resources (if any).
"""Returns a list of all the strings found within the resources (if any).
This method will scan all entries in the resources directory of the PE, if
there is one, and will return a [] with the strings.
Expand Down
6 changes: 3 additions & 3 deletions peutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
__contact__ = "[email protected]"


class SignatureDatabase(object):
class SignatureDatabase:
"""This class loads and keeps a parsed PEiD signature database.
Usage:
Expand Down Expand Up @@ -397,7 +397,7 @@ def __load(self, filename=None, data=None):
sig_f = urllib.request.urlopen(filename)
sig_data = sig_f.read()
sig_f.close()
except IOError:
except OSError:
# Let this be raised back to the user...
raise
else:
Expand All @@ -407,7 +407,7 @@ def __load(self, filename=None, data=None):
sig_f = open(filename, "rt")
sig_data = sig_f.read()
sig_f.close()
except IOError:
except OSError:
# Let this be raised back to the user...
raise
else:
Expand Down

0 comments on commit 7f8b0d0

Please sign in to comment.