Skip to content

Commit 166aab0

Browse files
Merge remote-tracking branch 'upstream/main' into tail-call
2 parents e545c55 + 2228e92 commit 166aab0

File tree

8 files changed

+57
-19
lines changed

8 files changed

+57
-19
lines changed

.github/workflows/reusable-docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ jobs:
9999
# Run "doctest" on HEAD as new syntax doesn't exist in the latest stable release
100100
doctest:
101101
name: 'Doctest'
102-
runs-on: ubuntu-22.04
102+
runs-on: ubuntu-24.04
103103
timeout-minutes: 60
104104
steps:
105105
- uses: actions/checkout@v4

Doc/using/configure.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Features and minimum versions required to build CPython:
2929

3030
* Tcl/Tk 8.5.12 for the :mod:`tkinter` module.
3131

32-
* Autoconf 2.71 and aclocal 1.16.5 are required to regenerate the
32+
* Autoconf 2.72 and aclocal 1.16.5 are required to regenerate the
3333
:file:`configure` script.
3434

3535
.. versionchanged:: 3.1
@@ -58,6 +58,9 @@ Features and minimum versions required to build CPython:
5858
.. versionchanged:: 3.13
5959
Autoconf 2.71, aclocal 1.16.5 and SQLite 3.15.2 are now required.
6060

61+
.. versionchanged:: next
62+
Autoconf 2.72 is now required.
63+
6164
See also :pep:`7` "Style Guide for C Code" and :pep:`11` "CPython platform
6265
support".
6366

Include/cpython/unicodeobject.h

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ typedef struct {
109109
3: Interned, Immortal, and Static
110110
This categorization allows the runtime to determine the right
111111
cleanup mechanism at runtime shutdown. */
112-
unsigned int interned:2;
112+
uint16_t interned;
113113
/* Character size:
114114
115115
- PyUnicode_1BYTE_KIND (1):
@@ -132,21 +132,23 @@ typedef struct {
132132
* all characters are in the range U+0000-U+10FFFF
133133
* at least one character is in the range U+10000-U+10FFFF
134134
*/
135-
unsigned int kind:3;
135+
unsigned short kind:3;
136136
/* Compact is with respect to the allocation scheme. Compact unicode
137137
objects only require one memory block while non-compact objects use
138138
one block for the PyUnicodeObject struct and another for its data
139139
buffer. */
140-
unsigned int compact:1;
140+
unsigned short compact:1;
141141
/* The string only contains characters in the range U+0000-U+007F (ASCII)
142142
and the kind is PyUnicode_1BYTE_KIND. If ascii is set and compact is
143143
set, use the PyASCIIObject structure. */
144-
unsigned int ascii:1;
144+
unsigned short ascii:1;
145145
/* The object is statically allocated. */
146-
unsigned int statically_allocated:1;
146+
unsigned short statically_allocated:1;
147147
/* Padding to ensure that PyUnicode_DATA() is always aligned to
148-
4 bytes (see issue #19537 on m68k). */
149-
unsigned int :24;
148+
4 bytes (see issue #19537 on m68k) and we use unsigned short to avoid
149+
the extra four bytes on 32-bit Windows. This is restricted features
150+
for specific compilers including GCC, MSVC, Clang and IBM's XL compiler. */
151+
unsigned short :10;
150152
} state;
151153
} PyASCIIObject;
152154

@@ -195,7 +197,11 @@ typedef struct {
195197

196198
/* Use only if you know it's a string */
197199
static inline unsigned int PyUnicode_CHECK_INTERNED(PyObject *op) {
200+
#ifdef Py_GIL_DISABLED
201+
return _Py_atomic_load_uint16_relaxed(&_PyASCIIObject_CAST(op)->state.interned);
202+
#else
198203
return _PyASCIIObject_CAST(op)->state.interned;
204+
#endif
199205
}
200206
#define PyUnicode_CHECK_INTERNED(op) PyUnicode_CHECK_INTERNED(_PyObject_CAST(op))
201207

Lib/_pydatetime.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2392,7 +2392,6 @@ def __reduce__(self):
23922392

23932393
def _isoweek1monday(year):
23942394
# Helper to calculate the day number of the Monday starting week 1
2395-
# XXX This could be done more efficiently
23962395
THURSDAY = 3
23972396
firstday = _ymd2ord(year, 1, 1)
23982397
firstweekday = (firstday + 6) % 7 # See weekday() above
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Update :c:type:`PyASCIIObject` layout to handle interned field with the
2+
atomic operation. Patch by Donghee Na.

Objects/unicodeobject.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15729,7 +15729,7 @@ immortalize_interned(PyObject *s)
1572915729
_Py_DecRefTotal(_PyThreadState_GET());
1573015730
}
1573115731
#endif
15732-
_PyUnicode_STATE(s).interned = SSTATE_INTERNED_IMMORTAL;
15732+
FT_ATOMIC_STORE_UINT16_RELAXED(_PyUnicode_STATE(s).interned, SSTATE_INTERNED_IMMORTAL);
1573315733
_Py_SetImmortal(s);
1573415734
}
1573515735

@@ -15848,7 +15848,7 @@ intern_common(PyInterpreterState *interp, PyObject *s /* stolen */,
1584815848
_Py_DecRefTotal(_PyThreadState_GET());
1584915849
#endif
1585015850
}
15851-
_PyUnicode_STATE(s).interned = SSTATE_INTERNED_MORTAL;
15851+
FT_ATOMIC_STORE_UINT16_RELAXED(_PyUnicode_STATE(s).interned, SSTATE_INTERNED_MORTAL);
1585215852

1585315853
/* INTERNED_MORTAL -> INTERNED_IMMORTAL (if needed) */
1585415854

@@ -15984,7 +15984,7 @@ _PyUnicode_ClearInterned(PyInterpreterState *interp)
1598415984
Py_UNREACHABLE();
1598515985
}
1598615986
if (!shared) {
15987-
_PyUnicode_STATE(s).interned = SSTATE_NOT_INTERNED;
15987+
FT_ATOMIC_STORE_UINT16_RELAXED(_PyUnicode_STATE(s).interned, SSTATE_NOT_INTERNED);
1598815988
}
1598915989
}
1599015990
#ifdef INTERNED_STATS

configure

Lines changed: 16 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

configure.ac

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ dnl ************************************************************
22
dnl * Please run autoreconf -ivf -Werror to test your changes! *
33
dnl ************************************************************
44
dnl
5-
dnl Python's configure script requires autoconf 2.71, autoconf-archive,
5+
dnl Python's configure script requires autoconf 2.72, autoconf-archive,
66
dnl aclocal 1.16, and pkg-config.
77
dnl
88
dnl It is recommended to use the Tools/build/regen-configure.sh shell script
@@ -12,7 +12,7 @@ dnl
1212
# Set VERSION so we only need to edit in one place (i.e., here)
1313
m4_define([PYTHON_VERSION], [3.14])
1414

15-
AC_PREREQ([2.71])
15+
AC_PREREQ([2.72])
1616

1717
AC_INIT([python],[PYTHON_VERSION],[https://github.com/python/cpython/issues/])
1818

@@ -2176,14 +2176,28 @@ AS_VAR_IF([enable_shared], [yes], [
21762176
BOLT_BINARIES="${BOLT_BINARIES} \$(INSTSONAME)"
21772177
])
21782178

2179+
AC_ARG_VAR(
2180+
[BOLT_COMMON_FLAGS],
2181+
[Common arguments to llvm-bolt when instrumenting and applying]
2182+
)
2183+
2184+
AC_MSG_CHECKING([BOLT_COMMON_FLAGS])
2185+
if test -z "${BOLT_COMMON_FLAGS}"
2186+
then
2187+
AS_VAR_SET(
2188+
[BOLT_COMMON_FLAGS],
2189+
[-update-debug-sections]
2190+
)
2191+
fi
2192+
21792193
AC_ARG_VAR(
21802194
[BOLT_INSTRUMENT_FLAGS],
21812195
[Arguments to llvm-bolt when instrumenting binaries]
21822196
)
21832197
AC_MSG_CHECKING([BOLT_INSTRUMENT_FLAGS])
21842198
if test -z "${BOLT_INSTRUMENT_FLAGS}"
21852199
then
2186-
BOLT_INSTRUMENT_FLAGS=
2200+
BOLT_INSTRUMENT_FLAGS="${BOLT_COMMON_FLAGS}"
21872201
fi
21882202
AC_MSG_RESULT([$BOLT_INSTRUMENT_FLAGS])
21892203

@@ -2197,7 +2211,7 @@ then
21972211
AS_VAR_SET(
21982212
[BOLT_APPLY_FLAGS],
21992213
[m4_normalize("
2200-
-update-debug-sections
2214+
${BOLT_COMMON_FLAGS}
22012215
-reorder-blocks=ext-tsp
22022216
-reorder-functions=cdsort
22032217
-split-functions

0 commit comments

Comments
 (0)