pycryptodome icon indicating copy to clipboard operation
pycryptodome copied to clipboard

Broken Python 2.7 compatibility

Open pysquared opened this issue 6 months ago • 2 comments

Firstly, many thanks for this project. I have to support legacy Python 2.7 systems, and it is invaluable.

I have been using version 3.18.0, but when upgrading to 3.23.0, my package failed to build the pyc files as follows:

These 3 modules have type annotations:

  Cipher/_mode_kw.py
  Cipher/_mode_kwp.py
  Protocol/HPKE.py

This file has a different SyntaxError on line 411 which from __future__ import print_function would fix: SelfTest/Protocol/test_HPKE.py # Line 411: print(".", end="", flush=True)

pysquared avatar Jun 12 '25 12:06 pysquared

Can you provide more information on how the package "failed to build the pyc files"?

That test case (test_HPKE.py) is indeed Python 3-only, but it will only be called if you explicitly use it. Normally, it will be skipped.

Legrandin avatar Jun 13 '25 19:06 Legrandin

I have a script which uses something similar to "pycompile -V2.7 -v ." to generate pyc files for production. It falls over on the 4 files I mentioned. Thanks for explaining test_HPKE.py is irrelevant (I will exclude the whole "SelfTest" dir in my build).

pysquared avatar Jun 16 '25 14:06 pysquared