[prev in list] [next in list] [prev in thread] [next in thread] 

List:       subversion-commits
Subject:    svn commit: r1874390 - /subversion/trunk/tools/hook-scripts/validate-files.py
From:       futatuki () apache ! org
Date:       2020-02-22 17:11:16
Message-ID: 20200222171116.1B79617A010 () svn01-us-east ! apache ! org
[Download RAW message or body]

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):


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic