Subject | Hash | Author | Date (UTC) |
---|---|---|---|
bpo-24329: allow __qualname__ and __classcell__ in __slots__ (GH-495) | c393ee858932f79bd6dabf31550f9a53ea90bc68 | Xiang Zhang | 2017-03-08 03:18:49 |
bpo-26915: Test identity first in membership operation in index() and count() methods of collections.abc.Sequence (GH-503) | d5d3249e8a37936d32266fa06ac20017307a1f70 | Xiang Zhang | 2017-03-08 03:04:24 |
bpo-28682: Added support for bytes paths in os.fwalk(). (#489) | 8f6b344d368c15c3fe56c65c2f2776e7766fef55 | Serhiy Storchaka | 2017-03-07 12:33:21 |
PCbuild: Add -q option to svn export (GH-535) | 8886d5f39286dffa7d9337857b151e7fb4af23fd | INADA Naoki | 2017-03-07 06:34:38 |
bpo-29676: fix lsprof can't profile C method call. (GH523) | 93fac8dd358cd0e85e7b59115db226ce685d3f6f | INADA Naoki | 2017-03-07 05:24:37 |
bpo-28728: clarify possible test failure due to ISP (GH-412) | d36a71637cefdddc02efd884f1b2c204f370afaa | Xiang Zhang | 2017-03-07 03:06:09 |
Exclude myself from mention-bot (#529) | fea967658d2dff1e2afc45311e1ee6a40e3176c2 | Victor Stinner | 2017-03-07 01:51:47 |
bpo-29737: Optimize concatenating with empty tuple. (#524) | 98e80c2babac0003182c3482c6c5437ea111e795 | Serhiy Storchaka | 2017-03-06 21:39:35 |
bpo-15954: Check return code of wcsxfrm(). (#508) | be487a65f18e1be5fde03e2977fff4be53cc2fbf | Serhiy Storchaka | 2017-03-06 19:21:41 |
bpo-29695: Fixed tests after removing keyword args support in some basic type constructors. (GH-520) | d908fd9ee1c307f7066023eb2031c0f509036cbc | Serhiy Storchaka | 2017-03-06 19:08:59 |
Ignore What's New for MentionBot (GH-521) | 0f5f1c3055e4c5b3d6165f56507bae6e16af7ca8 | Matthias Bussonnier | 2017-03-06 18:56:58 |
The mention-bot is too exuberant for my taste. (#522) | 4e0f612a1fc8444fe4fef3231f6934379e302a26 | Stefan Krah | 2017-03-06 17:28:29 |
bpo-29695: Remove bad keyword parameters in int(), bool(), float(), list() and tuple(). (#518) | 2e5642422f6234fd8d0c082142b27340e588f96e | Serhiy Storchaka | 2017-03-06 15:01:06 |
bpo-29714: Fix a regression that bytes format may fail when containing zero bytes inside. (GH-499) | b76ad5121e2cfa89d6476d700cbcb65b7ffc39ac | Xiang Zhang | 2017-03-06 09:17:05 |
remove 3 redundant casts in Objects/longobject.c (#445) | 86aa269646fa73bbcbc26f45ed854359d04c1fde | orenmn | 2017-03-06 08:42:47 |
bpo-29719: Remove Date and Release field in whatsnew/3.6 (GH-494) | 2225ddaa9e64c086b2b6997b0c9ac50921f7aa85 | INADA Naoki | 2017-03-06 06:41:59 |
Fixes the upload script to purge the CDN correctly and display success output. (#466) | f6e61019ae6b2517c8eb7755f75e4de95355be38 | Steve Dower | 2017-03-06 03:55:12 |
bpo-29695: Deprecated using bad named keyword arguments in builtings: (#486) | 58d23e68068996c76cac78887ec67dee68cdbc72 | Serhiy Storchaka | 2017-03-05 22:53:39 |
Add Appveyor (GH-324) | d31b28e16a2387d0251df948ef5d1b33d4357652 | Zachary Ware | 2017-03-05 21:45:53 |
bpo-29638: Fix spurious refleaks after typing is imported (#469) | 7acffa23c9e7866e5b4b98b8f3c28b14ec1c688c | Ivan Levkivskyi | 2017-03-05 18:15:20 |
File | Lines added | Lines deleted |
---|---|---|
Lib/test/test_descr.py | 40 | 0 |
Objects/typeobject.c | 11 | 5 |
File Lib/test/test_descr.py changed (mode: 100644) (index 5da7ae598c..92553e3573) | |||
... | ... | order (MRO) for bases """ | |
1322 | 1322 | a.foo = 42 | a.foo = 42 |
1323 | 1323 | self.assertEqual(a.__dict__, {"foo": 42}) | self.assertEqual(a.__dict__, {"foo": 42}) |
1324 | 1324 | ||
1325 | def test_slots_special2(self): | ||
1326 | # Testing __qualname__ and __classcell__ in __slots__ | ||
1327 | class Meta(type): | ||
1328 | def __new__(cls, name, bases, namespace, attr): | ||
1329 | self.assertIn(attr, namespace) | ||
1330 | return super().__new__(cls, name, bases, namespace) | ||
1331 | |||
1332 | class C1: | ||
1333 | def __init__(self): | ||
1334 | self.b = 42 | ||
1335 | class C2(C1, metaclass=Meta, attr="__classcell__"): | ||
1336 | __slots__ = ["__classcell__"] | ||
1337 | def __init__(self): | ||
1338 | super().__init__() | ||
1339 | self.assertIsInstance(C2.__dict__["__classcell__"], | ||
1340 | types.MemberDescriptorType) | ||
1341 | c = C2() | ||
1342 | self.assertEqual(c.b, 42) | ||
1343 | self.assertNotHasAttr(c, "__classcell__") | ||
1344 | c.__classcell__ = 42 | ||
1345 | self.assertEqual(c.__classcell__, 42) | ||
1346 | with self.assertRaises(TypeError): | ||
1347 | class C3: | ||
1348 | __classcell__ = 42 | ||
1349 | __slots__ = ["__classcell__"] | ||
1350 | |||
1351 | class Q1(metaclass=Meta, attr="__qualname__"): | ||
1352 | __slots__ = ["__qualname__"] | ||
1353 | self.assertEqual(Q1.__qualname__, C1.__qualname__[:-2] + "Q1") | ||
1354 | self.assertIsInstance(Q1.__dict__["__qualname__"], | ||
1355 | types.MemberDescriptorType) | ||
1356 | q = Q1() | ||
1357 | self.assertNotHasAttr(q, "__qualname__") | ||
1358 | q.__qualname__ = "q" | ||
1359 | self.assertEqual(q.__qualname__, "q") | ||
1360 | with self.assertRaises(TypeError): | ||
1361 | class Q2: | ||
1362 | __qualname__ = object() | ||
1363 | __slots__ = ["__qualname__"] | ||
1364 | |||
1325 | 1365 | def test_slots_descriptor(self): | def test_slots_descriptor(self): |
1326 | 1366 | # Issue2115: slot descriptors did not correctly check | # Issue2115: slot descriptors did not correctly check |
1327 | 1367 | # the type of the given object | # the type of the given object |
File Objects/typeobject.c changed (mode: 100644) (index 18b67c8325..d70ced04bf) | |||
... | ... | type_new(PyTypeObject *metatype, PyObject *args, PyObject *kwds) | |
2478 | 2478 | } | } |
2479 | 2479 | PyList_SET_ITEM(newslots, j, tmp); | PyList_SET_ITEM(newslots, j, tmp); |
2480 | 2480 | if (PyDict_GetItem(dict, tmp)) { | if (PyDict_GetItem(dict, tmp)) { |
2481 | PyErr_Format(PyExc_ValueError, | ||
2482 | "%R in __slots__ conflicts with class variable", | ||
2483 | tmp); | ||
2484 | Py_DECREF(newslots); | ||
2485 | goto error; | ||
2481 | /* CPython inserts __qualname__ and __classcell__ (when needed) | ||
2482 | into the namespace when creating a class. They will be deleted | ||
2483 | below so won't act as class variables. */ | ||
2484 | if (!_PyUnicode_EqualToASCIIId(tmp, &PyId___qualname__) && | ||
2485 | !_PyUnicode_EqualToASCIIId(tmp, &PyId___classcell__)) { | ||
2486 | PyErr_Format(PyExc_ValueError, | ||
2487 | "%R in __slots__ conflicts with class variable", | ||
2488 | tmp); | ||
2489 | Py_DECREF(newslots); | ||
2490 | goto error; | ||
2491 | } | ||
2486 | 2492 | } | } |
2487 | 2493 | j++; | j++; |
2488 | 2494 | } | } |