René's URL Explorer Experiment


Title: Paragraph.text setter silently detaches comments (and footnote references) added with 1.2 comment support · Issue #1604 · python-openxml/python-docx · GitHub

Open Graph Title: Paragraph.text setter silently detaches comments (and footnote references) added with 1.2 comment support · Issue #1604 · python-openxml/python-docx

X Title: Paragraph.text setter silently detaches comments (and footnote references) added with 1.2 comment support · Issue #1604 · python-openxml/python-docx

Description: Since 1.2 added Document.add_comment(), assigning paragraph.text removes the comment's anchor without any indication. Paragraph.clear() drops every child except w:pPr, which includes w:commentRangeStart / w:commentRangeEnd (these are par...

Open Graph Description: Since 1.2 added Document.add_comment(), assigning paragraph.text removes the comment's anchor without any indication. Paragraph.clear() drops every child except w:pPr, which includes w:commentRange...

X Description: Since 1.2 added Document.add_comment(), assigning paragraph.text removes the comment's anchor without any indication. Paragraph.clear() drops every child except w:pPr, which includes w:commentR...

Opengraph URL: https://github.com/python-openxml/python-docx/issues/1604

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Paragraph.text setter silently detaches comments (and footnote references) added with 1.2 comment support","articleBody":"Since 1.2 added `Document.add_comment()`, assigning `paragraph.text` removes the comment's anchor without any indication. `Paragraph.clear()` drops every child except `w:pPr`, which includes `w:commentRangeStart` / `w:commentRangeEnd` (these are paragraph children, not runs) and the run holding `w:commentReference`. The `\u003cw:comment>` stays in `comments.xml`, anchored to nothing. Word opens the file with no warning and just doesn't show the comment.\n\nSelf-contained repro, python-docx 1.2.0:\n\n    from docx import Document\n    import zipfile, re\n\n    d = Document()\n    p = d.add_paragraph(\"The fee is EUR 12,000 per milestone.\")\n    d.add_comment(runs=p.runs[0], text=\"Confirm this figure before circulation\", author=\"Reviewer\")\n    d.save(\"before.docx\")\n\n    d = Document(\"before.docx\")\n    d.paragraphs[0].text = \"The fee is EUR 14,000 per milestone.\"\n    d.save(\"after.docx\")\n\n    for f in (\"before.docx\", \"after.docx\"):\n        z = zipfile.ZipFile(f)\n        doc = z.read(\"word/document.xml\").decode()\n        cm = z.read(\"word/comments.xml\").decode()\n        print(f, len(re.findall(r\"commentRange(Start|End)|commentReference\", doc)),\n              \"markers,\", len(re.findall(r\"\u003cw:comment \", cm)), \"comments\")\n\n    # before.docx 3 markers, 1 comments\n    # after.docx  0 markers, 1 comments\n\nThe same happens to `w:footnoteReference` (the footnote body survives in `footnotes.xml`, the reference in the text is gone) and to any `w:ins`/`w:del` wrapping the runs. Probably related to #1519, which reports comments disappearing on save without a repro — I suspect this is the mechanism.\n\nI understand `.text = ...` is documented as replacing the paragraph's content, and that preserving markers across an arbitrary text replacement is not well-defined. But this is the first thing every code sample and every LLM agent reaches for, and the failure is invisible. Options, from small to large:\n\n1. Keep `w:commentRangeStart`/`w:commentRangeEnd` in `clear()` (they are not content), and re-emit `w:commentReference` for each surviving range at the end of the new run. The comment then anchors to the whole new text, which is what Word does when you retype a commented passage.\n2. At minimum, a warning in the `text` setter docstring and in the comments section of the docs that setting text removes comment anchors, footnote references and tracked-change markup in that paragraph.\n3. Emit a `warnings.warn` when `clear()` is about to drop a comment range or footnote reference.\n\nHappy to open a PR for (1) or (2) if either is acceptable. Found while measuring what verification steps catch on agent-edited documents (github.com/Dmitry-Kov/ooxml-integrity).\n\npython-docx 1.2.0, Python 3.9.6, macOS","author":{"url":"https://github.com/Dmitry-Kov","@type":"Person","name":"Dmitry-Kov"},"datePublished":"2026-09-07T14:43:12Z","url":"https://github.com/python-openxml/python-docx/issues/1604"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:a9975437-3f84-3b82-1678-6474aff29104
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id8A26:4D728:797FD0:8B1219:6AFF6390
html-safe-nonce2d789bc966af8d4ef873e3c93f226a59f529530d96c6ac60fbd501f8bff7ea8a
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4QTI2OjRENzI4Ojc5N0ZEMDo4QjEyMTk6NkFGRjYzOTAiLCJ2aXNpdG9yX2lkIjoiNTI2MDU2MzU0MTc5MzkyMzk4NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac00b76fc7de3a790c0a611aece26b361c5ab33f21bf38c763e460c2f31a84260d
hovercard-subject-tagissue:5376129790
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python-openxml/python-docx/1604/issue_layout
twitter:imagehttps://opengraph.githubassets.com/bff209254feabc238cf43a1c10b59562207cb57347ff5e381c735e71c7b20db1/python-openxml/python-docx/issues/1604
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/bff209254feabc238cf43a1c10b59562207cb57347ff5e381c735e71c7b20db1/python-openxml/python-docx/issues/1604
og:image:altSince 1.2 added Document.add_comment(), assigning paragraph.text removes the comment's anchor without any indication. Paragraph.clear() drops every child except w:pPr, which includes w:commentRange...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameDmitry-Kov
hostnamegithub.com
expected-hostnamegithub.com
None41b58589a1c4eda1e3c8904144a412b88ca4455f63ca2ad3629f2e9f3c3a1d12
turbo-cache-controlno-preview
go-importgithub.com/python-openxml/python-docx git https://github.com/python-openxml/python-docx.git
octolytics-dimension-user_id3403760
octolytics-dimension-user_loginpython-openxml
octolytics-dimension-repository_id13592924
octolytics-dimension-repository_nwopython-openxml/python-docx
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id13592924
octolytics-dimension-repository_network_root_nwopython-openxml/python-docx
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release8968d6d6acc65d74e4df332d23932dd3fd0502a4
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/python-openxml/python-docx/issues/1604#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython-openxml%2Fpython-docx%2Fissues%2F1604
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython-openxml%2Fpython-docx%2Fissues%2F1604
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=python-openxml%2Fpython-docx
Reloadhttps://github.com/python-openxml/python-docx/issues/1604
Reloadhttps://github.com/python-openxml/python-docx/issues/1604
Reloadhttps://github.com/python-openxml/python-docx/issues/1604
python-openxmlhttps://github.com/python-openxml
python-docxhttps://github.com/python-openxml/python-docx
Codehttps://github.com/python-openxml/python-docx
Issues387 (387)https://github.com/python-openxml/python-docx/issues
Pull requests167 (167)https://github.com/python-openxml/python-docx/pulls
Actionshttps://github.com/python-openxml/python-docx/actions
Projectshttps://github.com/python-openxml/python-docx/projects
Wikihttps://github.com/python-openxml/python-docx/wiki
Security and qualityhttps://github.com/python-openxml/python-docx/security
Insightshttps://github.com/python-openxml/python-docx/insights
https://github.com/python-openxml/python-docx
New issuehttps://github.com/login?return_to=https://github.com/python-openxml/python-docx/issues/1604
New issuehttps://github.com/login?return_to=https://github.com/python-openxml/python-docx/issues/1604
Paragraph.text setter silently detaches comments (and footnote references) added with 1.2 comment supporthttps://github.com/python-openxml/python-docx/issues/1604#top
https://github.com/Dmitry-Kov
Dmitry-Kovhttps://github.com/Dmitry-Kov
on Sep 7, 2026https://github.com/python-openxml/python-docx/issues/1604#issue-5376129790
#1519https://github.com/python-openxml/python-docx/issues/1519
Sign up for freehttps://github.com/signup?return_to=https://github.com/python-openxml/python-docx/issues/1604
Sign in to commenthttps://github.com/login?return_to=https://github.com/python-openxml/python-docx/issues/1604
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.