Skip to content

AssertionError, assert delay >= 0, delay #159

@mstarodub

Description

@mstarodub
import trio
import trio_asyncio
from trio_asyncio import aio_as_trio as a2t
from curl_cffi import requests as ccr
from aioresult import ResultCapture

urls = [
  'https://google.com/',
  'https://facebook.com/',
  'https://twitter.com/',
]


async def main():
  async with a2t(ccr.AsyncSession()) as session:
    async with trio.open_nursery() as nursery:
      results = [
        ResultCapture.start_soon(nursery, a2t(session.get), url) for url in urls
      ]

  for r in results:
    resp = r.result()
    print(resp.url, resp.status_code, len(resp.text))


trio_asyncio.run(main)

gives

Exception ignored from cffi callback <function timer_function at 0x1038ed9e0>:
Traceback (most recent call last):
  File ".venv/lib/python3.13/site-packages/curl_cffi/aio.py", line 131, in timer_function
    async_curl._timer = async_curl.loop.call_later(
  File ".venv/lib/python3.13/site-packages/trio_asyncio/_base.py", line 367, in call_later
    assert delay >= 0, delay
AssertionError: -0.001
https://www.google.com/ 200 50051
https://www.facebook.com/unsupportedbrowser 200 152403
https://x.com/ 200 221313

related to #153

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions