arrow
Return

Detecting and Explaining Python Name Errors

delete2025-02-01
delete0
PRE
AI
J
Jiawei Wang *
L
Li Li
刘
刘奎 (Kui Liu)
DOI:10.1016/j.infsof.2024.107592delete
deleteOriginal
deleteOriginal request for help
deleteShare
deleteSave
Abstract

Abstract

En 中文
Python has become one of the most popular programming languages nowadays but has not received enough attention from the software engineering community. Many errors, either fixed or not yet, have been scattered in the lifetime of Python projects, including popular Python libraries that have already been reused. NameError is among one of those errors that are widespread in the Python community, as confirmed in our empirical study. Yet, our community has not put effort into helping developers mitigate its introductions. To fill this gap, we propose in this work a static analysis-based approach called DENE (short for D etecting and E xplaining N ame E rrors) to automatically detect and explain name errors in Python projects. To this end, DENE builds control-flow graphs for Python projects and leverages a scope-aware reaching definition analysis to locate identifiers that may cause name errors at runtime and report their locations. Experimental results on carefully crafted ground truth demonstrate that DENE is effective in detecting name errors in real-world Python projects. The results also confirm that unknown name errors are still widely presented in popular Python projects and libraries, and the outputs of DENE can indeed help developers understand why the name errors are flagged as such.
Keywords:
Static analysis
Python code
Tools
Empirical studies

Journal

Information and Software Technology cover
Information and Software Technology
IF:
4.3
Papers:
3.8K
Citations:
7.7K

Organization

M
Monash University
Scholars:
5.4W
Papers: 5.4W
Citations: 79
H
huawei technologies
Scholars:
3.3K
Papers: 2.9K
Citations: 1
B
Beihang University
Scholars:
5.2W
Papers: 4.1W
Citations: 37
researcher View more organizations
Cited Papers

Cited Papers

Analysis of the collagen content and tensile strength of the aponeurotic scar - an experimental study in pigs
err1999-02-01
err0
PREAI
errE. Brenda; A. Marques; P. H. N. Saldiva; M. C. Davini; M. D. Pereira; E. Minami; M. C. Ferreira
errShare
errSave
Bacillus Calmette-Guérin Treatment and Vesicorenal Reflux
err2017-08-11
err0
PREAI
errA. Böhle; J. Schüller; A. Knipper; A. Hofstetter
errShare
errSave
Enhanced loading of a magneto-optic trap from an atomic beam
err1994-11-01
err0
PREAI
errBrian P. Anderson; Mark A. Kasevich
errShare
errSave
Effect of early dietary amino acid restrictions on serum metabolites in pigs selected for lean growth efficiency
err2006-12-01
err0
errOAAI
errH. R. Mule; L. I. Chiba; J. Fabian; D. L. Kuhlers; S. B. Jungst; L. T. Frobish; K. Nadarajah; W. G. Bergen; E. G. Welles
errShare
errSave
The advantages of normocalcemic continuous warm cardioplegia over low calcemic cardioplegia in myocardial protection
err1999-09-01
err0
PREAI
errYoshinobu Nakamura; Naoaki Takemoto; Hiroaki Kuroda; Shigetsugu Ohgi
errShare
errSave
Anatomy of pudendal nerve at urogenital diaphragm—new critical site for nerve entrapment
err2005-11-01
err0
PREAI
errStephan Hruby; Johannes Ebmer; A. Lee Dellon; Oskar C. Aszmann
errShare
errSave
researcher View more