Re: [C++-sig] Building Boost.Python against a debug build of Python

2012-02-28 Thread Adam Preble
Too late--I managed to get it to build a bit ago. But that being said, I had read that little blurb while trying to figure out what was going on. Unfortunately it's the kind of thing that makes sense if you already know what to do, but it didn't make any sense to me when I was stammering through

[C++-sig] Boost.Python 1.33.1 and static __doc__ properties

2012-02-28 Thread Andrew Buza
I have a set of libraries that I've been trying to build for Python 2.7 using the 1.33.1 release of Boost.Python. I've used them in the past with Python 2.4, but Py2.6 made the __doc__ property on classes read-only. Because of this change I get an AttributeError (with the message "'Boost.Python.Sta

Re: [C++-sig] boost python & context manager/with statement

2012-02-28 Thread Dave Abrahams
on Sun Feb 12 2012, Avi Bahra wrote: > Does boost python support context management using the with > statement? In my case I need to manage __enter__/__exit__ on > the c++ side. Could not find any examples for this in the > documentation. > > Any help appreciated. > > Best regards, > Ta, >    

Re: [C++-sig] Building Boost.Python against a debug build of Python

2012-02-28 Thread Dave Abrahams
Please read: http://www.boost.org/doc/libs/1_49_0/libs/python/doc/building.html#python-debugging-builds HTH, Dave on Wed Feb 15 2012, Adam Preble wrote: > I previously posted about runtime oddness when switching to a debug > build of python.  I figured I needed to rebuild Boost.Python.  The >

Re: [C++-sig] how to override __setattr__ of an extension class

2012-02-28 Thread Wojciech Mamrak
Yes, this is what I meant :) I will precise my previous message. The docs are very concise on some topics, hence misleading. If you find such statement: "Beware the common pitfall of forgetting that the constructors of most of Python's mutable types make copies, just as in Python." then it is con

Re: [C++-sig] how to override __setattr__ of an extension class

2012-02-28 Thread Holger Joukl
Hi, > The docs regarding the mutable copying problem are very misleading. > Following Python [1] and Boost [2] scripts do not produce the same results: > > > [1] > b = a = [] > c = list(a) > a.append("s1") > print a.count("s1"), b.count("s1"), c.count("s1") #prints 1 1 0 > > [2] > list a, b, c; >

Re: [C++-sig] how to override __setattr__ of an extension class

2012-02-28 Thread Wojciech Mamrak
Here is a part of my message posted here few months ago, which has been left without any response (no offence - maybe it disappeared somewhere): The docs regarding the mutable copying problem are very misleading. Following Python [1] and Boost [2] scripts do not produce the same results: [1] b =

Re: [C++-sig] how to override __setattr__ of an extension class

2012-02-28 Thread Holger Joukl
> > To actually write to my instance dict I currently do > > > > PyObject* __dict__ = PyObject_GetAttrString(m_self, const_cast > > ("__dict__")); > > PyDict_SetItemString(__dict__, name, value.ptr()); > > > > inside MyExtensionClass::setattr (where m_self is PyObj*) > > > > Is there a be