Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34k
gh-137821: Improve Argument Clinic definitions in the _json module#140780
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| Convert ``_json`` module to use Argument Clinic. | ||
MemberAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @StanFromIreland Moved. | ||
| Patched by Yoonho Hann. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -645,7 +645,7 @@ scanstring_unicode(PyObject *pystr, Py_ssize_t end, int strict, Py_ssize_t *next | ||
| /*[clinic input] | ||
| _json.scanstring as py_scanstring | ||
| pystr: object | ||
| pystr: unicode | ||
| end: Py_ssize_t | ||
| strict: bool = True | ||
| / | ||
| @@ -664,74 +664,41 @@ after the end quote. | ||
| static PyObject * | ||
| py_scanstring_impl(PyObject *module, PyObject *pystr, Py_ssize_t end, | ||
| int strict) | ||
| /*[clinic end generated code: output=961740cfae07cdb3 input=9d46d7df7ac749b0]*/ | ||
| /*[clinic end generated code: output=961740cfae07cdb3 input=cff59e47498f4d8e]*/ | ||
| { | ||
| PyObject *rval; | ||
| Py_ssize_t next_end = -1; | ||
| if (PyUnicode_Check(pystr)){ | ||
| rval = scanstring_unicode(pystr, end, strict, &next_end); | ||
| } | ||
| else{ | ||
corona10 marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading. Please reload this page. | ||
| PyErr_Format(PyExc_TypeError, | ||
| "first argument must be a string, not %.80s", | ||
| Py_TYPE(pystr)->tp_name); | ||
| return NULL; | ||
| } | ||
| PyObject *rval = scanstring_unicode(pystr, end, strict, &next_end); | ||
| return _build_rval_index_tuple(rval, next_end); | ||
| } | ||
| /*[clinic input] | ||
| _json.encode_basestring_ascii as py_encode_basestring_ascii | ||
| pystr: object | ||
| pystr: unicode | ||
| / | ||
| Return an ASCII-only JSON representation of a Python string | ||
| [clinic start generated code]*/ | ||
| static PyObject * | ||
| py_encode_basestring_ascii(PyObject *module, PyObject *pystr) | ||
| /*[clinic end generated code: output=a8afcd88eba0b572 input=f4085ccd5928ea55]*/ | ||
| py_encode_basestring_ascii_impl(PyObject *module, PyObject *pystr) | ||
| /*[clinic end generated code: output=7b3841287cf211df input=4f3609498aff2de5]*/ | ||
| { | ||
| PyObject *rval; | ||
| /* Return an ASCII-only JSON representation of a Python string */ | ||
| /* METH_O */ | ||
| if (PyUnicode_Check(pystr)){ | ||
| rval = ascii_escape_unicode(pystr); | ||
| } | ||
| else{ | ||
| PyErr_Format(PyExc_TypeError, | ||
| "first argument must be a string, not %.80s", | ||
| Py_TYPE(pystr)->tp_name); | ||
| return NULL; | ||
| } | ||
| return rval; | ||
| return ascii_escape_unicode(pystr); | ||
| } | ||
| /*[clinic input] | ||
| _json.encode_basestring as py_encode_basestring | ||
| pystr: object | ||
| pystr: unicode | ||
| / | ||
| Return a JSON representation of a Python string | ||
| [clinic start generated code]*/ | ||
| static PyObject * | ||
| py_encode_basestring(PyObject *module, PyObject *pystr) | ||
| /*[clinic end generated code: output=c87752300776d3b1 input=c3c7ef6e72624f6e]*/ | ||
| py_encode_basestring_impl(PyObject *module, PyObject *pystr) | ||
| /*[clinic end generated code: output=900950f95df3f1c9 input=d42ef714b2c07386]*/ | ||
| { | ||
| PyObject *rval; | ||
| /* Return a JSON representation of a Python string */ | ||
| /* METH_O */ | ||
| if (PyUnicode_Check(pystr)){ | ||
| rval = escape_unicode(pystr); | ||
| } | ||
| else{ | ||
| PyErr_Format(PyExc_TypeError, | ||
| "first argument must be a string, not %.80s", | ||
| Py_TYPE(pystr)->tp_name); | ||
| return NULL; | ||
| } | ||
| return rval; | ||
| return escape_unicode(pystr); | ||
| } | ||
| static void | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was wrongly tested.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See: