You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by fu...@apache.org on 2020/02/22 17:11:16 UTC

svn commit: r1874390 - /subversion/trunk/tools/hook-scripts/validate-files.py

Author: futatuki
Date: Sat Feb 22 17:11:15 2020
New Revision: 1874390

URL: http://svn.apache.org/viewvc?rev=1874390&view=rev
Log:
Use configparser.ConfigParser instead of configparser.SafeConfigParser in py3

On Python 3.2, configparser.Configparser implementation is replaced by one it
was configparser.SafeConfigParser before 3.2, and SafeConfigParser class is
only an alias for compatibility on Python >= 3.2.  So we use
ConfigParser.SafeConfigParser in Python 2.7 and configparser.ConfigParser in
Python 3 for the base class of our Config class.

* tools/hook-scripts/validate-files.py
 (ConfigParser): New valiable to absorb difference of package and class name
 (class Config): Use ConfigParser as base class

Modified:
    subversion/trunk/tools/hook-scripts/validate-files.py

Modified: subversion/trunk/tools/hook-scripts/validate-files.py
URL: http://svn.apache.org/viewvc/subversion/trunk/tools/hook-scripts/validate-files.py?rev=1874390&r1=1874389&r2=1874390&view=diff
==============================================================================
--- subversion/trunk/tools/hook-scripts/validate-files.py (original)
+++ subversion/trunk/tools/hook-scripts/validate-files.py Sat Feb 22 17:11:15 2020
@@ -30,11 +30,13 @@ import fnmatch
 try:
     # Python >= 3.0
     import configparser
+    ConfigParser = configparser.ConfigParser
 except ImportError:
     # Python < 3.0
     import ConfigParser as configparser
+    ConfigParser = configparser.SafeConfigParser
 
-class Config(configparser.SafeConfigParser):
+class Config(ConfigParser):
     """Superclass of SafeConfigParser with some customizations
     for this script"""
     def optionxform(self, option):