From e4b1377b0e7380f42e7cce7cc2af954432185553 Mon Sep 17 00:00:00 2001 From: Dave Abrahams Date: Sat, 13 Apr 2002 15:33:00 +0000 Subject: [PATCH] vc7 compatibility for BOost.Python v1 Better error messages for Jam when actions are too long [SVN r13477] --- doc/index.html | 6 +++--- include/boost/python/conversions.hpp | 8 ++++---- src/conversions.cpp | 4 ++-- test/comprehensive.cpp | 9 ++++++++- 4 files changed, 17 insertions(+), 10 deletions(-) diff --git a/doc/index.html b/doc/index.html index 01e5d13e..97bec88d 100644 --- a/doc/index.html +++ b/doc/index.html @@ -41,6 +41,9 @@ the following compilers (Note that pickling doesn't work with Python href="http://msdn.microsoft.com/vstudio/downloads/updates/sp/vs6/sp5/default.asp">MSVC++6sp5. All tests pass. +
  • MSVC++7 (Visual + Studio .NET). All tests pass. +
  • Metrowerks CodeWarrior Pro7.2 for Windows. All tests pass. @@ -62,9 +65,6 @@ the following compilers (Note that pickling doesn't work with Python C++ 5.0 Comprehensive test fails at runtime due to an exception-handling bug. Other tests seem to work. -
  • MSVC++7 (Visual - Studio .NET). Some tests fail to compile (comprehensive.cpp, - ivect.cpp, dvect.cpp, noncopyable_export.cpp); others seem to work. diff --git a/include/boost/python/conversions.hpp b/include/boost/python/conversions.hpp index f328981e..83823494 100644 --- a/include/boost/python/conversions.hpp +++ b/include/boost/python/conversions.hpp @@ -160,7 +160,7 @@ unsigned char from_python(PyObject*, boost::python::type); BOOST_PYTHON_DECL float from_python(PyObject*, boost::python::type); BOOST_PYTHON_DECL double from_python(PyObject*, boost::python::type); -# ifndef BOOST_MSVC6_OR_EARLIER +# if !defined(BOOST_MSVC) || BOOST_MSVC > 1300 PyObject* to_python(float); PyObject* to_python(double); # else @@ -260,7 +260,7 @@ PyObject* from_python(PyObject*, boost::python::type); // #endif // }} // namespace boost::python -#if !defined(BOOST_MSVC6_OR_EARLIER) +#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) template boost::shared_ptr from_python(PyObject*p, boost::python::type >) { @@ -286,7 +286,7 @@ PyObject* to_python(boost::shared_ptr p) // inline implementations // -#ifndef BOOST_MSVC6_OR_EARLIER +#if !defined(BOOST_MSVC) || BOOST_MSVC > 1300 inline PyObject* to_python(double d) { return PyFloat_FromDouble(d); @@ -296,7 +296,7 @@ inline PyObject* to_python(float f) { return PyFloat_FromDouble(f); } -#endif // BOOST_MSVC6_OR_EARLIER +#endif inline PyObject* to_python(long l) { diff --git a/src/conversions.cpp b/src/conversions.cpp index 2818276b..3c5edad5 100644 --- a/src/conversions.cpp +++ b/src/conversions.cpp @@ -206,7 +206,7 @@ BOOST_PYTHON_DECL bool from_python(PyObject* p, boost::python::type) return true; } -#ifdef BOOST_MSVC6_OR_EARLIER +#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 // An optimizer bug prevents these from being inlined. BOOST_PYTHON_DECL PyObject* to_python(double d) { @@ -217,7 +217,7 @@ BOOST_PYTHON_DECL PyObject* to_python(float f) { return PyFloat_FromDouble(f); } -#endif // BOOST_MSVC6_OR_EARLIER +#endif BOOST_PYTHON_END_CONVERSION_NAMESPACE diff --git a/test/comprehensive.cpp b/test/comprehensive.cpp index 531180d6..6cb78865 100644 --- a/test/comprehensive.cpp +++ b/test/comprehensive.cpp @@ -103,7 +103,14 @@ StringMapPythonClass::StringMapPythonClass(boost::python::module_builder& m) : boost::python::class_builder(m, "StringMap") { def(boost::python::constructor<>()); +#if defined(BOOST_MSVC) && BOOST_MSVC == 1300 + // MSVC7 incorrectly makes this the target of this function + // pointer the same type as the class in which it is defined (some + // standard library class), instead of StringMap. + def((std::size_t (StringMap::*)()const)&StringMap::size, "__len__"); +#else def(&StringMap::size, "__len__"); +#endif def(&get_item, "__getitem__"); def(&set_item, "__setitem__"); def(&del_item, "__delitem__"); @@ -884,7 +891,7 @@ namespace bpl_test { // This doesn't test anything but the compiler, since it has the same signature as the above. // Since MSVC is broken and gets the signature wrong, we'll skip it. std::string use_const_plain_char( -#ifndef BOOST_MSVC6_OR_EARLIER +#if !defined(BOOST_MSVC) || BOOST_MSVC > 1300 const #endif char c) { return std::string(5, c); }