diff --git a/README.md b/README.md index e6f5d0d5..7646d3a8 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ # Synopsis +[![Join the chat at https://gitter.im/boostorg/python](https://badges.gitter.im/boostorg/python.svg)](https://gitter.im/boostorg/python?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) + Welcome to Boost.Python, a C++ library which enables seamless interoperability between C++ and the Python programming language. The library includes support for: * References and Pointers diff --git a/doc/tutorial.qbk b/doc/tutorial.qbk index b3dcfc94..71d25850 100644 --- a/doc/tutorial.qbk +++ b/doc/tutorial.qbk @@ -1871,36 +1871,6 @@ This technique has several advantages: * Minimize the need to recompile * Rapid prototyping (you can move the code to C++ if required without changing the interface) -You can even add a little syntactic sugar with the use of metaclasses. Let's -create a special metaclass that "injects" methods in other classes. - - # The one Boost.Python uses for all wrapped classes. - # You can use here any class exported by Boost instead of "point" - BoostPythonMetaclass = point.__class__ - - class injector(object): - class __metaclass__(BoostPythonMetaclass): - def __init__(self, name, bases, dict): - for b in bases: - if type(b) not in (self, type): - for k,v in dict.items(): - setattr(b,k,v) - return type.__init__(self, name, bases, dict) - - # inject some methods in the point foo - class more_point(injector, point): - def __repr__(self): - return 'Point(x=%s, y=%s)' % (self.x, self.y) - def foo(self): - print 'foo!' - -Now let's see how it got: - - >>> print point() - Point(x=10, y=10) - >>> point().foo() - foo! - Another useful idea is to replace constructors with factory functions: _point = point diff --git a/include/boost/python/numpy/config.hpp b/include/boost/python/numpy/config.hpp index e6484bc5..f70b94cb 100644 --- a/include/boost/python/numpy/config.hpp +++ b/include/boost/python/numpy/config.hpp @@ -62,7 +62,9 @@ // Set the name of our library, this will get undef'ed by auto_link.hpp // once it's done with it: // -#define BOOST_LIB_NAME boost_numpy##PY_MAJOR_VERSION##PY_MINOR_VERSION +#define _BOOST_PYTHON_CONCAT(N, M, m) N ## M ## m +#define BOOST_PYTHON_CONCAT(N, M, m) _BOOST_PYTHON_CONCAT(N, M, m) +#define BOOST_LIB_NAME BOOST_PYTHON_CONCAT(boost_numpy, PY_MAJOR_VERSION, PY_MINOR_VERSION) // // If we're importing code from a dll, then tell auto_link.hpp about it: // @@ -75,6 +77,9 @@ #include #endif // auto-linking disabled +#undef BOOST_PYTHON_CONCAT +#undef _BOOST_PYTHON_CONCAT + #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION #endif // CONFIG_NUMPY20170215_H_ diff --git a/src/numpy/numpy.cpp b/src/numpy/numpy.cpp index 8e259bc7..3ae2295e 100644 --- a/src/numpy/numpy.cpp +++ b/src/numpy/numpy.cpp @@ -19,6 +19,7 @@ static void wrap_import_array() static void * wrap_import_array() { import_array(); + return NULL; } #endif diff --git a/src/object/class.cpp b/src/object/class.cpp index aeef688e..9bb9683a 100644 --- a/src/object/class.cpp +++ b/src/object/class.cpp @@ -618,7 +618,7 @@ namespace objects { object property( (python::detail::new_reference) - PyObject_CallFunction((PyObject*)&PyProperty_Type, const_cast("Osss"), fget.ptr(), 0, 0, docstr)); + PyObject_CallFunction((PyObject*)&PyProperty_Type, const_cast("Osss"), fget.ptr(), (char*)NULL, (char*)NULL, docstr)); this->setattr(name, property); } @@ -628,7 +628,7 @@ namespace objects { object property( (python::detail::new_reference) - PyObject_CallFunction((PyObject*)&PyProperty_Type, const_cast("OOss"), fget.ptr(), fset.ptr(), 0, docstr)); + PyObject_CallFunction((PyObject*)&PyProperty_Type, const_cast("OOss"), fget.ptr(), fset.ptr(), (char*)NULL, docstr)); this->setattr(name, property); }