Skip to content

Bug in ConfigParser when setting new values in extended interpolation #70656

Closed

Description

@MichaelJacob
BPO 26469
Nosy @ambv

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2016-03-02.09:53:47.923>
created_at = <Date 2016-03-02.09:40:40.534>
labels = ['invalid', 'library', 'type-crash']
title = 'Bug in ConfigParser when setting new values in extended interpolation'
updated_at = <Date 2022-02-17.12:22:51.625>
user = 'https://bugs.python.org/MichaelJacob'

bugs.python.org fields:

activity = <Date 2022-02-17.12:22:51.625>
actor = 'lukasz.langa'
assignee = 'none'
closed = True
closed_date = <Date 2016-03-02.09:53:47.923>
closer = 'Michael Jacob'
components = ['Library (Lib)']
creation = <Date 2016-03-02.09:40:40.534>
creator = 'Michael Jacob'
dependencies = []
files = []
hgrepos = []
issue_num = 26469
keywords = []
message_count = 3.0
messages = ['261101', '261102', '413400']
nosy_count = 2.0
nosy_names = ['lukasz.langa', 'Michael Jacob']
pr_nums = []
priority = 'normal'
resolution = 'not a bug'
stage = None
status = 'closed'
superseder = None
type = 'crash'
url = 'https://bugs.python.org/issue26469'
versions = ['Python 3.5']

Activity

  1. MichaelJacob commented on Mar 2, 2016

    MichaelJacobmannequin
    MannequinAuthor

    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.

  2. added
    stdlibStandard Library Python modules in the Lib/ directory
    type-crashA hard crash of the interpreter, possibly with a core dump
    on Mar 2, 2016
  3. MichaelJacob commented on Mar 2, 2016

    MichaelJacobmannequin
    MannequinAuthor

    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.

  4. ambv commented on Feb 17, 2022

    @ambv
    Contributor

    Note: the problem here was due to passing ExtendedInterpolation (the class) instead of ExtendedInterpolation() (the object). This is now fixed through BPO-41086.

  5. transferred this issue fromon Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytype-crashA hard crash of the interpreter, possibly with a core dump

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions