Skip to content

hanging object references in helper functions avoided #264

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

Merged
merged 4 commits into from
May 5, 2020
Merged

hanging object references in helper functions avoided #264

merged 4 commits into from
May 5, 2020

Conversation

abdulsmapara
Copy link
Contributor

@abdulsmapara abdulsmapara commented Apr 28, 2020

resolves: #44

Description of changes:

  • Avoided hanging object references in helper functions -
    • Created a deep copy of header and keyring trace objects from the managed stream before passing them to CryptoResult in the encrypt[1] and decrypt[2] functions.
    • Modified the test for checking equality of header but not identity

[1]

with StreamEncryptor(**kwargs) as encryptor:
ciphertext = encryptor.read()
return CryptoResult(result=ciphertext, header=encryptor.header, keyring_trace=encryptor.keyring_trace)

[2]
with StreamDecryptor(**kwargs) as decryptor:
plaintext = decryptor.read()
return CryptoResult(result=plaintext, header=decryptor.header, keyring_trace=decryptor.keyring_trace)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@mattsb42-aws
Copy link
Member

mattsb42-aws commented Apr 28, 2020

Thanks for the contribution!
It looks like there are a bunch of tests where we currently check identity (ex: assert header is expected_header) that will need to be changed to check the new requirement: equality but NOT identity (ex:

assert header == expected_header
assert header is not expected_header

Also, please run tox -e autoformat to take care of the formatting issues that our CI is blocking on.

@abdulsmapara
Copy link
Contributor Author

@mattsb42-aws, added commits as per the comments.

Copy link
Member

@mattsb42-aws mattsb42-aws left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Thanks for the contribution. :)

@mattsb42-aws mattsb42-aws merged commit b10c415 into aws:master May 5, 2020
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.

avoid leaving hanging object references in helper functions
2 participants