Skip to content

Commit

Permalink
Edited files and fixed issues
Browse files Browse the repository at this point in the history
  • Loading branch information
clintaire committed Sep 15, 2024
1 parent 5c33478 commit cc5a3ef
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 18 deletions.
12 changes: 6 additions & 6 deletions mypy/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion mypy/test/typefixture.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
8 changes: 4 additions & 4 deletions mypyc/ir/ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion mypyc/irbuild/expression.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion mypyc/irbuild/function.py
Original file line number Diff line number Diff line change
Expand Up @@ -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).
"""
Expand Down
8 changes: 4 additions & 4 deletions mypyc/test/test_namegen.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand All @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion mypyc/transform/refcount.py
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down

0 comments on commit cc5a3ef

Please sign in to comment.