mirror of
				https://github.com/python/cpython.git
				synced 2025-11-03 03:22:27 +00:00 
			
		
		
		
	gh-89653: PEP 670: Convert PyDict_GET_SIZE() macro to function (#92695)
The limited C API version 3.12 no longer casts the argument.
This commit is contained in:
		
							parent
							
								
									b3f99b69d0
								
							
						
					
					
						commit
						f9b67ad770
					
				
					 1 changed files with 9 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -46,7 +46,15 @@ PyAPI_FUNC(int) _PyDict_Next(
 | 
			
		|||
    PyObject *mp, Py_ssize_t *pos, PyObject **key, PyObject **value, Py_hash_t *hash);
 | 
			
		||||
 | 
			
		||||
/* Get the number of items of a dictionary. */
 | 
			
		||||
#define PyDict_GET_SIZE(mp)  (assert(PyDict_Check(mp)),((PyDictObject *)mp)->ma_used)
 | 
			
		||||
static inline Py_ssize_t PyDict_GET_SIZE(PyObject *op) {
 | 
			
		||||
    assert(PyDict_Check(op));
 | 
			
		||||
    PyDictObject *mp = _Py_CAST(PyDictObject*, op);
 | 
			
		||||
    return mp->ma_used;
 | 
			
		||||
}
 | 
			
		||||
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030c0000
 | 
			
		||||
#  define PyDict_GET_SIZE(op) PyDict_GET_SIZE(_PyObject_CAST(op))
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
PyAPI_FUNC(int) _PyDict_Contains_KnownHash(PyObject *, PyObject *, Py_hash_t);
 | 
			
		||||
PyAPI_FUNC(int) _PyDict_ContainsId(PyObject *, _Py_Identifier *);
 | 
			
		||||
PyAPI_FUNC(PyObject *) _PyDict_NewPresized(Py_ssize_t minused);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue