Skip to content

use self.payload[:self.payload_len] for getting python string - #18

Merged
mattfox merged 1 commit into
oremanj:masterfrom
WGH-:master
Oct 28, 2016
Merged

mattfox merged 1 commit into
oremanj:masterfrom
WGH-:master

Conversation

@WGH-

@WGH- WGH- commented Oct 27, 2016

Copy link
Copy Markdown
Contributor

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

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
@mattfox
mattfox merged commit adb2545 into oremanj:master Oct 28, 2016
@mattfox

mattfox commented Oct 28, 2016

Copy link
Copy Markdown
Collaborator

Thanks @WGH-

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