def compare_single_extraction_wrapper()

in src/math_verify/grader.py [0:0]


    def compare_single_extraction_wrapper(g, t):
        try:
            return compare_single_extraction(g, t)

        except ValueError as e:
            if str(e) == "signal only works in main thread of the main interpreter":
                raise ValueError(
                    "Math-Verify doesn't support threaded environment due to usage of signal.alarm() in timeout mechanism. If you need to run in multithreaded environment it's recommended to set the parsing_timeout=None, which will run without timeout (and signal handling). In this case you need to handle the timeouting yourself."
                ) from e
            else:
                logger.exception("Error during comparison")
                return False
        except Exception:
            #! Do not attempt to print out the g and t during handling of exception
            # Because a) it can throw an exception itself and b) it can cause it to be stuck forever during str conversion
            logger.exception("Error during comparison")
            return False
        except TimeoutException:
            logger.error("Timeout during comparison")
            return False