Repository navigation
Fix clip() with no arguments in Python and Scheme - #3108
Merged
Merged
Conversation
clip() with no arguments should reset the clipping region to the whole screen, as it does in Lua and the other languages. In Python the binding required all four arguments, and in Scheme the API table marked all four as required, so the reset path in scheme_clip was never reached. Fixes nesbox#3042
nesbox
approved these changes
Oct 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3042.
The wiki says clip() with no arguments resets the clip region to the whole screen. That works in Lua, but Python and Scheme throw an error instead.
For Python I made the four arguments default to None. When none are given it calls clip(0, 0, 240, 136), the same thing Lua does. clip(1, 2) is still an error, like in Lua.
Scheme was a different problem. scheme_clip handles the empty call fine, but api.h marks all four clip args as required and s7 rejects the call before it gets that far. I changed the required count to 0. mruby uses that field too, but mrb_clip parses its args as optional anyway, and ruby's results didn't change.
I tested with the conformance runner, built the way the CI tests job builds it. On main the clip row is red for python and scheme (clip/set and clip/reset). With this change clip is green for every language, and python and scheme each go from 19 to 17 divergences. Nothing else in the table moved. ctest passes and clang-format 20.1.6 has no complaints.