diff options
| -rw-r--r-- | cython/plist.pyx | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/cython/plist.pyx b/cython/plist.pyx index be3fe8a..bfecf85 100644 --- a/cython/plist.pyx +++ b/cython/plist.pyx | |||
| @@ -2,10 +2,6 @@ cimport cpython | |||
| 2 | cimport libc.stdlib | 2 | cimport libc.stdlib |
| 3 | from libc.stdint cimport * | 3 | from libc.stdint cimport * |
| 4 | 4 | ||
| 5 | # https://groups.google.com/forum/#!topic/cython-users/xoKNFTRagvk | ||
| 6 | cdef _from_string_and_size(char *s, size_t length): | ||
| 7 | return s[:length].encode('utf-8') | ||
| 8 | |||
| 9 | cdef extern from *: | 5 | cdef extern from *: |
| 10 | ctypedef enum plist_type: | 6 | ctypedef enum plist_type: |
| 11 | PLIST_BOOLEAN, | 7 | PLIST_BOOLEAN, |
| @@ -553,7 +549,7 @@ cdef class Data(Node): | |||
| 553 | plist_get_data_val(self._c_node, &val, &length) | 549 | plist_get_data_val(self._c_node, &val, &length) |
| 554 | 550 | ||
| 555 | try: | 551 | try: |
| 556 | return _from_string_and_size(val, length) | 552 | return bytes(val[:length]) |
| 557 | finally: | 553 | finally: |
| 558 | libc.stdlib.free(val) | 554 | libc.stdlib.free(val) |
| 559 | 555 | ||
