Skip to content

[heads up] Python 3.15: test_introspect_builtin_modules fails as there's Missing introspection for the following callables: builtins: frozendict #623

Description

@befeleme

Hello,
when trying to build toolz/cytoolz with Python 3.15, I experience one test failure, as follows: Missing introspection for the following callables: builtins: frozendict.
Based on the older PR I found here (#513) and checking toolz/_signatures.py, I assume the solution would require adding a similar entry to dict in the builtins dictionary:

+    frozendict=[
+        lambda **kwargs: None,
+        lambda mapping, **kwargs: None],

This builds in my testing environment just fine. If that's the correct solution, I can send a patch (not sure here, I derived it from existing code without much understanding of the internals).

_______________________ test_introspect_builtin_modules ________________________

    def test_introspect_builtin_modules():
        mods = [builtins, functools, itertools, operator, toolz,
                toolz.functoolz, toolz.itertoolz, toolz.dicttoolz, toolz.recipes]
    
        denylist = set()
    
        def add_denylist(mod, attr):
            if hasattr(mod, attr):
                denylist.add(getattr(mod, attr))
    
        add_denylist(builtins, 'basestring')
        add_denylist(builtins, 'NoneType')
        add_denylist(builtins, '__metaclass__')
        add_denylist(builtins, 'sequenceiterator')
    
        def is_missing(modname, name, func):
            if name.startswith('_') and not name.startswith('__'):
                return False
            if name.startswith('__pyx_unpickle_') or name.endswith('_cython__'):
                return False
            try:
                if issubclass(func, BaseException):
                    return False
            except TypeError:
                pass
            try:
                return (callable(func)
                        and func.__module__ is not None
                        and modname in func.__module__
                        and is_partial_args(func, (), {}) is not True
                        and func not in denylist)
            except AttributeError:
                return False
    
        missing = {}
        for mod in mods:
            modname = mod.__name__
            for name, func in vars(mod).items():
                if is_missing(modname, name, func):
                    if modname not in missing:
                        missing[modname] = []
                    missing[modname].append(name)
        if missing:
            messages = []
            for modname, names in sorted(missing.items()):
                msg = '{}:\n    {}'.format(modname, '\n    '.join(sorted(names)))
                messages.append(msg)
            message = 'Missing introspection for the following callables:\n\n'
>           raise AssertionError(message + '\n\n'.join(messages))
E           AssertionError: Missing introspection for the following callables:
E           
E           builtins:
E               frozendict

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions