From mark.mcmahon at eur.autodesk.com Sun Dec 3 19:04:10 2000 From: mark.mcmahon at eur.autodesk.com (mark.mcmahon at eur.autodesk.com) Date: Sun, 3 Dec 2000 19:04:10 +0100 Subject: [C++-SIG] Playing with CXX 5.0b Message-ID: Hi, I just downloaded this for SourceForge. I tried an extremely simple app (I never tried cxx before - so please flame me if I am doing something completely wrong!) Below is my short sample - I get a "Breakpoint" exception when the PyObject* p is being decreffed in Release(). Got an idea? Details - MSVC++6 (sp3), Python 2.0 Mark //------------------------------------------- #include "stdafx.h" #pragma warning(disable: 4786) #include "..\CXX\Objects.hxx" #include "python.h" #include int main(int argc, char* argv[]) { Py_Initialize(); Py::String str("my string"); Py_Finalize(); return 0; } //------------------------------------------- From barry at scottb.demon.co.uk Sun Dec 10 15:35:17 2000 From: barry at scottb.demon.co.uk (Barry Scott) Date: Sun, 10 Dec 2000 14:35:17 -0000 Subject: [C++-SIG] Playing with CXX 5.0b In-Reply-To: Message-ID: <000301c062b6$6a2edd40$060210ac@private> The dtor is run after finalize. Add some {} to make the str destruct before the finalize. > //------------------------------------------- > #include "stdafx.h" > #pragma warning(disable: 4786) > > > #include "..\CXX\Objects.hxx" > #include "python.h" > #include > > int main(int argc, char* argv[]) > { > Py_Initialize(); { // init before here > Py::String str("my string"); } // str destruct here, finalize after here > Py_Finalize(); > return 0; > } > //------------------------------------------- Barry From barry at scottb.demon.co.uk Sun Dec 10 15:38:25 2000 From: barry at scottb.demon.co.uk (Barry Scott) Date: Sun, 10 Dec 2000 14:38:25 -0000 Subject: [C++-SIG] Problems using iostreams or string with Python? In-Reply-To: Message-ID: <000401c062b6$da38a850$060210ac@private> I believe you can mix iostreams and even to the same FILE. Isn't iostreams implemented in terms of FILE fron ? BArry From abrahams at mediaone.net Mon Dec 11 01:39:28 2000 From: abrahams at mediaone.net (David Abrahams) Date: Sun, 10 Dec 2000 19:39:28 -0500 Subject: [C++-SIG] [ANN] Boost Python Library (formerly py_cpp) Message-ID: <07dd01c0630a$d1a8d760$0500a8c0@dragonsys.com> I am proud to announce the re-release of py_cpp as the Boost Python Library at www.boost.org. Among its many features: * Automatic function argument type checking and conversion * Subclassing wrapped C++ types in Python * [Member] Function overloading * Automatic wrapping of numeric operators * Pickling support * Support for C++ smart pointers For those who have been following py_cpp, significant improvements have occurred since the last release. An excerpt from the release notes follows: 2000-11-22 10:00 Ullrich fixed bug in operator_dispatcher. 2000-11-21 10:00 Changed all class and function names into lower_case. Ullrich updated documentation for operator wrapping. 2000-11-20 10:00 Ullrich renamed ExtensionClass:register_coerce() into ExtensionClass:def_standard_coerce() and made it public Ullrich improved shared_pod_manager. 2000-11-17 15:04 Changed allocation strategy of shared_pod_manager to make it portable. Added pickling support + tests thanks to "Ralf W. Grosse-Kunstleve" Added a specialization of Callback to prevent unsafe usage. Fixed Ullrich's operator_dispatcher refcount bug Removed const char* return values from virtual functions in tests; that usage was unsafe. Ullrich changed Module::add() so that it steals a reference (fix of refcount bug) Ullrich added operator_dispatcher::create() optimization Ullrich changed design and implementation of TypeObjectBase::enable() (to eliminate low-level code) and added shared_pod_manager optimization. 2000-11-15 12:01 Fixed refcount bugs in operator calls. Added callback_adjust_refcount(PyObject*, Type) to account for different ownership semantics of Callback's return types and Caller's arguments (which both use from_python()) This bug caused refcount errors during operator calls. Moved operator_dispatcher into extclass.cpp Gave it shared ownership of the objects it wraps Introduced sequence points in extension_class_coerce for exception-safety UPPER_CASE_MACRO_NAMES MixedCase template type argument names Changed internal error reporting to use Python exceptions so we don't force the user to link in iostreams code Changed error return value of call_cmp to -1 Moved unwrap_* functions out of operator_dispatcher. This was transitional: when I realized they didn't need to be declared in extclass.h I moved them out, but now that operator_dispatcher itself is in extclass.cpp they could go back in. Numerous formatting tweaks Updated the BoundFunction::create() optimization and enabled it so it could actually be used! 2000-11-15 00:26 Made Ullrich's operators support work with MSVC Cleaned up operators.h such that invalid define_operator<0> is no longer needed. Ullrich created operators.h to support wrapping of C++ operators (including the "__r*__" forms). He added several auxiliary classes to extclass.h and extclass.cpp (most importantly, py::detail::operator_dispatcher and py::operators) 2000-11-13 22:29 removed obsolete ExtensionClassFromPython for good. removed unused class ExtensionType forward declaration 2000-11-12 13:08 Added enum_as_int_converters for easier enum wrapping Introduced new conversion namespace macros: PY_BEGIN_CONVERSION_NAMESPACE, PY_END_CONVERSION_NAMESPACE, PY_CONVERSION callback.h, gen_callback.py: Added call() function so that a regular python function (as opposed to method or other function-as-attribute) can be called. Added newlines for readability. class_wrapper.h: Fixed a bug in add(), which allows non-method class attributes Ullrich has added def_raw for simple varargs and keyword support. Fixed version number check for __MWERKS__ Added tests for enums and non-method class attributes objects.h/objects.cpp: Added py::String operator*= and operator* for repetition Change Dict::items(), keys(), and values() to return a List Added template versions of set_item, etc., methods so that users can optionally use C++ types that have to_python() functions as parameters. Changed various Ptr by-value parameters to const Ptr&