mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	bpo-31677: email: Remove re.IGNORECASE flag (GH-3868)
While there is not real bug in this case, using re.IGNORECASE without re.ASCII leads unexpected behavior. Instead of adding re.ASCII, this commit removes re.IGNORECASE flag because it's easier and simpler. This commit removes dead copy of the pattern in email.util module too. While the pattern is same, it is compiled separately because it had different flags.
This commit is contained in:
		
							parent
							
								
									e2d0dd2cf9
								
							
						
					
					
						commit
						bf477a99e0
					
				
					 2 changed files with 2 additions and 14 deletions
				
			
		|  | @ -36,11 +36,11 @@ | ||||||
|   =\?                   # literal =? |   =\?                   # literal =? | ||||||
|   (?P<charset>[^?]*?)   # non-greedy up to the next ? is the charset |   (?P<charset>[^?]*?)   # non-greedy up to the next ? is the charset | ||||||
|   \?                    # literal ? |   \?                    # literal ? | ||||||
|   (?P<encoding>[qb])    # either a "q" or a "b", case insensitive |   (?P<encoding>[qQbB])  # either a "q" or a "b", case insensitive | ||||||
|   \?                    # literal ? |   \?                    # literal ? | ||||||
|   (?P<encoded>.*?)      # non-greedy up to the next ?= is the encoded string |   (?P<encoded>.*?)      # non-greedy up to the next ?= is the encoded string | ||||||
|   \?=                   # literal ?= |   \?=                   # literal ?= | ||||||
|   ''', re.VERBOSE | re.IGNORECASE | re.MULTILINE) |   ''', re.VERBOSE | re.MULTILINE) | ||||||
| 
 | 
 | ||||||
| # Field name regexp, including trailing colon, but not separating whitespace, | # Field name regexp, including trailing colon, but not separating whitespace, | ||||||
| # according to RFC 2822.  Character range is from tilde to exclamation mark. | # according to RFC 2822.  Character range is from tilde to exclamation mark. | ||||||
|  |  | ||||||
|  | @ -114,18 +114,6 @@ def getaddresses(fieldvalues): | ||||||
|     return a.addresslist |     return a.addresslist | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| ecre = re.compile(r''' |  | ||||||
|   =\?                   # literal =? |  | ||||||
|   (?P<charset>[^?]*?)   # non-greedy up to the next ? is the charset |  | ||||||
|   \?                    # literal ? |  | ||||||
|   (?P<encoding>[qb])    # either a "q" or a "b", case insensitive |  | ||||||
|   \?                    # literal ? |  | ||||||
|   (?P<atom>.*?)         # non-greedy up to the next ?= is the atom |  | ||||||
|   \?=                   # literal ?= |  | ||||||
|   ''', re.VERBOSE | re.IGNORECASE) |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| def _format_timetuple_and_zone(timetuple, zone): | def _format_timetuple_and_zone(timetuple, zone): | ||||||
|     return '%s, %02d %s %04d %02d:%02d:%02d %s' % ( |     return '%s, %02d %s %04d %02d:%02d:%02d %s' % ( | ||||||
|         ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'][timetuple[6]], |         ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'][timetuple[6]], | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 INADA Naoki
						INADA Naoki