Skip to content

Commit

Permalink
Fix a bug in un.rpyc and also add support for RevertableDict's in the…
Browse files Browse the repository at this point in the history
… AST
  • Loading branch information
CensoredUsername committed Jul 1, 2019
1 parent 129c4e1 commit 8fdda39
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 6 additions & 1 deletion un.rpyc/unrpyc-compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 6 additions & 1 deletion unrpyc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down

0 comments on commit 8fdda39

Please sign in to comment.