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

Function python_to_string

src/engine/function.c:4887–4909  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4885 */
4886
4887OBJECT * python_to_string( PyObject * value )
4888{
4889 if ( PyString_Check( value ) )
4890 return object_new( PyString_AS_STRING( value ) );
4891
4892 /* See if this instance defines the special __jam_repr__ method. */
4893 if ( PyInstance_Check( value )
4894 && PyObject_HasAttrString( value, "__jam_repr__" ) )
4895 {
4896 PyObject * repr = PyObject_GetAttrString( value, "__jam_repr__" );
4897 if ( repr )
4898 {
4899 PyObject * arguments2 = PyTuple_New( 0 );
4900 PyObject * value2 = PyObject_Call( repr, arguments2, 0 );
4901 Py_DECREF( repr );
4902 Py_DECREF( arguments2 );
4903 if ( PyString_Check( value2 ) )
4904 return object_new( PyString_AS_STRING( value2 ) );
4905 Py_DECREF( value2 );
4906 }
4907 }
4908 return 0;
4909}
4910
4911
4912static module_t * python_module()

Callers 1

call_python_functionFunction · 0.85

Calls 1

object_newFunction · 0.85

Tested by

no test coverage detected