Skip to content
This repository was archived by the owner on Oct 4, 2023. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[build-system]
requires = ["setuptools>=42", "wheel"]
build-backend = "setuptools.build_meta"

[tool.poetry]
name = "ratelimiter"
version = "1.2.0"
description = "A rate-limiting library"
authors = ["Frazer McLean <frazer@frazermclean.co.uk>"]
3 changes: 2 additions & 1 deletion ratelimiter/_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,5 @@ async def __aenter__(self):
await asyncio.sleep(sleeptime)
return self

__aexit__ = asyncio.coroutine(RateLimiter.__exit__)
# backward behavior for python 3.5 - 3.10; no need for decorator if deprecated in python > 3.11
__aexit__ = asyncio.coroutine(RateLimiter.__exit__) if hasattr(asyncio, 'coroutine') else RateLimiter.__exit__
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @brainysmurf - have you tested whether returning RateLimiter.__exit__ behaves as expected on Python 3.11? (it's declared using def, not async def, which is what has me wondering)

Copy link
Copy Markdown

@jondoescoding jondoescoding Apr 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't work as expected. Implemented the changes and when called I get:

name 'RateLimiter' is not defined

And the error points to "RateLimiter.exit"