Skip to content
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

Update Python bindings to support Python 3 (tested on Python 3.7) #16

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

momonala
Copy link

@momonala momonala commented Sep 8, 2020

First off, this is a great project! Thanks for making it open source.

I played around with it a bit, and I'd like to make a PR to update the python binding to support 3.X, as Python 2 is deprecated as of this year.

The main changes required were porting some C Python extensions over. Specifically, the Py_InitModule constructor has been replaced. Now I create a PyModuleDef structure and then pass a reference to it to PyModule_Create.

Additionally, I had to change the entry point of the compilation, by explicitly converting the application argument from char to wchar_t.

Other minor changes include:

  • updating the .gitignore to ignore precompiled python files.
  • updating the README and INSTALL markdown files.
  • adding a requirements.txt file for pip.
  • updating the example.py (scikits.audiolab.wavread is also deprecated).
  • minor formatting, as per the PEP8 standard.

ignore compiled python files

ignore compiled python files

ignore compiled python files
@sevagh
Copy link

sevagh commented Dec 16, 2020

Thanks, confirmed this is working for Python 3.8 as well.

Have you considered making it support both, by using ifdefs? E.g.

#if PY_MAJOR_VERSION >= 3

http://python3porting.com/cextensions.html

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.

2 participants