Remove FunctionRecord objects in favor of existing PyMethodDef globals (issue179086)

0 views
Skip to first unread message

reid.k...@gmail.com

unread,
Dec 16, 2009, 6:11:05 PM12/16/09
to col...@gmail.com, unladen...@googlegroups.com, re...@codereview.appspotmail.com
Reviewers: Collin Winter,

Message:
PTAL. This assumes that all PyMethodDefs are global and live forever,
which is certainly the case in CPython, and should be for all extension
modules. I can imagine someone allocating a PyMethodDef and taking a
weakref to the PyCFunction (does it even support that?) and then
deallocating the methoddef when it's freed, but that's insane.



Please review this at http://codereview.appspot.com/179086

Affected files:
M Python/llvm_fbuilder.cc
M Util/RuntimeFeedback.cc
M Util/RuntimeFeedback.h


col...@gmail.com

unread,
Dec 16, 2009, 7:23:43 PM12/16/09
to reid.k...@gmail.com, unladen...@googlegroups.com, re...@codereview.appspotmail.com

http://codereview.appspot.com/179086/diff/8/10
File Util/RuntimeFeedback.cc (left):

http://codereview.appspot.com/179086/diff/8/10#oldcode59
Util/RuntimeFeedback.cc:59: else if (src.InFuncMode() &&
src.data_[i].getPointer() != NULL) {
You can't Py_INCREF a PyMethodDef. FuncMode needs to stick around.

http://codereview.appspot.com/179086

reid.k...@gmail.com

unread,
Dec 16, 2009, 8:20:48 PM12/16/09
to col...@gmail.com, unladen...@googlegroups.com, re...@codereview.appspotmail.com

http://codereview.appspot.com/179086/diff/8/10
File Util/RuntimeFeedback.cc (left):

http://codereview.appspot.com/179086/diff/8/10#oldcode59
Util/RuntimeFeedback.cc:59: else if (src.InFuncMode() &&
src.data_[i].getPointer() != NULL) {

On 2009/12/17 00:23:43, Collin Winter wrote:
> You can't Py_INCREF a PyMethodDef. FuncMode needs to stick around.

I didn't remove func mode, so don't worry, it doesn't try to incref the
PyMethodDef. It just copies the data as normal.

http://codereview.appspot.com/179086

collin...@google.com

unread,
Dec 17, 2009, 3:38:38 PM12/17/09
to reid.k...@gmail.com, col...@gmail.com, unladen...@googlegroups.com, re...@codereview.appspotmail.com
Reply all
Reply to author
Forward
0 new messages