Author: Richard Plangger <planri...@gmail.com> Branch: Changeset: r90392:610a99f1638f Date: 2017-02-27 14:03 +0100 http://bitbucket.org/pypy/pypy/changeset/610a99f1638f/
Log: add use autodoc for text_w diff --git a/pypy/doc/conf.py b/pypy/doc/conf.py --- a/pypy/doc/conf.py +++ b/pypy/doc/conf.py @@ -17,6 +17,7 @@ # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. sys.path.append(os.path.abspath('.')) +sys.path.append(os.path.abspath('../../')) # -- Read The Docs theme config ------------------------------------------------ diff --git a/pypy/doc/objspace.rst b/pypy/doc/objspace.rst --- a/pypy/doc/objspace.rst +++ b/pypy/doc/objspace.rst @@ -291,10 +291,7 @@ If :py:obj:`w_x` is an application-level integer or long, return an interpreter-level :py:class:`rbigint`. Otherwise raise :py:exc:`TypeError`. -.. py:function:: text_w(w_x) - - Takes an application level :py:class:`str` and converts it to a rpython byte string. - PyPy3 this method will return an utf-8-nosg encoded result. +.. automethod:: pypy.interpreter.baseobjspace.ObjSpace.text_w(w_x) .. py:function:: bytes_w(w_x) diff --git a/pypy/interpreter/baseobjspace.py b/pypy/interpreter/baseobjspace.py --- a/pypy/interpreter/baseobjspace.py +++ b/pypy/interpreter/baseobjspace.py @@ -1613,8 +1613,14 @@ return w_obj.str_w(self) def text_w(self, w_obj): - """Takes a string object (unicode in Python 3) and returns an - unwrapped RPython bytestring.""" + """ PyPy2 takes either a :py:class:`str` and returns a + rpython byte string, or it takes an :py:class:`unicode` + and uses the systems default encoding to return a rpython + byte string. + + On PyPy3 it takes a :py:class:`str` and it will return + an utf-8 encoded rpython string. + """ return w_obj.str_w(self) @not_rpython # tests only; should be replaced with bytes_w or text_w _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit