From 5c3347876b64df567a1dd05d521bc736e5dd2f47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Clint=20Air=C3=A9?= <111376518+clintaire@users.noreply.github.com> Date: Sun, 15 Sep 2024 23:05:55 +0100 Subject: [PATCH 1/7] Fixed spelling issues --- CHANGELOG.md | 2 +- mypy/argmap.py | 2 +- mypy/checkexpr.py | 2 +- mypy/fastparse.py | 2 +- mypy/join.py | 2 +- mypy/messages.py | 2 +- mypy/nodes.py | 14 +++++++------- mypy/plugins/common.py | 2 +- mypy/plugins/enums.py | 2 +- mypy/semanal.py | 4 ++-- mypy/semanal_namedtuple.py | 2 +- mypy/semanal_newtype.py | 2 +- mypy/stubgenc.py | 4 ++-- mypy/suggestions.py | 2 +- mypy/test/teststubgen.py | 16 ++++++++-------- mypy/test/testtypes.py | 4 ++-- mypy/test/typefixture.py | 2 +- mypy/test/update_data.py | 2 +- mypy/typeanal.py | 2 +- mypyc/codegen/emit.py | 2 +- mypyc/codegen/emitmodule.py | 2 +- mypyc/doc/dev-intro.md | 2 +- mypyc/ir/module_ir.py | 2 +- mypyc/ir/ops.py | 8 ++++---- mypyc/irbuild/classdef.py | 4 ++-- mypyc/irbuild/expression.py | 2 +- mypyc/irbuild/function.py | 2 +- mypyc/irbuild/ll_builder.py | 2 +- mypyc/irbuild/match.py | 2 +- mypyc/test/test_namegen.py | 8 ++++---- mypyc/transform/refcount.py | 2 +- 31 files changed, 54 insertions(+), 54 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b544e05ee573..a28658e08fed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -119,7 +119,7 @@ This feature was contributed by Jukka Lehtosalo (PR [17404](https://github.com/p #### Mypyc Improvements -Mypyc now supports the new syntax for generics introduced in Python 3.12 (see above). Another notable improvement is signficantly faster basic operations on `int` values. +Mypyc now supports the new syntax for generics introduced in Python 3.12 (see above). Another notable improvement is significantly faster basic operations on `int` values. * Support Python 3.12 syntax for generic functions and classes (Jukka Lehtosalo, PR [17357](https://github.com/python/mypy/pull/17357)) * Support Python 3.12 type alias syntax (Jukka Lehtosalo, PR [17384](https://github.com/python/mypy/pull/17384)) diff --git a/mypy/argmap.py b/mypy/argmap.py index e6700c9f1092..d48c0639b1b1 100644 --- a/mypy/argmap.py +++ b/mypy/argmap.py @@ -219,7 +219,7 @@ def expand_actual_type( self.tuple_index += 1 item = actual_type.items[self.tuple_index - 1] if isinstance(item, UnpackType) and not allow_unpack: - # An upack item that doesn't have special handling, use upper bound as above. + # An unpack item that doesn't have special handling, use upper bound as above. unpacked = get_proper_type(item.type) if isinstance(unpacked, TypeVarTupleType): fallback = get_proper_type(unpacked.upper_bound) diff --git a/mypy/checkexpr.py b/mypy/checkexpr.py index 9dee743ad406..b482e2766311 100644 --- a/mypy/checkexpr.py +++ b/mypy/checkexpr.py @@ -840,7 +840,7 @@ def validate_typeddict_kwargs( # Having an optional key not explicitly declared by a ** unpacked # TypedDict is unsafe, it may be an (incompatible) subtype at runtime. # TODO: catch the cases where a declared key is overridden by a subsequent - # ** item without it (and not again overriden with complete ** item). + # ** item without it (and not again overridden with complete ** item). self.msg.non_required_keys_absent_with_star(absent_keys, last_star_found) return result, always_present_keys diff --git a/mypy/fastparse.py b/mypy/fastparse.py index abcce74c6064..250e0870d4d1 100644 --- a/mypy/fastparse.py +++ b/mypy/fastparse.py @@ -2249,7 +2249,7 @@ def visit_member_expr(self, e: MemberExpr) -> None: class FindYield(TraverserVisitor): - """Check if an AST contains yields or yield froms.""" + """Check if an AST contains yields or yield forms.""" def __init__(self) -> None: self.found = False diff --git a/mypy/join.py b/mypy/join.py index 5284be7dd2a1..e3965475e60d 100644 --- a/mypy/join.py +++ b/mypy/join.py @@ -498,7 +498,7 @@ def join_tuples(self, s: TupleType, t: TupleType) -> list[Type] | None: return items return None if s_unpack_index is not None and t_unpack_index is not None: - # The most complex case: both tuples have an upack item. + # The most complex case: both tuples have an unpack item. s_unpack = s.items[s_unpack_index] assert isinstance(s_unpack, UnpackType) s_unpacked = get_proper_type(s_unpack.type) diff --git a/mypy/messages.py b/mypy/messages.py index 62846c536f3d..d5fa21273d6c 100644 --- a/mypy/messages.py +++ b/mypy/messages.py @@ -209,7 +209,7 @@ def are_type_names_disabled(self) -> bool: def prefer_simple_messages(self) -> bool: """Should we generate simple/fast error messages? - If errors aren't shown to the user, we don't want to waste cyles producing + If errors aren't shown to the user, we don't want to waste cycles producing complex error messages. """ return self.errors.prefer_simple_messages() diff --git a/mypy/nodes.py b/mypy/nodes.py index 4a5c7240fa83..377678213a5b 100644 --- a/mypy/nodes.py +++ b/mypy/nodes.py @@ -184,15 +184,15 @@ class Node(Context): __slots__ = () def __str__(self) -> str: - ans = self.accept(mypy.strconv.StrConv(options=Options())) - if ans is None: + and = self.accept(mypy.strconv.StrConv(options=Options())) + if and is None: return repr(self) - return ans + return and def str_with_options(self, options: Options) -> str: - ans = self.accept(mypy.strconv.StrConv(options=options)) - assert ans - return ans + and = self.accept(mypy.strconv.StrConv(options=options)) + assert and + return and def accept(self, visitor: NodeVisitor[T]) -> T: raise RuntimeError("Not implemented", type(self)) @@ -1166,7 +1166,7 @@ def __init__( self.keywords = dict(keywords) if keywords else {} self.analyzed = None self.has_incompatible_baseclass = False - # Used for error reporting (to keep backwad compatibility with pre-3.8) + # Used for error reporting (to keep backwards compatibility with pre-3.8) self.deco_line: int | None = None self.docstring: str | None = None self.removed_statements = [] diff --git a/mypy/plugins/common.py b/mypy/plugins/common.py index f0ff6f30a3b9..43caa6483236 100644 --- a/mypy/plugins/common.py +++ b/mypy/plugins/common.py @@ -164,7 +164,7 @@ def find_shallow_matching_overload_item(overload: Overloaded, call: CallExpr) -> def _get_callee_type(call: CallExpr) -> CallableType | None: - """Return the type of the callee, regardless of its syntatic form.""" + """Return the type of the callee, regardless of its syntactic form.""" callee_node: Node | None = call.callee diff --git a/mypy/plugins/enums.py b/mypy/plugins/enums.py index 816241fa6e9a..86e7f1f7b31e 100644 --- a/mypy/plugins/enums.py +++ b/mypy/plugins/enums.py @@ -129,7 +129,7 @@ def _implements_new(info: TypeInfo) -> bool: def enum_member_callback(ctx: mypy.plugin.FunctionContext) -> Type: - """By default `member(1)` will be infered as `member[int]`, + """By default `member(1)` will be inferred as `member[int]`, we want to improve the inference to be `Literal[1]` here.""" if ctx.arg_types or ctx.arg_types[0]: arg = get_proper_type(ctx.arg_types[0][0]) diff --git a/mypy/semanal.py b/mypy/semanal.py index 782985e3fbab..d0dc901a49a2 100644 --- a/mypy/semanal.py +++ b/mypy/semanal.py @@ -4034,7 +4034,7 @@ def analyze_type_alias_type_params( ) -> tuple[TypeVarLikeList, list[str]]: """Analyze type_params of TypeAliasType. - Returns declared unbound type variable expressions and a list of all decalred type + Returns declared unbound type variable expressions and a list of all declared type variable names for error reporting. """ if "type_params" in rvalue.arg_names: @@ -6038,7 +6038,7 @@ def visit_yield_expr(self, e: YieldExpr) -> None: def visit_await_expr(self, expr: AwaitExpr) -> None: if not self.is_func_scope() or not self.function_stack: # We check both because is_function_scope() returns True inside comprehensions. - # This is not a blocker, because some enviroments (like ipython) + # This is not a blocker, because some environments (like ipython) # support top level awaits. self.fail('"await" outside function', expr, serious=True, code=codes.TOP_LEVEL_AWAIT) elif not self.function_stack[-1].is_coroutine: diff --git a/mypy/semanal_namedtuple.py b/mypy/semanal_namedtuple.py index 768dd265b338..d2e7124c4c72 100644 --- a/mypy/semanal_namedtuple.py +++ b/mypy/semanal_namedtuple.py @@ -196,7 +196,7 @@ def check_namedtuple_classdef( # Something is incomplete. We need to defer this named tuple. return None types.append(analyzed) - # ...despite possible minor failures that allow further analyzis. + # ...despite possible minor failures that allow further analysis. if name.startswith("_"): self.fail( f"NamedTuple field name cannot start with an underscore: {name}", stmt diff --git a/mypy/semanal_newtype.py b/mypy/semanal_newtype.py index c9c0c46f7aee..0c717b5d9a0e 100644 --- a/mypy/semanal_newtype.py +++ b/mypy/semanal_newtype.py @@ -174,7 +174,7 @@ def analyze_newtype_declaration(self, s: AssignmentStmt) -> tuple[str | None, Ca def check_newtype_args( self, name: str, call: CallExpr, context: Context ) -> tuple[Type | None, bool]: - """Ananlyze base type in NewType call. + """Analyze base type in NewType call. Return a tuple (type, should defer). """ diff --git a/mypy/stubgenc.py b/mypy/stubgenc.py index 7ab500b4fe12..fbaa862bf721 100755 --- a/mypy/stubgenc.py +++ b/mypy/stubgenc.py @@ -241,7 +241,7 @@ def __init__( self.module_name = module_name if self.is_c_module: # Add additional implicit imports. - # C-extensions are given more lattitude since they do not import the typing module. + # C-extensions are given more latitude since they do not import the typing module. self.known_imports.update( { "typing": [ @@ -340,7 +340,7 @@ def get_pos_default(i: int, _arg: str) -> Any | None: # Add *args if present if varargs: arglist.append(ArgSig(f"*{varargs}", get_annotation(varargs))) - # if we have keyword only args, then wee need to add "*" + # if we have keyword only args, then we need to add "*" elif kwonlyargs: arglist.append(ArgSig("*")) diff --git a/mypy/suggestions.py b/mypy/suggestions.py index 268f3032fc9b..ca681b9cda8e 100644 --- a/mypy/suggestions.py +++ b/mypy/suggestions.py @@ -454,7 +454,7 @@ def get_guesses_from_parent(self, node: FuncDef) -> list[CallableType]: pnode = parent.names.get(node.name) if pnode and isinstance(pnode.node, (FuncDef, Decorator)): typ = get_proper_type(pnode.node.type) - # FIXME: Doesn't work right with generic tyeps + # FIXME: Doesn't work right with generic types if isinstance(typ, CallableType) and len(typ.arg_types) == len(node.arguments): # Return the first thing we find, since it probably doesn't make sense # to grab things further up in the chain if an earlier parent has it. diff --git a/mypy/test/teststubgen.py b/mypy/test/teststubgen.py index e65a16c8f395..e3e20fee73d5 100644 --- a/mypy/test/teststubgen.py +++ b/mypy/test/teststubgen.py @@ -587,10 +587,10 @@ def test_common_dir_prefix_unix(self) -> None: assert common_dir_prefix(["foo/bar/x.pyi", "foo/bar/y.pyi"]) == "foo/bar" assert common_dir_prefix(["foo/bar/x.pyi", "foo/y.pyi"]) == "foo" assert common_dir_prefix(["foo/x.pyi", "foo/bar/y.pyi"]) == "foo" - assert common_dir_prefix(["foo/bar/zar/x.pyi", "foo/y.pyi"]) == "foo" - assert common_dir_prefix(["foo/x.pyi", "foo/bar/zar/y.pyi"]) == "foo" - assert common_dir_prefix(["foo/bar/zar/x.pyi", "foo/bar/y.pyi"]) == "foo/bar" - assert common_dir_prefix(["foo/bar/x.pyi", "foo/bar/zar/y.pyi"]) == "foo/bar" + assert common_dir_prefix(["foo/bar/czar/x.pyi", "foo/y.pyi"]) == "foo" + assert common_dir_prefix(["foo/x.pyi", "foo/bar/czar/y.pyi"]) == "foo" + assert common_dir_prefix(["foo/bar/czar/x.pyi", "foo/bar/y.pyi"]) == "foo/bar" + assert common_dir_prefix(["foo/bar/x.pyi", "foo/bar/czar/y.pyi"]) == "foo/bar" assert common_dir_prefix([r"foo/bar\x.pyi"]) == "foo" assert common_dir_prefix([r"foo\bar/x.pyi"]) == r"foo\bar" @@ -604,10 +604,10 @@ def test_common_dir_prefix_win(self) -> None: assert common_dir_prefix([r"foo\bar\x.pyi", r"foo\bar\y.pyi"]) == r"foo\bar" assert common_dir_prefix([r"foo\bar\x.pyi", r"foo\y.pyi"]) == "foo" assert common_dir_prefix([r"foo\x.pyi", r"foo\bar\y.pyi"]) == "foo" - assert common_dir_prefix([r"foo\bar\zar\x.pyi", r"foo\y.pyi"]) == "foo" - assert common_dir_prefix([r"foo\x.pyi", r"foo\bar\zar\y.pyi"]) == "foo" - assert common_dir_prefix([r"foo\bar\zar\x.pyi", r"foo\bar\y.pyi"]) == r"foo\bar" - assert common_dir_prefix([r"foo\bar\x.pyi", r"foo\bar\zar\y.pyi"]) == r"foo\bar" + assert common_dir_prefix([r"foo\bar\czar\x.pyi", r"foo\y.pyi"]) == "foo" + assert common_dir_prefix([r"foo\x.pyi", r"foo\bar\czar\y.pyi"]) == "foo" + assert common_dir_prefix([r"foo\bar\czar\x.pyi", r"foo\bar\y.pyi"]) == r"foo\bar" + assert common_dir_prefix([r"foo\bar\x.pyi", r"foo\bar\czar\y.pyi"]) == r"foo\bar" assert common_dir_prefix([r"foo/bar\x.pyi"]) == r"foo\bar" assert common_dir_prefix([r"foo\bar/x.pyi"]) == r"foo\bar" assert common_dir_prefix([r"foo/bar/x.pyi"]) == r"foo\bar" diff --git a/mypy/test/testtypes.py b/mypy/test/testtypes.py index 0218d33cc124..5dd3b78c9498 100644 --- a/mypy/test/testtypes.py +++ b/mypy/test/testtypes.py @@ -867,7 +867,7 @@ def test_generics_contravariant(self) -> None: def test_generics_with_multiple_args(self) -> None: self.assert_join(self.fx_co.hab, self.fx_co.hab, self.fx_co.hab) self.assert_join(self.fx_co.hab, self.fx_co.hbb, self.fx_co.hab) - self.assert_join(self.fx_co.had, self.fx_co.haa, self.fx_co.hao) + self.assert_join(self.fx_co.had, self.fx_co.has, self.fx_co.hao) def test_generics_with_inheritance(self) -> None: self.assert_join(self.fx_co.gsab, self.fx_co.gb, self.fx_co.gb) @@ -1208,7 +1208,7 @@ def test_simple_generics(self) -> None: def test_generics_with_multiple_args(self) -> None: self.assert_meet(self.fx.hab, self.fx.hab, self.fx.hab) - self.assert_meet(self.fx.hab, self.fx.haa, self.fx.hab) + self.assert_meet(self.fx.hab, self.fx.has, self.fx.hab) self.assert_meet(self.fx.hab, self.fx.had, self.fx.nonet) self.assert_meet(self.fx.hab, self.fx.hbb, self.fx.hbb) diff --git a/mypy/test/typefixture.py b/mypy/test/typefixture.py index 5a813f70117c..73af11b45327 100644 --- a/mypy/test/typefixture.py +++ b/mypy/test/typefixture.py @@ -182,7 +182,7 @@ def make_type_var( self.gs2d = Instance(self.gs2i, [self.d]) # GS2[D] self.hab = Instance(self.hi, [self.a, self.b]) # H[A, B] - self.haa = Instance(self.hi, [self.a, self.a]) # H[A, A] + self.has = Instance(self.hi, [self.a, self.a]) # H[A, A] self.hbb = Instance(self.hi, [self.b, self.b]) # H[B, B] self.hts = Instance(self.hi, [self.t, self.s]) # H[T, S] self.had = Instance(self.hi, [self.a, self.d]) # H[A, D] diff --git a/mypy/test/update_data.py b/mypy/test/update_data.py index 2d66752f61bd..2e1a6a9b3d1d 100644 --- a/mypy/test/update_data.py +++ b/mypy/test/update_data.py @@ -69,7 +69,7 @@ def _iter_fixes( source_line = source_line[: comment_match.start("indent")] # strip old comment if reports: indent = comment_match.group("indent") if comment_match else " " - # multiline comments are on the first line and then on subsequent lines emtpy lines + # multiline comments are on the first line and then on subsequent lines empty lines # with a continuation backslash for j, (severity, msg) in enumerate(reports): out_l = source_line if j == 0 else " " * len(source_line) diff --git a/mypy/typeanal.py b/mypy/typeanal.py index 274b4b893a98..1d894a0f6720 100644 --- a/mypy/typeanal.py +++ b/mypy/typeanal.py @@ -940,7 +940,7 @@ def analyze_unbound_type_without_type_info( elif unbound_tvar: assert isinstance(sym.node, TypeVarLikeExpr) if sym.node.is_new_style: - # PEP 695 type paramaters are never considered unbound -- they are undefined + # PEP 695 type parameters are never considered unbound -- they are undefined # in contexts where they aren't valid, such as in argument default values. message = 'Name "{}" is not defined' name = name.split(".")[-1] diff --git a/mypyc/codegen/emit.py b/mypyc/codegen/emit.py index fce6896e8d11..97302805fd3b 100644 --- a/mypyc/codegen/emit.py +++ b/mypyc/codegen/emit.py @@ -195,7 +195,7 @@ def attr(self, name: str) -> str: return ATTR_PREFIX + name def object_annotation(self, obj: object, line: str) -> str: - """Build a C comment with an object's string represention. + """Build a C comment with an object's string representation. If the comment exceeds the line length limit, it's wrapped into a multiline string (with the extra lines indented to be aligned with diff --git a/mypyc/codegen/emitmodule.py b/mypyc/codegen/emitmodule.py index 1d8708912de5..bb24bc532558 100644 --- a/mypyc/codegen/emitmodule.py +++ b/mypyc/codegen/emitmodule.py @@ -699,7 +699,7 @@ def generate_export_table(self, decl_emitter: Emitter, code_emitter: Emitter) -> copy the contents into a local copy of the table (to eliminate the need for a pointer indirection when accessing it). - Then, all calls to functions in another group and accesses to statics + Then, all calls to functions in another group and accesses to statistics from another group are done indirectly via the export table. For example, a group containing a module b, where b contains a class B diff --git a/mypyc/doc/dev-intro.md b/mypyc/doc/dev-intro.md index d11df7068e91..b34d6e22b9d8 100644 --- a/mypyc/doc/dev-intro.md +++ b/mypyc/doc/dev-intro.md @@ -280,7 +280,7 @@ under `mypyc/lib-rt`. ## Inspecting Generated C -It's often useful to inspect the C code genenerate by mypyc to debug +It's often useful to inspect the C code generate by mypyc to debug issues. Mypyc stores the generated C code as `build/__native.c`. Compiled native functions have the prefix `CPyDef_`, while wrapper functions used for calling functions from interpreted Python code have diff --git a/mypyc/ir/module_ir.py b/mypyc/ir/module_ir.py index e3b240629eda..2bb60e024a75 100644 --- a/mypyc/ir/module_ir.py +++ b/mypyc/ir/module_ir.py @@ -28,7 +28,7 @@ def __init__( self.functions = functions self.classes = classes self.final_names = final_names - # Names of C statics used for Python 3.12 type variable objects. + # Names of C statistics used for Python 3.12 type variable objects. # These are only visible in the module that defined them, so no need # to serialize. self.type_var_names = type_var_names diff --git a/mypyc/ir/ops.py b/mypyc/ir/ops.py index 896ba3ac091c..a1ab322a36be 100644 --- a/mypyc/ir/ops.py +++ b/mypyc/ir/ops.py @@ -780,7 +780,7 @@ def accept(self, visitor: OpVisitor[T]) -> T: return visitor.visit_set_attr(self) -# Default name space for statics, variables +# Default name space for statistics, variables NAMESPACE_STATIC: Final = "static" # Static namespace for pointers to native type objects @@ -796,12 +796,12 @@ def accept(self, visitor: OpVisitor[T]) -> T: class LoadStatic(RegisterOp): """Load a static name (name :: static). - Load a C static variable/pointer. The namespace for statics is shared + Load a C static variable/pointer. The namespace for statistics is shared for the entire compilation group. You can optionally provide a module name and a sub-namespace identifier for additional namespacing to avoid name conflicts. The static namespace does not overlap with other C names, since the final C name will get a prefix, so conflicts only must be - avoided with other statics. + avoided with other statistics. """ error_kind = ERR_NEVER @@ -1451,7 +1451,7 @@ class LoadAddress(RegisterOp): type: Type of the loaded address(e.g. ptr/object_ptr) src: Source value (str for globals like 'PyList_Type', Register for temporary values or locals, LoadStatic - for statics.) + for statistics.) """ error_kind = ERR_NEVER diff --git a/mypyc/irbuild/classdef.py b/mypyc/irbuild/classdef.py index 7e0a842b1b41..daea4a249c81 100644 --- a/mypyc/irbuild/classdef.py +++ b/mypyc/irbuild/classdef.py @@ -519,7 +519,7 @@ def populate_non_ext_bases(builder: IRBuilder, cdef: ClassDef) -> Value: "typing.Container", "typing.Sized", ): - # HAX: Synthesized base classes added by mypy don't exist at runtime, so skip them. + # HEX: Synthesized base classes added by mypy don't exist at runtime, so skip them. # This could break if they were added explicitly, though... continue # Add the current class to the base classes list of concrete subclasses @@ -529,7 +529,7 @@ def populate_non_ext_bases(builder: IRBuilder, cdef: ClassDef) -> Value: base_ir.children.append(ir) if cls.fullname in MAGIC_TYPED_DICT_CLASSES: - # HAX: Mypy internally represents TypedDict classes differently from what + # HEX: Mypy internally represents TypedDict classes differently from what # should happen at runtime. Replace with something that works. module = "typing" if builder.options.capi_version < (3, 9): diff --git a/mypyc/irbuild/expression.py b/mypyc/irbuild/expression.py index 8d7c089e20cd..31a7be405bbd 100644 --- a/mypyc/irbuild/expression.py +++ b/mypyc/irbuild/expression.py @@ -109,7 +109,7 @@ def transform_name_expr(builder: IRBuilder, expr: NameExpr) -> Value: if isinstance(expr.node, TypeVarLikeExpr) and expr.node.is_new_style: # Reference to Python 3.12 implicit TypeVar/TupleVarTuple/... object. - # These are stored in C statics and not visible in Python namespaces. + # These are stored in C statistics and not visible in Python namespaces. return builder.load_type_var(expr.node.name, expr.node.line) if expr.node is None: builder.add( diff --git a/mypyc/irbuild/function.py b/mypyc/irbuild/function.py index c985e88b0e0c..1294de2b319c 100644 --- a/mypyc/irbuild/function.py +++ b/mypyc/irbuild/function.py @@ -514,7 +514,7 @@ def calculate_arg_defaults( ) -> None: """Calculate default argument values and store them. - They are stored in statics for top level functions and in + They are stored in statistics for top level functions and in the function objects for nested functions (while constants are still stored computed on demand). """ diff --git a/mypyc/irbuild/ll_builder.py b/mypyc/irbuild/ll_builder.py index 0c9310e6a5ca..5d5bd7d13c67 100644 --- a/mypyc/irbuild/ll_builder.py +++ b/mypyc/irbuild/ll_builder.py @@ -1908,7 +1908,7 @@ def primitive_op( ) return self.call_c(c_desc, args, line, result_type) - # This primitve gets transformed in a lowering pass to + # This primitive gets transformed in a lowering pass to # lower-level IR ops using a custom transform function. coerced = [] diff --git a/mypyc/irbuild/match.py b/mypyc/irbuild/match.py index a1e671911ea5..fb49119c591e 100644 --- a/mypyc/irbuild/match.py +++ b/mypyc/irbuild/match.py @@ -124,7 +124,7 @@ def visit_or_pattern(self, pattern: OrPattern) -> None: def visit_class_pattern(self, pattern: ClassPattern) -> None: # TODO: use faster instance check for native classes (while still - # making sure to account for inheritence) + # making sure to account for inheritance) isinstance_op = ( fast_isinstance_op if self.builder.is_builtin_ref_expr(pattern.class_ref) diff --git a/mypyc/test/test_namegen.py b/mypyc/test/test_namegen.py index 509018b4c3bd..d6c3e78bb82e 100644 --- a/mypyc/test/test_namegen.py +++ b/mypyc/test/test_namegen.py @@ -25,10 +25,10 @@ def test_make_module_translation_map(self) -> None: "foo.bar": "bar.", "foo.baz": "baz.", } - assert make_module_translation_map(["zar", "foo.bar", "foo.baz"]) == { + assert make_module_translation_map(["czar", "foo.bar", "foo.baz"]) == { "foo.bar": "bar.", "foo.baz": "baz.", - "zar": "zar.", + "czar": "czar.", } assert make_module_translation_map(["foo.bar", "fu.bar", "foo.baz"]) == { "foo.bar": "foo.bar.", @@ -37,11 +37,11 @@ def test_make_module_translation_map(self) -> None: } def test_name_generator(self) -> None: - g = NameGenerator([["foo", "foo.zar"]]) + g = NameGenerator([["foo", "foo.czar"]]) assert g.private_name("foo", "f") == "foo___f" assert g.private_name("foo", "C.x.y") == "foo___C___x___y" assert g.private_name("foo", "C.x.y") == "foo___C___x___y" - assert g.private_name("foo.zar", "C.x.y") == "zar___C___x___y" + assert g.private_name("foo.czar", "C.x.y") == "zar___C___x___y" assert g.private_name("foo", "C.x_y") == "foo___C___x_y" assert g.private_name("foo", "C_x_y") == "foo___C_x_y" assert g.private_name("foo", "C_x_y") == "foo___C_x_y" diff --git a/mypyc/transform/refcount.py b/mypyc/transform/refcount.py index f2ab438f6576..455935b7a6ba 100644 --- a/mypyc/transform/refcount.py +++ b/mypyc/transform/refcount.py @@ -187,7 +187,7 @@ def f(a: int) -> None term = block.terminator for i, target in enumerate(term.targets()): - # HAX: After we've checked against an error value the value we must not touch the + # HEX: After we've checked against an error value the value we must not touch the # refcount since it will be a null pointer. The correct way to do this would be # to perform data flow analysis on whether a value can be null (or is always # null). From cc5a3ef331ef90708a2535cff0c2b217ea0d9bbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Clint=20Air=C3=A9?= <111376518+clintaire@users.noreply.github.com> Date: Mon, 16 Sep 2024 00:18:22 +0100 Subject: [PATCH 2/7] Edited files and fixed issues --- mypy/nodes.py | 12 ++++++------ mypy/test/typefixture.py | 2 +- mypyc/ir/ops.py | 8 ++++---- mypyc/irbuild/expression.py | 2 +- mypyc/irbuild/function.py | 2 +- mypyc/test/test_namegen.py | 8 ++++---- mypyc/transform/refcount.py | 2 +- 7 files changed, 18 insertions(+), 18 deletions(-) diff --git a/mypy/nodes.py b/mypy/nodes.py index 377678213a5b..19f908661d49 100644 --- a/mypy/nodes.py +++ b/mypy/nodes.py @@ -184,15 +184,15 @@ class Node(Context): __slots__ = () def __str__(self) -> str: - and = self.accept(mypy.strconv.StrConv(options=Options())) - if and is None: + ans = self.accept(mypy.strconv.StrConv(options=Options())) + if ans is None: return repr(self) - return and + return ans def str_with_options(self, options: Options) -> str: - and = self.accept(mypy.strconv.StrConv(options=options)) - assert and - return and + ans = self.accept(mypy.strconv.StrConv(options=options)) + assert ans + return ans def accept(self, visitor: NodeVisitor[T]) -> T: raise RuntimeError("Not implemented", type(self)) diff --git a/mypy/test/typefixture.py b/mypy/test/typefixture.py index 73af11b45327..5a813f70117c 100644 --- a/mypy/test/typefixture.py +++ b/mypy/test/typefixture.py @@ -182,7 +182,7 @@ def make_type_var( self.gs2d = Instance(self.gs2i, [self.d]) # GS2[D] self.hab = Instance(self.hi, [self.a, self.b]) # H[A, B] - self.has = Instance(self.hi, [self.a, self.a]) # H[A, A] + self.haa = Instance(self.hi, [self.a, self.a]) # H[A, A] self.hbb = Instance(self.hi, [self.b, self.b]) # H[B, B] self.hts = Instance(self.hi, [self.t, self.s]) # H[T, S] self.had = Instance(self.hi, [self.a, self.d]) # H[A, D] diff --git a/mypyc/ir/ops.py b/mypyc/ir/ops.py index a1ab322a36be..896ba3ac091c 100644 --- a/mypyc/ir/ops.py +++ b/mypyc/ir/ops.py @@ -780,7 +780,7 @@ def accept(self, visitor: OpVisitor[T]) -> T: return visitor.visit_set_attr(self) -# Default name space for statistics, variables +# Default name space for statics, variables NAMESPACE_STATIC: Final = "static" # Static namespace for pointers to native type objects @@ -796,12 +796,12 @@ def accept(self, visitor: OpVisitor[T]) -> T: class LoadStatic(RegisterOp): """Load a static name (name :: static). - Load a C static variable/pointer. The namespace for statistics is shared + Load a C static variable/pointer. The namespace for statics is shared for the entire compilation group. You can optionally provide a module name and a sub-namespace identifier for additional namespacing to avoid name conflicts. The static namespace does not overlap with other C names, since the final C name will get a prefix, so conflicts only must be - avoided with other statistics. + avoided with other statics. """ error_kind = ERR_NEVER @@ -1451,7 +1451,7 @@ class LoadAddress(RegisterOp): type: Type of the loaded address(e.g. ptr/object_ptr) src: Source value (str for globals like 'PyList_Type', Register for temporary values or locals, LoadStatic - for statistics.) + for statics.) """ error_kind = ERR_NEVER diff --git a/mypyc/irbuild/expression.py b/mypyc/irbuild/expression.py index 31a7be405bbd..8d7c089e20cd 100644 --- a/mypyc/irbuild/expression.py +++ b/mypyc/irbuild/expression.py @@ -109,7 +109,7 @@ def transform_name_expr(builder: IRBuilder, expr: NameExpr) -> Value: if isinstance(expr.node, TypeVarLikeExpr) and expr.node.is_new_style: # Reference to Python 3.12 implicit TypeVar/TupleVarTuple/... object. - # These are stored in C statistics and not visible in Python namespaces. + # These are stored in C statics and not visible in Python namespaces. return builder.load_type_var(expr.node.name, expr.node.line) if expr.node is None: builder.add( diff --git a/mypyc/irbuild/function.py b/mypyc/irbuild/function.py index 1294de2b319c..c985e88b0e0c 100644 --- a/mypyc/irbuild/function.py +++ b/mypyc/irbuild/function.py @@ -514,7 +514,7 @@ def calculate_arg_defaults( ) -> None: """Calculate default argument values and store them. - They are stored in statistics for top level functions and in + They are stored in statics for top level functions and in the function objects for nested functions (while constants are still stored computed on demand). """ diff --git a/mypyc/test/test_namegen.py b/mypyc/test/test_namegen.py index d6c3e78bb82e..509018b4c3bd 100644 --- a/mypyc/test/test_namegen.py +++ b/mypyc/test/test_namegen.py @@ -25,10 +25,10 @@ def test_make_module_translation_map(self) -> None: "foo.bar": "bar.", "foo.baz": "baz.", } - assert make_module_translation_map(["czar", "foo.bar", "foo.baz"]) == { + assert make_module_translation_map(["zar", "foo.bar", "foo.baz"]) == { "foo.bar": "bar.", "foo.baz": "baz.", - "czar": "czar.", + "zar": "zar.", } assert make_module_translation_map(["foo.bar", "fu.bar", "foo.baz"]) == { "foo.bar": "foo.bar.", @@ -37,11 +37,11 @@ def test_make_module_translation_map(self) -> None: } def test_name_generator(self) -> None: - g = NameGenerator([["foo", "foo.czar"]]) + g = NameGenerator([["foo", "foo.zar"]]) assert g.private_name("foo", "f") == "foo___f" assert g.private_name("foo", "C.x.y") == "foo___C___x___y" assert g.private_name("foo", "C.x.y") == "foo___C___x___y" - assert g.private_name("foo.czar", "C.x.y") == "zar___C___x___y" + assert g.private_name("foo.zar", "C.x.y") == "zar___C___x___y" assert g.private_name("foo", "C.x_y") == "foo___C___x_y" assert g.private_name("foo", "C_x_y") == "foo___C_x_y" assert g.private_name("foo", "C_x_y") == "foo___C_x_y" diff --git a/mypyc/transform/refcount.py b/mypyc/transform/refcount.py index 455935b7a6ba..f2ab438f6576 100644 --- a/mypyc/transform/refcount.py +++ b/mypyc/transform/refcount.py @@ -187,7 +187,7 @@ def f(a: int) -> None term = block.terminator for i, target in enumerate(term.targets()): - # HEX: After we've checked against an error value the value we must not touch the + # HAX: After we've checked against an error value the value we must not touch the # refcount since it will be a null pointer. The correct way to do this would be # to perform data flow analysis on whether a value can be null (or is always # null). From b31c21116d54eb59e771f2840936810b4b60bdf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Clint=20Air=C3=A9?= <111376518+clintaire@users.noreply.github.com> Date: Mon, 16 Sep 2024 00:32:54 +0100 Subject: [PATCH 3/7] Staging unstaged changes before pull --- mypy/test/teststubgen.py | 16 ++++++++-------- mypy/test/testtypes.py | 2 +- mypyc/irbuild/classdef.py | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/mypy/test/teststubgen.py b/mypy/test/teststubgen.py index e3e20fee73d5..e65a16c8f395 100644 --- a/mypy/test/teststubgen.py +++ b/mypy/test/teststubgen.py @@ -587,10 +587,10 @@ def test_common_dir_prefix_unix(self) -> None: assert common_dir_prefix(["foo/bar/x.pyi", "foo/bar/y.pyi"]) == "foo/bar" assert common_dir_prefix(["foo/bar/x.pyi", "foo/y.pyi"]) == "foo" assert common_dir_prefix(["foo/x.pyi", "foo/bar/y.pyi"]) == "foo" - assert common_dir_prefix(["foo/bar/czar/x.pyi", "foo/y.pyi"]) == "foo" - assert common_dir_prefix(["foo/x.pyi", "foo/bar/czar/y.pyi"]) == "foo" - assert common_dir_prefix(["foo/bar/czar/x.pyi", "foo/bar/y.pyi"]) == "foo/bar" - assert common_dir_prefix(["foo/bar/x.pyi", "foo/bar/czar/y.pyi"]) == "foo/bar" + assert common_dir_prefix(["foo/bar/zar/x.pyi", "foo/y.pyi"]) == "foo" + assert common_dir_prefix(["foo/x.pyi", "foo/bar/zar/y.pyi"]) == "foo" + assert common_dir_prefix(["foo/bar/zar/x.pyi", "foo/bar/y.pyi"]) == "foo/bar" + assert common_dir_prefix(["foo/bar/x.pyi", "foo/bar/zar/y.pyi"]) == "foo/bar" assert common_dir_prefix([r"foo/bar\x.pyi"]) == "foo" assert common_dir_prefix([r"foo\bar/x.pyi"]) == r"foo\bar" @@ -604,10 +604,10 @@ def test_common_dir_prefix_win(self) -> None: assert common_dir_prefix([r"foo\bar\x.pyi", r"foo\bar\y.pyi"]) == r"foo\bar" assert common_dir_prefix([r"foo\bar\x.pyi", r"foo\y.pyi"]) == "foo" assert common_dir_prefix([r"foo\x.pyi", r"foo\bar\y.pyi"]) == "foo" - assert common_dir_prefix([r"foo\bar\czar\x.pyi", r"foo\y.pyi"]) == "foo" - assert common_dir_prefix([r"foo\x.pyi", r"foo\bar\czar\y.pyi"]) == "foo" - assert common_dir_prefix([r"foo\bar\czar\x.pyi", r"foo\bar\y.pyi"]) == r"foo\bar" - assert common_dir_prefix([r"foo\bar\x.pyi", r"foo\bar\czar\y.pyi"]) == r"foo\bar" + assert common_dir_prefix([r"foo\bar\zar\x.pyi", r"foo\y.pyi"]) == "foo" + assert common_dir_prefix([r"foo\x.pyi", r"foo\bar\zar\y.pyi"]) == "foo" + assert common_dir_prefix([r"foo\bar\zar\x.pyi", r"foo\bar\y.pyi"]) == r"foo\bar" + assert common_dir_prefix([r"foo\bar\x.pyi", r"foo\bar\zar\y.pyi"]) == r"foo\bar" assert common_dir_prefix([r"foo/bar\x.pyi"]) == r"foo\bar" assert common_dir_prefix([r"foo\bar/x.pyi"]) == r"foo\bar" assert common_dir_prefix([r"foo/bar/x.pyi"]) == r"foo\bar" diff --git a/mypy/test/testtypes.py b/mypy/test/testtypes.py index 5dd3b78c9498..2ee2758cf67f 100644 --- a/mypy/test/testtypes.py +++ b/mypy/test/testtypes.py @@ -1208,7 +1208,7 @@ def test_simple_generics(self) -> None: def test_generics_with_multiple_args(self) -> None: self.assert_meet(self.fx.hab, self.fx.hab, self.fx.hab) - self.assert_meet(self.fx.hab, self.fx.has, self.fx.hab) + self.assert_meet(self.fx.hab, self.fx.haa, self.fx.hab) self.assert_meet(self.fx.hab, self.fx.had, self.fx.nonet) self.assert_meet(self.fx.hab, self.fx.hbb, self.fx.hbb) diff --git a/mypyc/irbuild/classdef.py b/mypyc/irbuild/classdef.py index daea4a249c81..7e0a842b1b41 100644 --- a/mypyc/irbuild/classdef.py +++ b/mypyc/irbuild/classdef.py @@ -519,7 +519,7 @@ def populate_non_ext_bases(builder: IRBuilder, cdef: ClassDef) -> Value: "typing.Container", "typing.Sized", ): - # HEX: Synthesized base classes added by mypy don't exist at runtime, so skip them. + # HAX: Synthesized base classes added by mypy don't exist at runtime, so skip them. # This could break if they were added explicitly, though... continue # Add the current class to the base classes list of concrete subclasses @@ -529,7 +529,7 @@ def populate_non_ext_bases(builder: IRBuilder, cdef: ClassDef) -> Value: base_ir.children.append(ir) if cls.fullname in MAGIC_TYPED_DICT_CLASSES: - # HEX: Mypy internally represents TypedDict classes differently from what + # HAX: Mypy internally represents TypedDict classes differently from what # should happen at runtime. Replace with something that works. module = "typing" if builder.options.capi_version < (3, 9): From 90e296fb5a89d495fba1827aef97b21e3121557e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Clint=20Air=C3=A9?= <111376518+clintaire@users.noreply.github.com> Date: Mon, 16 Sep 2024 01:26:26 +0100 Subject: [PATCH 4/7] Update testtypes.py --- mypy/test/testtypes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mypy/test/testtypes.py b/mypy/test/testtypes.py index 2ee2758cf67f..0218d33cc124 100644 --- a/mypy/test/testtypes.py +++ b/mypy/test/testtypes.py @@ -867,7 +867,7 @@ def test_generics_contravariant(self) -> None: def test_generics_with_multiple_args(self) -> None: self.assert_join(self.fx_co.hab, self.fx_co.hab, self.fx_co.hab) self.assert_join(self.fx_co.hab, self.fx_co.hbb, self.fx_co.hab) - self.assert_join(self.fx_co.had, self.fx_co.has, self.fx_co.hao) + self.assert_join(self.fx_co.had, self.fx_co.haa, self.fx_co.hao) def test_generics_with_inheritance(self) -> None: self.assert_join(self.fx_co.gsab, self.fx_co.gb, self.fx_co.gb) From b2c35f9087e781c6235aa40ab9e307740bf4783d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Clint=20Air=C3=A9?= <111376518+clintaire@users.noreply.github.com> Date: Mon, 16 Sep 2024 00:18:22 +0100 Subject: [PATCH 5/7] Edited files and fixed issues Staging unstaged changes before pull Update testtypes.py --- mypy/nodes.py | 12 ++++++------ mypy/test/teststubgen.py | 16 ++++++++-------- mypy/test/testtypes.py | 4 ++-- mypy/test/typefixture.py | 2 +- mypyc/ir/ops.py | 8 ++++---- mypyc/irbuild/classdef.py | 4 ++-- mypyc/irbuild/expression.py | 2 +- mypyc/irbuild/function.py | 2 +- mypyc/test/test_namegen.py | 8 ++++---- mypyc/transform/refcount.py | 2 +- 10 files changed, 30 insertions(+), 30 deletions(-) diff --git a/mypy/nodes.py b/mypy/nodes.py index 377678213a5b..19f908661d49 100644 --- a/mypy/nodes.py +++ b/mypy/nodes.py @@ -184,15 +184,15 @@ class Node(Context): __slots__ = () def __str__(self) -> str: - and = self.accept(mypy.strconv.StrConv(options=Options())) - if and is None: + ans = self.accept(mypy.strconv.StrConv(options=Options())) + if ans is None: return repr(self) - return and + return ans def str_with_options(self, options: Options) -> str: - and = self.accept(mypy.strconv.StrConv(options=options)) - assert and - return and + ans = self.accept(mypy.strconv.StrConv(options=options)) + assert ans + return ans def accept(self, visitor: NodeVisitor[T]) -> T: raise RuntimeError("Not implemented", type(self)) diff --git a/mypy/test/teststubgen.py b/mypy/test/teststubgen.py index e3e20fee73d5..e65a16c8f395 100644 --- a/mypy/test/teststubgen.py +++ b/mypy/test/teststubgen.py @@ -587,10 +587,10 @@ def test_common_dir_prefix_unix(self) -> None: assert common_dir_prefix(["foo/bar/x.pyi", "foo/bar/y.pyi"]) == "foo/bar" assert common_dir_prefix(["foo/bar/x.pyi", "foo/y.pyi"]) == "foo" assert common_dir_prefix(["foo/x.pyi", "foo/bar/y.pyi"]) == "foo" - assert common_dir_prefix(["foo/bar/czar/x.pyi", "foo/y.pyi"]) == "foo" - assert common_dir_prefix(["foo/x.pyi", "foo/bar/czar/y.pyi"]) == "foo" - assert common_dir_prefix(["foo/bar/czar/x.pyi", "foo/bar/y.pyi"]) == "foo/bar" - assert common_dir_prefix(["foo/bar/x.pyi", "foo/bar/czar/y.pyi"]) == "foo/bar" + assert common_dir_prefix(["foo/bar/zar/x.pyi", "foo/y.pyi"]) == "foo" + assert common_dir_prefix(["foo/x.pyi", "foo/bar/zar/y.pyi"]) == "foo" + assert common_dir_prefix(["foo/bar/zar/x.pyi", "foo/bar/y.pyi"]) == "foo/bar" + assert common_dir_prefix(["foo/bar/x.pyi", "foo/bar/zar/y.pyi"]) == "foo/bar" assert common_dir_prefix([r"foo/bar\x.pyi"]) == "foo" assert common_dir_prefix([r"foo\bar/x.pyi"]) == r"foo\bar" @@ -604,10 +604,10 @@ def test_common_dir_prefix_win(self) -> None: assert common_dir_prefix([r"foo\bar\x.pyi", r"foo\bar\y.pyi"]) == r"foo\bar" assert common_dir_prefix([r"foo\bar\x.pyi", r"foo\y.pyi"]) == "foo" assert common_dir_prefix([r"foo\x.pyi", r"foo\bar\y.pyi"]) == "foo" - assert common_dir_prefix([r"foo\bar\czar\x.pyi", r"foo\y.pyi"]) == "foo" - assert common_dir_prefix([r"foo\x.pyi", r"foo\bar\czar\y.pyi"]) == "foo" - assert common_dir_prefix([r"foo\bar\czar\x.pyi", r"foo\bar\y.pyi"]) == r"foo\bar" - assert common_dir_prefix([r"foo\bar\x.pyi", r"foo\bar\czar\y.pyi"]) == r"foo\bar" + assert common_dir_prefix([r"foo\bar\zar\x.pyi", r"foo\y.pyi"]) == "foo" + assert common_dir_prefix([r"foo\x.pyi", r"foo\bar\zar\y.pyi"]) == "foo" + assert common_dir_prefix([r"foo\bar\zar\x.pyi", r"foo\bar\y.pyi"]) == r"foo\bar" + assert common_dir_prefix([r"foo\bar\x.pyi", r"foo\bar\zar\y.pyi"]) == r"foo\bar" assert common_dir_prefix([r"foo/bar\x.pyi"]) == r"foo\bar" assert common_dir_prefix([r"foo\bar/x.pyi"]) == r"foo\bar" assert common_dir_prefix([r"foo/bar/x.pyi"]) == r"foo\bar" diff --git a/mypy/test/testtypes.py b/mypy/test/testtypes.py index 5dd3b78c9498..0218d33cc124 100644 --- a/mypy/test/testtypes.py +++ b/mypy/test/testtypes.py @@ -867,7 +867,7 @@ def test_generics_contravariant(self) -> None: def test_generics_with_multiple_args(self) -> None: self.assert_join(self.fx_co.hab, self.fx_co.hab, self.fx_co.hab) self.assert_join(self.fx_co.hab, self.fx_co.hbb, self.fx_co.hab) - self.assert_join(self.fx_co.had, self.fx_co.has, self.fx_co.hao) + self.assert_join(self.fx_co.had, self.fx_co.haa, self.fx_co.hao) def test_generics_with_inheritance(self) -> None: self.assert_join(self.fx_co.gsab, self.fx_co.gb, self.fx_co.gb) @@ -1208,7 +1208,7 @@ def test_simple_generics(self) -> None: def test_generics_with_multiple_args(self) -> None: self.assert_meet(self.fx.hab, self.fx.hab, self.fx.hab) - self.assert_meet(self.fx.hab, self.fx.has, self.fx.hab) + self.assert_meet(self.fx.hab, self.fx.haa, self.fx.hab) self.assert_meet(self.fx.hab, self.fx.had, self.fx.nonet) self.assert_meet(self.fx.hab, self.fx.hbb, self.fx.hbb) diff --git a/mypy/test/typefixture.py b/mypy/test/typefixture.py index 73af11b45327..5a813f70117c 100644 --- a/mypy/test/typefixture.py +++ b/mypy/test/typefixture.py @@ -182,7 +182,7 @@ def make_type_var( self.gs2d = Instance(self.gs2i, [self.d]) # GS2[D] self.hab = Instance(self.hi, [self.a, self.b]) # H[A, B] - self.has = Instance(self.hi, [self.a, self.a]) # H[A, A] + self.haa = Instance(self.hi, [self.a, self.a]) # H[A, A] self.hbb = Instance(self.hi, [self.b, self.b]) # H[B, B] self.hts = Instance(self.hi, [self.t, self.s]) # H[T, S] self.had = Instance(self.hi, [self.a, self.d]) # H[A, D] diff --git a/mypyc/ir/ops.py b/mypyc/ir/ops.py index a1ab322a36be..896ba3ac091c 100644 --- a/mypyc/ir/ops.py +++ b/mypyc/ir/ops.py @@ -780,7 +780,7 @@ def accept(self, visitor: OpVisitor[T]) -> T: return visitor.visit_set_attr(self) -# Default name space for statistics, variables +# Default name space for statics, variables NAMESPACE_STATIC: Final = "static" # Static namespace for pointers to native type objects @@ -796,12 +796,12 @@ def accept(self, visitor: OpVisitor[T]) -> T: class LoadStatic(RegisterOp): """Load a static name (name :: static). - Load a C static variable/pointer. The namespace for statistics is shared + Load a C static variable/pointer. The namespace for statics is shared for the entire compilation group. You can optionally provide a module name and a sub-namespace identifier for additional namespacing to avoid name conflicts. The static namespace does not overlap with other C names, since the final C name will get a prefix, so conflicts only must be - avoided with other statistics. + avoided with other statics. """ error_kind = ERR_NEVER @@ -1451,7 +1451,7 @@ class LoadAddress(RegisterOp): type: Type of the loaded address(e.g. ptr/object_ptr) src: Source value (str for globals like 'PyList_Type', Register for temporary values or locals, LoadStatic - for statistics.) + for statics.) """ error_kind = ERR_NEVER diff --git a/mypyc/irbuild/classdef.py b/mypyc/irbuild/classdef.py index daea4a249c81..7e0a842b1b41 100644 --- a/mypyc/irbuild/classdef.py +++ b/mypyc/irbuild/classdef.py @@ -519,7 +519,7 @@ def populate_non_ext_bases(builder: IRBuilder, cdef: ClassDef) -> Value: "typing.Container", "typing.Sized", ): - # HEX: Synthesized base classes added by mypy don't exist at runtime, so skip them. + # HAX: Synthesized base classes added by mypy don't exist at runtime, so skip them. # This could break if they were added explicitly, though... continue # Add the current class to the base classes list of concrete subclasses @@ -529,7 +529,7 @@ def populate_non_ext_bases(builder: IRBuilder, cdef: ClassDef) -> Value: base_ir.children.append(ir) if cls.fullname in MAGIC_TYPED_DICT_CLASSES: - # HEX: Mypy internally represents TypedDict classes differently from what + # HAX: Mypy internally represents TypedDict classes differently from what # should happen at runtime. Replace with something that works. module = "typing" if builder.options.capi_version < (3, 9): diff --git a/mypyc/irbuild/expression.py b/mypyc/irbuild/expression.py index 31a7be405bbd..8d7c089e20cd 100644 --- a/mypyc/irbuild/expression.py +++ b/mypyc/irbuild/expression.py @@ -109,7 +109,7 @@ def transform_name_expr(builder: IRBuilder, expr: NameExpr) -> Value: if isinstance(expr.node, TypeVarLikeExpr) and expr.node.is_new_style: # Reference to Python 3.12 implicit TypeVar/TupleVarTuple/... object. - # These are stored in C statistics and not visible in Python namespaces. + # These are stored in C statics and not visible in Python namespaces. return builder.load_type_var(expr.node.name, expr.node.line) if expr.node is None: builder.add( diff --git a/mypyc/irbuild/function.py b/mypyc/irbuild/function.py index 1294de2b319c..c985e88b0e0c 100644 --- a/mypyc/irbuild/function.py +++ b/mypyc/irbuild/function.py @@ -514,7 +514,7 @@ def calculate_arg_defaults( ) -> None: """Calculate default argument values and store them. - They are stored in statistics for top level functions and in + They are stored in statics for top level functions and in the function objects for nested functions (while constants are still stored computed on demand). """ diff --git a/mypyc/test/test_namegen.py b/mypyc/test/test_namegen.py index d6c3e78bb82e..509018b4c3bd 100644 --- a/mypyc/test/test_namegen.py +++ b/mypyc/test/test_namegen.py @@ -25,10 +25,10 @@ def test_make_module_translation_map(self) -> None: "foo.bar": "bar.", "foo.baz": "baz.", } - assert make_module_translation_map(["czar", "foo.bar", "foo.baz"]) == { + assert make_module_translation_map(["zar", "foo.bar", "foo.baz"]) == { "foo.bar": "bar.", "foo.baz": "baz.", - "czar": "czar.", + "zar": "zar.", } assert make_module_translation_map(["foo.bar", "fu.bar", "foo.baz"]) == { "foo.bar": "foo.bar.", @@ -37,11 +37,11 @@ def test_make_module_translation_map(self) -> None: } def test_name_generator(self) -> None: - g = NameGenerator([["foo", "foo.czar"]]) + g = NameGenerator([["foo", "foo.zar"]]) assert g.private_name("foo", "f") == "foo___f" assert g.private_name("foo", "C.x.y") == "foo___C___x___y" assert g.private_name("foo", "C.x.y") == "foo___C___x___y" - assert g.private_name("foo.czar", "C.x.y") == "zar___C___x___y" + assert g.private_name("foo.zar", "C.x.y") == "zar___C___x___y" assert g.private_name("foo", "C.x_y") == "foo___C___x_y" assert g.private_name("foo", "C_x_y") == "foo___C_x_y" assert g.private_name("foo", "C_x_y") == "foo___C_x_y" diff --git a/mypyc/transform/refcount.py b/mypyc/transform/refcount.py index 455935b7a6ba..f2ab438f6576 100644 --- a/mypyc/transform/refcount.py +++ b/mypyc/transform/refcount.py @@ -187,7 +187,7 @@ def f(a: int) -> None term = block.terminator for i, target in enumerate(term.targets()): - # HEX: After we've checked against an error value the value we must not touch the + # HAX: After we've checked against an error value the value we must not touch the # refcount since it will be a null pointer. The correct way to do this would be # to perform data flow analysis on whether a value can be null (or is always # null). From 271dd048c556a08fe30007c3665aacf82bc3ec89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Clint=20Air=C3=A9?= <111376518+clintaire@users.noreply.github.com> Date: Tue, 17 Sep 2024 13:36:37 +0100 Subject: [PATCH 6/7] Update module_ir.py --- mypyc/ir/module_ir.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mypyc/ir/module_ir.py b/mypyc/ir/module_ir.py index 2bb60e024a75..e3b240629eda 100644 --- a/mypyc/ir/module_ir.py +++ b/mypyc/ir/module_ir.py @@ -28,7 +28,7 @@ def __init__( self.functions = functions self.classes = classes self.final_names = final_names - # Names of C statistics used for Python 3.12 type variable objects. + # Names of C statics used for Python 3.12 type variable objects. # These are only visible in the module that defined them, so no need # to serialize. self.type_var_names = type_var_names From e453262fbb553f1c1236fa8d7f600bfff215c3a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Clint=20Air=C3=A9?= <111376518+clintaire@users.noreply.github.com> Date: Tue, 17 Sep 2024 13:37:39 +0100 Subject: [PATCH 7/7] Update fastparse.py --- mypy/fastparse.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mypy/fastparse.py b/mypy/fastparse.py index 250e0870d4d1..abcce74c6064 100644 --- a/mypy/fastparse.py +++ b/mypy/fastparse.py @@ -2249,7 +2249,7 @@ def visit_member_expr(self, e: MemberExpr) -> None: class FindYield(TraverserVisitor): - """Check if an AST contains yields or yield forms.""" + """Check if an AST contains yields or yield froms.""" def __init__(self) -> None: self.found = False