From fc68cbcecbc727ce6653ce2f4a4269f14cb317c5 Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Wed, 25 Jun 2025 13:55:42 +0200 Subject: [PATCH 1/5] gh-120713: Make _Py_NORMALIZE_CENTURY private --- Modules/_datetimemodule.c | 2 +- configure | 2 +- configure.ac | 2 +- pyconfig.h.in | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Modules/_datetimemodule.c b/Modules/_datetimemodule.c index eb90be81c8d34c..7a6426593d021f 100644 --- a/Modules/_datetimemodule.c +++ b/Modules/_datetimemodule.c @@ -1934,7 +1934,7 @@ wrap_strftime(PyObject *object, PyObject *format, PyObject *timetuple, } replacement = freplacement; } -#ifdef Py_NORMALIZE_CENTURY +#ifdef _Py_NORMALIZE_CENTURY else if (ch == 'Y' || ch == 'G' || ch == 'F' || ch == 'C' ) { diff --git a/configure b/configure index 50223d81cd976e..ddb5e57a4e31b7 100755 --- a/configure +++ b/configure @@ -28234,7 +28234,7 @@ printf "%s\n" "$ac_cv_normalize_century" >&6; } if test "$ac_cv_normalize_century" = yes then -printf "%s\n" "#define Py_NORMALIZE_CENTURY 1" >>confdefs.h +printf "%s\n" "#define _Py_NORMALIZE_CENTURY 1" >>confdefs.h fi diff --git a/configure.ac b/configure.ac index f58e16c774f4aa..d5331da2480a52 100644 --- a/configure.ac +++ b/configure.ac @@ -6813,7 +6813,7 @@ int main(void) [ac_cv_normalize_century=yes])]) if test "$ac_cv_normalize_century" = yes then - AC_DEFINE([Py_NORMALIZE_CENTURY], [1], + AC_DEFINE([_Py_NORMALIZE_CENTURY], [1], [Define if year with century should be normalized for strftime.]) fi diff --git a/pyconfig.h.in b/pyconfig.h.in index 65a2c55217c258..fe313b2ba4335e 100644 --- a/pyconfig.h.in +++ b/pyconfig.h.in @@ -1746,9 +1746,6 @@ SipHash13: 3, externally defined: 0 */ #undef Py_HASH_ALGORITHM -/* Define if year with century should be normalized for strftime. */ -#undef Py_NORMALIZE_CENTURY - /* Define if you want to enable remote debugging support. */ #undef Py_REMOTE_DEBUG @@ -2026,6 +2023,9 @@ /* Maximum length in bytes of a thread name */ #undef _PYTHREAD_NAME_MAXLEN +/* Define if year with century should be normalized for strftime. */ +#undef _Py_NORMALIZE_CENTURY + /* Define to force use of thread-safe errno, h_errno, and other functions */ #undef _REENTRANT From 55572d43a77e41b694bb02d3fa6b53f0d51758c0 Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Wed, 25 Jun 2025 15:44:08 +0200 Subject: [PATCH 2/5] Turn the __future__ table to list-table This'll make it easier to add entries that need longer markup --- Doc/library/__future__.rst | 78 ++++++++++++++++++++++---------------- 1 file changed, 46 insertions(+), 32 deletions(-) diff --git a/Doc/library/__future__.rst b/Doc/library/__future__.rst index 4f3b663006fb28..1d068da51f5f76 100644 --- a/Doc/library/__future__.rst +++ b/Doc/library/__future__.rst @@ -37,38 +37,52 @@ No feature description will ever be deleted from :mod:`__future__`. Since its introduction in Python 2.1 the following features have found their way into the language using this mechanism: -+------------------+-------------+--------------+---------------------------------------------+ -| feature | optional in | mandatory in | effect | -+==================+=============+==============+=============================================+ -| nested_scopes | 2.1.0b1 | 2.2 | :pep:`227`: | -| | | | *Statically Nested Scopes* | -+------------------+-------------+--------------+---------------------------------------------+ -| generators | 2.2.0a1 | 2.3 | :pep:`255`: | -| | | | *Simple Generators* | -+------------------+-------------+--------------+---------------------------------------------+ -| division | 2.2.0a2 | 3.0 | :pep:`238`: | -| | | | *Changing the Division Operator* | -+------------------+-------------+--------------+---------------------------------------------+ -| absolute_import | 2.5.0a1 | 3.0 | :pep:`328`: | -| | | | *Imports: Multi-Line and Absolute/Relative* | -+------------------+-------------+--------------+---------------------------------------------+ -| with_statement | 2.5.0a1 | 2.6 | :pep:`343`: | -| | | | *The "with" Statement* | -+------------------+-------------+--------------+---------------------------------------------+ -| print_function | 2.6.0a2 | 3.0 | :pep:`3105`: | -| | | | *Make print a function* | -+------------------+-------------+--------------+---------------------------------------------+ -| unicode_literals | 2.6.0a2 | 3.0 | :pep:`3112`: | -| | | | *Bytes literals in Python 3000* | -+------------------+-------------+--------------+---------------------------------------------+ -| generator_stop | 3.5.0b1 | 3.7 | :pep:`479`: | -| | | | *StopIteration handling inside generators* | -+------------------+-------------+--------------+---------------------------------------------+ -| annotations | 3.7.0b1 | Never [1]_ | :pep:`563`: | -| | | | *Postponed evaluation of annotations*, | -| | | | :pep:`649`: *Deferred evaluation of | -| | | | annotations using descriptors* | -+------------------+-------------+--------------+---------------------------------------------+ + +.. list-table:: + :widths: auto + :header-rows: 1 + + * * feature + * optional in + * mandatory in + * effect + * * nested_scopes + * 2.1.0b1 + * 2.2 + * :pep:`227`: *Statically Nested Scopes* + * * generators + * 2.2.0a1 + * 2.3 + * :pep:`255`: *Simple Generators* + * * division + * 2.2.0a2 + * 3.0 + * :pep:`238`: *Changing the Division Operator* + * * absolute_import + * 2.5.0a1 + * 3.0 + * :pep:`328`: *Imports: Multi-Line and Absolute/Relative* + * * with_statement + * 2.5.0a1 + * 2.6 + * :pep:`343`: *The “with” Statement* + * * print_function + * 2.6.0a2 + * 3.0 + * :pep:`3105`: *Make print a function* + * * unicode_literals + * 2.6.0a2 + * 3.0 + * :pep:`3112`: *Bytes literals in Python 3000* + * * generator_stop + * 3.5.0b1 + * 3.7 + * :pep:`479`: *StopIteration handling inside generators* + * * annotations + * 3.7.0b1 + * Never [1]_ + * :pep:`563`: *Postponed evaluation of annotations*, + :pep:`649`: *Deferred evaluation of annotations using descriptors* .. XXX Adding a new entry? Remember to update simple_stmts.rst, too. From 3e5a8f946f4afb6356a792ec1ee4184c6e0fc2bf Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Wed, 25 Jun 2025 15:47:07 +0200 Subject: [PATCH 3/5] Semantic markup for __future__ feature descriptions --- Doc/library/__future__.rst | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Doc/library/__future__.rst b/Doc/library/__future__.rst index 1d068da51f5f76..5d916b30112d3c 100644 --- a/Doc/library/__future__.rst +++ b/Doc/library/__future__.rst @@ -46,39 +46,39 @@ language using this mechanism: * optional in * mandatory in * effect - * * nested_scopes + * * .. data:: nested_scopes * 2.1.0b1 * 2.2 * :pep:`227`: *Statically Nested Scopes* - * * generators + * * .. data:: generators * 2.2.0a1 * 2.3 * :pep:`255`: *Simple Generators* - * * division + * * .. data:: division * 2.2.0a2 * 3.0 * :pep:`238`: *Changing the Division Operator* - * * absolute_import + * * .. data:: absolute_import * 2.5.0a1 * 3.0 * :pep:`328`: *Imports: Multi-Line and Absolute/Relative* - * * with_statement + * * .. data:: with_statement * 2.5.0a1 * 2.6 * :pep:`343`: *The “with” Statement* - * * print_function + * * .. data:: print_function * 2.6.0a2 * 3.0 * :pep:`3105`: *Make print a function* - * * unicode_literals + * * .. data:: unicode_literals * 2.6.0a2 * 3.0 * :pep:`3112`: *Bytes literals in Python 3000* - * * generator_stop + * * .. data:: generator_stop * 3.5.0b1 * 3.7 * :pep:`479`: *StopIteration handling inside generators* - * * annotations + * * .. data:: annotations * 3.7.0b1 * Never [1]_ * :pep:`563`: *Postponed evaluation of annotations*, From 83072af3c6c4996acc25cd93e6968d7783520a85 Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Mon, 7 Jul 2025 12:31:34 +0200 Subject: [PATCH 4/5] Revert accidentally-pushed commit This reverts commit 3e5a8f946f4afb6356a792ec1ee4184c6e0fc2bf. --- Doc/library/__future__.rst | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Doc/library/__future__.rst b/Doc/library/__future__.rst index 5d916b30112d3c..1d068da51f5f76 100644 --- a/Doc/library/__future__.rst +++ b/Doc/library/__future__.rst @@ -46,39 +46,39 @@ language using this mechanism: * optional in * mandatory in * effect - * * .. data:: nested_scopes + * * nested_scopes * 2.1.0b1 * 2.2 * :pep:`227`: *Statically Nested Scopes* - * * .. data:: generators + * * generators * 2.2.0a1 * 2.3 * :pep:`255`: *Simple Generators* - * * .. data:: division + * * division * 2.2.0a2 * 3.0 * :pep:`238`: *Changing the Division Operator* - * * .. data:: absolute_import + * * absolute_import * 2.5.0a1 * 3.0 * :pep:`328`: *Imports: Multi-Line and Absolute/Relative* - * * .. data:: with_statement + * * with_statement * 2.5.0a1 * 2.6 * :pep:`343`: *The “with” Statement* - * * .. data:: print_function + * * print_function * 2.6.0a2 * 3.0 * :pep:`3105`: *Make print a function* - * * .. data:: unicode_literals + * * unicode_literals * 2.6.0a2 * 3.0 * :pep:`3112`: *Bytes literals in Python 3000* - * * .. data:: generator_stop + * * generator_stop * 3.5.0b1 * 3.7 * :pep:`479`: *StopIteration handling inside generators* - * * .. data:: annotations + * * annotations * 3.7.0b1 * Never [1]_ * :pep:`563`: *Postponed evaluation of annotations*, From 44ad0142c52019ea8e05f6c5361bc6025a234c18 Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Mon, 7 Jul 2025 12:31:54 +0200 Subject: [PATCH 5/5] Revert accidentally-pushed commit This reverts commit 55572d43a77e41b694bb02d3fa6b53f0d51758c0. --- Doc/library/__future__.rst | 78 ++++++++++++++++---------------------- 1 file changed, 32 insertions(+), 46 deletions(-) diff --git a/Doc/library/__future__.rst b/Doc/library/__future__.rst index 1d068da51f5f76..4f3b663006fb28 100644 --- a/Doc/library/__future__.rst +++ b/Doc/library/__future__.rst @@ -37,52 +37,38 @@ No feature description will ever be deleted from :mod:`__future__`. Since its introduction in Python 2.1 the following features have found their way into the language using this mechanism: - -.. list-table:: - :widths: auto - :header-rows: 1 - - * * feature - * optional in - * mandatory in - * effect - * * nested_scopes - * 2.1.0b1 - * 2.2 - * :pep:`227`: *Statically Nested Scopes* - * * generators - * 2.2.0a1 - * 2.3 - * :pep:`255`: *Simple Generators* - * * division - * 2.2.0a2 - * 3.0 - * :pep:`238`: *Changing the Division Operator* - * * absolute_import - * 2.5.0a1 - * 3.0 - * :pep:`328`: *Imports: Multi-Line and Absolute/Relative* - * * with_statement - * 2.5.0a1 - * 2.6 - * :pep:`343`: *The “with” Statement* - * * print_function - * 2.6.0a2 - * 3.0 - * :pep:`3105`: *Make print a function* - * * unicode_literals - * 2.6.0a2 - * 3.0 - * :pep:`3112`: *Bytes literals in Python 3000* - * * generator_stop - * 3.5.0b1 - * 3.7 - * :pep:`479`: *StopIteration handling inside generators* - * * annotations - * 3.7.0b1 - * Never [1]_ - * :pep:`563`: *Postponed evaluation of annotations*, - :pep:`649`: *Deferred evaluation of annotations using descriptors* ++------------------+-------------+--------------+---------------------------------------------+ +| feature | optional in | mandatory in | effect | ++==================+=============+==============+=============================================+ +| nested_scopes | 2.1.0b1 | 2.2 | :pep:`227`: | +| | | | *Statically Nested Scopes* | ++------------------+-------------+--------------+---------------------------------------------+ +| generators | 2.2.0a1 | 2.3 | :pep:`255`: | +| | | | *Simple Generators* | ++------------------+-------------+--------------+---------------------------------------------+ +| division | 2.2.0a2 | 3.0 | :pep:`238`: | +| | | | *Changing the Division Operator* | ++------------------+-------------+--------------+---------------------------------------------+ +| absolute_import | 2.5.0a1 | 3.0 | :pep:`328`: | +| | | | *Imports: Multi-Line and Absolute/Relative* | ++------------------+-------------+--------------+---------------------------------------------+ +| with_statement | 2.5.0a1 | 2.6 | :pep:`343`: | +| | | | *The "with" Statement* | ++------------------+-------------+--------------+---------------------------------------------+ +| print_function | 2.6.0a2 | 3.0 | :pep:`3105`: | +| | | | *Make print a function* | ++------------------+-------------+--------------+---------------------------------------------+ +| unicode_literals | 2.6.0a2 | 3.0 | :pep:`3112`: | +| | | | *Bytes literals in Python 3000* | ++------------------+-------------+--------------+---------------------------------------------+ +| generator_stop | 3.5.0b1 | 3.7 | :pep:`479`: | +| | | | *StopIteration handling inside generators* | ++------------------+-------------+--------------+---------------------------------------------+ +| annotations | 3.7.0b1 | Never [1]_ | :pep:`563`: | +| | | | *Postponed evaluation of annotations*, | +| | | | :pep:`649`: *Deferred evaluation of | +| | | | annotations using descriptors* | ++------------------+-------------+--------------+---------------------------------------------+ .. XXX Adding a new entry? Remember to update simple_stmts.rst, too.