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

Function python_to_string

v2/engine/function.c:4751–4773  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4749 */
4750
4751OBJECT * python_to_string( PyObject * value )
4752{
4753 if ( PyString_Check( value ) )
4754 return object_new( PyString_AS_STRING( value ) );
4755
4756 /* See if this instance defines the special __jam_repr__ method. */
4757 if ( PyInstance_Check( value )
4758 && PyObject_HasAttrString( value, "__jam_repr__" ) )
4759 {
4760 PyObject * repr = PyObject_GetAttrString( value, "__jam_repr__" );
4761 if ( repr )
4762 {
4763 PyObject * arguments2 = PyTuple_New( 0 );
4764 PyObject * value2 = PyObject_Call( repr, arguments2, 0 );
4765 Py_DECREF( repr );
4766 Py_DECREF( arguments2 );
4767 if ( PyString_Check( value2 ) )
4768 return object_new( PyString_AS_STRING( value2 ) );
4769 Py_DECREF( value2 );
4770 }
4771 }
4772 return 0;
4773}
4774
4775
4776static module_t * python_module()

Callers 1

call_python_functionFunction · 0.85

Calls 1

object_newFunction · 0.85

Tested by

no test coverage detected