From 6787e51f8fa21a5740995c5eb8a29b6c59464767 Mon Sep 17 00:00:00 2001 From: "Yilei \"Dolee\" Yang" Date: Sun, 5 Feb 2023 23:43:27 -0800 Subject: [PATCH] Fix a few typos in mypyc's comments and docstrings (#14617) --- mypyc/codegen/emitclass.py | 2 +- mypyc/codegen/emitfunc.py | 2 +- mypyc/common.py | 2 +- mypyc/doc/using_type_annotations.rst | 2 +- mypyc/irbuild/function.py | 4 ++-- mypyc/irbuild/ll_builder.py | 2 +- mypyc/lib-rt/dict_ops.c | 2 +- mypyc/lib-rt/str_ops.c | 2 +- mypyc/test/test_run.py | 2 +- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/mypyc/codegen/emitclass.py b/mypyc/codegen/emitclass.py index 79fdd9103371..15935c3b79f2 100644 --- a/mypyc/codegen/emitclass.py +++ b/mypyc/codegen/emitclass.py @@ -333,7 +333,7 @@ def emit_line() -> None: flags.append("_Py_TPFLAGS_HAVE_VECTORCALL") if not fields.get("tp_vectorcall"): # This is just a placeholder to please CPython. It will be - # overriden during setup. + # overridden during setup. fields["tp_call"] = "PyVectorcall_Call" fields["tp_flags"] = " | ".join(flags) diff --git a/mypyc/codegen/emitfunc.py b/mypyc/codegen/emitfunc.py index 56a22447eeac..e7fb7db80413 100644 --- a/mypyc/codegen/emitfunc.py +++ b/mypyc/codegen/emitfunc.py @@ -432,7 +432,7 @@ def visit_set_attr(self, op: SetAttr) -> None: # ...and struct access for normal attributes. attr_expr = self.get_attr_expr(obj, op, decl_cl) if not op.is_init and attr_rtype.is_refcounted: - # This is not an initalization (where we know that the attribute was + # This is not an initialization (where we know that the attribute was # previously undefined), so decref the old value. always_defined = cl.is_always_defined(op.attr) if not always_defined: diff --git a/mypyc/common.py b/mypyc/common.py index 7412ebef4752..c8da5ff63bab 100644 --- a/mypyc/common.py +++ b/mypyc/common.py @@ -56,7 +56,7 @@ MAX_LITERAL_SHORT_INT: Final = MAX_SHORT_INT MIN_LITERAL_SHORT_INT: Final = -MAX_LITERAL_SHORT_INT - 1 -# Decription of the C type used to track the definedness of attributes and +# Description of the C type used to track the definedness of attributes and # the presence of argument default values that have types with overlapping # error values. Each tracked attribute/argument has a dedicated bit in the # relevant bitmap. diff --git a/mypyc/doc/using_type_annotations.rst b/mypyc/doc/using_type_annotations.rst index be596fc23210..a01246ab0914 100644 --- a/mypyc/doc/using_type_annotations.rst +++ b/mypyc/doc/using_type_annotations.rst @@ -304,7 +304,7 @@ Example:: def example() -> None: # A small integer uses the value (unboxed) representation x = 5 - # A large integer the the heap (boxed) representation + # A large integer uses the heap (boxed) representation x = 2**500 # Lists always contain boxed integers a = [55] diff --git a/mypyc/irbuild/function.py b/mypyc/irbuild/function.py index 5262b74e2853..02155d70e928 100644 --- a/mypyc/irbuild/function.py +++ b/mypyc/irbuild/function.py @@ -123,7 +123,7 @@ def transform_decorator(builder: IRBuilder, dec: Decorator) -> None: # if this is a registered singledispatch implementation with no other decorators), we should # treat this function as a regular function, not a decorated function elif dec.func in builder.fdefs_to_decorators: - # Obtain the the function name in order to construct the name of the helper function. + # Obtain the function name in order to construct the name of the helper function. name = dec.func.fullname.split(".")[-1] # Load the callable object representing the non-decorated function, and decorate it. @@ -397,7 +397,7 @@ def handle_ext_method(builder: IRBuilder, cdef: ClassDef, fdef: FuncDef) -> None builder.functions.append(func_ir) if is_decorated(builder, fdef): - # Obtain the the function name in order to construct the name of the helper function. + # Obtain the function name in order to construct the name of the helper function. _, _, name = fdef.fullname.rpartition(".") # Read the PyTypeObject representing the class, get the callable object # representing the non-decorated method diff --git a/mypyc/irbuild/ll_builder.py b/mypyc/irbuild/ll_builder.py index 691f4729e4a4..2391ccc4d0ed 100644 --- a/mypyc/irbuild/ll_builder.py +++ b/mypyc/irbuild/ll_builder.py @@ -1386,7 +1386,7 @@ def compare_tagged_condition( ) -> None: """Compare two tagged integers using given operator (conditional context). - Assume lhs and and rhs are tagged integers. + Assume lhs and rhs are tagged integers. Args: lhs: Left operand diff --git a/mypyc/lib-rt/dict_ops.c b/mypyc/lib-rt/dict_ops.c index ba565257fd72..c0cc8d5a7f87 100644 --- a/mypyc/lib-rt/dict_ops.c +++ b/mypyc/lib-rt/dict_ops.c @@ -89,7 +89,7 @@ PyObject *CPyDict_SetDefaultWithEmptyDatatype(PyObject *dict, PyObject *key, int data_type) { PyObject *res = CPyDict_GetItem(dict, key); if (!res) { - // CPyDict_GetItem() would generates an PyExc_KeyError + // CPyDict_GetItem() would generates a PyExc_KeyError // when key is not found. PyErr_Clear(); diff --git a/mypyc/lib-rt/str_ops.c b/mypyc/lib-rt/str_ops.c index 3c0d275fbe39..90b19001f8f0 100644 --- a/mypyc/lib-rt/str_ops.c +++ b/mypyc/lib-rt/str_ops.c @@ -188,7 +188,7 @@ PyObject *CPyStr_GetSlice(PyObject *obj, CPyTagged start, CPyTagged end) { return CPyObject_GetSlice(obj, start, end); } -/* Check if the given string is true (i.e. it's length isn't zero) */ +/* Check if the given string is true (i.e. its length isn't zero) */ bool CPyStr_IsTrue(PyObject *obj) { Py_ssize_t length = PyUnicode_GET_LENGTH(obj); return length != 0; diff --git a/mypyc/test/test_run.py b/mypyc/test/test_run.py index c867c9d37dac..6a5ab87fca49 100644 --- a/mypyc/test/test_run.py +++ b/mypyc/test/test_run.py @@ -255,7 +255,7 @@ def run_case_step(self, testcase: DataDrivenTestCase, incremental_step: int) -> assert False, "Compile error" # Check that serialization works on this IR. (Only on the first - # step because the the returned ir only includes updated code.) + # step because the returned ir only includes updated code.) if incremental_step == 1: check_serialization_roundtrip(ir)