Bug 1952522 - python-cryptography fails to build with Python 3.10: AssertionError: assert '<TLSFeature(...us_request])>' == '<TLSFeature(...equest: 5>])>'
Summary: python-cryptography fails to build with Python 3.10: AssertionError: assert '...
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: python-cryptography
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ---
Assignee: Christian Heimes
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: PYTHON3.10
TreeView+ depends on / blocked
 
Reported: 2021-04-22 13:12 UTC by Tomáš Hrnčiar
Modified: 2021-06-14 10:35 UTC (History)
7 users (show)

Fixed In Version: python-cryptography-3.4.7-2.fc35
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-06-14 10:35:08 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github pyca cryptography issues 5995 0 None open tests are failing with Python 3.10.0a7 due to change in repr() 2021-05-10 12:20:24 UTC
Github pyca cryptography pull 6042 0 None open Use well-defined enum representation 2021-05-10 12:20:24 UTC

Description Tomáš Hrnčiar 2021-04-22 13:12:38 UTC
python-cryptography fails to build with Python 3.10.0a7.

=================================== FAILURES ===================================
___________________________ TestTLSFeature.test_repr ___________________________

self = <tests.x509.test_x509_ext.TestTLSFeature object at 0x7f157d40cbe0>

    def test_repr(self):
        ext1 = x509.TLSFeature([x509.TLSFeatureType.status_request])
>       assert repr(ext1) == (
            "<TLSFeature(features=[<TLSFeatureType.status_request: 5>])>"
        )
E       AssertionError: assert '<TLSFeature(...us_request])>' == '<TLSFeature(...equest: 5>])>'
E         - <TLSFeature(features=[<TLSFeatureType.status_request: 5>])>
E         ?                       -                             ----
E         + <TLSFeature(features=[TLSFeatureType.status_request])>

tests/x509/test_x509_ext.py:150: AssertionError
___________________________ TestCRLReason.test_repr ____________________________

self = <tests.x509.test_x509_ext.TestCRLReason object at 0x7f157d40ece0>

    def test_repr(self):
        reason1 = x509.CRLReason(x509.ReasonFlags.unspecified)
>       assert repr(reason1) == ("<CRLReason(reason=ReasonFlags.unspecified)>")
E       AssertionError: assert '<CRLReason(r...unspecified)>' == '<CRLReason(r...unspecified)>'
E         - <CRLReason(reason=ReasonFlags.unspecified)>
E         ?                   ------------
E         + <CRLReason(reason=unspecified)>

tests/x509/test_x509_ext.py:344: AssertionError
_______________________ TestDistributionPoint.test_repr ________________________

self = <tests.x509.test_x509_ext.TestDistributionPoint object at 0x7f157d23eb00>

    def test_repr(self):
        dp = x509.DistributionPoint(
            None,
            x509.RelativeDistinguishedName(
                [x509.NameAttribute(NameOID.COMMON_NAME, "myCN")]
            ),
            frozenset([x509.ReasonFlags.ca_compromise]),
            [
                x509.DirectoryName(
                    x509.Name(
                        [
                            x509.NameAttribute(
                                NameOID.COMMON_NAME, "Important CA"
                            )
                        ]
                    )
                )
            ],
        )
>       assert repr(dp) == (
            "<DistributionPoint(full_name=None, relative_name=<RelativeDis"
            "tinguishedName(CN=myCN)>, reasons=frozenset({<ReasonFlags.ca_"
            "compromise: 'cACompromise'>}), crl_issuer=[<DirectoryName(val"
            "ue=<Name(CN=Important CA)>)>])>"
        )
E       AssertionError: assert '<Distributio...ant CA)>)>])>' == '<Distributio...ant CA)>)>])>'
E         Skipping 96 identical leading characters in diff, use -v to show
E         - rozenset({<ReasonFlags.ca_compromise: 'cACompromise'>}), crl_issuer=[<DirectoryName(value=<Name(CN=Important CA)>)>])>
E         ?           -                         -----------------
E         + rozenset({ReasonFlags.ca_compromise}), crl_issuer=[<DirectoryName(value=<Name(CN=Important CA)>)>])>

tests/x509/test_x509_ext.py:3806: AssertionError
__________________________ TestFreshestCRL.test_repr ___________________________

self = <tests.x509.test_x509_ext.TestFreshestCRL object at 0x7f157d40c280>

    def test_repr(self):
        fcrl = x509.FreshestCRL(
            [
                x509.DistributionPoint(
                    [x509.UniformResourceIdentifier("ftp://domain")],
                    None,
                    frozenset([x509.ReasonFlags.key_compromise]),
                    None,
                ),
            ]
        )
