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

Function python_to_string

src/engine/function.cpp:5425–5447  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5423 */
5424
5425OBJECT * python_to_string( PyObject * value )
5426{
5427 if ( PyString_Check( value ) )
5428 return object_new( PyString_AS_STRING( value ) );
5429
5430 /* See if this instance defines the special __jam_repr__ method. */
5431 if ( PyInstance_Check( value )
5432 && PyObject_HasAttrString( value, "__jam_repr__" ) )
5433 {
5434 PyObject * repr = PyObject_GetAttrString( value, "__jam_repr__" );
5435 if ( repr )
5436 {
5437 PyObject * arguments2 = PyTuple_New( 0 );
5438 PyObject * value2 = PyObject_Call( repr, arguments2, 0 );
5439 Py_DECREF( repr );
5440 Py_DECREF( arguments2 );
5441 if ( PyString_Check( value2 ) )
5442 return object_new( PyString_AS_STRING( value2 ) );
5443 Py_DECREF( value2 );
5444 }
5445 }
5446 return 0;
5447}
5448
5449
5450static module_t * python_module()

Callers 1

call_python_functionFunction · 0.85

Calls 1

object_newFunction · 0.85

Tested by

no test coverage detected