Skip to content

Fix inconsistent copying of meniscal attributes in BoneMesh.copy()#49

Draft
Copilot wants to merge 2 commits intomeniscus_measuresfrom
copilot/sub-pr-48
Draft

Fix inconsistent copying of meniscal attributes in BoneMesh.copy()#49
Copilot wants to merge 2 commits intomeniscus_measuresfrom
copilot/sub-pr-48

Conversation

Copy link

Copilot AI commented Oct 30, 2025

The BoneMesh.copy() method was inconsistently handling meniscal attributes: _meniscus_meshes used shallow copy while _meniscal_outcomes and _meniscal_cart_labels were assigned by reference, allowing modifications to the copy to affect the original.

Changes

  • Updated _meniscal_outcomes and _meniscal_cart_labels to use .copy() with None checks
  • Added empty dict fallback for _meniscus_meshes to match initialization behavior
  • All three attributes now follow the same pattern as dict_cartilage_labels
# Before: reference assignment allowed shared state
copy_._meniscal_outcomes = self._meniscal_outcomes

# After: shallow copy prevents shared state
copy_._meniscal_outcomes = (
    self._meniscal_outcomes.copy() if self._meniscal_outcomes else None
)

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: gattia <10676083+gattia@users.noreply.github.com>
Copilot AI changed the title [WIP] WIP address feedback from review on meniscus measures implementation Fix inconsistent copying of meniscal attributes in BoneMesh.copy() Oct 30, 2025
Copilot AI requested a review from gattia October 30, 2025 22:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants