mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +00:00
#20476: Deal with the message_factory circular import differently.
It turns out we can't depend on email.message getting imported every place message_factory is needed, so to avoid a circular import we need to special case Policy.message_factory=None in the parser instead of using monkey patching. I had a feeling that was a bad idea when I did it.
This commit is contained in:
parent
c7454ff5fc
commit
b067c8fdd1
5 changed files with 9 additions and 8 deletions
|
|
@ -147,7 +147,11 @@ class FeedParser:
|
|||
self.policy = policy
|
||||
self._old_style_factory = False
|
||||
if _factory is None:
|
||||
self._factory = policy.message_factory
|
||||
if policy.message_factory is None:
|
||||
from email.message import Message
|
||||
self._factory = Message
|
||||
else:
|
||||
self._factory = policy.message_factory
|
||||
else:
|
||||
self._factory = _factory
|
||||
try:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue