-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Description
Hi,
Since cryptography 38 it is no longer possible to use copy/deepcopy with some (many?) cryptography objects. I assume that this is due to them being ported to Rust (which is not at all mentioned in the changelog, btw :-(). One example I have found is ObjectIdentifier, but I assume there may be others:
>>> import copy
>>> from cryptography import x509
>>> copy.copy(x509.NameOID.COMMON_NAME)
...
TypeError: cannot pickle 'builtins.ObjectIdentifier' object
>>> copy.deepcopy(x509.NameOID.COMMON_NAME)
...
TypeError: cannot pickle 'builtins.ObjectIdentifier' objectThis can easily cause problems in Python code:
>>> class Test:
... def __init__(self, oid):
... self.oid = oid
>>> copy.deepcopy(Test(x509.NameOID.COMMON_NAME))
...
TypeError: cannot pickle 'builtins.ObjectIdentifier' object
>>> copy.deepcopy({x509.NameOID.COMMON_NAME: 'CommonName'})
...
TypeError: cannot pickle 'builtins.ObjectIdentifier' objectThis works in cryptography==37.0.4:
>>> copy.deepcopy({x509.NameOID.COMMON_NAME: 'CommonName'})
{<ObjectIdentifier(oid=2.5.4.3, name=commonName)>: 'CommonName'}
The copy module says that implementing copy/deepcopy would fix the issue (so no, no pickle required).
Can we implement this again? I'm not a Rust developer, but I'm willing to try of course.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels