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
6f6f4865
Kaydet (Commit)
6f6f4865
authored
Eyl 08, 2013
tarafından
Charles-François Natali
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Merge.
üst
807ba855
a3c18d0f
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
101 additions
and
23 deletions
+101
-23
cmdline.rst
Doc/using/cmdline.rst
+8
-8
test_faulthandler.py
Lib/test/test_faulthandler.py
+23
-7
test_os.py
Lib/test/test_os.py
+29
-7
test_socket.py
Lib/test/test_socket.py
+30
-0
NEWS
Misc/NEWS
+7
-0
faulthandler.c
Modules/faulthandler.c
+4
-1
No files found.
Doc/using/cmdline.rst
Dosyayı görüntüle @
6f6f4865
...
...
@@ -511,9 +511,9 @@ conflict.
.. envvar:: PYTHONDONTWRITEBYTECODE
If this is set
, Python won't try to write ``.pyc`` or ``.pyo`` files on the
import of source modules. This is equivalent to specifying the :option:`-B`
option.
If this is set
to a non-empty string, Python won't try to write ``.pyc`` or
``.pyo`` files on the import of source modules. This is equivalent to
specifying the :option:`-B`
option.
.. envvar:: PYTHONHASHSEED
...
...
@@ -582,11 +582,11 @@ conflict.
.. envvar:: PYTHONFAULTHANDLER
If this environment variable is set
, :func:`faulthandler.enable` is called
at startup: install a handler for :const:`SIGSEGV`, :const:`SIGFPE`,
:const:`SIG
ABRT`, :const:`SIGBUS` and :const:`SIGILL` signals to dump the
Python traceback. This is equivalent to :option:`-X` ``faulthandler``
option.
If this environment variable is set
to a non-empty string,
:func:`faulthandler.enable` is called at startup: install a handler for
:const:`SIG
SEGV`, :const:`SIGFPE`, :const:`SIGABRT`, :const:`SIGBUS` and
:const:`SIGILL` signals to dump the Python traceback. This is equivalent to
:option:`-X` ``faulthandler``
option.
.. versionadded:: 3.3
...
...
Lib/test/test_faulthandler.py
Dosyayı görüntüle @
6f6f4865
...
...
@@ -265,17 +265,33 @@ faulthandler._sigsegv()
# By default, the module should be disabled
code
=
"import faulthandler; print(faulthandler.is_enabled())"
args
=
(
sys
.
executable
,
'-E'
,
'-c'
,
code
)
# use subprocess module directly because test.script_helper adds
# "-X faulthandler" to the command line
stdout
=
subprocess
.
check_output
(
args
)
self
.
assertEqual
(
stdout
.
rstrip
(),
b
"False"
)
# don't use assert_python_ok() because it always enable faulthandler
output
=
subprocess
.
check_output
(
args
)
self
.
assertEqual
(
output
.
rstrip
(),
b
"False"
)
def
test_sys_xoptions
(
self
):
# Test python -X faulthandler
code
=
"import faulthandler; print(faulthandler.is_enabled())"
rc
,
stdout
,
stderr
=
assert_python_ok
(
"-X"
,
"faulthandler"
,
"-c"
,
code
)
stdout
=
(
stdout
+
stderr
)
.
strip
()
self
.
assertEqual
(
stdout
,
b
"True"
)
args
=
(
sys
.
executable
,
"-E"
,
"-X"
,
"faulthandler"
,
"-c"
,
code
)
# don't use assert_python_ok() because it always enable faulthandler
output
=
subprocess
.
check_output
(
args
)
self
.
assertEqual
(
output
.
rstrip
(),
b
"True"
)
def
test_env_var
(
self
):
# empty env var
code
=
"import faulthandler; print(faulthandler.is_enabled())"
args
=
(
sys
.
executable
,
"-c"
,
code
)
env
=
os
.
environ
.
copy
()
env
[
'PYTHONFAULTHANDLER'
]
=
''
# don't use assert_python_ok() because it always enable faulthandler
output
=
subprocess
.
check_output
(
args
,
env
=
env
)
self
.
assertEqual
(
output
.
rstrip
(),
b
"False"
)
# non-empty env var
env
=
os
.
environ
.
copy
()
env
[
'PYTHONFAULTHANDLER'
]
=
'1'
output
=
subprocess
.
check_output
(
args
,
env
=
env
)
self
.
assertEqual
(
output
.
rstrip
(),
b
"True"
)
def
check_dump_traceback
(
self
,
filename
):
"""
...
...
Lib/test/test_os.py
Dosyayı görüntüle @
6f6f4865
...
...
@@ -34,6 +34,10 @@ try:
import
resource
except
ImportError
:
resource
=
None
try
:
import
fcntl
except
ImportError
:
fcntl
=
None
from
test.script_helper
import
assert_python_ok
...
...
@@ -2300,19 +2304,37 @@ class CPUCountTests(unittest.TestCase):
class
FDInheritanceTests
(
unittest
.
TestCase
):
def
test_get_inheritable
(
self
):
def
test_get_
set_
inheritable
(
self
):
fd
=
os
.
open
(
__file__
,
os
.
O_RDONLY
)
self
.
addCleanup
(
os
.
close
,
fd
)
for
inheritable
in
(
False
,
True
):
os
.
set_inheritable
(
fd
,
inheritable
)
self
.
assertEqual
(
os
.
get_inheritable
(
fd
),
inheritable
)
self
.
assertEqual
(
os
.
get_inheritable
(
fd
),
False
)
def
test_set_inheritable
(
self
):
fd
=
os
.
open
(
__file__
,
os
.
O_RDONLY
)
self
.
addCleanup
(
os
.
close
,
fd
)
os
.
set_inheritable
(
fd
,
True
)
self
.
assertEqual
(
os
.
get_inheritable
(
fd
),
True
)
if
fcntl
:
def
test_get_inheritable_cloexec
(
self
):
fd
=
os
.
open
(
__file__
,
os
.
O_RDONLY
)
self
.
addCleanup
(
os
.
close
,
fd
)
self
.
assertEqual
(
os
.
get_inheritable
(
fd
),
False
)
# clear FD_CLOEXEC flag
flags
=
fcntl
.
fcntl
(
fd
,
fcntl
.
F_GETFD
)
flags
&=
~
fcntl
.
FD_CLOEXEC
fcntl
.
fcntl
(
fd
,
fcntl
.
F_SETFD
,
flags
)
self
.
assertEqual
(
os
.
get_inheritable
(
fd
),
True
)
def
test_set_inheritable_cloexec
(
self
):
fd
=
os
.
open
(
__file__
,
os
.
O_RDONLY
)
self
.
addCleanup
(
os
.
close
,
fd
)
self
.
assertEqual
(
fcntl
.
fcntl
(
fd
,
fcntl
.
F_GETFD
)
&
fcntl
.
FD_CLOEXEC
,
fcntl
.
FD_CLOEXEC
)
os
.
set_inheritable
(
fd
,
True
)
self
.
assertEqual
(
fcntl
.
fcntl
(
fd
,
fcntl
.
F_GETFD
)
&
fcntl
.
FD_CLOEXEC
,
0
)
def
test_open
(
self
):
fd
=
os
.
open
(
__file__
,
os
.
O_RDONLY
)
self
.
addCleanup
(
os
.
close
,
fd
)
...
...
Lib/test/test_socket.py
Dosyayı görüntüle @
6f6f4865
...
...
@@ -26,6 +26,10 @@ try:
import
multiprocessing
except
ImportError
:
multiprocessing
=
False
try
:
import
fcntl
except
ImportError
:
fcntl
=
None
HOST
=
support
.
HOST
MSG
=
'Michael Gilfix was here
\u1234\r\n
'
.
encode
(
'utf-8'
)
## test unicode string and carriage return
...
...
@@ -4804,6 +4808,32 @@ class InheritanceTest(unittest.TestCase):
sock
.
set_inheritable
(
False
)
self
.
assertEqual
(
sock
.
get_inheritable
(),
False
)
if
fcntl
:
def
test_get_inheritable_cloexec
(
self
):
sock
=
socket
.
socket
()
with
sock
:
fd
=
sock
.
fileno
()
self
.
assertEqual
(
sock
.
get_inheritable
(),
False
)
# clear FD_CLOEXEC flag
flags
=
fcntl
.
fcntl
(
fd
,
fcntl
.
F_GETFD
)
flags
&=
~
fcntl
.
FD_CLOEXEC
fcntl
.
fcntl
(
fd
,
fcntl
.
F_SETFD
,
flags
)
self
.
assertEqual
(
sock
.
get_inheritable
(),
True
)
def
test_set_inheritable_cloexec
(
self
):
sock
=
socket
.
socket
()
with
sock
:
fd
=
sock
.
fileno
()
self
.
assertEqual
(
fcntl
.
fcntl
(
fd
,
fcntl
.
F_GETFD
)
&
fcntl
.
FD_CLOEXEC
,
fcntl
.
FD_CLOEXEC
)
sock
.
set_inheritable
(
True
)
self
.
assertEqual
(
fcntl
.
fcntl
(
fd
,
fcntl
.
F_GETFD
)
&
fcntl
.
FD_CLOEXEC
,
0
)
@unittest.skipUnless
(
hasattr
(
socket
,
"socketpair"
),
"need socket.socketpair()"
)
def
test_socketpair
(
self
):
...
...
Misc/NEWS
Dosyayı görüntüle @
6f6f4865
...
...
@@ -7,6 +7,13 @@ What's New in Python 3.4.0 Alpha 3?
Projected Release date: 2013-10-XX
Library
-------
- The :envvar:`PYTHONFAULTHANDLER` environment variable now only enables the
faulthandler module if the variable is non-empty. Same behaviour than other
variables like :envvar:`PYTHONDONTWRITEBYTECODE`.
Tests
-----
...
...
Modules/faulthandler.c
Dosyayı görüntüle @
6f6f4865
...
...
@@ -1048,8 +1048,11 @@ faulthandler_env_options(void)
{
PyObject
*
xoptions
,
*
key
,
*
module
,
*
res
;
_Py_IDENTIFIER
(
enable
);
char
*
p
;
if
(
!
Py_GETENV
(
"PYTHONFAULTHANDLER"
))
{
if
(
!
((
p
=
Py_GETENV
(
"PYTHONFAULTHANDLER"
))
&&
*
p
!=
'\0'
))
{
/* PYTHONFAULTHANDLER environment variable is missing
or an empty string */
int
has_key
;
xoptions
=
PySys_GetXOptions
();
...
...
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