Skip to content

Fix MidiIn.close_port docstring (comparison instead of assignment) - #231

Open
iDoMeteor wants to merge 1 commit into
SpotlightKid:masterfrom
iDoMeteor:fix-close-port-doc
Open

iDoMeteor wants to merge 1 commit into
SpotlightKid:masterfrom
iDoMeteor:fix-close-port-doc

Conversation

@iDoMeteor

Copy link
Copy Markdown

In cdef class MidiIn, the line meant to copy close_port's docstring from MidiBase is a comparison (==), not an assignment:

close_port.__doc__ == MidiBase.close_port.__doc__

so rtmidi.MidiIn.close_port.__doc__ holds only the embedded signature, not the documentation. This changes it to =; Cython 3 accepts the assignment in a cdef class body. A test in tests/test_basic.py checks that the docstring is set; it fails without the fix.

Tested against a build of this branch on free-threaded CPython 3.14.7. It is independent of #230 and merges cleanly with it.

🤖 Generated with Claude Code

In MidiIn, the line

    close_port.__doc__ == MidiBase.close_port.__doc__

is a comparison, not an assignment, so it did nothing and MidiIn.close_port
only had the signature that Cython embeds ("MidiIn.close_port(self)"),
while MidiBase.close_port documents that it also cancels the callback.

Use a plain assignment, which Cython accepts in a cdef class body, so that
MidiIn.close_port gets the docstring of MidiBase.close_port, like the
other inherited methods. Add a test for it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant