-
-
Notifications
You must be signed in to change notification settings - Fork 33.2k
Closed as not planned
Closed as not planned
Copy link
Labels
3.12only security fixesonly security fixestype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Documentation
RuntimeWarning: assigning None to unbound local
← I get this periodically since upgrading to python 3.12, for various lines of library code somewhere deep in my project's dependencies, and it seems like there's no documentation for it online? It's not even clear to me from the error message why this would be a bad thing to happen. These warnings generally seem to show up in list comprehensions. I don't know how to fix them or what they indicate. Maybe it's even a bug in python! I'm using Python 3.12.6 on Windows 10.
Here's an example from today:
C:\[...]\.venv\Lib\site-packages\asttokens\util.py:173: RuntimeWarning: assigning None to unbound local 'n'
if isinstance(c, type) and issubclass(c, ast.expr)} |
C:\[...]\.venv\Lib\site-packages\asttokens\util.py:173: RuntimeWarning: assigning None to unbound local 'c'
if isinstance(c, type) and issubclass(c, ast.expr)} |
Here's the line it's complaining about: https://github.com/gristlabs/asttokens/blob/2ff0e8d157fa89c22fe16839ab060b33f4c888bd/asttokens/util.py#L173
Here's another:
C:\[...]\.venv\Lib\site-packages\scipy\sparse\__init__.py:315: RuntimeWarning: assigning None to unbound local 's'
__all__ = [s for s in dir() if not s.startswith('_')]
Metadata
Metadata
Assignees
Labels
3.12only security fixesonly security fixestype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error