~mcepl/m2crypto#352: 
ASN1_* classes have completely wrong signatures

class ASN1_Integer(object):

    def __init__(self, asn1int: ASN1_Integer, _pyfree: int = 0):
        self.asn1int = asn1int
        self._pyfree = _pyfree

is just wrong: we have to keep stable API, but could we at least optionally accept plain str, int, etc.?

Status
RESOLVED FIXED
Submitter
~mcepl
Assigned to
No-one
Submitted
29 days ago
Updated
11 days ago
Labels
milestone-0.42

~mcepl 13 days ago

tumbleweed-pkg~/r/m2crypto (352_ASN1_signatures)$ python3 -munittest -v tests.test_asn1
test_BitSTring (tests.test_asn1.ASN1TestCase.test_BitSTring) ... ok
test_Integer (tests.test_asn1.ASN1TestCase.test_Integer) ... ERROR
Exception ignored in: <function ASN1_Integer.__del__ at 0x7fd1dbdea520>
Traceback (most recent call last):
  File "/home/matej/archiv/knihovna/repos/m2crypto/build/lib.linux-x86_64-cpython-311/M2Crypto/ASN1.py", line 47, in __del__
    self.m2_asn1_integer_free(self.asn1int)
TypeError: in method 'asn1_integer_free', argument 1 of type 'ASN1_INTEGER *'
test_Object (tests.test_asn1.ASN1TestCase.test_Object) ... ok
test_String_legacy (tests.test_asn1.ASN1TestCase.test_String_legacy) ... ok
test_TIME (tests.test_asn1.ASN1TestCase.test_TIME) ... ok
test_TIME_datetime (tests.test_asn1.ASN1TestCase.test_TIME_datetime) ... ok
test_UTCTIME (tests.test_asn1.ASN1TestCase.test_UTCTIME) ... ok
test_UTCTIME_datetime (tests.test_asn1.ASN1TestCase.test_UTCTIME_datetime) ... ok

======================================================================
ERROR: test_Integer (tests.test_asn1.ASN1TestCase.test_Integer)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/matej/archiv/knihovna/repos/m2crypto/tests/test_asn1.py", line 20, in test_Integer
    self.assertEqual(int(a_int), 42)
                     ^^^^^^^^^^
  File "/home/matej/archiv/knihovna/repos/m2crypto/build/lib.linux-x86_64-cpython-311/M2Crypto/ASN1.py", line 50, in __int__
    return m2.asn1_integer_get(self.asn1int)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: in method 'asn1_integer_get', argument 1 of type 'ASN1_INTEGER *'

----------------------------------------------------------------------
Ran 8 tests in 0.003s

FAILED (errors=1)
tumbleweed-pkg~/r/m2crypto (352_ASN1_signatures)$ 

~mcepl REPORTED FIXED 12 days ago

Matěj Cepl referenced this ticket in commit b374ef8.

~mcepl 11 days ago

Matěj Cepl referenced this ticket in commit 1c3c151.

~mcepl 11 days ago

Matěj Cepl referenced this ticket in commit 5b7c4de.

Register here or Log in to comment, or comment via email.