Merge branch 'PyBuffer_Release-pybuffer'

* PyBuffer_Release-pybuffer:
  Add tests.
  Fix the error handling for the PyObject_GetBuffer() calls in pybuffer.i
This commit is contained in:
William S Fulton 2020-10-07 22:37:17 +01:00
commit 4d5f4bcd33
2 changed files with 35 additions and 13 deletions

View file

@ -44,3 +44,27 @@ else:
buf3 = bytearray(b"hello")
python_pybuffer.title1(buf3)
check(buf3 == b"Hello")
try:
python_pybuffer.func1(1)
raise RuntimeError, "should throw TypeError"
except TypeError, e:
check("(char *buf1, int len)" in str(e))
try:
python_pybuffer.func2(1)
raise RuntimeError, "should throw TypeError"
except TypeError, e:
check("(char *buf2)" in str(e))
try:
python_pybuffer.func3(1)
raise RuntimeError, "should throw TypeError"
except TypeError, e:
check("(const char *buf3, int len)" in str(e))
try:
python_pybuffer.func4(1)
raise RuntimeError, "should throw TypeError"
except TypeError, e:
check("(const char *buf4)" in str(e))