Jump to solution
Verify

The Fix

Removed the non-existing `__author__` from the `__dir__` method in aiohttp, which was causing an AttributeError.

Based on closed aio-libs/aiohttp issue #9914 · PR/commit linked

Jump to Verify Open PR/Commit
@@ -0,0 +1 @@ @@ -0,0 +1 @@ +Removed non-existing ``__author__`` from ``dir(aiohttp)`` -- by :user:`Dreamsorcerer`. diff --git a/aiohttp/__init__.py b/aiohttp/__init__.py index b2c366efe49..f7864247791 100644
repro.py
<class 'aiohttp.client_exceptions.ServerTimeoutError'> <class 'aiohttp.client_exceptions.SocketTimeoutError'> <class 'aiohttp.streams.StreamReader'> <class 'aiohttp.payload.StringIOPayload'> <class 'aiohttp.payload.StringPayload'> <class 'aiohttp.connector.TCPConnector'> <class 'aiohttp.payload.TextIOPayload'> <class 'aiohttp.resolver.ThreadedResolver'> <class 'aiohttp.client_exceptions.TooManyRedirects'> <class 'aiohttp.tracing.TraceConfig'> <class 'aiohttp.tracing.TraceConnectionCreateEndParams'> <class 'aiohttp.tracing.TraceConnectionCreateStartParams'> <class 'aiohttp.tracing.TraceConnectionQueuedEndParams'> <class 'aiohttp.tracing.TraceConnectionQueuedStartParams'> <class 'aiohttp.tracing.TraceConnectionReuseconnParams'> <class 'aiohttp.tracing.TraceDnsCacheHitParams'> <class 'aiohttp.tracing.TraceDnsCacheMissParams'> <class 'aiohttp.tracing.TraceDnsResolveHostEndParams'> <class 'aiohttp.tracing.TraceDnsResolveHostStartParams'> <class 'aiohttp.tracing.TraceRequestChunkSentParams'> <class 'aiohttp.tracing.TraceRequestEndParams'> <class 'aiohttp.tracing.TraceRequestExceptionParams'> <class 'aiohttp.tracing.TraceRequestHeadersSentParams'> <class 'aiohttp.tracing.TraceRequestRedirectParams'> <class 'aiohttp.tracing.TraceRequestStartParams'> <class 'aiohttp.tracing.TraceResponseChunkReceivedParams'> <class 'aiohttp.connector.UnixConnector'> <enum 'WSCloseCode'> <class 'aiohttp.http_websocket.WSMessage'> <enum 'WSMsgType'> <class 'aiohttp.client_exceptions.WSServerHandshakeError'> <class 'aiohttp.http_websocket.WebSocketError'> *** AttributeError: module aiohttp has no attribute __author__
verify
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.
fix.md
Option A — Apply the official fix\nRemoved the non-existing `__author__` from the `__dir__` method in aiohttp, which was causing an AttributeError.\nWhen NOT to use: Do not apply this fix if you rely on the `__author__` attribute being present.\n\n

Why This Fix Works in Production

  • Trigger: raise AttributeError(f"module {__name__} has no attribute {name}")
  • Mechanism: The `__author__` attribute was incorrectly included in the `__dir__` method of aiohttp

Why This Breaks in Prod

  • Shows up under Python 3.12 in real deployments (not just unit tests).
  • The `__author__` attribute was incorrectly included in the `__dir__` method of aiohttp
  • Surfaces as: raise AttributeError(f"module {__name__} has no attribute {name}")

Proof / Evidence

Discussion

High-signal excerpts from the issue thread (symptoms, repros, edge-cases).

“> dict(map(_to_tuple, filter(_is_valid_key, groupby(src, _extract_key)))) Seems like you expect us to guess what your code does?”
@Dreamsorcerer · 2024-11-15 · source
“Sorry, that's still not helping, I don't see what any of that has to do with aiohttp”
@Dreamsorcerer · 2024-11-15 · source
“Tried with pdb stack trace and see the below output - I tried to list the items here using for i in src: print(i) and…”
@NiranjanUv · 2024-11-15 · source
“Still rather unclear what you're trying to do”
@Dreamsorcerer · 2024-11-15 · source

Failure Signature (Search String)

  • raise AttributeError(f"module {__name__} has no attribute {name}")

Error Message

