Table of Contents

Class BufferError

Namespace
NumSharp
Assembly
NumSharp.dll

Python's BufferError: a buffer could not be exported in the form a caller asked for. NumPy's ndarray(shape, buffer=memoryview(a[::2])) raises it, because the buffer protocol request asks for a contiguous buffer and a strided memoryview refuses (memoryview: underlying buffer is not contiguous).

public class BufferError : NumSharpException, ISerializable, INumSharpException
Inheritance
BufferError
Implements
Inherited Members

Remarks

A non-contiguous NDArray passed directly is a ValueError instead (ndarray is not contiguous): NumPy's own array exporter raises that one. The two texts and types are NumPy's, kept apart as NumPy keeps them.

Constructors

BufferError()

Creates the exception with Python's text for a bare raise BufferError: an empty Message, as str(BufferError()) is ''.

public BufferError()

Remarks

ToString() then starts with the class name alone, as Python's traceback prints a bare BufferError.

BufferError(string)

Creates the exception with NumPy's message.

public BufferError(string message)

Parameters

message string

The message, verbatim from NumPy where NumPy has one.

BufferError(string, Exception)

Creates the exception with a message and the exception that caused it.

public BufferError(string message, Exception innerException)

Parameters

message string

The message.

innerException Exception

The cause.