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
1399a01b
Kaydet (Commit)
1399a01b
authored
Nis 02, 2015
tarafından
Serhiy Storchaka
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Issue #22977: Fixed formatting Windows error messages on Wine.
Patch by Martin Panter.
üst
4b9df0d3
f41f8f99
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
3 deletions
+14
-3
test_exceptions.py
Lib/test/test_exceptions.py
+9
-1
NEWS
Misc/NEWS
+3
-0
errors.c
Python/errors.c
+2
-2
No files found.
Lib/test/test_exceptions.py
Dosyayı görüntüle @
1399a01b
...
...
@@ -6,10 +6,11 @@ import unittest
import
pickle
import
weakref
import
errno
import
ctypes
from
test.support
import
(
TESTFN
,
captured_output
,
check_impl_detail
,
check_warnings
,
cpython_only
,
gc_collect
,
run_unittest
,
no_tracing
,
unlink
)
no_tracing
,
unlink
,
get_attribute
)
class
NaiveException
(
Exception
):
def
__init__
(
self
,
x
):
...
...
@@ -245,6 +246,13 @@ class ExceptionTests(unittest.TestCase):
self
.
assertEqual
(
w
.
strerror
,
'foo'
)
self
.
assertEqual
(
w
.
filename
,
None
)
def
test_windows_message
(
self
):
"""Should fill in unknown error code in Windows error message"""
windll
=
get_attribute
(
ctypes
,
"windll"
)
code
=
int
.
from_bytes
(
b
"
\xE0
msc"
,
"big"
)
with
self
.
assertRaisesRegex
(
OSError
,
hex
(
code
)):
windll
.
kernel32
.
RaiseException
(
code
,
0
,
0
,
None
)
def
testAttributes
(
self
):
# test that exception attributes are happy
...
...
Misc/NEWS
Dosyayı görüntüle @
1399a01b
...
...
@@ -10,6 +10,9 @@ Release date: XXX
Core and Builtins
-----------------
- Issue #22977: Fixed formatting Windows error messages on Wine.
Patch by Martin Panter.
Library
-------
...
...
Python/errors.c
Dosyayı görüntüle @
1399a01b
...
...
@@ -491,7 +491,7 @@ PyErr_SetFromErrnoWithFilenameObjects(PyObject *exc, PyObject *filenameObject, P
/* Only ever seen this in out-of-mem
situations */
s_buf
=
NULL
;
message
=
PyUnicode_FromFormat
(
"Windows Error 0x%
X
"
,
i
);
message
=
PyUnicode_FromFormat
(
"Windows Error 0x%
x
"
,
i
);
}
else
{
/* remove trailing cr/lf and dots */
while
(
len
>
0
&&
(
s_buf
[
len
-
1
]
<=
L' '
||
s_buf
[
len
-
1
]
==
L'.'
))
...
...
@@ -600,7 +600,7 @@ PyObject *PyErr_SetExcFromWindowsErrWithFilenameObjects(
NULL
);
/* no args */
if
(
len
==
0
)
{
/* Only seen this in out of mem situations */
message
=
PyUnicode_FromFormat
(
"Windows Error 0x%
X
"
,
err
);
message
=
PyUnicode_FromFormat
(
"Windows Error 0x%
x
"
,
err
);
s_buf
=
NULL
;
}
else
{
/* remove trailing cr/lf and dots */
...
...
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