Coding Pitfalls: Demystifying the Potential API Compatibility Risk of Variadic Parameters in Python

Abstract

In Python development, developers often use variadic parameters, i.e., *args and **kwargs, to ensure backward compatibility of APIs after parameter changes or enhancements. Variadic parameters enable APIs to accept an arbitrary number of arguments. However, our preliminary investigation reveals that when an API with variadic parameters internally passes these parameters to other APIs that do not support variadic parameters, it may introduce potential compatibility issues, i.e., variadic parameter pitfalls (VPPs). In this work, we explore the prevalence and impact of VPPs by conducting an empirical study on 33 popular Python third-party libraries using a prototype tool, i.e., VPPDetector. We provide recommendations to mitigate VPPs based on our findings.

Publication
2024 IEEE 35th International Symposium on Software Reliability Engineering (ISSRE) - Fast Abstract Track
Date
Links