@@ -5321,6 +5321,38 @@ os_set_handle_inheritable(PyModuleDef *module, PyObject *args)
53215321
53225322#endif /* defined(MS_WINDOWS) */
53235323
5324+ PyDoc_STRVAR (os_fspath__doc__ ,
5325+ "fspath($module, /, path)\n"
5326+ "--\n"
5327+ "\n"
5328+ "Return the file system path representation of the object.\n"
5329+ "\n"
5330+ "If the object is str or bytes, then allow it to pass through with\n"
5331+ "an incremented refcount. If the object defines __fspath__(), then\n"
5332+ "return the result of that method. All other types raise a TypeError." );
5333+
5334+ #define OS_FSPATH_METHODDEF \
5335+ {"fspath", (PyCFunction)os_fspath, METH_VARARGS|METH_KEYWORDS, os_fspath__doc__},
5336+
5337+ static PyObject *
5338+ os_fspath_impl (PyModuleDef * module , PyObject * path );
5339+
5340+ static PyObject *
5341+ os_fspath (PyModuleDef * module , PyObject * args , PyObject * kwargs )
5342+ {
5343+ PyObject * return_value = NULL ;
5344+ static char * _keywords [] = {"path" , NULL };
5345+ PyObject * path ;
5346+
5347+ if (!PyArg_ParseTupleAndKeywords (args , kwargs , "O:fspath" , _keywords ,
5348+ & path ))
5349+ goto exit ;
5350+ return_value = os_fspath_impl (module , path );
5351+
5352+ exit :
5353+ return return_value ;
5354+ }
5355+
53245356#ifndef OS_TTYNAME_METHODDEF
53255357 #define OS_TTYNAME_METHODDEF
53265358#endif /* !defined(OS_TTYNAME_METHODDEF) */
@@ -5792,4 +5824,4 @@ os_set_handle_inheritable(PyModuleDef *module, PyObject *args)
57925824#ifndef OS_SET_HANDLE_INHERITABLE_METHODDEF
57935825 #define OS_SET_HANDLE_INHERITABLE_METHODDEF
57945826#endif /* !defined(OS_SET_HANDLE_INHERITABLE_METHODDEF) */
5795- /*[clinic end generated code: output=a5c9bef9ad11a20b input=a9049054013a1b77]*/
5827+ /*[clinic end generated code: output=e64e246b8270abda input=a9049054013a1b77]*/
0 commit comments