Skip to content

Commit e5653ee

Browse files
authored
Merge branch 'main' into instruction-stream
2 parents 258f142 + 2f62a5d commit e5653ee

38 files changed

+829
-868
lines changed

.github/workflows/new-bugs-announce-notifier.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ jobs:
1919
- name: Send notification
2020
uses: actions/github-script@v6
2121
env:
22-
MAILGUN_API_KEY: ${{ secrets.PSF_MAILGUN_KEY }}
22+
MAILGUN_API_KEY: ${{ secrets.MAILGUN_PYTHON_ORG_MAILGUN_KEY }}
2323
with:
2424
script: |
2525
const Mailgun = require("mailgun.js");
2626
const formData = require('form-data');
2727
const mailgun = new Mailgun(formData);
28-
const DOMAIN = "mg.python.org";
28+
const DOMAIN = "mailgun.python.org";
2929
const mg = mailgun.client({username: 'api', key: process.env.MAILGUN_API_KEY});
3030
github.rest.issues.get({
3131
issue_number: context.issue.number,
@@ -44,7 +44,7 @@ jobs:
4444
};
4545
4646
const data = {
47-
from: "CPython Issues <github@mg.python.org>",
47+
from: "CPython Issues <github@mailgun.python.org>",
4848
4949
subject: `[Issue ${issue.data.number}] ${issue.data.title}`,
5050
template: "new-github-issue",

Doc/conf.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@
268268
ogp_site_name = 'Python documentation'
269269
ogp_image = '_static/og-image.png'
270270
ogp_custom_meta_tags = [
271-
'<meta property="og:image:width" content="200">',
272-
'<meta property="og:image:height" content="200">',
273-
'<meta name="theme-color" content="#3776ab">',
271+
'<meta property="og:image:width" content="200" />',
272+
'<meta property="og:image:height" content="200" />',
273+
'<meta name="theme-color" content="#3776ab" />',
274274
]

Doc/library/sys.rst

+49-49
Original file line numberDiff line numberDiff line change
@@ -568,55 +568,55 @@ always available.
568568

569569
.. tabularcolumns:: |l|l|L|
570570

571-
+---------------------+----------------+--------------------------------------------------+
572-
| attribute | float.h macro | explanation |
573-
+=====================+================+==================================================+
574-
| :const:`epsilon` | DBL_EPSILON | difference between 1.0 and the least value |
575-
| | | greater than 1.0 that is representable as a float|
576-
| | | |
577-
| | | See also :func:`math.ulp`. |
578-
+---------------------+----------------+--------------------------------------------------+
579-
| :const:`dig` | DBL_DIG | maximum number of decimal digits that can be |
580-
| | | faithfully represented in a float; see below |
581-
+---------------------+----------------+--------------------------------------------------+
582-
| :const:`mant_dig` | DBL_MANT_DIG | float precision: the number of base-``radix`` |
583-
| | | digits in the significand of a float |
584-
+---------------------+----------------+--------------------------------------------------+
585-
| :const:`max` | DBL_MAX | maximum representable positive finite float |
586-
+---------------------+----------------+--------------------------------------------------+
587-
| :const:`max_exp` | DBL_MAX_EXP | maximum integer *e* such that ``radix**(e-1)`` is|
588-
| | | a representable finite float |
589-
+---------------------+----------------+--------------------------------------------------+
590-
| :const:`max_10_exp` | DBL_MAX_10_EXP | maximum integer *e* such that ``10**e`` is in the|
591-
| | | range of representable finite floats |
592-
+---------------------+----------------+--------------------------------------------------+
593-
| :const:`min` | DBL_MIN | minimum representable positive *normalized* float|
594-
| | | |
595-
| | | Use :func:`math.ulp(0.0) <math.ulp>` to get the |
596-
| | | smallest positive *denormalized* representable |
597-
| | | float. |
598-
+---------------------+----------------+--------------------------------------------------+
599-
| :const:`min_exp` | DBL_MIN_EXP | minimum integer *e* such that ``radix**(e-1)`` is|
600-
| | | a normalized float |
601-
+---------------------+----------------+--------------------------------------------------+
602-
| :const:`min_10_exp` | DBL_MIN_10_EXP | minimum integer *e* such that ``10**e`` is a |
603-
| | | normalized float |
604-
+---------------------+----------------+--------------------------------------------------+
605-
| :const:`radix` | FLT_RADIX | radix of exponent representation |
606-
+---------------------+----------------+--------------------------------------------------+
607-
| :const:`rounds` | FLT_ROUNDS | integer representing the rounding mode for |
608-
| | | floating-point arithmetic. This reflects the |
609-
| | | value of the system FLT_ROUNDS macro at |
610-
| | | interpreter startup time: |
611-
| | | ``-1`` indeterminable, |
612-
| | | ``0`` toward zero, |
613-
| | | ``1`` to nearest, |
614-
| | | ``2`` toward positive infinity, |
615-
| | | ``3`` toward negative infinity |
616-
| | | |
617-
| | | All other values for FLT_ROUNDS characterize |
618-
| | | implementation-defined rounding behavior. |
619-
+---------------------+----------------+--------------------------------------------------+
571+
+---------------------+---------------------+--------------------------------------------------+
572+
| attribute | float.h macro | explanation |
573+
+=====================+=====================+==================================================+
574+
| ``epsilon`` | ``DBL_EPSILON`` | difference between 1.0 and the least value |
575+
| | | greater than 1.0 that is representable as a float|
576+
| | | |
577+
| | | See also :func:`math.ulp`. |
578+
+---------------------+---------------------+--------------------------------------------------+
579+
| ``dig`` | ``DBL_DIG`` | maximum number of decimal digits that can be |
580+
| | | faithfully represented in a float; see below |
581+
+---------------------+---------------------+--------------------------------------------------+
582+
| ``mant_dig`` | ``DBL_MANT_DIG`` | float precision: the number of base-``radix`` |
583+
| | | digits in the significand of a float |
584+
+---------------------+---------------------+--------------------------------------------------+
585+
| ``max`` | ``DBL_MAX`` | maximum representable positive finite float |
586+
+---------------------+---------------------+--------------------------------------------------+
587+
| ``max_exp`` | ``DBL_MAX_EXP`` | maximum integer *e* such that ``radix**(e-1)`` is|
588+
| | | a representable finite float |
589+
+---------------------+---------------------+--------------------------------------------------+
590+
| ``max_10_exp`` | ``DBL_MAX_10_EXP`` | maximum integer *e* such that ``10**e`` is in the|
591+
| | | range of representable finite floats |
592+
+---------------------+---------------------+--------------------------------------------------+
593+
| ``min`` | ``DBL_MIN`` | minimum representable positive *normalized* float|
594+
| | | |
595+
| | | Use :func:`math.ulp(0.0) <math.ulp>` to get the |
596+
| | | smallest positive *denormalized* representable |
597+
| | | float. |
598+
+---------------------+---------------------+--------------------------------------------------+
599+
| ``min_exp`` | ``DBL_MIN_EXP`` | minimum integer *e* such that ``radix**(e-1)`` is|
600+
| | | a normalized float |
601+
+---------------------+---------------------+--------------------------------------------------+
602+
| ``min_10_exp`` | ``DBL_MIN_10_EXP`` | minimum integer *e* such that ``10**e`` is a |
603+
| | | normalized float |
604+
+---------------------+---------------------+--------------------------------------------------+
605+
| ``radix`` | ``FLT_RADIX`` | radix of exponent representation |
606+
+---------------------+---------------------+--------------------------------------------------+
607+
| ``rounds`` | ``FLT_ROUNDS`` | integer representing the rounding mode for |
608+
| | | floating-point arithmetic. This reflects the |
609+
| | | value of the system ``FLT_ROUNDS`` macro at |
610+
| | | interpreter startup time: |
611+
| | | ``-1`` indeterminable, |
612+
| | | ``0`` toward zero, |
613+
| | | ``1`` to nearest, |
614+
| | | ``2`` toward positive infinity, |
615+
| | | ``3`` toward negative infinity |
616+
| | | |
617+
| | | All other values for ``FLT_ROUNDS`` characterize |
618+
| | | implementation-defined rounding behavior. |
619+
+---------------------+---------------------+--------------------------------------------------+
620620

621621
The attribute :attr:`sys.float_info.dig` needs further explanation. If
622622
``s`` is any string representing a decimal number with at most

Doc/library/test.rst

+7
Original file line numberDiff line numberDiff line change
@@ -536,6 +536,13 @@ The :mod:`test.support` module defines the following functions:
536536
:func:`doctest.testmod`.
537537

538538

539+
.. function:: get_pagesize()
540+
541+
Get size of a page in bytes.
542+
543+
.. versionadded:: 3.12
544+
545+
539546
.. function:: setswitchinterval(interval)
540547

541548
Set the :func:`sys.setswitchinterval` to the given *interval*. Defines

Include/internal/pycore_dtoa.h

+6-5
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,11 @@ Bigint {
2424

2525
#ifdef Py_USING_MEMORY_DEBUGGER
2626

27-
struct _dtoa_runtime_state {
27+
struct _dtoa_state {
2828
int _not_used;
2929
};
30-
#define _dtoa_runtime_state_INIT {0}
30+
#define _dtoa_interp_state_INIT(INTERP) \
31+
{0}
3132

3233
#else // !Py_USING_MEMORY_DEBUGGER
3334

@@ -40,17 +41,17 @@ struct _dtoa_runtime_state {
4041
#define Bigint_PREALLOC_SIZE \
4142
((PRIVATE_MEM+sizeof(double)-1)/sizeof(double))
4243

43-
struct _dtoa_runtime_state {
44+
struct _dtoa_state {
4445
/* p5s is a linked list of powers of 5 of the form 5**(2**i), i >= 2 */
4546
// XXX This should be freed during runtime fini.
4647
struct Bigint *p5s;
4748
struct Bigint *freelist[Bigint_Kmax+1];
4849
double preallocated[Bigint_PREALLOC_SIZE];
4950
double *preallocated_next;
5051
};
51-
#define _dtoa_runtime_state_INIT(runtime) \
52+
#define _dtoa_state_INIT(INTERP) \
5253
{ \
53-
.preallocated_next = runtime.dtoa.preallocated, \
54+
.preallocated_next = (INTERP)->dtoa.preallocated, \
5455
}
5556

5657
#endif // !Py_USING_MEMORY_DEBUGGER

Include/internal/pycore_global_objects.h

+4-3
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ extern "C" {
2727
_PyRuntime.cached_objects.NAME
2828

2929
struct _Py_cached_objects {
30-
PyObject *str_replace_inf;
31-
3230
PyObject *interned_strings;
3331
};
3432

@@ -67,11 +65,14 @@ struct _Py_static_objects {
6765
(interp)->cached_objects.NAME
6866

6967
struct _Py_interp_cached_objects {
70-
int _not_set;
68+
/* AST */
69+
PyObject *str_replace_inf;
70+
7171
/* object.__reduce__ */
7272
PyObject *objreduce;
7373
PyObject *type_slots_pname;
7474
pytype_slotdef *type_slots_ptrs[MAX_EQUIV];
75+
7576
};
7677

7778
#define _Py_INTERP_STATIC_OBJECT(interp, NAME) \

Include/internal/pycore_interp.h

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ extern "C" {
1616
#include "pycore_code.h" // struct callable_cache
1717
#include "pycore_context.h" // struct _Py_context_state
1818
#include "pycore_dict_state.h" // struct _Py_dict_state
19+
#include "pycore_dtoa.h" // struct _dtoa_state
1920
#include "pycore_exceptions.h" // struct _Py_exc_state
2021
#include "pycore_floatobject.h" // struct _Py_float_state
2122
#include "pycore_function.h" // FUNC_MAX_WATCHERS
@@ -139,6 +140,7 @@ struct _is {
139140
struct _Py_unicode_state unicode;
140141
struct _Py_float_state float_state;
141142
struct _Py_long_state long_state;
143+
struct _dtoa_state dtoa;
142144
/* Using a cache is very effective since typically only a single slice is
143145
created and then deleted again. */
144146
PySliceObject *slice_cache;

Include/internal/pycore_runtime.h

-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ extern "C" {
1111
#include "pycore_atomic.h" /* _Py_atomic_address */
1212
#include "pycore_ceval_state.h" // struct _ceval_runtime_state
1313
#include "pycore_dict_state.h" // struct _Py_dict_runtime_state
14-
#include "pycore_dtoa.h" // struct _dtoa_runtime_state
1514
#include "pycore_floatobject.h" // struct _Py_float_runtime_state
1615
#include "pycore_faulthandler.h" // struct _faulthandler_runtime_state
1716
#include "pycore_function.h" // struct _func_runtime_state
@@ -141,7 +140,6 @@ typedef struct pyruntimestate {
141140
struct _ceval_runtime_state ceval;
142141
struct _gilstate_runtime_state gilstate;
143142
struct _getargs_runtime_state getargs;
144-
struct _dtoa_runtime_state dtoa;
145143
struct _fileutils_state fileutils;
146144
struct _faulthandler_runtime_state faulthandler;
147145
struct _tracemalloc_runtime_state tracemalloc;

Include/internal/pycore_runtime_init.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ extern "C" {
5353
.gilstate = { \
5454
.check_enabled = 1, \
5555
}, \
56-
.dtoa = _dtoa_runtime_state_INIT(runtime), \
5756
.fileutils = { \
5857
.force_ascii = -1, \
5958
}, \
@@ -94,10 +93,10 @@ extern "C" {
9493
}, \
9594
}, \
9695
}, \
97-
._main_interpreter = _PyInterpreterState_INIT, \
96+
._main_interpreter = _PyInterpreterState_INIT(runtime._main_interpreter), \
9897
}
9998

100-
#define _PyInterpreterState_INIT \
99+
#define _PyInterpreterState_INIT(INTERP) \
101100
{ \
102101
.id_refcount = -1, \
103102
.imports = IMPORTS_INIT, \
@@ -113,6 +112,7 @@ extern "C" {
113112
{ .threshold = 10, }, \
114113
}, \
115114
}, \
115+
.dtoa = _dtoa_state_INIT(&(INTERP)), \
116116
.static_objects = { \
117117
.singletons = { \
118118
._not_used = 1, \

Lib/test/support/__init__.py

+14
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@
5151
# sys
5252
"is_jython", "is_android", "is_emscripten", "is_wasi",
5353
"check_impl_detail", "unix_shell", "setswitchinterval",
54+
# os
55+
"get_pagesize",
5456
# network
5557
"open_urlresource",
5658
# processes
@@ -1893,6 +1895,18 @@ def setswitchinterval(interval):
18931895
return sys.setswitchinterval(interval)
18941896

18951897

1898+
def get_pagesize():
1899+
"""Get size of a page in bytes."""
1900+
try:
1901+
page_size = os.sysconf('SC_PAGESIZE')
1902+
except (ValueError, AttributeError):
1903+
try:
1904+
page_size = os.sysconf('SC_PAGE_SIZE')
1905+
except (ValueError, AttributeError):
1906+
page_size = 4096
1907+
return page_size
1908+
1909+
18961910
@contextlib.contextmanager
18971911
def disable_faulthandler():
18981912
import faulthandler

Lib/test/test_fcntl.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import struct
77
import sys
88
import unittest
9-
from test.support import verbose, cpython_only
9+
from test.support import verbose, cpython_only, get_pagesize
1010
from test.support.import_helper import import_module
1111
from test.support.os_helper import TESTFN, unlink
1212

@@ -201,7 +201,8 @@ def test_fcntl_f_pipesize(self):
201201
# Get the default pipesize with F_GETPIPE_SZ
202202
pipesize_default = fcntl.fcntl(test_pipe_w, fcntl.F_GETPIPE_SZ)
203203
pipesize = pipesize_default // 2 # A new value to detect change.
204-
if pipesize < 512: # the POSIX minimum
204+
pagesize_default = get_pagesize()
205+
if pipesize < pagesize_default: # the POSIX minimum
205206
raise unittest.SkipTest(
206207
'default pipesize too small to perform test.')
207208
fcntl.fcntl(test_pipe_w, fcntl.F_SETPIPE_SZ, pipesize)

Lib/test/test_subprocess.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -717,7 +717,8 @@ def test_pipesizes(self):
717717
os.close(test_pipe_r)
718718
os.close(test_pipe_w)
719719
pipesize = pipesize_default // 2
720-
if pipesize < 512: # the POSIX minimum
720+
pagesize_default = support.get_pagesize()
721+
if pipesize < pagesize_default: # the POSIX minimum
721722
raise unittest.SkipTest(
722723
'default pipesize too small to perform test.')
723724
p = subprocess.Popen(
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Cleanup Windows 7 specific special handling. Patch by Max Bachmann.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Implement ``winreg.QueryValue`` using ``QueryValueEx`` and
2+
``winreg.SetValue`` using ``SetValueEx``. Patch by Max Bachmann.

Modules/Setup

+2-2
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,8 @@ PYTHONPATH=$(COREPYTHONPATH)
163163

164164
# hashing builtins
165165
#_blake2 _blake2/blake2module.c _blake2/blake2b_impl.c _blake2/blake2s_impl.c
166-
#_md5 md5module.c -I$(srcdir)/Modules/_hacl/include _hacl/Hacl_Hash_MD5.c
167-
#_sha1 sha1module.c -I$(srcdir)/Modules/_hacl/include _hacl/Hacl_Hash_SHA1.c
166+
#_md5 md5module.c -I$(srcdir)/Modules/_hacl/include _hacl/Hacl_Hash_MD5.c -D_BSD_SOURCE -D_DEFAULT_SOURCE
167+
#_sha1 sha1module.c -I$(srcdir)/Modules/_hacl/include _hacl/Hacl_Hash_SHA1.c -D_BSD_SOURCE -D_DEFAULT_SOURCE
168168
#_sha2 sha2module.c -I$(srcdir)/Modules/_hacl/include Modules/_hacl/libHacl_Streaming_SHA2.a
169169
#_sha3 _sha3/sha3module.c
170170

0 commit comments

Comments
 (0)