mirror of
https://github.com/boostorg/python.git
synced 2026-01-24 06:02:14 +00:00
more fixes to get testcases work, includes module init and other minor fixes
[SVN r53285]
This commit is contained in:
@@ -79,7 +79,11 @@ void* enum_<T>::convertible_from_python(PyObject* obj)
|
||||
template <class T>
|
||||
void enum_<T>::construct(PyObject* obj, converter::rvalue_from_python_stage1_data* data)
|
||||
{
|
||||
#if PY_VERSION_HEX >= 0x03000000
|
||||
T x = static_cast<T>(PyLong_AS_LONG(obj));
|
||||
#else
|
||||
T x = static_cast<T>(PyInt_AS_LONG(obj));
|
||||
#endif
|
||||
void* const storage = ((converter::rvalue_from_python_storage<T>*)data)->storage.bytes;
|
||||
new (storage) T(x);
|
||||
data->convertible = storage;
|
||||
|
||||
@@ -18,36 +18,45 @@ BOOST_PYTHON_DECL PyObject* init_module(char const* name, void(*)());
|
||||
// TODO(bhy) Take care of this later.
|
||||
// But any reseaon we don't use BOOST_PYTHON_DECL here?
|
||||
|
||||
# if (defined(_WIN32) || defined(__CYGWIN__)) && !defined(BOOST_PYTHON_STATIC_MODULE)
|
||||
# if PY_VERSION_HEX >= 0x03000000
|
||||
|
||||
# define BOOST_PYTHON_MODULE_INIT(name) \
|
||||
void init_module_##name(); \
|
||||
extern "C" __declspec(dllexport) void init##name() \
|
||||
# define _BOOST_PYTHON_MODULE_INIT(name) \
|
||||
PyObject* PyInit_##name() \
|
||||
{ \
|
||||
return boost::python::detail::init_module( \
|
||||
#name,&init_module_##name); \
|
||||
} \
|
||||
void init_module_##name()
|
||||
|
||||
# else
|
||||
|
||||
# define _BOOST_PYTHON_MODULE_INIT(name) \
|
||||
void init##name() \
|
||||
{ \
|
||||
boost::python::detail::init_module( \
|
||||
#name,&init_module_##name); \
|
||||
} \
|
||||
void init_module_##name()
|
||||
|
||||
# endif
|
||||
|
||||
# if (defined(_WIN32) || defined(__CYGWIN__)) && !defined(BOOST_PYTHON_STATIC_MODULE)
|
||||
|
||||
# define BOOST_PYTHON_MODULE_INIT(name) \
|
||||
void init_module_##name(); \
|
||||
extern "C" __declspec(dllexport) _BOOST_PYTHON_MODULE_INIT(name)
|
||||
|
||||
# elif BOOST_PYTHON_USE_GCC_SYMBOL_VISIBILITY
|
||||
|
||||
# define BOOST_PYTHON_MODULE_INIT(name) \
|
||||
void init_module_##name(); \
|
||||
extern "C" __attribute__ ((visibility("default"))) void init##name() \
|
||||
{ \
|
||||
boost::python::detail::init_module(#name, &init_module_##name); \
|
||||
} \
|
||||
void init_module_##name()
|
||||
extern "C" __attribute__ ((visibility("default"))) _BOOST_PYTHON_MODULE_INIT(name)
|
||||
|
||||
# else
|
||||
|
||||
# define BOOST_PYTHON_MODULE_INIT(name) \
|
||||
void init_module_##name(); \
|
||||
extern "C" void init##name() \
|
||||
{ \
|
||||
boost::python::detail::init_module(#name, &init_module_##name); \
|
||||
} \
|
||||
void init_module_##name()
|
||||
extern "C" _BOOST_PYTHON_MODULE_INIT(name)
|
||||
|
||||
# endif
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ struct make_instance_impl
|
||||
|
||||
// Note the position of the internally-stored Holder,
|
||||
// for the sake of destruction
|
||||
instance->ob_size = offsetof(instance_t, storage);
|
||||
Py_SIZE(instance) = offsetof(instance_t, storage);
|
||||
|
||||
// Release ownership of the python object
|
||||
protect.cancel();
|
||||
|
||||
Reference in New Issue
Block a user