mirror of
https://github.com/python/cpython
synced 2026-09-29 12:10:30 +03:00
gh-112730: Use color to highlight error locations (gh-112732)
Signed-off-by: Pablo Galindo <pablogsal@gmail.com> Co-authored-by: Łukasz Langa <lukasz@langa.pl>
This commit is contained in:
parent
3870d19d15
commit
16448cab44
8 changed files with 369 additions and 40 deletions
28
Modules/clinic/posixmodule.c.h
generated
28
Modules/clinic/posixmodule.c.h
generated
|
|
@ -11756,6 +11756,28 @@ exit:
|
|||
|
||||
#endif /* (defined(WIFEXITED) || defined(MS_WINDOWS)) */
|
||||
|
||||
#if defined(MS_WINDOWS)
|
||||
|
||||
PyDoc_STRVAR(os__supports_virtual_terminal__doc__,
|
||||
"_supports_virtual_terminal($module, /)\n"
|
||||
"--\n"
|
||||
"\n"
|
||||
"Checks if virtual terminal is supported in windows");
|
||||
|
||||
#define OS__SUPPORTS_VIRTUAL_TERMINAL_METHODDEF \
|
||||
{"_supports_virtual_terminal", (PyCFunction)os__supports_virtual_terminal, METH_NOARGS, os__supports_virtual_terminal__doc__},
|
||||
|
||||
static PyObject *
|
||||
os__supports_virtual_terminal_impl(PyObject *module);
|
||||
|
||||
static PyObject *
|
||||
os__supports_virtual_terminal(PyObject *module, PyObject *Py_UNUSED(ignored))
|
||||
{
|
||||
return os__supports_virtual_terminal_impl(module);
|
||||
}
|
||||
|
||||
#endif /* defined(MS_WINDOWS) */
|
||||
|
||||
#ifndef OS_TTYNAME_METHODDEF
|
||||
#define OS_TTYNAME_METHODDEF
|
||||
#endif /* !defined(OS_TTYNAME_METHODDEF) */
|
||||
|
|
@ -12395,4 +12417,8 @@ exit:
|
|||
#ifndef OS_WAITSTATUS_TO_EXITCODE_METHODDEF
|
||||
#define OS_WAITSTATUS_TO_EXITCODE_METHODDEF
|
||||
#endif /* !defined(OS_WAITSTATUS_TO_EXITCODE_METHODDEF) */
|
||||
/*[clinic end generated code: output=2900675ac5219924 input=a9049054013a1b77]*/
|
||||
|
||||
#ifndef OS__SUPPORTS_VIRTUAL_TERMINAL_METHODDEF
|
||||
#define OS__SUPPORTS_VIRTUAL_TERMINAL_METHODDEF
|
||||
#endif /* !defined(OS__SUPPORTS_VIRTUAL_TERMINAL_METHODDEF) */
|
||||
/*[clinic end generated code: output=ff0ec3371de19904 input=a9049054013a1b77]*/
|
||||
|
|
|
|||
|
|
@ -16073,6 +16073,26 @@ os_waitstatus_to_exitcode_impl(PyObject *module, PyObject *status_obj)
|
|||
}
|
||||
#endif
|
||||
|
||||
#if defined(MS_WINDOWS)
|
||||
/*[clinic input]
|
||||
os._supports_virtual_terminal
|
||||
|
||||
Checks if virtual terminal is supported in windows
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
os__supports_virtual_terminal_impl(PyObject *module)
|
||||
/*[clinic end generated code: output=bd0556a6d9d99fe6 input=0752c98e5d321542]*/
|
||||
{
|
||||
DWORD mode = 0;
|
||||
HANDLE handle = GetStdHandle(STD_ERROR_HANDLE);
|
||||
if (!GetConsoleMode(handle, &mode)) {
|
||||
Py_RETURN_FALSE;
|
||||
}
|
||||
return PyBool_FromLong(mode & ENABLE_VIRTUAL_TERMINAL_PROCESSING);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
static PyMethodDef posix_methods[] = {
|
||||
|
||||
|
|
@ -16277,6 +16297,8 @@ static PyMethodDef posix_methods[] = {
|
|||
OS__PATH_ISFILE_METHODDEF
|
||||
OS__PATH_ISLINK_METHODDEF
|
||||
OS__PATH_EXISTS_METHODDEF
|
||||
|
||||
OS__SUPPORTS_VIRTUAL_TERMINAL_METHODDEF
|
||||
{NULL, NULL} /* Sentinel */
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue