Skip to content

Commit

Permalink
Close scandir iterator (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
cbornet authored Feb 20, 2025
1 parent ddeedea commit 5642a66
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
14 changes: 7 additions & 7 deletions blockbuster/blockbuster.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import os
import platform
import sys
import tempfile
from contextlib import contextmanager
from contextvars import ContextVar
from pathlib import Path
Expand Down Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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"]
Expand Down
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5642a66

Please sign in to comment.