2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-13 00:12:11 +00:00

Fix a crash when using bjam.caller.

Patch from Juraj Ivančić


[SVN r75605]
This commit is contained in:
Vladimir Prus
2011-11-22 11:20:42 +00:00
parent 564db3ed4c
commit 52eb370501
3 changed files with 6 additions and 5 deletions

View File

@@ -117,8 +117,8 @@ def flags(rule_or_module, variable_name, condition, values = []):
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?

View File

@@ -2140,9 +2140,9 @@ PyObject * bjam_backtrace( PyObject * self, PyObject * args )
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 */

View File

@@ -865,6 +865,7 @@ call_python_function(RULE* r, FRAME* frame)
frame_before_python_call = frame;
py_result = PyObject_Call( r->python_function, arguments, kw );
frame_before_python_call = NULL;
Py_DECREF(arguments);
Py_XDECREF(kw);
if ( py_result != NULL )