Skip to content

fix python >3.12#20

Open
capsaicincapsicum wants to merge 1 commit into
HeinleinSupport:masterfrom
maikkuendig:patch-1
Open

fix python >3.12#20
capsaicincapsicum wants to merge 1 commit into
HeinleinSupport:masterfrom
maikkuendig:patch-1

Conversation

@capsaicincapsicum

Copy link
Copy Markdown

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

internethering added a commit to internethering/hering-overlay that referenced this pull request Aug 25, 2025
@c-rosenberg

Copy link
Copy Markdown
Member

@copilot resolve the merge conflicts in this pull request

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread olefy.py
olefy_listen_addr = ""
else:
addr_re = re.compile('[\[" \]]')
addr_re = re.compile('[]" []')
Comment thread olefy.py
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants