D1136: templatefilters: defend against evil unicode strs in json filter

ryanmce (Ryan McElroy) phabricator at mercurial-scm.org
Tue Oct 17 08:23:51 EDT 2017


ryanmce added a comment.


  I'm not a python 3 expert by any means, but I'm not sold on this change.
  
  I think we need perhaps a programming error so it's clear its a bug and not something the user needs to fix in their command inputs.

INLINE COMMENTS

> templatefilters.py:241-242
> +        # hurt someone.
> +        raise TypeError(
> +            r'Mercurial only does output with bytes on Python 3: %r' % obj)
>      elif util.safehasattr(obj, 'keys'):

I fear that this is is an non-actionable error. How might I see it as a user? If I see it, what do I do?

Also, why is this a TypeError? Should this be a ProgrammingError instead? Or is there a way user input could trigger this?

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D1136

To: durin42, #hg-reviewers
Cc: ryanmce, mercurial-devel


More information about the Mercurial-devel mailing list