Skip to content

fix: output parser bugs in xml.py and pydantic.py#35641

Open
jnMetaCode wants to merge 2 commits intolangchain-ai:masterfrom
jnMetaCode:fix/output-parser-bugs
Open

fix: output parser bugs in xml.py and pydantic.py#35641
jnMetaCode wants to merge 2 commits intolangchain-ai:masterfrom
jnMetaCode:fix/output-parser-bugs

Conversation

@jnMetaCode
Copy link

Summary

  • Fix missing spaces in error messages in xml.py: Adjacent string literals in two ImportError messages were missing spaces between them, resulting in concatenated words like "parser.You" and "defusedxml`See".
  • Fix partial parameter not forwarded in PydanticOutputParser.parse_result: The partial parameter was accepted but not passed to super().parse_result(), so partial parsing mode had no effect.

Files Changed

  • libs/core/langchain_core/output_parsers/xml.py — Added trailing spaces to adjacent string literals in two error messages
  • libs/core/langchain_core/output_parsers/pydantic.py — Forward partial=partial to super().parse_result()

Test plan

  • Verified the string concatenation produces correct spacing
  • Verified parse_result now respects partial=True by forwarding to parent class

The error message strings were concatenated without spaces, resulting
in "...parser.You can install..." instead of "...parser. You can install...".

Signed-off-by: JiangNan <1394485448@qq.com>
The `partial` parameter was not being forwarded to the parent
`super().parse_result()` call, causing partial parsing to not
work correctly in PydanticOutputParser.

Signed-off-by: JiangNan <1394485448@qq.com>
@github-actions github-actions bot added fix For PRs that implement a fix core `langchain-core` package issues & PRs external and removed fix For PRs that implement a fix labels Mar 8, 2026
@codspeed-hq
Copy link

codspeed-hq bot commented Mar 8, 2026

Merging this PR will not alter performance

⚠️ Unknown Walltime execution environment detected

Using the Walltime instrument on standard Hosted Runners will lead to inconsistent data.

For the most accurate results, we recommend using CodSpeed Macro Runners: bare-metal machines fine-tuned for performance measurement consistency.

✅ 13 untouched benchmarks
⏩ 23 skipped benchmarks1


Comparing jnMetaCode:fix/output-parser-bugs (08f6e02) with master (29134dc)2

Open in CodSpeed

Footnotes

  1. 23 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

  2. No successful run was found on master (532b014) during the generation of this report, so 29134dc was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@github-actions github-actions bot added the size: XS < 50 LOC label Mar 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core `langchain-core` package issues & PRs external size: XS < 50 LOC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant