Skip to content

Commit 9abd6af

Browse files
committed
Merge branch 'main' into pr/92078
2 parents 1aeb27e + 0a160bf commit 9abd6af

File tree

3 files changed

+7
-60
lines changed

3 files changed

+7
-60
lines changed

Lib/string/__init__.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -191,16 +191,14 @@ def get_identifiers(self):
191191

192192

193193
########################################################################
194-
# the Formatter class
195-
# see PEP 3101 for details and purpose of this class
196-
197-
# The hard parts are reused from the C implementation. They're exposed as "_"
198-
# prefixed methods of str.
199-
194+
# The Formatter class (PEP 3101).
195+
#
200196
# The overall parser is implemented in _string.formatter_parser.
201-
# The field name parser is implemented in _string.formatter_field_name_split
197+
# The field name parser is implemented in _string.formatter_field_name_split.
202198

203199
class Formatter:
200+
"""See PEP 3101 for details and purpose of this class."""
201+
204202
def format(self, format_string, /, *args, **kwargs):
205203
return self.vformat(format_string, args, kwargs)
206204

@@ -293,7 +291,6 @@ def parse(self, format_string):
293291
Return an iterable that contains tuples of the form
294292
(literal_text, field_name, format_spec, conversion).
295293
296-
297294
*field_name* can be None, in which case there's no object
298295
to format and output; otherwise, it is looked up and
299296
formatted with *format_spec* and *conversion*.

Lib/test/test_faulthandler.py

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -166,29 +166,6 @@ def check_windows_exception(self, code, line_number, name_regex, **kw):
166166
fatal_error = 'Windows fatal exception: %s' % name_regex
167167
self.check_error(code, line_number, fatal_error, **kw)
168168

169-
@unittest.skipIf(sys.platform.startswith('aix'),
170-
"the first page of memory is a mapped read-only on AIX")
171-
def test_read_null(self):
172-
if not MS_WINDOWS:
173-
self.check_fatal_error("""
174-
import faulthandler
175-
faulthandler.enable()
176-
faulthandler._read_null()
177-
""",
178-
3,
179-
# Issue #12700: Read NULL raises SIGILL on Mac OS X Lion
180-
'(?:Segmentation fault'
181-
'|Bus error'
182-
'|Illegal instruction)')
183-
else:
184-
self.check_windows_exception("""
185-
import faulthandler
186-
faulthandler.enable()
187-
faulthandler._read_null()
188-
""",
189-
3,
190-
'access violation')
191-
192169
@skip_segfault_on_android
193170
def test_sigsegv(self):
194171
self.check_fatal_error("""

Modules/faulthandler.c

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1069,18 +1069,6 @@ faulthandler_suppress_crash_report(void)
10691069
#endif
10701070
}
10711071

1072-
static PyObject* _Py_NO_SANITIZE_UNDEFINED
1073-
faulthandler_read_null(PyObject *self, PyObject *args)
1074-
{
1075-
volatile int *x;
1076-
volatile int y;
1077-
1078-
faulthandler_suppress_crash_report();
1079-
x = NULL;
1080-
y = *x;
1081-
return PyLong_FromLong(y);
1082-
1083-
}
10841072

10851073
static void
10861074
faulthandler_raise_sigsegv(void)
@@ -1158,23 +1146,12 @@ faulthandler_fatal_error_c_thread(PyObject *self, PyObject *args)
11581146
Py_RETURN_NONE;
11591147
}
11601148

1161-
static PyObject* _Py_NO_SANITIZE_UNDEFINED
1149+
static PyObject*
11621150
faulthandler_sigfpe(PyObject *self, PyObject *Py_UNUSED(dummy))
11631151
{
11641152
faulthandler_suppress_crash_report();
1165-
1166-
/* Do an integer division by zero: raise a SIGFPE on Intel CPU, but not on
1167-
PowerPC. Use volatile to disable compile-time optimizations. */
1168-
volatile int x = 1, y = 0, z;
1169-
z = x / y;
1170-
1171-
/* If the division by zero didn't raise a SIGFPE (e.g. on PowerPC),
1172-
raise it manually. */
11731153
raise(SIGFPE);
1174-
1175-
/* This line is never reached, but we pretend to make something with z
1176-
to silence a compiler warning. */
1177-
return PyLong_FromLong(z);
1154+
Py_UNREACHABLE();
11781155
}
11791156

11801157
static PyObject *
@@ -1316,10 +1293,6 @@ static PyMethodDef module_methods[] = {
13161293
"Unregister the handler of the signal "
13171294
"'signum' registered by register().")},
13181295
#endif
1319-
{"_read_null", faulthandler_read_null, METH_NOARGS,
1320-
PyDoc_STR("_read_null($module, /)\n--\n\n"
1321-
"Read from NULL, raise "
1322-
"a SIGSEGV or SIGBUS signal depending on the platform.")},
13231296
{"_sigsegv", faulthandler_sigsegv, METH_VARARGS,
13241297
PyDoc_STR("_sigsegv($module, release_gil=False, /)\n--\n\n"
13251298
"Raise a SIGSEGV signal.")},

0 commit comments

Comments
 (0)