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
d7e9f608
Kaydet (Commit)
d7e9f608
authored
Agu 21, 2007
tarafından
Georg Brandl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Revert accidental checkins from last commit.
üst
fdca6d85
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
58 deletions
+7
-58
test_exceptions.py
Lib/test/test_exceptions.py
+1
-16
exceptions.c
Objects/exceptions.c
+6
-32
import.c
Python/import.c
+0
-10
No files found.
Lib/test/test_exceptions.py
Dosyayı görüntüle @
d7e9f608
...
@@ -9,16 +9,6 @@ from test.test_support import (TESTFN, unlink, run_unittest,
...
@@ -9,16 +9,6 @@ from test.test_support import (TESTFN, unlink, run_unittest,
catch_warning
)
catch_warning
)
from
test.test_pep352
import
ignore_message_warning
from
test.test_pep352
import
ignore_message_warning
class
NaiveException
(
Exception
):
def
__init__
(
self
,
x
):
self
.
x
=
x
class
SomewhatNaiveException
(
Exception
):
def
__init__
(
self
,
x
):
self
.
x
=
x
Exception
.
__init__
(
self
)
# XXX This is not really enough, each *operation* should be tested!
# XXX This is not really enough, each *operation* should be tested!
class
ExceptionTests
(
unittest
.
TestCase
):
class
ExceptionTests
(
unittest
.
TestCase
):
...
@@ -273,10 +263,6 @@ class ExceptionTests(unittest.TestCase):
...
@@ -273,10 +263,6 @@ class ExceptionTests(unittest.TestCase):
{
'message'
:
''
,
'args'
:
(
u'
\u3042
'
,
0
,
1
,
'ouch'
),
{
'message'
:
''
,
'args'
:
(
u'
\u3042
'
,
0
,
1
,
'ouch'
),
'object'
:
u'
\u3042
'
,
'reason'
:
'ouch'
,
'object'
:
u'
\u3042
'
,
'reason'
:
'ouch'
,
'start'
:
0
,
'end'
:
1
}),
'start'
:
0
,
'end'
:
1
}),
(
NaiveException
,
(
'foo'
,),
{
'message'
:
''
,
'args'
:
(
'foo'
,),
'x'
:
'foo'
}),
(
SomewhatNaiveException
,
(
'foo'
,),
{
'message'
:
''
,
'args'
:
(),
'x'
:
'foo'
}),
]
]
try
:
try
:
exceptionList
.
append
(
exceptionList
.
append
(
...
@@ -297,8 +283,7 @@ class ExceptionTests(unittest.TestCase):
...
@@ -297,8 +283,7 @@ class ExceptionTests(unittest.TestCase):
if
type
(
e
)
is
not
exc
:
if
type
(
e
)
is
not
exc
:
raise
raise
# Verify module name
# Verify module name
if
not
type
(
e
)
.
__name__
.
endswith
(
'NaiveException'
):
self
.
assertEquals
(
type
(
e
)
.
__module__
,
'exceptions'
)
self
.
assertEquals
(
type
(
e
)
.
__module__
,
'exceptions'
)
# Verify no ref leaks in Exc_str()
# Verify no ref leaks in Exc_str()
s
=
str
(
e
)
s
=
str
(
e
)
for
checkArgName
in
expected
:
for
checkArgName
in
expected
:
...
...
Objects/exceptions.c
Dosyayı görüntüle @
d7e9f608
...
@@ -38,31 +38,18 @@ BaseException_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
...
@@ -38,31 +38,18 @@ BaseException_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
/* the dict is created on the fly in PyObject_GenericSetAttr */
/* the dict is created on the fly in PyObject_GenericSetAttr */
self
->
message
=
self
->
dict
=
NULL
;
self
->
message
=
self
->
dict
=
NULL
;
if
(
!
args
)
{
self
->
args
=
PyTuple_New
(
0
);
/* MemoryError instantiation */
if
(
!
self
->
args
)
{
args
=
PyTuple_New
(
0
);
if
(
!
args
)
{
Py_DECREF
(
self
);
return
NULL
;
}
}
else
{
Py_INCREF
(
args
);
}
self
->
args
=
args
;
/* Since the args can be overwritten in __init__, we have to store
the original args somewhere for pickling. */
if
(
PyObject_SetAttrString
((
PyObject
*
)
self
,
"__newargs__"
,
args
)
<
0
)
{
Py_DECREF
(
self
);
Py_DECREF
(
self
);
return
NULL
;
return
NULL
;
}
}
self
->
message
=
PyString_FromString
(
""
);
self
->
message
=
PyString_FromString
(
""
);
if
(
!
self
->
message
)
{
if
(
!
self
->
message
)
{
Py_DECREF
(
self
);
Py_DECREF
(
self
);
return
NULL
;
return
NULL
;
}
}
return
(
PyObject
*
)
self
;
return
(
PyObject
*
)
self
;
}
}
...
@@ -160,23 +147,10 @@ BaseException_repr(PyBaseExceptionObject *self)
...
@@ -160,23 +147,10 @@ BaseException_repr(PyBaseExceptionObject *self)
static
PyObject
*
static
PyObject
*
BaseException_reduce
(
PyBaseExceptionObject
*
self
)
BaseException_reduce
(
PyBaseExceptionObject
*
self
)
{
{
PyObject
*
result
;
PyObject
*
newargs
=
PyObject_GetAttrString
((
PyObject
*
)
self
,
"__newargs__"
);
if
(
!
newargs
)
{
if
(
PyErr_ExceptionMatches
(
PyExc_AttributeError
))
{
PyErr_SetString
(
PyExc_AttributeError
,
"To pickle exceptions via BaseException.__reduce__, "
"you need to set the __newargs__ attribute in your "
"custom __new__ method."
);
}
return
NULL
;
}
if
(
self
->
args
&&
self
->
dict
)
if
(
self
->
args
&&
self
->
dict
)
re
sult
=
PyTuple_Pack
(
3
,
Py_Type
(
self
),
new
args
,
self
->
dict
);
re
turn
PyTuple_Pack
(
3
,
Py_Type
(
self
),
self
->
args
,
self
->
dict
);
else
else
result
=
PyTuple_Pack
(
2
,
Py_Type
(
self
),
newargs
);
return
PyTuple_Pack
(
2
,
Py_Type
(
self
),
self
->
args
);
Py_DECREF
(
newargs
);
return
result
;
}
}
/*
/*
...
...
Python/import.c
Dosyayı görüntüle @
d7e9f608
...
@@ -1395,7 +1395,6 @@ find_module(char *fullname, char *subname, PyObject *path, char *buf,
...
@@ -1395,7 +1395,6 @@ find_module(char *fullname, char *subname, PyObject *path, char *buf,
filemode
=
fdp
->
mode
;
filemode
=
fdp
->
mode
;
if
(
filemode
[
0
]
==
'U'
)
if
(
filemode
[
0
]
==
'U'
)
filemode
=
"r"
PY_STDIOTEXTMODE
;
filemode
=
"r"
PY_STDIOTEXTMODE
;
errno
=
0
;
fp
=
fopen
(
buf
,
filemode
);
fp
=
fopen
(
buf
,
filemode
);
if
(
fp
!=
NULL
)
{
if
(
fp
!=
NULL
)
{
if
(
case_ok
(
buf
,
len
,
namelen
,
name
))
if
(
case_ok
(
buf
,
len
,
namelen
,
name
))
...
@@ -1405,15 +1404,6 @@ find_module(char *fullname, char *subname, PyObject *path, char *buf,
...
@@ -1405,15 +1404,6 @@ find_module(char *fullname, char *subname, PyObject *path, char *buf,
fp
=
NULL
;
fp
=
NULL
;
}
}
}
}
/* issue a warning if the file is there */
/*if (errno != ENOENT) {
char warnstr[MAXPATHLEN+80];
sprintf(warnstr, "Not importing '%.*s': ");
if (PyErr_Warn(PyExc_ImportWarning,
warnstr)) {
}*/
#if defined(PYOS_OS2)
#if defined(PYOS_OS2)
/* restore the saved snapshot */
/* restore the saved snapshot */
strcpy
(
buf
,
saved_buf
);
strcpy
(
buf
,
saved_buf
);
...
...
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