You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The second line in the following definition of a function gives an AttributeError.
f[Except[_[___], x_?NumericQ]] :=g[x];f[f[x_]] :=x;(* crashes with AttributeError: 'NoneType' object has no attribute 'get_attributes' *)
Error message
$ mathics
Mathics 2.2.0
on CPython 3.9.4 (default, Apr 7 2021, 05:45:11)
using SymPy 1.8, mpmath 1.2.1, numpy 1.20.3
Copyright (C) 2011-2021 The Mathics Team.
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under certain conditions.
See the documentation for the full license.
Quit by evaluating Quit[] or by pressing CONTROL-D.
In[1]:= f[Except[_[___], x_?NumericQ]] := g[x];
Out[1]= None
In[2]:= f[f[x_]] := x;
Traceback (most recent call last):
File "/home/tueda/tmp/test-mathicsscript/.venv/bin/mathics", line 8, in <module>
sys.exit(main())
File "/home/tueda/tmp/test-mathicsscript/.venv/lib/python3.9/site-packages/mathics/main.py", line 397, in main
result = evaluation.evaluate(query, timeout=settings.TIMEOUT)
File "/home/tueda/tmp/test-mathicsscript/.venv/lib/python3.9/site-packages/mathics/core/evaluation.py", line 355, in evaluate
result = run_with_timeout_and_stack(evaluate, timeout, self)
File "/home/tueda/tmp/test-mathicsscript/.venv/lib/python3.9/site-packages/mathics/core/evaluation.py", line 112, in run_with_timeout_and_stack
return request()
File "/home/tueda/tmp/test-mathicsscript/.venv/lib/python3.9/site-packages/mathics/core/evaluation.py", line 326, in evaluate
self.last_eval = query.evaluate(self)
File "/home/tueda/tmp/test-mathicsscript/.venv/lib/python3.9/site-packages/mathics/core/expression.py", line 1310, in evaluate
expr, reevaluate = expr.evaluate_next(evaluation)
File "/home/tueda/tmp/test-mathicsscript/.venv/lib/python3.9/site-packages/mathics/core/expression.py", line 1444, in evaluate_next
result = rule.apply(new, evaluation, fully=False)
File "/home/tueda/tmp/test-mathicsscript/.venv/lib/python3.9/site-packages/mathics/core/rules.py", line 67, in apply
self.pattern.match(yield_match, expression, {}, evaluation, fully=fully)
File "/home/tueda/tmp/test-mathicsscript/.venv/lib/python3.9/site-packages/mathics/core/pattern.py", line 291, in match
self.head.match(yield_head, expression.get_head(), vars, evaluation)
File "/home/tueda/tmp/test-mathicsscript/.venv/lib/python3.9/site-packages/mathics/core/pattern.py", line 159, in match
yield_func(vars, None)
File "/home/tueda/tmp/test-mathicsscript/.venv/lib/python3.9/site-packages/mathics/core/pattern.py", line 281, in yield_head
self.get_pre_choices(
File "/home/tueda/tmp/test-mathicsscript/.venv/lib/python3.9/site-packages/mathics/core/pattern.py", line 429, in get_pre_choices
yield_func(vars)
File "/home/tueda/tmp/test-mathicsscript/.venv/lib/python3.9/site-packages/mathics/core/pattern.py", line 258, in yield_choice
self.match_leaf(
File "/home/tueda/tmp/test-mathicsscript/.venv/lib/python3.9/site-packages/mathics/core/pattern.py", line 655, in match_leaf
self.get_wrappings(
File "/home/tueda/tmp/test-mathicsscript/.venv/lib/python3.9/site-packages/mathics/core/pattern.py", line 467, in get_wrappings
yield_func(sequence)
File "/home/tueda/tmp/test-mathicsscript/.venv/lib/python3.9/site-packages/mathics/core/pattern.py", line 643, in yield_wrapping
leaf.match(
File "/home/tueda/tmp/test-mathicsscript/.venv/lib/python3.9/site-packages/mathics/builtin/patterns.py", line 848, in match
self.pattern.match(yield_func, expression, new_vars, evaluation)
File "/home/tueda/tmp/test-mathicsscript/.venv/lib/python3.9/site-packages/mathics/builtin/patterns.py", line 1158, in match
yield_func(vars, None)
File "/home/tueda/tmp/test-mathicsscript/.venv/lib/python3.9/site-packages/mathics/core/pattern.py", line 640, in match_yield
yield_func(new_vars, items_rest)
File "/home/tueda/tmp/test-mathicsscript/.venv/lib/python3.9/site-packages/mathics/core/rules.py", line 42, in yield_match
new_expression = self.do_replace(expression, vars, options, evaluation)
File "/home/tueda/tmp/test-mathicsscript/.venv/lib/python3.9/site-packages/mathics/core/rules.py", line 131, in do_replace
return self.function(evaluation=evaluation, **vars_noctx)
File "/home/tueda/tmp/test-mathicsscript/.venv/lib/python3.9/site-packages/mathics/builtin/control.py", line 98, in apply
result = expr.evaluate(evaluation)
File "/home/tueda/tmp/test-mathicsscript/.venv/lib/python3.9/site-packages/mathics/core/expression.py", line 1310, in evaluate
expr, reevaluate = expr.evaluate_next(evaluation)
File "/home/tueda/tmp/test-mathicsscript/.venv/lib/python3.9/site-packages/mathics/core/expression.py", line 1444, in evaluate_next
result = rule.apply(new, evaluation, fully=False)
File "/home/tueda/tmp/test-mathicsscript/.venv/lib/python3.9/site-packages/mathics/core/rules.py", line 67, in apply
self.pattern.match(yield_match, expression, {}, evaluation, fully=fully)
File "/home/tueda/tmp/test-mathicsscript/.venv/lib/python3.9/site-packages/mathics/core/pattern.py", line 291, in match
self.head.match(yield_head, expression.get_head(), vars, evaluation)
File "/home/tueda/tmp/test-mathicsscript/.venv/lib/python3.9/site-packages/mathics/core/pattern.py", line 159, in match
yield_func(vars, None)
File "/home/tueda/tmp/test-mathicsscript/.venv/lib/python3.9/site-packages/mathics/core/pattern.py", line 281, in yield_head
self.get_pre_choices(
File "/home/tueda/tmp/test-mathicsscript/.venv/lib/python3.9/site-packages/mathics/core/pattern.py", line 429, in get_pre_choices
yield_func(vars)
File "/home/tueda/tmp/test-mathicsscript/.venv/lib/python3.9/site-packages/mathics/core/pattern.py", line 258, in yield_choice
self.match_leaf(
File "/home/tueda/tmp/test-mathicsscript/.venv/lib/python3.9/site-packages/mathics/core/pattern.py", line 655, in match_leaf
self.get_wrappings(
File "/home/tueda/tmp/test-mathicsscript/.venv/lib/python3.9/site-packages/mathics/core/pattern.py", line 456, in get_wrappings
yield_func(items[0])
File "/home/tueda/tmp/test-mathicsscript/.venv/lib/python3.9/site-packages/mathics/core/pattern.py", line 643, in yield_wrapping
leaf.match(
File "/home/tueda/tmp/test-mathicsscript/.venv/lib/python3.9/site-packages/mathics/builtin/patterns.py", line 848, in match
self.pattern.match(yield_func, expression, new_vars, evaluation)
File "/home/tueda/tmp/test-mathicsscript/.venv/lib/python3.9/site-packages/mathics/builtin/patterns.py", line 1046, in match
yield_func(vars, None)
File "/home/tueda/tmp/test-mathicsscript/.venv/lib/python3.9/site-packages/mathics/core/pattern.py", line 623, in match_yield
self.match_leaf(
File "/home/tueda/tmp/test-mathicsscript/.venv/lib/python3.9/site-packages/mathics/core/pattern.py", line 655, in match_leaf
self.get_wrappings(
File "/home/tueda/tmp/test-mathicsscript/.venv/lib/python3.9/site-packages/mathics/core/pattern.py", line 456, in get_wrappings
yield_func(items[0])
File "/home/tueda/tmp/test-mathicsscript/.venv/lib/python3.9/site-packages/mathics/core/pattern.py", line 643, in yield_wrapping
leaf.match(
File "/home/tueda/tmp/test-mathicsscript/.venv/lib/python3.9/site-packages/mathics/builtin/patterns.py", line 848, in match
self.pattern.match(yield_func, expression, new_vars, evaluation)
File "/home/tueda/tmp/test-mathicsscript/.venv/lib/python3.9/site-packages/mathics/builtin/patterns.py", line 1046, in match
yield_func(vars, None)
File "/home/tueda/tmp/test-mathicsscript/.venv/lib/python3.9/site-packages/mathics/core/pattern.py", line 640, in match_yield
yield_func(new_vars, items_rest)
File "/home/tueda/tmp/test-mathicsscript/.venv/lib/python3.9/site-packages/mathics/core/pattern.py", line 616, in leaf_yield
yield_func(
File "/home/tueda/tmp/test-mathicsscript/.venv/lib/python3.9/site-packages/mathics/core/rules.py", line 42, in yield_match
new_expression = self.do_replace(expression, vars, options, evaluation)
File "/home/tueda/tmp/test-mathicsscript/.venv/lib/python3.9/site-packages/mathics/core/rules.py", line 131, in do_replace
return self.function(evaluation=evaluation, **vars_noctx)
File "/home/tueda/tmp/test-mathicsscript/.venv/lib/python3.9/site-packages/mathics/builtin/assignment.py", line 603, in apply
if self.assign(lhs, rhs, evaluation):
File "/home/tueda/tmp/test-mathicsscript/.venv/lib/python3.9/site-packages/mathics/builtin/assignment.py", line 469, in assign
return self.assign_elementary(lhs, rhs, evaluation)
File "/home/tueda/tmp/test-mathicsscript/.venv/lib/python3.9/site-packages/mathics/builtin/assignment.py", line 211, in assign_elementary
focus = focus.evaluate_leaves(evaluation)
File "/home/tueda/tmp/test-mathicsscript/.venv/lib/python3.9/site-packages/mathics/core/expression.py", line 1472, in evaluate_leaves
leaves = [leaf.evaluate(evaluation) for leaf in self._leaves]
File "/home/tueda/tmp/test-mathicsscript/.venv/lib/python3.9/site-packages/mathics/core/expression.py", line 1472, in <listcomp>
leaves = [leaf.evaluate(evaluation) for leaf in self._leaves]
File "/home/tueda/tmp/test-mathicsscript/.venv/lib/python3.9/site-packages/mathics/core/expression.py", line 1310, in evaluate
expr, reevaluate = expr.evaluate_next(evaluation)
File "/home/tueda/tmp/test-mathicsscript/.venv/lib/python3.9/site-packages/mathics/core/expression.py", line 1444, in evaluate_next
result = rule.apply(new, evaluation, fully=False)
File "/home/tueda/tmp/test-mathicsscript/.venv/lib/python3.9/site-packages/mathics/core/rules.py", line 67, in apply
self.pattern.match(yield_match, expression, {}, evaluation, fully=fully)
File "/home/tueda/tmp/test-mathicsscript/.venv/lib/python3.9/site-packages/mathics/core/pattern.py", line 291, in match
self.head.match(yield_head, expression.get_head(), vars, evaluation)
File "/home/tueda/tmp/test-mathicsscript/.venv/lib/python3.9/site-packages/mathics/core/pattern.py", line 159, in match
yield_func(vars, None)
File "/home/tueda/tmp/test-mathicsscript/.venv/lib/python3.9/site-packages/mathics/core/pattern.py", line 281, in yield_head
self.get_pre_choices(
File "/home/tueda/tmp/test-mathicsscript/.venv/lib/python3.9/site-packages/mathics/core/pattern.py", line 429, in get_pre_choices
yield_func(vars)
File "/home/tueda/tmp/test-mathicsscript/.venv/lib/python3.9/site-packages/mathics/core/pattern.py", line 232, in yield_choice
if not leaf.does_match(
File "/home/tueda/tmp/test-mathicsscript/.venv/lib/python3.9/site-packages/mathics/core/pattern.py", line 84, in does_match
self.match(yield_match, expression, vars, evaluation, fully=fully)
File "/home/tueda/tmp/test-mathicsscript/.venv/lib/python3.9/site-packages/mathics/builtin/patterns.py", line 625, in match
self.c.match(except_yield_func, expression, vars, evaluation)
File "/home/tueda/tmp/test-mathicsscript/.venv/lib/python3.9/site-packages/mathics/core/pattern.py", line 190, in match
attributes = self.head.get_attributes(evaluation.definitions)
File "/home/tueda/tmp/test-mathicsscript/.venv/lib/python3.9/site-packages/mathics/builtin/base.py", line 770, in get_attributes
return self.head.get_attributes(definitions)
AttributeError: 'NoneType' object has no attribute 'get_attributes'
This was found by a casual try for FeynRules (though recently its incompatibility with Mathematica 12.2 was resolved).
FeynRules v2.3.47, Core/Initialisation.m:1275 and 1316:
The second line in the following definition of a function gives an
AttributeError
.Error message
This was found by a casual try for FeynRules (though recently its incompatibility with Mathematica 12.2 was resolved).
FeynRules v2.3.47, Core/Initialisation.m:1275 and 1316:
FYI: expectd results with the above
f
function:The text was updated successfully, but these errors were encountered: