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
2cb46617
Kaydet (Commit)
2cb46617
authored
Mar 20, 2018
tarafından
Matt Eaton
Kaydeden (comit)
Berker Peksag
Mar 20, 2018
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
bpo-33034: Improve exception message when cast fails for {Parse,Split}Result.port (GH-6078)
üst
7389fd93
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
1 deletion
+18
-1
test_urlparse.py
Lib/test/test_urlparse.py
+10
-0
parse.py
Lib/urllib/parse.py
+5
-1
2018-03-11-08-44-12.bpo-33034.bpb23d.rst
...S.d/next/Library/2018-03-11-08-44-12.bpo-33034.bpb23d.rst
+3
-0
No files found.
Lib/test/test_urlparse.py
Dosyayı görüntüle @
2cb46617
...
...
@@ -936,6 +936,16 @@ class UrlParseTestCase(unittest.TestCase):
self
.
assertEqual
(
p2
.
scheme
,
'tel'
)
self
.
assertEqual
(
p2
.
path
,
'+31641044153'
)
def
test_port_casting_failure_message
(
self
):
message
=
"Port could not be cast to integer value as 'oracle'"
p1
=
urllib
.
parse
.
urlparse
(
'http://Server=sde; Service=sde:oracle'
)
with
self
.
assertRaisesRegex
(
ValueError
,
message
):
p1
.
port
p2
=
urllib
.
parse
.
urlsplit
(
'http://Server=sde; Service=sde:oracle'
)
with
self
.
assertRaisesRegex
(
ValueError
,
message
):
p2
.
port
def
test_telurl_params
(
self
):
p1
=
urllib
.
parse
.
urlparse
(
'tel:123-4;phone-context=+1-650-516'
)
self
.
assertEqual
(
p1
.
scheme
,
'tel'
)
...
...
Lib/urllib/parse.py
Dosyayı görüntüle @
2cb46617
...
...
@@ -166,7 +166,11 @@ class _NetlocResultMixinBase(object):
def
port
(
self
):
port
=
self
.
_hostinfo
[
1
]
if
port
is
not
None
:
port
=
int
(
port
,
10
)
try
:
port
=
int
(
port
,
10
)
except
ValueError
:
message
=
f
'Port could not be cast to integer value as {port!r}'
raise
ValueError
(
message
)
from
None
if
not
(
0
<=
port
<=
65535
):
raise
ValueError
(
"Port out of range 0-65535"
)
return
port
...
...
Misc/NEWS.d/next/Library/2018-03-11-08-44-12.bpo-33034.bpb23d.rst
0 → 100644
Dosyayı görüntüle @
2cb46617
Providing an explicit error message when casting the port property to anything
that is not an integer value using ``urlparse()`` and ``urlsplit()``.
Patch by Matt Eaton.
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