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
0067bd68
Kaydet (Commit)
0067bd68
authored
Agu 16, 2008
tarafından
Benjamin Peterson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
add _testcapi.raise_memoryerror to make test_exceptions.test_MemoryError simpler
üst
72dc1ead
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
1 deletion
+13
-1
test_exceptions.py
Lib/test/test_exceptions.py
+2
-1
_testcapimodule.c
Modules/_testcapimodule.c
+11
-0
No files found.
Lib/test/test_exceptions.py
Dosyayı görüntüle @
0067bd68
...
@@ -593,9 +593,10 @@ class ExceptionTests(unittest.TestCase):
...
@@ -593,9 +593,10 @@ class ExceptionTests(unittest.TestCase):
# PyErr_NoMemory always raises the same exception instance.
# PyErr_NoMemory always raises the same exception instance.
# Check that the traceback is not doubled.
# Check that the traceback is not doubled.
import
traceback
import
traceback
from
_testcapi
import
raise_memoryerror
def
raiseMemError
():
def
raiseMemError
():
try
:
try
:
"a"
*
(
sys
.
maxsize
//
2
)
raise_memoryerror
(
)
except
MemoryError
as
e
:
except
MemoryError
as
e
:
tb
=
e
.
__traceback__
tb
=
e
.
__traceback__
else
:
else
:
...
...
Modules/_testcapimodule.c
Dosyayı görüntüle @
0067bd68
...
@@ -971,8 +971,19 @@ exception_print(PyObject *self, PyObject *args)
...
@@ -971,8 +971,19 @@ exception_print(PyObject *self, PyObject *args)
/* reliably raise a MemoryError */
static
PyObject
*
raise_memoryerror
(
PyObject
*
self
)
{
PyErr_NoMemory
();
return
NULL
;
}
static
PyMethodDef
TestMethods
[]
=
{
static
PyMethodDef
TestMethods
[]
=
{
{
"raise_exception"
,
raise_exception
,
METH_VARARGS
},
{
"raise_exception"
,
raise_exception
,
METH_VARARGS
},
{
"raise_memoryerror"
,
(
PyCFunction
)
raise_memoryerror
,
METH_NOARGS
},
{
"test_config"
,
(
PyCFunction
)
test_config
,
METH_NOARGS
},
{
"test_config"
,
(
PyCFunction
)
test_config
,
METH_NOARGS
},
{
"test_list_api"
,
(
PyCFunction
)
test_list_api
,
METH_NOARGS
},
{
"test_list_api"
,
(
PyCFunction
)
test_list_api
,
METH_NOARGS
},
{
"test_dict_iteration"
,
(
PyCFunction
)
test_dict_iteration
,
METH_NOARGS
},
{
"test_dict_iteration"
,
(
PyCFunction
)
test_dict_iteration
,
METH_NOARGS
},
...
...
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