Translate NameError into SyntaxError to meet prescribed API

--HG--
extra : histedit_source : 6ed89212bff75512c980d3fc0f98117510f3b576
Prefer local implementation to markerlib implementation as markerlib implementation is not as complete.

--HG--
extra : histedit_source : 3855347db7042dc34032b6bfa7b4c4e5239c1c3f