Skip to content
Browse files

Convert to str before writing bytes

  • Loading branch information...
1 parent 7baa84b commit 999056c78b7e02660a3235ee98d65b7f23784565 @wsxiaoys committed Sep 25, 2012
Showing with 31 additions and 13 deletions.
  1. +29 −11 hadoopy/_typedbytes.c
  2. +2 −2 hadoopy/_typedbytes.pyx
View
40 hadoopy/_typedbytes.c
@@ -1,4 +1,4 @@
-/* Generated by Cython 0.17 on Mon Sep 24 01:27:03 2012 */
+/* Generated by Cython 0.17 on Tue Sep 25 01:23:53 2012 */
#define PY_SSIZE_T_CLEAN
#include "Python.h"
@@ -364,7 +364,7 @@ struct __pyx_obj_19_hadoopy_typedbytes_TypedBytesFile {
/* "hadoopy/_typedbytes.pyx":637
- * _write_bytes(fp, v)
+ * _write_bytes(fp, str(v))
*
* cdef class RawBytesFile(object): # <<<<<<<<<<<<<<
* """RawBytesFile interface
@@ -5435,7 +5435,7 @@ static PyObject *__pyx_f_19_hadoopy_typedbytes___read_key_value_rb(void *__pyx_v
*
* cdef __write_key_value_rb(void *fp, kv): # <<<<<<<<<<<<<<
* k, v = kv
- * _write_bytes(fp, k)
+ * _write_bytes(fp, str(k))
*/
static PyObject *__pyx_f_19_hadoopy_typedbytes___write_key_value_rb(void *__pyx_v_fp, PyObject *__pyx_v_kv) {
@@ -5456,8 +5456,8 @@ static PyObject *__pyx_f_19_hadoopy_typedbytes___write_key_value_rb(void *__pyx_
*
* cdef __write_key_value_rb(void *fp, kv):
* k, v = kv # <<<<<<<<<<<<<<
- * _write_bytes(fp, k)
- * _write_bytes(fp, v)
+ * _write_bytes(fp, str(k))
+ * _write_bytes(fp, str(v))
*/
if ((likely(PyTuple_CheckExact(__pyx_v_kv))) || (PyList_CheckExact(__pyx_v_kv))) {
PyObject* sequence = __pyx_v_kv;
@@ -5514,23 +5514,41 @@ static PyObject *__pyx_f_19_hadoopy_typedbytes___write_key_value_rb(void *__pyx_
/* "hadoopy/_typedbytes.pyx":634
* cdef __write_key_value_rb(void *fp, kv):
* k, v = kv
- * _write_bytes(fp, k) # <<<<<<<<<<<<<<
- * _write_bytes(fp, v)
+ * _write_bytes(fp, str(k)) # <<<<<<<<<<<<<<
+ * _write_bytes(fp, str(v))
*
*/
- __pyx_t_2 = __pyx_f_19_hadoopy_typedbytes__write_bytes(__pyx_v_fp, __pyx_v_k); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
+ __Pyx_INCREF(__pyx_v_k);
+ PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_k);
+ __Pyx_GIVEREF(__pyx_v_k);
+ __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+ __pyx_t_2 = __pyx_f_19_hadoopy_typedbytes__write_bytes(__pyx_v_fp, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* "hadoopy/_typedbytes.pyx":635
* k, v = kv
- * _write_bytes(fp, k)
- * _write_bytes(fp, v) # <<<<<<<<<<<<<<
+ * _write_bytes(fp, str(k))
+ * _write_bytes(fp, str(v)) # <<<<<<<<<<<<<<
*
* cdef class RawBytesFile(object):
*/
- __pyx_t_2 = __pyx_f_19_hadoopy_typedbytes__write_bytes(__pyx_v_fp, __pyx_v_v); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
+ __Pyx_INCREF(__pyx_v_v);
+ PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_v);
+ __Pyx_GIVEREF(__pyx_v_v);
+ __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
+ __pyx_t_2 = __pyx_f_19_hadoopy_typedbytes__write_bytes(__pyx_v_fp, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
View
4 hadoopy/_typedbytes.pyx
@@ -631,8 +631,8 @@ cdef __read_key_value_rb(void *fp):
cdef __write_key_value_rb(void *fp, kv):
k, v = kv
- _write_bytes(fp, k)
- _write_bytes(fp, v)
+ _write_bytes(fp, str(k))
+ _write_bytes(fp, str(v))
cdef class RawBytesFile(object):
"""RawBytesFile interface

0 comments on commit 999056c

Please sign in to comment.
Something went wrong with that request. Please try again.