Skip to content

Python 3.11 named tuple behavior change #76

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

Closed
dbluhm opened this issue Jan 2, 2023 · 1 comment
Closed

Python 3.11 named tuple behavior change #76

dbluhm opened this issue Jan 2, 2023 · 1 comment
Assignees

Comments

@dbluhm
Copy link
Contributor

dbluhm commented Jan 2, 2023

It would seem that in python 3.11, named tuples aren't behaving exactly the same way as before. I am getting the following error when attempting to pack a message:

alg = <AuthCryptAlg.A256CBC_HS512_ECDH_1PU_A256KW: ('ECDH-1PU+A256KW', 'A256CBC-HS512')>

    def _build_header(to: List[Key], frm: Key, alg: AuthCryptAlg):
        skid = frm.kid
        kids = [to_key.kid for to_key in to]

        apu = to_unicode(urlsafe_b64encode(to_bytes(skid)))
        apv = calculate_apv(kids)
        protected = {
            "typ": DIDCommMessageTypes.ENCRYPTED.value,
>           "alg": alg.value.alg,
            "enc": alg.value.enc,
            "apu": apu,
            "apv": apv,
            "skid": skid,
        }
E       AttributeError: 'tuple' object has no attribute 'alg'

.venv/lib/python3.11/site-packages/didcomm/core/authcrypt.py:129: AttributeError
@dkulic dkulic self-assigned this Feb 20, 2023
@dkulic
Copy link
Contributor

dkulic commented Feb 20, 2023

This was a python regression which is fixed in 3.11.2: python/cpython#100098
I tested with this python interpreter and confirmed that it is working without issues.

Closing the ticket.

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

No branches or pull requests

2 participants