https://bugs.kde.org/show_bug.cgi?id=403027
Bug ID: 403027
Summary: type inference bloats when functools.partial is
present, but functools is not imported
Product: kdev-python
Version: 5.3.1
Platform: openSUSE RPMs
OS: Linux
Status: REPORTED
Severity: minor
Priority: NOR
Component: Code completion
Assignee: [email protected]
Reporter: [email protected]
Target Milestone: ---
SUMMARY
For the following code, inferred type for bar grows exponentially each time
file is reparsed (during the save, I presume), in the end this causes kdevelop
to hung because it took too much to process it.
from typing import List, Optional, Tuple
class Instance:
pass
def ham(instances: List[Instance]) -> List[Instance]:
command_args = ["true"]
action = functools.partial(bar, command_args=command_args)
instances = map(action, instances)
return list(filter(None, instances))
def bar(instance: Instance, command_args: List[str]) -> Optional[Instance]:
return instance
Note that importing functools resolves the issue.
OBSERVED RESULT
unsure (Instance, function unsure (Instance, function Instance (Instance,
mixed)) (unsure (Instance, function Instance (Instance, mixed)), mixed)) bar(
unsure (Instance, function unsure (Instance, function Instance (Instance,
mixed)) (unsure (Instance, function Instance (Instance, mixed)), mixed))
instance, mixed command_args )
EXPECTED RESULT
Instance bar( Instance instance, mixed command_args)
SOFTWARE/OS VERSIONS
KDE Frameworks 5.45.0
Qt 5.9.4 (built against 5.9.4)
The xcb windowing system
ADDITIONAL INFORMATION
--
You are receiving this mail because:
You are watching all bug changes.