mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +00:00
bpo-45948: Remove constructor discrepancy in C version of ElementTree.XMLParser (GH-31152)
Both implementations accept target=None now.
This commit is contained in:
parent
9d9cfd61ec
commit
168fd6453b
4 changed files with 19 additions and 5 deletions
|
|
@ -3637,7 +3637,7 @@ ignore_attribute_error(PyObject *value)
|
|||
_elementtree.XMLParser.__init__
|
||||
|
||||
*
|
||||
target: object = NULL
|
||||
target: object = None
|
||||
encoding: str(accept={str, NoneType}) = None
|
||||
|
||||
[clinic start generated code]*/
|
||||
|
|
@ -3645,7 +3645,7 @@ _elementtree.XMLParser.__init__
|
|||
static int
|
||||
_elementtree_XMLParser___init___impl(XMLParserObject *self, PyObject *target,
|
||||
const char *encoding)
|
||||
/*[clinic end generated code: output=3ae45ec6cdf344e4 input=53e35a829ae043e8]*/
|
||||
/*[clinic end generated code: output=3ae45ec6cdf344e4 input=7e716dd6e4f3e439]*/
|
||||
{
|
||||
self->entity = PyDict_New();
|
||||
if (!self->entity)
|
||||
|
|
@ -3670,7 +3670,7 @@ _elementtree_XMLParser___init___impl(XMLParserObject *self, PyObject *target,
|
|||
(unsigned long)_Py_HashSecret.expat.hashsalt);
|
||||
}
|
||||
|
||||
if (target) {
|
||||
if (target != Py_None) {
|
||||
Py_INCREF(target);
|
||||
} else {
|
||||
target = treebuilder_new(&TreeBuilder_Type, NULL, NULL);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue