Compare commits
7 Commits
0b43778b3c
...
3966e2ea41
Author | SHA1 | Date |
---|---|---|
Miss Islington (bot) | 3966e2ea41 | |
Miss Islington (bot) | cc7f745e80 | |
Miss Islington (bot) | df794406a8 | |
Miss Islington (bot) | 1ceb097cec | |
Miss Islington (bot) | 71d73900eb | |
Miss Islington (bot) | 578caafabe | |
Miss Islington (bot) | 7bdb3e0825 |
|
@ -1219,7 +1219,7 @@ Instance methods:
|
|||
|
||||
.. method:: datetime.replace(year=self.year, month=self.month, day=self.day, \
|
||||
hour=self.hour, minute=self.minute, second=self.second, microsecond=self.microsecond, \
|
||||
tzinfo=self.tzinfo, * fold=0)
|
||||
tzinfo=self.tzinfo, *, fold=0)
|
||||
|
||||
Return a datetime with the same attributes, except for those attributes given
|
||||
new values by whichever keyword arguments are specified. Note that
|
||||
|
@ -1783,7 +1783,7 @@ Other constructor:
|
|||
Instance methods:
|
||||
|
||||
.. method:: time.replace(hour=self.hour, minute=self.minute, second=self.second, \
|
||||
microsecond=self.microsecond, tzinfo=self.tzinfo, * fold=0)
|
||||
microsecond=self.microsecond, tzinfo=self.tzinfo, *, fold=0)
|
||||
|
||||
Return a :class:`.time` with the same value, except for those attributes given
|
||||
new values by whichever keyword arguments are specified. Note that
|
||||
|
|
|
@ -116,7 +116,7 @@ Currently the email package provides only one concrete content manager,
|
|||
decoding the payload to unicode. The default error handler is
|
||||
``replace``.
|
||||
|
||||
.. method:: set_content(msg, <'str'>, subtype="plain", charset='utf-8' \
|
||||
.. method:: set_content(msg, <'str'>, subtype="plain", charset='utf-8', \
|
||||
cte=None, \
|
||||
disposition=None, filename=None, cid=None, \
|
||||
params=None, headers=None)
|
||||
|
|
|
@ -665,14 +665,14 @@ The ``errors`` module has the following attributes:
|
|||
|
||||
.. data:: codes
|
||||
|
||||
A dictionary mapping numeric error codes to their string descriptions.
|
||||
A dictionary mapping string descriptions to their error codes.
|
||||
|
||||
.. versionadded:: 3.2
|
||||
|
||||
|
||||
.. data:: messages
|
||||
|
||||
A dictionary mapping string descriptions to their error codes.
|
||||
A dictionary mapping numeric error codes to their string descriptions.
|
||||
|
||||
.. versionadded:: 3.2
|
||||
|
||||
|
|
|
@ -447,7 +447,7 @@ class TclTest(unittest.TestCase):
|
|||
else:
|
||||
self.assertEqual(result, str(i))
|
||||
self.assertIsInstance(result, str)
|
||||
if tcl_version < (8, 5): # bignum was added in Tcl 8.5
|
||||
if get_tk_patchlevel() < (8, 5): # bignum was added in Tcl 8.5
|
||||
self.assertRaises(TclError, tcl.call, 'expr', str(2**1000))
|
||||
|
||||
def test_passing_values(self):
|
||||
|
|
|
@ -1849,9 +1849,17 @@ class MiscTests(unittest.TestCase):
|
|||
('ftp', 'joe', 'password', 'proxy.example.com')),
|
||||
# Test for no trailing '/' case
|
||||
('http://joe:password@proxy.example.com',
|
||||
('http', 'joe', 'password', 'proxy.example.com'))
|
||||
('http', 'joe', 'password', 'proxy.example.com')),
|
||||
# Testcases with '/' character in username, password
|
||||
('http://user/name:password@localhost:22',
|
||||
('http', 'user/name', 'password', 'localhost:22')),
|
||||
('http://username:pass/word@localhost:22',
|
||||
('http', 'username', 'pass/word', 'localhost:22')),
|
||||
('http://user/name:pass/word@localhost:22',
|
||||
('http', 'user/name', 'pass/word', 'localhost:22')),
|
||||
]
|
||||
|
||||
|
||||
for tc, expected in parse_proxy_test_cases:
|
||||
self.assertEqual(_parse_proxy(tc), expected)
|
||||
|
||||
|
|
|
@ -491,15 +491,11 @@ class Variable:
|
|||
self._tk.call("trace", "vinfo", self._name))]
|
||||
|
||||
def __eq__(self, other):
|
||||
"""Comparison for equality (==).
|
||||
|
||||
Note: if the Variable's master matters to behavior
|
||||
also compare self._master == other._master
|
||||
"""
|
||||
if not isinstance(other, Variable):
|
||||
return NotImplemented
|
||||
return self.__class__.__name__ == other.__class__.__name__ \
|
||||
and self._name == other._name
|
||||
return (self._name == other._name
|
||||
and self.__class__.__name__ == other.__class__.__name__
|
||||
and self._tk == other._tk)
|
||||
|
||||
|
||||
class StringVar(Variable):
|
||||
|
|
|
@ -103,7 +103,7 @@ class Font:
|
|||
def __eq__(self, other):
|
||||
if not isinstance(other, Font):
|
||||
return NotImplemented
|
||||
return self.name == other.name
|
||||
return self.name == other.name and self._tk == other._tk
|
||||
|
||||
def __getitem__(self, key):
|
||||
return self.cget(key)
|
||||
|
|
|
@ -63,15 +63,22 @@ class FontTest(AbstractTkTest, unittest.TestCase):
|
|||
self.assertEqual(self.font.name, fontname)
|
||||
self.assertEqual(str(self.font), fontname)
|
||||
|
||||
def test_eq(self):
|
||||
def test_equality(self):
|
||||
font1 = font.Font(root=self.root, name=fontname, exists=True)
|
||||
font2 = font.Font(root=self.root, name=fontname, exists=True)
|
||||
self.assertIsNot(font1, font2)
|
||||
self.assertEqual(font1, font2)
|
||||
self.assertNotEqual(font1, font1.copy())
|
||||
|
||||
self.assertNotEqual(font1, 0)
|
||||
self.assertEqual(font1, ALWAYS_EQ)
|
||||
|
||||
root2 = tkinter.Tk()
|
||||
self.addCleanup(root2.destroy)
|
||||
font3 = font.Font(root=root2, name=fontname, exists=True)
|
||||
self.assertEqual(str(font1), str(font3))
|
||||
self.assertNotEqual(font1, font3)
|
||||
|
||||
def test_measure(self):
|
||||
self.assertIsInstance(self.font.measure('abc'), int)
|
||||
|
||||
|
|
|
@ -58,22 +58,32 @@ class TestVariable(TestBase):
|
|||
del v2
|
||||
self.assertFalse(self.info_exists("name"))
|
||||
|
||||
def test___eq__(self):
|
||||
def test_equality(self):
|
||||
# values doesn't matter, only class and name are checked
|
||||
v1 = Variable(self.root, name="abc")
|
||||
v2 = Variable(self.root, name="abc")
|
||||
self.assertIsNot(v1, v2)
|
||||
self.assertEqual(v1, v2)
|
||||
|
||||
v3 = StringVar(self.root, name="abc")
|
||||
v3 = Variable(self.root, name="cba")
|
||||
self.assertNotEqual(v1, v3)
|
||||
|
||||
v4 = StringVar(self.root, name="abc")
|
||||
self.assertEqual(str(v1), str(v4))
|
||||
self.assertNotEqual(v1, v4)
|
||||
|
||||
V = type('Variable', (), {})
|
||||
self.assertNotEqual(v1, V())
|
||||
|
||||
self.assertNotEqual(v1, object())
|
||||
self.assertEqual(v1, ALWAYS_EQ)
|
||||
|
||||
root2 = tkinter.Tk()
|
||||
self.addCleanup(root2.destroy)
|
||||
v5 = Variable(root2, name="abc")
|
||||
self.assertEqual(str(v1), str(v5))
|
||||
self.assertNotEqual(v1, v5)
|
||||
|
||||
def test_invalid_name(self):
|
||||
with self.assertRaises(TypeError):
|
||||
Variable(self.root, name=123)
|
||||
|
|
|
@ -771,6 +771,10 @@ def _parse_proxy(proxy):
|
|||
raise ValueError("proxy URL with no authority: %r" % proxy)
|
||||
# We have an authority, so for RFC 3986-compliant URLs (by ss 3.
|
||||
# and 3.3.), path is empty or starts with '/'
|
||||
if '@' in r_scheme:
|
||||
host_separator = r_scheme.find('@')
|
||||
end = r_scheme.find("/", host_separator)
|
||||
else:
|
||||
end = r_scheme.find("/", 2)
|
||||
if end == -1:
|
||||
end = None
|
||||
|
|
|
@ -475,7 +475,7 @@ compression header.
|
|||
|
||||
..
|
||||
|
||||
.. bpo: 16936
|
||||
.. bpo: 16396
|
||||
.. date: 2020-07-08-09-45-00
|
||||
.. nonce: z8o8Pn
|
||||
.. section: Library
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
:mod:`subprocess` *extra_groups* is now correctly passed into setgroups()
|
||||
system call.
|
|
@ -0,0 +1 @@
|
|||
Allow / character in username, password fields on _PROXY envars.
|
|
@ -0,0 +1,3 @@
|
|||
Fixed equality comparison of :class:`tkinter.Variable` and
|
||||
:class:`tkinter.font.Font`. Objects which belong to different Tcl
|
||||
interpreters are now always different, even if they have the same name.
|
|
@ -753,7 +753,7 @@ subprocess_fork_exec(PyObject* self, PyObject *args)
|
|||
if (groups_list != Py_None) {
|
||||
#ifdef HAVE_SETGROUPS
|
||||
Py_ssize_t i;
|
||||
unsigned long gid;
|
||||
gid_t gid;
|
||||
|
||||
if (!PyList_Check(groups_list)) {
|
||||
PyErr_SetString(PyExc_TypeError,
|
||||
|
@ -787,10 +787,6 @@ subprocess_fork_exec(PyObject* self, PyObject *args)
|
|||
Py_DECREF(elem);
|
||||
goto cleanup;
|
||||
} else {
|
||||
/* In posixmodule.c UnsignedLong is used as a fallback value
|
||||
* if the value provided does not fit in a Long. Since we are
|
||||
* already doing the bounds checking on the Python side, we
|
||||
* can go directly to an UnsignedLong here. */
|
||||
if (!_Py_Gid_Converter(elem, &gid)) {
|
||||
Py_DECREF(elem);
|
||||
PyErr_SetString(PyExc_ValueError, "invalid group id");
|
||||
|
|
|
@ -632,7 +632,7 @@ _PyLong_FromGid(gid_t gid)
|
|||
}
|
||||
|
||||
int
|
||||
_Py_Uid_Converter(PyObject *obj, void *p)
|
||||
_Py_Uid_Converter(PyObject *obj, uid_t *p)
|
||||
{
|
||||
uid_t uid;
|
||||
PyObject *index;
|
||||
|
@ -719,7 +719,7 @@ _Py_Uid_Converter(PyObject *obj, void *p)
|
|||
|
||||
success:
|
||||
Py_DECREF(index);
|
||||
*(uid_t *)p = uid;
|
||||
*p = uid;
|
||||
return 1;
|
||||
|
||||
underflow:
|
||||
|
@ -738,7 +738,7 @@ fail:
|
|||
}
|
||||
|
||||
int
|
||||
_Py_Gid_Converter(PyObject *obj, void *p)
|
||||
_Py_Gid_Converter(PyObject *obj, gid_t *p)
|
||||
{
|
||||
gid_t gid;
|
||||
PyObject *index;
|
||||
|
@ -826,7 +826,7 @@ _Py_Gid_Converter(PyObject *obj, void *p)
|
|||
|
||||
success:
|
||||
Py_DECREF(index);
|
||||
*(gid_t *)p = gid;
|
||||
*p = gid;
|
||||
return 1;
|
||||
|
||||
underflow:
|
||||
|
|
|
@ -14,8 +14,8 @@ extern "C" {
|
|||
#ifndef MS_WINDOWS
|
||||
PyAPI_FUNC(PyObject *) _PyLong_FromUid(uid_t);
|
||||
PyAPI_FUNC(PyObject *) _PyLong_FromGid(gid_t);
|
||||
PyAPI_FUNC(int) _Py_Uid_Converter(PyObject *, void *);
|
||||
PyAPI_FUNC(int) _Py_Gid_Converter(PyObject *, void *);
|
||||
PyAPI_FUNC(int) _Py_Uid_Converter(PyObject *, uid_t *);
|
||||
PyAPI_FUNC(int) _Py_Gid_Converter(PyObject *, gid_t *);
|
||||
#endif /* MS_WINDOWS */
|
||||
|
||||
#if defined(PYPTHREAD_SIGMASK) || defined(HAVE_SIGWAIT) || \
|
||||
|
|
Loading…
Reference in New Issue