Merge "Accessbot fix for running on Python 3.12"

This commit is contained in:
Zuul 2025-03-27 00:04:38 +00:00 committed by Gerrit Code Review
commit e1127848aa

View File

@ -17,6 +17,7 @@
import configparser
import argparse
import functools
import irc.client
import logging
import ssl
@ -47,7 +48,12 @@ class SetAccess(irc.client.SimpleIRCClient):
self.changes = []
self.identified = False
if self.port == 6697:
factory = irc.connection.Factory(wrapper=ssl.wrap_socket)
# Taken from the example in the Factory class docstring at
# https://github.com/jaraco/irc/blob/main/irc/connection.py
context = ssl.create_default_context()
wrapper = functools.partial(
context.wrap_socket, server_hostname=self.server)
factory = irc.connection.Factory(wrapper=wrapper)
self.connect(self.server, self.port, self.nick,
connect_factory=factory)
else: