Subject | Hash | Author | Date (UTC) |
---|---|---|---|
bpo-29894: Deprecate returning an instance of complex subclass from __complex__. (#798) | 671079ef6063fe227460a6c3114625fb6282bbd0 | Serhiy Storchaka | 2017-03-24 19:28:43 |
bpo-25803: Avoid incorrect errors raised by Path.mkdir(exist_ok=True) (#805) | af7b9ec5c855366feef4c67dc492d64b3baf84ca | Serhiy Storchaka | 2017-03-24 18:51:53 |
bpo-29861: release references to multiprocessing Pool tasks (#743) | 8988945cdc27ffa86ba8c624e095b51c459f5154 | Antoine Pitrou | 2017-03-24 12:52:11 |
bpo-19930: The mode argument of os.makedirs() no longer affects the file (#799) | e304e33c16e060932d1e2cc8a030d42b02b429b5 | Serhiy Storchaka | 2017-03-24 11:27:42 |
doc: Fix small typos in library/multiprocessing (GH-698) | 5619ab2db3a6c62ffaa55e8826cf67b7459fc484 | Sylvain Bellemare | 2017-03-24 08:26:07 |
`make tags` fixes (GH-717) | 8a543c0bc7347d5b333f334d157bf4a7cd33c14a | Alex Dzyoba | 2017-03-24 08:23:43 |
faulthandler: Restore the old sigaltstack during teardown (#777) | 20fbf8accd494fd15b0fc4c84928178c71ead4d1 | Christophe Zeitouny | 2017-03-23 17:14:29 |
Use NULL rather than 0. (#778) | 0b3ec192259a65971001ce8f0de85a9c1e71d9c7 | Serhiy Storchaka | 2017-03-23 15:53:47 |
bpo-6532: Make the thread id an unsigned integer. (#781) | aefa7ebf0ff0f73feee7ab24f4cdcb2014d83ee5 | Serhiy Storchaka | 2017-03-23 13:48:39 |
bpo-29728: Provide socket.TCP_NOTSENT_LOWAT (#477) | 1e2147b9d75a64df370a9393c2b5b9d170dc0afd | Nathaniel J. Smith | 2017-03-23 03:56:55 |
Remove an outdated statement in execution model docs (GH-754) | fad7f1560669af1766c583c7ef242c55d8c8de41 | Ivan Levkivskyi | 2017-03-23 00:54:53 |
doc: minor fix for library/profile (GH-761) | bd3d8ba3b22da0bad018b53a3e6610ae03c5aa49 | INADA Naoki | 2017-03-22 07:56:36 |
fix function name in tabnanny documentation (GH-759) | 75b6cf879fab58c0576d5415eaf38d92bfd678ab | Jelle Zijlstra | 2017-03-22 06:53:57 |
bpo-29859: Fix error messages from return codes for pthread_* calls (GH-741) | d7fa6b259e00fca04dbf816bfcf4115fdda14bb7 | Daniel Birnstiel | 2017-03-21 13:06:06 |
bpo-29865: Use PyXXX_GET_SIZE macros rather than Py_SIZE for concrete types. (#748) | fff9a31a91283c39c363af219e595eab7d4da6f7 | Serhiy Storchaka | 2017-03-21 06:53:25 |
Don't use Py_SIZE for dict object. (#747) | c61ac1642d19f54c7b755098230967ad2e603180 | Serhiy Storchaka | 2017-03-21 06:52:38 |
bpo-27593: Revise git SCM build info. (#744) | 554626ada769abf82a5dabe6966afa4265acb6a6 | Ned Deily | 2017-03-21 03:41:52 |
bpo-29849: fix a memory leak in import_from (GH-712) | 4830f581af57dd305c02c1fd72299ecb5b090eca | Xiang Zhang | 2017-03-21 03:13:42 |
Fix "NotImplentedError" typo in constants documentation (#692) | 05f53735c8912f8df1077e897f052571e13c3496 | zertrin | 2017-03-20 12:24:39 |
bpo-20087: Revert "make the glibc alias table take precedence over the X11 one (#422)" (#713) | df8280838f52d6ec45ba03ef734b0dec8a9c43fb | Benjamin Peterson | 2017-03-20 06:49:43 |
File | Lines added | Lines deleted |
---|---|---|
Lib/test/test_complex.py | 3 | 2 |
Lib/test/test_getargs2.py | 2 | 1 |
Misc/NEWS | 4 | 0 |
Objects/complexobject.c | 19 | 10 |
File Lib/test/test_complex.py changed (mode: 100644) (index cee49343e2..2d883c5348) | |||
... | ... | class ComplexTest(unittest.TestCase): | |
383 | 383 | def __complex__(self): | def __complex__(self): |
384 | 384 | return None | return None |
385 | 385 | ||
386 | self.assertAlmostEqual(complex(complex0(1j)), 42j) | ||
387 | self.assertAlmostEqual(complex(complex1(1j)), 2j) | ||
386 | self.assertEqual(complex(complex0(1j)), 42j) | ||
387 | with self.assertWarns(DeprecationWarning): | ||
388 | self.assertEqual(complex(complex1(1j)), 2j) | ||
388 | 389 | self.assertRaises(TypeError, complex, complex2(1j)) | self.assertRaises(TypeError, complex, complex2(1j)) |
389 | 390 | ||
390 | 391 | @support.requires_IEEE_754 | @support.requires_IEEE_754 |
File Lib/test/test_getargs2.py changed (mode: 100644) (index 8a194aa03d..e5d9aa64ee) | |||
... | ... | class Float_TestCase(unittest.TestCase): | |
408 | 408 | self.assertEqual(getargs_D(ComplexSubclass(7.5+0.25j)), 7.5+0.25j) | self.assertEqual(getargs_D(ComplexSubclass(7.5+0.25j)), 7.5+0.25j) |
409 | 409 | self.assertEqual(getargs_D(ComplexSubclass2(7.5+0.25j)), 7.5+0.25j) | self.assertEqual(getargs_D(ComplexSubclass2(7.5+0.25j)), 7.5+0.25j) |
410 | 410 | self.assertRaises(TypeError, getargs_D, BadComplex()) | self.assertRaises(TypeError, getargs_D, BadComplex()) |
411 | self.assertEqual(getargs_D(BadComplex2()), 4.25+0.5j) | ||
411 | with self.assertWarns(DeprecationWarning): | ||
412 | self.assertEqual(getargs_D(BadComplex2()), 4.25+0.5j) | ||
412 | 413 | self.assertEqual(getargs_D(BadComplex3(7.5+0.25j)), 7.5+0.25j) | self.assertEqual(getargs_D(BadComplex3(7.5+0.25j)), 7.5+0.25j) |
413 | 414 | ||
414 | 415 | for x in (DBL_MIN, -DBL_MIN, DBL_MAX, -DBL_MAX, INF, -INF): | for x in (DBL_MIN, -DBL_MIN, DBL_MAX, -DBL_MAX, INF, -INF): |
File Misc/NEWS changed (mode: 100644) (index 9b0414a8e5..a5653c8524) | |||
... | ... | What's New in Python 3.7.0 alpha 1? | |
10 | 10 | Core and Builtins | Core and Builtins |
11 | 11 | ----------------- | ----------------- |
12 | 12 | ||
13 | - bpo-29894: The deprecation warning is emitted if __complex__ returns an | ||
14 | instance of a strict subclass of complex. In a future versions of Python | ||
15 | this can be an error. | ||
16 | |||
13 | 17 | - bpo-29859: Show correct error messages when any of the pthread_* calls in | - bpo-29859: Show correct error messages when any of the pthread_* calls in |
14 | 18 | thread_pthread.h fails. | thread_pthread.h fails. |
15 | 19 |
File Objects/complexobject.c changed (mode: 100644) (index 773ddb3d7a..5ebb50435e) | |||
... | ... | PyComplex_ImagAsDouble(PyObject *op) | |
274 | 274 | } | } |
275 | 275 | ||
276 | 276 | static PyObject * | static PyObject * |
277 | try_complex_special_method(PyObject *op) { | ||
277 | try_complex_special_method(PyObject *op) | ||
278 | { | ||
278 | 279 | PyObject *f; | PyObject *f; |
279 | 280 | _Py_IDENTIFIER(__complex__); | _Py_IDENTIFIER(__complex__); |
280 | 281 | ||
... | ... | try_complex_special_method(PyObject *op) { | |
282 | 283 | if (f) { | if (f) { |
283 | 284 | PyObject *res = _PyObject_CallNoArg(f); | PyObject *res = _PyObject_CallNoArg(f); |
284 | 285 | Py_DECREF(f); | Py_DECREF(f); |
285 | if (res != NULL && !PyComplex_Check(res)) { | ||
286 | PyErr_SetString(PyExc_TypeError, | ||
287 | "__complex__ should return a complex object"); | ||
286 | if (!res || PyComplex_CheckExact(res)) { | ||
287 | return res; | ||
288 | } | ||
289 | if (!PyComplex_Check(res)) { | ||
290 | PyErr_Format(PyExc_TypeError, | ||
291 | "__complex__ returned non-complex (type %.200s)", | ||
292 | res->ob_type->tp_name); | ||
293 | Py_DECREF(res); | ||
294 | return NULL; | ||
295 | } | ||
296 | /* Issue #29894: warn if 'res' not of exact type complex. */ | ||
297 | if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1, | ||
298 | "__complex__ returned non-complex (type %.200s). " | ||
299 | "The ability to return an instance of a strict subclass of complex " | ||
300 | "is deprecated, and may be removed in a future version of Python.", | ||
301 | res->ob_type->tp_name)) { | ||
288 | 302 | Py_DECREF(res); | Py_DECREF(res); |
289 | 303 | return NULL; | return NULL; |
290 | 304 | } | } |
... | ... | complex_new_impl(PyTypeObject *type, PyObject *r, PyObject *i) | |
1030 | 1044 | } | } |
1031 | 1045 | if (tmp == NULL) | if (tmp == NULL) |
1032 | 1046 | return NULL; | return NULL; |
1033 | if (!PyFloat_Check(tmp)) { | ||
1034 | PyErr_SetString(PyExc_TypeError, | ||
1035 | "float(r) didn't return a float"); | ||
1036 | Py_DECREF(tmp); | ||
1037 | return NULL; | ||
1038 | } | ||
1047 | assert(PyFloat_Check(tmp)); | ||
1039 | 1048 | cr.real = PyFloat_AsDouble(tmp); | cr.real = PyFloat_AsDouble(tmp); |
1040 | 1049 | cr.imag = 0.0; | cr.imag = 0.0; |
1041 | 1050 | Py_DECREF(tmp); | Py_DECREF(tmp); |