[unladen-swallow] r941 committed - Fix a segfault in llvm_clear_feedback.

0 views
Skip to first unread message

unladen...@googlecode.com

unread,
Dec 17, 2009, 8:33:45 PM12/17/09
to unladen...@googlegroups.com
Revision: 941
Author: collinw
Date: Thu Dec 17 17:33:17 2009
Log: Fix a segfault in llvm_clear_feedback.
http://code.google.com/p/unladen-swallow/source/detail?r=941

Modified:
/trunk/Modules/_llvm.cc

=======================================
--- /trunk/Modules/_llvm.cc Fri Oct 9 14:23:13 2009
+++ /trunk/Modules/_llvm.cc Thu Dec 17 17:33:17 2009
@@ -93,13 +93,16 @@
code = (PyCodeObject *)func->func_code;
}
else if (PyMethod_Check(obj)) {
- PyFunctionObject *func =
- (PyFunctionObject *)((PyMethodObject *)obj)->im_func;
- code = (PyCodeObject *)func->func_code;
+ // Methods contain other callable objects, including, potentially
other
+ // methods.
+ return llvm_clear_feedback(self, ((PyMethodObject *)obj)->im_func);
}
else if (PyCode_Check(obj)) {
code = (PyCodeObject *)obj;
}
+ else if (PyCFunction_Check(obj)) { // No feedback; this is a no-op.
+ Py_RETURN_NONE;
+ }
else {
PyErr_Format(PyExc_TypeError,
"cannot clear feedback for %.100s objects",

Reply all
Reply to author
Forward
0 new messages