Skip to content

[BUG] pyarmor 9 + py3.12 bad output TypeError: 'str' object is not callable / protection exception  #2064

@cjavad

Description

@cjavad

I noticed a certain subset of builds were compiling perfectly fine, but produced output that failed when run, this was particular noticeable since it was a file that exported some constant dicts that another file simply imported.

This issue happened exclusively on python 3.12.9 and 3.12.8 (i have not tested any other versions) but not on 3.13 or 3.11 (latest patch releases) all with pyarmor 9.0.7.

I was able to produce a minimal reproducible example by cutting things away while still conversing the issue. Certain modifications to the source file led to other messages such as TypeError: 'bytes' object is not callable instead of str and the general protection exception. But the current state of the repo gives the original str error message which was the file i tracked down. This happened with the most minimal setting --obf-code 1 but not 0, both with Trial, Pro and CI license. The log file attached is performed in a reproducable enviroment (docker python3.12-bookworm) with only pyarmor and the source file.

bad_file.py.txt
pyarmor.debug.log

docker run --rm -it -v "$(pwd):/app" python:3.12-bookworm bash   
pip install pyarmor
cd app
mv bad_file.py.txt bad_file.py
# Works without pyarmor
python bad_file.py
# Pyarmor completes successfully
pyarmor gen bad_file.py
# Fails after pyarmor step
pushd dist/; python bad_file.py; popd

It is expected that the file (which is just a single dictionary) should work fine under pyarmor, and it does except for with python 3.12.

Let me know if any additional information is required. If required i can provide the file (with the exact same issue) that i derived the minimal test file from.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions