Skip to content

email.policy.compat32 does not work as policy for email.message.MIMEPart #133315

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
dkg opened this issue May 2, 2025 · 0 comments
Open

email.policy.compat32 does not work as policy for email.message.MIMEPart #133315

dkg opened this issue May 2, 2025 · 0 comments
Labels
type-bug An unexpected behavior, bug, or error

Comments

@dkg
Copy link

dkg commented May 2, 2025

Bug report

Bug description:

#!/usr/bin/python3

from email.message import MIMEPart
from email.policy import compat32

m = MIMEPart(policy=compat32)
m.set_content(b'\x00'*100, 'image', 'phg')

This raises the following exception:

Traceback (most recent call last):
  File "[…]/test.py", line 7, in <module>
    m.set_content(b'\x00'*100, 'image', 'phg')
    ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/email/message.py", line 1136, in set_content
    content_manager = self.policy.content_manager
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'Compat32' object has no attribute 'content_manager'

This is with python3 3.13.3-1 on debian.

CPython versions tested on:

3.13

Operating systems tested on:

Linux

@dkg dkg added the type-bug An unexpected behavior, bug, or error label May 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

1 participant