Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception for uninstantiated interpolation (configparser) #85258

Closed
scrummyin mannequin opened this issue Jun 23, 2020 · 4 comments
Closed

Exception for uninstantiated interpolation (configparser) #85258

scrummyin mannequin opened this issue Jun 23, 2020 · 4 comments
Labels
3.11 only security fixes stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@scrummyin
Copy link
Mannequin

scrummyin mannequin commented Jun 23, 2020

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']

    @scrummyin
    Copy link
    Mannequin Author

    scrummyin mannequin commented Jun 23, 2020

    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.

    @scrummyin scrummyin mannequin added type-bug An unexpected behavior, bug, or error 3.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes 3.10 only security fixes stdlib Python modules in the Lib dir labels Jun 23, 2020
    @iritkatriel
    Copy link
    Member

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

    @iritkatriel iritkatriel added 3.11 only security fixes type-feature A feature request or enhancement and removed 3.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes 3.10 only security fixes type-bug An unexpected behavior, bug, or error labels Oct 22, 2021
    @ambv
    Copy link
    Contributor

    ambv commented Feb 17, 2022

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

    @ambv
    Copy link
    Contributor

    ambv commented Feb 17, 2022

    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! ✨ 🍰 ✨

    @ambv ambv closed this as completed Feb 17, 2022
    @ambv ambv closed this as completed Feb 17, 2022
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.11 only security fixes stdlib Python modules in the Lib dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants