From 478f61c3a590323144c9c1e0ef7b7254d9f82b6f Mon Sep 17 00:00:00 2001 From: mephi42 Date: Thu, 21 May 2020 14:18:17 +0200 Subject: [PATCH] Fix determining PAGESIZE under Jython (#314) Jython has neither `resource` nor `mmap`, therefore just use a reasonable default. --- elftools/elf/elffile.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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 -- 2.30.2