gh-156821: Fix inaccuracies in the xml.parsers.expat documentation - #156822
Conversation
…ion and docstrings GetInputContext() returns bytes, not a string, and its result extends to the end of the buffered input. Parse() accepts a bytes-like object as well as a string, and ignores the encoding declaration for a string. ParseFile() only supports binary files. XML_ERROR_XML_DECL was described as XML_ERROR_NO_ELEMENTS. UnparsedEntityDeclHandler is not restricted to Expat 1.2. GetSpecifiedAttributeCount() is only meaningful if ordered_attributes is true. Document the intern parameter of ParserCreate(), the intern and namespace_prefixes attributes, the SkippedEntityHandler handler, the XML_CTYPE_MIXED and XML_CTYPE_NAME content model types, and the EXPAT_VERSION, version_info and features data items, which describe the Expat library loaded by the interpreter. Remove obsolete notes about Expat versions 1.2 and 1.95.0, complete the list of attribute types in AttlistDeclHandler, and remove :noindex: from the content model constants, which have no other description and were therefore not referenceable.
Documentation build overview
|
|
Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14, 3.15. |
|
Sorry, @serhiy-storchaka, I could not cleanly backport this to |
|
Sorry, @serhiy-storchaka, I could not cleanly backport this to |
|
Sorry, @serhiy-storchaka, I could not cleanly backport this to |
…umentation (pythonGH-156822) Corrected, in the documentation and in the docstrings: * GetInputContext() returns bytes, and its result extends to the end of the buffered input; * Parse() accepts a bytes-like object as well as a string, and ignores the encoding declaration for a string; * ParseFile() only supports binary files; * XML_ERROR_XML_DECL was described as XML_ERROR_NO_ELEMENTS; * UnparsedEntityDeclHandler is not restricted to Expat 1.2; * GetSpecifiedAttributeCount() needs ordered_attributes. Documented the intern parameter and attribute, namespace_prefixes, SkippedEntityHandler, XML_CTYPE_MIXED and XML_CTYPE_NAME, and EXPAT_VERSION, version_info and features. Removed obsolete notes about Expat 1.2 and 1.95.0, and :noindex: from the content model constants, which are not documented elsewhere; completed the list of attribute types in AttlistDeclHandler. (cherry picked from commit d16a691) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
|
GH-156852 is a backport of this pull request to the 3.15 branch. |
|
GH-156853 is a backport of this pull request to the 3.14 branch. |
|
GH-156854 is a backport of this pull request to the 3.13 branch. |
…tion (GH-156822) (GH-156854) Corrected, in the documentation and in the docstrings: * GetInputContext() returns bytes, and its result extends to the end of the buffered input; * Parse() accepts a bytes-like object as well as a string, and ignores the encoding declaration for a string; * ParseFile() only supports binary files; * XML_ERROR_XML_DECL was described as XML_ERROR_NO_ELEMENTS; * UnparsedEntityDeclHandler is not restricted to Expat 1.2; * GetSpecifiedAttributeCount() needs ordered_attributes. Documented the intern parameter and attribute, namespace_prefixes, SkippedEntityHandler, XML_CTYPE_MIXED and XML_CTYPE_NAME, and EXPAT_VERSION, version_info and features. Removed obsolete notes about Expat 1.2 and 1.95.0, and :noindex: from the content model constants, which are not documented elsewhere; completed the list of attribute types in AttlistDeclHandler. (cherry picked from commit d16a691)
…tion (GH-156822) (GH-156853) Corrected, in the documentation and in the docstrings: * GetInputContext() returns bytes, and its result extends to the end of the buffered input; * Parse() accepts a bytes-like object as well as a string, and ignores the encoding declaration for a string; * ParseFile() only supports binary files; * XML_ERROR_XML_DECL was described as XML_ERROR_NO_ELEMENTS; * UnparsedEntityDeclHandler is not restricted to Expat 1.2; * GetSpecifiedAttributeCount() needs ordered_attributes. Documented the intern parameter and attribute, namespace_prefixes, SkippedEntityHandler, XML_CTYPE_MIXED and XML_CTYPE_NAME, and EXPAT_VERSION, version_info and features. Removed obsolete notes about Expat 1.2 and 1.95.0, and :noindex: from the content model constants, which are not documented elsewhere; completed the list of attribute types in AttlistDeclHandler. (cherry picked from commit d16a691)
Fix statements which do not match the behaviour: the type and the extent of the result of
GetInputContext(), the types accepted byParse()andParseFile(), the description ofXML_ERROR_XML_DECL, and the Expat version required forUnparsedEntityDeclHandler. The docstrings are corrected too.Document the intern parameter of
ParserCreate(), theinternandnamespace_prefixesattributes,SkippedEntityHandler,XML_CTYPE_MIXEDandXML_CTYPE_NAME, and theEXPAT_VERSION,version_infoandfeaturesdata items.Remove obsolete notes about Expat 1.2 and 1.95.0, complete the list of attribute types in
AttlistDeclHandler, and remove:noindex:from the content model constants, which have no other description and were therefore not referenceable.This also fixes gh-60930.