Author: Marc Abramowitz <[email protected]>
Branch: test_SetFromErrnoWithFilename_NULL
Changeset: r70228:322c7911932a
Date: 2014-03-24 00:12 -0700
http://bitbucket.org/pypy/pypy/changeset/322c7911932a/
Log: Add test_SetFromErrnoWithFilename_NULL
Tests that PyErr_SetFromErrnoWithFilename with filename == NULL
works
diff --git a/pypy/module/cpyext/test/test_pyerrors.py
b/pypy/module/cpyext/test/test_pyerrors.py
--- a/pypy/module/cpyext/test/test_pyerrors.py
+++ b/pypy/module/cpyext/test/test_pyerrors.py
@@ -215,6 +215,23 @@
assert exc_info.value.errno == errno.EBADF
assert exc_info.value.strerror == os.strerror(errno.EBADF)
+ def test_SetFromErrnoWithFilename_NULL(self):
+ import errno, os
+
+ module = self.import_extension('foo', [
+ ("set_from_errno", "METH_NOARGS",
+ '''
+ errno = EBADF;
+ PyErr_SetFromErrnoWithFilename(PyExc_OSError, NULL);
+ return NULL;
+ '''),
+ ],
+ prologue="#include <errno.h>")
+ exc_info = raises(OSError, module.set_from_errno)
+ assert exc_info.value.filename == None
+ assert exc_info.value.errno == errno.EBADF
+ assert exc_info.value.strerror == os.strerror(errno.EBADF)
+
def test_SetFromErrnoWithFilenameObject__PyString(self):
import errno, os
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit