Risky Dynamic Typing Related Practices in Python: An Empirical Study

ACM Transactions on Software Engineering and Methodology(2023)

引用 0|浏览3
暂无评分
摘要
Python’s dynamic typing nature provides developers with powerful programming abstractions. However, many type related bugs are accumulated in code bases of Python due to the misuse of dynamic typing. The goal of this paper is to aid in the understanding of developers’ high-risk practices towards dynamic typing and the early detection of type related bugs. We first formulate the rules of six types of risky dynamic typing related practices (type smells for short) in Python. We then develop a rule-based tool named RUPOR which builds an accurate type base to detect type smells. Our evaluation shows that RUPOR outperforms the existing type smell detection techniques (including the LLM-based approaches, Mypy, and PYDYPE) on a benchmark of 900 Python methods. Based on RUPOR, we conduct an empirical study on 25 real-world projects. We find that type smells are significantly related to the occurrence of post-release faults. The fault-proneness prediction model built with type smell features slightly outperforms the model built without them. We also summarize the common patterns including inserting type check to fix type smell bugs. These findings provide valuable insights for preventing and fixing type related bugs in the programs written in dynamic-typed languages.
更多
查看译文
关键词
Dynamic Typing,Python,Empirical Study,Bug Fixing
AI 理解论文
溯源树
样例
生成溯源树,研究论文发展脉络
Chat Paper
正在生成论文摘要