Skip to content

Commit

Permalink
bpo-36101: remove non-ascii characters in docstring (pythonGH-12018)
Browse files Browse the repository at this point in the history
* remove non-ascii characters in docstring
* clinic.py emits a warning when docstring has non-ascii character
  • Loading branch information
animalize authored and methane committed Feb 24, 2019
1 parent 9e456bc commit 463572c
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 11 deletions.
8 changes: 4 additions & 4 deletions Modules/_curses_panel.c
Original file line number Diff line number Diff line change
Expand Up @@ -412,12 +412,12 @@ _curses_panel.panel.set_userptr
obj: object
/
Set the panels user pointer to obj.
Set the panel's user pointer to obj.
[clinic start generated code]*/

static PyObject *
_curses_panel_panel_set_userptr(PyCursesPanelObject *self, PyObject *obj)
/*[clinic end generated code: output=6fb145b3af88cf4a input=2056be1cd148b05c]*/
/*[clinic end generated code: output=6fb145b3af88cf4a input=d2c6a9dbefabbf39]*/
{
PyObject *oldobj;
int rc;
Expand Down Expand Up @@ -587,12 +587,12 @@ _curses_panel.update_panels
Updates the virtual screen after changes in the panel stack.
This does not call curses.doupdate(), so youll have to do this yourself.
This does not call curses.doupdate(), so you'll have to do this yourself.
[clinic start generated code]*/

static PyObject *
_curses_panel_update_panels_impl(PyObject *module)
/*[clinic end generated code: output=2f3b4c2e03d90ded input=a127069202b0a097]*/
/*[clinic end generated code: output=2f3b4c2e03d90ded input=5299624c9a708621]*/
{
PyCursesInitialised;
update_panels();
Expand Down
6 changes: 3 additions & 3 deletions Modules/clinic/_curses_panel.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Python/clinic/context.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Python/context.c
Original file line number Diff line number Diff line change
Expand Up @@ -592,12 +592,12 @@ _contextvars_Context_keys_impl(PyContext *self)
/*[clinic input]
_contextvars.Context.values
Return a list of all variables values in the context object.
Return a list of all variables' values in the context object.
[clinic start generated code]*/

static PyObject *
_contextvars_Context_values_impl(PyContext *self)
/*[clinic end generated code: output=d286dabfc8db6dde input=6c3d08639ba3bf67]*/
/*[clinic end generated code: output=d286dabfc8db6dde input=ce8075d04a6ea526]*/
{
return _PyHamt_NewIterValues(self->ctx_vars);
}
Expand Down
3 changes: 3 additions & 0 deletions Tools/clinic/clinic.py
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,9 @@ def render(self, clinic, signatures):
return self.render_function(clinic, function)

def docstring_for_c_string(self, f):
if re.search(r'[^\x00-\x7F]', f.docstring):
warn("Non-ascii character appear in docstring.")

text, add, output = _text_accumulator()
# turn docstring into a properly quoted C string
for line in f.docstring.split('\n'):
Expand Down

0 comments on commit 463572c

Please sign in to comment.