File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed
Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -128,10 +128,13 @@ def get_docstring_and_version_via_ast(target):
128128 for child in node .body :
129129 # Only use the version from the given module if it's a simple
130130 # string assignment to __version__
131- is_version_str = (isinstance (child , ast .Assign ) and
132- len (child .targets ) == 1 and
133- child .targets [0 ].id == "__version__" and
134- isinstance (child .value , ast .Str ))
131+ is_version_str = (
132+ isinstance (child , ast .Assign )
133+ and len (child .targets ) == 1
134+ and isinstance (child .targets [0 ], ast .Name )
135+ and child .targets [0 ].id == "__version__"
136+ and isinstance (child .value , ast .Str )
137+ )
135138 if is_version_str :
136139 version = child .value .s
137140 break
Original file line number Diff line number Diff line change 22Docstring formatted like this.
33"""
44
5+ a = {}
6+ # An assignment to a subscript (a['test']) broke introspection
7+ # https://github.com/takluyver/flit/issues/343
8+ a ['test' ] = 6
9+
510__version__ = '7.0'
You can’t perform that action at this time.
0 commit comments