Skip to content

Commit

Permalink
Drop deprecated 'loop' parameter from RWLock constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
asvetlov committed Jan 18, 2022
1 parent 3edb2a1 commit d4b41f5
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 27 deletions.
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Changes

* Dropped Python 3.6 support
* Python 3.10 is officially supported
* Drop deprecated `loop` parameter from `RWLock` constructor


1.2.0 (2021-11-09)
Expand Down
13 changes: 2 additions & 11 deletions aiorwlock/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,17 +238,8 @@ class RWLock:

core = _RWLockCore

def __init__(self, *, fast: bool = False, loop: OptLoop = None) -> None:
if loop is None:
loop = asyncio.get_event_loop()
else:
warnings.warn(
'Passing "loop" argument '
'is deprecated since aiorwlock 1.0 and scheduled for removal '
'in aiorwlock 2.0',
DeprecationWarning,
stacklevel=2,
)
def __init__(self, *, fast: bool = False) -> None:
loop = asyncio.get_running_loop()
if not loop.is_running():
warnings.warn(
'Instantiation of RWLock outside of async function context '
Expand Down
16 changes: 0 additions & 16 deletions tests/test_rwlock.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,22 +48,6 @@ async def _wait():
await asyncio.sleep(0.01)


def test_ctor_deprecated_implicit_not_running(loop):
with pytest.warns(DeprecationWarning):
RWLock()


def test_ctor_deprecated_explicit_non_running(loop):
with pytest.warns(DeprecationWarning):
RWLock(loop=loop)


@pytest.mark.asyncio
async def test_ctor_loop_deprecated_arg(loop):
with pytest.warns(DeprecationWarning):
RWLock(loop=loop)


@pytest.mark.asyncio
async def test_ctor_loop_reader(loop):
rwlock = RWLock().reader_lock
Expand Down

0 comments on commit d4b41f5

Please sign in to comment.