Skip to content

Commit ea254d8

Browse files
committed
fix
1 parent 80ca6be commit ea254d8

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

pydantic_ai_slim/pydantic_ai/_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -467,14 +467,14 @@ def validate_empty_kwargs(_kwargs: dict[str, Any]) -> None:
467467
raise exceptions.UserError(f'Unknown keyword arguments: {unknown_kwargs}')
468468

469469

470-
_MARKDOWN_FENCES_PATTERN = re.compile(r'```(?:\w+)?\n(\{.*\})')
470+
_MARKDOWN_FENCES_PATTERN = re.compile(r'```(?:\w+)?\n(\{.*\})', flags=re.DOTALL)
471471

472472

473473
def strip_markdown_fences(text: str) -> str:
474474
if text.startswith('{'):
475475
return text
476476

477-
match = re.search(_MARKDOWN_FENCES_PATTERN, text, re.DOTALL)
477+
match = re.search(_MARKDOWN_FENCES_PATTERN, text)
478478
if match:
479479
return match.group(1)
480480

tests/test_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ def test_merge_json_schema_defs():
495495
def test_strip_markdown_fences():
496496
assert strip_markdown_fences('{"foo": "bar"}') == '{"foo": "bar"}'
497497
assert strip_markdown_fences('```json\n{"foo": "bar"}\n```') == '{"foo": "bar"}'
498-
assert strip_markdown_fences('```json\n{"foo": "bar"}') == '{"foo": "bar"}'
498+
assert strip_markdown_fences('```json\n{\n "foo": "bar"\n}') == '{\n "foo": "bar"\n}'
499499
assert (
500500
strip_markdown_fences('{"foo": "```json\\n{"foo": "bar"}\\n```"}')
501501
== '{"foo": "```json\\n{"foo": "bar"}\\n```"}'

0 commit comments

Comments
 (0)