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

Conversation

agjohnson
Copy link
Contributor

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 added the Priority: high High priority label Dec 1, 2017
@ericholscher ericholscher merged commit 8ecd8f6 into master Dec 1, 2017
@ericholscher
Copy link
Member

Should this go out today?

@ericholscher
Copy link
Member

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 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 August 15, 2018 22:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: high High priority
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants