Skip to content

Conversation

chalmerlowe
Copy link
Collaborator

@chalmerlowe chalmerlowe commented Sep 19, 2025

The _AsyncJob.result() method was not correctly passing the right arguments to the superclass's result() method when the retry object was expected to be the same as the DEFAULT_RETRY object. Passing an empty dict was a way of simply letting the google.api_core handle things.

{} if retry is DEFAULT_RETRY else {"retry": retry}

When the retry object is instantiated and when the DEFAULT_RETRY object is instantiated, these two elements are separate objects. This means that because the is keyword checks for identity NOT equality that code path never evaluates to True and is not used as one would expect.

This leads to subtle bugs that this PR corrects by simply passing the retry object and relying on the google.api_core to understand what a DEFAULT_RETRY value is and managing it appropriately.

A new test case is added to verify that job.result() correctly handles both the default retry use case and a custom retry object use case.

Fixes #2210 🦕

The `_AsyncJob.result()` method was not correctly passing the `retry`
argument to the superclass's `result()` method when the `retry` object
was the same as the default retry object. This caused the default
retry settings to be ignored in some cases.

This change modifies the `result()` method to always pass the `retry`
argument to the superclass, ensuring that the provided retry settings
are always honored.

A new test case is added to verify that `job.result()` correctly
handles both the default retry and a custom retry object.
@chalmerlowe chalmerlowe requested review from a team as code owners September 19, 2025 14:52
@product-auto-label product-auto-label bot added the size: s Pull request size is small. label Sep 19, 2025
@product-auto-label product-auto-label bot added the api: bigquery Issues related to the googleapis/python-bigquery API. label Sep 19, 2025
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 API. size: s Pull request size is small.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

LoadJob.result() ignores its default retry
2 participants