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: Bug in ConfigParser when setting new values in extended interpolation
Type: crash Stage:
Components: Library (Lib) Versions: Python 3.5
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: Michael Jacob, lukasz.langa
Priority: normal Keywords:

Created on 2016-03-02 09:40 by Michael Jacob, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (3)
msg261101 - (view) Author: Michael Jacob (Michael Jacob) Date: 2016-03-02 09:40
There seems to be a bug in configparser when setting new values in extended interpolation:

python --version
Python 3.5.1

from configparser import ConfigParser, ExtendedInterpolation
c=ConfigParser(interpolation=ExtendedInterpolation)
c.add_section('test')
c.set('test', 'key', 'value')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.5/configparser.py", line 1190, in set
    super().set(section, option, value)
  File "/usr/lib/python3.5/configparser.py", line 891, in set
    value)
TypeError: before_set() missing 1 required positional argument: 'value'

It works ithout extended interpolation, though.
msg261102 - (view) Author: Michael Jacob (Michael Jacob) Date: 2016-03-02 09:53
My bad.

ConfigParser expects an interpolation object, not a class.

Instead of c=ConfigParser(interpolation=ExtendedInterpolation)

you need to create it with:

c=ConfigParser(interpolation=ExtendedInterpolation())

Sorry about that.
msg413400 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2022-02-17 12:22
Note: the problem here was due to passing `ExtendedInterpolation` (the class) instead of `ExtendedInterpolation()` (the object). This is now fixed through BPO-41086.
History
Date User Action Args
2022-04-11 14:58:28adminsetgithub: 70656
2022-02-17 12:22:51lukasz.langasetnosy: + lukasz.langa
messages: + msg413400
2016-03-02 09:53:47Michael Jacobsetstatus: open -> closed
resolution: not a bug
messages: + msg261102
2016-03-02 09:40:40Michael Jacobcreate