Skip to content

pycryptodom fails to run with CFFI and PYTHONOPTIMIZE=2 due to using cffi in-line ABI mode #228

Closed
@schlenk

Description

@schlenk

Hi,

when using the cffi backend with optimize (PYTHONOPTIMIZE=2) the loading of cryptodome fails due to a bug in pycparser (see eliben/pycparser#198 ). See below for the error.

It should be possible to work around that issue, if pycryptodome used the 'out-of-line' feature of cffi, to compile/produce the API wrappers upfront during installation. See https://cffi.readthedocs.io/en/latest/cdef.html#ffibuilder-set-source-preparing-out-of-line-modules

As a side effect, using the out-of-line mode for cffi would speed up import times and reduce the memory footprint.

C:\>c:\Python27_x64\python.exe -OO -m Cryptodome.SelfTest
This leads to an error on load.
c:\Python27_x64\lib\site-packages\pycparser\c_parser.py:20: RuntimeWarning: parsing methods must have __doc__ for pycparser to work properly class CParser(PLYParser): WARNING: There was a problem loading the table file: KeyError('p_direct_id_declarator_1',)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions