TypeError - list indices must be integers, not weakref
Created originally on Bitbucket by Anonymous
#!python
Stacktrace (most recent call last):
File "requests/api.py", line 68, in get
return request('get', url, **kwargs)
File "requests/api.py", line 50, in request
response = session.request(method=method, url=url, **kwargs)
File "requests/sessions.py", line 465, in request
resp = self.send(prep, **send_kwargs)
File "requests/sessions.py", line 573, in send
r = adapter.send(request, **kwargs)
File "requests/adapters.py", line 370, in send
timeout=timeout
File "requests/packages/urllib3/connectionpool.py", line 544, in urlopen
body=body, headers=headers)
File "requests/packages/urllib3/connectionpool.py", line 341, in _make_request
self._validate_conn(conn)
File "requests/packages/urllib3/connectionpool.py", line 761, in _validate_conn
conn.connect()
File "requests/packages/urllib3/connection.py", line 245, in connect
cert = self.sock.getpeercert()
File "requests/packages/urllib3/contrib/pyopenssl.py", line 234, in getpeercert
for value in get_subj_alt_name(x509)
File "requests/packages/urllib3/contrib/pyopenssl.py", line 127, in get_subj_alt_name
ext = peer_cert.get_extension(i)
File "OpenSSL/crypto.py", line 1341, in get_extension
ext._extension = _ffi.gc(extension, _lib.X509_EXTENSION_free)
File "cffi/api.py", line 336, in gc
return gc_weakrefs.build(cdata, destructor)
File "cffi/gc_weakref.py", line 26, in build
self.freelist = self.data[index]
#!python
'cdata': <cdata 'X509_EXTENSION *' 0x4137420>
'destructor': <built-in function X509_EXTENSION_free>
'index': <weakref at 0x40cb260; to '_cffi_backend.CData' at 0x2685968 (<cdata>)>
'key': <weakref at 0x40a6fc8; to '_cffi_backend.CData' at 0x3f488c8 (<cdata>)>
'new_cdata': <cdata 'X509_EXTENSION *' 0x4137420>
'remove': <function remove from cffi.gc_weakref at 0x260d2a8>
'self': <cffi.gc_weakref.GcWeakrefs object at 0x3fbf790>
I got this on cffi 1.1.1. Version 1.1.0 works just fine. It happens while creating POST request using requests library.