Skip to content
This repository was archived by the owner on Sep 13, 2024. It is now read-only.

Commit 979ac7d

Browse files
authored
Merge pull request #69 from beeware/py312
Add an explicit new_child_loop API
2 parents 26e9eef + cb5f760 commit 979ac7d

File tree

4 files changed

+16
-3
lines changed

4 files changed

+16
-3
lines changed

changes/61.feature.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Support for Python 3.11 and 3.12 was added.
1+
Support for Python 3.11 was added.

changes/69.feature.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Initial support for Python 3.12 was added.

src/gbulb/utils.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import asyncio
22
import weakref
33

4-
__all__ = ["install", "get_event_loop", "wait_signal"]
4+
__all__ = ["install", "get_event_loop", "new_event_loop", "wait_signal"]
55

66

77
def install(gtk=False):
@@ -41,6 +41,11 @@ def get_event_loop():
4141
return asyncio.get_event_loop()
4242

4343

44+
def new_event_loop():
45+
"""Alias to asyncio.new_event_loop()."""
46+
return asyncio.new_event_loop()
47+
48+
4449
class wait_signal(asyncio.Future):
4550
"""A future for waiting for a given signal to occur."""
4651

tests/test_utils.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,14 @@ def test_get_event_loop():
5252

5353
import gbulb
5454

55-
assert asyncio.get_event_loop() is gbulb.get_event_loop()
55+
try:
56+
loop = gbulb.new_event_loop()
57+
asyncio.set_event_loop(loop)
58+
59+
assert asyncio.get_event_loop() is gbulb.get_event_loop()
60+
61+
finally:
62+
loop.close()
5663

5764

5865
def test_wait_signal(glib_loop):

0 commit comments

Comments
 (0)