boost::python, returning new PyObject references

Arnaldur Gylfason arnaldur at decode.is
Wed Dec 19 14:24:31 CET 2001


--0__=00256B270048BEB98f9e8a93df938690918c00256B270048BEB9
Content-type: text/plain; charset=us-ascii



Here is the code.
objects.hpp and objects.cpp

Next step is making final (for the moment) decision regarding design and
the going on from there.
Adding the operators to be able to do m["k"] += 3 etc. is probably next.
Changing all proxies/ op[] in other classes should be done.


objects_b.hpp has the proxies that do not use the callbacks.
tmodule.cpp is a test module.
(See attached file: objects.hpp)(See attached file: objects_b.hpp)(See
attached file: objects.cpp)(See attached file: tmodule.cpp)

Comments:

object is a virtual base class for sequence and mapping.
seqmap inherits from both.
The proxies inherit from seqmap and thus provide both a sequence and
mapping interface.

If a non-existent key is accessed, a Null ref (default constructed) is
stored in the proxies object_base.
Then the mapping::proxy stores a callback in the object_base that will call
PyObject_GetItem when used in
any way other than setting a new key-value pair.

The proxies call reset after setting a new item to reflect the change.
That means the behaviour of multiple assignment is as would be expected:
          python::sequence seq2 = seq[2] = 5;
I.e. seq2 gets 5 (instead of 3 which was the old value).

const correctness is respected: If items are accessed for const
sequences/mappings,
only const methods in object, sequence or mapping can be used.
All methods that can possibly change the underlying PyObject are non-const.

Constructors for seqmap and proxies call the object constructor directly
because it is a virtual base class.
There is no default constructor for the virtual base class.
Many consider that bad practice but a default constructor wouldn't make
sense in this case I think.

Implicit Copy constructor and destructor respect virtual base classes.
According to the version of the Draft standard I found, the operator= could
assign the virtual base class
more than once - unspecified behaviour. => seqmap::operator= is defined.

The copy constructor is specified in the object_base because of strange
behaviour.
When the ref holds a NULL object a Segmentation Fault occurs if it is used
to copy construct another one.
(Since the ref copy constructor calls Py_XINCREF it should handle NULL ,
any ideas?).
Any way, by directly passing reference() in this case the callback is used.
In case of illegal key access
the Key Error is thrown here.


I believe all concrete object interfaces (like tuple, list, dictionary,
...)should inherit from object_base.
If their interface has all relevant member functions there is no need to
inherit from object or sequence.
The idea of list<>, list<object>, list<sequence> , ...:
     template<class ObjectType = object_bas>
     list : public ObjectType
is interesting.
When ObjectType is sequence or other class that inherits virtually, a
problem arises.
The constructor would have to call the object constructor directly.
Hard if inherited fdrom a template parameter.
For now I believe just inheriting from object_base is good.
What do you think?

Cheers

Arnaldur

--0__=00256B270048BEB98f9e8a93df938690918c00256B270048BEB9
Content-type: application/octet-stream; 
	name="objects.hpp"
Content-Disposition: attachment; filename="objects.hpp"
Content-transfer-encoding: base64

