Skip to content

Conversation

dhermes
Copy link
Contributor

@dhermes dhermes commented Nov 9, 2017

I'm not entirely sure how worthwhile this is, I just discovered the implementation doesn't do anything helpful in Python 2 (e.g. print the traceback from the original exc):

# Python < 3.2
def raise_from(value, from_value):
    raise value
# Python == 3.2
def raise_from(value, from_value):
    try:
        if from_value is None:
            raise value
        raise value from from_value
    finally:
        value = None
# Python > 3.2
def raise_from(value, from_value):
    try:
        raise value from from_value
    finally:
        value = None

I was "inspired" to do this by #211.

_default._load_credentials_from_file(str(filename))

assert excinfo.match(r'Failed to load authorized user')
assert excinfo.match(r'missing fields')

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

@dhermes
Copy link
Contributor Author

dhermes commented Nov 9, 2017

@jonparrott I updated so that the wrapped exceptions were still wrapped.

@dhermes dhermes merged commit 01efcd4 into googleapis:master Nov 9, 2017
@dhermes dhermes deleted the six-raise-from branch November 9, 2017 21:00
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.

2 participants