Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
3dc33d18
Kaydet (Commit)
3dc33d18
authored
Agu 31, 2007
tarafından
Martin v. Löwis
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Revert 57722. Move error dialog APIs to msvcrt instead,
add -n option to regrtest, and use it on the buildbot.
üst
39cf04b7
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
97 additions
and
23 deletions
+97
-23
regrtest.py
Lib/test/regrtest.py
+18
-2
main.c
Modules/main.c
+0
-19
msvcrtmodule.c
PC/msvcrtmodule.c
+78
-0
test.bat
Tools/buildbot/test.bat
+1
-2
No files found.
Lib/test/regrtest.py
Dosyayı görüntüle @
3dc33d18
...
...
@@ -28,6 +28,7 @@ Command line options:
-L: runleaks -- run the leaks(1) command just before exit
-R: huntrleaks -- search for reference leaks (needs debug build, v. slow)
-M: memlimit -- run very large memory-consuming tests
-n: nowindows -- suppress error message boxes on Windows
If non-option arguments are present, they are names for tests to run,
unless -x is given, in which case they are names for tests not to run.
...
...
@@ -210,13 +211,13 @@ def main(tests=None, testdir=None, verbose=0, quiet=False, generate=False,
test_support
.
record_original_stdout
(
sys
.
stdout
)
try
:
opts
,
args
=
getopt
.
getopt
(
sys
.
argv
[
1
:],
'dhvgqxsS:rf:lu:t:TD:NLR:wM:'
,
opts
,
args
=
getopt
.
getopt
(
sys
.
argv
[
1
:],
'dhvgqxsS:rf:lu:t:TD:NLR:wM:
n
'
,
[
'help'
,
'verbose'
,
'quiet'
,
'generate'
,
'exclude'
,
'single'
,
'random'
,
'fromfile'
,
'findleaks'
,
'use='
,
'threshold='
,
'trace'
,
'coverdir='
,
'nocoverdir'
,
'runleaks'
,
'huntrleaks='
,
'verbose2'
,
'memlimit='
,
'debug'
,
'start='
'debug'
,
'start='
,
"nowindows"
])
except
getopt
.
error
as
msg
:
usage
(
msg
)
...
...
@@ -296,6 +297,21 @@ def main(tests=None, testdir=None, verbose=0, quiet=False, generate=False,
use_resources
.
remove
(
r
)
elif
r
not
in
use_resources
:
use_resources
.
append
(
r
)
elif
o
in
(
'-n'
,
'--nowindows'
):
import
msvcrt
msvcrt
.
SetErrorMode
(
msvcrt
.
SEM_FAILCRITICALERRORS
|
msvcrt
.
SEM_NOALIGNMENTFAULTEXCEPT
|
msvcrt
.
SEM_NOGPFAULTERRORBOX
|
msvcrt
.
SEM_NOOPENFILEERRORBOX
)
try
:
msvcrt
.
CrtSetReportMode
except
AttributeError
:
# release build
pass
else
:
for
m
in
[
msvcrt
.
CRT_WARN
,
msvcrt
.
CRT_ERROR
,
msvcrt
.
CRT_ASSERT
]:
msvcrt
.
CrtSetReportMode
(
m
,
msvcrt
.
CRTDBG_MODE_FILE
)
msvcrt
.
CrtSetReportFile
(
m
,
msvcrt
.
CRTDBG_FILE_STDERR
)
if
generate
and
verbose
:
usage
(
"-g and -v don't go together!"
)
if
single
and
fromfile
:
...
...
Modules/main.c
Dosyayı görüntüle @
3dc33d18
...
...
@@ -328,25 +328,6 @@ Py_Main(int argc, char **argv)
(
p
=
Py_GETENV
(
"PYTHONUNBUFFERED"
))
&&
*
p
!=
'\0'
)
unbuffered
=
1
;
#ifdef MS_WINDOWS
if
((
p
=
Py_GETENV
(
"PYTHONNOERRORWINDOW"
))
&&
*
p
!=
'\0'
)
{
/* Disable all error windows created by the sytem
or the CRT. */
#if defined(_DEBUG) && defined(_MSC_VER)
int
types
[]
=
{
_CRT_WARN
,
_CRT_ERROR
,
_CRT_ASSERT
};
int
i
;
for
(
i
=
0
;
i
<
sizeof
(
types
)
/
sizeof
(
types
[
0
]);
i
++
)
{
_CrtSetReportFile
(
types
[
i
],
_CRTDBG_FILE_STDERR
);
_CrtSetReportMode
(
types
[
i
],
_CRTDBG_MODE_FILE
);
}
_set_error_mode
(
_OUT_TO_STDERR
);
#endif
SetErrorMode
(
SEM_FAILCRITICALERRORS
|
SEM_NOALIGNMENTFAULTEXCEPT
|
SEM_NOGPFAULTERRORBOX
|
SEM_NOOPENFILEERRORBOX
);
}
#endif
if
(
command
==
NULL
&&
module
==
NULL
&&
_PyOS_optind
<
argc
&&
strcmp
(
argv
[
_PyOS_optind
],
"-"
)
!=
0
)
{
...
...
PC/msvcrtmodule.c
Dosyayı görüntüle @
3dc33d18
...
...
@@ -21,6 +21,8 @@
#include <io.h>
#include <conio.h>
#include <sys/locking.h>
#include <crtdbg.h>
#include <windows.h>
// Force the malloc heap to clean itself up, and free unused blocks
// back to the OS. (According to the docs, only works on NT.)
...
...
@@ -201,6 +203,60 @@ insertint(PyObject *d, char *name, int value)
}
}
#ifdef _DEBUG
static
PyObject
*
msvcrt_setreportfile
(
PyObject
*
self
,
PyObject
*
args
)
{
int
type
,
file
;
_HFILE
res
;
if
(
!
PyArg_ParseTuple
(
args
,
"ii"
,
&
type
,
&
file
))
return
NULL
;
res
=
_CrtSetReportFile
(
type
,
(
_HFILE
)
file
);
return
PyInt_FromLong
((
long
)
res
);
Py_INCREF
(
Py_None
);
return
Py_None
;
}
static
PyObject
*
msvcrt_setreportmode
(
PyObject
*
self
,
PyObject
*
args
)
{
int
type
,
mode
;
int
res
;
if
(
!
PyArg_ParseTuple
(
args
,
"ii"
,
&
type
,
&
mode
))
return
NULL
;
res
=
_CrtSetReportMode
(
type
,
mode
);
if
(
res
==
-
1
)
return
PyErr_SetFromErrno
(
PyExc_IOError
);
return
PyLong_FromLong
(
res
);
}
static
PyObject
*
msvcrt_seterrormode
(
PyObject
*
self
,
PyObject
*
args
)
{
int
mode
,
res
;
if
(
!
PyArg_ParseTuple
(
args
,
"i"
,
&
mode
))
return
NULL
;
res
=
_set_error_mode
(
mode
);
return
PyLong_FromLong
(
res
);
}
#endif
static
PyObject
*
seterrormode
(
PyObject
*
self
,
PyObject
*
args
)
{
unsigned
int
mode
,
res
;
if
(
!
PyArg_ParseTuple
(
args
,
"I"
,
&
mode
))
return
NULL
;
res
=
SetErrorMode
(
mode
);
return
PyLong_FromUnsignedLong
(
res
);
}
/* List of functions exported by this module */
static
struct
PyMethodDef
msvcrt_functions
[]
=
{
...
...
@@ -214,6 +270,12 @@ static struct PyMethodDef msvcrt_functions[] = {
{
"getche"
,
msvcrt_getche
,
METH_VARARGS
},
{
"putch"
,
msvcrt_putch
,
METH_VARARGS
},
{
"ungetch"
,
msvcrt_ungetch
,
METH_VARARGS
},
{
"SetErrorMode"
,
seterrormode
,
METH_VARARGS
},
#ifdef _DEBUG
{
"CrtSetReportFile"
,
msvcrt_setreportfile
,
METH_VARARGS
},
{
"CrtSetReportMode"
,
msvcrt_setreportmode
,
METH_VARARGS
},
{
"set_error_mode"
,
msvcrt_seterrormode
,
METH_VARARGS
},
#endif
{
NULL
,
NULL
}
};
...
...
@@ -232,4 +294,20 @@ initmsvcrt(void)
insertint
(
d
,
"LK_NBRLCK"
,
_LK_NBRLCK
);
insertint
(
d
,
"LK_RLCK"
,
_LK_RLCK
);
insertint
(
d
,
"LK_UNLCK"
,
_LK_UNLCK
);
insertint
(
d
,
"SEM_FAILCRITICALERRORS"
,
SEM_FAILCRITICALERRORS
);
insertint
(
d
,
"SEM_NOALIGNMENTFAULTEXCEPT"
,
SEM_NOALIGNMENTFAULTEXCEPT
);
insertint
(
d
,
"SEM_NOGPFAULTERRORBOX"
,
SEM_NOGPFAULTERRORBOX
);
insertint
(
d
,
"SEM_NOOPENFILEERRORBOX"
,
SEM_NOOPENFILEERRORBOX
);
#ifdef _DEBUG
insertint
(
d
,
"CRT_WARN"
,
_CRT_WARN
);
insertint
(
d
,
"CRT_ERROR"
,
_CRT_ERROR
);
insertint
(
d
,
"CRT_ASSERT"
,
_CRT_ASSERT
);
insertint
(
d
,
"CRTDBG_MODE_DEBUG"
,
_CRTDBG_MODE_DEBUG
);
insertint
(
d
,
"CRTDBG_MODE_FILE"
,
_CRTDBG_MODE_FILE
);
insertint
(
d
,
"CRTDBG_MODE_WNDW"
,
_CRTDBG_MODE_WNDW
);
insertint
(
d
,
"CRTDBG_REPORT_MODE"
,
_CRTDBG_REPORT_MODE
);
insertint
(
d
,
"CRTDBG_FILE_STDERR"
,
(
int
)
_CRTDBG_FILE_STDERR
);
insertint
(
d
,
"CRTDBG_FILE_STDOUT"
,
(
int
)
_CRTDBG_FILE_STDOUT
);
insertint
(
d
,
"CRTDBG_REPORT_FILE"
,
(
int
)
_CRTDBG_REPORT_FILE
);
#endif
}
Tools/buildbot/test.bat
Dosyayı görüntüle @
3dc33d18
@rem Used by the buildbot "test" step.
cd PCbuild
set PYTHONNOERRORWINDOW=1
call rt.bat -d -q -uall -rw
call rt.bat -d -q -uall -rw -n
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment