Write a Blog >>
ICSE 2021
Mon 17 May - Sat 5 June 2021

Call graphs play an important role in different contexts, such as profiling and vulnerability propagation analysis. Generating call graphs in an efficient manner can be a challenging task when it comes to high-level languages that are modular and incorporate dynamic features and higher-order functions.

Despite the language’s popularity, there have been very few tools aiming to generate call graphs for Python programs. Worse, these tools suffer from several effectiveness issues that limit their practicality in realistic programs. We propose a pragmatic, static approach for call graph generation in Python. We compute all assignment relations between program identifiers of functions, variables, classes, and modules through an inter-procedural analysis. Based on these assignment relations, we produce the resulting call graph by resolving all calls to potentially invoked functions. Notably, the underlying analysis is designed to be efficient and scalable, handling several Python features, such as modules, generators, function closures, and multiple inheritance.

We have evaluated our prototype implementation, which we call PyCG, using two benchmarks: a micro-benchmark suite containing small Python programs and a set of macro-benchmarks with several popular real-world Python packages. Our results indicate that PyCG can efficiently handle thousands of lines of code in less than a second (0.38 seconds for 1k LoC on average). Further, it outperforms the state-of-the-art for Python in both precision and recall: PyCG achieves high rates of precision ~99.2%, and adequate recall ~69.9%. Finally, we demonstrate how PyCG can aid dependency impact analysis by showcasing a potential enhancement to GitHub’s "security advisory'' notification service using a real-world example.

Wed 26 May

Displayed time zone: Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna change

11:20 - 12:20
2.1.4. Tools for the Python LanguageTechnical Track at Blended Sessions Room 4 +12h
Chair(s): Igor Steinmacher Northern Arizona University, USA
11:20
20m
Research paper
Restoring Execution Environments of Jupyter NotebooksTechnical Track
Technical Track
Jiawei Wang Monash University, Li Li Monash University, Andreas Zeller CISPA Helmholtz Center for Information Security
Pre-print Media Attached
11:40
20m
Paper
PyART: Python API Recommendation in Real-TimeArtifact ReusableTechnical Track
Technical Track
Xincheng He State Key Laboratory for Novel Software Technology, Nanjing University, Lei Xu State Key Laboratory for Novel Software Technology, Nanjing University, Xiangyu Zhang Purdue University, Rui Hao State Key Laboratory for Novel Software Technology Nanjing University, Yang Feng State Key Laboratory for Novel Software Technology, Nanjing University, Baowen Xu Nanjing University
Pre-print Media Attached
12:00
20m
Paper
PyCG: Practical Call Graph Generation in PythonArtifact ReusableTechnical TrackArtifact Available
Technical Track
Vitalis Salis Athens University of Economics and Business, National and Technical University of Athens, Thodoris Sotiropoulos Athens University of Economics and Business, Panos Louridas Athens University of Economics and Business, Diomidis Spinellis Athens University of Economics and Business & TU Delft, Dimitris Mitropoulos National and Kapodistrian University of Athens
Pre-print Media Attached
23:20 - 00:20
2.1.4. Tools for the Python LanguageTechnical Track at Blended Sessions Room 4
23:20
20m
Research paper
Restoring Execution Environments of Jupyter NotebooksTechnical Track
Technical Track
Jiawei Wang Monash University, Li Li Monash University, Andreas Zeller CISPA Helmholtz Center for Information Security
Pre-print Media Attached
23:40
20m
Paper
PyART: Python API Recommendation in Real-TimeArtifact ReusableTechnical Track
Technical Track
Xincheng He State Key Laboratory for Novel Software Technology, Nanjing University, Lei Xu State Key Laboratory for Novel Software Technology, Nanjing University, Xiangyu Zhang Purdue University, Rui Hao State Key Laboratory for Novel Software Technology Nanjing University, Yang Feng State Key Laboratory for Novel Software Technology, Nanjing University, Baowen Xu Nanjing University
Pre-print Media Attached
00:00
20m
Paper
PyCG: Practical Call Graph Generation in PythonArtifact ReusableTechnical TrackArtifact Available
Technical Track
Vitalis Salis Athens University of Economics and Business, National and Technical University of Athens, Thodoris Sotiropoulos Athens University of Economics and Business, Panos Louridas Athens University of Economics and Business, Diomidis Spinellis Athens University of Economics and Business & TU Delft, Dimitris Mitropoulos National and Kapodistrian University of Athens
Pre-print Media Attached