|
Boost-Build : |
Subject: Re: [Boost-build] Access violation patch
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2011-11-22 09:46:35
AMDG
On 11/22/2011 03:21 AM, Vladimir Prus wrote:
> [Adding list to CC]
>
> On 21/11/11 19:31, Juraj Ivanèiæ wrote:
>> I produced a patch which fixes access violation from my previous e-mail.
>
> Thanks for the patch! Comitted in revision 75605.
>
> - Volodya
>
>> Index: build/toolset.py
>> ===================================================================
>> --- build/toolset.py (revision 75578)
>> +++ build/toolset.py (working copy)
>> @@ -117,8 +117,8 @@
>> is specified, then the value of 'feature'
>> will be added.
>> """
>> - caller = bjam.caller()[:-1]
>> - if not '.' in rule_or_module and caller.startswith("Jamfile"):
>> + caller = bjam.caller()
>> + if not '.' in rule_or_module and caller and
>> caller[:-1].startswith("Jamfile"):
>> # Unqualified rule name, used inside Jamfile. Most likely
>> used with
>> # 'make' or 'notfile' rules. This prevents setting flags on
>> the entire
>> # Jamfile module (this will be considered as rule), but who
>> cares?
>> Index: engine/builtins.c
>> ===================================================================
>> --- engine/builtins.c (revision 75578)
>> +++ engine/builtins.c (working copy)
>> @@ -2140,9 +2140,9 @@
>>
>> PyObject * bjam_caller( PyObject * self, PyObject * args )
>> {
>> - PyObject *result = PyString_FromString(
>> - frame_before_python_call->prev->module->name);
>> - return result;
>> + if ( !frame_before_python_call )
>> + Py_RETURN_NONE;
>> + return
>> PyString_FromString(frame_before_python_call->prev->module->name);
>> }
>>
>> #endif /* #ifdef HAVE_PYTHON */
>> Index: engine/compile.c
>> ===================================================================
>> --- engine/compile.c (revision 75578)
>> +++ engine/compile.c (working copy)
>> @@ -865,6 +865,7 @@
>>
>> frame_before_python_call = frame;
>> py_result = PyObject_Call( r->python_function, arguments, kw );
>> + frame_before_python_call = NULL;
This is still wrong. The correct fix is
to save and restore frame_before_python_call.
Otherwise, you can get cases like this
bjam:
python:
bjam:
python
bjam_call -> returns None
>> Py_DECREF(arguments);
>> Py_XDECREF(kw);
>> if ( py_result != NULL )
>
In Christ,
Steven Watanabe
Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk