Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make dict views behave like their unrestricted versions #148

Closed
wants to merge 1 commit into from

Conversation

perrinjerome
Copy link
Contributor

unlike the restricted versions, the unrestricted versions:

  • are not iterators, they are views
  • have a len
  • are false when the mapping is empty, true otherwise
  • are instances of collections.abc.MappingView

This change aligns the behavior of restricted versions with the behavior of unrestricted one, while keeping the "guard", which validates the access with the security manager.

During this refactoring, also change .items() to validate ach keys and values, like .keys() and .values() do.

unlike the restricted versions, the unrestricted versions:
 - are not iterators, they are views
 - have a len
 - are false when the mapping is empty, true otherwise
 - are instances of collections.abc.MappingView

This change aligns the behavior of restricted versions with the behavior
of unrestricted one, while keeping the "guard", which validates the
access with the security manager.

During this refactoring, also change `.items()` to validate
ach keys and values, like `.keys()` and `.values()` do.

Co-authored-by: Dieter Maurer <[email protected]>
@perrinjerome
Copy link
Contributor Author

this replaces #147

@perrinjerome perrinjerome enabled auto-merge (squash) March 13, 2024 08:43
@perrinjerome perrinjerome requested a review from icemac March 13, 2024 08:44
@perrinjerome perrinjerome disabled auto-merge March 13, 2024 09:09
@perrinjerome perrinjerome deleted the fix/dict-views branch March 13, 2024 11:17
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