Skip to content

Commit b473aa9

Browse files
Merge branch 'main' into warn_explicit-no-module
2 parents 9ce17e4 + 75a1cbd commit b473aa9

File tree

68 files changed

+793
-370
lines changed

Some content is hidden

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

68 files changed

+793
-370
lines changed

Apple/iOS/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,17 @@ Once you have a built an XCframework, you can test that framework by running:
224224

225225
$ python Apple test iOS
226226

227+
This test will attempt to find an "SE-class" simulator (i.e., an iPhone SE, or
228+
iPhone 16e, or similar), and run the test suite on the most recent version of
229+
iOS that is available. You can specify a simulator using the `--simulator`
230+
command line argument, providing the name of the simulator (e.g., `--simulator
231+
'iPhone 16 Pro'`). You can also use this argument to control the OS version used
232+
for testing; `--simulator 'iPhone 16 Pro,OS=18.2'` would attempt to run the
233+
tests on an iPhone 16 Pro running iOS 18.2.
234+
235+
If the test runner is executed on GitHub Actions, the `GITHUB_ACTIONS`
236+
environment variable will be exposed to the iOS process at runtime.
237+
227238
### Testing a single-architecture framework
228239

229240
The `Apple/testbed` folder that contains an Xcode project that is able to run

Apple/testbed/TestbedTests/TestbedTests.m

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ - (void)testPython {
3535
setenv("NO_COLOR", "1", true);
3636
setenv("PYTHON_COLORS", "0", true);
3737

38+
if (getenv("GITHUB_ACTIONS")) {
39+
NSLog(@"Running in a GitHub Actions environment");
40+
}
3841
// Arguments to pass into the test suite runner.
3942
// argv[0] must identify the process; any subsequent arg
4043
// will be handled as if it were an argument to `python -m test`

Apple/testbed/__main__.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import argparse
22
import json
3+
import os
34
import re
45
import shutil
56
import subprocess
@@ -78,13 +79,21 @@ def xcode_test(location: Path, platform: str, simulator: str, verbose: bool):
7879
check=True,
7980
)
8081

82+
# Any environment variable prefixed with TEST_RUNNER_ is exposed into the
83+
# test runner environment. There are some variables (like those identifying
84+
# CI platforms) that can be useful to have access to.
85+
test_env = os.environ.copy()
86+
if "GITHUB_ACTIONS" in os.environ:
87+
test_env["TEST_RUNNER_GITHUB_ACTIONS"] = os.environ["GITHUB_ACTIONS"]
88+
8189
print("Running test project...")
8290
# Test execution *can't* be run -quiet; verbose mode
8391
# is how we see the output of the test output.
8492
process = subprocess.Popen(
8593
["xcodebuild", "test-without-building"] + args,
8694
stdout=subprocess.PIPE,
8795
stderr=subprocess.STDOUT,
96+
env=test_env,
8897
)
8998
while line := (process.stdout.readline()).decode(*DECODE_ARGS):
9099
# Strip the timestamp/process prefix from each log line

Doc/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,7 @@
359359
'papersize': 'a4paper',
360360
# The font size ('10pt', '11pt' or '12pt').
361361
'pointsize': '10pt',
362+
'maxlistdepth': '8', # See https://github.com/python/cpython/issues/139588
362363
}
363364

364365
# Grouping the document tree into LaTeX files. List of tuples

Doc/library/logging.rst

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,12 +1082,13 @@ LoggerAdapter Objects
10821082
information into logging calls. For a usage example, see the section on
10831083
:ref:`adding contextual information to your logging output <context-info>`.
10841084

1085-
.. class:: LoggerAdapter(logger, extra, merge_extra=False)
1085+
.. class:: LoggerAdapter(logger, extra=None, merge_extra=False)
10861086

10871087
Returns an instance of :class:`LoggerAdapter` initialized with an
1088-
underlying :class:`Logger` instance, a dict-like object (*extra*), and a
1089-
boolean (*merge_extra*) indicating whether or not the *extra* argument of
1090-
individual log calls should be merged with the :class:`LoggerAdapter` extra.
1088+
underlying :class:`Logger` instance, an optional dict-like object (*extra*),
1089+
and an optional boolean (*merge_extra*) indicating whether or not
1090+
the *extra* argument of individual log calls should be merged with
1091+
the :class:`LoggerAdapter` extra.
10911092
The default behavior is to ignore the *extra* argument of individual log
10921093
calls and only use the one of the :class:`LoggerAdapter` instance
10931094

