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
527bf3a8
Kaydet (Commit)
527bf3a8
authored
Şub 06, 2008
tarafından
Thomas Heller
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fix the way methods are created for the _ctypes.COMError exception
type; this fix is already in the trunk.
üst
e69f2bdb
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
9 deletions
+36
-9
test_win32.py
Lib/ctypes/test/test_win32.py
+13
-0
NEWS
Misc/NEWS
+4
-0
_ctypes.c
Modules/_ctypes/_ctypes.c
+19
-9
No files found.
Lib/ctypes/test/test_win32.py
Dosyayı görüntüle @
527bf3a8
...
...
@@ -37,6 +37,19 @@ if sys.platform == "win32":
# are trapped and raise an exception.
self
.
assertRaises
(
WindowsError
,
windll
.
kernel32
.
GetModuleHandleA
,
32
)
class
TestWintypes
(
unittest
.
TestCase
):
def
test_COMError
(
self
):
from
_ctypes
import
COMError
self
.
assertEqual
(
COMError
.
__doc__
,
"Raised when a COM method call failed."
)
ex
=
COMError
(
-
1
,
"text"
,
(
"details"
,))
self
.
assertEqual
(
ex
.
hresult
,
-
1
)
self
.
assertEqual
(
ex
.
text
,
"text"
)
self
.
assertEqual
(
ex
.
details
,
(
"details"
,))
self
.
assertEqual
((
ex
.
hresult
,
ex
.
text
,
ex
.
details
),
ex
[:])
class
Structures
(
unittest
.
TestCase
):
def
test_struct_by_value
(
self
):
...
...
Misc/NEWS
Dosyayı görüntüle @
527bf3a8
...
...
@@ -80,6 +80,10 @@ Core and builtins
Library
-------
- Fixed _ctypes.COMError so that it must be called with exactly three
arguments, instances now have the hresult, text, and details
instance variables.
- #1507247, #2004: tarfile.py: Use mode 0700 for temporary directories and
default permissions for missing directories.
...
...
Modules/_ctypes/_ctypes.c
Dosyayı görüntüle @
527bf3a8
...
...
@@ -4520,32 +4520,42 @@ create_comerror(void)
PyObject
*
s
;
int
status
;
ComError
=
PyErr_NewException
(
"_ctypes.COMError"
,
NULL
,
dict
);
if
(
ComError
==
NULL
)
if
(
dict
==
NULL
)
return
-
1
;
while
(
methods
->
ml_name
)
{
/* get a wrapper for the built-in function */
PyObject
*
func
=
PyCFunction_New
(
methods
,
NULL
);
PyObject
*
meth
;
if
(
func
==
NULL
)
return
-
1
;
goto
error
;
meth
=
PyMethod_New
(
func
,
NULL
,
ComError
);
Py_DECREF
(
func
);
if
(
meth
==
NULL
)
return
-
1
;
goto
error
;
PyDict_SetItemString
(
dict
,
methods
->
ml_name
,
meth
);
Py_DECREF
(
meth
);
++
methods
;
}
Py_INCREF
(
ComError
);
s
=
PyString_FromString
(
comerror_doc
);
if
(
s
==
NULL
)
return
-
1
;
goto
error
;
status
=
PyDict_SetItemString
(
dict
,
"__doc__"
,
s
);
Py_DECREF
(
s
);
return
status
;
if
(
status
==
-
1
)
goto
error
;
ComError
=
PyErr_NewException
(
"_ctypes.COMError"
,
NULL
,
dict
);
if
(
ComError
==
NULL
)
goto
error
;
return
0
;
error:
Py_DECREF
(
dict
);
return
-
1
;
}
#endif
...
...
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