[pypy-commit] pypy more-cpyext: add PyErr_SetFromWindowsErr, test needed
mattip
pypy.commits at gmail.com
Wed Sep 11 10:52:43 EDT 2019
Author: Matti Picus <matti.picus at gmail.com>
Branch: more-cpyext
Changeset: r97441:64d4dfe78eb4
Date: 2019-09-11 17:53 +0300
http://bitbucket.org/pypy/pypy/changeset/64d4dfe78eb4/
Log: add PyErr_SetFromWindowsErr, test needed
diff --git a/pytime.h b/pypy/module/cpyext/include/pytime.h
rename from pytime.h
rename to pypy/module/cpyext/include/pytime.h
diff --git a/pypy/module/cpyext/pyerrors.py b/pypy/module/cpyext/pyerrors.py
--- a/pypy/module/cpyext/pyerrors.py
+++ b/pypy/module/cpyext/pyerrors.py
@@ -64,6 +64,11 @@
"""This is a shorthand for PyErr_SetObject(type, Py_None)."""
PyErr_SetObject(space, w_type, space.w_None)
+if os.name == 'nt':
+ @cpython_api([rffi.INT_real], lltype.Void, error=CANNOT_FAIL)
+ def PyErr_SetFromWindowsErr(space, err):
+ PyErr_SetObject(space, space.w_OSError, space.newint(err))
+
@cpython_api([], PyObject, result_borrowed=True)
def PyErr_Occurred(space):
state = space.fromcache(State)
More information about the pypy-commit
mailing list