GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — ConfigParser does not handle square brackets in section name · Issue #67490 · python/cpython

ConfigParser does not handle square brackets in section name #67490

New issue
Copy link
New issue
Copy link
Closed
Closed
ConfigParser does not handle square brackets in section name#67490
Copy link
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

xflr6
mannequin
opened on Jan 22, 2015
Issue body actions
BPO 23301
Nosy @bitdancer, @xflr6
Superseder
  • bpo-20923: [doc] Explain ConfigParser 'valid section name' and .SECTCRE
  • 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 2015-01-22.16:06:52.188>
    created_at = <Date 2015-01-22.15:58:05.320>
    labels = ['type-bug', 'library']
    title = 'ConfigParser does not handle square brackets in section name'
    updated_at = <Date 2015-01-22.16:06:52.186>
    user = 'https://github.com/xflr6'

    bugs.python.org fields:

    activity = <Date 2015-01-22.16:06:52.186>
    actor = 'r.david.murray'
    assignee = 'none'
    closed = True
    closed_date = <Date 2015-01-22.16:06:52.188>
    closer = 'r.david.murray'
    components = ['Library (Lib)']
    creation = <Date 2015-01-22.15:58:05.320>
    creator = 'xflr6'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 23301
    keywords = []
    message_count = 2.0
    messages = ['234497', '234498']
    nosy_count = 2.0
    nosy_names = ['r.david.murray', 'xflr6']
    pr_nums = []
    priority = 'normal'
    resolution = 'duplicate'
    stage = 'resolved'
    status = 'closed'
    superseder = '20923'
    type = 'behavior'
    url = 'https://bugs.python.org/issue23301'
    versions = ['Python 2.7', 'Python 3.4']

    Activity

    1. xflr6 commented on Jan 22, 2015

      @xflr6
      xflr6mannequin
      on Jan 22, 2015
      MannequinAuthor
      More actions

      ConfigParser parses section lines containing square brackets like '[spam [eggs] spam]' up to the first instead of the last occurrence of ']' preventing roundtrips:

      >> s = StringIO()
      >> c1 = ConfigParser()
      >> c1.add_section('spam [eggs]')
      >> c1.write(s)
      >> s.seek(0)
      >> c2 = ConfigParser()
      >> c2.readfp(s)
      >> assert c1.sections() == c2.sections() # fails

      Potential fix: change the second line of SECTCRE from r'(?P<header>[^]]+)' to r'(?P<header>.+?)'.

      If the parsing behaviour cannot be changed, the user should at least be warned about supplying data that breaks the roundtrip.

    2. xflr6
      added
      stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directory
      type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
      on Jan 22, 2015
    3. bitdancer commented on Jan 22, 2015

      @bitdancer
      bitdancer
      on Jan 22, 2015
      Member
      More actions

      This is a duplicate of bpo-20923 (#65122), which was rejected. To argue against the rejection you probably need to provide evidence that this is something that is actually supported by other common ini parsers. And that evidence should be posted to bpo-20923.

    4. bitdancer
      closed this as completedon Jan 22, 2015
    5. ezio-melotti
      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/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions

        You are visitor 01402520 — GeezerVison does not store the pages you look up.
        Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.