better filtering of builtins in check_api
This commit is contained in:
parent
403342703a
commit
47210e1551
1 changed files with 16 additions and 7 deletions
|
|
@ -5,6 +5,7 @@ import os
|
|||
import os.path
|
||||
import subprocess
|
||||
import sys
|
||||
import types
|
||||
from collections import OrderedDict
|
||||
|
||||
# import koji code from our checkout
|
||||
|
|
@ -109,23 +110,28 @@ def dump_module(mod):
|
|||
_type = str(type(value))
|
||||
if '__future__' in _type:
|
||||
continue
|
||||
if type(value) in (types.BuiltinFunctionType, types.BuiltinMethodType):
|
||||
vinfo['is_external'] = True
|
||||
vinfo['is_builtin'] = True
|
||||
vinfo['type'] = str(type(value))
|
||||
info[name] = vinfo
|
||||
if inspect.ismodule(value):
|
||||
vinfo['is_module'] = True
|
||||
continue
|
||||
try:
|
||||
if inspect.getsourcefile(value) != file:
|
||||
# don't dig any deeper if it isn't defined in the module
|
||||
if inspect.isclass(value):
|
||||
if 'builtins' in value.__module__:
|
||||
vinfo['is_external'] = True
|
||||
vinfo['is_builtin'] = True
|
||||
continue
|
||||
elif inspect.getsourcefile(value) != file:
|
||||
vinfo['is_external'] = True
|
||||
continue
|
||||
except TypeError:
|
||||
# getsourcefile fails for numerous types
|
||||
pass
|
||||
if inspect.isclass(value):
|
||||
vinfo['is_class'] = True
|
||||
vinfo.update(dump_class(value))
|
||||
elif inspect.isfunction(value):
|
||||
if inspect.getsourcefile(value) != file:
|
||||
vinfo['is_external'] = True
|
||||
continue
|
||||
vinfo['is_function'] = True
|
||||
vinfo.update(dump_func(value))
|
||||
return info
|
||||
|
|
@ -255,6 +261,9 @@ def compare_mod_global(mod, name, old, new):
|
|||
|
||||
|
||||
def compare_class(cls, old, new):
|
||||
if not new.get('is_class'):
|
||||
error(f'No longer a class: {cls}')
|
||||
return
|
||||
names1 = set(old['members'])
|
||||
names2 = set(new['members'])
|
||||
added = names2 - names1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue