Skip to content

RPCError messages should use repr, not str#120

Merged
stylewarning merged 3 commits intomasterfrom
feature/repr-not-str
Feb 25, 2020
Merged

RPCError messages should use repr, not str#120
stylewarning merged 3 commits intomasterfrom
feature/repr-not-str

Conversation

@braised-babbage
Copy link
Copy Markdown
Contributor

@braised-babbage braised-babbage commented Feb 24, 2020

Using str often provides less information thanrepr.

@braised-babbage braised-babbage requested a review from a team as a code owner February 24, 2020 18:39
Comment thread rpcq/_spec.py
Copy link
Copy Markdown
Contributor

@appleby appleby left a comment

Choose a reason for hiding this comment

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

fyi, latest changes appear to have broken some of the pytests

https://gitlab.com/rigetti/forest/rpcq/-/jobs/448340424

Also for the record, it's worth considering whether there are any potential information leakage issues associated with switching from str to repr. I can't think of any reason why this should be considered an "unsafe" change, but mentioning it in case anyone else can. The only reason it occurs to me at all is I recently came across an internal issue that mentions scrubbing error messages to prevent leaking info.

edit: to be clear, I think any code that is depending on the difference between str and repr to hide sensitive info is already Doing it Wrong.

Comment thread rpcq/_spec.py
@stylewarning stylewarning merged commit 0278c62 into master Feb 25, 2020
@stylewarning stylewarning deleted the feature/repr-not-str branch February 25, 2020 18:37
appleby added a commit that referenced this pull request Feb 27, 2020
In #120 we switch from `str` to `repr` for printing exceptions, which
broke the python tests on 3.7+ due a change in python's default
BaseException.__repr__, which dropped the trailing comma.

https://docs.python.org/3/whatsnew/3.7.html#changes-in-the-python-api
appleby added a commit that referenced this pull request Feb 27, 2020
In #120 we switched from `str` to `repr` for printing exceptions,
which broke the python tests on 3.7+ due a change in python's default
BaseException.__repr__, which dropped the trailing comma.

https://docs.python.org/3/whatsnew/3.7.html#changes-in-the-python-api
stylewarning pushed a commit that referenced this pull request Feb 28, 2020
In #120 we switched from `str` to `repr` for printing exceptions,
which broke the python tests on 3.7+ due a change in python's default
BaseException.__repr__, which dropped the trailing comma.

https://docs.python.org/3/whatsnew/3.7.html#changes-in-the-python-api
@notmgsk notmgsk mentioned this pull request Mar 2, 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.

3 participants