Repository navigation
chore: add handling for None values - #624
Conversation
|
Thanks for this. Some research behind the change and a suggested tweak: This is a real 3.15 bug, not just a typing nitPEP 798 (unpacking in comprehensions) lands in CPython 3.15. typeshed matches this: On import libcst as cst
x = {**d for d in ds}
class V(cst.CSTVisitor):
def visit_Call(self, node):
passWhy CI didn't catch it
Suggested changeThe diff here nests if isinstance(node, ast.DictComp):
visit(node.key)
# PEP 798 (3.15+): ``{**d for d in ds}`` has ``value=None``.
if node.value is not None:
visit(node.value)
else:
visit(node.elt)I checked this locally: Better follow-ups (could be in this PR or a separate one)
|
Thanks for the reply and analysis here. Then i can add a follow-up PR to let mypy run on 3.15 -- that should be fine. |
|
Applied the recommended draft! That should suffice for now :) |
Desc
I get the following complaint from mypy when running strict across the
bugbear.pyAfter this fix it is no longer present.
This type annotation seems to have been updated to include
None.