Created
May 8, 2012 13:18
-
-
Save DamienCassou/2634899 to your computer and use it in GitHub Desktop.
Coccinelle semantic patch to find misuses of PyDescr_NewMethod with respect to reference counters in cpython
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@r exists@ | |
local idexpression x; | |
expression e; | |
position p1,p2; | |
@@ | |
x = PyDescr_NewMethod@p1(...) | |
... when != Py_INCREF(x) | |
when != Py_XINCREF(x) | |
when != Py_DECREF(x) | |
when != Py_XDECREF(x) | |
when != e = x | |
when != true x == NULL | |
( | |
return <+...x...+>; | |
| | |
return@p2 ...; | |
) | |
@script:python@ | |
p1 << r.p1; | |
p2 << r.p2; | |
@@ | |
cocci.print_main("call",p1) | |
cocci.print_secs("ret",p2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I had gone through all you do DamienCassou,
well done. Can we join to work the project together?