File tree Expand file tree Collapse file tree 3 files changed +15
-2
lines changed Expand file tree Collapse file tree 3 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -164,7 +164,7 @@ struct IPoly: public PolyRESTProcess<IPoly> {};
164164
165165struct Poly : public PolyRESTProcess <Poly, IPoly>
166166{
167- int a;
167+ int a= 5 ;
168168};
169169
170170// root type
@@ -175,7 +175,7 @@ struct Root
175175 Bar1 bar1;
176176
177177 std::shared_ptr<IPoly> spoly{new Poly};
178- std::shared_ptr<Bar> sbar{new Bar};
178+ std::shared_ptr<Bar> sbar{new Bar ( 0 ) };
179179
180180 FooBar1& getFB1 () {
181181 static FooBar1 m;
Original file line number Diff line number Diff line change @@ -220,3 +220,7 @@ def expectThrow(f):
220220fb = FooBar1 ()
221221assert foo .b ()== 2
222222assert fb .f .b ()== 0
223+
224+ # shared pointer support
225+ assert root .sbar .f ()== 20
226+ assert root .spoly .a ()== 5
Original file line number Diff line number Diff line change @@ -571,6 +571,7 @@ namespace classdesc
571571 }
572572
573573 static PyObject* getAttro (PyObject* self, PyObject* attr)
574+ try
574575 {
575576 auto cppWrapper=static_cast <CppWrapper*>(self);
576577 auto i=cppWrapper->methods .find (PyUnicode_AsUTF8 (attr));
@@ -579,8 +580,16 @@ namespace classdesc
579580 Py_INCREF (i->second );
580581 return i->second ;
581582 }
583+ else
584+ {
585+ auto methods=cppWrapper->command ->list ();
586+ auto attribute=methods.find (string (" ." )+PyUnicode_AsUTF8 (attr));
587+ if (attribute!=methods.end ())
588+ return CppWrapper::create (attribute->second , false );
589+ }
582590 return PyObject_GenericGetAttr (self,attr);
583591 }
592+ CLASSDESC_PY_EXCEPTION_ABSORB (nullptr );
584593
585594 static int setAttro (PyObject* self, PyObject* name, PyObject* attr)
586595 {
You can’t perform that action at this time.
0 commit comments