Skip to content

sphinx.util.logging: Make write() methods return int #13595

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

srittau
Copy link

@srittau srittau commented May 26, 2025

Purpose

In typeshed, we're currently switching from our old custom protocol _typeshed.SupportsWrite to the new Writer protocol (in Python 3.14's io module and backported to typing_extensions starting with 4.14.0). One incompatibility is that Writer.write() expects an int return type, while SupportsWrite.write() was using object. This leads to a few new type errors in Sphinx (as pointed out by mypy_primer).

This PR fixes upcoming type check errors in Sphinx, but also makes the two logging writer classes more compatible by returning the number of written bytes from write().

Does this require an entry in CHANGES.rst or are the classes in util internal-facing?

References

See python/typeshed#14149 for background.

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.

1 participant