mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	When reading a continuation line, make sure we still use the transformed
name when filling in the internal data structures, otherwise we incorrectly raise a KeyError. This fixes SF bug #432369.
This commit is contained in:
		
							parent
							
								
									45c23e61d8
								
							
						
					
					
						commit
						beb6713ea7
					
				
					 2 changed files with 9 additions and 1 deletions
				
			
		|  | @ -431,7 +431,8 @@ def __read(self, fp, fpname): | ||||||
|             if line[0] in ' \t' and cursect is not None and optname: |             if line[0] in ' \t' and cursect is not None and optname: | ||||||
|                 value = line.strip() |                 value = line.strip() | ||||||
|                 if value: |                 if value: | ||||||
|                     cursect[optname] = cursect[optname] + '\n ' + value |                     k = self.optionxform(optname) | ||||||
|  |                     cursect[k] = "%s\n%s" % (cursect[k], value) | ||||||
|             # a section header or option header? |             # a section header or option header? | ||||||
|             else: |             else: | ||||||
|                 # is it a section header? |                 # is it a section header? | ||||||
|  |  | ||||||
|  | @ -70,6 +70,13 @@ def case_sensitivity(): | ||||||
|     cf.remove_option("a", "B") |     cf.remove_option("a", "B") | ||||||
|     verify(cf.options("a") == []) |     verify(cf.options("a") == []) | ||||||
| 
 | 
 | ||||||
|  |     # SF bug #432369: | ||||||
|  |     cf = ConfigParser.ConfigParser() | ||||||
|  |     sio = StringIO.StringIO("[MySection]\nOption: first line\n\tsecond line\n") | ||||||
|  |     cf.readfp(sio) | ||||||
|  |     verify(cf.options("MySection") == ["option"]) | ||||||
|  |     verify(cf.get("MySection", "Option") == "first line\nsecond line") | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| def interpolation(src): | def interpolation(src): | ||||||
|     print "Testing value interpolation..." |     print "Testing value interpolation..." | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Fred Drake
						Fred Drake