Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move to explicitly creating a new loop #3164

Merged
merged 5 commits into from Jul 14, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGES.md
Expand Up @@ -39,6 +39,9 @@

<!-- Changes to Black's terminal output and error messages -->

- Change from deprecated `asyncio.get_event_loop()` to create our event loop which
removes DesprecationWarning (#3164)
cooperlees marked this conversation as resolved.
Show resolved Hide resolved

### Packaging

<!-- Changes to how Black is packaged, such as dependency requirements -->
Expand Down
2 changes: 1 addition & 1 deletion src/black/__init__.py
Expand Up @@ -773,7 +773,6 @@ def reformat_many(
from concurrent.futures import Executor, ThreadPoolExecutor, ProcessPoolExecutor

executor: Executor
loop = asyncio.get_event_loop()
worker_count = workers if workers is not None else DEFAULT_WORKERS
if sys.platform == "win32":
# Work around https://bugs.python.org/issue26903
Expand All @@ -788,6 +787,7 @@ def reformat_many(
# any good due to the Global Interpreter Lock)
executor = ThreadPoolExecutor(max_workers=1)

loop = asyncio.new_event_loop()
ichard26 marked this conversation as resolved.
Show resolved Hide resolved
try:
loop.run_until_complete(
schedule_formatting(
Expand Down