diff -r f2cfa8a348dd Modules/posixmodule.c --- a/Modules/posixmodule.c Sun Dec 21 21:00:51 2014 -0600 +++ b/Modules/posixmodule.c Mon Dec 22 18:25:46 2014 +0200 @@ -617,6 +617,22 @@ fail: #endif /* MS_WINDOWS */ +#if defined(HAVE_MKNOD) && defined(HAVE_MAKEDEV) +static int +_Py_Dev_Converter(PyObject *obj, void *p) +{ +#ifdef HAVE_LONG_LONG + *((dev_t *)p) = PyLong_AsUnsignedLongLong(obj); +#else + *((dev_t *)p) = PyLong_AsUnsignedLong(obj); +#endif + if (PyErr_Occurred()) + return 0; + return 1; +} +#endif + + #ifdef AT_FDCWD /* * Why the (int) cast? Solaris 10 defines AT_FDCWD as 0xffd19553 (-3041965); @@ -2589,6 +2605,10 @@ class gid_t_converter(CConverter): type = "gid_t" converter = '_Py_Gid_Converter' +class dev_t_converter(CConverter): + type = 'dev_t' + converter = '_Py_Dev_Converter' + class FSConverter_converter(CConverter): type = 'PyObject *' converter = 'PyUnicode_FSConverter' @@ -2639,7 +2659,7 @@ class sched_param_converter(CConverter): impl_by_reference = True; [python start generated code]*/ -/*[python end generated code: output=da39a3ee5e6b4b0d input=147ba8f52a05aca4]*/ +/*[python end generated code: output=da39a3ee5e6b4b0d input=9a77d6e66b7bc1df]*/ /*[clinic input] @@ -12348,7 +12368,7 @@ os.mknod path: path_t mode: int=0o600 - device: int=0 + device: dev_t=0 * dir_fd: dir_fd(requires='mknodat')=None @@ -12389,7 +12409,7 @@ PyDoc_STRVAR(os_mknod__doc__, {"mknod", (PyCFunction)os_mknod, METH_VARARGS|METH_KEYWORDS, os_mknod__doc__}, static PyObject * -os_mknod_impl(PyModuleDef *module, path_t *path, int mode, int device, int dir_fd); +os_mknod_impl(PyModuleDef *module, path_t *path, int mode, dev_t device, int dir_fd); static PyObject * os_mknod(PyModuleDef *module, PyObject *args, PyObject *kwargs) @@ -12398,12 +12418,12 @@ os_mknod(PyModuleDef *module, PyObject * static char *_keywords[] = {"path", "mode", "device", "dir_fd", NULL}; path_t path = PATH_T_INITIALIZE("mknod", "path", 0, 0); int mode = 384; - int device = 0; + dev_t device = 0; int dir_fd = DEFAULT_DIR_FD; if (!PyArg_ParseTupleAndKeywords(args, kwargs, - "O&|ii$O&:mknod", _keywords, - path_converter, &path, &mode, &device, MKNODAT_DIR_FD_CONVERTER, &dir_fd)) + "O&|iO&$O&:mknod", _keywords, + path_converter, &path, &mode, _Py_Dev_Converter, &device, MKNODAT_DIR_FD_CONVERTER, &dir_fd)) goto exit; return_value = os_mknod_impl(module, &path, mode, device, dir_fd); @@ -12415,8 +12435,8 @@ exit: } static PyObject * -os_mknod_impl(PyModuleDef *module, path_t *path, int mode, int device, int dir_fd) -/*[clinic end generated code: output=c688739c15ca7bbb input=30e02126aba9732e]*/ +os_mknod_impl(PyModuleDef *module, path_t *path, int mode, dev_t device, int dir_fd) +/*[clinic end generated code: output=f71d54eaf9bb6f1a input=ee44531551a4d83b]*/ { int result;