10000 Merge branch 'master' of https://github.com/python/cpython into master · python/cpython@30dad41 · GitHub
[go: up one dir, main page]

Skip to content

Commit 30dad41

Browse files
author
Ross Rhodes
committed
Merge branch 'master' of https://github.com/python/cpython into master
2 parents efa5de7 + 84402eb commit 30dad41

File tree

13 files changed

+50
-21
lines changed

13 files changed

+50
-21
lines changed

Doc/library/pyexpat.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -665,14 +665,14 @@ The ``errors`` module has the following attributes:
665665

666666
.. data:: codes
667667

668-
A dictionary mapping numeric error codes to their string descriptions.
668+
A dictionary mapping string descriptions to their error codes.
669669

670670
.. versionadded:: 3.2
671671

672672

673673
.. data:: messages
674674

675-
A dictionary mapping string descriptions to their error codes.
675+
A dictionary mapping numeric error codes to their string descriptions.
676676

677677
.. versionadded:: 3.2
678678

Lib/test/test_tcl.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ def test_expr_bignum(self):
449449
else:
450450
self.assertEqual(result, str(i))
451451
self.assertIsInstance(result, str)
452-
if tcl_version < (8, 5): # bignum was added in Tcl 8.5
452+
if get_tk_patchlevel() < (8, 5): # bignum was added in Tcl 8.5
453453
self.assertRaises(TclError, tcl.call, 'expr', str(2**1000))
454454

455455
def test_passing_values(self):

Lib/test/test_urllib2.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1851, 8000 9 +1851,17 @@ def test_parse_proxy(self):
18511851
('ftp', 'joe', 'password', 'proxy.example.com')),
18521852
# Test for no trailing '/' case
18531853
('http://joe:password@proxy.example.com',
1854-
('http', 'joe', 'password', 'proxy.example.com'))
1854+
('http', 'joe', 'password', 'proxy.example.com')),
1855+
# Testcases with '/' character in username, password
1856+
('http://user/name:password@localhost:22',
1857+
('http', 'user/name', 'password', 'localhost:22')),
1858+
('http://username:pass/word@localhost:22',
1859+
('http', 'username', 'pass/word', 'localhost:22')),
1860+
('http://user/name:pass/word@localhost:22',
1861+
('http', 'user/name', 'pass/word', 'localhost:22')),
18551862
]
18561863

1864+
18571865
for tc, expected in parse_proxy_test_cases:
18581866
self.assertEqual(_parse_proxy(tc), expected)
18591867

Lib/tkinter/__init__.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -516,15 +516,11 @@ def trace_vinfo(self):
516516
self._tk.call("trace", "vinfo", self._name))]
517517

518518
def __eq__(self, other):
519-
"""Comparison for equality (==).
520-
521-
Note: if the Variable's master matters to behavior
522-
also compare self._master == other._master
523-
"""
524519
if not isinstance(other, Variable):
525520
return NotImplemented
526-
return self.__class__.__name__ == other.__class__.__name__ \
527-
and self._name == other._name
521+
return (self._name == other._name
522+
and self.__class__.__name__ == other.__class__.__name__
523+
and self._tk == other._tk)
528524

529525

530526
class StringVar(Variable):

Lib/tkinter/font.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def __repr__(self):
107107
def __eq__(self, other):
108108
if not isinstance(other, Font):
109109
return NotImplemented
110-
return self.name == other.name
110+
return self.name == other.name and self._tk == other._tk
111111

112112
def __getitem__(self, key):
113113
return self.cget(key)

Lib/tkinter/test/test_tkinter/test_font.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,22 @@ def test_name(self):
6363
self.assertEqual(self.font.name, fontname)
6464
self.assertEqual(str(self.font), fontname)
6565

66-
def test_eq(self):
66+
def test_equality(self):
6767
font1 = font.Font(root=self.root, name=fontname, exists=True)
6868
font2 = font.Font(root=self.root, name=fontname, exists=True)
6969
self.assertIsNot(font1, font2)
7070
self.assertEqual(font1, font2)
7171
self.assertNotEqual(font1, font1.copy())
72+
7273
self.assertNotEqual(font1, 0)
7374
self.assertEqual(font1, ALWAYS_EQ)
7475

76+
root2 = tkinter.Tk()
77+
self.addCleanup(root2.destroy)
78+
font3 = font.Font(root=root2, name=fontname, exists=True)
79+
self.assertEqual(str(font1), str(font3))
80+
self.assertNotEqual(font1, font3)
81+
7582
def test_measure(self):
7683
self.assertIsInstance(self.font.measure('abc'), int)
7784

