Fix IMAP4WithTimeout compatibility with Python 3.14#641
Open
736-c41-2c1-e464fc974 wants to merge 1 commit intomjs:masterfrom
Open
Fix IMAP4WithTimeout compatibility with Python 3.14#641736-c41-2c1-e464fc974 wants to merge 1 commit intomjs:masterfrom
736-c41-2c1-e464fc974 wants to merge 1 commit intomjs:masterfrom
Conversation
Python 3.14 changed imaplib.IMAP4.file from a plain instance attribute
to a read-only property (see cpython commit introducing the change). The
open() override in IMAP4WithTimeout assigned to self.file directly, which
now raises:
AttributeError: property 'file' of 'IMAP4WithTimeout' object has no setter
The fix mirrors what was already done for IMAP4_TLS in commit 64250b0:
remove the open() override entirely and instead pass the timeout through
to the parent __init__, which calls open() itself using self._file
internally. The _create_socket override is kept as-is so the stored
self._timeout fallback still applies for any call path that omits an
explicit timeout.
Fixes mjs#638
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Python 3.14 changed imaplib.IMAP4.file from a plain instance attribute to a read-only property (see cpython commit introducing the change). The open() override in IMAP4WithTimeout assigned to self.file directly, which now raises:
The fix mirrors what was already done for IMAP4_TLS in commit 64250b0: remove the open() override entirely and instead pass the timeout through to the parent init, which calls open() itself using self._file internally. The _create_socket override is kept as-is so the stored self._timeout fallback still applies for any call path that omits an explicit timeout.
Fixes #638