| 2237 | |
| 2238 | |
| 2239 | PyObject * bjam_backtrace( PyObject * self, PyObject * args ) |
| 2240 | { |
| 2241 | PyObject * result = PyList_New( 0 ); |
| 2242 | struct frame * f = frame_before_python_call; |
| 2243 | |
| 2244 | for ( ; f = f->prev; ) |
| 2245 | { |
| 2246 | PyObject * tuple = PyTuple_New( 4 ); |
| 2247 | char const * file; |
| 2248 | int line; |
| 2249 | char buf[ 32 ]; |
| 2250 | string module_name[ 1 ]; |
| 2251 | |
| 2252 | get_source_line( f, &file, &line ); |
| 2253 | sprintf( buf, "%d", line ); |
| 2254 | string_new( module_name ); |
| 2255 | if ( f->module->name ) |
| 2256 | { |
| 2257 | string_append( module_name, object_str( f->module->name ) ); |
| 2258 | string_append( module_name, "." ); |
| 2259 | } |
| 2260 | |
| 2261 | /* PyTuple_SetItem steals reference. */ |
| 2262 | PyTuple_SetItem( tuple, 0, PyString_FromString( file ) ); |
| 2263 | PyTuple_SetItem( tuple, 1, PyString_FromString( buf ) ); |
| 2264 | PyTuple_SetItem( tuple, 2, PyString_FromString( module_name->value ) ); |
| 2265 | PyTuple_SetItem( tuple, 3, PyString_FromString( f->rulename ) ); |
| 2266 | |
| 2267 | string_free( module_name ); |
| 2268 | |
| 2269 | PyList_Append( result, tuple ); |
| 2270 | Py_DECREF( tuple ); |
| 2271 | } |
| 2272 | return result; |
| 2273 | } |
| 2274 | |
| 2275 | PyObject * bjam_caller( PyObject * self, PyObject * args ) |
| 2276 | { |
nothing calls this directly
no test coverage detected