Sergey B Kirpichev
b6e745a27e
gh-121268: Remove workarounds for non-IEEE 754 systems in cmath ( #122716 )
...
As now building Python now requires support of IEEE 754 floating point
numbers.
2024-08-09 11:17:40 +02:00
Sergey B Kirpichev
0b433aa9df
gh-122681: merge m_atan2() and c_atan2() helper functions ( #122682 )
2024-08-06 14:43:13 +02:00
Sergey B Kirpichev
e6fad7a0e3
gh-122637: fix tanh(±0+infj) and tanh(±0+nanj) to return ±0+nanj ( #122638 )
...
As per C11 DR#471, ctanh (0 + i NaN) and ctanh (0 + i Inf) should return
0 + i NaN (with "invalid" exception in the second case). This has
corresponding implications for ctan(z), as its errors and special cases
are handled as if the operation is implemented by -i*ctanh(i*z).
This patch fixes cmath's code to do same.
Glibs patch: https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=d15e83c5f5231d971472b5ffc9219d54056ca0f1
2024-08-04 10:05:30 +01:00
Sergey B Kirpichev
3462a80d2c
gh-121889: cmath.acosh(0+nanj) returns nan+pi/2j ( #121892 )
...
As per C11 DR#471 (adjusted resolution accepted for C17), cacosh (0 +
iNaN) should return NaN ± i pi/2, not NaN + iNaN. This patch
fixes cmath's code to do same.
2024-08-04 09:53:17 +01:00
Sergey B Kirpichev
cd11ff12ac
gh-119613: Use C99+ functions instead of Py_IS_NAN/INFINITY/FINITE ( #119619 )
2024-05-29 09:51:19 +02:00
Brett Simmers
c2627d6eea
gh-116322: Add Py_mod_gil module slot ( #116882 )
...
This PR adds the ability to enable the GIL if it was disabled at
interpreter startup, and modifies the multi-phase module initialization
path to enable the GIL when loading a module, unless that module's spec
includes a slot indicating it can run safely without the GIL.
PEP 703 called the constant for the slot `Py_mod_gil_not_used`; I went
with `Py_MOD_GIL_NOT_USED` for consistency with gh-104148.
A warning will be issued up to once per interpreter for the first
GIL-using module that is loaded. If `-v` is given, a shorter message
will be printed to stderr every time a GIL-using module is loaded
(including the first one that issues a warning).
2024-05-03 11:30:55 -04:00
Serhiy Storchaka
3e65baee72
gh-86493: Fix possible leaks in some modules initialization (GH-106768)
...
Fix _ssl, _stat, _testinternalcapi, _threadmodule, cmath, math, posix, time.
2023-07-18 10:50:47 +03:00
Victor Stinner
c38c66687f
gh-106320: Add pycore_complexobject.h header file ( #106339 )
...
Add internal pycore_complexobject.h header file.
Move _Py_c_xxx() functions and _PyComplex_FormatAdvancedWriter()
function to this new header file.
2023-07-02 21:19:59 +00:00
Sebastian Berg
7a3b03509e
gh-104263: Rely on Py_NAN and introduce Py_INFINITY (GH-104202)
...
This PR removes `_Py_dg_stdnan` and `_Py_dg_infinity` in favour of
using the standard `NAN` and `INFINITY` macros provided by C99.
This change has the side-effect of fixing a bug on MIPS where the
hard-coded value used by `_Py_dg_stdnan` gave a signalling NaN
rather than a quiet NaN.
---------
Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
2023-05-10 17:44:52 +01:00
Eric Snow
a9c6e0618f
gh-99113: Add Py_MOD_PER_INTERPRETER_GIL_SUPPORTED (gh-104205)
...
Here we are doing no more than adding the value for Py_mod_multiple_interpreters and using it for stdlib modules. We will start checking for it in gh-104206 (once PyInterpreterState.ceval.own_gil is added in gh-104204).
2023-05-05 21:11:27 +00:00
Sergey B Kirpichev
592f65fdb5
Few coverage nitpicks for the cmath module ( #102067 )
...
- partial tests for cosh/sinh overflows (L535 and L771). I doubt
both ||-ed conditions could be tested.
- removed inaccessible case in sqrt (L832): ax=ay=0 is handled
above (L823) because fabs() is exact. Also added test (checked
with mpmath and gmpy2) for second condition on that line.
- some trivial tests for isclose (cover all conditions on L1217-1218)
- add comment for uncovered L1018
Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
2023-02-22 19:10:01 +00:00
Owain Davies
71f614ef2a
Add missing 'is' to `cmath.log()` docstring ( #102049 )
...
Fix missing 'is' in cmath.log() docstring
2023-02-19 15:00:59 +00:00
Mark Dickinson
0672a6c23b
Revert "gh-89381: Fix invalid signatures of math/cmath.log ( #101404 )" ( #101580 )
...
This reverts commit 0ef92d9793
.
2023-02-05 16:36:33 +00:00
Sergey B Kirpichev
0ef92d9793
gh-89381: Fix invalid signatures of math/cmath.log ( #101404 )
2023-01-29 11:50:10 -08:00
Victor Stinner
1b2611eb02
bpo-46656: Remove Py_NO_NAN macro (GH-31160)
...
Building Python now requires support for floating point Not-a-Number
(NaN): remove the Py_NO_NAN macro.
2022-02-25 01:32:57 +01:00
Victor Stinner
9bbdde2180
bpo-45412: Add _PY_SHORT_FLOAT_REPR macro (GH-31171)
...
Remove the HAVE_PY_SET_53BIT_PRECISION macro (moved to the internal
C API).
* Move HAVE_PY_SET_53BIT_PRECISION macro to pycore_pymath.h.
* Replace PY_NO_SHORT_FLOAT_REPR macro with _PY_SHORT_FLOAT_REPR
macro which is always defined. gcc -Wundef emits a warning when
using _PY_SHORT_FLOAT_REPR but the macro is not defined, if
pycore_pymath.h include was forgotten.
2022-02-23 18:16:23 +01:00
Christian Heimes
fa26245a1c
bpo-45548: Remove _math.c workarounds for pre-C99 libm (GH-29179)
...
The :mod:`math` and :mod:`cmath` implementation now require a C99 compatible
``libm`` and no longer ship with workarounds for missing acosh, asinh,
expm1, and log1p functions.
The changeset also removes ``_math.c`` and moves the last remaining
workaround into ``_math.h``. This simplifies static builds with
``Modules/Setup`` and resolves symbol conflicts.
Co-authored-by: Mark Dickinson <mdickinson@enthought.com>
Co-authored-by: Brett Cannon <brett@python.org>
Signed-off-by: Christian Heimes <christian@python.org>
2021-10-25 01:25:27 -07:00
Christian Heimes
03e9f5dc75
bpo-43974: Move Py_BUILD_CORE_MODULE into module code (GH-29157)
...
setup.py no longer defines Py_BUILD_CORE_MODULE. Instead every
module defines the macro before #include "Python.h" unless
Py_BUILD_CORE_BUILTIN is already defined.
Py_BUILD_CORE_BUILTIN is defined for every module that is built by
Modules/Setup.
The PR also simplifies Modules/Setup. Makefile and makesetup
already define Py_BUILD_CORE_BUILTIN and include Modules/internal
for us.
Signed-off-by: Christian Heimes <christian@python.org>
2021-10-22 15:36:28 +02:00
Mohamed Koubaa
f76d894dc5
bpo-1635741: Port cmath to multi-phase init (PEP 489) (GH-22165)
2020-09-10 16:09:04 +02:00
Victor Stinner
e9e7d284c4
bpo-35081: Move dtoa.h header to the internal C API (GH-18489)
...
Move the dtoa.h header file to the internal C API as pycore_dtoa.h:
it only contains private functions (prefixed by "_Py").
The math and cmath modules must now be compiled with the
Py_BUILD_CORE macro defined.
2020-02-12 22:54:42 +01:00
Victor Stinner
be143ec996
bpo-38835: Don't use PyFPE_START_PROTECT and PyFPE_END_PROTECT (GH-17231)
...
The PyFPE_START_PROTECT() and PyFPE_END_PROTECT() macros are empty:
they have been doing nothing for the last year (since commit
735ae8d139
), so stop using them.
2019-11-20 02:51:30 +01:00
Serhiy Storchaka
279f44678c
bpo-37206: Unrepresentable default values no longer represented as None. (GH-13933)
...
In ArgumentClinic, value "NULL" should now be used only for unrepresentable default values
(like in the optional third parameter of getattr). "None" should be used if None is accepted
as argument and passing None has the same effect as not passing the argument at all.
2019-09-14 12:24:05 +03:00
Ned Batchelder
6faad355db
bpo-36908: 'This module is always available' isn't helpful. ( #13297 )
...
Makes the documentation of math and cmath module
more helpful for the beginners.
2019-05-17 15:29:13 +05:30
Mark Dickinson
84e6311dee
Issue 23229: add cmath.inf, cmath.nan, cmath.infj and cmath.nanj.
2016-08-29 13:56:58 +01:00
Guido van Rossum
0a891d70de
Issue #12345 : Add mathemathcal constant tau to math and cmath.
...
Patch by Lisa Roach. See also PEP 628.
2016-08-15 09:12:52 -07:00
Serhiy Storchaka
1a2b24f02d
Issue #27332 : Fixed the type of the first argument of module-level functions
...
generated by Argument Clinic. Patch by Petr Viktorin.
2016-07-07 17:35:15 +03:00
Serhiy Storchaka
ebe95fdabb
Issue #26305 : Argument Clinic now escapes braces. No need to double them.
2016-06-09 16:02:15 +03:00
Antoine Pitrou
a72f0cdaea
Issue #24489 : ensure a previously set C errno doesn't disturb cmath.polar().
2015-06-23 14:38:13 +02:00
Antoine Pitrou
6bc217dd3d
Issue #24489 : ensure a previously set C errno doesn't disturb cmath.polar().
2015-06-23 14:31:11 +02:00
Tal Einat
d5519ed7f4
Issue #19543 : Implementation of isclose as per PEP 485
...
For details, see:
PEP 0485 -- A Function for testing approximate equality
Functions added: math.isclose() and cmath.isclose().
Original code by Chris Barker. Patch by Tal Einat.
2015-05-31 22:05:00 +03:00
Serhiy Storchaka
1009bf18b3
Issue #23501 : Argumen Clinic now generates code into separate files by default.
2015-04-03 23:53:51 +03:00
Serhiy Storchaka
79d8f3f123
Regenerated Argument Clinic checksums.
2015-02-20 12:46:11 +02:00
Mark Dickinson
cc8617b93a
Issue #21092 : Merge from 3.4.
2015-01-11 13:22:44 +00:00
Mark Dickinson
dfe0b2326b
Issue #21902 : Replace incorrect 'hyperbolic arc sine' (etc.) with 'inverse hyperbolic sine' (etc.). Remove meaningless reference to radians.
2015-01-11 13:08:05 +00:00
Brett Cannon
b0fc490307
Issue #20152 : Convert the cmath module to Argument Clinic.
2014-10-14 17:37:02 -04:00
Antoine Pitrou
de08cb60fd
Fix compilation failure (followup to #21803 )
2014-07-07 19:08:47 -04:00
Brett Cannon
1088d98899
The function name for cmath.isinf in PyArg_ParseTuple() was wrong.
2014-01-31 12:04:36 -05:00
Mark Dickinson
58ceecfe5a
Issue #18513 : Add workaround for OS X 10.8 cexp bug that leads to wrong cmath.rect(0.0,-0.0) results.
2013-07-20 17:59:13 +01:00
Ezio Melotti
3b3499ba69
#11565 : Merge with 3.1.
2011-03-16 11:35:38 +02:00
Ezio Melotti
13925008dc
#11565 : Fix several typos. Patch by Piotr Kasprzyk.
2011-03-16 11:05:33 +02:00
Mark Dickinson
8e0c996873
Issue #9165 : Add math.isfinite and cmath.isfinite.
2010-07-11 17:38:24 +00:00
Antoine Pitrou
7f14f0d8a0
Recorded merge of revisions 81032 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/branches/py3k
................
r81032 | antoine.pitrou | 2010-05-09 17:52:27 +0200 (dim., 09 mai 2010) | 9 lines
Recorded merge of revisions 81029 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r81029 | antoine.pitrou | 2010-05-09 16:46:46 +0200 (dim., 09 mai 2010) | 3 lines
Untabify C files. Will watch buildbots.
........
................
2010-05-09 16:14:21 +00:00
Antoine Pitrou
f95a1b3c53
Recorded merge of revisions 81029 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/trunk
........
r81029 | antoine.pitrou | 2010-05-09 16:46:46 +0200 (dim., 09 mai 2010) | 3 lines
Untabify C files. Will watch buildbots.
........
2010-05-09 15:52:27 +00:00
Mark Dickinson
f371859a4f
Merged revisions 76978 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/trunk
........
r76978 | mark.dickinson | 2009-12-21 15:22:00 +0000 (Mon, 21 Dec 2009) | 3 lines
Issue #7518 : Move substitute definitions of C99 math functions from
pymath.c to Modules/_math.c.
........
2009-12-21 15:27:41 +00:00
Mark Dickinson
216dc7b70b
Merged revisions 74305 via svnmerge from
...
svn+ssh://pythondev@www.python.org/python/branches/py3k
................
r74305 | mark.dickinson | 2009-08-04 20:25:12 +0100 (Tue, 04 Aug 2009) | 9 lines
Merged revisions 74303 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r74303 | mark.dickinson | 2009-08-04 20:22:35 +0100 (Tue, 04 Aug 2009) | 2 lines
Issue #6644 : Fix compile error on AIX.
........
................
2009-08-04 19:26:17 +00:00
Mark Dickinson
e5842c1f14
Merged revisions 74303 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/trunk
........
r74303 | mark.dickinson | 2009-08-04 20:22:35 +0100 (Tue, 04 Aug 2009) | 2 lines
Issue #6644 : Fix compile error on AIX.
........
2009-08-04 19:25:12 +00:00
Mark Dickinson
1bd2e29d82
Merged revisions 70062 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/trunk
........
r70062 | mark.dickinson | 2009-02-28 15:50:40 +0000 (Sat, 28 Feb 2009) | 2 lines
Issue #5393 : typo in cmath.cos and cmath.cosh docstring
........
2009-02-28 15:53:24 +00:00
Georg Brandl
86b2fb9d77
Merged revisions 64623,64640,64665,64687,64689-64690,64719,64721,64735,64742,64744-64746,64756-64761,64767-64769,64771-64772,64774-64775,64788,64793,64835-64836 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/trunk
........
r64623 | benjamin.peterson | 2008-07-01 21:51:54 +0200 (Tue, 01 Jul 2008) | 1 line
write a short little section for multiprocessing; it still needs help
........
r64640 | georg.brandl | 2008-07-01 22:56:03 +0200 (Tue, 01 Jul 2008) | 2 lines
Add a comment about incref'ing w.
........
r64665 | jesse.noller | 2008-07-02 18:56:51 +0200 (Wed, 02 Jul 2008) | 1 line
Add #!/usr/bin/env python for ben
........
r64687 | andrew.kuchling | 2008-07-03 14:50:03 +0200 (Thu, 03 Jul 2008) | 1 line
Tweak wording
........
r64689 | benjamin.peterson | 2008-07-03 14:57:35 +0200 (Thu, 03 Jul 2008) | 1 line
lowercase glossary term
........
r64690 | benjamin.peterson | 2008-07-03 15:01:17 +0200 (Thu, 03 Jul 2008) | 1 line
let the term be linked
........
r64719 | raymond.hettinger | 2008-07-05 04:11:55 +0200 (Sat, 05 Jul 2008) | 1 line
Update comment on prediction macros.
........
r64721 | georg.brandl | 2008-07-05 12:07:18 +0200 (Sat, 05 Jul 2008) | 2 lines
Fix tabs.
........
r64735 | mark.dickinson | 2008-07-05 17:25:48 +0200 (Sat, 05 Jul 2008) | 3 lines
Minor rewrite of cmath_log to work around a Sun compiler bug. See issue
#3168 .
........
r64742 | benjamin.peterson | 2008-07-05 18:29:38 +0200 (Sat, 05 Jul 2008) | 1 line
make regrtest aware of the lib2to3 resource
........
r64744 | georg.brandl | 2008-07-05 18:43:45 +0200 (Sat, 05 Jul 2008) | 2 lines
Keep below 80 chars.
........
r64745 | facundo.batista | 2008-07-05 21:19:50 +0200 (Sat, 05 Jul 2008) | 3 lines
Issue 3289. Removed two lines that ended doing nothing.
........
r64746 | facundo.batista | 2008-07-05 22:39:59 +0200 (Sat, 05 Jul 2008) | 4 lines
Issue #3239 . Differentiate the ascii call from the curses one and
the builtin one.
........
r64756 | gregory.p.smith | 2008-07-06 09:16:40 +0200 (Sun, 06 Jul 2008) | 3 lines
- Issue #2113 : Fix error in subprocess.Popen if the select system call is
interrupted by a signal.
........
r64757 | benjamin.peterson | 2008-07-06 14:39:09 +0200 (Sun, 06 Jul 2008) | 1 line
remove test_compact_freelists from test_sys
........
r64758 | gregory.p.smith | 2008-07-06 19:06:29 +0200 (Sun, 06 Jul 2008) | 2 lines
fix issue3304 - remove an incorrect PyMem_Free in fileio_init
........
r64759 | georg.brandl | 2008-07-06 19:36:20 +0200 (Sun, 06 Jul 2008) | 2 lines
Fix opensearch template.
........
r64760 | andrew.kuchling | 2008-07-06 19:43:16 +0200 (Sun, 06 Jul 2008) | 1 line
Wording fix
........
r64761 | andrew.kuchling | 2008-07-06 19:44:17 +0200 (Sun, 06 Jul 2008) | 1 line
Add two items; rewrap paragraph
........
r64767 | gregory.p.smith | 2008-07-07 06:31:58 +0200 (Mon, 07 Jul 2008) | 4 lines
- Issue #3309 : Fix bz2.BZFile itererator to release its internal lock
properly when raising an exception due to the bz2file being closed.
Prevents a deadlock.
........
r64768 | josiah.carlson | 2008-07-07 06:51:46 +0200 (Mon, 07 Jul 2008) | 2 lines
Fixed bugs 760475, 953599, and 1519.
........
r64769 | gregory.p.smith | 2008-07-07 06:54:31 +0200 (Mon, 07 Jul 2008) | 2 lines
Add commented out #_sha256 and #_sha512 lines per issue 3183.
........
r64771 | gregory.p.smith | 2008-07-07 07:09:12 +0200 (Mon, 07 Jul 2008) | 4 lines
- Issue #3094 : httplib.HTTPSConnection Host: headers no longer include the
redundant ":443" port number designation when the connection is using the
default https port (443).
........
r64772 | skip.montanaro | 2008-07-07 13:16:14 +0200 (Mon, 07 Jul 2008) | 2 lines
Correct grammar.
........
r64774 | andrew.kuchling | 2008-07-07 18:51:09 +0200 (Mon, 07 Jul 2008) | 1 line
Fix example to match text
........
r64775 | facundo.batista | 2008-07-07 19:02:59 +0200 (Mon, 07 Jul 2008) | 3 lines
Issue 3306. Better control for a lenght in findmax() function.
........
r64788 | georg.brandl | 2008-07-08 09:05:23 +0200 (Tue, 08 Jul 2008) | 2 lines
Add missing ABCs to list.
........
r64793 | nick.coghlan | 2008-07-08 16:21:42 +0200 (Tue, 08 Jul 2008) | 1 line
Add missing NEWS and ACK entries for r64791
........
r64835 | raymond.hettinger | 2008-07-10 11:31:08 +0200 (Thu, 10 Jul 2008) | 1 line
Issue 3287: Raise correct exception for float inputs.
........
r64836 | raymond.hettinger | 2008-07-10 12:28:41 +0200 (Thu, 10 Jul 2008) | 1 line
Use operator.index() instead of n.__index__().
........
2008-07-16 03:43:04 +00:00
Martin v. Löwis
1a21451b1d
Implement PEP 3121: new module initialization and finalization API.
2008-06-11 05:26:20 +00:00
Alexandre Vassalotti
bee325387b
Merged revisions 63361-63373,63375,63377-63380 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/trunk
........
r63361 | alexandre.vassalotti | 2008-05-16 03:14:08 -0400 (Fri, 16 May 2008) | 2 lines
Rename the test file of reprlib.
........
r63364 | georg.brandl | 2008-05-16 05:34:48 -0400 (Fri, 16 May 2008) | 2 lines
Make generator repr consistent with function and code object repr.
........
r63365 | georg.brandl | 2008-05-16 05:47:29 -0400 (Fri, 16 May 2008) | 2 lines
#2869 : remove parameter from signature.
........
r63366 | christian.heimes | 2008-05-16 06:23:31 -0400 (Fri, 16 May 2008) | 1 line
Fixed #2870 : cmathmodule.c compile error
........
r63367 | christian.heimes | 2008-05-16 07:28:56 -0400 (Fri, 16 May 2008) | 1 line
Following Amaury's advice
........
r63368 | georg.brandl | 2008-05-16 09:10:15 -0400 (Fri, 16 May 2008) | 2 lines
#2890 : support os.O_ASYNC and fcntl.FASYNC.
........
r63369 | georg.brandl | 2008-05-16 09:18:50 -0400 (Fri, 16 May 2008) | 2 lines
#2845 : fix copy2's docs.
........
r63370 | georg.brandl | 2008-05-16 09:24:29 -0400 (Fri, 16 May 2008) | 2 lines
Don't allow keyword arguments to reversed().
........
r63373 | georg.brandl | 2008-05-16 09:41:26 -0400 (Fri, 16 May 2008) | 2 lines
Document O_ASYNC addition.
........
r63380 | georg.brandl | 2008-05-16 13:33:13 -0400 (Fri, 16 May 2008) | 2 lines
Fix reprlib docs.
........
2008-05-16 18:15:12 +00:00