diff --git a/bindings/python/src/ChunkIterator.hh b/bindings/python/src/ChunkIterator.hh index 3770bb616ac..7fbe931bffd 100644 --- a/bindings/python/src/ChunkIterator.hh +++ b/bindings/python/src/ChunkIterator.hh @@ -98,7 +98,7 @@ namespace PyXRootD else { self->currentOffset += self->chunksize; - pychunk = PyUnicode_FromStringAndSize( (const char*) chunk->GetBuffer(), + pychunk = PyBytes_FromStringAndSize( (const char*) chunk->GetBuffer(), chunk->GetSize() ); } diff --git a/bindings/python/src/Conversions.hh b/bindings/python/src/Conversions.hh index a644a6eb23b..6c7d7353e0f 100644 --- a/bindings/python/src/Conversions.hh +++ b/bindings/python/src/Conversions.hh @@ -241,7 +241,7 @@ namespace PyXRootD { static PyObject* Convert( XrdCl::Buffer *buffer ) { - return PyUnicode_FromStringAndSize( buffer->GetBuffer(), buffer->GetSize() ); + return PyBytes_FromStringAndSize( buffer->GetBuffer(), buffer->GetSize() ); } }; @@ -249,7 +249,7 @@ namespace PyXRootD { static PyObject* Convert( XrdCl::ChunkInfo *chunk ) { - PyObject *o = PyUnicode_FromStringAndSize( (const char*)chunk->buffer, + PyObject *o = PyBytes_FromStringAndSize( (const char*)chunk->buffer, chunk->length ); delete[] (char*) chunk->buffer; return o; @@ -268,7 +268,7 @@ namespace PyXRootD for ( uint32_t i = 0; i < chunks.size(); ++i ) { XrdCl::ChunkInfo chunk = chunks.at( i ); - PyObject *buffer = PyUnicode_FromStringAndSize( (const char *) chunk.buffer, + PyObject *buffer = PyBytes_FromStringAndSize( (const char *) chunk.buffer, chunk.length ); delete[] (char*) chunk.buffer; diff --git a/bindings/python/src/PyXRootDFile.cc b/bindings/python/src/PyXRootDFile.cc index f6d9608b898..c366e7b1c30 100644 --- a/bindings/python/src/PyXRootDFile.cc +++ b/bindings/python/src/PyXRootDFile.cc @@ -195,7 +195,7 @@ namespace PyXRootD else { uint32_t bytesRead = 0; async( status = self->file->Read( offset, size, buffer, bytesRead, timeout ) ); - pyresponse = PyUnicode_FromStringAndSize( buffer, bytesRead ); + pyresponse = PyBytes_FromStringAndSize( buffer, bytesRead ); delete[] buffer; }