-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BUG, EASY, PY38: web_protocol.RequestHandler mismatch _keepalive field with __slots__ #3644
Labels
Comments
cjrh
changed the title
BUG, EASY: web_protocol.RequestHandler mismatch _keepalive field with __slots__
BUG, EASY, PY38: web_protocol.RequestHandler mismatch _keepalive field with __slots__
Mar 10, 2019
GitMate.io thinks the contributor most likely able to help you is @asvetlov. Possibly related issues are #2752 (IndexError in RequestHandler), #103 (BasicAuth bugged ?), and #2620 (DNSCache BUG). |
Merged
5 tasks
asvetlov
pushed a commit
that referenced
this issue
May 6, 2019
…epalive field with __slots__ (#3727) (cherry picked from commit bfb99eb) Co-authored-by: Artem Yushkovskiy <[email protected]>
asvetlov
pushed a commit
that referenced
this issue
May 8, 2019
…ch _keepalive field with __slots__ (#3727) (#3731) (cherry picked from commit bfb99eb) Co-authored-by: Artem Yushkovskiy <[email protected]> (cherry picked from commit ff1c9de) Co-authored-by: Artem Yushkovskiy <[email protected]>
asvetlov
added a commit
that referenced
this issue
May 8, 2019
…epalive field with __slots__ (#3727) (#3729) (cherry picked from commit bfb99eb) Co-authored-by: Artem Yushkovskiy <[email protected]>
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Long story short
In
RequestHandler
, the spelling in__slots__
is_keep_alive
but in the default assignment in__init__()
, the name of the field is_keepalive
. The latter is what actually gets used in the module, not the slots name.In Python 3.7, this appears to be ok because instances are getting a
__dict__
from somewhere (presumably from an ancestor in the MRO chain). However, in Python 3.8 it seems that instances ofRequestHandler
are not getting a__dict__
attached to them, which is why anAttributeError
gets raised.The slots declaration in
aiohttp/web_protocol.py
:This code was added in #3095.
Expected behaviour
In Python 3.8 requests to the aiohttp web server should succeed.
Actual behaviour
In Python 3.8, requests fail with this traceback:
Immediately at the offending line (in a debugger), the
__mro__
for theRequestHandler
instance appears to be the same when running under Python 3.7 and Python 3.8:This leads me to suspect that something might have changed with either
Protocol
orBaseProtocol
in upstream asyncio (i.e. declaring slots so as to prevent__dict__
appearing on the instance), but I've not confirmed this.Regardless, the name mismatch of the field must still be fixed.
Steps to reproduce
Server code with:
Then open
localhost:8080
in a browser.Your environment
requirements.txt
:The text was updated successfully, but these errors were encountered: