Skip to content

Conversation

@nocarryr
Copy link
Owner

Changes made in python/cpython#125325

Fixes #24

@coveralls
Copy link

coveralls commented Dec 17, 2025

Coverage Status

coverage: 97.88% (+0.04%) from 97.844%
when pulling 48ee874 on py314-compat
into d053139 on master.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request adds Python 3.14 compatibility to the pydispatch library by addressing changes made to WeakValueDictionary in Python 3.14 (python/cpython#125325). The PR fixes issue #24 by manually reintroducing _pending_removals and _iterating attributes that were removed from the parent class, and updates asyncio examples to use modern patterns.

Key Changes

  • Reorganized imports to move _remove_dead_weakref from weakref to _weakref module
  • Added manual initialization of _pending_removals and _iterating attributes in WeakValueDictionary subclasses for Python 3.14+ compatibility
  • Implemented conditional import and no-op fallback for _IterationGuard which was removed in Python 3.14
  • Updated documentation examples to use modern asyncio patterns (asyncio.run(), get_running_loop(), create_task())
  • Added Python 3.14 to CI/CD test matrix with conditional exclusion for sphinx-plugin

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
pydispatch/utils.py Reorganized imports and added manual initialization of _pending_removals and _iterating in InformativeWVDict for Python 3.14 compatibility
pydispatch/aioutils.py Reorganized imports, added conditional _IterationGuard implementation, and manually initialized _pending_removals and _iterating in AioWeakMethodContainer
pydispatch/dispatch.py Updated asyncio docstring example to use modern asyncio.run() and get_running_loop() patterns
doc/source/async.rst Updated multiple asyncio examples to use modern patterns replacing deprecated get_event_loop()
.github/workflows/dist-test.yml Added Python 3.14 to test matrix and conditionally excluded sphinx-plugin tests for 3.14
.github/workflows/ci.yml Added Python 3.14 to test matrix and conditionally excluded sphinx-plugin tests for 3.14

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@nocarryr nocarryr merged commit 1174aef into master Dec 18, 2025
39 checks passed
@nocarryr nocarryr deleted the py314-compat branch December 18, 2025 00:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

python-dispatch v0.2.2 is incompatible with Python 3.14

3 participants