Skip to content

Conversation

sethmlarson
Copy link
Contributor

@sethmlarson sethmlarson commented Oct 1, 2025

@picnixz
Copy link
Member

picnixz commented Oct 1, 2025

My comment got hidden because of the resolved conversation:

Also, I would instead put the warning after the class description (before the versionchanged). The rationale is that when reading the warning box, we still don't know what this class do.

@sethmlarson
Copy link
Contributor Author

Thanks for the suggestion @picnixz, I've moved the warning in 4b4c15a

@sethmlarson
Copy link
Contributor Author

@serhiy-storchaka I changed the warning to a note about intended usage here: cbe0c12 please take a look.

Comment on lines +76 to +77
with SAX parser functions from the :mod:`!xml.sax` module. Using XMLGenerator
on untrusted user inputs is not the intended use.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
with SAX parser functions from the :mod:`!xml.sax` module. Using XMLGenerator
on untrusted user inputs is not the intended use.
with SAX parser functions from the :mod:`!xml.sax` module. Using
:class:`!XMLGenerator` on untrusted user inputs is not the intended use.

.. note::
:class:`!XMLGenerator` is only intended to be used as a ``handler``
with SAX parser functions from the :mod:`!xml.sax` module. Using XMLGenerator
on untrusted user inputs is not the intended use.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"is only intended to be used": Ok, but what are the consequences if the class is misused? It's unclear to me what are the risks.

Comment on lines +75 to +77
:class:`!XMLGenerator` is only intended to be used as a ``handler``
with SAX parser functions from the :mod:`!xml.sax` module. Using XMLGenerator
on untrusted user inputs is not the intended use.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this form it simply reiterates what was said in the previous paragraph.

Even if this was not intended, people use XMLGenerator for generating XML. If it worked for them, it is fine. They should be aware about pitfalls. But I suggest adding such notes/warnings in other places that are used to generate XML first or simultaneously with XMLGenerator. They all should use unified wording. We can keep a short reminder that this is not intended use of XMLGenerator, the rest of the note should be similar to other notes.

I propose also to add helpers to validate names (#139489). Since this is a new feature, we cannot refer it the documentation changes that will be backported, but keep in mind that we can add references later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting merge docs Documentation in the Doc dir
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

6 participants