From: mephi42 Date: Thu, 21 May 2020 12:18:17 +0000 (+0200) Subject: Fix determining PAGESIZE under Jython (#314) X-Git-Tag: v0.27~29 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=478f61c3a590323144c9c1e0ef7b7254d9f82b6f;p=pyelftools.git Fix determining PAGESIZE under Jython (#314) Jython has neither `resource` nor `mmap`, therefore just use a reasonable default. --- diff --git a/elftools/elf/elffile.py b/elftools/elf/elffile.py index f95fd54..b7868f2 100644 --- a/elftools/elf/elffile.py +++ b/elftools/elf/elffile.py @@ -14,9 +14,13 @@ try: import resource PAGESIZE = resource.getpagesize() except ImportError: - # Windows system - import mmap - PAGESIZE = mmap.PAGESIZE + try: + # Windows system + import mmap + PAGESIZE = mmap.PAGESIZE + except ImportError: + # Jython + PAGESIZE = 4096 from ..common.py3compat import BytesIO from ..common.exceptions import ELFError