Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Bug in obfuscating Numpy 1.22.4 #904

Closed
bramth opened this issue Dec 23, 2022 · 1 comment
Closed

[BUG] Bug in obfuscating Numpy 1.22.4 #904

bramth opened this issue Dec 23, 2022 · 1 comment
Assignees
Labels

Comments

@bramth
Copy link

bramth commented Dec 23, 2022

After packing with the following command,

pyarmor pack -e "--hidden-import lxml._elementpath --onefile --clean --upx-dir C:\Users\bram\Projects -y --key XXX --icon myicon.ico" app.py

the following error is thrown when obfuscating Numpy 1.22.4 (it seems):

INFO            env\Lib\site-packages\numpy\core\tests\test_protocols.py -> dist\obf\env\Lib\site-packages\numpy\core\tests\test_protocols.py
INFO            env\Lib\site-packages\numpy\core\tests\test_records.py -> dist\obf\env\Lib\site-packages\numpy\core\tests\test_records.py
INFO            env\Lib\site-packages\numpy\core\tests\test_regression.py -> dist\obf\env\Lib\site-packages\numpy\core\tests\test_regression.py
ERROR    invalid character '©' (U+00A9) (<frozen env.Lib.site-packages.numpy.core.tests.test_regression>, line 2527)
ERROR    Run command failed

I'm using the following environment:

# Name                    Version                   Build  Channel
altgraph                  0.17.3          py310haa95532_0
atomicwrites              1.4.0                      py_0
attrs                     22.1.0          py310haa95532_0
blas                      1.0                         mkl
bottleneck                1.3.5           py310h9128911_0
brotlipy                  0.7.0           py310h2bbff1b_1002
bzip2                     1.0.8                he774522_0
ca-certificates           2022.12.7            h5b45459_0    conda-forge
certifi                   2022.12.7          pyhd8ed1ab_0    conda-forge
cffi                      1.15.1          py310h2bbff1b_3
charset-normalizer        2.0.4              pyhd3eb1b0_0
colorama                  0.4.5           py310haa95532_0
conda                     22.11.1         py310h5588dad_1    conda-forge
conda-package-handling    1.9.0           py310h8cc25b3_1
coverage                  6.3.2           py310h2bbff1b_0
cryptography              38.0.1          py310h21b164f_0
future                    0.18.2          py310haa95532_1
idna                      3.4             py310haa95532_0
iniconfig                 1.1.1              pyhd3eb1b0_0
intel-openmp              2021.4.0          haa95532_3556
libblas                   3.9.0           1_h8933c1f_netlib    conda-forge
libcblas                  3.9.0           5_hd5c7e75_netlib    conda-forge
libffi                    3.4.2                hd77b12b_6
libiconv                  1.16                 h2bbff1b_2
liblapack                 3.9.0           5_hd5c7e75_netlib    conda-forge
libxml2                   2.9.14               h0ad7f3c_0
libxslt                   1.1.35               h2bbff1b_0
lxml                      4.9.1           py310h1985fb9_0
m2w64-gcc-libgfortran     5.3.0                         6    conda-forge
m2w64-gcc-libs            5.3.0                         7    conda-forge
m2w64-gcc-libs-core       5.3.0                         7    conda-forge
m2w64-gmp                 6.1.0                         2    conda-forge
m2w64-libwinpthread-git   5.0.0.4634.697f757               2    conda-forge
macholib                  1.16.2          py310haa95532_0
menuinst                  1.4.19          py310h59b6b97_0
msys2-conda-epoch         20160418                      1    conda-forge
munch                     2.5.0                      py_0    conda-forge
nomkl                     1.0                  h5ca1d4c_0    conda-forge
numexpr                   2.8.3           py310h32c9954_100    conda-forge
numpy                     1.22.4          py310hed7ac4c_0    conda-forge
openssl                   1.1.1s               h2bbff1b_0
packaging                 22.0            py310haa95532_0
pandas                    1.4.4           py310hd77b12b_0
pefile                    2022.5.30       py310haa95532_0
pip                       22.2.2          py310haa95532_0
pluggy                    1.0.0           py310haa95532_1
py                        1.11.0             pyhd3eb1b0_0
pyarmor                   7.7.4                    pypi_0    pypi
pycosat                   0.6.4           py310h2bbff1b_0
pycparser                 2.21               pyhd3eb1b0_0
pycryptodome              3.15.0          py310h2bbff1b_0
pyinstaller               4.8             py310h8cc25b3_0
pyopenssl                 22.0.0             pyhd3eb1b0_0
pysocks                   1.7.1           py310haa95532_0
pytest                    7.1.2           py310haa95532_0
pytest-check              1.0.10                   pypi_0    pypi
pytest-cov                3.0.0              pyhd3eb1b0_0
python                    3.10.6               hbb2ffb3_0
python-dateutil           2.8.2              pyhd3eb1b0_0
python_abi                3.10                    2_cp310    conda-forge
pytz                      2022.7          py310haa95532_0
pywin32                   305             py310h2bbff1b_0
pywin32-ctypes            0.2.0           py310haa95532_1000
pyyaml                    6.0             py310he2412df_4    conda-forge
requests                  2.28.1          py310haa95532_0
ruamel.yaml               0.17.21         py310h2bbff1b_0
ruamel.yaml.clib          0.2.6           py310h2bbff1b_1
setuptools                65.5.0          py310haa95532_0
six                       1.16.0             pyhd3eb1b0_1
sqlite                    3.40.0               h2bbff1b_0
tinyaes                   1.0.4                    pypi_0    pypi
tk                        8.6.12               h2bbff1b_0
toml                      0.10.2             pyhd3eb1b0_0
tomli                     2.0.1           py310haa95532_0
toolz                     0.12.0          py310haa95532_0
tqdm                      4.64.1          py310haa95532_0
tzdata                    2022g                h04d1e81_0
urllib3                   1.26.13         py310haa95532_0
vc                        14.2                 h21ff451_1
vs2015_runtime            14.27.29016          h5e58377_2
wheel                     0.37.1             pyhd3eb1b0_0
win_inet_pton             1.1.0           py310haa95532_0
wincertstore              0.2             py310haa95532_2
xz                        5.2.8                h8cc25b3_0
yaml                      0.2.5                he774522_0
my_own_packacge               0.0.1                     dev_0    <develop>
zlib                      1.2.13               h8cc25b3_0

Any ideas?

@bramth
Copy link
Author

bramth commented Dec 23, 2022

Removing the test on line 2523 of the test_regression.py file seems to work as a temporary solution:

    # def test_frompyfunc_name(self):
    #     # name conversion was failing for python 3 strings
    #     # resulting in the default '?' name. Also test utf-8
    #     # encoding using non-ascii name.
    #     def cassé(x):
    #         return x
    #
    #     f = np.frompyfunc(cassé, 1, 1)
    #     assert str(f) == "<ufunc 'cassé (vectorized)'>"

@jondy jondy closed this as completed Mar 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants