mirror of
				https://github.com/python/cpython.git
				synced 2025-11-04 07:31:38 +00:00 
			
		
		
		
	PyUnicode_GET_SIZE() checks that PyUnicode_AsUnicode() succeed
using an assertion
This commit is contained in:
		
							parent
							
								
									dcbbd9ea21
								
							
						
					
					
						commit
						f3ae6208c7
					
				
					 1 changed files with 7 additions and 6 deletions
				
			
		| 
						 | 
					@ -385,12 +385,13 @@ PyAPI_DATA(PyTypeObject) PyUnicodeIter_Type;
 | 
				
			||||||
   If the Py_UNICODE representation is not available, it will be computed
 | 
					   If the Py_UNICODE representation is not available, it will be computed
 | 
				
			||||||
   on request.  Use PyUnicode_GET_LENGTH() for the length in code points. */
 | 
					   on request.  Use PyUnicode_GET_LENGTH() for the length in code points. */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define PyUnicode_GET_SIZE(op) \
 | 
					#define PyUnicode_GET_SIZE(op)                       \
 | 
				
			||||||
    (assert(PyUnicode_Check(op)), \
 | 
					    (assert(PyUnicode_Check(op)),                    \
 | 
				
			||||||
     (((PyASCIIObject *)(op))->wstr) ? \
 | 
					     (((PyASCIIObject *)(op))->wstr) ?               \
 | 
				
			||||||
        PyUnicode_WSTR_LENGTH(op) :                   \
 | 
					      PyUnicode_WSTR_LENGTH(op) :                    \
 | 
				
			||||||
        ((void)PyUnicode_AsUnicode((PyObject *)(op)), \
 | 
					      ((void)PyUnicode_AsUnicode((PyObject *)(op)),  \
 | 
				
			||||||
         PyUnicode_WSTR_LENGTH(op)))
 | 
					       assert(((PyASCIIObject *)(op))->wstr),        \
 | 
				
			||||||
 | 
					       PyUnicode_WSTR_LENGTH(op)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define PyUnicode_GET_DATA_SIZE(op) \
 | 
					#define PyUnicode_GET_DATA_SIZE(op) \
 | 
				
			||||||
    (PyUnicode_GET_SIZE(op) * Py_UNICODE_SIZE)
 | 
					    (PyUnicode_GET_SIZE(op) * Py_UNICODE_SIZE)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue