summaryrefslogtreecommitdiffstats
path: root/Modules/clinic
diff options
context:
space:
mode:
authorDino Viehland <dinoviehland@gmail.com>2019-05-28 23:21:17 (GMT)
committerGitHub <noreply@github.com>2019-05-28 23:21:17 (GMT)
commit415406999d7c09af9f3dcacfb4578b9e97b2ce77 (patch)
tree99aba9596d3532bb75913ac7c1c8dda8aebd9f91 /Modules/clinic
parentab0716ed1ea2957396054730afbb80c1825f9786 (diff)
downloadcpython-415406999d7c09af9f3dcacfb4578b9e97b2ce77.zip
cpython-415406999d7c09af9f3dcacfb4578b9e97b2ce77.tar.gz
cpython-415406999d7c09af9f3dcacfb4578b9e97b2ce77.tar.bz2
bpo-37001: Makes symtable.symtable have parity with compile for input (#13483)
* Makes symtable.symtable have parity for accepted datatypes for source code as compile() * Add NEWS blurb
Diffstat (limited to 'Modules/clinic')
-rw-r--r--Modules/clinic/symtablemodule.c.h24
1 files changed, 6 insertions, 18 deletions
diff --git a/Modules/clinic/symtablemodule.c.h b/Modules/clinic/symtablemodule.c.h
index 73e340b..7d8b0ad 100644
--- a/Modules/clinic/symtablemodule.c.h
+++ b/Modules/clinic/symtablemodule.c.h
@@ -3,7 +3,7 @@ preserve
[clinic start generated code]*/
PyDoc_STRVAR(_symtable_symtable__doc__,
-"symtable($module, str, filename, startstr, /)\n"
+"symtable($module, source, filename, startstr, /)\n"
"--\n"
"\n"
"Return symbol and scope dictionaries used internally by compiler.");
@@ -12,33 +12,21 @@ PyDoc_STRVAR(_symtable_symtable__doc__,
{"symtable", (PyCFunction)(void(*)(void))_symtable_symtable, METH_FASTCALL, _symtable_symtable__doc__},
static PyObject *
-_symtable_symtable_impl(PyObject *module, const char *str,
+_symtable_symtable_impl(PyObject *module, PyObject *source,
PyObject *filename, const char *startstr);
static PyObject *
_symtable_symtable(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
- const char *str;
+ PyObject *source;
PyObject *filename;
const char *startstr;
if (!_PyArg_CheckPositional("symtable", nargs, 3, 3)) {
goto exit;
}
- if (!PyUnicode_Check(args[0])) {
- _PyArg_BadArgument("symtable", 1, "str", args[0]);
- goto exit;
- }
- Py_ssize_t str_length;
- str = PyUnicode_AsUTF8AndSize(args[0], &str_length);
- if (str == NULL) {
- goto exit;
- }
- if (strlen(str) != (size_t)str_length) {
- PyErr_SetString(PyExc_ValueError, "embedded null character");
- goto exit;
- }
+ source = args[0];
if (!PyUnicode_FSDecoder(args[1], &filename)) {
goto exit;
}
@@ -55,9 +43,9 @@ _symtable_symtable(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
PyErr_SetString(PyExc_ValueError, "embedded null character");
goto exit;
}
- return_value = _symtable_symtable_impl(module, str, filename, startstr);
+ return_value = _symtable_symtable_impl(module, source, filename, startstr);
exit:
return return_value;
}
-/*[clinic end generated code: output=be1cca59de019984 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=de655625eee705f4 input=a9049054013a1b77]*/