GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Improper call to `asyncio.Timeout.expired` · Issue #101498 · python/cpython

Improper call to asyncio.Timeout.expired #101498

New issue
Copy link
New issue
Copy link
Closed
Closed
Improper call to asyncio.Timeout.expired#101498
Copy link
Labels
docsDocumentation in the Doc dirDocumentation in the Doc dirtopic-asyncio

Description

@rsokl
rsokl
opened on Feb 1, 2023
Issue body actions

Documentation

In this example for using asyncio.Timeout, expired is accessed as an attribute, but it should be called as a method.

I.e. the example should read as:

async def main():
    try:
        # We do not know the timeout when starting, so we pass ``None``.
        async with asyncio.timeout(None) as cm:
            # We know the timeout now, so we reschedule it.
            new_deadline = get_running_loop().time() + 10
            cm.reschedule(new_deadline)

            await long_running_task()
    except TimeoutError:
        pass

    if cm.expired():  # <---- I CHANGED THIS TO BE A METHOD CALL
        print("Looks like we haven't finished on time.")

Linked PRs

  • gh-101498 : Updated Doc/library/asyncio-task.rst#timeout #101499
  • [3.11] gh-101498 : Fix asyncio.Timeout example in docs (GH-101499) #101501

Activity

  1. rsokl
    added
    docsDocumentation in the Doc dirDocumentation in the Doc dir
    on Feb 1, 2023
  2. AlexWaygood
    added
    topic-asyncio
    on Feb 1, 2023
  3. ezio-melotti
    added this to asyncioon Feb 1, 2023
  4. github-project-automation
    moved this to Todo in asyncioon Feb 1, 2023
  5. gvanrossum
    added a commit that references this issue on Feb 1, 2023

    gh-101498 : Fix asyncio.Timeout example in docs (#101499)

    95fb0e0
  6. gvanrossum
    closed this as completedon Feb 1, 2023
  7. github-project-automation
    moved this from Todo to Done in asyncioon Feb 1, 2023
  8. miss-islington
    added 2 commits that reference this issue on Feb 1, 2023

    pythongh-101498 : Fix asyncio.Timeout example in docs (pythonGH-101499)

    1dd037e

    gh-101498 : Fix asyncio.Timeout example in docs (GH-101499)

    89442e1
  9. carljm
    added a commit that references this issue on Feb 1, 2023

    Merge branch 'main' into inlinecomp2

    8b76051
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

    docsDocumentation in the Doc dirDocumentation in the Doc dirtopic-asyncio

    Projects

    • asyncio
      Status
      Done
      Show more project fields

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402503 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.