Title: "RuntimeWarning: assigning None to unbound local": an inscrutable error · Issue #124118 · python/cpython · GitHub
Open Graph Title: "RuntimeWarning: assigning None to unbound local": an inscrutable error · Issue #124118 · python/cpython
X Title: "RuntimeWarning: assigning None to unbound local": an inscrutable error · Issue #124118 · python/cpython
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 documenta...
Open Graph 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...
X 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 dependen...
Opengraph URL: https://github.com/python/cpython/issues/124118
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"\"RuntimeWarning: assigning None to unbound local\": an inscrutable error","articleBody":"# Documentation\r\n\r\n`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.\r\n\r\nHere's an example from today:\r\n\r\n```python\r\nC:\\[...]\\.venv\\Lib\\site-packages\\asttokens\\util.py:173: RuntimeWarning: assigning None to unbound local 'n'\r\n if isinstance(c, type) and issubclass(c, ast.expr)} |\r\nC:\\[...]\\.venv\\Lib\\site-packages\\asttokens\\util.py:173: RuntimeWarning: assigning None to unbound local 'c'\r\n if isinstance(c, type) and issubclass(c, ast.expr)} |\r\n ```\r\n\r\nHere's the line it's complaining about: https://github.com/gristlabs/asttokens/blob/2ff0e8d157fa89c22fe16839ab060b33f4c888bd/asttokens/util.py#L173\r\n\r\nHere's another:\r\n```python\r\nC:\\[...]\\.venv\\Lib\\site-packages\\scipy\\sparse\\__init__.py:315: RuntimeWarning: assigning None to unbound local 's'\r\n __all__ = [s for s in dir() if not s.startswith('_')]\r\n```","author":{"url":"https://github.com/wyattscarpenter","@type":"Person","name":"wyattscarpenter"},"datePublished":"2024-09-16T10:26:09.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":12},"url":"https://github.com/124118/cpython/issues/124118"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:c5a87d38-1f20-396e-d725-c487da0ee294 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E504:3B638A:11A2FC4:18316D1:6969FCFE |
| html-safe-nonce | 8ce2371f1ca4e5db9cb24d880a58c9854f4ce6602cc331cb81f75f5d73d06a30 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNTA0OjNCNjM4QToxMUEyRkM0OjE4MzE2RDE6Njk2OUZDRkUiLCJ2aXNpdG9yX2lkIjoiMjM3NjA3ODI5NzY0MTEyMzA3MCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | c1485677f7909d2ce6d27bd8dba0074b0ebaea330d29c4068b10db57e4c6fead |
| hovercard-subject-tag | issue:2528068627 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/124118/issue_layout |
| twitter:image | https://opengraph.githubassets.com/b1494cba33153d57a7e5cb6a7c073406d67254f2c6a6631490cf1bfe03fc32b5/python/cpython/issues/124118 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/b1494cba33153d57a7e5cb6a7c073406d67254f2c6a6631490cf1bfe03fc32b5/python/cpython/issues/124118 |
| og:image:alt | 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... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | wyattscarpenter |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7b32f1c7c4549428ee399213e8345494fc55b5637195d3fc5f493657579235e8 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | bdde15ad1b403e23b08bbd89b53fbe6bdf688cad |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width