summaryrefslogtreecommitdiffstats
path: root/Modules/parsermodule.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/parsermodule.c')
-rw-r--r--Modules/parsermodule.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/Modules/parsermodule.c b/Modules/parsermodule.c
index 3cdf135..2f2e045 100644
--- a/Modules/parsermodule.c
+++ b/Modules/parsermodule.c
@@ -581,8 +581,10 @@ parser_do_parse(PyObject *args, PyObject *kw, char *argspec, int type)
if (res)
((PyST_Object *)res)->st_flags.cf_flags = flags & PyCF_MASK;
}
- else
+ else {
PyParser_SetError(&err);
+ }
+ PyParser_ClearError(&err);
}
return (res);
}
@@ -3239,10 +3241,13 @@ PyInit_parser(void)
copyreg = PyImport_ImportModuleNoBlock("copyreg");
if (copyreg != NULL) {
PyObject *func, *pickler;
+ _Py_IDENTIFIER(pickle);
+ _Py_IDENTIFIER(sequence2st);
+ _Py_IDENTIFIER(_pickler);
- func = PyObject_GetAttrString(copyreg, "pickle");
- pickle_constructor = PyObject_GetAttrString(module, "sequence2st");
- pickler = PyObject_GetAttrString(module, "_pickler");
+ func = _PyObject_GetAttrId(copyreg, &PyId_pickle);
+ pickle_constructor = _PyObject_GetAttrId(module, &PyId_sequence2st);
+ pickler = _PyObject_GetAttrId(module, &PyId__pickler);
Py_XINCREF(pickle_constructor);
if ((func != NULL) && (pickle_constructor != NULL)
&& (pickler != NULL)) {