Skip to content

wrap setitem/setattr assign failures in PathAssignError - #304

Open
Sahana2524 wants to merge 1 commit into
mahmoud:masterfrom
Sahana2524:assign-path-error-wrap
Open

wrap setitem/setattr assign failures in PathAssignError#304
Sahana2524 wants to merge 1 commit into
mahmoud:masterfrom
Sahana2524:assign-path-error-wrap

Conversation

@Sahana2524

Copy link
Copy Markdown

_assign_op only turned failures into PathAssignError for the registry ('P') branch, so an assignment through a T-expression destination leaked the raw error instead:

  • Assign(T[i], v) past the end of a list, or into an immutable tuple, surfaced a bare IndexError/TypeError wrapped by the generic trace
  • Assign(T.attr, v) onto a read-only attribute did the same with AttributeError
  • the string/Path form already raised PathAssignError, and Delete._del_one wraps all three op branches, so this was the odd one out

Wrapped the setitem and setattr branches the same way, which also matches what the Assign docstring already promises. Test covers the list, tuple, and attribute cases.

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.

1 participant