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

Make pysane Python3-compatible #2

Closed
wants to merge 1 commit into from
Closed

Make pysane Python3-compatible #2

wants to merge 1 commit into from

Conversation

manisandro
Copy link

These changes allow the pysane module to be compiled both as a python2 or python3 module.

@warsaw
Copy link

warsaw commented Jan 9, 2013

String exceptions are no longer supported in Python 3, so you need to do this too:

  • ErrorObject = PyString_FromString("_sane.error");
  • ErrorObject = PyErr_NewException("_sane.error", NULL, NULL);

/* Create the module and add the functions */
PyObject *m = Py_InitModule("_sane", PySane_methods);
if(!m)
return;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has to return NULL

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That section of the code is for the python2 variant, where the module init function is void.

@fluggo
Copy link
Owner

fluggo commented Jan 10, 2013

This was cherry-picked. (Which I now realize was the wrong thing to do, but the damage is done.)

@fluggo fluggo closed this Jan 10, 2013
@manisandro
Copy link
Author

Uhm, I actually had a patch ready with the suggested modifications (but can't commit it until this evening being behind an annoying corporate firewall atm). Should I post a new pull-request?

@manisandro
Copy link
Author

Oh, you already made the changes. Ok, never mind - thanks!

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.

3 participants