Finding Reference-Counting Errors in Python']Python/C Programs with Affine Analysis

被引:0
作者
Li, Siliang [1 ]
Tan, Gang [1 ]
机构
[1] Lehigh Univ, Bethlehem, PA 18015 USA
来源
ECOOP 2014 - OBJECT-ORIENTED PROGRAMMING | 2014年 / 8586卷
关键词
!text type='Python']Python[!/text]/C; reference counting; affine programs; static analysis; LANGUAGE; !text type='JAVA']JAVA[!/text; CHECKING; SAFETY;
D O I
暂无
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
Python is a popular programming language that uses reference counting to manage heap objects. Python also has a Foreign Function Interface (FFI) that allows Python extension modules to be written in native code such as C and C++. Native code, however, is outside Python's system of memory management; therefore extension programmers are responsible for making sure these objects are reference counted correctly. This is an error prone process when code becomes complex. In this paper, we propose Pungi, a system that statically checks whether Python objects' reference counts are adjusted correctly in Python/C interface code. Pungi transforms Python/C interface code into affine programs with respect to our proposed abstractions of reference counts. Our system performs static analysis on transformed affine programs and reports possible reference counting errors. Our prototype implementation found over 150 errors in a set of Python/C programs.
引用
收藏
页码:80 / 104
页数:25
相关论文
共 27 条
[1]  
[Anonymous], 2013, PYTHON C API REFEREN
[2]  
Aycock J, 2000, LECT NOTES COMPUT SC, V1781, P110
[3]  
Beazley D. M., 1997, SWIG USERS MANUAL VE
[4]   ESP: Path-sensitive program verification in polynomial time [J].
Das, M ;
Lerner, S ;
Seigle, M .
ACM SIGPLAN NOTICES, 2002, 37 (05) :57-68
[5]  
Elder M, 2011, LECT NOTES COMPUT SC, V6887, P198, DOI 10.1007/978-3-642-23702-7_17
[6]  
Emmi M, 2009, LECT NOTES COMPUT SC, V5505, P352, DOI 10.1007/978-3-642-00768-2_30
[7]  
Furr M, 2006, LECT NOTES COMPUT SC, V3924, P309
[8]   Checking type safety of foreign function calls [J].
Furr, M ;
Foster, JS .
ACM SIGPLAN NOTICES, 2005, 40 (06) :62-72
[9]   Discovering affine equalities using random interpretation [J].
Gulwani, S ;
Necula, GC .
ACM SIGPLAN NOTICES, 2003, 38 (01) :74-84
[10]   Jeannie: Granting Java']Java native interface developers their wishes [J].
Hirzel, Martin ;
Grimm, Robert .
ACM SIGPLAN NOTICES, 2007, 42 (10) :19-38