In Python 3.2, the mailbox module was fixed to properly handle Unicode: it should now get bytes, rather than text. Support for accepting text was kept but marked as deprecated.
Main change: commit b7deff1 by @bitdancer in 2011: issue #53370.
In Python 3.12, 10 releases later, IMO it's now time to remove this legacy code.
I wrote PR #94351 to remove this code path.