Skip to content

Commit 6235dcc

Browse files
Fix attributes for True and False
1 parent b1eeb97 commit 6235dcc

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

CHANGES.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ New Builtins
99
Internals
1010
=========
1111

12+
1213
* To speed up attributes read, and RAM usage, attributes are now stored in a bitset instead of a tuple of strings.
1314
* Definitions for symbols ``CurrentContext`` and ``ContextPath[]`` are mirrored in the ``mathics.core.definitions.Definitions`` object for faster access.
1415
* To speed up the lookup of symbols names, `Definitions` object now have two properties: `current_context` and `context_path`. These properties stores the values of the corresponding symbols in the `builtin` definitions.
@@ -22,8 +23,8 @@ Internals
2223
* A bug comming from a failure in the order in which `mathics.core.definitions` stores the rules was fixed.
2324
* `any`/`all` calls were unrolled as loops in Cythonized modules: this avoids the overhead of a function call replacing it by a (C) for loop, which is faster.
2425
* `BaseExpression.get_head` now avoids building a symbol and then look for its name. It saves two function calls.
25-
* Now, `SameQ` first checks type, then `id`s, and then names in symbols.
26-
* In `mathics.builtin.patterns.PatternTest`, if the condition is one of the most used tests (`NumberQ`, `NumericQ`, `StringQ`, etc) the `match` method is overwritten to specialized versions that avoid function calls.
26+
* Now, ``SameQ`` first checks type, then ``id``s, and then names in symbols.
27+
* In `mathics.builtin.patterns.PatternTest`, if the condition is one of the most used tests (``NumberQ``, ``NumericQ``, ``StringQ``, etc) the `match` method is overwritten to specialized versions that avoid function calls.
2728
* in the same aim, `mathics.core.patterns.AtomPattern` now specializes the comparison depending of the `Atom` type.
2829
* To speed up the Mathics ``Expression`` manipulation code, `Symbol`s objects are now a singleton class. This avoids a lot of unnecesary string comparisons, and calls to ``ensure_context``.
2930
* To speed up development, you can set ``NO_CYTHON`` to skip Cythonizing Python modules

mathics/builtin/assignments/assignment.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
from mathics.builtin.base import Builtin, BinaryOperator
88
from mathics.core.symbols import Symbol
99

10-
1110
from mathics.core.systemsymbols import (
1211
SymbolFailed,
1312
)

mathics/builtin/logic.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,14 @@
1010
SymbolFalse,
1111
)
1212

13-
from mathics.core.attributes import flat, hold_all, one_identity, orderless, protected
13+
from mathics.core.attributes import (
14+
flat,
15+
hold_all,
16+
one_identity,
17+
orderless,
18+
protected,
19+
locked,
20+
)
1421

1522

1623
class Or(BinaryOperator):
@@ -331,6 +338,7 @@ class True_(Predefined):
331338
</dl>
332339
"""
333340

341+
attributes = locked | protected
334342
name = "True"
335343

336344

@@ -342,6 +350,7 @@ class False_(Predefined):
342350
</dl>
343351
"""
344352

353+
attributes = locked | protected
345354
name = "False"
346355

347356

0 commit comments

Comments
 (0)