File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -280,12 +280,26 @@ def _is_kwlist(decl):
280280 vartype = '' .join (str (decl .vartype ).split ())
281281 return vartype == 'char*[]'
282282
283+ def _is_local_static_mutex (decl ):
284+ if not hasattr (decl , "vartype" ):
285+ return False
286+
287+ if not hasattr (decl , "parent" ) or decl .parent is None :
288+ # We only want to allow local variables
289+ return False
290+
291+ vartype = decl .vartype
292+ return (vartype .typespec == 'PyMutex' ) and (decl .storage == 'static' )
283293
284294def _has_other_supported_type (decl ):
285295 if hasattr (decl , 'file' ) and decl .file .filename .endswith ('.c.h' ):
286296 assert 'clinic' in decl .file .filename , (decl ,)
287297 if decl .name == '_kwtuple' :
288298 return True
299+ if _is_local_static_mutex (decl ):
300+ # GH-127081: Local static mutexes are used to
301+ # wrap libc functions that aren't thread safe
302+ return True
289303 vartype = str (decl .vartype ).split ()
290304 if vartype [0 ] == 'struct' :
291305 vartype = vartype [1 :]
Original file line number Diff line number Diff line change @@ -739,7 +739,6 @@ Modules/expat/xmlrole.c - declClose -
739739Modules/expat/xmlrole.c - error -
740740
741741# # other
742- Modules/grpmodule.c grp_getgrall_impl getgrall_mutex -
743742Modules/_io/_iomodule.c - _PyIO_Module -
744743Modules/_sqlite/module.c - _sqlite3module -
745744Modules/clinic/md5module.c.h _md5_md5 _keywords -
You can’t perform that action at this time.
0 commit comments