diff --git a/blockbuster/blockbuster.py b/blockbuster/blockbuster.py index 957c122..669909c 100644 --- a/blockbuster/blockbuster.py +++ b/blockbuster/blockbuster.py @@ -11,7 +11,6 @@ import os import platform import sys -import tempfile from contextlib import contextmanager from contextvars import ContextVar from pathlib import Path @@ -344,12 +343,13 @@ def _get_os_wrapped_functions( ) if platform.python_implementation() != "CPython" or sys.version_info >= (3, 9): - functions["os.scandir"] = BlockBusterFunction( - type(os.scandir(tempfile.tempdir)), - "__next__", - scanned_modules=modules, - excluded_modules=excluded_modules, - ) + with os.scandir() as scandir_it: + functions["os.scandir"] = BlockBusterFunction( + type(scandir_it), + "__next__", + scanned_modules=modules, + excluded_modules=excluded_modules, + ) for method in ( "ismount", diff --git a/pyproject.toml b/pyproject.toml index ac0fd29..44ee610 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "blockbuster" -version = "1.5.20" +version = "1.5.21" description = "Utility to detect blocking calls in the async event loop" readme = "README.md" keywords = ["async", "block", "detect", "event loop", "asyncio"] diff --git a/uv.lock b/uv.lock index 17bfbea..d9d6eeb 100644 --- a/uv.lock +++ b/uv.lock @@ -16,7 +16,7 @@ wheels = [ [[package]] name = "blockbuster" -version = "1.5.20" +version = "1.5.21" source = { editable = "." } dependencies = [ { name = "forbiddenfruit" },