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

Python 3.11 through 3.12 Updates #362

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/ModuleManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ def _load_module(self, bot: "IRCBot.Bot", definition: ModuleDefinition,
definition.filename)
module = importlib.util.module_from_spec(import_spec)
sys.modules[import_name] = module
loader = typing.cast(importlib.abc.Loader, import_spec.loader)
loader = typing.cast(importlib._abc.Loader, import_spec.loader)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This didn't work on my setup. The other changes helped it work on Python 3.11; but _abc was undefined, while abc worked.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JeDaYoshi -- what is your full release string? I have Python 3.11.3 as the output of python3 --version. Python merged the _abc update for Python a couple years ago -- you'll see the PR in the 22ed4dd commit message.

loader.exec_module(module)

module_object_pointer = getattr(module, "Module", None)
Expand Down
12 changes: 5 additions & 7 deletions src/utils/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,13 +301,11 @@ async def _request(request):
responses[request.id] = Response(response.code, response.body, encoding,
headers, {})

loop = asyncio.new_event_loop()
awaits = []
for request in requests:
awaits.append(_request(request))
task = asyncio.wait(awaits, timeout=5)
loop.run_until_complete(task)
loop.close()
async def _getResponses(requests):
tasks = [asyncio.create_task(_request(request)) for request in requests]
done,pending = await asyncio.wait(tasks)

asyncio.run(_getResponses(requests))

return responses

Expand Down