This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: email.feedparser regex duplicate
Type: Stage: needs patch
Components: Library (Lib) Versions: Python 3.10, Python 3.9, Python 3.8
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: ezio.melotti, jimjjewett
Priority: low Keywords: patch

Created on 2008-04-24 13:52 by jimjjewett, last changed 2022-04-11 14:56 by admin.

Files
File name Uploaded Description Edit
2679.patch moijes12, 2012-09-06 05:33 Change in patch : NLCRE_crack = NLCRE_bol review
Messages (2)
msg65723 - (view) Author: Jim Jewett (jimjjewett) Date: 2008-04-24 13:52
feedparser defines four regexs for end-of-line, but two are redundant.

NLCRE checks for the three common line endings.
NLCRE_crack also captures the line ending.
NLCRE_eol also adds a $ to ensure it is at the end.
NLCRE_bol ... is identical to NLCRE_crack.

It should either use a ^ to insist on line-start, or be explicitly the 
same.  (e.g., NLCRE_bol=NLCRE_crack.)  (It gets away with not listing the ^ 
because the current code only uses NLCRE_bol.match.

(Actually, if the regexes are considered private, then the current code 
could just use the bound methods directly ... setting NLCRE_bol to the
 .match method, NLCRE_eol to the .search method, and NLCRE_crack to the
 .split method.)
msg169904 - (view) Author: moijes12 (moijes12) Date: 2012-09-06 05:36
Hi 

I've attached a patch. Its a simple one wherein NLCRE_crack = NLCRE_bol. I found this in Python 3.3.0b2+ and so I've added version 3.3. I executed "./python -m test" after making the change and no failures were reported (340-OK, 30-Skip). Looking forward to your comments.
History
Date User Action Args
2022-04-11 14:56:33adminsetgithub: 46931
2020-10-25 23:24:50iritkatrielsettype: behavior ->
versions: + Python 3.8, Python 3.9, Python 3.10, - Python 2.6, Python 3.1, Python 2.7, Python 3.2, Python 3.3
2014-01-05 05:31:07moijes12setnosy: - moijes12
2012-09-06 05:36:58moijes12setmessages: + msg169904
2012-09-06 05:33:35moijes12setfiles: + 2679.patch
keywords: + patch
2012-09-06 05:22:16moijes12setversions: + Python 3.3
2012-09-06 05:12:32moijes12setnosy: + moijes12
2010-01-12 16:49:02ezio.melottisetnosy: + ezio.melotti
type: behavior
2010-01-12 02:54:00brian.curtinsetpriority: low
stage: needs patch
versions: + Python 3.1, Python 2.7, Python 3.2, - Python 3.0
2008-04-24 13:52:19jimjjewettcreate