fix python >3.12#20
Open
capsaicincapsicum wants to merge 1 commit into
Open
Conversation
internethering
added a commit
to internethering/hering-overlay
that referenced
this pull request
Aug 25, 2025
Member
|
@copilot resolve the merge conflicts in this pull request |
There was a problem hiding this comment.
Pull request overview
This PR attempts to make olefy.py compatible with Python >3.12 by (a) adjusting a regex used to sanitize bind-address input and (b) updating asyncio event-loop initialization to avoid deprecation warnings.
Changes:
- Updated the bind-address sanitization regex used when parsing
OLEFY_BINDADDRESS. - Added Python-version-specific asyncio loop selection logic intended to replace
asyncio.get_event_loop()for newer Python versions.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| olefy_listen_addr = "" | ||
| else: | ||
| addr_re = re.compile('[\[" \]]') | ||
| addr_re = re.compile('[]" []') |
Comment on lines
+204
to
214
| if sys.version_info < (3, 10): | ||
| loop = asyncio.get_event_loop() | ||
| else: | ||
| try: | ||
| loop = asyncio.get_running_loop() | ||
| except RuntimeError: | ||
| loop = asyncio.new_event_loop() | ||
| asyncio.set_event_loop(loop) | ||
| # each client connection will create a new protocol instance | ||
| coro = loop.create_server(AIO, olefy_listen_addr, olefy_listen_port) | ||
| server = loop.run_until_complete(coro) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
https://docs.python.org/3/library/re.html#re.compile
-----8<-----
To match a literal ']' inside a set, precede it with a backslash, or place it at the beginning of the set. For example, both [()[]{}] and [{}] will match a right bracket, as well as left bracket, braces, and parentheses.
----->8-----
https://stackoverflow.com/questions/73884117/how-to-replace-asyncio-get-event-loop-to-avoid-the-deprecationwarning