Storyyeller / Krakatau

Java decompiler, assembler, and disassembler
GNU General Public License v3.0
1.95k stars 219 forks source link

Brought python 3 compatibility #140

Closed KOLANICH closed 6 years ago

KOLANICH commented 6 years ago

With 2to3 and manual fixes. Some fixes with six may be needed. But do it yourself: I don't have python 2 on my machines.

Storyyeller commented 6 years ago

What is the point of this? The assembler and disassembler already support Python 3, while the decompiler is too big and complex to be worth the effort of porting. I suppose it could be useful to have this PR available in case people want to run the decompiler under Python 3 as well, but I don't see it ever being merged. I don't trust 2to3 to not break things, and I don't want to uglify the code so much either.

Note that the previous time I tried 2to3, there were obvious bugs in it. It looks like it has improved, but it still can't cover everything. When I ported the assembler and disassembler by hand, there were a bunch of subtle breakages, and the decompiler is a lot more complicated, so I don't expect an automated tool to ever handle everything correctly.

That being said, I do appreciate the effort to improve Krakatau.

KOLANICH commented 6 years ago

The assembler and disassembler already support Python 3, while the decompiler is too big and complex to be worth the effort of porting.

It's already ported. And it works. Other decompilers (luyten, jd) have failed (just wrote "internal error") to decompile and even disassemble the code (scala) it have decompiled.

I don't trust 2to3 to not break things, and I don't want to uglify the code so much either.

I have reviewed it changes manually and fixed what I found it had spoiled or uglified, which can be fixed.

z3ntu commented 6 years ago

@Storyyeller Python 2 will be EOL in 2020 and several distributions are already planning to drop Python 2. If you want your software to stay compatible you should try to port it over (or let other people do it :wink: )

KOLANICH commented 6 years ago

or let other people do it 😉

Who doesn't let? If you are ready to merge python3 port with the @Storyyeller 's repo, just create an org and clone my repo there. I guess merging would be easier if a one uses some better merge tool working on AST level.

Python 2 will be EOL in 2020

I'd prefer it be EOL in 2010.

z3ntu commented 6 years ago

I'd prefer it to be EOL in 2010.

Well it was planned to be in 2015 but people complained ¯\_(ツ)_/¯

KOLANICH commented 3 years ago

@Storyyeller, python 2 is already EOL for more than a year. Maybe this PR should be reopened and merged?

Storyyeller commented 3 years ago

The main issue is the maintenance burden. The reason I didn't try to port the decompiler to python 3 before is because there's a high risk of breakages and I didn't have the time and energy to go through and try to find them all.

In any case, just because Python 2 is EOL doesn't mean people aren't still using it.

KOLANICH commented 3 years ago

is because there's a high risk of breakages and I didn't have the time and energy to go through and try to find them all.

Python 3 is not so different to python 2 to get a lot of breakages. BTW I use python 3 from 2013, and Krakatau since I have ported it. Works OK for me.

Do you have a test suite for decompilation?

In any case, just because Python 2 is EOL doesn't mean people aren't still using it.

Yes, and neither just because it exists people are wiling to have it on their machines. I have never used 2 as the main interpreter, in fact I only used 2 (not counting the large and long to build software bundled with 2 here, such as gimp, inkskape and freecad) to test some projects I had to contribute that required compatibility to 2. Anyway, I see no reason to use 2 while 3 is much better.

Storyyeller commented 3 years ago

There are tests for the decompiler, but coverage is not great.