Author: Alex Gaynor <[email protected]>
Branch:
Changeset: r70229:be52f96491e8
Date: 2014-03-24 00:16 -0700
http://bitbucket.org/pypy/pypy/changeset/be52f96491e8/
Log: Merged in msabramo/pypy/test_SetFromErrnoWithFilename_NULL (pull
request #212)
Add test_SetFromErrnoWithFilename_NULL
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