Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Expand the definition of PyObject-related variables.
  • Loading branch information
ericsnowcurrently committed Sep 12, 2019
commit 31836de78fab897e44cf32a4c831aaeebfcc56b2
60 changes: 43 additions & 17 deletions Tools/c-analyzer/c_globals/supported.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,25 +253,51 @@ def _is_vartype_okay(vartype, ignoredtypes=None):
return None


PYOBJECT_RE = re.compile(r'''
^
(
# must start with "static "
static \w+
(
identifier
)
\b
) |
(
# may start with "static "
( static \w+ )?
(
(
PyObject |
PyTypeObject |
_? Py\w+Object |
_PyArg_Parser |
_Py_Identifier |
traceback_t |
PyAsyncGenASend |
_PyAsyncGenWrappedValue |
PyContext |
method_cache_entry
)
\b
) |
(
(
_Py_IDENTIFIER |
_Py_static_string
)
[(]
)
)
''', re.VERBOSE)


def _is_object(vartype):
if re.match(r'.*\bPy\w*Object\b', vartype):
return True
if '_PyArg_Parser ' in vartype:
return True
if vartype.startswith(('_Py_IDENTIFIER(', 'static _Py_Identifier',
'_Py_static_string(')):
return True
if 'traceback_t' in vartype:
return True
if 'PyAsyncGenASend' in vartype:
return True
if '_PyAsyncGenWrappedValue' in vartype:
return True
if 'PyContext' in vartype:
return True
if 'method_cache_entry' in vartype:
if 'PyDictKeysObject' in vartype:
return False
if PYOBJECT_RE.match(vartype):
return True
if vartype.startswith('static identifier '):
if re.match(r'.*\bPy\w*Object\b', vartype):
return True
if vartype.endswith((' _Py_FalseStruct', ' _Py_TrueStruct')):
return True
Expand Down