]> granicus.if.org Git - python/commitdiff
Issue #24489: ensure a previously set C errno doesn't disturb cmath.polar().
authorAntoine Pitrou <solipsis@pitrou.net>
Tue, 23 Jun 2015 12:38:13 +0000 (14:38 +0200)
committerAntoine Pitrou <solipsis@pitrou.net>
Tue, 23 Jun 2015 12:38:13 +0000 (14:38 +0200)
1  2 
Lib/test/test_cmath.py
Misc/NEWS
Modules/_testcapimodule.c
Modules/cmathmodule.c

index 25ab7c12cbd65f8da00159f4b653bc4f1637403e,68bf16e51aaabece747e90d3fccf835ef52b6d43..1f884e52a2c9c4a5c074ccce6ee0fdefee8be1c8
@@@ -1,6 -1,5 +1,6 @@@
- from test.support import requires_IEEE_754
 -from test.support import run_unittest, requires_IEEE_754, cpython_only
++from test.support import requires_IEEE_754, cpython_only
  from test.test_math import parse_testfile, test_file
 +import test.test_math as test_math
  import unittest
  import cmath, math
  from cmath import phase, polar, rect, pi
diff --cc Misc/NEWS
index cc3f4d42b89363d1dfc37cfdb077527d560ccc7e,7205e93841da153b2ee416df7ed09016c26b8e25..8d25325c0fef27bfbde9621e734fa2b11359c819
+++ b/Misc/NEWS
@@@ -2,69 -2,10 +2,71 @@@
  Python News
  +++++++++++
  
 -What's New in Python 3.4.4rc1?
 -==============================
 +What's New in Python 3.5.0 beta 3?
 +==================================
 +
 +Release date: 2015-07-05
 +
 +Core and Builtins
 +-----------------
 +
 +- Issue #24345: Add Py_tp_finalize slot for the stable ABI.
 +
 +- Issue #24400: Introduce a distinct type for PEP 492 coroutines; add
 +  types.CoroutineType, inspect.getcoroutinestate, inspect.getcoroutinelocals;
 +  coroutines no longer use CO_GENERATOR flag; sys.set_coroutine_wrapper
 +  works only for 'async def' coroutines; inspect.iscoroutine no longer
 +  uses collections.abc.Coroutine, it's intended to test for pure 'async def'
 +  coroutines only; add new opcode: GET_YIELD_FROM_ITER; fix generators wrapper
 +  used in types.coroutine to be instance of collections.abc.Generator.
 +
 +
 +Library
 +-------
 +
++- Issue #24489: ensure a previously set C errno doesn't disturb cmath.polar().
++
 +- Issue #24408: Fixed AttributeError in measure() and metrics() methods of
 +  tkinter.Font.
 +
 +- Issue #14373: C implementation of functools.lru_cache() now can be used with
 +  methods.
 +
 +- Issue #8232: webbrowser support incomplete on Windows. Patch by Brandon
 +  Milam
 +
 +- Issue #24347: Set KeyError if PyDict_GetItemWithError returns NULL.
 +
 +- Issue #24348: Drop superfluous incref/decref.
 +
 +- Issue #24359: Check for changed OrderedDict size during iteration.
 +
 +- Issue #24368: Support keyword arguments in OrderedDict methods.
 +
 +- Issue #24362: Simplify the C OrderedDict fast nodes resize logic.
 +
 +- Issue #24377: Fix a ref leak in OrderedDict.__repr__.
 +
 +- Issue #24369: Defend against key-changes during iteration.
 +
 +Tests
 +-----
 +
 +- Issue #24373: _testmultiphase and xxlimited now use tp_traverse and
 +  tp_finalize to avoid reference leaks encountered when combining tp_dealloc
 +  with PyType_FromSpec (see issue #16690 for details)
 +
 +Documentation
 +-------------
 +
 +- Issue #24351: Clarify what is meant by "identifier" in the context of
 +  string.Template instances.
 +
 +
 +What's New in Python 3.5.0 beta 2?
 +==================================
  
 -Release date: tba
 +Release date: 2015-05-31
  
  Core and Builtins
  -----------------
Simple merge
index d12e4c50cd2fa2c25f078b9c1a68e1aff91f0e97,b341c343e1d7ecd03d3a82e955f4b2a61ecce6da..7f6c2c9df4f738450e6fb59ecd50be0de1d86a5f
@@@ -969,26 -930,21 +969,27 @@@ cmath_phase_impl(PyModuleDef *module, P
          return PyFloat_FromDouble(phi);
  }
  
 -PyDoc_STRVAR(cmath_phase_doc,
 -"phase(z) -> float\n\n\
 -Return argument, also known as the phase angle, of a complex.");
 +/*[clinic input]
 +cmath.polar
 +
 +    z: Py_complex
 +    /
 +
 +Convert a complex from rectangular coordinates to polar coordinates.
 +
 +r is the distance from 0 and phi the phase angle.
 +[clinic start generated code]*/
  
  static PyObject *
 -cmath_polar(PyObject *self, PyObject *args)
 +cmath_polar_impl(PyModuleDef *module, Py_complex z)
 +/*[clinic end generated code: output=07d41b16c877875a input=26c353574fd1a861]*/
  {
 -    Py_complex z;
      double r, phi;
 -    if (!PyArg_ParseTuple(args, "D:polar", &z))
 -        return NULL;
 +
+     errno = 0;
      PyFPE_START_PROTECT("polar function", return 0)
      phi = c_atan2(z); /* should not cause any exception */
-     r = _Py_c_abs(z); /* sets errno to ERANGE on overflow;  otherwise 0 */
 -    r = c_abs(z); /* sets errno to ERANGE on overflow */
++    r = _Py_c_abs(z); /* sets errno to ERANGE on overflow */
      PyFPE_END_PROTECT(r)
      if (errno != 0)
          return math_error();