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 python usage around oauth pagination #3342

Merged
merged 1 commit into from Dec 1, 2017
Merged

Conversation

@agjohnson
Copy link
Contributor

@agjohnson agjohnson commented Dec 1, 2017

Because of a python quirk, we are currently returning an empty list during
pagination against oauth proviers. The quirk breaks down to this:

def foo():
    try:
        return 'duck'
    except Exception:
        return 'duck'
    finally:
        return 'goose'

assert foo() == 'goose'

I didn't realize finally behaved in this manner with respect to return, so
hey, The More You Know™

Because of a python quirk, we are currently returning an empty list during
pagination against oauth proviers. The quirk breaks down to this:

```python
def foo():
    try:
        return 'duck'
    except Exception:
        return 'duck'
    finally:
        return 'goose'

assert foo() == 'goose'
```

I didn't realize `finally` behaved in this manner with respect to `return`, so
hey, The More You Know™
@agjohnson agjohnson requested review from humitos and ericholscher Dec 1, 2017
@ericholscher ericholscher merged commit 8ecd8f6 into master Dec 1, 2017
2 checks passed
@ericholscher
Copy link
Member

@ericholscher ericholscher commented Dec 1, 2017

Should this go out today?

@ericholscher
Copy link
Member

@ericholscher ericholscher commented Dec 1, 2017

Also curious why the tests weren't failing? Guessing we aren't testing the pagination?

@humitos
Copy link
Member

@humitos humitos commented Dec 1, 2017

Nice catch! That was me :D

I got confused between finally and else. Thanks!

@stsewd stsewd deleted the agj/oauth-sync-fix-more branch Aug 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants