fix(helpers): use asyncio.get_running_loop() inside async methods (#3289)
### What Three `async` methods in `src/openai/helpers/` call `asyncio.get_event_loop()` from inside a running coroutine: - `LocalAudioPlayer.play` (`local_audio_player.py`) - `LocalAudioPlayer.play_stream` (`local_audio_player.py`) - `Microphone.record` (`microphone.py`) ### Why it matters Since Python 3.10, calling `asyncio.get_event_loop()` when there is no current event loop is deprecated, and calling it from within a coroutine to obtain the running loop emits a `DeprecationWarning`. The documented replacement for code that runs inside a coroutine is `asyncio.get_running_loop()`. ### Fix ```python # Before loop = asyncio.get_event_loop() # After loop = asyncio.get_running_loop() ``` In all three cases the loop is obtained inside an `async def` and only used for `run_in_executor` / `call_soon_threadsafe`, so there is always a running loop and behavior is unchanged. This just removes the deprecation and makes the intent explicit. ### Scope Three one-line changes in `src/openai/helpers/` (a hand-maintained, non-generated path). Files still parse and import. Happy to adjust if you would prefer a different approach. Co-authored-by: Marcus Wood <marcuswood@openai.com>
R
Rolly Calma committed
bac3545eee5a0dfd348a6766bca3e904308792dd
Parent: 161ae65
Committed by GitHub <noreply@github.com>
on 9/22/2026, 9:45:33 PM