mirror of
				https://github.com/msgpack/msgpack-python.git
				synced 2025-10-31 17:40:54 +00:00 
			
		
		
		
	pack and packb raises ValueError when extra data passed.
This commit is contained in:
		
							parent
							
								
									4d643894a1
								
							
						
					
					
						commit
						8b2959bc0a
					
				
					 1 changed files with 5 additions and 2 deletions
				
			
		|  | @ -257,7 +257,10 @@ def unpackb(object packed, object object_hook=None, object list_hook=None, | |||
|         ctx.user.list_hook = <PyObject*>list_hook | ||||
|     ret = template_execute(&ctx, buf, buf_len, &off) | ||||
|     if ret == 1: | ||||
|         return template_data(&ctx) | ||||
|         obj = template_data(&ctx) | ||||
|         if off < buf_len: | ||||
|             raise ValueError("Extra data.") | ||||
|         return obj | ||||
|     else: | ||||
|         return None | ||||
| 
 | ||||
|  | @ -461,7 +464,7 @@ cdef class Unpacker(object): | |||
|                 if self.file_like is not None: | ||||
|                     self.read_from_file() | ||||
|                     continue | ||||
|                 raise StopIteration("No more unpack data.") | ||||
|                 raise StopIteration("No more data to unpack.") | ||||
|             else: | ||||
|                 raise ValueError("Unpack failed: error = %d" % (ret,)) | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 INADA Naoki
						INADA Naoki