DeprecationWarning: Attribute s is deprecated and will be removed in Python 3.14
Commandcracker opened this issue · comments
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
C:\Users\red\AppData\Local\Programs\Python\Python312\Lib\site-packages\sanic\touchup\schemes\ode.py:70: DeprecationWarning: Attribute s is deprecated and will be removed in Python 3.14; use value instead
if hasattr(event, "s"):
Code snippet
No response
Expected Behavior
No response
How do you run Sanic?
ASGI
Operating System
Windows
Sanic Version
Sanic 23.12.1; Routing 23.12.0
Additional context
No response
according to ast module in release 3.12.2:
-- the following expression can appear in assignment context
| Attribute(expr value, identifier attr, expr_context ctx)
therefore in sanic/touchup/schemes/ode.py the following update should happen around line 70 as "s" should be "value"
if isinstance(func, Attribute) and func.attr == "dispatch":
event = args[0]
if hasattr(event, "value"):
event_name = getattr(event, "value", event.value)
if self._not_registered(event_name):
logger.debug(
f"Disabling event: {event_name}",
extra={"verbosity": 2},
)
return None
return node
I updated the script and the warning is gone.
Should have a pull request to update the release source.
Should you not poke the bear on: #2949 as this is very close to be a real issue.