PyTER: effective program repair for Python type errors
Wonseok Oh, Hakjoo Oh
Abstract
We present PyTER, an automated program repair (APR) technique for Python type errors. Python developers struggle with type error exceptions that are prevalent and difficult to fix. Despite the importance, however, automatically repairing type errors in dynamically typed languages such as Python has received little attention in the APR community and no existing techniques are readily available for practical use. PyTER is the first technique that is carefully designed to fix diverse type errors in real-world Python applications. To this end, we present a novel APR approach that uses dynamic and static analyses to infer correct and incorrect types of program variables, and leverage their difference to effectively identify faulty locations and patch candidates. We evaluated PyTER on 93 type errors collected from open-source projects. The result shows that PyTER is able to fix 48.4% of them with a precision of 77.6%.
Ask about this paper
Ask your agent about it.
Lune has read the top-tier papers around this one, so every answer names the papers it rests on.
Your agent calls
Lunesearch_papers
Free to start. No credit card required.
Terminal
Install the CLIlune papers get d811e47a-c3d6-4d4d-a7ae-40b6743e9cf0Cited by top-tier papers15
- RAP-Gen: Retrieval-Augmented Patch Generation with CodeT5 for Automatic Program RepairWeishi Wang, Yue Wang, Shafiq Joty, Steven C. H. HoiFSE 2023 · 84 citations
- Domain Knowledge Matters: Improving Prompts with Fix Templates for Repairing Python Type ErrorsYun Peng, Shuzheng Gao, Cuiyun Gao, Yintong Huo et al.ICSE 2024 · 39 citations
- Generative Type Inference for PythonYun Peng, Chaozheng Wang, Wenxuan Wang, Cuiyun Gao et al.ASE 2023 · 29 citations
- PyTy: Repairing Static Type Errors in PythonYiu Wai Chow, Luca Di Grazia, Michael PradelICSE 2024 · 13 citations
- The Fact Selection Problem in LLM-Based Program RepairNikhil Parasaram, Huijie Yan, Boyu Yang, Zineb Flahy et al.ICSE 2025 · 11 citations
Related papers
- DLInfer: Deep Learning with Static Slicing for Python Type InferenceYanyan Yan, Yang Feng, Hongcheng Fan, Baowen XuICSE 2023 · 9 citations
- Towards Effective Static Type-Error Detection for PythonWonseok Oh, Hakjoo OhASE 2024 · 1 citation
- Reflective Unit Test Generation for Precise Type Error Detection with Large Language ModelsChen Yang, Ziqi Wang, Yanjie Jiang, Lin Yang et al.ASE 2025 · 1 citation
- Automating Just-In-Time Python Type Annotation UpdatingZhipeng Xue, Zhipeng Gao, Xing Hu, Jingyuan Chen et al.ICSE 2026
- Static Type Recommendation for PythonKe Sun, Yifan Zhao, Dan Hao, Lu ZhangASE 2022 · 6 citations