>       assert repr(fcrl) == (
            "<FreshestCRL([<DistributionPoint(full_name=[<Unifo"
            "rmResourceIdentifier(value='ftp://domain')>], relative"
            "_name=None, reasons=frozenset({<ReasonFlags.key_compromise: "
            "'keyCompromise'>}), crl_issuer=None)>])>"
        )
E       AssertionError: assert '<FreshestCRL...uer=None)>])>' == '<FreshestCRL...uer=None)>])>'
E         Skipping 125 identical leading characters in diff, use -v to show
E         - rozenset({<ReasonFlags.key_compromise: 'keyCompromise'>}), crl_issuer=None)>])>
E         ?           -                          ------------------
E         + rozenset({ReasonFlags.key_compromise}), crl_issuer=None)>])>

tests/x509/test_x509_ext.py:3909: AssertionError
_____________________ TestCRLDistributionPoints.test_repr ______________________

self = <tests.x509.test_x509_ext.TestCRLDistributionPoints object at 0x7f157d2655a0>

    def test_repr(self):
        cdp = x509.CRLDistributionPoints(
            [
                x509.DistributionPoint(
                    [x509.UniformResourceIdentifier("ftp://domain")],
                    None,
                    frozenset([x509.ReasonFlags.key_compromise]),
                    None,
                ),
            ]
        )
>       assert repr(cdp) == (
            "<CRLDistributionPoints([<DistributionPoint(full_name=[<Unifo"
            "rmResourceIdentifier(value='ftp://domain')>], relative"
            "_name=None, reasons=frozenset({<ReasonFlags.key_compromise: "
            "'keyCompromise'>}), crl_issuer=None)>])>"
        )
E       AssertionError: assert '<CRLDistribu...uer=None)>])>' == '<CRLDistribu...uer=None)>])>'
E         Skipping 135 identical leading characters in diff, use -v to show
E         - rozenset({<ReasonFlags.key_compromise: 'keyCompromise'>}), crl_issuer=None)>])>
E         ?           -                          ------------------
E         + rozenset({ReasonFlags.key_compromise}), crl_issuer=None)>])>

tests/x509/test_x509_ext.py:4166: AssertionError
_______________ TestIssuingDistributionPointExtension.test_repr ________________

self = <tests.x509.test_x509_ext.TestIssuingDistributionPointExtension object at 0x7f157d58db40>

    def test_repr(self):
        idp = x509.IssuingDistributionPoint(
            None,
            None,
            False,
            False,
            frozenset([x509.ReasonFlags.key_compromise]),
            False,
            False,
        )
>       assert repr(idp) == (
            "<IssuingDistributionPoint(full_name=None, relative_name=None,"
            " only_contains_user_certs=False, only_contains_ca_certs=False"
            ", only_some_reasons=frozenset({<ReasonFlags.key_compromise: '"
            "keyCompromise'>}), indirect_crl=False, only_contains_attribut"
            "e_certs=False)>"
        )
E       AssertionError: assert '<IssuingDist...certs=False)>' == '<IssuingDist...certs=False)>'
E         Skipping 143 identical leading characters in diff, use -v to show
E         - rozenset({<ReasonFlags.key_compromise: 'keyCompromise'>}), indirect_crl=False, only_contains_attribute_certs=False)>
E         ?           -                          ------------------
E         + rozenset({ReasonFlags.key_compromise}), indirect_crl=False, only_contains_attribute_certs=False)>

There were some changes in repr() in latest alpha of Python 3.10.
https://docs.python.org/3.10/whatsnew/changelog.html#python-3-10-0-alpha-7

bpo-40066: Enum: adjust repr() to show only enum and member name (not value, nor angle brackets) and str() to show only member name. Update and improve documentation to match.

bpo-40066: Enum’s repr() and str() have changed: repr() is now EnumClass.MemberName and str() is MemberName. Additionally, stdlib Enum’s whose contents are available as module attributes, such as RegexFlag.IGNORECASE, have their repr() as module.name, e.g. re.IGNORECASE.
https://bugs.python.org/issue40066


For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.10/fedora-rawhide-x86_64/02144773-python-cryptography/

For all our attempts to build python-cryptography with Python 3.10, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.10/package/python-cryptography/

Testing and mass rebuild of packages is happening in copr. You can follow these instructions to test locally in mock if your package builds with Python 3.10:
https://copr.fedorainfracloud.org/coprs/g/python/python3.10/

Let us know here if you have any questions.

Python 3.10 will be included in Fedora 35. To make that update smoother, we're building Fedora packages with early pre-releases of Python 3.10.
A build failure prevents us from testing all dependent packages (transitive [Build]Requires), so if this package is required a lot, it's important for us to get it fixed soon.
We'd appreciate help from the people who know this package best, but if you don't want to work on this now, let us know so we can try to work around it on our side.

Comment 1 Miro Hrončok 2021-05-10 10:46:01 UTC
With Python 3.10.0b1:

