diff options
author | Jacob Walls <jacobtylerwalls@gmail.com> | 2022-02-12 08:27:02 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-12 08:27:02 (GMT) |
commit | 168fd6453b5de15236116f9261d64601d92571ac (patch) | |
tree | 07a6d937d29cb21781520e2b8cba5f09492ce955 /Modules | |
parent | 9d9cfd61ec3cbe84dbc25c74f664877f3d02b8ef (diff) | |
download | cpython-168fd6453b5de15236116f9261d64601d92571ac.zip cpython-168fd6453b5de15236116f9261d64601d92571ac.tar.gz cpython-168fd6453b5de15236116f9261d64601d92571ac.tar.bz2 |
bpo-45948: Remove constructor discrepancy in C version of ElementTree.XMLParser (GH-31152)
Both implementations accept target=None now.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_elementtree.c | 6 | ||||
-rw-r--r-- | Modules/clinic/_elementtree.c.h | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c index f155dc7..f54c284 100644 --- a/Modules/_elementtree.c +++ b/Modules/_elementtree.c @@ -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); diff --git a/Modules/clinic/_elementtree.c.h b/Modules/clinic/_elementtree.c.h index 2c9ba47..5ed5a6c 100644 --- a/Modules/clinic/_elementtree.c.h +++ b/Modules/clinic/_elementtree.c.h @@ -807,7 +807,7 @@ _elementtree_XMLParser___init__(PyObject *self, PyObject *args, PyObject *kwargs PyObject * const *fastargs; Py_ssize_t nargs = PyTuple_GET_SIZE(args); Py_ssize_t noptargs = nargs + (kwargs ? PyDict_GET_SIZE(kwargs) : 0) - 0; - PyObject *target = NULL; + PyObject *target = Py_None; const char *encoding = NULL; fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 0, 0, 0, argsbuf); @@ -915,4 +915,4 @@ skip_optional: exit: return return_value; } -/*[clinic end generated code: output=1385b5e5688f3614 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=992733cfc7390590 input=a9049054013a1b77]*/ |