Excluding a name keeps the def, but references to it are still renamed, so the call raises NameError.
Input
main.py
from pkg.core import run
print(run())
pkg/__init__.py - empty package marker
pkg/core.py
def run():
def worker():
return 1
return worker()
Steps
pyarmor init -s . -p pkg -e main.py
pyarmor env -p push rft:exclude_names 'worker'
pyarmor build --rft
Refactored output (the inconsistency)
dist/pkg/core.py
def pyarmor__1():
def worker():
return 1
return pyarmor__2()
Running the refactored code:
Traceback (most recent call last):
File "main.py", line 2, in <module>
print(pyarmor__1())
^^^^^^^^^^^^
File "pkg/core.py", line 5, in pyarmor__1
return pyarmor__2()
^^^^^^^^^^
NameError: name 'pyarmor__2' is not defined. Did you mean: 'pyarmor__1'?
Environment
- PyArmor: 9.2.7 (pro), build 005037
- Python: 3.11.9
- Platform: windows.x86_64 (Windows 11)
- Mode: RFT (
pyarmor build --rft)
Excluding a name keeps the def, but references to it are still renamed, so the call raises NameError.
Input
main.pypkg/__init__.py- empty package markerpkg/core.pySteps
Refactored output (the inconsistency)
dist/pkg/core.pyRunning the refactored code:
Environment
pyarmor build --rft)