Skip to content

Fix IMAP4WithTimeout compatibility with Python 3.14#641

Open
736-c41-2c1-e464fc974 wants to merge 1 commit intomjs:masterfrom
736-c41-2c1-e464fc974:bugfix/3.14-compatibility-IMAP4.file-read-only
Open

Fix IMAP4WithTimeout compatibility with Python 3.14#641
736-c41-2c1-e464fc974 wants to merge 1 commit intomjs:masterfrom
736-c41-2c1-e464fc974:bugfix/3.14-compatibility-IMAP4.file-read-only

Conversation

@736-c41-2c1-e464fc974
Copy link
Copy Markdown

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 #638

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
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.

AttributeError: property 'file' of 'IMAP4WithTimeout' object has no setter (Python 3.14)

1 participant