🤖 AI Summary
This work addresses the compatibility challenges posed by platform-specific APIs when software is deployed on non-target operating systems, which undermines portability and maintainability. To tackle this issue, the paper introduces PSASpotter—the first static analysis tool tailored for Python—that automatically identifies platform-specific API calls by parsing abstract syntax trees and leveraging a curated knowledge base of platform-dependent APIs. Crucially, PSASpotter also determines whether such calls are guarded by defensive code constructs, such as try/except blocks or conditional platform checks. Beyond enabling large-scale empirical studies of cross-platform compatibility issues, the tool facilitates the discovery of alternative implementations, thereby significantly enhancing the efficiency of developing and maintaining cross-platform Python software and offering a novel approach to ensuring compatibility.
📝 Abstract
A platform-specific API is implemented for a particular platform (e.g., operating system), thus, it may not work on other platforms than the target one. Detecting the usage of such APIs is important for supporting software maintenance, as it allows maintainers to be alerted about APIs that could pose potential risks. This paper proposes PSASpotter, a tool to detect the usage of platform-specific APIs in Python systems. PSASpotter also identifies whether the platform-specific APIs are used within a defensive code, such as try/except blocks or if blocks that check the current platform. PSASpotter can support the development of novel empirical studies about the usage of platform-specific APIs in the Python ecosystem. Moreover, the defensive code detected by PSASpotter may contain alternative solutions for unavailable APIs, which can provide insights for software development and testing across multiple platforms. PSASpotter is available at: https://github.com/ricardojob/PSASpotter. Tool video: https://youtu.be/d3WyozTAKS8.