Skip to content

Python3: import fails with "undefined symbol: PyString_FromStringAndSize" #17

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

Closed
WGH- opened this issue Oct 27, 2016 · 0 comments
Closed

Comments

@WGH-
Copy link
Contributor

WGH- commented Oct 27, 2016

As of current master, importing netfilterqueue fails:

ImportError: .../lib/python3.4/site-packages/netfilterqueue.cpython-34.so: undefined symbol: PyString_FromStringAndSize

Issue #9 reports the same problem, but it was closed some time ago, and since then Python 3 support was supposedly merge into master.

So it seems that the problem reappeared again.

WGH- added a commit to WGH-/python-netfilterqueue that referenced this issue Oct 27, 2016
WGH- added a commit to WGH-/python-netfilterqueue that referenced this issue Oct 27, 2016
This is more Cythonic way, documented here
http://cython.readthedocs.io/en/latest/src/tutorial/strings.html#passing-byte-strings

It compiles to
    __Pyx_PyBytes_FromStringAndSize(
        __pyx_v_self->payload + 0,
        __pyx_v_self->payload_len - 0)

Which is the Cython macro wrapper which handles both Python 2 and
Python3.

Fixes oremanj#17
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

No branches or pull requests

1 participant