File tree 3 files changed +15
-2
lines changed
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> {};
164
164
165
165
struct Poly : public PolyRESTProcess <Poly, IPoly>
166
166
{
167
- int a;
167
+ int a= 5 ;
168
168
};
169
169
170
170
// root type
@@ -175,7 +175,7 @@ struct Root
175
175
Bar1 bar1;
176
176
177
177
std::shared_ptr<IPoly> spoly{new Poly};
178
- std::shared_ptr<Bar> sbar{new Bar};
178
+ std::shared_ptr<Bar> sbar{new Bar ( 0 ) };
179
179
180
180
FooBar1& getFB1 () {
181
181
static FooBar1 m;
Original file line number Diff line number Diff line change @@ -220,3 +220,7 @@ def expectThrow(f):
220
220
fb = FooBar1 ()
221
221
assert foo .b ()== 2
222
222
assert 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
571
571
}
572
572
573
573
static PyObject* getAttro (PyObject* self, PyObject* attr)
574
+ try
574
575
{
575
576
auto cppWrapper=static_cast <CppWrapper*>(self);
576
577
auto i=cppWrapper->methods .find (PyUnicode_AsUTF8 (attr));
@@ -579,8 +580,16 @@ namespace classdesc
579
580
Py_INCREF (i->second );
580
581
return i->second ;
581
582
}
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
+ }
582
590
return PyObject_GenericGetAttr (self,attr);
583
591
}
592
+ CLASSDESC_PY_EXCEPTION_ABSORB (nullptr );
584
593
585
594
static int setAttro (PyObject* self, PyObject* name, PyObject* attr)
586
595
{
You can’t perform that action at this time.
0 commit comments