Bug 275661

Summary: The return value of dict.fromkeys() is incorrectly given as list
Product: [Developer tools] kdev-python Reporter: Eike Hein <hein>
Component: generalAssignee: kdevelop-bugs-null
Status: RESOLVED FIXED    
Severity: normal CC: mail
Priority: NOR    
Version: git master   
Target Milestone: 1.2.0   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:

Description Eike Hein 2011-06-14 22:38:34 UTC
Title pretty much says it all :-). It correctly assumes dict for copy() though. I tried to look at the code to fix this, but couldn't make sense of it in the time I had - if it's going by the "return {}" in builtindocumentation.py it should do the right thing, but it doesn't. I looked at the DUChain code a bit, but couldn't track things down there.
Comment 1 Eike Hein 2011-06-14 22:40:49 UTC
I should also add for completeness' sake that for some reason, KDevelop has now stopped showing the tooltip for fromkeys() in a "foo = dict.fromkeys(bar, False)" line, even after restarting it. It worked initially though, and I didn't change the code ...
Comment 2 Sven Brauch 2011-06-15 00:48:43 UTC
Should be fixed in b27ee95, there was a function called dict(), too. This should instead be the constructor of the class (but as the plugin doesn't support constructors yet, it doesn't matter).
This, however, made me aware of another issue with classes that don't exist showing up in autocompletion (for example the "dict" pseudo-class from the documentation file). This is however unrelated and I'll fix it asap. :)
Thanks for reporting.
Comment 3 Eike Hein 2011-06-15 01:01:06 UTC
Thanks for the fix :).
Comment 4 Eike Hein 2011-06-15 01:03:58 UTC
And for the record, after pulling and building and installing I still didn't get a tooltip for fromkeys() anymore, so I deleted ~/.kdevduchain, now it works again ...
Comment 5 Sven Brauch 2011-06-15 13:51:55 UTC
Yes, the documentation file probably will not be reparsed automatically, so you would have needed to open it by hand and press F5. But your solution is also possible. :]
Comment 6 Eike Hein 2011-06-15 22:54:07 UTC
The issue is subtly bigger/different than this though :). Prior to your commit, the tooltip for fromkeys() originally worked, then stopped working, so the DUChain data must have gotten corrupted somehow. Then you made the fix, I grabbed it and restarted, and it didn't help with the missing tooltip until I wiped the data. As you mentioned the latter is probably because it wasn't reparsed automatically, but the more interesting thing is the original problem where the tooltip initially stopped working ... which I probably should file separately if it happens more often and I can detect some kind of pattern to it.
Comment 7 Sven Brauch 2011-06-16 00:13:03 UTC
Hi,

it is possible that such a bug exists, however I can't even explain why it worked before the fix anyways. There was no object named "dict" with the correct type, as far as I'm aware. Maybe you had something like that declared in the context where the tooltip worked, but not in another one?
I'd suggest to just forget about that until it reappears, because I can imagine it won't. :)

Cheers,
Sven