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

Fixes #8: Use dict on py>=3.7; Improved exceptions, and mapping vs iterable #14

Merged
merged 1 commit into from
Jul 22, 2020

Commits on Jul 22, 2020

  1. Use dict on py>=3.7; Improved exceptions, and mapping vs iterable

    Details:
    
    * Starting with Python 3.7, the standard dict is guaranteed to be
      ordered on all Python implementations. Therefore, there is no
      reason to use OrderedDict anymore on py>=3.7, and the standard
      dict is faster. This change uses dict on py>=3.7 and otherwise
      OrderedDict for the implementation of NocaseDict.
    
    * The issuing of message 'During handling of the above exception,
      another exception occurred' is now suppressed by setting
      exc.__cause__ = None. This works on both Python 2 and 3.
    
    * Improved the detection of mapping vs iterable as the init
      argument by generalizing the type checking for mapping to
      be derived from (NocaseDict, Mapping, UserDict), and to expect
      an iterable otherwise, failing with TypeError when it cannot
      be iterated on.
    
    * Exception messages have been cleaned up and improved, and in
      some cases re-raised with better message. No different
      exception types are raised than before this change.
    
    * Along with the new re.-raising of exceptions, it surfaced
      that some error cases had not been tested so far, mainly
      in the area of providing iterables of tuples (key, value)
      where the tuple items did not contain exactly two items.
      Added testcases to cover these error cases.
    
    Signed-off-by: Andreas Maier <andreas.r.maier@gmx.de>
    andy-maier committed Jul 22, 2020
    Configuration menu
    Copy the full SHA
    8af5101 View commit details
    Browse the repository at this point in the history