This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Default ConfigParser in python is not able to load values habing percent in them
Type: compile error Stage: resolved
Components: Distutils Versions: Python 3.4, Python 3.5
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: dstufft, eric.araujo, ssbarnea, steve.dower
Priority: normal Keywords:

Created on 2016-04-27 20:51 by ssbarnea, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (3)
msg264402 - (view) Author: Sorin Sbarnea (ssbarnea) * Date: 2016-04-27 20:51
The ConfigParser issue with % (percent) is taking huge proportions because it does have serious implications downstream. One such example is the fact that in breaks virtualenv in such way the if you create a virtual env in a path that contains percent at some point you will endup with a virtualenv where you can install only about 50% of existing python packages (serious ones like numpy or pandas will fail to install or even to perform a simple python setup.py egg_info on them).

This is related to distutils which is trying to use the ConfigParser to load the python PATH (which now contains the percent). 

Switching to RawConfigParser does resolve the problem but this seems like an almost impossible attempt because the huge number of occurrences in the wild.

You will find the that only class that is able to load a value with percent inside is RawConfigParser and I don't think that this is normal.

Here is some code I created to exemplify the defective behaviour:
https://github.com/ssbarnea/test-configparser/blob/master/tests/test-configparser.py#L21

The code is executed by Travis with multiple version of python, see one result example: https://travis-ci.org/ssbarnea/test-configparser/jobs/126145032

My personal impression is that the decision to process the % (percent) and to change the behaviour between Python 2 and 3 was a very unfortunate one. Ini/Cfg file specification does not specify the percent as an escape character. Introduction of the %(VAR) feature sounds more like bug than a feature in this case.
msg264403 - (view) Author: Sorin Sbarnea (ssbarnea) * Date: 2016-04-27 20:55
Here is one example of failure caused by this https://gist.github.com/ssbarnea/b373062dd45de92735c7482b2735c5fb
msg386371 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2021-02-03 18:21
Distutils is now deprecated (see PEP 632) and all tagged issues are being closed. From now until removal, only release blocking issues will be considered for distutils.

If this issue does not relate to distutils, please remove the component and reopen it. If you believe it still requires a fix, most likely the issue should be re-reported at https://github.com/pypa/setuptools
History
Date User Action Args
2022-04-11 14:58:30adminsetgithub: 71059
2021-02-03 18:21:54steve.dowersetstatus: open -> closed

nosy: + steve.dower
messages: + msg386371

resolution: out of date
stage: resolved
2016-04-27 20:55:03ssbarneasetmessages: + msg264403
2016-04-27 20:51:25ssbarneacreate