AttributeError: 'DummyLock' object has no attribute 'acquire' when using AsyncSession
arakurumi opened this issue · comments
Kurumi commented
Hi, thanks for this awesome HTTP library!
I'm having problems after updating to latest version (3.7.1)
Works normally on previous versions and SyncSession
Expected Result
200
Actual Result
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\<username>\AppData\Local\Programs\Python\Python311\Lib\asyncio\runners.py", line 190, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "C:\Users\<username>\AppData\Local\Programs\Python\Python311\Lib\asyncio\runners.py", line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\<username>\AppData\Local\Programs\Python\Python311\Lib\asyncio\base_events.py", line 654, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "<stdin>", line 3, in main
File "C:\Users\<username>\AppData\Local\Programs\Python\Python311\Lib\site-packages\niquests\_async.py", line 853, in get
return await self.request( # type: ignore[call-overload,misc]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\<username>\AppData\Local\Programs\Python\Python311\Lib\site-packages\niquests\_async.py", line 796, in request
return await self.send(prep, **send_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\<username>\AppData\Local\Programs\Python\Python311\Lib\site-packages\niquests\_async.py", line 481, in send
extract_cookies_to_jar(self.cookies, request, r.raw)
File "C:\Users\<username>\AppData\Local\Programs\Python\Python311\Lib\site-packages\niquests\cookies.py", line 181, in extract_cookies_to_jar
jar.extract_cookies(res, req) # type: ignore[arg-type]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\<username>\AppData\Local\Programs\Python\Python311\Lib\http\cookiejar.py", line 1683, in extract_cookies
self._cookies_lock.acquire()
^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'DummyLock' object has no attribute 'acquire'
Reproduction Steps
from asyncio import run
from niquests import AsyncSession
async def main():
async with AsyncSession() as session:
request = await session.get(url="https://www.google.com")
print(request.status_code)
run(main())
System Information
$ python -m niquests.help
{
"charset_normalizer": {
"version": "3.3.2"
},
"http1": {
"h11": "0.14.0"
},
"http2": {
"jh2": "5.0.3"
},
"http3": {
"enabled": true,
"qh3": "1.0.8"
},
"idna": {
"version": "3.7"
},
"implementation": {
"name": "CPython",
"version": "3.11.9"
},
"niquests": {
"version": "3.7.1"
},
"ocsp": {
"enabled": true
},
"platform": {
"release": "10",
"system": "Windows"
},
"system_ssl": {
"version": "300000d0"
},
"urllib3.future": {
"cohabitation_version": null,
"version": "2.8.902"
},
"wassima": {
"certifi_fallback": false,
"enabled": true,
"version": "1.1.1"
}
}
TAHRI Ahmed R. commented
good catch, a tiny regression was introduced with a performance concern patch. no coverage was there to prevent this.
we will yank this specific version and publish a hotfix.
let us know if everything went fine with 3.7.2
regards,
Kurumi commented
Works like a charm on new version, Thanks you for the quick fix