Skip to content

NameError: name '__armor_enter__' is not defined for __del__ destructors for python 3.6 #610

@tkornuta-nvidia

Description

@tkornuta-nvidia

Context
Building obfuscated python wheels with several modules and classes.

Platforms

Currently need to support several platforms (aarch64, x86) for different python versions (py3.6, py3.7 and py3.8)

Pyarmor versions tested: 6.7.1, 6.8.1

Description

The un-obfuscated wheels work fine, but when running the same code after installation of an obfuscated wheel errors like the following appear:

Exception ignored in: <function ArtifactRegistry.__del__ at 0x7fb61e32dc10>
Traceback (most recent call last):
File "<frozen src.eff.core.artifact_registry>", line 91, in __del__
NameError: name '__armor_enter__' is not defined
Exception ignored in: <function Artifact.__del__ at 0x7fb61e3981f0>
Traceback (most recent call last):
File "<frozen src.eff.core.artifact>", line 177, in __del__
NameError: name '__armor_enter__' is not defined
Exception ignored in: <function Artifact.__del__ at 0x7fb61e3981f0>
Traceback (most recent call last):
File "<frozen src.eff.core.artifact>", line 177, in __del__
NameError: name '__armor_enter__' is not defined
Exception ignored in: <function Artifact.__del__ at 0x7fb61e3981f0>
Traceback (most recent call last):
File "<frozen src.eff.core.artifact>", line 177, in __del__
NameError: name '__armor_enter__' is not defined
Exception ignored in: <function Artifact.__del__ at 0x7fb61e3981f0>
Traceback (most recent call last):

The core of the problem lies in PyArmor, precisely in bad handling of destructor del methods.

I have found references to this error in PyArmor docs:
https://buildmedia.readthedocs.org/media/pdf/pyarmor/stable/pyarmor.pdf
It is described in “14.6.12 Object method del raise NameError exception”
“If the scripts is obfuscated by non super mode and python is 3.7 and later, please obfuscate the scrits by super mode. Or refine the scripts, do not obfuscate the object method del. For example”

First tried the lambda_ trick, didn’t worked.

So then tried to switch to “Super Mode”:
https://pyarmor.readthedocs.io/en/latest/mode.html#super-mode

It didn’t worked OOTB, had to fix dozens of problems along the way, with building the obfuscated wheel with that new mode, finally got it working locally, pushed it to gitlab CI and…

ERROR No available dynamic library for linux.aarch64.11.py36 with features ['11']

Just tracked it down:
https://pyarmor.readthedocs.io/en/latest/platforms.html

and "Table-3. The Prebuilt Extensions For Super Mode" clearly indicates that python 3.6 is not supported for both platforms that I need to support!

How can I handle this issue?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions