• Stefy Lanza (nextime / spora )'s avatar
    build the floor-aware handler through its factory, not a global name · 87463dab
    Stefy Lanza (nextime / spora ) authored
    0.5.32 shipped the image-token floor and broke the projector load it was meant
    to fix:
    
        mmproj : failed to load projector (name 'ImageTokenFloorHandler' is not
                 defined); continuing text-only
    
    handler() referred to the class as a global while the class was produced by a
    module-level __getattr__, and PEP 562 consults that only for attribute access
    from OUTSIDE the module -- never for a global name lookup inside it. So the
    lookup raised NameError, the except around the mmproj block caught it, and the
    model came up text-only: it then refused images instead of answering them
    wrongly. Better, and still broken.
    
    The factory existed for exactly this; handler() now calls it (cached in
    _HANDLER_CLASS) instead of naming the class.
    
    And the test that let this through was testing the wrong call: it built the
    class with _make_handler_class() directly, so it passed against a shipped path
    that raised. It goes through handler() now, with a second test asserting the
    class is reachable the way the backend reaches it. A probe that does not call
    what the code calls proves nothing -- the same lesson as the vision-mapping fix
    in 0.5.27, learned again in the module next door.
    Co-Authored-By: 's avatarClaude Opus 5 <noreply@anthropic.com>
    Claude-Session: https://claude.ai/code/session_014T3rZozi1Ehk96NG1WesgC
    87463dab
test_gguf_vision_image_tokens.py 9.37 KB