Skip to content

Commit f4d0ce7

Browse files
authored
Merge branch 'master' into feat/python-3.14
Signed-off-by: Paillat <paillat@pycord.dev>
2 parents 0eb161c + 7a4c142 commit f4d0ce7

3 files changed

Lines changed: 6 additions & 8 deletions

File tree

discord/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,6 @@
8787
from discord.voice import VoiceClient as VoiceClientC
8888
from discord.voice import VoiceProtocol as VoiceProtocolC
8989

90-
from .client import Client
91-
9290
C = TypeVar("C", bound=Client)
9391

9492
@deprecated(

discord/utils.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1670,14 +1670,17 @@ def warn_if_voice_dependencies_missing() -> None:
16701670
def _get_event_loop() -> asyncio.AbstractEventLoop:
16711671
"""Get the current event loop, creating one if necessary.
16721672
1673+
If no event loop is running and none is set, a new event loop
1674+
is created and set as the current event loop.
1675+
16731676
Returns
16741677
-------
16751678
asyncio.AbstractEventLoop
16761679
The current event loop.
16771680
"""
16781681
if sys.version_info >= (3, 14):
16791682
try:
1680-
loop = asyncio.get_running_loop()
1683+
loop = asyncio.get_event_loop()
16811684
except RuntimeError:
16821685
loop = asyncio.new_event_loop()
16831686
asyncio.set_event_loop(loop)

examples/basic_voice.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,8 @@ def __init__(self, source: discord.AudioSource, *, data: dict, volume: float = 0
4242
self.url = data.get("url")
4343

4444
@classmethod
45-
async def from_url(cls, url, *, loop=None, stream=False):
46-
loop = loop or asyncio.get_event_loop()
47-
data = await loop.run_in_executor(
48-
None, lambda: ytdl.extract_info(url, download=not stream)
49-
)
45+
async def from_url(cls, url, *, stream=False):
46+
data = await asyncio.to_thread(ytdl.extract_info, url, download=not stream)
5047

5148
if "entries" in data:
5249
# Takes the first item from a playlist

0 commit comments

Comments
 (0)