Skip to content

Commit 4130df8

Browse files
committed
Merge branch 'main' into allow_initial_keyword_reduce
2 parents 7cc052f + 914356f commit 4130df8

File tree

21 files changed

+95
-35
lines changed

21 files changed

+95
-35
lines changed

.github/workflows/jit.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ concurrency:
2828
jobs:
2929
interpreter:
3030
name: Interpreter (Debug)
31-
runs-on: ubuntu-latest
31+
runs-on: ubuntu-22.04
3232
timeout-minutes: 90
3333
steps:
3434
- uses: actions/checkout@v4
@@ -85,19 +85,19 @@ jobs:
8585
compiler: clang
8686
- target: x86_64-unknown-linux-gnu/gcc
8787
architecture: x86_64
88-
runner: ubuntu-latest
88+
runner: ubuntu-22.04
8989
compiler: gcc
9090
- target: x86_64-unknown-linux-gnu/clang
9191
architecture: x86_64
92-
runner: ubuntu-latest
92+
runner: ubuntu-22.04
9393
compiler: clang
9494
- target: aarch64-unknown-linux-gnu/gcc
9595
architecture: aarch64
96-
runner: ubuntu-latest
96+
runner: ubuntu-22.04
9797
compiler: gcc
9898
- target: aarch64-unknown-linux-gnu/clang
9999
architecture: aarch64
100-
runner: ubuntu-latest
100+
runner: ubuntu-22.04
101101
compiler: clang
102102
env:
103103
CC: ${{ matrix.compiler }}
@@ -169,7 +169,7 @@ jobs:
169169
jit-with-disabled-gil:
170170
name: Free-Threaded (Debug)
171171
needs: interpreter
172-
runs-on: ubuntu-latest
172+
runs-on: ubuntu-22.04
173173
strategy:
174174
matrix:
175175
llvm:

