Skip to content

Fix IMAP4WithTimeout compatibility with Python 3.14#642

Closed
jaglac wants to merge 1 commit into
mjs:masterfrom
jaglac:bugfix/py3.14-compatibility
Closed

Fix IMAP4WithTimeout compatibility with Python 3.14#642
jaglac wants to merge 1 commit into
mjs:masterfrom
jaglac:bugfix/py3.14-compatibility

Conversation

@jaglac

@jaglac jaglac commented Jun 7, 2026

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
@jaglac

jaglac commented Jun 7, 2026

Copy link
Copy Markdown
Author

Closing this, it's identical to PR #641 - my bad, thought I was on my own fork

@jaglac jaglac closed this Jun 7, 2026
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)

2 participants