Comments (10)
Should be in dev now.
from unrpyc.
Ah, I have an idea what the issue is, I'll look at it.
from unrpyc.
Very good.
I checked pickle_Pickler
and the supposedly missing method is there. Same in the c module, as far as my understanding there goes. I draw a blank with this. If you have it, i would appreciate a short explanation.
from unrpyc.
The one in the c module is only an internal c function. It doesn't export it as a method on the Pickler object. That's why you don't see it.
>>> _pickle.Pickler.save_global
AttributeError: type object '_pickle.Pickler' has no attribute 'save_global'
Outside of that, calling it with a pack kwarg is an internal py2 thing that we shouldn't be doing to begin with as well.
I think the fixed code would be:
def save_global(self, obj, name=None, pack=struct.pack):
if isinstance(obj, FakeClassType):
if PY2:
self.write(pickle.GLOBAL + obj.__module__ + '\n' + obj.__name__ + '\n')
elif self.proto >= 4:
self.save(obj.__module__)
self.save(obj.__name__)
self.write(pickle.STACK_GLOBAL)
else:
self.write(pickle.GLOBAL +
(obj.__module__ + '\n' + obj.__name__ + '\n').decode("utf-8")
)
self.memoize(obj)
return
super().save_global(obj, name)
Please try that out, as I was unable to reproduce the error (likely needs your branch on tl works).
from unrpyc.
likely needs your branch on tl works
Ah no. I tested with a clean version of current dev and master. Now with just the two fixes from above:
Error while decompiling /home/olli/.xlib/RPG/_test/OurBrightDays-0.1.3-pc/game/tl/english/scripts/00parts/01arrival/03script/script.rpyc:
Traceback (most recent call last):
File "/home/olli/Code/Git/unrpyc/unrpyc.py", line 218, in worker
return extract_translations(filename, args.language)
File "/home/olli/Code/Git/unrpyc/unrpyc.py", line 177, in extract_translations
return pickle_safe_dumps(translator.dialogue), translator.strings
File "/home/olli/Code/Git/unrpyc/decompiler/renpycompat.py", line 168, in pickle_safe_dumps
return magic.safe_dumps(buffer)
File "/home/olli/Code/Git/unrpyc/decompiler/magic.py", line 639, in safe_dumps
SafePickler(file, protocol).dump(obj)
File "/usr/lib/python3.10/pickle.py", line 487, in dump
self.save(obj)
File "/usr/lib/python3.10/pickle.py", line 560, in save
f(self, obj) # Call unbound method with explicit self
File "/usr/lib/python3.10/pickle.py", line 972, in save_dict
self._batch_setitems(obj.items())
File "/usr/lib/python3.10/pickle.py", line 998, in _batch_setitems
save(v)
File "/usr/lib/python3.10/pickle.py", line 560, in save
f(self, obj) # Call unbound method with explicit self
File "/usr/lib/python3.10/pickle.py", line 932, in save_list
self._batch_appends(obj)
File "/usr/lib/python3.10/pickle.py", line 959, in _batch_appends
save(tmp[0])
File "/usr/lib/python3.10/pickle.py", line 603, in save
self.save_reduce(obj=obj, *rv)
File "/usr/lib/python3.10/pickle.py", line 717, in save_reduce
save(state)
File "/usr/lib/python3.10/pickle.py", line 560, in save
f(self, obj) # Call unbound method with explicit self
File "/usr/lib/python3.10/pickle.py", line 972, in save_dict
self._batch_setitems(obj.items())
File "/usr/lib/python3.10/pickle.py", line 998, in _batch_setitems
save(v)
File "/usr/lib/python3.10/pickle.py", line 603, in save
self.save_reduce(obj=obj, *rv)
File "/usr/lib/python3.10/pickle.py", line 717, in save_reduce
save(state)
File "/usr/lib/python3.10/pickle.py", line 560, in save
f(self, obj) # Call unbound method with explicit self
File "/usr/lib/python3.10/pickle.py", line 972, in save_dict
self._batch_setitems(obj.items())
File "/usr/lib/python3.10/pickle.py", line 998, in _batch_setitems
save(v)
File "/usr/lib/python3.10/pickle.py", line 603, in save
self.save_reduce(obj=obj, *rv)
File "/usr/lib/python3.10/pickle.py", line 691, in save_reduce
save(func)
File "/usr/lib/python3.10/pickle.py", line 560, in save
f(self, obj) # Call unbound method with explicit self
File "/usr/lib/python3.10/pickle.py", line 1129, in save_type
return self.save_global(obj)
File "/home/olli/Code/Git/unrpyc/decompiler/magic.py", line 555, in save_global
super().save_global(obj, name)
File "/usr/lib/python3.10/pickle.py", line 1071, in save_global
raise PicklingError(
_pickle.PicklingError: Can't pickle <class '__builtin__.oldset'>: it's not found as __builtin__.oldset
Edit: I tested with two other games with translations(no others for renpy8 in my stash) and NO errors at all. With the new fixes AND without. Strange. Could it be a issue with this one game?
from unrpyc.
Huh. I tested it with the files you posted and couldn't reproduce the error to begin with (that said, the errors were fairly obvious when I looked at it).
_pickle.PicklingError: Can't pickle <class 'builtin.oldset'>: it's not found as builtin.oldset
Oh bloody hell, need to add a reduce impl to oldset/oldfrozenset as well.
from unrpyc.
Does this fix it (in renpycompat.py):
class oldset(set):
__module__ = "__builtin__"
def __reduce__(self):
cls, args, state = super().__reduce__()
return (set, args, state)
class oldfrozenset(frozenset):
__module__ = "__builtin__"
def __reduce__(self):
cls, args, state = super().__reduce__()
return (frozenset, args, state)
from unrpyc.
Looks like that did it. Thanks!
Will test some with it like this and get back to you here.
Edit:Packed your fixes in a branch. Removed also the pack parameter from save_global as i figured its unneeded.
dev-magic_savepickler_fix
from unrpyc.
Removed also the pack parameter from save_global as i figured its unneeded.
It's in there due to python 2, where that is the signature of the method it's overriding. Strangely nothing there uses it either, but it can't hurt for compat to keep it in.
from unrpyc.
Yes, i figured. With unneeded i meant py3 and i thought we need maybe a version switch for the diff py versions, as py3 does not have the pack para anymore.
from unrpyc.
Related Issues (20)
- Legacy-backports HOT 4
- Dev_py3: Possible missing colons in decompiled v8.2 files HOT 5
- Check for manipulated header fails sometimes HOT 7
- AttributeError: 'RawBlock' object has no attribute 'statements' HOT 12
- AttributeError: 'module' object has no attribute '_loads' with Ren'Py 6.99.12.4.2187 HOT 5
- Instaliation issues HOT 6
- Translate feature is in both unrpyc branches error prone implemented HOT 17
- Sugar syntax error in the SL2 decompiler HOT 7
- Interleaved output when multiprocessing is used. HOT 2
- Python string RegEx does not match multiline strings HOT 3
- Failed decompile script 'options.rpyс' from renpy 6.11.2 HOT 11
- How to unrpyc a single file during runtime in a rpy file HOT 13
- Missing guards after argparse for bad arg combinations HOT 1
- Uncaught exception while running a game with un.rpy HOT 10
- Sometimes "elif True" if generated HOT 3
- ModuleNotFoundError: No module named 'renpy' HOT 4
- After decompiled .rpy files, the game crashed. HOT 10
- Module Not Found Error HOT 4
- Cannot import as a library; fails at importing 'renpy' HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from unrpyc.