summaryrefslogtreecommitdiffstats
path: root/src/boost/tools/boost_install/test/python/quick.cpp
blob: 4f31cb9e80a69e2f7efc2d48ad7f6c3800bde448 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// Copyright 2017, 2018 Peter Dimov.
//
// Distributed under the Boost Software License, Version 1.0.
//
// See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt

#if defined(_WIN32)
# define BOOST_PYTHON_STATIC_LIB
#endif
#include <boost/python.hpp>
#include <boost/core/lightweight_test.hpp>

namespace python = boost::python;

int main()
{
    Py_Initialize();

    python::dict env;
    python::object result = python::exec( "number = 42", env, env );

    BOOST_TEST_EQ( python::extract<int>( env["number"] ), 42 );

    return boost::report_errors();
}