@@ -1127,9 +1128,13 @@ information into logging calls. For a usage example, see the section on
11271128
Attribute :attr:`!manager` and method :meth:`!_log` were added, which
11281129
delegate to the underlying logger and allow adapters to be nested.
11291130

1131+
.. versionchanged:: 3.10
1132+
1133+
The *extra* argument is now optional.
1134+
11301135
.. versionchanged:: 3.13
11311136

1132-
The *merge_extra* argument was added.
1137+
The *merge_extra* parameter was added.
11331138

11341139

11351140
Thread Safety

Doc/library/unicodedata.rst

Lines changed: 39 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ following functions:
3131
this module.
3232

3333

34-
.. function:: lookup(name)
34+
.. function:: lookup(name, /)
3535

3636
Look up character by name. If a character with the given name is found, return
3737
the corresponding character. If not found, :exc:`KeyError` is raised.
@@ -94,7 +94,7 @@ following functions:
9494
0.5
9595

9696

97-
.. function:: category(chr)
97+
.. function:: category(chr, /)
9898

9999
Returns the general category assigned to the character *chr* as
100100
string. General category names consist of two letters.
@@ -106,7 +106,7 @@ following functions:
106106
'Lu'
107107

108108

109-
.. function:: bidirectional(chr)
109+
.. function:: bidirectional(chr, /)
110110

111111
Returns the bidirectional class assigned to the character *chr* as
112112
string. If no such value is defined, an empty string is returned.
@@ -118,7 +118,7 @@ following functions:
118118
'AN'
119119

120120

121-
.. function:: combining(chr)
121+
.. function:: combining(chr, /)
122122

123123
Returns the canonical combining class assigned to the character *chr*
124124
as integer. Returns ``0`` if no combining class is defined.
@@ -127,14 +127,14 @@ following functions:
127127
for more information.
128128

129129

130-
.. function:: east_asian_width(chr)
130+
.. function:: east_asian_width(chr, /)
131131

132132
Returns the east asian width assigned to the character *chr* as
133133
string. For a list of widths and or more information, see the
134134
`Unicode Standard Annex #11 <https://www.unicode.org/reports/tr11/>`_.
135135

136136

137-
.. function:: mirrored(chr)
137+
.. function:: mirrored(chr, /)
138138

139139
Returns the mirrored property assigned to the character *chr* as
140140
integer. Returns ``1`` if the character has been identified as a "mirrored"
@@ -144,7 +144,37 @@ following functions:
144144
1
145145

146146

147-
.. function:: decomposition(chr)
147+
.. function:: isxidstart(chr, /)
148+
149+
Return ``True`` if *chr* is a valid identifier start per the
150+
`Unicode Standard Annex #31 <https://www.unicode.org/reports/tr31/>`_,
151+
that is, it has the ``XID_Start`` property. Return ``False`` otherwise.
152+
For example::
153+
154+
>>> unicodedata.isxidstart('S')
155+
True
156+
>>> unicodedata.isxidstart('0')
157+
False
158+
159+
.. versionadded:: next
160+
161+
162+
.. function:: isxidcontinue(chr, /)
163+
164+
Return ``True`` if *chr* is a valid identifier character per the
165+
`Unicode Standard Annex #31 <https://www.unicode.org/reports/tr31/>`_,
166+
that is, it has the ``XID_Continue`` property. Return ``False`` otherwise.
167+
For example::
168+
169+
>>> unicodedata.isxidcontinue('S')
170+
True
171+
>>> unicodedata.isxidcontinue(' ')
172+
False
173+
174+
.. versionadded:: next
175+
176+
177+
.. function:: decomposition(chr, /)
148178

149179
Returns the character decomposition mapping assigned to the character
150180
*chr* as string. An empty string is returned in case no such mapping is
@@ -154,7 +184,7 @@ following functions:
154184
'0041 0303'
155185

156186

