From d8a712c0e1151797a3705dee374a866e20531503 Mon Sep 17 00:00:00 2001 From: cecinestpasunepipe <110607403+cecinestpasunepipe@users.noreply.github.com> Date: Tue, 20 Aug 2024 15:46:48 +0200 Subject: [PATCH] Add notice for PyPy users (DIS-3295) --- dissect/target/tools/shell.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/dissect/target/tools/shell.py b/dissect/target/tools/shell.py index 175f960fc..7185f57ce 100644 --- a/dissect/target/tools/shell.py +++ b/dissect/target/tools/shell.py @@ -9,6 +9,7 @@ import logging import os import pathlib +import platform import pydoc import random import re @@ -1442,6 +1443,20 @@ def main() -> None: if args.quiet: logging.getLogger("dissect").setLevel(level=logging.ERROR) + # PyPy < 3.10.14 readline is stuck in Python 2.7 + if platform.python_implementation() == "PyPy": + major, minor, patch = tuple(map(int, platform.python_version_tuple())) + if major <= 3 and minor <= 10 and patch < 14: + print( + "\n".join( + [ + "Note for users of PyPy < 3.10.14:", + "Autocomplete might not work due to an outdated version of pyrepl/readline.py", + "To fix this, please update your version of PyPy.", + ] + ) + ) + try: open_shell(args.targets, args.python, args.registry) except TargetError as e: