Skip to content

pytak >= 7.3.9 fails to import when 'cryptography' is not installed #97

Description

@freol35241

7.3.9 added a def _pkcs12_friendly_name(cert: Certificate) at src/pytak/crypto_functions.py:124, but Certificate is only imported inside a try: from cryptography.x509 import Certificate ... except ImportError: guard. Without the with-crypto extra, Python evaluates the annotation at module load and raises NameError, breaking import pytak.

Repro: pip install pytak==7.3.10 && python -c "import pytak". Worked in 7.3.7.

Potential fix: from __future__ import annotations at the top of crypto_functions.py, defers annotation evaluation, no semantics change.

Same root cause also affects L135, L161-162, L183.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions