spack_json: _strify should be a no-op in Python 3
_strify traverses *all* of the read-in data and converts strings, but only for Python 2. Ignore it in Python 3.
This commit is contained in:
		 Todd Gamblin
					Todd Gamblin
				
			
				
					committed by
					
						 Massimiliano Culpo
						Massimiliano Culpo
					
				
			
			
				
	
			
			
			 Massimiliano Culpo
						Massimiliano Culpo
					
				
			
						parent
						
							52508e6ee7
						
					
				
				
					commit
					e3e913ef8f
				
			| @@ -38,8 +38,12 @@ def dump(data, stream=None): | |||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| def _strify(data, ignore_dicts=False): | def _strify(data, ignore_dicts=False): | ||||||
|  |     """Converts python 2 unicodes to str in JSON data.""" | ||||||
|  |     # this is a no-op in python 3 | ||||||
|  |     if sys.version_info[0] >= 3: | ||||||
|  |         return data | ||||||
|  | 
 | ||||||
|     # if this is a unicode string in python 2, return its string representation |     # if this is a unicode string in python 2, return its string representation | ||||||
|     if sys.version_info[0] < 3: |  | ||||||
|     if isinstance(data, string_types): |     if isinstance(data, string_types): | ||||||
|         return data.encode('utf-8') |         return data.encode('utf-8') | ||||||
| 
 | 
 | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user