python-cryptography fails to build with Python 3.11.0a4. =================================== FAILURES =================================== ________________ TestAssertNoMemoryLeaks.test_no_leak_no_malloc ________________ self = <tests.hazmat.backends.test_openssl_memleak.TestAssertNoMemoryLeaks object at 0x7f34b115e110> def test_no_leak_no_malloc(self): > assert_no_memory_leaks( textwrap.dedent( """ def func(): pass """ ) ) tests/hazmat/backends/test_openssl_memleak.py:184: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ s = '\ndef func():\n pass\n' argv = ['/usr/bin/python3', '-c', '\ndef func():\n pass\n\n\n\nimport sys\n\n\ndef main(argv):\n import gc\n import ...n for ptr in remaining\n )))\n sys.stdout.flush()\n sys.exit(255)\n\nmain(sys.argv)\n'] def assert_no_memory_leaks(s, argv=[]): env = os.environ.copy() env["PYTHONPATH"] = os.pathsep.join(sys.path) # When using pytest-cov it attempts to instrument subprocesses. This # causes the memleak tests to raise exceptions. # we don't need coverage so we remove the env vars. env.pop("COV_CORE_CONFIG", None) env.pop("COV_CORE_DATAFILE", None) env.pop("COV_CORE_SOURCE", None) argv = [ sys.executable, "-c", "{}\n\n{}".format(s, MEMORY_LEAK_SCRIPT), ] + argv # Shell out to a fresh Python process because OpenSSL does not allow you to # install new memory hooks after the first malloc/free occurs. proc = subprocess.Popen( argv, env=env, stdout=subprocess.PIPE, stderr=subprocess.PIPE, ) assert proc.stdout is not None assert proc.stderr is not None try: proc.wait() if proc.returncode == 255: # 255 means there was a leak, load the info about what mallocs # weren't freed. out = json.loads(proc.stdout.read().decode()) raise AssertionError(out) elif proc.returncode != 0: # Any exception type will do to be honest > raise ValueError(proc.stdout.read(), proc.stderr.read()) E ValueError: (b'', b'Fatal Python error: init_threadstate: thread state already initialized\nPython runtime state: initialized\n\nThread 0x00007f74f4861741 (most recent call first):\n') tests/hazmat/backends/test_openssl_memleak.py:167: ValueError __________________ TestAssertNoMemoryLeaks.test_no_leak_free ___________________ self = <tests.hazmat.backends.test_openssl_memleak.TestAssertNoMemoryLeaks object at 0x7f34b10fd2d0> def test_no_leak_free(self): > assert_no_memory_leaks( textwrap.dedent( """ def func(): from cryptography.hazmat.bindings.openssl.binding import Binding b = Binding() name = b.lib.X509_NAME_new() b.lib.X509_NAME_free(name) """ ) ) tests/hazmat/backends/test_openssl_memleak.py:194: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ s = '\ndef func():\n from cryptography.hazmat.bindings.openssl.binding import Binding\n b = Binding()\n name = b.lib.X509_NAME_new()\n b.lib.X509_NAME_free(name)\n' argv = ['/usr/bin/python3', '-c', '\ndef func():\n from cryptography.hazmat.bindings.openssl.binding import Binding\n b...n for ptr in remaining\n )))\n sys.stdout.flush()\n sys.exit(255)\n\nmain(sys.argv)\n'] def assert_no_memory_leaks(s, argv=[]): env = os.environ.copy() env["PYTHONPATH"] = os.pathsep.join(sys.path) # When using pytest-cov it attempts to instrument subprocesses. This # causes the memleak tests to raise exceptions. # we don't need coverage so we remove the env vars. env.pop("COV_CORE_CONFIG", None) env.pop("COV_CORE_DATAFILE", None) env.pop("COV_CORE_SOURCE", None) argv = [ sys.executable, "-c", "{}\n\n{}".format(s, MEMORY_LEAK_SCRIPT), ] + argv # Shell out to a fresh Python process because OpenSSL does not allow you to # install new memory hooks after the first malloc/free occurs. proc = subprocess.Popen( argv, env=env, stdout=subprocess.PIPE, stderr=subprocess.PIPE, ) assert proc.stdout is not None assert proc.stderr is not None try: proc.wait() if proc.returncode == 255: # 255 means there was a leak, load the info about what mallocs # weren't freed. out = json.loads(proc.stdout.read().decode()) raise AssertionError(out) elif proc.returncode != 0: # Any exception type will do to be honest > raise ValueError(proc.stdout.read(), proc.stderr.read()) E ValueError: (b'', b'Fatal Python error: init_threadstate: thread state already initialized\nPython runtime state: initialized\n\nThread 0x00007fd1a47fa741 (most recent call first):\n') tests/hazmat/backends/test_openssl_memleak.py:167: ValueError ___________________ TestAssertNoMemoryLeaks.test_no_leak_gc ____________________ self = <tests.hazmat.backends.test_openssl_memleak.TestAssertNoMemoryLeaks object at 0x7f34b5dd5f10> def test_no_leak_gc(self): > assert_no_memory_leaks( textwrap.dedent( """ def func(): from cryptography.hazmat.bindings.openssl.binding import Binding b = Binding() name = b.lib.X509_NAME_new() b.ffi.gc(name, b.lib.X509_NAME_free) """ ) ) tests/hazmat/backends/test_openssl_memleak.py:207: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ s = '\ndef func():\n from cryptography.hazmat.bindings.openssl.binding import Binding\n b = Binding()\n name = b.lib.X509_NAME_new()\n b.ffi.gc(name, b.lib.X509_NAME_free)\n' argv = ['/usr/bin/python3', '-c', '\ndef func():\n from cryptography.hazmat.bindings.openssl.binding import Binding\n b...n for ptr in remaining\n )))\n sys.stdout.flush()\n sys.exit(255)\n\nmain(sys.argv)\n'] def assert_no_memory_leaks(s, argv=[]): env = os.environ.copy() env["PYTHONPATH"] = os.pathsep.join(sys.path) # When using pytest-cov it attempts to instrument subprocesses. This # causes the memleak tests to raise exceptions. # we don't need coverage so we remove the env vars. env.pop("COV_CORE_CONFIG", None) env.pop("COV_CORE_DATAFILE", None) env.pop("COV_CORE_SOURCE", None) argv = [ sys.executable, "-c", "{}\n\n{}".format(s, MEMORY_LEAK_SCRIPT), ] + argv # Shell out to a fresh Python process because OpenSSL does not allow you to # install new memory hooks after the first malloc/free occurs. proc = subprocess.Popen( argv, env=env, stdout=subprocess.PIPE, stderr=subprocess.PIPE, ) assert proc.stdout is not None assert proc.stderr is not None try: proc.wait() if proc.returncode == 255: # 255 means there was a leak, load the info about what mallocs # weren't freed. out = json.loads(proc.stdout.read().decode()) raise AssertionError(out) elif proc.returncode != 0: # Any exception type will do to be honest > raise ValueError(proc.stdout.read(), proc.stderr.read()) E ValueError: (b'', b'Fatal Python error: init_threadstate: thread state already initialized\nPython runtime state: initialized\n\nThread 0x00007f29c0f6d741 (most recent call first):\n') tests/hazmat/backends/test_openssl_memleak.py:167: ValueError ______________________ TestAssertNoMemoryLeaks.test_leak _______________________ self = <tests.hazmat.backends.test_openssl_memleak.TestAssertNoMemoryLeaks object at 0x7f34b10e35d0> def test_leak(self): with pytest.raises(AssertionError): > assert_no_memory_leaks( textwrap.dedent( """ def func(): from cryptography.hazmat.bindings.openssl.binding import ( Binding ) b = Binding() b.lib.X509_NAME_new() """ ) ) tests/hazmat/backends/test_openssl_memleak.py:221: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ s = '\ndef func():\n from cryptography.hazmat.bindings.openssl.binding import (\n Binding\n )\n b = Binding()\n b.lib.X509_NAME_new()\n' argv = ['/usr/bin/python3', '-c', '\ndef func():\n from cryptography.hazmat.bindings.openssl.binding import (\n Bin...n for ptr in remaining\n )))\n sys.stdout.flush()\n sys.exit(255)\n\nmain(sys.argv)\n'] def assert_no_memory_leaks(s, argv=[]): env = os.environ.copy() env["PYTHONPATH"] = os.pathsep.join(sys.path) # When using pytest-cov it attempts to instrument subprocesses. This # causes the memleak tests to raise exceptions. # we don't need coverage so we remove the env vars. env.pop("COV_CORE_CONFIG", None) env.pop("COV_CORE_DATAFILE", None) env.pop("COV_CORE_SOURCE", None) argv = [ sys.executable, "-c", "{}\n\n{}".format(s, MEMORY_LEAK_SCRIPT), ] + argv # Shell out to a fresh Python process because OpenSSL does not allow you to # install new memory hooks after the first malloc/free occurs. proc = subprocess.Popen( argv, env=env, stdout=subprocess.PIPE, stderr=subprocess.PIPE, ) assert proc.stdout is not None assert proc.stderr is not None try: proc.wait() if proc.returncode == 255: # 255 means there was a leak, load the info about what mallocs # weren't freed. out = json.loads(proc.stdout.read().decode()) raise AssertionError(out) elif proc.returncode != 0: # Any exception type will do to be honest > raise ValueError(proc.stdout.read(), proc.stderr.read()) E ValueError: (b'', b'Fatal Python error: init_threadstate: thread state already initialized\nPython runtime state: initialized\n\nThread 0x00007f4187883741 (most recent call first):\n') tests/hazmat/backends/test_openssl_memleak.py:167: ValueError _____________________ TestAssertNoMemoryLeaks.test_errors ______________________ self = <tests.hazmat.backends.test_openssl_memleak.TestAssertNoMemoryLeaks object at 0x7f34b2744c90> def test_errors(self): with pytest.raises(ValueError, match="ZeroDivisionError"): > assert_no_memory_leaks( textwrap.dedent( """ def func(): raise ZeroDivisionError """ ) ) tests/hazmat/backends/test_openssl_memleak.py:236: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ s = '\ndef func():\n raise ZeroDivisionError\n' argv = ['/usr/bin/python3', '-c', '\ndef func():\n raise ZeroDivisionError\n\n\n\nimport sys\n\n\ndef main(argv):\n imp...n for ptr in remaining\n )))\n sys.stdout.flush()\n sys.exit(255)\n\nmain(sys.argv)\n'] def assert_no_memory_leaks(s, argv=[]): env = os.environ.copy() env["PYTHONPATH"] = os.pathsep.join(sys.path) # When using pytest-cov it attempts to instrument subprocesses. This # causes the memleak tests to raise exceptions. # we don't need coverage so we remove the env vars. env.pop("COV_CORE_CONFIG", None) env.pop("COV_CORE_DATAFILE", None) env.pop("COV_CORE_SOURCE", None) argv = [ sys.executable, "-c", "{}\n\n{}".format(s, MEMORY_LEAK_SCRIPT), ] + argv # Shell out to a fresh Python process because OpenSSL does not allow you to # install new memory hooks after the first malloc/free occurs. proc = subprocess.Popen( argv, env=env, stdout=subprocess.PIPE, stderr=subprocess.PIPE, ) assert proc.stdout is not None assert proc.stderr is not None try: proc.wait() if proc.returncode == 255: # 255 means there was a leak, load the info about what mallocs # weren't freed. out = json.loads(proc.stdout.read().decode()) raise AssertionError(out) elif proc.returncode != 0: # Any exception type will do to be honest > raise ValueError(proc.stdout.read(), proc.stderr.read()) E ValueError: (b'', b'Fatal Python error: init_threadstate: thread state already initialized\nPython runtime state: initialized\n\nThread 0x00007f2661f95741 (most recent call first):\n') tests/hazmat/backends/test_openssl_memleak.py:167: ValueError During handling of the above exception, another exception occurred: self = <tests.hazmat.backends.test_openssl_memleak.TestAssertNoMemoryLeaks object at 0x7f34b2744c90> def test_errors(self): > with pytest.raises(ValueError, match="ZeroDivisionError"): E AssertionError: Regex pattern 'ZeroDivisionError' does not match "(b'', b'Fatal Python error: init_threadstate: thread state already initialized\\nPython runtime state: initialized\\n\\nThread 0x00007f2661f95741 (most recent call first):\\n')". tests/hazmat/backends/test_openssl_memleak.py:235: AssertionError _ TestOpenSSLMemoryLeaks.test_der_x509_certificate_extensions[x509/PKITS_data/certs/ValidcRLIssuerTest28EE.crt] _ self = <tests.hazmat.backends.test_openssl_memleak.TestOpenSSLMemoryLeaks object at 0x7f34b0fe6550> path = 'x509/PKITS_data/certs/ValidcRLIssuerTest28EE.crt' @pytest.mark.parametrize( "path", ["x509/PKITS_data/certs/ValidcRLIssuerTest28EE.crt"] ) def test_der_x509_certificate_extensions(self, path): > assert_no_memory_leaks( textwrap.dedent( """ def func(path): from cryptography import x509 from cryptography.hazmat.backends.openssl import backend import cryptography_vectors with cryptography_vectors.open_vector_file(path, "rb") as f: cert = x509.load_der_x509_certificate( f.read(), backend ) cert.extensions """ ), [path], ) tests/hazmat/backends/test_openssl_memleak.py:253: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ s = '\ndef func(path):\n from cryptography import x509\n from cryptography.hazmat.backends.openssl import backend\n\... f:\n cert = x509.load_der_x509_certificate(\n f.read(), backend\n )\n\n cert.extensions\n' argv = ['/usr/bin/python3', '-c', '\ndef func(path):\n from cryptography import x509\n from cryptography.hazmat.backend... sys.stdout.flush()\n sys.exit(255)\n\nmain(sys.argv)\n', 'x509/PKITS_data/certs/ValidcRLIssuerTest28EE.crt'] def assert_no_memory_leaks(s, argv=[]): env = os.environ.copy() env["PYTHONPATH"] = os.pathsep.join(sys.path) # When using pytest-cov it attempts to instrument subprocesses. This # causes the memleak tests to raise exceptions. # we don't need coverage so we remove the env vars. env.pop("COV_CORE_CONFIG", None) env.pop("COV_CORE_DATAFILE", None) env.pop("COV_CORE_SOURCE", None) argv = [ sys.executable, "-c", "{}\n\n{}".format(s, MEMORY_LEAK_SCRIPT), ] + argv # Shell out to a fresh Python process because OpenSSL does not allow you to # install new memory hooks after the first malloc/free occurs. proc = subprocess.Popen( argv, env=env, stdout=subprocess.PIPE, stderr=subprocess.PIPE, ) assert proc.stdout is not None assert proc.stderr is not None try: proc.wait() if proc.returncode == 255: # 255 means there was a leak, load the info about what mallocs # weren't freed. out = json.loads(proc.stdout.read().decode()) raise AssertionError(out) elif proc.returncode != 0: # Any exception type will do to be honest > raise ValueError(proc.stdout.read(), proc.stderr.read()) E ValueError: (b'', b'Fatal Python error: init_threadstate: thread state already initialized\nPython runtime state: initialized\n\nThread 0x00007fe418a96741 (most recent call first):\n') tests/hazmat/backends/test_openssl_memleak.py:167: ValueError _ TestOpenSSLMemoryLeaks.test_pem_x509_certificate_extensions[x509/cryptography.io.pem] _ self = <tests.hazmat.backends.test_openssl_memleak.TestOpenSSLMemoryLeaks object at 0x7f34b0fe5d10> path = 'x509/cryptography.io.pem' @pytest.mark.parametrize("path", ["x509/cryptography.io.pem"]) def test_pem_x509_certificate_extensions(self, path): > assert_no_memory_leaks( textwrap.dedent( """ def func(path): from cryptography import x509 from cryptography.hazmat.backends.openssl import backend import cryptography_vectors with cryptography_vectors.open_vector_file(path, "rb") as f: cert = x509.load_pem_x509_certificate( f.read(), backend ) cert.extensions """ ), [path], ) tests/hazmat/backends/test_openssl_memleak.py:275: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ s = '\ndef func(path):\n from cryptography import x509\n from cryptography.hazmat.backends.openssl import backend\n\... f:\n cert = x509.load_pem_x509_certificate(\n f.read(), backend\n )\n\n cert.extensions\n' argv = ['/usr/bin/python3', '-c', '\ndef func(path):\n from cryptography import x509\n from cryptography.hazmat.backend...ining\n )))\n sys.stdout.flush()\n sys.exit(255)\n\nmain(sys.argv)\n', 'x509/cryptography.io.pem'] def assert_no_memory_leaks(s, argv=[]): env = os.environ.copy() env["PYTHONPATH"] = os.pathsep.join(sys.path) # When using pytest-cov it attempts to instrument subprocesses. This # causes the memleak tests to raise exceptions. # we don't need coverage so we remove the env vars. env.pop("COV_CORE_CONFIG", None) env.pop("COV_CORE_DATAFILE", None) env.pop("COV_CORE_SOURCE", None) argv = [ sys.executable, "-c", "{}\n\n{}".format(s, MEMORY_LEAK_SCRIPT), ] + argv # Shell out to a fresh Python process because OpenSSL does not allow you to # install new memory hooks after the first malloc/free occurs. proc = subprocess.Popen( argv, env=env, stdout=subprocess.PIPE, stderr=subprocess.PIPE, ) assert proc.stdout is not None assert proc.stderr is not None try: proc.wait() if proc.returncode == 255: # 255 means there was a leak, load the info about what mallocs # weren't freed. out = json.loads(proc.stdout.read().decode()) raise AssertionError(out) elif proc.returncode != 0: # Any exception type will do to be honest > raise ValueError(proc.stdout.read(), proc.stderr.read()) E ValueError: (b'', b'Fatal Python error: init_threadstate: thread state already initialized\nPython runtime state: initialized\n\nThread 0x00007f88178e4741 (most recent call first):\n') tests/hazmat/backends/test_openssl_memleak.py:167: ValueError _______________ TestOpenSSLMemoryLeaks.test_x509_csr_extensions ________________ self = <tests.hazmat.backends.test_openssl_memleak.TestOpenSSLMemoryLeaks object at 0x7f34b10e3390> def test_x509_csr_extensions(self): > assert_no_memory_leaks( textwrap.dedent( """ def func(): from cryptography import x509 from cryptography.hazmat.backends.openssl import backend from cryptography.hazmat.primitives import hashes from cryptography.hazmat.primitives.asymmetric import rsa private_key = rsa.generate_private_key( key_size=2048, public_exponent=65537, backend=backend ) cert = x509.CertificateSigningRequestBuilder().subject_name( x509.Name([]) ).add_extension( x509.OCSPNoCheck(), critical=False ).sign(private_key, hashes.SHA256(), backend) cert.extensions """ ) ) tests/hazmat/backends/test_openssl_memleak.py:296: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ s = '\ndef func():\n from cryptography import x509\n from cryptography.hazmat.backends.openssl import backend\n f...n x509.OCSPNoCheck(), critical=False\n ).sign(private_key, hashes.SHA256(), backend)\n\n cert.extensions\n' argv = ['/usr/bin/python3', '-c', '\ndef func():\n from cryptography import x509\n from cryptography.hazmat.backends.op...n for ptr in remaining\n )))\n sys.stdout.flush()\n sys.exit(255)\n\nmain(sys.argv)\n'] def assert_no_memory_leaks(s, argv=[]): env = os.environ.copy() env["PYTHONPATH"] = os.pathsep.join(sys.path) # When using pytest-cov it attempts to instrument subprocesses. This # causes the memleak tests to raise exceptions. # we don't need coverage so we remove the env vars. env.pop("COV_CORE_CONFIG", None) env.pop("COV_CORE_DATAFILE", None) env.pop("COV_CORE_SOURCE", None) argv = [ sys.executable, "-c", "{}\n\n{}".format(s, MEMORY_LEAK_SCRIPT), ] + argv # Shell out to a fresh Python process because OpenSSL does not allow you to # install new memory hooks after the first malloc/free occurs. proc = subprocess.Popen( argv, env=env, stdout=subprocess.PIPE, stderr=subprocess.PIPE, ) assert proc.stdout is not None assert proc.stderr is not None try: proc.wait() if proc.returncode == 255: # 255 means there was a leak, load the info about what mallocs # weren't freed. out = json.loads(proc.stdout.read().decode()) raise AssertionError(out) elif proc.returncode != 0: # Any exception type will do to be honest > raise ValueError(proc.stdout.read(), proc.stderr.read()) E ValueError: (b'', b'Fatal Python error: init_threadstate: thread state already initialized\nPython runtime state: initialized\n\nThread 0x00007f003ae5c741 (most recent call first):\n') tests/hazmat/backends/test_openssl_memleak.py:167: ValueError __________ TestOpenSSLMemoryLeaks.test_ec_private_numbers_private_key __________ self = <tests.hazmat.backends.test_openssl_memleak.TestOpenSSLMemoryLeaks object at 0x7f34b0bfaad0> def test_ec_private_numbers_private_key(self): > assert_no_memory_leaks( textwrap.dedent( """ def func(): from cryptography.hazmat.backends.openssl import backend from cryptography.hazmat.primitives.asymmetric import ec ec.EllipticCurvePrivateNumbers( private_value=int( '280814107134858470598753916394807521398239633534281633982576099083' '35787109896602102090002196616273211495718603965098' ), public_numbers=ec.EllipticCurvePublicNumbers( curve=ec.SECP384R1(), x=int( '10036914308591746758780165503819213553101287571902957054148542' '504671046744460374996612408381962208627004841444205030' ), y=int( '17337335659928075994560513699823544906448896792102247714689323' '575406618073069185107088229463828921069465902299522926' ) ) ).private_key(backend) """ ) ) tests/hazmat/backends/test_openssl_memleak.py:320: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ s = "\ndef func():\n from cryptography.hazmat.backends.openssl import backend\n from cryptography.hazmat.primitives.... '575406618073069185107088229463828921069465902299522926'\n )\n )\n ).private_key(backend)\n" argv = ['/usr/bin/python3', '-c', '\ndef func():\n from cryptography.hazmat.backends.openssl import backend\n from cryp...n for ptr in remaining\n )))\n sys.stdout.flush()\n sys.exit(255)\n\nmain(sys.argv)\n'] def assert_no_memory_leaks(s, argv=[]): env = os.environ.copy() env["PYTHONPATH"] = os.pathsep.join(sys.path) # When using pytest-cov it attempts to instrument subprocesses. This # causes the memleak tests to raise exceptions. # we don't need coverage so we remove the env vars. env.pop("COV_CORE_CONFIG", None) env.pop("COV_CORE_DATAFILE", None) env.pop("COV_CORE_SOURCE", None) argv = [ sys.executable, "-c", "{}\n\n{}".format(s, MEMORY_LEAK_SCRIPT), ] + argv # Shell out to a fresh Python process because OpenSSL does not allow you to # install new memory hooks after the first malloc/free occurs. proc = subprocess.Popen( argv, env=env, stdout=subprocess.PIPE, stderr=subprocess.PIPE, ) assert proc.stdout is not None assert proc.stderr is not None try: proc.wait() if proc.returncode == 255: # 255 means there was a leak, load the info about what mallocs # weren't freed. out = json.loads(proc.stdout.read().decode()) raise AssertionError(out) elif proc.returncode != 0: # Any exception type will do to be honest > raise ValueError(proc.stdout.read(), proc.stderr.read()) E ValueError: (b'', b'Fatal Python error: init_threadstate: thread state already initialized\nPython runtime state: initialized\n\nThread 0x00007f4b21db6741 (most recent call first):\n') tests/hazmat/backends/test_openssl_memleak.py:167: ValueError ______________ TestOpenSSLMemoryLeaks.test_ec_derive_private_key _______________ self = <tests.hazmat.backends.test_openssl_memleak.TestOpenSSLMemoryLeaks object at 0x7f34b1048690> def test_ec_derive_private_key(self): > assert_no_memory_leaks( textwrap.dedent( """ def func(): from cryptography.hazmat.backends.openssl import backend from cryptography.hazmat.primitives.asymmetric import ec ec.derive_private_key(1, ec.SECP256R1(), backend) """ ) ) tests/hazmat/backends/test_openssl_memleak.py:349: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ s = '\ndef func():\n from cryptography.hazmat.backends.openssl import backend\n from cryptography.hazmat.primitives.asymmetric import ec\n ec.derive_private_key(1, ec.SECP256R1(), backend)\n' argv = ['/usr/bin/python3', '-c', '\ndef func():\n from cryptography.hazmat.backends.openssl import backend\n from cryp...n for ptr in remaining\n )))\n sys.stdout.flush()\n sys.exit(255)\n\nmain(sys.argv)\n'] def assert_no_memory_leaks(s, argv=[]): env = os.environ.copy() env["PYTHONPATH"] = os.pathsep.join(sys.path) # When using pytest-cov it attempts to instrument subprocesses. This # causes the memleak tests to raise exceptions. # we don't need coverage so we remove the env vars. env.pop("COV_CORE_CONFIG", None) env.pop("COV_CORE_DATAFILE", None) env.pop("COV_CORE_SOURCE", None) argv = [ sys.executable, "-c", "{}\n\n{}".format(s, MEMORY_LEAK_SCRIPT), ] + argv # Shell out to a fresh Python process because OpenSSL does not allow you to # install new memory hooks after the first malloc/free occurs. proc = subprocess.Popen( argv, env=env, stdout=subprocess.PIPE, stderr=subprocess.PIPE, ) assert proc.stdout is not None assert proc.stderr is not None try: proc.wait() if proc.returncode == 255: # 255 means there was a leak, load the info about what mallocs # weren't freed. out = json.loads(proc.stdout.read().decode()) raise AssertionError(out) elif proc.returncode != 0: # Any exception type will do to be honest > raise ValueError(proc.stdout.read(), proc.stderr.read()) E ValueError: (b'', b'Fatal Python error: init_threadstate: thread state already initialized\nPython runtime state: initialized\n\nThread 0x00007f1d38d71741 (most recent call first):\n') tests/hazmat/backends/test_openssl_memleak.py:167: ValueError __________ TestOpenSSLMemoryLeaks.test_x25519_pubkey_from_private_key __________ self = <tests.hazmat.backends.test_openssl_memleak.TestOpenSSLMemoryLeaks object at 0x7f34b10c6ad0> def test_x25519_pubkey_from_private_key(self): > assert_no_memory_leaks( textwrap.dedent( """ def func(): from cryptography.hazmat.primitives.asymmetric import x25519 private_key = x25519.X25519PrivateKey.generate() private_key.public_key() """ ) ) tests/hazmat/backends/test_openssl_memleak.py:361: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ s = '\ndef func():\n from cryptography.hazmat.primitives.asymmetric import x25519\n private_key = x25519.X25519PrivateKey.generate()\n private_key.public_key()\n' argv = ['/usr/bin/python3', '-c', '\ndef func():\n from cryptography.hazmat.primitives.asymmetric import x25519\n priva...n for ptr in remaining\n )))\n sys.stdout.flush()\n sys.exit(255)\n\nmain(sys.argv)\n'] def assert_no_memory_leaks(s, argv=[]): env = os.environ.copy() env["PYTHONPATH"] = os.pathsep.join(sys.path) # When using pytest-cov it attempts to instrument subprocesses. This # causes the memleak tests to raise exceptions. # we don't need coverage so we remove the env vars. env.pop("COV_CORE_CONFIG", None) env.pop("COV_CORE_DATAFILE", None) env.pop("COV_CORE_SOURCE", None) argv = [ sys.executable, "-c", "{}\n\n{}".format(s, MEMORY_LEAK_SCRIPT), ] + argv # Shell out to a fresh Python process because OpenSSL does not allow you to # install new memory hooks after the first malloc/free occurs. proc = subprocess.Popen( argv, env=env, stdout=subprocess.PIPE, stderr=subprocess.PIPE, ) assert proc.stdout is not None assert proc.stderr is not None try: proc.wait() if proc.returncode == 255: # 255 means there was a leak, load the info about what mallocs # weren't freed. out = json.loads(proc.stdout.read().decode()) raise AssertionError(out) elif proc.returncode != 0: # Any exception type will do to be honest > raise ValueError(proc.stdout.read(), proc.stderr.read()) E ValueError: (b'', b'Fatal Python error: init_threadstate: thread state already initialized\nPython runtime state: initialized\n\nThread 0x00007fc1eac51741 (most recent call first):\n') tests/hazmat/backends/test_openssl_memleak.py:167: ValueError _______________ TestOpenSSLMemoryLeaks.test_create_ocsp_request ________________ self = <tests.hazmat.backends.test_openssl_memleak.TestOpenSSLMemoryLeaks object at 0x7f34b11056d0> def test_create_ocsp_request(self): > assert_no_memory_leaks( textwrap.dedent( """ def func(): from cryptography import x509 from cryptography.hazmat.backends.openssl import backend from cryptography.hazmat.primitives import hashes from cryptography.x509 import ocsp import cryptography_vectors path = "x509/PKITS_data/certs/ValidcRLIssuerTest28EE.crt" with cryptography_vectors.open_vector_file(path, "rb") as f: cert = x509.load_der_x509_certificate( f.read(), backend ) builder = ocsp.OCSPRequestBuilder() builder = builder.add_certificate( cert, cert, hashes.SHA1() ).add_extension(x509.OCSPNonce(b"0000"), False) req = builder.build() """ ) ) tests/hazmat/backends/test_openssl_memleak.py:373: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ s = '\ndef func():\n from cryptography import x509\n from cryptography.hazmat.backends.openssl import backend\n f...(\n cert, cert, hashes.SHA1()\n ).add_extension(x509.OCSPNonce(b"0000"), False)\n req = builder.build()\n' argv = ['/usr/bin/python3', '-c', '\ndef func():\n from cryptography import x509\n from cryptography.hazmat.backends.op...n for ptr in remaining\n )))\n sys.stdout.flush()\n sys.exit(255)\n\nmain(sys.argv)\n'] def assert_no_memory_leaks(s, argv=[]): env = os.environ.copy() env["PYTHONPATH"] = os.pathsep.join(sys.path) # When using pytest-cov it attempts to instrument subprocesses. This # causes the memleak tests to raise exceptions. # we don't need coverage so we remove the env vars. env.pop("COV_CORE_CONFIG", None) env.pop("COV_CORE_DATAFILE", None) env.pop("COV_CORE_SOURCE", None) argv = [ sys.executable, "-c", "{}\n\n{}".format(s, MEMORY_LEAK_SCRIPT), ] + argv # Shell out to a fresh Python process because OpenSSL does not allow you to # install new memory hooks after the first malloc/free occurs. proc = subprocess.Popen( argv, env=env, stdout=subprocess.PIPE, stderr=subprocess.PIPE, ) assert proc.stdout is not None assert proc.stderr is not None try: proc.wait() if proc.returncode == 255: # 255 means there was a leak, load the info about what mallocs # weren't freed. out = json.loads(proc.stdout.read().decode()) raise AssertionError(out) elif proc.returncode != 0: # Any exception type will do to be honest > raise ValueError(proc.stdout.read(), proc.stderr.read()) E ValueError: (b'', b'Fatal Python error: init_threadstate: thread state already initialized\nPython runtime state: initialized\n\nThread 0x00007f7de37dd741 (most recent call first):\n') tests/hazmat/backends/test_openssl_memleak.py:167: ValueError _ TestOpenSSLMemoryLeaks.test_load_pkcs12_key_and_certificates[pkcs12/cert-aes256cbc-no-key.p12] _ self = <tests.hazmat.backends.test_openssl_memleak.TestOpenSSLMemoryLeaks object at 0x7f34b2745510> path = 'pkcs12/cert-aes256cbc-no-key.p12' @pytest.mark.parametrize( "path", ["pkcs12/cert-aes256cbc-no-key.p12", "pkcs12/cert-key-aes256cbc.p12"], ) def test_load_pkcs12_key_and_certificates(self, path): > assert_no_memory_leaks( textwrap.dedent( """ def func(path): from cryptography import x509 from cryptography.hazmat.backends.openssl import backend from cryptography.hazmat.primitives.serialization import pkcs12 import cryptography_vectors with cryptography_vectors.open_vector_file(path, "rb") as f: pkcs12.load_key_and_certificates( f.read(), b"cryptography", backend ) """ ), [path], ) tests/hazmat/backends/test_openssl_memleak.py:402: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ s = '\ndef func(path):\n from cryptography import x509\n from cryptography.hazmat.backends.openssl import backend\n ...h, "rb") as f:\n pkcs12.load_key_and_certificates(\n f.read(), b"cryptography", backend\n )\n' argv = ['/usr/bin/python3', '-c', '\ndef func(path):\n from cryptography import x509\n from cryptography.hazmat.backend... )))\n sys.stdout.flush()\n sys.exit(255)\n\nmain(sys.argv)\n', 'pkcs12/cert-aes256cbc-no-key.p12'] def assert_no_memory_leaks(s, argv=[]): env = os.environ.copy() env["PYTHONPATH"] = os.pathsep.join(sys.path) # When using pytest-cov it attempts to instrument subprocesses. This # causes the memleak tests to raise exceptions. # we don't need coverage so we remove the env vars. env.pop("COV_CORE_CONFIG", None) env.pop("COV_CORE_DATAFILE", None) env.pop("COV_CORE_SOURCE", None) argv = [ sys.executable, "-c", "{}\n\n{}".format(s, MEMORY_LEAK_SCRIPT), ] + argv # Shell out to a fresh Python process because OpenSSL does not allow you to # install new memory hooks after the first malloc/free occurs. proc = subprocess.Popen( argv, env=env, stdout=subprocess.PIPE, stderr=subprocess.PIPE, ) assert proc.stdout is not None assert proc.stderr is not None try: proc.wait() if proc.returncode == 255: # 255 means there was a leak, load the info about what mallocs # weren't freed. out = json.loads(proc.stdout.read().decode()) raise AssertionError(out) elif proc.returncode != 0: # Any exception type will do to be honest > raise ValueError(proc.stdout.read(), proc.stderr.read()) E ValueError: (b'', b'Fatal Python error: init_threadstate: thread state already initialized\nPython runtime state: initialized\n\nThread 0x00007fc24f4b9741 (most recent call first):\n') tests/hazmat/backends/test_openssl_memleak.py:167: ValueError _ TestOpenSSLMemoryLeaks.test_load_pkcs12_key_and_certificates[pkcs12/cert-key-aes256cbc.p12] _ self = <tests.hazmat.backends.test_openssl_memleak.TestOpenSSLMemoryLeaks object at 0x7f34b1106a10> path = 'pkcs12/cert-key-aes256cbc.p12' @pytest.mark.parametrize( "path", ["pkcs12/cert-aes256cbc-no-key.p12", "pkcs12/cert-key-aes256cbc.p12"], ) def test_load_pkcs12_key_and_certificates(self, path): > assert_no_memory_leaks( textwrap.dedent( """ def func(path): from cryptography import x509 from cryptography.hazmat.backends.openssl import backend from cryptography.hazmat.primitives.serialization import pkcs12 import cryptography_vectors with cryptography_vectors.open_vector_file(path, "rb") as f: pkcs12.load_key_and_certificates( f.read(), b"cryptography", backend ) """ ), [path], ) tests/hazmat/backends/test_openssl_memleak.py:402: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ s = '\ndef func(path):\n from cryptography import x509\n from cryptography.hazmat.backends.openssl import backend\n ...h, "rb") as f:\n pkcs12.load_key_and_certificates(\n f.read(), b"cryptography", backend\n )\n' argv = ['/usr/bin/python3', '-c', '\ndef func(path):\n from cryptography import x509\n from cryptography.hazmat.backend...\n )))\n sys.stdout.flush()\n sys.exit(255)\n\nmain(sys.argv)\n', 'pkcs12/cert-key-aes256cbc.p12'] def assert_no_memory_leaks(s, argv=[]): env = os.environ.copy() env["PYTHONPATH"] = os.pathsep.join(sys.path) # When using pytest-cov it attempts to instrument subprocesses. This # causes the memleak tests to raise exceptions. # we don't need coverage so we remove the env vars. env.pop("COV_CORE_CONFIG", None) env.pop("COV_CORE_DATAFILE", None) env.pop("COV_CORE_SOURCE", None) argv = [ sys.executable, "-c", "{}\n\n{}".format(s, MEMORY_LEAK_SCRIPT), ] + argv # Shell out to a fresh Python process because OpenSSL does not allow you to # install new memory hooks after the first malloc/free occurs. proc = subprocess.Popen( argv, env=env, stdout=subprocess.PIPE, stderr=subprocess.PIPE, ) assert proc.stdout is not None assert proc.stderr is not None try: proc.wait() if proc.returncode == 255: # 255 means there was a leak, load the info about what mallocs # weren't freed. out = json.loads(proc.stdout.read().decode()) raise AssertionError(out) elif proc.returncode != 0: # Any exception type will do to be honest > raise ValueError(proc.stdout.read(), proc.stderr.read()) E ValueError: (b'', b'Fatal Python error: init_threadstate: thread state already initialized\nPython runtime state: initialized\n\nThread 0x00007f4f75bbc741 (most recent call first):\n') tests/hazmat/backends/test_openssl_memleak.py:167: ValueError _______________ TestOpenSSLMemoryLeaks.test_create_crl_with_idp ________________ self = <tests.hazmat.backends.test_openssl_memleak.TestOpenSSLMemoryLeaks object at 0x7f34b30d4b10> def test_create_crl_with_idp(self): > assert_no_memory_leaks( textwrap.dedent( """ def func(): import datetime from cryptography import x509 from cryptography.hazmat.backends.openssl import backend from cryptography.hazmat.primitives import hashes from cryptography.hazmat.primitives.asymmetric import ec from cryptography.x509.oid import NameOID key = ec.generate_private_key(ec.SECP256R1(), backend) last_update = datetime.datetime(2002, 1, 1, 12, 1) next_update = datetime.datetime(2030, 1, 1, 12, 1) idp = x509.IssuingDistributionPoint( full_name=None, relative_name=x509.RelativeDistinguishedName([ x509.NameAttribute( oid=x509.NameOID.ORGANIZATION_NAME, value=u"PyCA") ]), only_contains_user_certs=False, only_contains_ca_certs=True, only_some_reasons=None, indirect_crl=False, only_contains_attribute_certs=False, ) builder = x509.CertificateRevocationListBuilder().issuer_name( x509.Name([ x509.NameAttribute( NameOID.COMMON_NAME, u"cryptography.io CA" ) ]) ).last_update( last_update ).next_update( next_update ).add_extension( idp, True ) crl = builder.sign(key, hashes.SHA256(), backend) crl.extensions.get_extension_for_class( x509.IssuingDistributionPoint ) """ ) ) tests/hazmat/backends/test_openssl_memleak.py:421: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ s = '\ndef func():\n import datetime\n from cryptography import x509\n from cryptography.hazmat.backends.openssl ...hashes.SHA256(), backend)\n crl.extensions.get_extension_for_class(\n x509.IssuingDistributionPoint\n )\n' argv = ['/usr/bin/python3', '-c', '\ndef func():\n import datetime\n from cryptography import x509\n from cryptograp...n for ptr in remaining\n )))\n sys.stdout.flush()\n sys.exit(255)\n\nmain(sys.argv)\n'] def assert_no_memory_leaks(s, argv=[]): env = os.environ.copy() env["PYTHONPATH"] = os.pathsep.join(sys.path) # When using pytest-cov it attempts to instrument subprocesses. This # causes the memleak tests to raise exceptions. # we don't need coverage so we remove the env vars. env.pop("COV_CORE_CONFIG", None) env.pop("COV_CORE_DATAFILE", None) env.pop("COV_CORE_SOURCE", None) argv = [ sys.executable, "-c", "{}\n\n{}".format(s, MEMORY_LEAK_SCRIPT), ] + argv # Shell out to a fresh Python process because OpenSSL does not allow you to # install new memory hooks after the first malloc/free occurs. proc = subprocess.Popen( argv, env=env, stdout=subprocess.PIPE, stderr=subprocess.PIPE, ) assert proc.stdout is not None assert proc.stderr is not None try: proc.wait() if proc.returncode == 255: # 255 means there was a leak, load the info about what mallocs # weren't freed. out = json.loads(proc.stdout.read().decode()) raise AssertionError(out) elif proc.returncode != 0: # Any exception type will do to be honest > raise ValueError(proc.stdout.read(), proc.stderr.read()) E ValueError: (b'', b'Fatal Python error: init_threadstate: thread state already initialized\nPython runtime state: initialized\n\nThread 0x00007f27fca1a741 (most recent call first):\n') tests/hazmat/backends/test_openssl_memleak.py:167: ValueError ________ TestOpenSSLMemoryLeaks.test_create_certificate_with_extensions ________ self = <tests.hazmat.backends.test_openssl_memleak.TestOpenSSLMemoryLeaks object at 0x7f34b0fa4d50> def test_create_certificate_with_extensions(self): > assert_no_memory_leaks( textwrap.dedent( """ def func(): import datetime from cryptography import x509 from cryptography.hazmat.backends.openssl import backend from cryptography.hazmat.primitives import hashes from cryptography.hazmat.primitives.asymmetric import ec from cryptography.x509.oid import ( AuthorityInformationAccessOID, ExtendedKeyUsageOID, NameOID ) private_key = ec.generate_private_key(ec.SECP256R1(), backend) not_valid_before = datetime.datetime.now() not_valid_after = not_valid_before + datetime.timedelta(days=365) aia = x509.AuthorityInformationAccess([ x509.AccessDescription( AuthorityInformationAccessOID.OCSP, x509.UniformResourceIdentifier(u"http://ocsp.domain.com") ), x509.AccessDescription( AuthorityInformationAccessOID.CA_ISSUERS, x509.UniformResourceIdentifier(u"http://domain.com/ca.crt") ) ]) sans = [u'*.example.org', u'foobar.example.net'] san = x509.SubjectAlternativeName(list(map(x509.DNSName, sans))) ski = x509.SubjectKeyIdentifier.from_public_key( private_key.public_key() ) eku = x509.ExtendedKeyUsage([ ExtendedKeyUsageOID.CLIENT_AUTH, ExtendedKeyUsageOID.SERVER_AUTH, ExtendedKeyUsageOID.CODE_SIGNING, ]) builder = x509.CertificateBuilder().serial_number( 777 ).issuer_name(x509.Name([ x509.NameAttribute(NameOID.COUNTRY_NAME, u'US'), ])).subject_name(x509.Name([ x509.NameAttribute(NameOID.COUNTRY_NAME, u'US'), ])).public_key( private_key.public_key() ).add_extension( aia, critical=False ).not_valid_before( not_valid_before ).not_valid_after( not_valid_after ) cert = builder.sign(private_key, hashes.SHA256(), backend) cert.extensions """ ) ) tests/hazmat/backends/test_openssl_memleak.py:470: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ s = '\ndef func():\n import datetime\n\n from cryptography import x509\n from cryptography.hazmat.backends.openss... not_valid_after\n )\n\n cert = builder.sign(private_key, hashes.SHA256(), backend)\n cert.extensions\n' argv = ['/usr/bin/python3', '-c', '\ndef func():\n import datetime\n\n from cryptography import x509\n from cryptogr...n for ptr in remaining\n )))\n sys.stdout.flush()\n sys.exit(255)\n\nmain(sys.argv)\n'] def assert_no_memory_leaks(s, argv=[]): env = os.environ.copy() env["PYTHONPATH"] = os.pathsep.join(sys.path) # When using pytest-cov it attempts to instrument subprocesses. This # causes the memleak tests to raise exceptions. # we don't need coverage so we remove the env vars. env.pop("COV_CORE_CONFIG", None) env.pop("COV_CORE_DATAFILE", None) env.pop("COV_CORE_SOURCE", None) argv = [ sys.executable, "-c", "{}\n\n{}".format(s, MEMORY_LEAK_SCRIPT), ] + argv # Shell out to a fresh Python process because OpenSSL does not allow you to # install new memory hooks after the first malloc/free occurs. proc = subprocess.Popen( argv, env=env, stdout=subprocess.PIPE, stderr=subprocess.PIPE, ) assert proc.stdout is not None assert proc.stderr is not None try: proc.wait() if proc.returncode == 255: # 255 means there was a leak, load the info about what mallocs # weren't freed. out = json.loads(proc.stdout.read().decode()) raise AssertionError(out) elif proc.returncode != 0: # Any exception type will do to be honest > raise ValueError(proc.stdout.read(), proc.stderr.read()) E ValueError: (b'', b'Fatal Python error: init_threadstate: thread state already initialized\nPython runtime state: initialized\n\nThread 0x00007f3eb731d741 (most recent call first):\n') tests/hazmat/backends/test_openssl_memleak.py:167: ValueError ________ TestOpenSSLMemoryLeaks.test_write_pkcs12_key_and_certificates _________ self = <tests.hazmat.backends.test_openssl_memleak.TestOpenSSLMemoryLeaks object at 0x7f34b1334110> def test_write_pkcs12_key_and_certificates(self): > assert_no_memory_leaks( textwrap.dedent( """ def func(): import os from cryptography import x509 from cryptography.hazmat.backends.openssl import backend from cryptography.hazmat.primitives import serialization from cryptography.hazmat.primitives.serialization import pkcs12 import cryptography_vectors path = os.path.join('x509', 'custom', 'ca', 'ca.pem') with cryptography_vectors.open_vector_file(path, "rb") as f: cert = x509.load_pem_x509_certificate( f.read(), backend ) path2 = os.path.join('x509', 'custom', 'dsa_selfsigned_ca.pem') with cryptography_vectors.open_vector_file(path2, "rb") as f: cert2 = x509.load_pem_x509_certificate( f.read(), backend ) path3 = os.path.join('x509', 'letsencryptx3.pem') with cryptography_vectors.open_vector_file(path3, "rb") as f: cert3 = x509.load_pem_x509_certificate( f.read(), backend ) key_path = os.path.join("x509", "custom", "ca", "ca_key.pem") with cryptography_vectors.open_vector_file(key_path, "rb") as f: key = serialization.load_pem_private_key( f.read(), None, backend ) encryption = serialization.NoEncryption() pkcs12.serialize_key_and_certificates( b"name", key, cert, [cert2, cert3], encryption) """ ) ) tests/hazmat/backends/test_openssl_memleak.py:534: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ s = '\ndef func():\n import os\n from cryptography import x509\n from cryptography.hazmat.backends.openssl import....NoEncryption()\n pkcs12.serialize_key_and_certificates(\n b"name", key, cert, [cert2, cert3], encryption)\n' argv = ['/usr/bin/python3', '-c', '\ndef func():\n import os\n from cryptography import x509\n from cryptography.haz...n for ptr in remaining\n )))\n sys.stdout.flush()\n sys.exit(255)\n\nmain(sys.argv)\n'] def assert_no_memory_leaks(s, argv=[]): env = os.environ.copy() env["PYTHONPATH"] = os.pathsep.join(sys.path) # When using pytest-cov it attempts to instrument subprocesses. This # causes the memleak tests to raise exceptions. # we don't need coverage so we remove the env vars. env.pop("COV_CORE_CONFIG", None) env.pop("COV_CORE_DATAFILE", None) env.pop("COV_CORE_SOURCE", None) argv = [ sys.executable, "-c", "{}\n\n{}".format(s, MEMORY_LEAK_SCRIPT), ] + argv # Shell out to a fresh Python process because OpenSSL does not allow you to # install new memory hooks after the first malloc/free occurs. proc = subprocess.Popen( argv, env=env, stdout=subprocess.PIPE, stderr=subprocess.PIPE, ) assert proc.stdout is not None assert proc.stderr is not None try: proc.wait() if proc.returncode == 255: # 255 means there was a leak, load the info about what mallocs # weren't freed. out = json.loads(proc.stdout.read().decode()) raise AssertionError(out) elif proc.returncode != 0: # Any exception type will do to be honest > raise ValueError(proc.stdout.read(), proc.stderr.read()) E ValueError: (b'', b'Fatal Python error: init_threadstate: thread state already initialized\nPython runtime state: initialized\n\nThread 0x00007f203bd7f741 (most recent call first):\n') https://docs.python.org/3.11/whatsnew/3.11.html For the build logs, see: https://copr-be.cloud.fedoraproject.org/results/@python/python3.11/fedora-rawhide-x86_64/03194275-python-cryptography/ For all our attempts to build python-cryptography with Python 3.11, see: https://copr.fedorainfracloud.org/coprs/g/python/python3.11/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.11: https://copr.fedorainfracloud.org/coprs/g/python/python3.11/ Let us know here if you have any questions. Python 3.11 is planned to be included in Fedora 37. To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.11. 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.
FEDORA-2022-04cf5dc008 has been submitted as an update to Fedora 36. https://bodhi.fedoraproject.org/updates/FEDORA-2022-04cf5dc008
FEDORA-2022-04cf5dc008 has been pushed to the Fedora 36 stable repository. If problem still persists, please make note of it in this bug report.
*** Bug 2046866 has been marked as a duplicate of this bug. ***