Skip to content

[3008.x] Replace deprecated asyncio.iscoroutinefunction with inspect.iscoroutinefunction (#69580)#69601

Open
dwoz wants to merge 1 commit into
saltstack:3008.xfrom
dwoz:dwoz/fix/issue-69580-3008x-iscoroutinefunction
Open

[3008.x] Replace deprecated asyncio.iscoroutinefunction with inspect.iscoroutinefunction (#69580)#69601
dwoz wants to merge 1 commit into
saltstack:3008.xfrom
dwoz:dwoz/fix/issue-69580-3008x-iscoroutinefunction

Conversation

@dwoz

@dwoz dwoz commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Backport of #69581 to 3008.x.

asyncio.iscoroutinefunction() was deprecated in Python 3.12 and is slated for removal in Python 3.16. This PR replaces it with inspect.iscoroutinefunction() in:

  • salt/utils/event.py
  • salt/cluster/consensus/raft/scheduler.py

Tests are added that verify no DeprecationWarning is emitted when scheduling coroutine callbacks through SaltEvent._schedule and AsyncTimeoutScheduler.schedule.

Why a sibling PR?

The original PR #69581 was merged to master (Potassium), but issue #69580 explicitly states:

We need to ensure we stop using deprecated functions on 3008.x.

So the master merge alone does not address the issue. This PR is the sibling backport that lands the same fix on 3008.x (Argon).

Related

Commits

  • Cherry-pick of `e70647eca19b2150098ae29c49ea29b127fc60c1` applies cleanly on `3008.x` with no conflicts. Both `salt/cluster/consensus/raft/scheduler.py` and its test exist on 3008.x, so the full set of files from the master PR was applied (nothing skipped).

Test plan

  • `venv310/bin/pytest tests/pytests/unit/utils/event/test_salt_event_schedule.py -v` -> 2 passed
  • `venv310/bin/pytest tests/pytests/unit/cluster/consensus/test_raft_scheduler.py -v` -> 16 passed
  • `pre-commit run --files ` clean

…nefunction

asyncio.iscoroutinefunction() was deprecated in Python 3.12 and is slated for
removal in Python 3.16. Replace it with inspect.iscoroutinefunction() in
salt/utils/event.py and salt/cluster/consensus/raft/scheduler.py. Add tests
that verify no DeprecationWarning is emitted when scheduling coroutine callbacks.

Fixes saltstack#69580
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test:full Run the full test suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants