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

New with semantics #42996

Closed
gvanrossum opened this issue Mar 8, 2006 · 2 comments
Closed

New with semantics #42996

gvanrossum opened this issue Mar 8, 2006 · 2 comments
Assignees
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs)

Comments

@gvanrossum
Copy link
Member

BPO 1445739
Nosy @gvanrossum
Files
  • new_with.patch: first rough patch
  • 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/gvanrossum'
    closed_at = <Date 2006-03-15.07:59:28.000>
    created_at = <Date 2006-03-08.15:50:55.000>
    labels = ['interpreter-core']
    title = 'New with semantics'
    updated_at = <Date 2006-03-15.07:59:28.000>
    user = 'https://github.com/gvanrossum'

    bugs.python.org fields:

    activity = <Date 2006-03-15.07:59:28.000>
    actor = 'nnorwitz'
    assignee = 'gvanrossum'
    closed = True
    closed_date = None
    closer = None
    components = ['Interpreter Core']
    creation = <Date 2006-03-08.15:50:55.000>
    creator = 'gvanrossum'
    dependencies = []
    files = ['7059']
    hgrepos = []
    issue_num = 1445739
    keywords = ['patch']
    message_count = 2.0
    messages = ['49689', '49690']
    nosy_count = 2.0
    nosy_names = ['gvanrossum', 'nnorwitz']
    pr_nums = []
    priority = 'normal'
    resolution = 'accepted'
    stage = None
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue1445739'
    versions = ['Python 2.5']

    @gvanrossum
    Copy link
    Member Author

    Here's a patch that implements the new with statement
    semantics: if __exit__ got passed an exception, it is
    only swallowed when __exit__ returns *true*. So it is
    no longer necessary for __exit__ handlers to re-raise
    the exception.

    This is a bit rough still -- existing unit tests have
    been adjusted, but there should be additional unit
    tests for the new functionality. Also the re-raise
    code in various __exit__ handlers coded in the previous
    patch could be removed (note that re-raising doesn't do
    any harm -- it's just not necessary).

    @gvanrossum gvanrossum self-assigned this Mar 8, 2006
    @gvanrossum gvanrossum added the interpreter-core (Objects, Python, Grammar, and Parser dirs) label Mar 8, 2006
    @nnorwitz
    Copy link
    Mannequin

    nnorwitz mannequin commented Mar 15, 2006

    Logged In: YES
    user_id=33168

    Guido checked this in a few days ago AFAIK, so closing.

    @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)
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant