-
Notifications
You must be signed in to change notification settings - Fork 369
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Python 3 support, continued #130
base: master
Are you sure you want to change the base?
Conversation
Those properties are within the classes and don't need space in the instances. Py3k complaints about them as the properies shadow the slots.
This gets rid of all those annoying ord() calls Use next() instead of .next() Use b"" where comparing with the raw data
Minor reformat
Ask for read() and write() attribute to avoid check for unicode which does not exist in Python3.
May need some love
The tests now pass (again) on Python 2.7.
I'm getting that error on Python 3 and I don't quite understand how the sequencer module works here (src/sequencer.py doesn't define a Sequencer class!).
(I don't know why Event comparison ignores everything except tick, seems like a bad idea TBH, but it's what master does so *shrug*) Note that these methods appear to be untested.
This is suboptimal on Python 2, but I don't expect these dicts to have many values, so it should be OK.
I believe I've figured out how to raise exceptions in C code that is wrapped by SWIG. Now the tests fail because you cannot open What's a bit more annoying is that tests fail for me locally with
I don't know how the ALSA loopback sequencer is supposed to work, so I'm not sure how to debug this. |
When you're reading from a file descriptor in non-blocking mode and there's nothing to read, you get an EAGAIN error. We don't want to see those as exceptions; we want to see a None value returned by event_input().
And I've figured out that the Resource temporarily unavailable error is normal and should be ignored, and now all three tests pass on my machine! I think this is ready for merging. I'd appreciate if any other users cared to test this branch on either Python 2 or 3. |
src/sequencer_alsa/sequencer_alsa.i
Outdated
if (err == -EAGAIN) | ||
{ | ||
Py_INCREF(Py_None); | ||
return Py_None; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This produces a compilation warning:
src/sequencer_alsa/sequencer_alsa_wrap.c:3039:9: warning: return from incompatible pointer type [enabled by default]
return Py_None;
^
And while it seems to work fine on my machine, TBH I'm not sure it's safe to pass Py_None through SWIG's SWIG_NewPointerObj() wrapper like this.
Godspeed! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trivial Change. Fixes dependency on future module.
Sorry, I thought I could review single patches. So my review above is premature. Will look through the other patches now. |
After looking through all patches: This looks really good. I strongly support merging this PR. One might argue that it might be even better if the two or three patches that fix previous ones would be rebased and squashed but this is rather cosmetic. Candidates might be:
But the patch set is good enough as is to be just merged IMHO. Thank you very much for the effort! |
100 days until Python 2 end of life. |
* Python3 port by Marius Gedminas See: - https://github.com/mgedmin/python-midi - vishnubob#130 * Re-applied adaptations for samplerbox * Add buffered writing of 1-track midi files (#2)
This is a continuation of @florianfesti's excellent PR #35. It fixes some bugs and made the test suite pass on Pythons 2 and 3 on my machine.