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

Obviously handle scrub_fields in rollbar.init() #235

Merged
merged 2 commits into from
Jun 15, 2018
Merged

Obviously handle scrub_fields in rollbar.init() #235

merged 2 commits into from
Jun 15, 2018

Conversation

veryuncommonname
Copy link
Contributor

My patch for #234

@rivkahstandig3636 rivkahstandig3636 added this to the v0.14.0 milestone Mar 8, 2018
@rokob
Copy link
Contributor

rokob commented Mar 14, 2018

These seems okay to me. I guess I would have set scrub_fields=None instead of =list() but they are equivalent here.

@brianr
Copy link
Member

brianr commented Mar 14, 2018

For the original issue (#234), wouldn't this potentially be a problem for every param, not just scrub_fields?

@veryuncommonname
Copy link
Contributor Author

It will. url_fields will also be affected. The reason of the problem here is dict_merge that can't copy some types. But I think it's not the best solution to change dict_merge in a case where the bug occurs because of arguments for init. Maybe implement a different version of dict_merge for copying settings?

@@ -276,7 +276,7 @@ def _get_pylons_request():

## public api

def init(access_token, environment='production', **kw):
def init(access_token, environment='production', scrub_fields=list(), **kw):

Choose a reason for hiding this comment

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

This is potentially dangerous.
It's discouraged to define default argument values with mutable objects.

http://docs.python-guide.org/en/latest/writing/gotchas/#mutable-default-arguments

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, you are right!

Copy link
Contributor

Choose a reason for hiding this comment

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

It isn't an issue here because the default isn't used instead it is just a falsey sentinel, but yeah a None would work just as well.

Choose a reason for hiding this comment

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

@rokob
You're right, it isn't used now.
But who knows what will be in future.
Can you guarantee next contributor won't overlook that?

@rivkahstandig3636 rivkahstandig3636 modified the milestones: v0.14.0, v0.15.0 May 17, 2018
@rokob rokob merged commit 60cdec9 into rollbar:master Jun 15, 2018
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.

5 participants