Doc/c-api/conversion.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ The following functions provide locale-independent string to number conversions.
105105
106106
If ``s`` represents a value that is too large to store in a float
107107
(for example, ``"1e500"`` is such a string on many platforms) then
108-
if ``overflow_exception`` is ``NULL`` return ``Py_HUGE_VAL`` (with
108+
if ``overflow_exception`` is ``NULL`` return ``Py_INFINITY`` (with
109109
an appropriate sign) and don't set any exception. Otherwise,
110110
``overflow_exception`` must point to a Python exception object;
111111
raise that exception and return ``-1.0``. In both cases, set

Doc/library/dis.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1647,7 +1647,7 @@ iterations of the loop.
16471647

16481648
.. versionadded:: 3.13
16491649

1650-
.. opcode:: FORMAT_SPEC
1650+
.. opcode:: FORMAT_WITH_SPEC
16511651

16521652
Formats the given value with the given format spec::
16531653

Doc/whatsnew/3.14.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -816,6 +816,10 @@ Porting to Python 3.14
816816
Deprecated
817817
----------
818818

819+
* The :c:macro:`!Py_HUGE_VAL` macro is :term:`soft deprecated`,
820+
use :c:macro:`!Py_INFINITY` instead.
821+
(Contributed by Sergey B Kirpichev in :gh:`120026`.)
822+
819823
* Macros :c:macro:`!Py_IS_NAN`, :c:macro:`!Py_IS_INFINITY`
820824
and :c:macro:`!Py_IS_FINITE` are :term:`soft deprecated`,
821825
use instead :c:macro:`!isnan`, :c:macro:`!isinf` and

Include/floatobject.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ PyAPI_DATA(PyTypeObject) PyFloat_Type;
2121
#define Py_RETURN_INF(sign) \
2222
do { \
2323
if (copysign(1., sign) == 1.) { \
24-
return PyFloat_FromDouble(Py_HUGE_VAL); \
24+
return PyFloat_FromDouble(Py_INFINITY); \
2525
} \
2626
else { \
27-
return PyFloat_FromDouble(-Py_HUGE_VAL); \
27+
return PyFloat_FromDouble(-Py_INFINITY); \
2828
} \
2929
} while(0)
3030

Include/internal/pycore_pymath.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ extern "C" {
3333
static inline void _Py_ADJUST_ERANGE1(double x)
3434
{
3535
if (errno == 0) {
36-
if (x == Py_HUGE_VAL || x == -Py_HUGE_VAL) {
36+
if (x == Py_INFINITY || x == -Py_INFINITY) {
3737
errno = ERANGE;
3838
}
3939
}
@@ -44,8 +44,8 @@ static inline void _Py_ADJUST_ERANGE1(double x)
4444

4545
static inline void _Py_ADJUST_ERANGE2(double x, double y)
4646
{
47-
if (x == Py_HUGE_VAL || x == -Py_HUGE_VAL ||
48-
y == Py_HUGE_VAL || y == -Py_HUGE_VAL)
47+
if (x == Py_INFINITY || x == -Py_INFINITY ||
48+
y == Py_INFINITY || y == -Py_INFINITY)
4949
{
5050
if (errno == 0) {
5151
errno = ERANGE;

Include/pymath.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949

5050
/* Py_HUGE_VAL should always be the same as Py_INFINITY. But historically
5151
* this was not reliable and Python did not require IEEE floats and C99
52-
* conformity. Prefer Py_INFINITY for new code.
52+
* conformity. The macro was soft deprecated in Python 3.14, use Py_INFINITY instead.
5353
*/
5454
#ifndef Py_HUGE_VAL
5555
# define Py_HUGE_VAL HUGE_VAL

Lib/_pyio.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1480,6 +1480,7 @@ def __init__(self, file, mode='r', closefd=True, opener=None):
14801480
"""
14811481
if self._fd >= 0:
14821482
# Have to close the existing file first.
1483+
self._stat_atopen = None
14831484
try:
14841485
if self._closefd:
14851486
os.close(self._fd)
@@ -1583,6 +1584,7 @@ def __init__(self, file, mode='r', closefd=True, opener=None):
15831584
if e.errno != errno.ESPIPE:
15841585
raise
15851586
except:
1587+
self._stat_atopen = None
15861588
if owned_fd is not None:
15871589
os.close(owned_fd)
15881590
raise
@@ -1756,6 +1758,7 @@ def close(self):
17561758
called more than once without error.
17571759
"""
17581760
if not self.closed:
1761+
self._stat_atopen = None
17591762
try:
17601763
if self._closefd:
17611764
os.close(self._fd)

Lib/test/test_cprofile.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,22 @@ def test_bad_counter_during_dealloc(self):
3030

3131
self.assertEqual(cm.unraisable.exc_type, TypeError)
3232

33+
def test_crash_with_not_enough_args(self):
34+
# gh-126220
35+
import _lsprof
36+
37+
for profile in [_lsprof.Profiler(), cProfile.Profile()]:
38+
for method in [
39+
"_pystart_callback",
40+
"_pyreturn_callback",
41+
"_ccall_callback",
42+
"_creturn_callback",
43+
]:
44+
with self.subTest(profile=profile, method=method):
45+
method_obj = getattr(profile, method)
46+
with self.assertRaises(TypeError):
47+
method_obj() # should not crash
48+
3349
def test_evil_external_timer(self):
3450
# gh-120289
3551
# Disabling profiler in external timer should not crash

Lib/test/test_embed.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Run the tests in Programs/_testembed.c (tests for the CPython embedding APIs)
22
from test import support
3+
from test.libregrtest.utils import get_build_info
34
from test.support import import_helper, os_helper, threading_helper, MS_WINDOWS
45
import unittest
56

@@ -1780,8 +1781,10 @@ def test_initconfig_api(self):
17801781
'perf_profiling': 2,
17811782
}
17821783
config_dev_mode(preconfig, config)
1784+
# Temporarily enable ignore_stderr=True to ignore warnings on JIT builds
1785+
# See gh-126255 for more information
17831786
self.check_all_configs("test_initconfig_api", config, preconfig,
1784-
api=API_ISOLATED)
1787+
api=API_ISOLATED, ignore_stderr=True)
17851788

17861789
def test_initconfig_get_api(self):
17871790
self.run_embedded_interpreter("test_initconfig_get_api")

0 commit comments

Comments
 (0)