]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-36101: remove non-ascii characters in docstring (GH-12018)
authoranimalize <animalize@users.noreply.github.com>
Sun, 24 Feb 2019 23:18:48 +0000 (07:18 +0800)
committerInada Naoki <methane@users.noreply.github.com>
Sun, 24 Feb 2019 23:18:48 +0000 (08:18 +0900)
* remove non-ascii characters in docstring
* clinic.py emits a warning when docstring has non-ascii character

Modules/_curses_panel.c
Modules/clinic/_curses_panel.c.h
Python/clinic/context.c.h
Python/context.c
Tools/clinic/clinic.py

index 609718f65f15abb4cb48097fce8267bcc07db420..e7bbefd50fdf38a78e87ac4b9a439a467a51dc2b 100644 (file)
@@ -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;
@@ -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();
index ed59c3ba3984bd2a4fc8e38a169dc4151d22f88d..0df442056ea9f3c589728d3e02dcaf34a10d9072 100644 (file)
@@ -228,7 +228,7 @@ PyDoc_STRVAR(_curses_panel_panel_set_userptr__doc__,
 "set_userptr($self, obj, /)\n"
 "--\n"
 "\n"
-"Set the panels user pointer to obj.");
+"Set the panel\'s user pointer to obj.");
 
 #define _CURSES_PANEL_PANEL_SET_USERPTR_METHODDEF    \
     {"set_userptr", (PyCFunction)_curses_panel_panel_set_userptr, METH_O, _curses_panel_panel_set_userptr__doc__},
@@ -322,7 +322,7 @@ PyDoc_STRVAR(_curses_panel_update_panels__doc__,
 "\n"
 "Updates the virtual screen after changes in the panel stack.\n"
 "\n"
-"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.");
 
 #define _CURSES_PANEL_UPDATE_PANELS_METHODDEF    \
     {"update_panels", (PyCFunction)_curses_panel_update_panels, METH_NOARGS, _curses_panel_update_panels__doc__},
@@ -335,4 +335,4 @@ _curses_panel_update_panels(PyObject *module, PyObject *Py_UNUSED(ignored))
 {
     return _curses_panel_update_panels_impl(module);
 }
-/*[clinic end generated code: output=ac1f56e6c3d4cc57 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=3cc16062281b7e07 input=a9049054013a1b77]*/
index bbe19db1bd93692b3fb044c4797b963c55a5fcaa..eedfc88654b6242fdb8fa0d9cb9a7f9c7960fc24 100644 (file)
@@ -82,7 +82,7 @@ PyDoc_STRVAR(_contextvars_Context_values__doc__,
 "values($self, /)\n"
 "--\n"
 "\n"
-"Return a list of all variables values in the context object.");
+"Return a list of all variables\' values in the context object.");
 
 #define _CONTEXTVARS_CONTEXT_VALUES_METHODDEF    \
     {"values", (PyCFunction)_contextvars_Context_values, METH_NOARGS, _contextvars_Context_values__doc__},
@@ -177,4 +177,4 @@ PyDoc_STRVAR(_contextvars_ContextVar_reset__doc__,
 
 #define _CONTEXTVARS_CONTEXTVAR_RESET_METHODDEF    \
     {"reset", (PyCFunction)_contextvars_ContextVar_reset, METH_O, _contextvars_ContextVar_reset__doc__},
-/*[clinic end generated code: output=67c3a8f76b6cf4e7 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=a86b66e1516c25d4 input=a9049054013a1b77]*/
index 7531f1440bce9ec872ecee6cc212fd2fc4189add..9a50ea91a77ee3d260ed68cd61a0409fd08326fb 100644 (file)
@@ -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);
 }
index 7f435f154692e440bd85ae127cb12f6d0afed909..f4f0017c292449765410b37c80901357b060cfeb 100755 (executable)
@@ -615,6 +615,9 @@ class CLanguage(Language):
         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'):