From 8fdda3961187b0c2a8de5f9e87cf3f652c6a5d00 Mon Sep 17 00:00:00 2001 From: CensoredUsername Date: Mon, 1 Jul 2019 16:11:08 +0200 Subject: [PATCH] Fix a bug in un.rpyc and also add support for RevertableDict's in the AST --- un.rpyc/unrpyc-compile.py | 7 ++++++- unrpyc.py | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/un.rpyc/unrpyc-compile.py b/un.rpyc/unrpyc-compile.py index 0518eae2..e01e8e01 100644 --- a/un.rpyc/unrpyc-compile.py +++ b/un.rpyc/unrpyc-compile.py @@ -48,7 +48,12 @@ class RevertableList(magic.FakeStrict, list): def __new__(cls): return list.__new__(cls) -class_factory = magic.FakeClassFactory((PyExpr, PyCode, RevertableList), magic.FakeStrict) +class RevertableDict(magic.FakeStrict, dict): + __module__ = "renpy.python" + def __new__(cls): + return dict.__new__(cls) + +factory = magic.FakeClassFactory((PyExpr, PyCode, RevertableList, RevertableDict), magic.FakeStrict) def read_ast_from_file(raw_contents): # .rpyc files are just zlib compressed pickles of a tuple of some data and the actual AST of the file diff --git a/unrpyc.py b/unrpyc.py index b8f909b8..72e8b723 100755 --- a/unrpyc.py +++ b/unrpyc.py @@ -57,7 +57,12 @@ class RevertableList(magic.FakeStrict, list): def __new__(cls): return list.__new__(cls) -class_factory = magic.FakeClassFactory((PyExpr, PyCode, RevertableList), magic.FakeStrict) +class RevertableDict(magic.FakeStrict, dict): + __module__ = "renpy.python" + def __new__(cls): + return dict.__new__(cls) + +class_factory = magic.FakeClassFactory((PyExpr, PyCode, RevertableList, RevertableDict), magic.FakeStrict) printlock = Lock()