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
d5d79545
Kaydet (Commit)
d5d79545
authored
Eki 24, 2017
tarafından
xdegaye
Kaydeden (comit)
GitHub
Eki 24, 2017
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
[3.6] bpo-30817: Fix PyErr_PrintEx() when no memory (GH-2526). (#4107)
(cherry picked from commit
66caacf2
)
üst
d8f78a1f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
4 deletions
+29
-4
test_exceptions.py
Lib/test/test_exceptions.py
+18
-1
2017-07-01-15-11-13.bpo-30817.j7ZvN_.rst
...ore and Builtins/2017-07-01-15-11-13.bpo-30817.j7ZvN_.rst
+2
-0
pythonrun.c
Python/pythonrun.c
+9
-3
No files found.
Lib/test/test_exceptions.py
Dosyayı görüntüle @
d5d79545
...
...
@@ -10,7 +10,7 @@ import errno
from
test.support
import
(
TESTFN
,
captured_stderr
,
check_impl_detail
,
check_warnings
,
cpython_only
,
gc_collect
,
run_unittest
,
no_tracing
,
unlink
,
import_module
)
no_tracing
,
unlink
,
import_module
,
script_helper
)
class
NaiveException
(
Exception
):
def
__init__
(
self
,
x
):
...
...
@@ -1104,6 +1104,23 @@ class ExceptionTests(unittest.TestCase):
self
.
assertIn
(
"test message"
,
report
)
self
.
assertTrue
(
report
.
endswith
(
"
\n
"
))
@cpython_only
def
test_memory_error_in_PyErr_PrintEx
(
self
):
code
=
"""if 1:
import _testcapi
class C(): pass
_testcapi.set_nomemory(0,
%
d)
C()
"""
# Issue #30817: Abort in PyErr_PrintEx() when no memory.
# Span a large range of tests as the CPython code always evolves with
# changes that add or remove memory allocations.
for
i
in
range
(
1
,
20
):
rc
,
out
,
err
=
script_helper
.
assert_python_failure
(
"-c"
,
code
%
i
)
self
.
assertIn
(
rc
,
(
1
,
120
))
self
.
assertIn
(
b
'MemoryError'
,
err
)
class
ImportErrorTests
(
unittest
.
TestCase
):
...
...
Misc/NEWS.d/next/Core and Builtins/2017-07-01-15-11-13.bpo-30817.j7ZvN_.rst
0 → 100644
Dosyayı görüntüle @
d5d79545
`PyErr_PrintEx()` clears now the ignored exception that may be raised by
`_PySys_SetObjectId()`, for example when no memory.
Python/pythonrun.c
Dosyayı görüntüle @
d5d79545
...
...
@@ -624,9 +624,15 @@ PyErr_PrintEx(int set_sys_last_vars)
return
;
/* Now we know v != NULL too */
if
(
set_sys_last_vars
)
{
_PySys_SetObjectId
(
&
PyId_last_type
,
exception
);
_PySys_SetObjectId
(
&
PyId_last_value
,
v
);
_PySys_SetObjectId
(
&
PyId_last_traceback
,
tb
);
if
(
_PySys_SetObjectId
(
&
PyId_last_type
,
exception
)
<
0
)
{
PyErr_Clear
();
}
if
(
_PySys_SetObjectId
(
&
PyId_last_value
,
v
)
<
0
)
{
PyErr_Clear
();
}
if
(
_PySys_SetObjectId
(
&
PyId_last_traceback
,
tb
)
<
0
)
{
PyErr_Clear
();
}
}
hook
=
_PySys_GetObjectId
(
&
PyId_excepthook
);
if
(
hook
)
{
...
...
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