File tree Expand file tree Collapse file tree 6 files changed +47
-9
lines changed Expand file tree Collapse file tree 6 files changed +47
-9
lines changed Original file line number Diff line number Diff line change 72
72
permissions :
73
73
id-token : write
74
74
contents : write
75
+ attestations : write
75
76
security-events : write
76
77
steps :
77
78
- uses : mongodb-labs/drivers-github-tools/secure-checkout@v2
Original file line number Diff line number Diff line change @@ -75,14 +75,11 @@ repos:
75
75
stages : [manual]
76
76
77
77
- repo : https://github.com/sirosen/check-jsonschema
78
- rev : 0.27 .0
78
+ rev : 0.29 .0
79
79
hooks :
80
- - id : check-jsonschema
81
- name : " Check GitHub Workflows"
82
- files : ^\.github/workflows/
83
- types : [yaml]
84
- args : ["--schemafile", "https://json.schemastore.org/github-workflow"]
85
- stages : [manual]
80
+ - id : check-github-workflows
81
+ - id : check-github-actions
82
+ - id : check-dependabot
86
83
87
84
- repo : https://github.com/ariebovenberg/slotscheck
88
85
rev : v0.19.0
Original file line number Diff line number Diff line change @@ -65,7 +65,17 @@ def __repr__(self) -> str:
65
65
return f"<{ self .__class__ .__name__ } (name={ self ._name } ) object at 0x{ id (self ):x} >"
66
66
67
67
def _run_async (self ) -> None :
68
- asyncio .run (self ._run ()) # type: ignore[func-returns-value]
68
+ # The default asyncio loop implementation on Windows
69
+ # has issues with sharing sockets across loops (https://github.com/python/cpython/issues/122240)
70
+ # We explicitly use a different loop implementation here to prevent that issue
71
+ if sys .platform == "win32" :
72
+ loop = asyncio .SelectorEventLoop ()
73
+ try :
74
+ loop .run_until_complete (self ._run ()) # type: ignore[func-returns-value]
75
+ finally :
76
+ loop .close ()
77
+ else :
78
+ asyncio .run (self ._run ()) # type: ignore[func-returns-value]
69
79
70
80
def open (self ) -> None :
71
81
"""Start. Multiple calls have no effect.
Original file line number Diff line number Diff line change @@ -65,7 +65,17 @@ def __repr__(self) -> str:
65
65
return f"<{ self .__class__ .__name__ } (name={ self ._name } ) object at 0x{ id (self ):x} >"
66
66
67
67
def _run_async (self ) -> None :
68
- asyncio .run (self ._run ()) # type: ignore[func-returns-value]
68
+ # The default asyncio loop implementation on Windows
69
+ # has issues with sharing sockets across loops (https://github.com/python/cpython/issues/122240)
70
+ # We explicitly use a different loop implementation here to prevent that issue
71
+ if sys .platform == "win32" :
72
+ loop = asyncio .SelectorEventLoop ()
73
+ try :
74
+ loop .run_until_complete (self ._run ()) # type: ignore[func-returns-value]
75
+ finally :
76
+ loop .close ()
77
+ else :
78
+ asyncio .run (self ._run ()) # type: ignore[func-returns-value]
69
79
70
80
def open (self ) -> None :
71
81
"""Start. Multiple calls have no effect.
Original file line number Diff line number Diff line change 79
79
80
80
_IS_SYNC = True
81
81
82
+ # The default asyncio loop implementation on Windows
83
+ # has issues with sharing sockets across loops (https://github.com/python/cpython/issues/122240)
84
+ # We explicitly use a different loop implementation here to prevent that issue
85
+ if (
86
+ not _IS_SYNC
87
+ and sys .platform == "win32"
88
+ and asyncio .get_event_loop_policy () == asyncio .WindowsProactorEventLoopPolicy
89
+ ):
90
+ asyncio .set_event_loop_policy (asyncio .WindowsSelectorEventLoopPolicy ()) # type: ignore[attr-defined]
91
+
82
92
83
93
class ClientContext :
84
94
client : MongoClient
Original file line number Diff line number Diff line change 79
79
80
80
_IS_SYNC = False
81
81
82
+ # The default asyncio loop implementation on Windows
83
+ # has issues with sharing sockets across loops (https://github.com/python/cpython/issues/122240)
84
+ # We explicitly use a different loop implementation here to prevent that issue
85
+ if (
86
+ not _IS_SYNC
87
+ and sys .platform == "win32"
88
+ and asyncio .get_event_loop_policy () == asyncio .WindowsProactorEventLoopPolicy
89
+ ):
90
+ asyncio .set_event_loop_policy (asyncio .WindowsSelectorEventLoopPolicy ()) # type: ignore[attr-defined]
91
+
82
92
83
93
class AsyncClientContext :
84
94
client : AsyncMongoClient
You can’t perform that action at this time.
0 commit comments