Skip to content

Multiple file obfuscation creates code with identation error #146

@sylvainmouretfico

Description

@sylvainmouretfico

Hey,
I have a very simple example, where the result is not proper Python code.

Here are the steps to reproduce.

main.py

import sub
sub.doSomething()

sub.py

def doSomething():
    print("test")
$ pyminifier --version
2.1
$ pyminifier -d out -O *.py
$ cd out
$ python main.py
Traceback (most recent call last):
  File "xxx\out\main.py", line 1, in <module>
    import sub
  File "xxx\out\sub.py", line 2
    i=print
    ^
IndentationError: expected an indented block after function definition on line 1

Result:

main.py

import sub
D=sub.D
D()

sub.py

def D():
i=print
 i("test")`

Note that the line i=print is not properly indented.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions