From 81b04ed2af4d8cbbb6e94c08874eeb7b1bdea25b Mon Sep 17 00:00:00 2001 From: Wulian233 <1055917385@qq.com> Date: Wed, 21 Aug 2024 19:06:46 +0800 Subject: [PATCH 1/2] typo --- Lib/test/test_asyncio/test_timeouts.py | 2 +- Lib/test/test_capi/test_exceptions.py | 2 +- Lib/test/test_pdb.py | 2 +- Lib/test/test_statistics.py | 2 +- Lib/test/test_typing.py | 2 +- Lib/test/test_unicodedata.py | 4 ++-- Lib/test/test_weakref.py | 4 ++-- Lib/tkinter/__init__.py | 4 ++-- Modules/_ctypes/_ctypes_test.c | 4 ++-- Objects/object.c | 6 +++--- 10 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Lib/test/test_asyncio/test_timeouts.py b/Lib/test/test_asyncio/test_timeouts.py index 1f7f9ee696a525..f5543e191d07ff 100644 --- a/Lib/test/test_asyncio/test_timeouts.py +++ b/Lib/test/test_asyncio/test_timeouts.py @@ -220,7 +220,7 @@ async def test_nested_timeouts_loop_busy(self): # Pretend the loop is busy for a while. time.sleep(0.1) await asyncio.sleep(1) - # TimeoutError was cought by (2) + # TimeoutError was caught by (2) await asyncio.sleep(10) # This sleep should be interrupted by (1) t1 = loop.time() self.assertTrue(t0 <= t1 <= t0 + 1) diff --git a/Lib/test/test_capi/test_exceptions.py b/Lib/test/test_capi/test_exceptions.py index c475b6d78d0c56..b22ddd8ad858d4 100644 --- a/Lib/test/test_capi/test_exceptions.py +++ b/Lib/test/test_capi/test_exceptions.py @@ -104,7 +104,7 @@ def __del__(self): ''') proc = assert_python_ok("-c", code) warnings = proc.err.splitlines() - # Due to the finalization of the interpreter, the source will be ommited + # Due to the finalization of the interpreter, the source will be omitted # because the ``warnings`` module cannot be imported at this time self.assertEqual(warnings, [ b':7: RuntimeWarning: Testing PyErr_WarnEx', diff --git a/Lib/test/test_pdb.py b/Lib/test/test_pdb.py index 9395e9b133f50d..db7d1b1e9cd935 100644 --- a/Lib/test/test_pdb.py +++ b/Lib/test/test_pdb.py @@ -1263,7 +1263,7 @@ def test_post_mortem_context_of_the_cause(): def test_post_mortem_from_none(): """Test post mortem traceback debugging of chained exception - In particular that cause from None (which sets __supress_context__ to True) + In particular that cause from None (which sets __suppress_context__ to True) does not show context. diff --git a/Lib/test/test_statistics.py b/Lib/test/test_statistics.py index 89201c647dfe51..c69baa4bf4d1b1 100644 --- a/Lib/test/test_statistics.py +++ b/Lib/test/test_statistics.py @@ -2799,7 +2799,7 @@ def test_sqrtprod_helper_function_fundamentals(self): @requires_IEEE_754 @unittest.skipIf(HAVE_DOUBLE_ROUNDING, "accuracy not guaranteed on machines with double rounding") - @support.cpython_only # Allow for a weaker sumprod() implmentation + @support.cpython_only # Allow for a weaker sumprod() implementation def test_sqrtprod_helper_function_improved_accuracy(self): # Test a known example where accuracy is improved x, y, target = 0.8035720646477457, 0.7957468097636939, 0.7996498651651661 diff --git a/Lib/test/test_typing.py b/Lib/test/test_typing.py index ef2ad30317bf34..6e036b600330c1 100644 --- a/Lib/test/test_typing.py +++ b/Lib/test/test_typing.py @@ -2500,7 +2500,7 @@ def test_concatenate(self): def test_nested_paramspec(self): # Since Callable has some special treatment, we want to be sure - # that substituion works correctly, see gh-103054 + # that substitution works correctly, see gh-103054 Callable = self.Callable P = ParamSpec('P') P2 = ParamSpec('P2') diff --git a/Lib/test/test_unicodedata.py b/Lib/test/test_unicodedata.py index d3bf4ea7c7d437..5f572c4cf9a5c5 100644 --- a/Lib/test/test_unicodedata.py +++ b/Lib/test/test_unicodedata.py @@ -114,7 +114,7 @@ def test_no_names_in_pua(self): def test_lookup_nonexistant(self): # just make sure that lookup can fail - for nonexistant in [ + for nonexistent in [ "LATIN SMLL LETR A", "OPEN HANDS SIGHS", "DREGS", @@ -122,7 +122,7 @@ def test_lookup_nonexistant(self): "MODIFIER LETTER CYRILLIC SMALL QUESTION MARK", "???", ]: - self.assertRaises(KeyError, self.db.lookup, nonexistant) + self.assertRaises(KeyError, self.db.lookup, nonexistent) def test_digit(self): self.assertEqual(self.db.digit('A', None), None) diff --git a/Lib/test/test_weakref.py b/Lib/test/test_weakref.py index 023df68fca7356..ce345bd86bf823 100644 --- a/Lib/test/test_weakref.py +++ b/Lib/test/test_weakref.py @@ -1860,7 +1860,7 @@ def test_weak_keyed_bad_delitem(self): self.assertRaises(KeyError, d.__delitem__, o) self.assertRaises(KeyError, d.__getitem__, o) - # If a key isn't of a weakly referencable type, __getitem__ and + # If a key isn't of a weakly referenceable type, __getitem__ and # __setitem__ raise TypeError. __delitem__ should too. self.assertRaises(TypeError, d.__delitem__, 13) self.assertRaises(TypeError, d.__getitem__, 13) @@ -2263,7 +2263,7 @@ def test_names(self): >>> class Dict(dict): ... pass ... ->>> obj = Dict(red=1, green=2, blue=3) # this object is weak referencable +>>> obj = Dict(red=1, green=2, blue=3) # this object is weak referenceable >>> r = weakref.ref(obj) >>> print(r() is obj) True diff --git a/Lib/tkinter/__init__.py b/Lib/tkinter/__init__.py index 5352276e874bf5..ec9559f11b983f 100644 --- a/Lib/tkinter/__init__.py +++ b/Lib/tkinter/__init__.py @@ -3681,7 +3681,7 @@ def set(self, value): def coords(self, value=None): """Return a tuple (X,Y) of the point along the centerline of the - trough that corresponds to VALUE or the current value if None is + through that corresponds to VALUE or the current value if None is given.""" return self._getints(self.tk.call(self._w, 'coords', value)) @@ -4490,7 +4490,7 @@ def data(self, format=None, *, from_coords=None, The FORMAT option specifies the name of the image file format handler to be used. If this option is not given, this method uses a format that consists of a tuple (one element per row) of strings - containings space separated (one element per pixel/column) colors + containing space separated (one element per pixel/column) colors in “#RRGGBB” format (where RR is a pair of hexadecimal digits for the red channel, GG for green, and BB for blue). diff --git a/Modules/_ctypes/_ctypes_test.c b/Modules/_ctypes/_ctypes_test.c index 0719a1b921f040..188e9e40d82212 100644 --- a/Modules/_ctypes/_ctypes_test.c +++ b/Modules/_ctypes/_ctypes_test.c @@ -187,8 +187,8 @@ _testfunc_array_in_struct3B_set_defaults(void) /* * Test3C struct tests the MAX_STRUCT_SIZE 32. Structs containing arrays of up * to four floating-point types are passed in registers on Arm platforms. - * This struct is used for within bounds test on Arm platfroms and for an - * out-of-bounds tests for platfroms where MAX_STRUCT_SIZE is less than 32. + * This struct is used for within bounds test on Arm platforms and for an + * out-of-bounds tests for platforms where MAX_STRUCT_SIZE is less than 32. * See gh-110190. */ typedef struct { diff --git a/Objects/object.c b/Objects/object.c index c6d46caa0bb62b..97403227625971 100644 --- a/Objects/object.c +++ b/Objects/object.c @@ -1258,9 +1258,9 @@ PyObject_GetOptionalAttr(PyObject *v, PyObject *name, PyObject **result) return 0; } if (tp->tp_getattro == _Py_type_getattro) { - int supress_missing_attribute_exception = 0; - *result = _Py_type_getattro_impl((PyTypeObject*)v, name, &supress_missing_attribute_exception); - if (supress_missing_attribute_exception) { + int suppress_missing_attribute_exception = 0; + *result = _Py_type_getattro_impl((PyTypeObject*)v, name, &suppress_missing_attribute_exception); + if (suppress_missing_attribute_exception) { // return 0 without having to clear the exception return 0; } From eb0b6e67bcebe9bcf343f44004f56dd96f51b4dc Mon Sep 17 00:00:00 2001 From: Wulian <1055917385@qq.com> Date: Wed, 21 Aug 2024 20:19:35 +0800 Subject: [PATCH 2/2] fix --- Lib/test/test_weakref.py | 4 ++-- Lib/tkinter/__init__.py | 4 ++-- Modules/_ctypes/_ctypes_test.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Lib/test/test_weakref.py b/Lib/test/test_weakref.py index ce345bd86bf823..023df68fca7356 100644 --- a/Lib/test/test_weakref.py +++ b/Lib/test/test_weakref.py @@ -1860,7 +1860,7 @@ def test_weak_keyed_bad_delitem(self): self.assertRaises(KeyError, d.__delitem__, o) self.assertRaises(KeyError, d.__getitem__, o) - # If a key isn't of a weakly referenceable type, __getitem__ and + # If a key isn't of a weakly referencable type, __getitem__ and # __setitem__ raise TypeError. __delitem__ should too. self.assertRaises(TypeError, d.__delitem__, 13) self.assertRaises(TypeError, d.__getitem__, 13) @@ -2263,7 +2263,7 @@ def test_names(self): >>> class Dict(dict): ... pass ... ->>> obj = Dict(red=1, green=2, blue=3) # this object is weak referenceable +>>> obj = Dict(red=1, green=2, blue=3) # this object is weak referencable >>> r = weakref.ref(obj) >>> print(r() is obj) True diff --git a/Lib/tkinter/__init__.py b/Lib/tkinter/__init__.py index ec9559f11b983f..2e5affb15e3f61 100644 --- a/Lib/tkinter/__init__.py +++ b/Lib/tkinter/__init__.py @@ -3681,7 +3681,7 @@ def set(self, value): def coords(self, value=None): """Return a tuple (X,Y) of the point along the centerline of the - through that corresponds to VALUE or the current value if None is + trough that corresponds to VALUE or the current value if None is given.""" return self._getints(self.tk.call(self._w, 'coords', value)) @@ -4490,7 +4490,7 @@ def data(self, format=None, *, from_coords=None, The FORMAT option specifies the name of the image file format handler to be used. If this option is not given, this method uses a format that consists of a tuple (one element per row) of strings - containing space separated (one element per pixel/column) colors + containing space-separated (one element per pixel/column) colors in “#RRGGBB” format (where RR is a pair of hexadecimal digits for the red channel, GG for green, and BB for blue). diff --git a/Modules/_ctypes/_ctypes_test.c b/Modules/_ctypes/_ctypes_test.c index 188e9e40d82212..8e07584f074936 100644 --- a/Modules/_ctypes/_ctypes_test.c +++ b/Modules/_ctypes/_ctypes_test.c @@ -187,8 +187,8 @@ _testfunc_array_in_struct3B_set_defaults(void) /* * Test3C struct tests the MAX_STRUCT_SIZE 32. Structs containing arrays of up * to four floating-point types are passed in registers on Arm platforms. - * This struct is used for within bounds test on Arm platforms and for an - * out-of-bounds tests for platforms where MAX_STRUCT_SIZE is less than 32. + * This struct is used for within-bounds tests on Arm platforms and for an + * out-of-bounds test for platforms where MAX_STRUCT_SIZE is less than 32. * See gh-110190. */ typedef struct {