gilch / hissp

It's Python with a Lissp.
https://gitter.im/hissp-lang/community
Apache License 2.0
364 stars 9 forks source link

Use a mock sentinel for MARK instead of a gensym #216

Closed gilch closed 1 year ago

gilch commented 1 year ago

Gensyms just resolve to strings, and shouldn't be used literally anywhere they might collide with adversarial input, which commonly come in the form of unsanitized strings. User input could theoretically change where a MARK is, altering behavior.

sentinels normally shouldn't be used outside of tests, but the standalone property limits my options. At run time a simple object() would do, but unpickling the same object() created at read time twice wouldn't preserve equality in this case. A sentinel can do that.

I've used getattr to create a sentinel with a non-identifier string, which are almost never used, so this is unlikely to interfere with tests. For good measure, I prepended hissp. to the ] as an ad-hoc namespace.

codecov[bot] commented 1 year ago

Codecov Report

Merging #216 (3e059e2) into master (4874223) will not change coverage. The diff coverage is n/a.

@@            Coverage Diff            @@
##            master      #216   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            6         6           
  Lines          710       710           
  Branches       109       109           
=========================================
  Hits           710       710           

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more