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 — plistlib inherits expat's newline-normalizing behavior, which can corrupt data in XML plists · Issue #139423 · python/cpython

plistlib inherits expat's newline-normalizing behavior, which can corrupt data in XML plists #139423

New issue
Copy link
New issue
Copy link
Open
Open
plistlib inherits expat's newline-normalizing behavior, which can corrupt data in XML plists#139423
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

@glyph
glyph
opened on Sep 29, 2025
Issue body actions

Bug report

Bug description:

This is just a special case of #84561 but it came up in the specific circumstance of XML plists in MOPUp, here: https://github.com/glyph/MOPUp/pull/448/files#r2280646662

I also discovered that it is possible to get the unmodified data, by changing plistlib._PlistParser.handle_data to look like this:

    def handle_data(self, data):
        ctx = self.parser.GetInputContext()
        if data == '\n' and ctx[0:1] != b'\n':
            data = ctx[0:1].decode("utf-8")
        self.data.append(data)

so we are not totally bound by the whims of Expat here; these types of bug could be fixed.

CPython versions tested on:

3.12, 3.13, 3.11

Operating systems tested on:

macOS

Linked PRs

  • gh-139423: Fix plistlib to preserve carriage returns in XML plist round-trips #148305

Activity

  1. glyph
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    on Sep 29, 2025
  2. StanFromIreland
    added
    stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directory
    on Sep 29, 2025
  3. gaweng
    added a commit that references this issue on Apr 9, 2026

    pythongh-139423: Fix plistlib to preserve carriage returns in XML pli…

    c8f1615
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 01402503 — 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.