MCPcopy Create free account
hub / github.com/boostorg/build / arg_list_compile_python

Function arg_list_compile_python

src/engine/function.cpp:5273–5314  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5271#ifdef HAVE_PYTHON
5272
5273static struct arg_list * arg_list_compile_python( PyObject * bjam_signature,
5274 int32_t * num_arguments )
5275{
5276 if ( bjam_signature )
5277 {
5278 struct argument_list_compiler c[ 1 ];
5279 struct arg_list * result;
5280 Py_ssize_t s;
5281 Py_ssize_t i;
5282 argument_list_compiler_init( c );
5283
5284 s = PySequence_Size( bjam_signature );
5285 for ( i = 0; i < s; ++i )
5286 {
5287 struct argument_compiler arg_comp[ 1 ];
5288 struct arg_list arg;
5289 PyObject * v = PySequence_GetItem( bjam_signature, i );
5290 Py_ssize_t j;
5291 Py_ssize_t inner;
5292 argument_compiler_init( arg_comp );
5293
5294 inner = PySequence_Size( v );
5295 for ( j = 0; j < inner; ++j )
5296 argument_compiler_add( arg_comp, object_new( PyString_AsString(
5297 PySequence_GetItem( v, j ) ) ), constant_builtin, -1 );
5298
5299 arg = arg_compile_impl( arg_comp, constant_builtin, -1 );
5300 dynamic_array_push( c->args, arg );
5301 argument_compiler_free( arg_comp );
5302 Py_DECREF( v );
5303 }
5304
5305 *num_arguments = c->args->size;
5306 result = (struct arg_list *)BJAM_MALLOC( c->args->size * sizeof( struct arg_list ) );
5307 memcpy( result, c->args->data, c->args->size * sizeof( struct arg_list )
5308 );
5309 argument_list_compiler_free( c );
5310 return result;
5311 }
5312 *num_arguments = 0;
5313 return 0;
5314}
5315
5316FUNCTION * function_python( PyObject * function, PyObject * bjam_signature )
5317{

Callers 1

function_pythonFunction · 0.85

Calls 7

argument_compiler_initFunction · 0.85
argument_compiler_addFunction · 0.85
object_newFunction · 0.85
arg_compile_implFunction · 0.85
argument_compiler_freeFunction · 0.85

Tested by

no test coverage detected