Skip to content

Commit

Permalink
[Py] Translate binary buffers into bytes objects, closes #632
Browse files Browse the repository at this point in the history
  • Loading branch information
simonmichal committed Dec 7, 2017
1 parent 4c1c2d3 commit 2c83dcb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions bindings/python/src/Conversions.hh
Expand Up @@ -241,15 +241,15 @@ namespace PyXRootD
{
static PyObject* Convert( XrdCl::Buffer *buffer )
{
return Py_BuildValue( "s#", buffer->GetBuffer(), buffer->GetSize() );
return Py_BuildValue( "y#", buffer->GetBuffer(), buffer->GetSize() );
}
};

template<> struct PyDict<XrdCl::ChunkInfo>
{
static PyObject* Convert( XrdCl::ChunkInfo *chunk )
{
PyObject *o = Py_BuildValue( "s#", chunk->buffer, chunk->length );
PyObject *o = Py_BuildValue( "y#", chunk->buffer, chunk->length );
delete[] (char*) chunk->buffer;
return o;
}
Expand All @@ -267,7 +267,7 @@ namespace PyXRootD
for ( uint32_t i = 0; i < chunks.size(); ++i ) {
XrdCl::ChunkInfo chunk = chunks.at( i );

PyObject *buffer = Py_BuildValue( "s#", (const char *) chunk.buffer,
PyObject *buffer = Py_BuildValue( "y#", (const char *) chunk.buffer,
chunk.length );
PyList_SET_ITEM( pychunks, i,
Py_BuildValue( "{sOsOsO}",
Expand Down
2 changes: 1 addition & 1 deletion bindings/python/src/PyXRootDFile.cc
Expand Up @@ -195,7 +195,7 @@ namespace PyXRootD
else {
uint32_t bytesRead;
async( status = self->file->Read( offset, size, buffer, bytesRead, timeout ) );
pyresponse = Py_BuildValue( "s#", buffer, bytesRead );
pyresponse = Py_BuildValue( "y#", buffer, bytesRead );
delete[] buffer;
}

Expand Down

0 comments on commit 2c83dcb

Please sign in to comment.