Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(93114)

Unified Diff: Lib/email/feedparser.py

Issue 27522: Reference cycle in email.feedparser
Patch Set: Created 2 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
--- a/Lib/email/feedparser.py Fri Jul 15 10:58:54 2016 -0700
+++ b/Lib/email/feedparser.py Fri Jul 15 19:49:25 2016 +0100
@@ -145,7 +145,7 @@
"""
self.policy = policy
- self._factory_kwds = lambda: {'policy': self.policy}
+ self._old_style_factory = False
if _factory is None:
# What this should be:
#self._factory = policy.default_message_factory
@@ -160,7 +160,7 @@
_factory(policy=self.policy)
except TypeError:
# Assume this is an old-style factory
- self._factory_kwds = lambda: {}
+ self._old_style_factory = True
self._input = BufferedSubFile()
self._msgstack = []
self._parse = self._parsegen().__next__
@@ -197,7 +197,10 @@
return root
def _new_message(self):
- msg = self._factory(**self._factory_kwds())
+ if self._old_style_factory:
+ msg = self._factory()
+ else:
+ msg = self._factory(policy=self.policy)
if self._cur and self._cur.get_content_type() == 'multipart/digest':
msg.set_default_type('message/rfc822')
if self._msgstack:
« no previous file with comments | « no previous file | no next file » | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+