From 61cd4a73b9d1c9f290c3760f357b4d7ab58ae4c3 Mon Sep 17 00:00:00 2001 From: Alexey Pelykh Date: Thu, 5 Oct 2023 08:07:12 +0200 Subject: [PATCH] Fix dangling log_output in Service The isinstance check was faulty and checked wrong type Fixes #12870 --- py/selenium/webdriver/common/service.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/py/selenium/webdriver/common/service.py b/py/selenium/webdriver/common/service.py index 395a098155c53..6a2eeea87e316 100644 --- a/py/selenium/webdriver/common/service.py +++ b/py/selenium/webdriver/common/service.py @@ -21,10 +21,10 @@ import typing from abc import ABC from abc import abstractmethod +from io import IOBase from platform import system from subprocess import PIPE from time import sleep -from typing import TextIO from urllib import request from urllib.error import URLError @@ -136,7 +136,7 @@ def stop(self) -> None: """Stops the service.""" if self.log_output != PIPE: - if isinstance(self.log_output, TextIO): + if isinstance(self.log_output, IOBase): self.log_output.close() elif isinstance(self.log_output, int): os.close(self.log_output)