Stack trace
error.txt
Error Message ------------- raise AttributeError(f"module {__name__} has no attribute {name}") AttributeError: module aiohttp has no attribute __author__
Stack trace
error.txt
Error Message ------------- # destroy aiohttp.worker Traceback (most recent call last): File "<frozen runpy>", line 198, in _run_module_as_main File "<frozen runpy>", line 88, in _run_code File "/root/.virtual_environment/lib64/python3.12/site-packages/error_messages_pdf/cli/__main__.py", line 15, in <module> cli() File "/root/.virtual_environment/lib64/python3.12/site-packages/click/core.py", line 1157, in __call__ return self.main(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/root/.virtual_environment/lib64/python3.12/site-packages/click/core.py", line 1078, in main rv = self.invoke(ctx) ^^^^^^^^^^^^^^^^ File "/root/.virtual_environment/lib64/python3.12/site-packages/click/core.py", line 1688, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/root/.virtual_environment/lib64/python3.12/site-packages/click/core.py", line 1434, in invoke return ctx.invoke(self.callback, **ctx.params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/root/.virtual_environment/lib64/python3.12/site-packages/click/core.py", line 783, in invoke return __callback(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/root/.virtual_environment/lib64/python3.12/site-packages/error_messages_pdf/cli/_internal/cmd_generate_pdf.py", line 39, in cmd_pdf error_messages: ... (truncated) ...
Stack trace
error.txt
Error Message ------------- >> dict(map(_to_tuple, filter(_is_valid_key, groupby(src, _extract_key)))) Traceback (most recent call last): File "<stdin>", line 1, in <module> NameError: name '_to_tuple' is not defined

Minimal Reproduction

repro.py
<class 'aiohttp.client_exceptions.ServerTimeoutError'> <class 'aiohttp.client_exceptions.SocketTimeoutError'> <class 'aiohttp.streams.StreamReader'> <class 'aiohttp.payload.StringIOPayload'> <class 'aiohttp.payload.StringPayload'> <class 'aiohttp.connector.TCPConnector'> <class 'aiohttp.payload.TextIOPayload'> <class 'aiohttp.resolver.ThreadedResolver'> <class 'aiohttp.client_exceptions.TooManyRedirects'> <class 'aiohttp.tracing.TraceConfig'> <class 'aiohttp.tracing.TraceConnectionCreateEndParams'> <class 'aiohttp.tracing.TraceConnectionCreateStartParams'> <class 'aiohttp.tracing.TraceConnectionQueuedEndParams'> <class 'aiohttp.tracing.TraceConnectionQueuedStartParams'> <class 'aiohttp.tracing.TraceConnectionReuseconnParams'> <class 'aiohttp.tracing.TraceDnsCacheHitParams'> <class 'aiohttp.tracing.TraceDnsCacheMissParams'> <class 'aiohttp.tracing.TraceDnsResolveHostEndParams'> <class 'aiohttp.tracing.TraceDnsResolveHostStartParams'> <class 'aiohttp.tracing.TraceRequestChunkSentParams'> <class 'aiohttp.tracing.TraceRequestEndParams'> <class 'aiohttp.tracing.TraceRequestExceptionParams'> <class 'aiohttp.tracing.TraceRequestHeadersSentParams'> <class 'aiohttp.tracing.TraceRequestRedirectParams'> <class 'aiohttp.tracing.TraceRequestStartParams'> <class 'aiohttp.tracing.TraceResponseChunkReceivedParams'> <class 'aiohttp.connector.UnixConnector'> <enum 'WSCloseCode'> <class 'aiohttp.http_websocket.WSMessage'> <enum 'WSMsgType'> <class 'aiohttp.client_exceptions.WSServerHandshakeError'> <class 'aiohttp.http_websocket.WebSocketError'> *** AttributeError: module aiohttp has no attribute __author__

Environment

  • Python: 3.12

Why It Broke

The `__author__` attribute was incorrectly included in the `__dir__` method of aiohttp

Fix Options (Details)

Option A — Apply the official fix

Removed the non-existing `__author__` from the `__dir__` method in aiohttp, which was causing an AttributeError.

When NOT to use: Do not apply this fix if you rely on the `__author__` attribute being present.

Fix reference: https://github.com/aio-libs/aiohttp/pull/9918

Last verified: 2026-02-09. Validate in your environment.

Get updates

We publish verified fixes weekly. No spam.

Subscribe

When NOT to Use This Fix

  • Do not apply this fix if you rely on the `__author__` attribute being present.

Verify Fix

verify
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.

Did This Fix Work in Your Case?

Quick signal helps us prioritize which fixes to verify and improve.

Prevention

  • Track RSS + object counts after deployments; alert on monotonic growth and GC pressure.
  • Add a long-running test that repeats the failing call path and asserts stable memory.

Related Issues

No related fixes found.

Sources

We don’t republish the full GitHub discussion text. Use the links above for context.