Skip to content

Commit 3221ad6

Browse files
author
FindDefinition
committed
fix bug in add_pybind_member
1 parent 8374c7e commit 3221ad6

2 files changed

Lines changed: 16 additions & 10 deletions

File tree

pccm/middlewares/pybind.py

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -473,15 +473,21 @@ def add_pybind_member(self: "Class",
473473
mw_metas = []
474474
if prop_name is None:
475475
prop_name = name
476-
for prop_name_part in prop_name.split("."):
477-
mw_metas.append(Pybind11PropMeta(prop_name_part, readwrite))
478-
return self.add_member(name=name,
479-
type=type,
480-
default=default,
481-
array=array,
482-
pyanno=pyanno,
483-
mw_metas=mw_metas)
484-
476+
name_part = name.split(",")
477+
prop_name_part = prop_name.split(",")
478+
assert len(name_part) == len(prop_name_part)
479+
for name, prop_name in zip(name_part, prop_name_part):
480+
name = name.strip()
481+
prop_name = prop_name.strip()
482+
mw_metas_part = mw_metas.copy()
483+
mw_metas_part.append(Pybind11PropMeta(prop_name, readwrite))
484+
self.add_member(name=name,
485+
type=type,
486+
default=default,
487+
array=array,
488+
pyanno=pyanno,
489+
mw_metas=mw_metas_part)
490+
return
485491

486492
def _postprocess_class(cls_name: str, cls_namespace: str, submod: str,
487493
decls: List[Union[PybindMethodDecl, PybindPropDecl]],

version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.1.14
1+
0.1.15

0 commit comments

Comments
 (0)