Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

something /.Repeated[_, {0, 1}]->5 raises an unhandled exception #992

Closed
mmatera opened this issue Oct 27, 2020 · 1 comment
Closed

something /.Repeated[_, {0, 1}]->5 raises an unhandled exception #992

mmatera opened this issue Oct 27, 2020 · 1 comment
Labels

Comments

@mmatera
Copy link
Contributor

mmatera commented Oct 27, 2020

In[1]:=something /.Repeated[_, {0, 1}]->5

Traceback (most recent call last):
File "/opt/miniconda3/envs/mathics/bin/mathics", line 33, in
sys.exit(load_entry_point('Mathics', 'console_scripts', 'mathics')())
File "/home/mauricio/Projects/mathics/mathics/main.py", line 344, in main
result = evaluation.evaluate(query, timeout=settings.TIMEOUT)
File "/home/mauricio/Projects/mathics/mathics/core/evaluation.py", line 291, in evaluate
result = run_with_timeout_and_stack(evaluate, timeout)
File "/home/mauricio/Projects/mathics/mathics/core/evaluation.py", line 95, in run_with_timeout_and_stack
return request()
File "/home/mauricio/Projects/mathics/mathics/core/evaluation.py", line 269, in evaluate
result = query.evaluate(self)
File "/home/mauricio/Projects/mathics/mathics/core/expression.py", line 1121, in evaluate
expr, reevaluate = expr.evaluate_next(evaluation)
File "/home/mauricio/Projects/mathics/mathics/core/expression.py", line 1249, in evaluate_next
result = rule.apply(new, evaluation, fully=False)
File "/home/mauricio/Projects/mathics/mathics/core/rules.py", line 63, in apply
self.pattern.match(
File "/home/mauricio/Projects/mathics/mathics/core/pattern.py", line 238, in match
self.head.match(
File "/home/mauricio/Projects/mathics/mathics/core/pattern.py", line 137, in match
yield_func(vars, None)
File "/home/mauricio/Projects/mathics/mathics/core/pattern.py", line 230, in yield_head
self.get_pre_choices(
File "/home/mauricio/Projects/mathics/mathics/core/pattern.py", line 358, in get_pre_choices
yield_func(vars)
File "/home/mauricio/Projects/mathics/mathics/core/pattern.py", line 215, in yield_choice
self.match_leaf(
File "/home/mauricio/Projects/mathics/mathics/core/pattern.py", line 517, in match_leaf
self.get_wrappings(
File "/home/mauricio/Projects/mathics/mathics/core/pattern.py", line 379, in get_wrappings
yield_func(items[0])
File "/home/mauricio/Projects/mathics/mathics/core/pattern.py", line 513, in yield_wrapping
leaf.match(match_yield, item, vars, evaluation, fully=True,
File "/home/mauricio/Projects/mathics/mathics/builtin/patterns.py", line 770, in match
self.pattern.match(yield_func, expression, new_vars, evaluation)
File "/home/mauricio/Projects/mathics/mathics/builtin/patterns.py", line 955, in match
yield_func(vars, None)
File "/home/mauricio/Projects/mathics/mathics/core/pattern.py", line 503, in match_yield
self.match_leaf(
File "/home/mauricio/Projects/mathics/mathics/core/pattern.py", line 517, in match_leaf
self.get_wrappings(
File "/home/mauricio/Projects/mathics/mathics/core/pattern.py", line 379, in get_wrappings
yield_func(items[0])
File "/home/mauricio/Projects/mathics/mathics/core/pattern.py", line 513, in yield_wrapping
leaf.match(match_yield, item, vars, evaluation, fully=True,
File "/home/mauricio/Projects/mathics/mathics/builtin/patterns.py", line 770, in match
self.pattern.match(yield_func, expression, new_vars, evaluation)
File "/home/mauricio/Projects/mathics/mathics/builtin/patterns.py", line 955, in match
yield_func(vars, None)
File "/home/mauricio/Projects/mathics/mathics/core/pattern.py", line 510, in match_yield
yield_func(new_vars, items_rest)
File "/home/mauricio/Projects/mathics/mathics/core/pattern.py", line 497, in leaf_yield
yield_func(
File "/home/mauricio/Projects/mathics/mathics/core/rules.py", line 40, in yield_match
new_expression = self.do_replace(expression, vars, options, evaluation)
File "/home/mauricio/Projects/mathics/mathics/core/rules.py", line 129, in do_replace
return self.function(evaluation=evaluation, **vars_noctx)
File "/home/mauricio/Projects/mathics/mathics/builtin/patterns.py", line 271, in apply
rules, ret = create_rules(rules, expr, 'ReplaceAll', evaluation)
File "/home/mauricio/Projects/mathics/mathics/builtin/patterns.py", line 125, in create_rules
result.append(Rule(rule.leaves[0], rule.leaves[1]))
File "/home/mauricio/Projects/mathics/mathics/core/rules.py", line 79, in init
super(Rule, self).init(pattern, system=system)
File "/home/mauricio/Projects/mathics/mathics/core/rules.py", line 18, in init
self.pattern = Pattern.create(pattern)
File "/home/mauricio/Projects/mathics/mathics/core/pattern.py", line 27, in Pattern_create
return pattern_object(expr)
File "/home/mauricio/Projects/mathics/mathics/builtin/base.py", line 316, in new
instance.init(*args, **kwargs)
File "/home/mauricio/Projects/mathics/mathics/builtin/patterns.py", line 1125, in init
self.error('range', 2, expr)
File "/home/mauricio/Projects/mathics/mathics/builtin/base.py", line 561, in error
raise PatternError(self.get_name(), tag, *args)
mathics.builtin.base.PatternError: ('SystemRepeated', 'range', 2, <Expression: SystemRepeated[SystemBlank[], SystemList[0, 1]]>)

@mmatera
Copy link
Contributor Author

mmatera commented Oct 27, 2020

Addressed by PR #993

@mmatera mmatera added the bug label Oct 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant