Issue-1397: possible solution

This commit is contained in:
Matthias Koefferlein 2023-06-13 00:44:42 +02:00
parent 9103d2b90d
commit 41c5d3f4ff
3 changed files with 39 additions and 0 deletions

View File

@ -690,6 +690,11 @@ PyObject *object_from_variant (tl::Variant &var, PYAObjectBase *self, const gsi:
}
} else {
// This is the case for return values that prefer to be copied (e.g. from const &)
prefer_copy = atype.prefer_copy ();
}
return object_to_python (obj, self, cls, pass_obj, is_const, prefer_copy, can_destroy);

View File

@ -711,6 +711,11 @@ static VALUE object_from_variant (tl::Variant &var, Proxy *self, const gsi::ArgT
}
} else {
// This is the case for return values that prefer to be copied (e.g. from const &)
prefer_copy = atype.prefer_copy ();
}
return object_to_ruby (obj, self, cls, pass_obj, is_const, prefer_copy, can_destroy);

View File

@ -1156,6 +1156,35 @@ class DBLayoutTest(unittest.TestCase):
self.assertEqual(shape.property(42), None)
self.assertEqual(shape.property(42.0), None)
# Bug #1397
def test_bug1397(self):
testtmp = os.getenv("TESTTMP_WITH_NAME", os.getenv("TESTTMP", "."))
tmp = os.path.join(testtmp, "tmp.gds")
l = pya.Layout()
c = l.create_cell("test_cell")
li = pya.LayerInfo(1, 0)
t = pya.Trans.R180
c.add_meta_info(pya.LayoutMetaInfo("kfactory:li", li, None, True))
c.add_meta_info(pya.LayoutMetaInfo("kfactory:t", t, None, True))
l.write(tmp)
l2 = pya.Layout()
l2.read(tmp)
c2 = l2.cell("test_cell")
li = c2.meta_info("kfactory:li").value
self.assertEqual(li.layer, 1)
self.assertEqual(li.datatype, 0)
t = c2.meta_info("kfactory:t").value
self.assertEqual(str(t), "r180 0,0")
# run unit tests
if __name__ == '__main__':