Ly8gIChDKSBDb3B5cmlnaHQgRGF2aWQgQWJyYWhhbXMgMjAwMC4gUGVybWlzc2lvbiB0byBjb3B5
LCB1c2UsIG1vZGlmeSwgc2VsbCBhbmQKLy8gIGRpc3RyaWJ1dGUgdGhpcyBzb2Z0d2FyZSBpcyBn
cmFudGVkIHByb3ZpZGVkIHRoaXMgY29weXJpZ2h0IG5vdGljZSBhcHBlYXJzCi8vICBpbiBhbGwg
Y29waWVzLiBUaGlzIHNvZnR3YXJlIGlzIHByb3ZpZGVkICJhcyBpcyIgd2l0aG91dCBleHByZXNz
IG9yIGltcGxpZWQKLy8gIHdhcnJhbnR5LCBhbmQgd2l0aCBubyBjbGFpbSBhcyB0byBpdHMgc3Vp
dGFiaWxpdHkgZm9yIGFueSBwdXJwb3NlLgovLwovLyAgVGhlIGF1dGhvciBncmF0ZWZ1bGx5IGFj
a25vd2xlZ2VzIHRoZSBzdXBwb3J0IG9mIERyYWdvbiBTeXN0ZW1zLCBJbmMuLCBpbgovLyAgcHJv
ZHVjaW5nIHRoaXMgd29yay4KCiNpZm5kZWYgT0JKRUNUU19EV0EwNTExMDBfSF8KIyBkZWZpbmUg
T0JKRUNUU19EV0EwNTExMDBfSF8KCiMgaW5jbHVkZSA8Ym9vc3QvcHl0aG9uL2RldGFpbC93cmFw
X3B5dGhvbi5ocHA+CiMgaW5jbHVkZSA8Ym9vc3QvcHl0aG9uL2RldGFpbC9jb25maWcuaHBwPgoj
IGluY2x1ZGUgPGJvb3N0L3B5dGhvbi9yZWZlcmVuY2UuaHBwPgojIGluY2x1ZG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3N0OjpweXRob246OnN0cmluZz4oKSk7Cn0KClB5T2JqZWN0KiB0b19weXRo
b24oY29uc3QgYm9vc3Q6OnB5dGhvbjo6ZGljdGlvbmFyeSYpOwpib29zdDo6cHl0aG9uOjpkaWN0
aW9uYXJ5IGZyb21fcHl0aG9uKFB5T2JqZWN0KiBwLCBib29zdDo6cHl0aG9uOjp0eXBlPGJvb3N0
OjpweXRob246OmRpY3Rpb25hcnk+KTsKCmlubGluZSBib29zdDo6cHl0aG9uOjpkaWN0aW9uYXJ5
IGZyb21fcHl0aG9uKFB5T2JqZWN0KiBwLCBib29zdDo6cHl0aG9uOjp0eXBlPGNvbnN0IGJvb3N0
OjpweXRob246OmRpY3Rpb25hcnkmPikKewogICAgcmV0dXJuIGZyb21fcHl0aG9uKHAsIGJvb3N0
OjpweXRob246OnR5cGU8Ym9vc3Q6OnB5dGhvbjo6ZGljdGlvbmFyeT4oKSk7Cn0KCkJPT1NUX1BZ
VEhPTl9FTkRfQ09OVkVSU0lPTl9OQU1FU1BBQ0UKCiNlbmRpZiAvLyBPQkpFQ1RTX0RXQTA1MTEw
MF9IXwo=

--0__=00256B270048BEB98f9e8a93df938690918c00256B270048BEB9
Content-type: application/octet-stream; 
	name="objects_b.hpp"
Content-Disposition: attachment; filename="objects_b.hpp"
Content-transfer-encoding: base64

Ly8gIChDKSBDb3B5cmlnaHQgRGF2aWQgQWJyYWhhbXMgMjAwMC4gUGVybWlzc2lvbiB0byBjb3B5
LCB1c2UsIG1vZGlmeSwgc2VsbCBhbmQKLy8gIGRpc3RyaWJ1dGUgdGhpcyBzb2Z0d2FyZSBpcyBn
cmFudGVkIHByb3ZpZGVkIHRoaXMgY29weXJpZ2h0IG5vdGljZSBhcHBlYXJzCi8vICBpbiBhbGwg
Y29waWVzLiBUaGlzIHNvZnR3YXJlIGlzIHByb3ZpZGVkICJhcyBpcyIgd2l0aG91dCBleHByZXNz
IG9yIGltcGxpZWQKLy8gIHdhcnJhbnR5LCBhbmQgd2l0aC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3N0OjpweXRob246
OnR5cGU8Ym9vc3Q6OnB5dGhvbjo6c3RyaW5nPik7CgppbmxpbmUgYm9vc3Q6OnB5dGhvbjo6c3Ry
aW5nIGZyb21fcHl0aG9uKFB5T2JqZWN0KiBwLCBib29zdDo6cHl0aG9uOjp0eXBlPGNvbnN0IGJv
b3N0OjpweXRob246OnN0cmluZyY+KQp7CiAgICByZXR1cm4gZnJvbV9weXRob24ocCwgYm9vc3Q6
OnB5dGhvbjo6dHlwZTxib29zdDo6cHl0aG9uOjpzdHJpbmc+KCkpOwp9CgpQeU9iamVjdCogdG9f
cHl0aG9uKGNvbnN0IGJvb3N0OjpweXRob246OmRpY3Rpb25hcnkmKTsKYm9vc3Q6OnB5dGhvbjo6
ZGljdGlvbmFyeSBmcm9tX3B5dGhvbihQeU9iamVjdCogcCwgYm9vc3Q6OnB5dGhvbjo6dHlwZTxi
b29zdDo6cHl0aG9uOjpkaWN0aW9uYXJ5Pik7CgppbmxpbmUgYm9vc3Q6OnB5dGhvbjo6ZGljdGlv
bmFyeSBmcm9tX3B5dGhvbihQeU9iamVjdCogcCwgYm9vc3Q6OnB5dGhvbjo6dHlwZTxjb25zdCBi
b29zdDo6cHl0aG9uOjpkaWN0aW9uYXJ5Jj4pCnsKICAgIHJldHVybiBmcm9tX3B5dGhvbihwLCBi
b29zdDo6cHl0aG9uOjp0eXBlPGJvb3N0OjpweXRob246OmRpY3Rpb25hcnk+KCkpOwp9CgpCT09T
VF9QWVRIT05fRU5EX0NPTlZFUlNJT05fTkFNRVNQQUNFCgojZW5kaWYgLy8gT0JKRUNUU19EV0Ew
NTExMDBfSF8K

