Bugs in the Shadows: Static Detection of Faulty Python Refactorings

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Oliveira, Jonhnanthan, Gheyi, Rohit, Ribeiro, Márcio, Garcia, Alessandro
Format: Preprint
Published: 2025
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866915626408214528
author Oliveira, Jonhnanthan
Gheyi, Rohit
Ribeiro, Márcio
Garcia, Alessandro
author_facet Oliveira, Jonhnanthan
Gheyi, Rohit
Ribeiro, Márcio
Garcia, Alessandro
contents Python is a widely adopted programming language, valued for its simplicity and flexibility. However, its dynamic type system poses significant challenges for automated refactoring - an essential practice in software evolution aimed at improving internal code structure without changing external behavior. Understanding how type errors are introduced during refactoring is crucial, as such errors can compromise software reliability and reduce developer productivity. In this work, we propose a static analysis technique to detect type errors introduced by refactoring implementations for Python. We evaluated our technique on Rope refactoring implementations, applying them to open-source Python projects. Our analysis uncovered 29 bugs across four refactoring types from a total of 1,152 refactoring attempts. Several of these issues were also found in widely used IDEs such as PyCharm and PyDev. All reported bugs were submitted to the respective developers, and some of them were acknowledged and accepted. These results highlight the need to improve the robustness of current Python refactoring tools to ensure the correctness of automated code transformations and support reliable software maintenance.
format Preprint
id arxiv_https___arxiv_org_abs_2507_01103
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle Bugs in the Shadows: Static Detection of Faulty Python Refactorings
Oliveira, Jonhnanthan
Gheyi, Rohit
Ribeiro, Márcio
Garcia, Alessandro
Software Engineering
Python is a widely adopted programming language, valued for its simplicity and flexibility. However, its dynamic type system poses significant challenges for automated refactoring - an essential practice in software evolution aimed at improving internal code structure without changing external behavior. Understanding how type errors are introduced during refactoring is crucial, as such errors can compromise software reliability and reduce developer productivity. In this work, we propose a static analysis technique to detect type errors introduced by refactoring implementations for Python. We evaluated our technique on Rope refactoring implementations, applying them to open-source Python projects. Our analysis uncovered 29 bugs across four refactoring types from a total of 1,152 refactoring attempts. Several of these issues were also found in widely used IDEs such as PyCharm and PyDev. All reported bugs were submitted to the respective developers, and some of them were acknowledged and accepted. These results highlight the need to improve the robustness of current Python refactoring tools to ensure the correctness of automated code transformations and support reliable software maintenance.
title Bugs in the Shadows: Static Detection of Faulty Python Refactorings
topic Software Engineering
url https://arxiv.org/abs/2507.01103