Skip to content

Exception for uninstantiated interpolation (configparser) #85258

Closed

Description

@scrummyin
mannequin
BPO 41086
Nosy @ambv, @iritkatriel, @scrummyin
PRs
  • bpo-41086: Add exception for uninstantiated interpolation (configparser) #21062
  • 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 2022-02-17.12:30:05.079>
    created_at = <Date 2020-06-23.01:28:41.517>
    labels = ['type-feature', 'library', '3.11']
    title = 'Exception for uninstantiated interpolation (configparser)'
    updated_at = <Date 2022-02-17.12:30:05.079>
    user = 'https://github.com/scrummyin'

    bugs.python.org fields:

    activity = <Date 2022-02-17.12:30:05.079>
    actor = 'lukasz.langa'
    assignee = 'none'
    closed = True
    closed_date = <Date 2022-02-17.12:30:05.079>
    closer = 'lukasz.langa'
    components = ['Library (Lib)']
    creation = <Date 2020-06-23.01:28:41.517>
    creator = 'scrummyin'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 41086
    keywords = ['patch']
    message_count = 4.0
    messages = ['372137', '404731', '413398', '413401']
    nosy_count = 4.0
    nosy_names = ['lukasz.langa', 'python-dev', 'iritkatriel', 'scrummyin']
    pr_nums = ['21062']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue41086'
    versions = ['Python 3.11']

    Activity

    1. scrummyin commented on Jun 23, 2020

      scrummyinmannequin
      MannequinAuthor

      The ConfigParser in Lib has a parameter called interpolation, that expects an instance of a subclass of Interpolation. However, when ConfigParser is given an argument of an uninstantiated subclass of Interpolation, the init function of ConfigParser accepts it and continues on. This results in a later receiving an error message along the lines of TypeError: before_set() missing 1 required positional argument: 'value' when functions are later called on the ConfigParser instance. This delay between the feedback and the original mistake has led to a few bugs open on the issue tracker (https://bugs.python.org/issue26831 and https://bugs.python.org/issue26469. Both of which were closed after a quick and simple explanation, which can be easily implemented in the library itself.

      I've created a PR for this work and will attach it shortly. Please let me know if there is a better name for the exception other than InterpolationIsNotInstantiatedError. It seems long, but also in line with the other Errors already in configparser.

    2. added
      type-bugAn unexpected behavior, bug, or error
      stdlibStandard Library Python modules in the Lib/ directory
      on Jun 23, 2020
    3. iritkatriel commented on Oct 22, 2021

      @iritkatriel
      Member

      This is not a bugfix so it should probably not be backported.

    4. 3 remaining items

    5. added
      type-featureA feature request or enhancement
      3.11only security fixes
      and removed
      type-bugAn unexpected behavior, bug, or error
      on Oct 22, 2021
    6. ambv commented on Feb 17, 2022

      @ambv
      Contributor

      New changeset fc115c9 by Brian Faherty in branch 'main':
      bpo-41086: Add exception for uninstantiated interpolation (configparser) (GH-21062)
      fc115c9

    7. ambv commented on Feb 17, 2022

      @ambv
      Contributor

      It's a behavioral change that tightens acceptable objects passed to interpolation=. In the past any object that provided the same interface as Interpolation instances would be accepted. No longer.

      I think this is an acceptable compromise but it's definitely outside of the realm of backporting.

      Thanks for your contribution, Brian! ✨ 🍰 ✨

    8. 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

      3.11only security fixesstdlibStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancement

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions