<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
David,
<p>In object dict_base::get(object_cref k) const
<br>isn't it better to have expect_non_null?
<br>Because otherwise wrong key leads to access violation.
<p>Best regards.
<br>Nikolay
<p>David Abrahams wrote:
<blockquote TYPE=CITE>Nikolay Mladenov <nickm@sitius.com> writes:
<p>> I am going to read the PEP.
<br>> But I think I am getting closer with:
<br>> self& staticmethod(char const* name)
<br>> {
<br>> PyObject *method
= pytype_check(&PyMethod_Type, ((object)(this->attr(name))).ptr());
<br>> this->attr(name)
= object(handle<>(
<br>>
PyStaticMethod_New(PyMethod_GET_FUNCTION(method) )
<br>>
));
<br>> return *this;
<br>> }
<p>> I guess PyMethod_GET_FUNCTION corresponds to "C.__dict__['f']" since
<br>> it extracts the function from the PyMethod Descriptor .
<p>It's similar, but I would prefer it if you would get it from the
<br>class' __dict__. One day I may have a reason not to build a true
<br>Python Method wrapper, and use something else instead; that would
<br>break your code.
<p>You can reach the class' dict very simply via:
<p> detail::downcast<PyTypeObject>(this->ptr())->tp_dict
<p>--
<br>
David Abrahams
<br> dave@boost-consulting.com * <a href="http://www.boost-consulting.com">http://www.boost-consulting.com</a>
<br>Boost support, enhancements, training, and commercial distribution</blockquote>
</html>