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

fix: avoid global mutation in BigQueryOptions.client_endpoints_override #1280

Merged
merged 2 commits into from
Jan 13, 2025

Conversation

tswast
Copy link
Collaborator

@tswast tswast commented Jan 10, 2025

This fixes a common "gotcha" in Python. Before this fix, mutations to this dictionary will affect all instances of the BigQueryOptions class, not just the current instance.

See: https://docs.python-guide.org/writing/gotchas/#mutable-default-arguments

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes internal issue 389087778 🦕

@tswast tswast requested a review from GarrettWu January 10, 2025 17:18
@tswast tswast requested review from a team as code owners January 10, 2025 17:18
@product-auto-label product-auto-label bot added size: xs Pull request size is extra small. api: bigquery Issues related to the googleapis/python-bigquery-dataframes API. labels Jan 10, 2025
@GarrettWu
Copy link
Contributor

Thanks for the fix!

@tswast tswast merged commit 788f6e9 into main Jan 13, 2025
22 checks passed
@tswast tswast deleted the b389087778-gotcha branch January 13, 2025 23:05
shuoweil pushed a commit that referenced this pull request Jan 20, 2025
…ide` (#1280)

* fix: avoid global mutation in `BigQueryOptions.client_endpoints_override`

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigquery Issues related to the googleapis/python-bigquery-dataframes API. size: xs Pull request size is extra small.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants