← 输入框|github.com|刷新
Skip to content

Raise TypeError in ExitStack.enter_context() for bad argument #88637

Closed

Description

@serhiy-storchaka
BPO 44471
Nosy @ncoghlan, @serhiy-storchaka, @1st1
PRs
  • bpo-44471: Change error type for bad objects in ExitStack.enter_context() #26820
  • Dependencies
  • bpo-12022: AttributeError should report the same details when raised by lookup_special() as when raised in the REPL
  • 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 = None
    closed_at = <Date 2021-06-29.08:29:12.209>
    created_at = <Date 2021-06-21.07:43:53.258>
    labels = ['type-feature', 'library', '3.11']
    title = 'Raise TypeError in ExitStack.enter_context() for bad argument'
    updated_at = <Date 2021-06-29.08:29:12.209>
    user = 'https://github.com/serhiy-storchaka'

    bugs.python.org fields:

    activity = <Date 2021-06-29.08:29:12.209>
    actor = 'serhiy.storchaka'
    assignee = 'none'
    closed = True
    closed_date = <Date 2021-06-29.08:29:12.209>
    closer = 'serhiy.storchaka'
    components = ['Library (Lib)']
    creation = <Date 2021-06-21.07:43:53.258>
    creator = 'serhiy.storchaka'
    dependencies = ['12022']
    files = []
    hgrepos = []
    issue_num = 44471
    keywords = ['patch']
    message_count = 2.0
    messages = ['396209', '396708']
    nosy_count = 3.0
    nosy_names = ['ncoghlan', 'serhiy.storchaka', 'yselivanov']
    pr_nums = ['26820']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue44471'
    versions = ['Python 3.11']

    Activity

    1. serhiy-storchaka commented on Jun 21, 2021

      @serhiy-storchaka
      MemberAuthor

      For consistency with the "with" statement (see bpo-12022) ExitStack.enter_context() should raise TypeError instead of AttributeError if the argument is not a context manager. Same for AsyncExitStack.enter_async_context().

    2. added
      3.11only security fixes
      stdlibStandard Library Python modules in the Lib/ directory
      type-featureA feature request or enhancement
      on Jun 21, 2021
    3. serhiy-storchaka commented on Jun 29, 2021

      @serhiy-storchaka
      MemberAuthor

      New changeset 6cb145d by Serhiy Storchaka in branch 'main':
      bpo-44471: Change error type for bad objects in ExitStack.enter_context() (GH-26820)
      6cb145d

    4. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      3.11only security fixesstdlibStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancement

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions