Commit e2c89418 authored by Fabian Müller's avatar Fabian Müller
Browse files

Merge branch 'mullerfa/python3.13-compat' into 'main'

Make scripts compatible with Python 3.13

See merge request !1960
parents 9e6e9e18 fcb9eebf
Loading
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -134,15 +134,25 @@ class IvasLogger(logging.Logger):


def getIvasLogger(name=None):
    try:
        # Python 3.13+
        acquireLock, releaseLock = logging._prepareFork, logging._afterFork
    except AttributeError:
        # Python <= 3.12
        acquireLock, releaseLock = logging._acquireLock, logging._releaseLock

    logging_class = logging.getLoggerClass()
    logging._acquireLock()

    acquireLock()

    try:
        logging.setLoggerClass(IvasLogger)
        logger = logging.getLogger(name)
        logging.setLoggerClass(logging_class)
        return logger

    finally:
        logging._releaseLock()
        releaseLock()


class IvasBaseClass(object):