157-
.. function:: normalize(form, unistr)
187+
.. function:: normalize(form, unistr, /)
158188

159189
Return the normal form *form* for the Unicode string *unistr*. Valid values for
160190
*form* are 'NFC', 'NFKC', 'NFD', and 'NFKD'.
@@ -187,7 +217,7 @@ following functions:
187217
doesn't, they may not compare equal.
188218

189219

190-
.. function:: is_normalized(form, unistr)
220+
.. function:: is_normalized(form, unistr, /)
191221

192222
Return whether the Unicode string *unistr* is in the normal form *form*. Valid
193223
values for *form* are 'NFC', 'NFKC', 'NFD', and 'NFKD'.

Doc/whatsnew/3.15.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -806,6 +806,11 @@ unicodedata
806806

807807
* The Unicode database has been updated to Unicode 17.0.0.
808808

809+
* Add :func:`unicodedata.isxidstart` and :func:`unicodedata.isxidcontinue`
810+
functions to check whether a character can start or continue a
811+
`Unicode Standard Annex #31 <https://www.unicode.org/reports/tr31/>`_ identifier.
812+
(Contributed by Stan Ulbrych in :gh:`129117`.)
813+
809814

810815
wave
811816
----

Include/internal/pycore_compile.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ extern int _PyAST_Preprocess(
4949
PyObject *filename,
5050
int optimize,
5151
int ff_features,
52-
int syntax_check_only);
52+
int syntax_check_only,
53+
int enable_warnings);
5354

5455

5556
typedef struct {
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#ifndef Py_INTERNAL_UNICODECTYPE_H
2+
#define Py_INTERNAL_UNICODECTYPE_H
3+
#ifdef __cplusplus
4+
extern "C" {
5+
#endif
6+
7+
#ifndef Py_BUILD_CORE
8+
# error "this header requires Py_BUILD_CORE define"
9+
#endif
10+
11+
extern int _PyUnicode_ToLowerFull(Py_UCS4 ch, Py_UCS4 *res);
12+
extern int _PyUnicode_ToTitleFull(Py_UCS4 ch, Py_UCS4 *res);
13+
extern int _PyUnicode_ToUpperFull(Py_UCS4 ch, Py_UCS4 *res);
14+
extern int _PyUnicode_ToFoldedFull(Py_UCS4 ch, Py_UCS4 *res);
15+
extern int _PyUnicode_IsCaseIgnorable(Py_UCS4 ch);
16+
extern int _PyUnicode_IsCased(Py_UCS4 ch);
17+
18+
// Export for 'unicodedata' shared extension.
19+
PyAPI_FUNC(int) _PyUnicode_IsXidStart(Py_UCS4 ch);
20+
PyAPI_FUNC(int) _PyUnicode_IsXidContinue(Py_UCS4 ch);
21+
22+
#ifdef __cplusplus
23+
}
24+
#endif
25+
#endif /* !Py_INTERNAL_UNICODECTYPE_H */

Include/internal/pycore_unicodeobject.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -74,18 +74,6 @@ _PyUnicodeWriter_WriteCharInline(_PyUnicodeWriter *writer, Py_UCS4 ch)
7474
return 0;
7575
}
7676

77-
78-
/* --- Characters Type APIs ----------------------------------------------- */
79-
80-
extern int _PyUnicode_IsXidStart(Py_UCS4 ch);
81-
extern int _PyUnicode_IsXidContinue(Py_UCS4 ch);
82-
extern int _PyUnicode_ToLowerFull(Py_UCS4 ch, Py_UCS4 *res);
83-
extern int _PyUnicode_ToTitleFull(Py_UCS4 ch, Py_UCS4 *res);
84-
extern int _PyUnicode_ToUpperFull(Py_UCS4 ch, Py_UCS4 *res);
85-
extern int _PyUnicode_ToFoldedFull(Py_UCS4 ch, Py_UCS4 *res);
86-
extern int _PyUnicode_IsCaseIgnorable(Py_UCS4 ch);
87-
extern int _PyUnicode_IsCased(Py_UCS4 ch);
88-
8977
/* --- Unicode API -------------------------------------------------------- */
9078

9179
// Export for '_json' shared extension

0 commit comments

Comments
 (0)