Skip to content

Commit

Permalink
fs: fix FS{Event,Poll}.path on Python 3
Browse files Browse the repository at this point in the history
  • Loading branch information
saghul committed Apr 10, 2015
1 parent 0982d6f commit c0ab26d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1639,10 +1639,14 @@ FSEvent_path_get(FSEvent *self, void *closure)
buf_len = sizeof(buf);
err = uv_fs_event_getpath(&self->fsevent_h, buf, &buf_len);
if (err < 0) {
return PyBytes_FromString("");
return Py_BuildValue("s", "");
}

#ifdef PYUV_PYTHON3
return PyUnicode_DecodeFSDefaultAndSize(buf, buf_len);
#else
return PyBytes_FromStringAndSize(buf, buf_len);
#endif
}


Expand Down Expand Up @@ -1906,7 +1910,11 @@ FSPoll_path_get(FSPoll *self, void *closure)
return PyBytes_FromString("");
}

#ifdef PYUV_PYTHON3
return PyUnicode_DecodeFSDefaultAndSize(buf, buf_len);
#else
return PyBytes_FromStringAndSize(buf, buf_len);
#endif
}


Expand Down

0 comments on commit c0ab26d

Please sign in to comment.