=================================== FAILURES ===================================
___________________________ TestTLSFeature.test_repr ___________________________

self = <tests.x509.test_x509_ext.TestTLSFeature object at 0x7faf75790d60>

    def test_repr(self):
        ext1 = x509.TLSFeature([x509.TLSFeatureType.status_request])
>       assert repr(ext1) == (
            "<TLSFeature(features=[<TLSFeatureType.status_request: 5>])>"
        )
E       AssertionError: assert '<TLSFeature(...us_request])>' == '<TLSFeature(...equest: 5>])>'
E         - <TLSFeature(features=[<TLSFeatureType.status_request: 5>])>
E         ?                       -                             ----
E         + <TLSFeature(features=[TLSFeatureType.status_request])>

tests/x509/test_x509_ext.py:150: AssertionError
___________________________ TestCRLReason.test_repr ____________________________

self = <tests.x509.test_x509_ext.TestCRLReason object at 0x7faf75792b90>

    def test_repr(self):
        reason1 = x509.CRLReason(x509.ReasonFlags.unspecified)
>       assert repr(reason1) == ("<CRLReason(reason=ReasonFlags.unspecified)>")
E       AssertionError: assert '<CRLReason(r...unspecified)>' == '<CRLReason(r...unspecified)>'
E         - <CRLReason(reason=ReasonFlags.unspecified)>
E         ?                   ------------
E         + <CRLReason(reason=unspecified)>

tests/x509/test_x509_ext.py:344: AssertionError
_______________________ TestDistributionPoint.test_repr ________________________

self = <tests.x509.test_x509_ext.TestDistributionPoint object at 0x7faf756287c0>

    def test_repr(self):
        dp = x509.DistributionPoint(
            None,
            x509.RelativeDistinguishedName(
                [x509.NameAttribute(NameOID.COMMON_NAME, "myCN")]
            ),
            frozenset([x509.ReasonFlags.ca_compromise]),
            [
                x509.DirectoryName(
                    x509.Name(
                        [
                            x509.NameAttribute(
                                NameOID.COMMON_NAME, "Important CA"
                            )
                        ]
                    )
                )
            ],
        )
>       assert repr(dp) == (
            "<DistributionPoint(full_name=None, relative_name=<RelativeDis"
            "tinguishedName(CN=myCN)>, reasons=frozenset({<ReasonFlags.ca_"
            "compromise: 'cACompromise'>}), crl_issuer=[<DirectoryName(val"
            "ue=<Name(CN=Important CA)>)>])>"
        )
E       AssertionError: assert '<Distributio...ant CA)>)>])>' == '<Distributio...ant CA)>)>])>'
E         Skipping 96 identical leading characters in diff, use -v to show
E         - rozenset({<ReasonFlags.ca_compromise: 'cACompromise'>}), crl_issuer=[<DirectoryName(value=<Name(CN=Important CA)>)>])>
E         ?           -                         -----------------
E         + rozenset({ReasonFlags.ca_compromise}), crl_issuer=[<DirectoryName(value=<Name(CN=Important CA)>)>])>

tests/x509/test_x509_ext.py:3806: AssertionError
__________________________ TestFreshestCRL.test_repr ___________________________

self = <tests.x509.test_x509_ext.TestFreshestCRL object at 0x7faf757910f0>

    def test_repr(self):
        fcrl = x509.FreshestCRL(
            [
                x509.DistributionPoint(
                    [x509.UniformResourceIdentifier("ftp://domain")],
                    None,
                    frozenset([x509.ReasonFlags.key_compromise]),
                    None,
                ),
            ]
        )
>       assert repr(fcrl) == (
            "<FreshestCRL([<DistributionPoint(full_name=[<Unifo"
            "rmResourceIdentifier(value='ftp://domain')>], relative"
            "_name=None, reasons=frozenset({<ReasonFlags.key_compromise: "
            "'keyCompromise'>}), crl_issuer=None)>])>"
        )
E       AssertionError: assert '<FreshestCRL...uer=None)>])>' == '<FreshestCRL...uer=None)>])>'
E         Skipping 125 identical leading characters in diff, use -v to show
E         - rozenset({<ReasonFlags.key_compromise: 'keyCompromise'>}), crl_issuer=None)>])>
E         ?           -                          ------------------
E         + rozenset({ReasonFlags.key_compromise}), crl_issuer=None)>])>

tests/x509/test_x509_ext.py:3909: AssertionError
_____________________ TestCRLDistributionPoints.test_repr ______________________

self = <tests.x509.test_x509_ext.TestCRLDistributionPoints object at 0x7faf75629d20>

    def test_repr(self):
        cdp = x509.CRLDistributionPoints(
            [
                x509.DistributionPoint(
                    [x509.UniformResourceIdentifier("ftp://domain")],
                    None,
                    frozenset([x509.ReasonFlags.key_compromise]),
                    None,
                ),
            ]
        )
