[Bugfix] Caption constructor positional signature disagrees with its frozen docstring #320
Labels
No labels
Alpha Release Requirement
Bugfix
Demo Target
Documentation
Major Feature
Minor Feature
priority:tier1-active
priority:tier2-foundation
priority:tier3-future
priority:tier4-deferred
Refactoring & Cleanup
system:animation
system:documentation
system:grid
system:input
system:performance
system:procgen
system:python-binding
system:rendering
system:ui-hierarchy
Tiny Feature
workflow:blocked
workflow:needs-benchmark
workflow:needs-documentation
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
john/McRogueFace#320
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
mcrfpy.Caption's constructor accepts a different positional layout than its frozen (#314-locked) docstring advertises, and is the lone sibling constructor that rejects a 3rd positional argument.Evidence
Frozen docstring (the public contract):
This declares
pos,font,textas positional-or-keyword (font is the 2nd positional, text the 3rd) — matching the sibling constructors:Sprite(pos=None, texture=None, sprite_index=0, **kwargs)— acceptsSprite((100,150), None, 5)Entity(grid_pos=None, texture=None, sprite_index=0, **kwargs)— acceptsEntity((5,10), None, 3)Actual implementation (
src/UICaption.cppUICaption::init, format"|Oz$...", kwlist{"pos","text",...}):(pos, text), withfontkeyword-only.Caption((50,100), None, "Hello")->TypeError: function takes at most 2 positional arguments (3 given)Caption((50,100), "hi")currently binds "hi" to text, contradicting the documented(pos, font, text)order.So Caption is the only one of the three that (a) caps at 2 positional args and (b) has a different positional order than documented.
Impact
tests/unit/test_constructor_comprehensive.pyfails at the Caption case (the only blocker; Entity/edge-cases already pass).Fix
Make the implementation match the frozen docstring and the Sprite/Entity convention: positional order
(pos, font, text), with the rest keyword-only.Behavior note (acceptable):
Caption((x,y), "string")changes meaning fromtext="string"tofont="string"(-> TypeError, since font must be a Font). Audited: zero live callers use the current(pos, text)2-positional form; the legacy(text, x, y)callers insrc/scripts/text_input_widget*.pyalready fail under the current impl and are out of scope.Regression test + fix to follow.
Labels to apply (MCP label bug -> apply via web):
Bugfix,system:python-binding,priority:tier1-active.