Bug Report
mypy.nodes.get_member_expr_fullname formats a MemberExpr into a dotted-name string if possible, or returns None if formatting the MemberExpr in that way is not possible (i.e. it contains expressions other than names and attribute accesses).
Sometimes when a dotted-name representation is not possible, it will return a string with an embedded "None" (e.g. "None.a.b.c") instead of returning None.
Encountered when reviewing #17178
To Reproduce
frommypy.nodesimportCallExpr, MemberExpr, NameExpr, get_member_expr_fullnamem1=MemberExpr(MemberExpr(NameExpr("a"), "b"), "c") # a.b.cm2=MemberExpr(CallExpr(NameExpr("a"), [], [], []), "b") # a().bm3=MemberExpr(MemberExpr(CallExpr(NameExpr("a"), [], [], []), "b"), "c") # a().b.c>>>get_member_expr_fullname(m1)
'a.b.c'>>>get_member_expr_fullname(m2) isNoneTrue>>>get_member_expr_fullname(m3)
'None.c'# uh oh! expected NoneYour Environment
- Mypy version used: master (1.12.0+dev.26a77f9d37)
- Mypy command-line flags: N/A
- Mypy configuration options from
mypy.ini (and other config files): N/A - Python version used: 3.12.6
Bug Report
mypy.nodes.get_member_expr_fullnameformats aMemberExprinto a dotted-name string if possible, or returnsNoneif formatting theMemberExprin that way is not possible (i.e. it contains expressions other than names and attribute accesses).Sometimes when a dotted-name representation is not possible, it will return a string with an embedded
"None"(e.g."None.a.b.c") instead of returningNone.Encountered when reviewing #17178
To Reproduce
Your Environment
mypy.ini(and other config files): N/A