Skip to content

Commit

Permalink
fs: fix FSEvent.path and FSPoll.path
Browse files Browse the repository at this point in the history
The uv conterparts no longer count the null byte in the length.
  • Loading branch information
saghul committed Apr 10, 2015
1 parent 5397477 commit 0982d6f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1642,7 +1642,7 @@ FSEvent_path_get(FSEvent *self, void *closure)
return PyBytes_FromString("");
}

return PyBytes_FromStringAndSize(buf, buf_len-1);
return PyBytes_FromStringAndSize(buf, buf_len);
}


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

return PyBytes_FromStringAndSize(buf, buf_len-1);
return PyBytes_FromStringAndSize(buf, buf_len);
}


Expand Down
2 changes: 2 additions & 0 deletions tests/test_fs.py
Original file line number Diff line number Diff line change
Expand Up @@ -877,6 +877,7 @@ def test_fsevent_basic(self):
self.filename = None
fs_event = pyuv.fs.FSEvent(self.loop)
fs_event.start(TEST_FILE, 0, self.on_fsevent_cb)
self.assertEqual(fs_event.path, TEST_FILE)
timer = pyuv.Timer(self.loop)
timer.start(self.timer_cb, 1, 0)
self.loop.run()
Expand Down Expand Up @@ -985,6 +986,7 @@ def test_fspoll1(self):
self.timer = pyuv.Timer(self.loop)
self.fs_poll = pyuv.fs.FSPoll(self.loop)
self.fs_poll.start(TEST_FILE, 0.1, self.on_fspoll)
self.assertEqual(self.fs_poll.path, TEST_FILE)
self.loop.run()
self.assertEqual(self.poll_cb_called, 5)

Expand Down

0 comments on commit 0982d6f

Please sign in to comment.