2
0
mirror of https://github.com/boostorg/python.git synced 2026-01-21 05:02:17 +00:00

Compare commits

..

1 Commits

Author SHA1 Message Date
Beman Dawes
46afdcd991 Release 1.41.0 Beta 1
[SVN r57353]
2009-11-04 12:14:07 +00:00
5 changed files with 24 additions and 19 deletions

View File

@@ -182,7 +182,7 @@ static PyTypeObject static_data_object = {
0, /* tp_alloc */
0, // filled in with type_new /* tp_new */
0, // filled in with __PyObject_GC_Del /* tp_free */
0, /* tp_is_gc */
(inquiry)type_is_gc, /* tp_is_gc */
0, /* tp_bases */
0, /* tp_mro */
0, /* tp_cache */

View File

@@ -3,9 +3,6 @@
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// boost::python::make_tuple below are for gcc 4.4 -std=c++0x compatibility
// (Intel C++ 10 and 11 with -std=c++0x don't need the full qualification).
#include <boost/python/converter/registrations.hpp>
#include <boost/python/object/function_doc_signature.hpp>
#include <boost/python/errors.hpp>
@@ -15,6 +12,7 @@
#include <boost/python/detail/signature.hpp>
#include <vector>
namespace boost { namespace python { namespace objects {
@@ -230,7 +228,7 @@ namespace boost { namespace python { namespace objects {
{
return str(
"%s %s(%s%s%s%s)"
% boost::python::make_tuple // workaround, see top
% make_tuple
( ret_type
, f->m_name
, str(",").join(formal_params.slice(0,arity-n_overloads))
@@ -241,7 +239,7 @@ namespace boost { namespace python { namespace objects {
}else{
return str(
"%s(%s%s%s%s) -> %s"
% boost::python::make_tuple // workaround, see top
% make_tuple
( f->m_name
, str(",").join(formal_params.slice(0,arity-n_overloads))
, n_overloads ? (n_overloads!=arity?str(" [,"):str("[ ")) : str()
@@ -253,7 +251,7 @@ namespace boost { namespace python { namespace objects {
return str(
"%s %s(%s%s%s%s) %s"
% boost::python::make_tuple // workaround, see top
% make_tuple
( cpp_types?ret_type:str("")
, f->m_name
, str(",").join(formal_params.slice(0,arity-n_overloads))

View File

@@ -40,7 +40,8 @@ namespace boost_python_test {
boost::python::tuple
getinitargs(const world& w)
{
return boost::python::make_tuple(w.get_country());
using namespace boost::python;
return make_tuple(w.get_country());
}
};

View File

@@ -52,14 +52,16 @@ namespace boost_python_test {
boost::python::tuple
getinitargs(const world& w)
{
return boost::python::make_tuple(w.get_country());
using namespace boost::python;
return make_tuple(w.get_country());
}
static
boost::python::tuple
getstate(const world& w)
{
return boost::python::make_tuple(w.get_secret_number());
using namespace boost::python;
return make_tuple(w.get_secret_number());
}
static
@@ -75,7 +77,7 @@ namespace boost_python_test {
);
throw_error_already_set();
}
long number = extract<long>(state[0]);
if (number != 42)
w.set_secret_number(number);

View File

@@ -25,6 +25,10 @@
#include <boost/python/extract.hpp>
#include <boost/python/back_reference.hpp>
#if BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x580)) || BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1500))
# define make_tuple boost::python::make_tuple
#endif
namespace boost_python_test {
// A friendly class.
@@ -49,18 +53,18 @@ namespace boost_python_test {
boost::python::tuple
getinitargs(const world& w)
{
return boost::python::make_tuple(w.get_country());
using namespace boost::python;
return make_tuple(w.get_country());
}
static
boost::python::tuple
getstate(boost::python::object w_obj)
{
world const& w = boost::python::extract<world const&>(w_obj)();
using namespace boost::python;
world const& w = extract<world const&>(w_obj)();
return boost::python::make_tuple(
w_obj.attr("__dict__"),
w.get_secret_number());
return make_tuple(w_obj.attr("__dict__"), w.get_secret_number());
}
static
@@ -69,7 +73,7 @@ namespace boost_python_test {
{
using namespace boost::python;
world& w = extract<world&>(w_obj)();
if (len(state) != 2)
{
PyErr_SetObject(PyExc_ValueError,
@@ -78,11 +82,11 @@ namespace boost_python_test {
);
throw_error_already_set();
}
// restore the object's __dict__
dict d = extract<dict>(w_obj.attr("__dict__"))();
d.update(state[0]);
// restore the internal state of the C++ object
long number = extract<long>(state[1]);
if (number != 42)