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

on __exit__(), exc_value does not contain the exception. #52101

Closed
florentx mannequin opened this issue Feb 4, 2010 · 7 comments
Closed

on __exit__(), exc_value does not contain the exception. #52101

florentx mannequin opened this issue Feb 4, 2010 · 7 comments
Assignees
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error

Comments

@florentx
Copy link
Mannequin

florentx mannequin commented Feb 4, 2010

BPO 7853
Nosy @pitrou, @benjaminp, @florentx
Files
  • case_contextmanager_exit.py
  • issue7853_cm_exit.diff: Patch, apply to trunk
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/benjaminp'
    closed_at = <Date 2010-02-05.02:12:53.035>
    created_at = <Date 2010-02-04.09:35:08.283>
    labels = ['interpreter-core', 'type-bug']
    title = 'on __exit__(), exc_value does not contain the exception.'
    updated_at = <Date 2010-02-06.02:03:18.483>
    user = 'https://github.com/florentx'

    bugs.python.org fields:

    activity = <Date 2010-02-06.02:03:18.483>
    actor = 'benjamin.peterson'
    assignee = 'benjamin.peterson'
    closed = True
    closed_date = <Date 2010-02-05.02:12:53.035>
    closer = 'benjamin.peterson'
    components = ['Interpreter Core']
    creation = <Date 2010-02-04.09:35:08.283>
    creator = 'flox'
    dependencies = []
    files = ['16126', '16137']
    hgrepos = []
    issue_num = 7853
    keywords = ['patch']
    message_count = 7.0
    messages = ['98817', '98833', '98834', '98835', '98860', '98863', '98928']
    nosy_count = 3.0
    nosy_names = ['pitrou', 'benjamin.peterson', 'flox']
    pr_nums = []
    priority = 'high'
    resolution = 'fixed'
    stage = 'patch review'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue7853'
    versions = ['Python 2.6', 'Python 2.7']

    @florentx
    Copy link
    Mannequin Author

    florentx mannequin commented Feb 4, 2010

    On __exit__(), the 3rd argument "exc_value" should contain the instance of the exception.

    But in most cases, it contains only the string representation of the exception.

    See attached test case.
    Same behavior for KeyError, AttributeError, RuntimeError, ...

    @florentx florentx mannequin added interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error labels Feb 4, 2010
    @pitrou
    Copy link
    Member

    pitrou commented Feb 4, 2010

    Indeed, it seems the exception isn't always normalized.

    @benjaminp
    Copy link
    Contributor

    Has this behavior changed between 2.6 and 2.7?

    @pitrou
    Copy link
    Member

    pitrou commented Feb 4, 2010

    No, it's also in 2.6.

    @benjaminp benjaminp self-assigned this Feb 4, 2010
    @florentx
    Copy link
    Mannequin Author

    florentx mannequin commented Feb 5, 2010

    Patch.

    @benjaminp
    Copy link
    Contributor

    Fixed in r77983.

    @benjaminp
    Copy link
    Contributor

    BTW, I'm not going to backport this fix, since the implementation does carry over well to 2.6. Additionally, it is probably an unacceptable change of behavior in a bug fix release.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants