Commit fc64c4d
authored
Add event loop setup for Python 3.14 compatibility
Set a new event loop for asyncio in Python 3.14 and above.
Otherwise invoking `ghstack` crashes with
```
ERROR: Fatal exception
Traceback (most recent call last):
File "/Users/nshulga/py3.14-local/lib/python3.14/site-packages/ghstack/logs.py", line 105, in manager
yield
File "/Users/nshulga/py3.14-local/lib/python3.14/site-packages/ghstack/cli.py", line 47, in cli_context
yield shell, config, github
File "/Users/nshulga/py3.14-local/lib/python3.14/site-packages/ghstack/cli.py", line 281, in submit
ghstack.submit.main(
~~~~~~~~~~~~~~~~~~~^
msg=message,
^^^^^^^^^^^^
...<13 lines>...
direct_opt=direct_opt,
^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/Users/nshulga/py3.14-local/lib/python3.14/site-packages/ghstack/submit.py", line 259, in main
submitter = Submitter(**kwargs)
File "<string>", line 24, in __init__
File "/Users/nshulga/py3.14-local/lib/python3.14/site-packages/ghstack/submit.py", line 379, in __post_init__
repo = ghstack.github_utils.get_github_repo_info(
github=self.github,
...<4 lines>...
remote_name=self.remote_name,
)
File "/Users/nshulga/py3.14-local/lib/python3.14/site-packages/ghstack/github_utils.py", line 71, in get_github_repo_info
name_with_owner = get_github_repo_name_with_owner(
sh=sh,
github_url=github_url,
remote_name=remote_name,
)
File "/Users/nshulga/py3.14-local/lib/python3.14/site-packages/ghstack/github_utils.py", line 28, in get_github_repo_name_with_owner
remote_url = sh.git("remote", "get-url", remote_name)
File "/Users/nshulga/py3.14-local/lib/python3.14/site-packages/ghstack/shell.py", line 281, in git
return self._maybe_rstrip(self.sh(*(("git",) + args), **kwargs))
~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/nshulga/py3.14-local/lib/python3.14/site-packages/ghstack/shell.py", line 200, in sh
loop = asyncio.get_event_loop()
File "/opt/homebrew/Cellar/python@3.14/3.14.0_1/Frameworks/Python.framework/Versions/3.14/lib/python3.14/asyncio/events.py", line 715, in get_event_loop
raise RuntimeError('There is no current event loop in thread %r.'
% threading.current_thread().name)
RuntimeError: There is no current event loop in thread 'MainThread'.
```1 parent 0fe2792 commit fc64c4d
1 file changed
+5
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
10 | 15 | | |
0 commit comments