Skip to content

Commit 039b14d

Browse files
committed
Merge branch 'main' into make-gen-in-bytecode
2 parents 79b6d11 + 16901c0 commit 039b14d

File tree

159 files changed

+1627
-402
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

159 files changed

+1627
-402
lines changed

Doc/library/time.rst

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -476,10 +476,10 @@ Functions
476476
| | negative time difference from UTC/GMT of the | |
477477
| | form +HHMM or -HHMM, where H represents decimal| |
478478
| | hour digits and M represents decimal minute | |
479-
| | digits [-23:59, +23:59]. | |
479+
| | digits [-23:59, +23:59]. [1]_ | |
480480
+-----------+------------------------------------------------+-------+
481481
| ``%Z`` | Time zone name (no characters if no time zone | |
482-
| | exists). | |
482+
| | exists). Deprecated. [1]_ | |
483483
+-----------+------------------------------------------------+-------+
484484
| ``%%`` | A literal ``'%'`` character. | |
485485
+-----------+------------------------------------------------+-------+
@@ -500,7 +500,7 @@ Functions
500500
calculations when the day of the week and the year are specified.
501501

502502
Here is an example, a format for dates compatible with that specified in the
503-
:rfc:`2822` Internet email standard. [#]_ ::
503+
:rfc:`2822` Internet email standard. [1]_ ::
504504

505505
>>> from time import gmtime, strftime
506506
>>> strftime("%a, %d %b %Y %H:%M:%S +0000", gmtime())
@@ -928,10 +928,9 @@ Timezone Constants
928928

929929
.. rubric:: Footnotes
930930

931-
.. [#] The use of ``%Z`` is now deprecated, but the ``%z`` escape that expands to the
932-
preferred hour/minute offset is not supported by all ANSI C libraries. Also, a
931+
.. [1] The use of ``%Z`` is now deprecated, but the ``%z`` escape that expands to the
932+
preferred hour/minute offset is not supported by all ANSI C libraries. Also, a
933933
strict reading of the original 1982 :rfc:`822` standard calls for a two-digit
934-
year (%y rather than %Y), but practice moved to 4-digit years long before the
934+
year (``%y`` rather than ``%Y``), but practice moved to 4-digit years long before the
935935
year 2000. After that, :rfc:`822` became obsolete and the 4-digit year has
936936
been first recommended by :rfc:`1123` and then mandated by :rfc:`2822`.
937-

Doc/library/timeit.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,13 @@ It is possible to provide a setup statement that is executed only once at the be
282282
$ python -m timeit -s 'text = "sample string"; char = "g"' 'text.find(char)'
283283
1000000 loops, best of 5: 0.342 usec per loop
284284
285+
In the output, there are three fields. The loop count, which tells you how many
286+
times the statement body was run per timing loop repetition. The repetition
287+
count ('best of 5') which tells you how many times the timing loop was
288+
repeated, and finally the time the statement body took on average within the
289+
best repetition of the timing loop. That is, the time the fastest repetition
290+
took divided by the loop count.
291+
285292
::
286293

287294
>>> import timeit

Doc/using/configure.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ General Options
3535

3636
Define the size in bits of Python :class:`int` digits: 15 or 30 bits.
3737

38-
By default, the number of bits is selected depending on ``sizeof(void*)``:
39-
30 bits if ``void*`` size is 64-bit or larger, 15 bits otherwise.
38+
By default, the digit size is 30.
4039

4140
Define the ``PYLONG_BITS_IN_DIGIT`` to ``15`` or ``30``.
4241

Doc/whatsnew/3.11.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -622,6 +622,16 @@ Build Changes
622622
like Pyodide.
623623
(Contributed by Christian Heimes and Ethan Smith in :issue:`40280`.)
624624

625+
* CPython will now use 30-bit digits by default for the Python :class:`int`
626+
implementation. Previously, the default was to use 30-bit digits on platforms
627+
with ``SIZEOF_VOID_P >= 8``, and 15-bit digits otherwise. It's still possible
628+
to explicitly request use of 15-bit digits via either the
629+
``--enable-big-digits`` option to the configure script or (for Windows) the
630+
``PYLONG_BITS_IN_DIGIT`` variable in ``PC/pyconfig.h``, but this option may
631+
be removed at some point in the future. (Contributed by Mark Dickinson in
632+
:issue:`45569`.)
633+
634+
625635
C API Changes
626636
=============
627637

Include/patchlevel.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@
2020
#define PY_MINOR_VERSION 11
2121
#define PY_MICRO_VERSION 0
2222
#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_ALPHA
23-
#define PY_RELEASE_SERIAL 3
23+
#define PY_RELEASE_SERIAL 4
2424

2525
/* Version as a string */
26-
#define PY_VERSION "3.11.0a3+"
26+
#define PY_VERSION "3.11.0a4+"
2727
/*--end constants--*/
2828

2929
/* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2.

Include/pyport.h

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -85,20 +85,12 @@ Used in: Py_SAFE_DOWNCAST
8585
#define PY_INT32_T int32_t
8686
#define PY_INT64_T int64_t
8787

88-
/* If PYLONG_BITS_IN_DIGIT is not defined then we'll use 30-bit digits if all
89-
the necessary integer types are available, and we're on a 64-bit platform
90-
(as determined by SIZEOF_VOID_P); otherwise we use 15-bit digits.
91-
92-
From pyodide: WASM has 32 bit pointers but has native 64 bit arithmetic
93-
so it is more efficient to use 30 bit digits.
88+
/* PYLONG_BITS_IN_DIGIT describes the number of bits per "digit" (limb) in the
89+
* PyLongObject implementation (longintrepr.h). It's currently either 30 or 15,
90+
* defaulting to 30. The 15-bit digit option may be removed in the future.
9491
*/
95-
9692
#ifndef PYLONG_BITS_IN_DIGIT
97-
#if SIZEOF_VOID_P >= 8 || defined(__wasm__)
98-
# define PYLONG_BITS_IN_DIGIT 30
99-
#else
100-
# define PYLONG_BITS_IN_DIGIT 15
101-
#endif
93+
#define PYLONG_BITS_IN_DIGIT 30
10294
#endif
10395

10496
/* uintptr_t is the C9X name for an unsigned integral type such that a

Lib/enum.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,7 @@ def _create_(cls, class_name, names, *, module=None, qualname=None, type=None, s
763763
"""
764764
metacls = cls.__class__
765765
bases = (cls, ) if type is None else (type, cls)
766-
_, first_enum = cls._get_mixins_(cls, bases)
766+
_, first_enum = cls._get_mixins_(class_name, bases)
767767
classdict = metacls.__prepare__(class_name, bases)
768768

769769
# special processing needed for names?
@@ -848,8 +848,8 @@ def _check_for_existing_members(class_name, bases):
848848
% (class_name, base.__name__)
849849
)
850850

851-
@staticmethod
852-
def _get_mixins_(class_name, bases):
851+
@classmethod
852+
def _get_mixins_(cls, class_name, bases):
853853
"""
854854
Returns the type for creating enum members, and the first inherited
855855
enum class.
@@ -890,9 +890,8 @@ def _find_data_type(bases):
890890
if not issubclass(first_enum, Enum):
891891
raise TypeError("new enumerations should be created as "
892892
"`EnumName([mixin_type, ...] [data_type,] enum_type)`")
893+
cls._check_for_existing_members(class_name, bases)
893894
member_type = _find_data_type(bases) or object
894-
if first_enum._member_names_:
895-
raise TypeError("Cannot extend enumerations")
896895
return member_type, first_enum
897896

898897
@staticmethod

0 commit comments

Comments
 (0)