diff --git a/Lib/test/mathdata/math_testcases.txt b/Lib/test/mathdata/math_testcases.txt index 4a38a3666bab208..b7a099ce92a3133 100644 --- a/Lib/test/mathdata/math_testcases.txt +++ b/Lib/test/mathdata/math_testcases.txt @@ -1311,9 +1311,9 @@ atan2pi20000 atan2pi inf 0 -> 0.5 atan2pi20001 atan2pi -inf 0 -> -0.5 atan2pi20002 atan2pi nan 0 -> nan -atan2pi20000 atan2pi inf -0 -> 0.5 -atan2pi20001 atan2pi -inf -0 -> -0.5 -atan2pi20002 atan2pi nan -0 -> nan +atan2pi21000 atan2pi inf -0 -> 0.5 +atan2pi21001 atan2pi -inf -0 -> -0.5 +atan2pi21002 atan2pi nan -0 -> nan atan2pi20003 atan2pi inf 1 -> 0.5 atan2pi20004 atan2pi -inf 1 -> -0.5 @@ -1339,9 +1339,9 @@ atan2pi30000 atan2pi 0 inf -> 0.0 atan2pi30001 atan2pi 0 -inf -> 1.0 atan2pi30002 atan2pi 0 nan -> nan -atan2pi30000 atan2pi -0 inf -> -0.0 -atan2pi30001 atan2pi -0 -inf -> -1.0 -atan2pi30002 atan2pi -0 nan -> nan +atan2pi31000 atan2pi -0 inf -> -0.0 +atan2pi31001 atan2pi -0 -inf -> -1.0 +atan2pi31002 atan2pi -0 nan -> nan atan2pi30003 atan2pi 1 inf -> 0.0 atan2pi30004 atan2pi 1 -inf -> 1.0 @@ -2247,3 +2247,8 @@ tanpi10275 tanpi -1.6591963470121216 -> 1.829921944286168 tanpi20001 tanpi inf -> nan invalid tanpi20002 tanpi -inf -> nan invalid tanpi20003 tanpi nan -> nan + +tanpi30001 tanpi 0.5 -> inf divide-by-zero +tanpi30002 tanpi -0.5 -> -inf divide-by-zero +tanpi30003 tanpi 1.5 -> -inf divide-by-zero +tanpi30004 tanpi -1.5 -> inf divide-by-zero diff --git a/Lib/test/test_curses.py b/Lib/test/test_curses.py index bbcf8d285a67743..7b059eb2e8e1414 100644 --- a/Lib/test/test_curses.py +++ b/Lib/test/test_curses.py @@ -3459,6 +3459,8 @@ def test_use_prescr_screen(self): with self.assertRaises(curses.error): prescr.use(func) # Affecting the state before initscr() is what such a screen is for. + # use_env() is process-wide, not a property of this screen. + self.addCleanup(curses.use_env, True) prescr.use(lambda scr: curses.use_env(False)) # The current screen is unchanged. screen.stdscr.refresh() diff --git a/Lib/test/test_math.py b/Lib/test/test_math.py index a27996dd01c9d12..a1250c668223e7f 100644 --- a/Lib/test/test_math.py +++ b/Lib/test/test_math.py @@ -2144,7 +2144,12 @@ def test_mtestfile(self): fail_fmt = "{}: {}{!r}: {}" failures = [] + ids = set() for id, fn, args, expected, flags in parse_mtestfile(math_testcases): + if id in ids: + failures.append(f"Duplicate test id {id}") + ids.add(id) + func = getattr(math, fn) if 'invalid' in flags or 'divide-by-zero' in flags: diff --git a/Misc/NEWS.d/next/Core_and_Builtins/2026-09-04-22-00-00.gh-issue-156910.aBcD3f.rst b/Misc/NEWS.d/next/Core_and_Builtins/2026-09-04-22-00-00.gh-issue-156910.aBcD3f.rst new file mode 100644 index 000000000000000..f717bbe5f16aa96 --- /dev/null +++ b/Misc/NEWS.d/next/Core_and_Builtins/2026-09-04-22-00-00.gh-issue-156910.aBcD3f.rst @@ -0,0 +1,3 @@ +Fix a deadlock in the :term:`free threaded ` build when +setting ``__abstractmethods__`` on a type while another thread holds the +type lock. diff --git a/Misc/NEWS.d/next/Library/2026-08-17-17-39-41.gh-issue-155966.0YOADY.rst b/Misc/NEWS.d/next/Library/2026-08-17-17-39-41.gh-issue-155966.0YOADY.rst new file mode 100644 index 000000000000000..2f556aef54a63a0 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2026-08-17-17-39-41.gh-issue-155966.0YOADY.rst @@ -0,0 +1,2 @@ +:func:`math.tanpi` now raises :exc:`ValueError` for half-integer values +(e.g., ``tanpi(1.5)``), as these are poles of the function. diff --git a/Modules/mathmodule.c b/Modules/mathmodule.c index 7988a77ab0abcca..16e7231214af2df 100644 --- a/Modules/mathmodule.c +++ b/Modules/mathmodule.c @@ -1343,10 +1343,10 @@ FUNC1D(tan, tan, 0, FUNC1(tanh, tanh, 0, "tanh($module, x, /)\n--\n\n" "Return the hyperbolic tangent of x.") -FUNC1D(tanpi, m_tanpi, 1, +FUNC1D(tanpi, m_tanpi, 0, "tanpi($module, x, /)\n--\n\n" "Return the tangent of x (measured in half-turns).", - "expected a finite input, got %s") + "expected a finite input not equal to a half-integer, got %s") /* Precision summation function as msum() by Raymond Hettinger in , diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 572e302df8d80d5..30958310227af0e 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -1706,14 +1706,17 @@ type_set_abstractmethods(PyObject *tp, PyObject *value, void *Py_UNUSED(closure) return -1; } + pinned_mutexes_t pinned; BEGIN_TYPE_LOCK(); _PyType_Modified_Unlocked(type); + type_lock_prevent_release(&pinned); types_stop_world(); if (abstract) type_add_flags(type, Py_TPFLAGS_IS_ABSTRACT); else type_clear_flags(type, Py_TPFLAGS_IS_ABSTRACT); types_start_world(); + type_lock_allow_release(&pinned); ASSERT_TYPE_LOCK_HELD(); END_TYPE_LOCK();