From abrahams at mediaone.net Fri Nov 3 01:09:47 2000 From: abrahams at mediaone.net (David Abrahams) Date: Thu, 2 Nov 2000 19:09:47 -0500 Subject: [C++-SIG] py_cpp maintenance release Message-ID: <096501c0452a$6550c8f0$0500a8c0@dragonsys.com> People turned up a few problems with the last release that seemed relatively serious to me, so I have posted another update to http://people.ne.mediaone.net/abrahams/downloads/py_cpp.html Release notes: 2000-11-02 17:42 Added a fix for interactions between default virtual function implementations and declare_base(). You still need to write your declare_base() /after/ all member functions have been def()d for the two classes concerned. Many, many thanks to Ullrich Koethe for all his work on this. Added missing conversions: to_python(float) from_python(const char* const&) from_python(const double&) from_python(const float&) Added a Regression test for a reference-counting bug thanks to Mark Evans () const-ify ClassBase::getattr() Add repr() function to Class Add to_python/from_python conversions for PyPtr Standardize set_item/get_item interfaces (instead of proxies) for Dict and List Add Reprable<> template to newtypes.h Fix a bug wherein the __module__ attribute would be lost for classes that have a default virtual function implementation. Remove extra ';' in module.cpp thanks to "Ralf W. Grosse-Kunstleve" Fix a bug in the code of example1.html From abrahams at mediaone.net Fri Nov 3 01:56:24 2000 From: abrahams at mediaone.net (David Abrahams) Date: Thu, 2 Nov 2000 19:56:24 -0500 Subject: [C++-SIG] test - please ignore Message-ID: <099b01c04530$e3b39dc0$0500a8c0@dragonsys.com> From abrahams at mediaone.net Mon Nov 6 06:38:11 2000 From: abrahams at mediaone.net (David Abrahams) Date: Mon, 6 Nov 2000 00:38:11 -0500 Subject: [C++-SIG] Yet another py_cpp update Message-ID: <0f5701c047b3$c64f0780$0500a8c0@dragonsys.com> Available at http://www.egroups.com/files/boost/py_cpp/py_cpp_20001106.zip or http://people.ne.mediaone.net/abrahams/downloads/py_cpp.html -Dave Changes since last release: 2000-11-06 0:22 Lots of documentation updates added 4-argument template constructor to py::Tuple added "add" member function to ClassWrapper<> to allow arbitrary Python objects to be added to an extension class. gen_all.py now generates support for n argument member functions and n+1 argument member functions at the suggestion of "Ralf W. Grosse-Kunstleve" Added regression tests and re-ordered declare_base calls to verify that the phantom base class issue is resolved. 2000-11-04 17:35 Integrated Ullrich Koethe's brilliant from_python_experiment for better error-reporting in many cases. extclass.h, gen_extclass.py: removed special-case MSVC code added much commentary removed unused py_copy_to_new_value_holder init_function.h, gen_init_function.py: added missing 'template' keyword on type-dependent template member usage removed special-case MSVC code added much commentary 2000-11-04 0:36 Removed the need for the phantom base class that screwed up inheritance hierarchies, introduced error-prone ordering dependencies, and complexified logic in many places! extclass.h: Added some explanatory comments, removed wasteful m_self member of HeldInstance extclass_demo.cpp: Added #pragmas which allow compilation in ansi strict mode under Metrowerks functions.h: Added virtual_function as part of phantom base class removal; expanded commentary pyptr.h: Added some missing 'typename's and a GCC workaround fix subclass.cpp: Added missing string literal const_cast<>s. 2000-11-03 10:58 Fix friend function instantiation bug caught by Metrowerks (thanks Metrowerks!) Add proof-of-concept for one technique of wrapping function that return a pointer Worked around MSVC optimizer bug by writing to_python(double) and to_python(float) out-of-line 2000-11-02 23:25 Add /Zm200 option to vc6_prj to deal with MSVC resource limitations Remove conflicting /Ot option from vc6_prj release build From Xavier.Juvigny at onera.fr Wed Nov 8 14:28:38 2000 From: Xavier.Juvigny at onera.fr (Xavier JUVIGNY) Date: Wed, 08 Nov 2000 14:28:38 +0100 Subject: [C++-SIG] Problem with last version of py_cpp Message-ID: <3A095505.B196CF7A@onera.fr> Hi, I try to use the last version of py_cpp on a Unix station with gcc 2.95.1 I had a problem with a method with three arguments. The folowing example : #include class A { public: A() {} void f(int,int,int,float,float,float) { } }; void initMesh() { try { // Create the object representing this extension module py::Module PyA("A"); // Create the Python type object for our extension class. py::ClassWrapper A_class(PyA, "PyA"); // A_class.def(&A::f, "f"); } catch(...) { py::handle_exception(); } } give me the unexcepted error : /data/Wksp/juvigny/Decoupeur.d/py_cpp/functions.h: In function `class py::Function * py::new_wrapped_function(void (A::*)(int, int, int, float, float, float))': /data/Wksp/juvigny/Decoupeur.d/py_cpp/extclass.h:371: instantiated from `py::ExtensionClass >::def(void (A::*)(int, int, int, float, float, float), const char *)' /data/Wksp/juvigny/Decoupeur.d/py_cpp/class_wrapper.h:35: instantiated from `py::ClassWrapper >::def(void (A::*)(int, int, int, float, float, float), const char *)' Py_A.C:22: instantiated from here /data/Wksp/juvigny/Decoupeur.d/py_cpp/functions.h:127: no matching function for call to `return_value (void (A::* &)(int, int, int, float, float, float))' Has anyone a idea ? Thanks for help. Juvigny Xavier From abrahams at mediaone.net Thu Nov 9 15:41:12 2000 From: abrahams at mediaone.net (David Abrahams) Date: Thu, 9 Nov 2000 09:41:12 -0500 Subject: [C++-SIG] Re: Problem with last version of py_cpp References: <973757716.3196@egroups.com> Message-ID: <059f01c04a5b$1bb7bec0$0500a8c0@dragonsys.com> > From: Xavier JUVIGNY > Subject: Problem with last version of py_cpp > > Hi, > > I try to use the last version of py_cpp on a Unix station with gcc > 2.95.1 > > Has anyone a idea ? First, as your function takes more than 5 arguments, you'll need to run: > gen_all.py xxx where xxx >= the most arguments you need to handle in the py_cpp directory. This will generate code to support more arguments. I think you may want to grab an updated copy of gen_extclass.py first, though, from: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/boost/development/py_cpp/gen_e xtclass.py?cvsroot=boost as I believe we fixed a bug in the past few days. Also, I suggest you get gcc 2.95.2, as 2.95.1 is not supported with py_cpp. Regards, Dave From tom at malcolmson.com Wed Nov 15 17:53:22 2000 From: tom at malcolmson.com (Tom) Date: Wed, 15 Nov 2000 11:53:22 -0500 Subject: [C++-SIG] Problems using iostreams or string with Python? Message-ID: I have seen it reported that the C++ iostreams library (and the C++ string class, which uses iostreams) should never be mixed with the C streams library. Given that Python uses the C streams library, does this mean that I can't use C++ iostreams with Python related code? Thanks, Tom. From abrahams at mediaone.net Thu Nov 16 14:28:37 2000 From: abrahams at mediaone.net (David Abrahams) Date: Thu, 16 Nov 2000 08:28:37 -0500 Subject: [c++-sig] Digest Number 54 References: <974362228.71020@egroups.com> Message-ID: <019e01c04fd1$209db720$0500a8c0@dragonsys.com> > From: tom at malcolmson.com (Tom) > I have seen it reported that the C++ iostreams library (and the C++ string > class, which uses iostreams) should never be mixed with the C streams > library. I've seen it reported that if you eat pop rocks and drink coke, your stomach will explode ;-) > Given that Python uses the C streams library, does this mean that I can't > use C++ iostreams with Python related code? No. On the other hand, if you want to write to stdout/stderr coherently, using std::cout/std::cerr to do it may have surprising results, since they are buffered separately from the 'C' streams. There's a lot more to C++ iostreams than just cout/cerr, though. For example, you can make an ostreambuf that writes to a 'C' FILE stream, or you can write to an ostringstream and then write its contents into stdout yourself (less convenient, but easier to implement). that's-what-happened-to-mikey-you-know-the-life-cereal-kid-ly y'rs dave From mark.mcmahon at eur.autodesk.com Thu Nov 16 14:31:50 2000 From: mark.mcmahon at eur.autodesk.com (mark.mcmahon at eur.autodesk.com) Date: Thu, 16 Nov 2000 14:31:50 +0100 Subject: [c++-sig] Digest Number 54 Message-ID: Or you could use sync_with_stdio ----- copy from MSDN ----------- ios_base::sync_with_stdio static bool sync_with_stdio(bool sync = true); The static member function stores a stdio sync flag, which is initially true. When true, this flag ensures that operations on the same file are properly synchronized between the iostreams functions and those defined in the Standard C library. Otherwise, synchronization may or may not be guaranteed, but performance may be improved. The function stores sync in the stdio sync flag and returns its previous stored value. You can call it reliably only before performing any operations on the standard streams. -------------------------------- -----Original Message----- From: David Abrahams [mailto:abrahams at mediaone.net] Sent: 16 November 2000 14:29 To: c++-sig at python.org Subject: Re: [c++-sig] Digest Number 54 > From: tom at malcolmson.com (Tom) > I have seen it reported that the C++ iostreams library (and the C++ string > class, which uses iostreams) should never be mixed with the C streams > library. I've seen it reported that if you eat pop rocks and drink coke, your stomach will explode ;-) > Given that Python uses the C streams library, does this mean that I can't > use C++ iostreams with Python related code? No. On the other hand, if you want to write to stdout/stderr coherently, using std::cout/std::cerr to do it may have surprising results, since they are buffered separately from the 'C' streams. There's a lot more to C++ iostreams than just cout/cerr, though. For example, you can make an ostreambuf that writes to a 'C' FILE stream, or you can write to an ostringstream and then write its contents into stdout yourself (less convenient, but easier to implement). that's-what-happened-to-mikey-you-know-the-life-cereal-kid-ly y'rs dave _______________________________________________ C++-SIG maillist - C++-SIG at python.org http://www.python.org/mailman/listinfo/c++-sig From abrahams at mediaone.net Thu Nov 16 15:15:17 2000 From: abrahams at mediaone.net (David Abrahams) Date: Thu, 16 Nov 2000 09:15:17 -0500 Subject: [c++-sig] Digest Number 54 References: Message-ID: <01b601c04fd7$a5a54a90$0500a8c0@dragonsys.com> That's a nonstandard and thus nonportable feature of one particular standard library implementation. The OP didn't say which platform he was using. -Dave ----- Original Message ----- From: > Or you could use sync_with_stdio > > ----- copy from MSDN ----------- > ios_base::sync_with_stdio > > static bool sync_with_stdio(bool sync = true); > > The static member function stores a stdio sync flag, which is initially true. When true, this flag ensures that operations on the same file are properly synchronized between the iostreams functions and those defined in the Standard C library. Otherwise, synchronization may or may not be guaranteed, but performance may be improved. The function stores sync in the stdio sync flag and returns its previous stored value. You can call it reliably only before performing any operations on the standard streams. > -------------------------------- From mark.mcmahon at eur.autodesk.com Thu Nov 16 15:20:31 2000 From: mark.mcmahon at eur.autodesk.com (mark.mcmahon at eur.autodesk.com) Date: Thu, 16 Nov 2000 15:20:31 +0100 Subject: [c++-sig] Digest Number 54 Message-ID: It is actually part of the standard (of which I do not have) but http://www.claas-solutions.de/iostreams/ios_base.html M -----Original Message----- From: David Abrahams [mailto:abrahams at mediaone.net] Sent: 16 November 2000 15:15 To: mark.mcmahon at eur.autodesk.com; c++-sig at python.org Subject: Re: [c++-sig] Digest Number 54 That's a nonstandard and thus nonportable feature of one particular standard library implementation. The OP didn't say which platform he was using. -Dave ----- Original Message ----- From: > Or you could use sync_with_stdio > > ----- copy from MSDN ----------- > ios_base::sync_with_stdio > > static bool sync_with_stdio(bool sync = true); > > The static member function stores a stdio sync flag, which is initially true. When true, this flag ensures that operations on the same file are properly synchronized between the iostreams functions and those defined in the Standard C library. Otherwise, synchronization may or may not be guaranteed, but performance may be improved. The function stores sync in the stdio sync flag and returns its previous stored value. You can call it reliably only before performing any operations on the standard streams. > -------------------------------- _______________________________________________ C++-SIG maillist - C++-SIG at python.org http://www.python.org/mailman/listinfo/c++-sig From alexander.belopolsky at gs.com Thu Nov 16 16:43:15 2000 From: alexander.belopolsky at gs.com (Belopolsky, Alexander) Date: Thu, 16 Nov 2000 10:43:15 -0500 Subject: [c++-sig] Digest Number 54 Message-ID: Yes this is in the standard: ISO/IEC 148882:1998(E) Section 27.4.2.4 [lib.ios.members.static] --alex -----Original Message----- From: mark.mcmahon at eur.autodesk.com [mailto:mark.mcmahon at eur.autodesk.com] Sent: Thursday, November 16, 2000 9:21 AM To: c++-sig at python.org Subject: RE: [c++-sig] Digest Number 54 It is actually part of the standard (of which I do not have) but http://www.claas-solutions.de/iostreams/ios_base.html M > Or you could use sync_with_stdio From abrahams at mediaone.net Fri Nov 17 13:41:35 2000 From: abrahams at mediaone.net (David Abrahams) Date: Fri, 17 Nov 2000 07:41:35 -0500 Subject: [c++-sig] Digest Number 55 References: <974448663.75752@egroups.com> Message-ID: <03a801c05093$b900dcf0$0500a8c0@dragonsys.com> > From: "Belopolsky, Alexander" > Subject: RE: Digest Number 54 > > Yes this is in the standard: > > ISO/IEC 148882:1998(E) Section 27.4.2.4 [lib.ios.members.static] So it is. And a big "whoops, sorry!" to all. -Dave