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] 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).