https://bugs.kde.org/show_bug.cgi?id=399534
Bug ID: 399534 Summary: Wrong type for value returned by context manager Product: kdev-python Version: 5.2.4 Platform: Other OS: Linux Status: REPORTED Severity: normal Priority: NOR Component: Language support Assignee: m...@svenbrauch.de Reporter: nicolas.alva...@gmail.com Target Milestone: --- In the Python 'with' statement, an 'as' clause can be used to store the value returned by the context manager: class Mgr: def __enter__(self): return "text" def __exit__(self, *args): pass with Mgr() as asd: print(asd) However, kdev-python incorrectly marks 'asd' as having type 'Mgr', when the correct type here should be 'str'. This happens to work for the common pattern of "with open(...) as f:" because file objects return themselves in __enter__, but other context managers don't. -- You are receiving this mail because: You are watching all bug changes.