--0__=00256B270048BEB98f9e8a93df938690918c00256B270048BEB9
Content-type: application/octet-stream; 
	name="objects.cpp"
Content-Disposition: attachment; filename="objects.cpp"
Content-transfer-encoding: base64

Ly8gIChDKSBDb3B5cmlnaHQgRGF2aWQgQWJyYWhhbXMgMjAwMC4gUGVybWlzc2lvbiB0byBjb3B5
LCB1c2UsIG1vZGl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25zdAp7CiAgICByZXR1cm4gdGhpcy0+b3BlcmF0b3Ig
bGlzdCgpLnNpemUoKTsKfQoKcmVmIGxpc3Q6OnNsaWNlX3Byb3h5OjpvcGVyYXRvcltdKHN0ZDo6
c2l6ZV90IHBvcykgY29uc3QKewogICAgcmV0dXJuIHRoaXMtPm9wZXJhdG9yIGxpc3QoKVtwb3Nd
Lm9wZXJhdG9yIHJlZigpOwp9CgpsaXN0OjpzbGljZV9wcm94eTo6c2xpY2VfcHJveHkoY29uc3Qg
cmVmJiBsaXN0LCBpbnQgbG93LCBpbnQgaGlnaCkKICAgIDogbV9saXN0KGxpc3QpLCBtX2xvdyhs
b3cpLCBtX2hpZ2goaGlnaCkKewp9Cgp9fSAvLyBuYW1lc3BhY2UgYm9vc3Q6OnB5dGhvbgo=

--0__=00256B270048BEB98f9e8a93df938690918c00256B270048BEB9
Content-type: application/octet-stream; 
	name="tmodule.cpp"
Content-Disposition: attachment; filename="tmodule.cpp"
Content-transfer-encoding: base64

CiNpbmNsdWRlIDxQeXRob24uaD4KI2luY2x1ZGUgPGJvb3N0L3B5dGhvbi9jbGFzc19idWlsZGVy
LmhwcD4KI2luY2x1ZGUgPGJvb3N0L3B5dGhvbi9yZWZlcmVuY2UuaHBwPgojaW5jbHVkZSA8Ym9v
c3QvcHl0aG9uL29iamVjdHMuaHBwPgovLyNpbmNsdWRlIDxib29zdC9weXRob24vY2FsbGJhY2su
aHBwPgojaW5jbHVkZSA8Ym9vc3QvdHlwZV90cmFpdHMuaHBwPgoKI2luY2x1ZGUgPGlvc3RyZWFt
PgoKbmFtZXNwYWNlIHB5dGhvbiA9IGJvb3N0OjpweXRob247CgpuYW1lc3BhY2UKewoJCgkvKgoJ
cHl0aG9uOjpyZWYgY3JlYXRlVE1QKCkKCXsKCQlweXRob246OnB5cmVmIHRtcF9kYXRhX21vZChQ
eUltcG9ydF9JbXBvcnRNb2R1bGUoInRtcF9kYXRhIikpOwoKCQlweXRob246OnB5cmVmIFRNUF90
ID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