>       assert repr(cdp) == (
            "<CRLDistributionPoints([<DistributionPoint(full_name=[<Unifo"
            "rmResourceIdentifier(value='ftp://domain')>], relative"
            "_name=None, reasons=frozenset({<ReasonFlags.key_compromise: "
            "'keyCompromise'>}), crl_issuer=None)>])>"
        )
E       AssertionError: assert '<CRLDistribu...uer=None)>])>' == '<CRLDistribu...uer=None)>])>'
E         Skipping 135 identical leading characters in diff, use -v to show
E         - rozenset({<ReasonFlags.key_compromise: 'keyCompromise'>}), crl_issuer=None)>])>
E         ?           -                          ------------------
E         + rozenset({ReasonFlags.key_compromise}), crl_issuer=None)>])>

tests/x509/test_x509_ext.py:4166: AssertionError
_______________ TestIssuingDistributionPointExtension.test_repr ________________

self = <tests.x509.test_x509_ext.TestIssuingDistributionPointExtension object at 0x7faf759183a0>

    def test_repr(self):
        idp = x509.IssuingDistributionPoint(
            None,
            None,
            False,
            False,
            frozenset([x509.ReasonFlags.key_compromise]),
            False,
            False,
        )
>       assert repr(idp) == (
            "<IssuingDistributionPoint(full_name=None, relative_name=None,"
            " only_contains_user_certs=False, only_contains_ca_certs=False"
            ", only_some_reasons=frozenset({<ReasonFlags.key_compromise: '"
            "keyCompromise'>}), indirect_crl=False, only_contains_attribut"
            "e_certs=False)>"
        )
E       AssertionError: assert '<IssuingDist...certs=False)>' == '<IssuingDist...certs=False)>'
E         Skipping 143 identical leading characters in diff, use -v to show
E         - rozenset({<ReasonFlags.key_compromise: 'keyCompromise'>}), indirect_crl=False, only_contains_attribute_certs=False)>
E         ?           -                          ------------------
E         + rozenset({ReasonFlags.key_compromise}), indirect_crl=False, only_contains_attribute_certs=False)>

tests/x509/test_x509_ext.py:5028: AssertionError
= 6 failed, 2707 passed, 6056 skipped, 12 deselected, 86527 warnings in 124.47s (0:02:04) =


Setting severity to high, this blocks at least 41 other packages in the testing Copr.

Comment 2 Christian Heimes 2021-05-10 12:20:24 UTC
Tomáš Hrnčiar created upstream ticket https://github.com/pyca/cryptography/issues/5995. I have opened upstream PR https://github.com/pyca/cryptography/pull/6042 to fix the issue. I'll backport the fix to PyCA cryptography 3.4 branch and Rawhide after it has landed in main branch.

Comment 3 Miro Hrončok 2021-05-10 14:25:27 UTC
> I'll backport the fix to PyCA cryptography 3.4 branch and Rawhide after it has landed in main branch.

BTW if you want to check if it builds in the Python 3.10 copr, you can open a downstream PR and than observe https://copr.fedorainfracloud.org/coprs/g/python/python3.10/builds/?dirname=python3.10:pr:<pr_number_here>

Comment 4 Christian Heimes 2021-05-11 09:08:33 UTC
I have backported my fix to 3.4 branch and pushed a new build. It also includes OpenSSL 3.0.0 compatibility patches.

https://koji.fedoraproject.org/koji/taskinfo?taskID=67681495

Comment 5 Miro Hrončok 2021-06-04 20:15:08 UTC
This is a mass-posted update. Sorry if it is not 100% accurate to this bugzilla.


The Python 3.10 rebuild is in progress in a Koji side tag. If you manage to fix the problem, please commit the fix in the rawhide branch, but don't build the package in regular rawhide.

You can either build the package in the side tag, with:

    $ fedpkg build --target=f35-python

Or you can the build and we will eventually build it for you.

Note that the rebuild is still in progress, so not all (build) dependencies of this package might be available right away.

Thanks.

See also https://fedoraproject.org/wiki/Changes/Python3.10

If you have general questions about the rebuild, please use this mailing list thread: https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/G47SGOYIQLRDTWGOSLSWERZSSHXDEDH5/

Comment 6 Miro Hrončok 2021-06-07 22:59:37 UTC
The f35-python side tag has been merged to Rawhide. From now on, build as you would normally build.

Comment 7 Miro Hrončok 2021-06-14 10:35:08 UTC
This package was successfully rebuilt with Python 3.10.

If you need this bugzilla open for tracking purposes, sorry for the automatic closing: feel free to reopen it.


Note You need to log in before you can comment on or make changes to this bug.