Lib/tkinter/test/test_tkinter/test_variables.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,22 +58,32 @@ def test_dont_unset_not_existing(self):
5858
del v2
5959
self.assertFalse(self.info_exists("name"))
6060

61-
def test___eq__(self):
61+
def test_equality(self):
6262
# values doesn't matter, only class and name are checked
6363
v1 = Variable(self.root, name="abc")
6464
v2 = Variable(self.root, name="abc")
6565
self.assertIsNot(v1, v2)
6666
self.assertEqual(v1, v2)
6767

68-
v3 = StringVar(self.root, name="abc")
68+
v3 = Variable(self.root, name="cba")
6969
self.assertNotEqual(v1, v3)
7070

71+
v4 = StringVar(self.root, name="abc")
72+
self.assertEqual(str(v1), str(v4))
73+
self.assertNotEqual(v1, v4)
74+
7175
V = type('Variable', (), {})
7276
self.assertNotEqual(v1, V())
7377

7478
self.assertNotEqual(v1, object())
7579
self.assertEqual(v1, ALWAYS_EQ)
7680

81+
root2 = tkinter.Tk()
82+
self.addCleanup(root2.destroy)
83+
v5 = Variable(root2, name="abc")
84+
self.assertEqual(str(v1), str(v5))
85+
self.assertNotEqual(v1, v5)
86+
7787
def test_invalid_name(self):
7888
with self.assertRaises(TypeError):
7989
Variable(self.root, name=123)

Lib/typing.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1249,7 +1249,7 @@ def _no_init(self, *args, **kwargs):
12491249
raise TypeError('Protocols cannot be instantiated')
12501250

12511251

1252-
def _allow_reckless_class_cheks():
1252+
def _allow_reckless_class_checks():
12531253
"""Allow instance and class checks for special stdlib modules.
12541254
12551255
The abc and functools modules indiscriminately call isinstance() and
@@ -1338,12 +1338,12 @@ def _proto_hook(other):
13381338

13391339
# First, perform various sanity checks.
13401340
if not getattr(cls, '_is_runtime_protocol', False):
1341-
if _allow_reckless_class_cheks():
1341+
if _allow_reckless_class_checks():
13421342
return NotImplemented
13431343
raise TypeError("Instance and class checks can only be used with"
13441344
" @runtime_checkable protocols")
13451345
if not _is_callable_members_only(cls):
1346-
if _allow_reckless_class_cheks():
1346+
if _allow_reckless_class_checks():
13471347
return NotImplemented
13481348
raise TypeError("Protocols with non-method members"
13491349
" don't support issubclass()")

Lib/urllib/request.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -773,7 +773,11 @@ def _parse_proxy(proxy):
773773
raise ValueError("proxy URL with no authority: %r" % proxy)
774774
# We have an authority, so for RFC 3986-compliant URLs (by ss 3.
775775
# and 3.3.), path is empty or starts with '/'
776-
end = r_scheme.find("/", 2)
776+
if '@' in r_scheme:
777+
host_separator = r_scheme.find('@')
778+
end = r_scheme.find("/", host_separator)
779+
else:
780+
end = r_scheme.find("/", 2)
777781
if end == -1:
778782
end = None
779783
authority = r_scheme[2:end]

Misc/NEWS.d/3.8.0a1.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1784,7 +1784,7 @@ instead of an OrderedDict.
17841784
.. nonce: Q0ktFC
17851785
.. section: Library
17861786
1787-
An ExitStack is now used internally within subprocess.POpen to clean up pipe
1787+
An ExitStack is now used internally within subprocess.Popen to clean up pipe
17881788
file handles. No behavior change in normal operation. But if closing one
17891789
handle were ever to cause an exception, the others will now be closed
17901790
instead of leaked. (patch by Giampaolo Rodola)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Allow / character in username, password fields on _PROXY envars.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Fixed equality comparison of :class:`tkinter.Variable` and
2+
:class:`tkinter.font.Font`. Objects which belong to different Tcl
3+
interpreters are now always different, even if they have the same name.

Modules/readline.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ extern char **completion_matches(char *, CPFunction *);
5151
*
5252
* This emulation library is not 100% API compatible with the "real" readline
5353
* and cannot be detected at compile-time,
54-
* hence we use a runtime check to detect if the Python readlinke module is
54+
* hence we use a runtime check to detect if the Python readline module is
5555
* linked to libedit.
5656
*
5757
* Currently there is one known API incompatibility:

0 commit comments

Comments
 (0)
0