Skip to content

Fix compilation with python 3.7 - #80

Merged
grisha merged 3 commits into
grisha:masterfrom
wom-bat:master
Nov 6, 2019
Merged

grisha merged 3 commits into
grisha:masterfrom
wom-bat:master

Conversation

@wom-bat

@wom-bat wom-bat commented Nov 1, 2019

Copy link
Copy Markdown
Contributor

_PyImport_FixupExtensionObject now takes four arguments.
The libpython library is now 2-digit versioned (at least on Debian), so
use -lpython3.7 not -lpython3 at link time.
The StringField class subclasses bytes, which needs a str() as its
initialiser.
Py_GetPath() and Py_GetProgramFullPath() return wide-char strings,
so use %ls when printing.

_PyImport_FixupExtensionObject now takes four arguments.
The libpython library is now 2-digit versioned (at least on Debian), so
use -lpython3.7 not -lpython3 at link time.
The StringField class subclasses bytes, which needs a str() as its
initialiser.
Py_GetPath() and Py_GetProgramFullPath() return wide-char strings,
so use %ls when printing.
@wom-bat

wom-bat commented Nov 1, 2019

Copy link
Copy Markdown
Contributor Author

This addresses issue #79

@grisha

grisha commented Nov 1, 2019

Copy link
Copy Markdown
Owner

Thank you! Just a quick question on this - should it work for Python 3 versions older than 3.7?

@wom-bat

wom-bat commented Nov 5, 2019

Copy link
Copy Markdown
Contributor Author

Probably not. _PyImport_FixupExtensionObject() now takes four arguments; it used to take three. Python 3.6 or earlier use the 3-argument form. The other changes should be benign.

@wom-bat

wom-bat commented Nov 5, 2019

Copy link
Copy Markdown
Contributor Author

I can add a guard around that if you like (but I don't really like #ifdefs in code.)

@grisha

grisha commented Nov 6, 2019

Copy link
Copy Markdown
Owner

I think adding some ifdefs is the only way to go here so as to not break it for people with older Python.

Peter Chubb added 2 commits November 7, 2019 09:32
Python provides a way to query the library name to link against, so use it.
This allows for distributions that name their libraries with various suffices
(like libpython3.5m.so) where it's not just the version that's important.
I've now tested with pytohon 2.7, 3.6, and 3.7, and all three build.
@wom-bat

wom-bat commented Nov 6, 2019

Copy link
Copy Markdown
Contributor Author

I think the two changes I've just pushed will fix this. The code builds cleanly against 2.7, 3,5 and 3.7; and I've tested 3.7.

@grisha
grisha merged commit 7af8011 into grisha:master Nov 6, 2019
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