| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 91aaeac commit 0b68a2d
10 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -52,19 +52,19 @@ and *NULL* returned. | |||
| 52 | 52 | ||
| 53 | 53 | .. c:function:: PyObject* PyCodec_IncrementalEncoder(const char *encoding, const char *errors) | |
| 54 | 54 | ||
| 55 | - Get an :class:`IncrementalEncoder` object for the given *encoding*. | ||
| 55 | + Get an :class:`~codecs.IncrementalEncoder` object for the given *encoding*. | ||
| 56 | 56 | ||
| 57 | 57 | .. c:function:: PyObject* PyCodec_IncrementalDecoder(const char *encoding, const char *errors) | |
| 58 | 58 | ||
| 59 | - Get an :class:`IncrementalDecoder` object for the given *encoding*. | ||
| 59 | + Get an :class:`~codecs.IncrementalDecoder` object for the given *encoding*. | ||
| 60 | 60 | ||
| 61 | 61 | .. c:function:: PyObject* PyCodec_StreamReader(const char *encoding, PyObject *stream, const char *errors) | |
| 62 | 62 | ||
| 63 | - Get a :class:`StreamReader` factory function for the given *encoding*. | ||
| 63 | + Get a :class:`~codecs.StreamReader` factory function for the given *encoding*. | ||
| 64 | 64 | ||
| 65 | 65 | .. c:function:: PyObject* PyCodec_StreamWriter(const char *encoding, PyObject *stream, const char *errors) | |
| 66 | 66 | ||
| 67 | - Get a :class:`StreamWriter` factory function for the given *encoding*. | ||
| 67 | + Get a :class:`~codecs.StreamWriter` factory function for the given *encoding*. | ||
| 68 | 68 | ||
| 69 | 69 | ||
| 70 | 70 | Registry API for Unicode encoding error handlers | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -40,17 +40,18 @@ the :mod:`io` APIs instead. | |||
| 40 | 40 | ||
| 41 | 41 | Return the file descriptor associated with *p* as an :c:type:`int`. If the | |
| 42 | 42 | object is an integer, its value is returned. If not, the | |
| 43 | - object's :meth:`fileno` method is called if it exists; the method must return | ||
| 44 | - an integer, which is returned as the file descriptor value. Sets an | ||
| 45 | - exception and returns ``-1`` on failure. | ||
| 43 | + object's :meth:`~io.IOBase.fileno` method is called if it exists; the | ||
| 44 | + method must return an integer, which is returned as the file descriptor | ||
| 45 | + value. Sets an exception and returns ``-1`` on failure. | ||
| 46 | 46 | ||
| 47 | 47 | ||
| 48 | 48 | .. c:function:: PyObject* PyFile_GetLine(PyObject *p, int n) | |
| 49 | 49 | ||
| 50 | 50 | .. index:: single: EOFError (built-in exception) | |
| 51 | 51 | ||
| 52 | 52 | Equivalent to ``p.readline([n])``, this function reads one line from the | |
| 53 | - object *p*. *p* may be a file object or any object with a :meth:`readline` | ||
| 53 | + object *p*. *p* may be a file object or any object with a | ||
| 54 | + :meth:`~io.IOBase.readline` | ||
| 54 | 55 | method. If *n* is ``0``, exactly one line is read, regardless of the length of | |
| 55 | 56 | the line. If *n* is greater than ``0``, no more than *n* bytes will be read | |
| 56 | 57 | from the file; a partial line can be returned. In both cases, an empty string | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -60,8 +60,8 @@ Object Protocol | |||
| 60 | 60 | Generic attribute getter function that is meant to be put into a type | |
| 61 | 61 | object's ``tp_getattro`` slot. It looks for a descriptor in the dictionary | |
| 62 | 62 | of classes in the object's MRO as well as an attribute in the object's | |
| 63 | - :attr:`__dict__` (if present). As outlined in :ref:`descriptors`, data | ||
| 64 | - descriptors take preference over instance attributes, while non-data | ||
| 63 | + :attr:`~object.__dict__` (if present). As outlined in :ref:`descriptors`, | ||
| 64 | + data descriptors take preference over instance attributes, while non-data | ||
| 65 | 65 | descriptors don't. Otherwise, an :exc:`AttributeError` is raised. | |
| 66 | 66 | ||
| 67 | 67 | ||
@@ -85,8 +85,8 @@ Object Protocol | |||
| 85 | 85 | object's ``tp_setattro`` slot. It looks for a data descriptor in the | |
| 86 | 86 | dictionary of classes in the object's MRO, and if found it takes preference | |
| 87 | 87 | over setting the attribute in the instance dictionary. Otherwise, the | |
| 88 | - attribute is set in the object's :attr:`__dict__` (if present). Otherwise, | ||
| 89 | - an :exc:`AttributeError` is raised and ``-1`` is returned. | ||
| 88 | + attribute is set in the object's :attr:`~object.__dict__` (if present). | ||
| 89 | + Otherwise, an :exc:`AttributeError` is raised and ``-1`` is returned. | ||
| 90 | 90 | ||
| 91 | 91 | ||
| 92 | 92 | .. c:function:: int PyObject_DelAttr(PyObject *o, PyObject *attr_name) | |
@@ -189,9 +189,9 @@ Object Protocol | |||
| 189 | 189 | be done against every entry in *cls*. The result will be ``1`` when at least one | |
| 190 | 190 | of the checks returns ``1``, otherwise it will be ``0``. If *inst* is not a | |
| 191 | 191 | class instance and *cls* is neither a type object, nor a class object, nor a | |
| 192 | - tuple, *inst* must have a :attr:`__class__` attribute --- the class relationship | ||
| 193 | - of the value of that attribute with *cls* will be used to determine the result | ||
| 194 | - of this function. | ||
| 192 | + tuple, *inst* must have a :attr:`~instance.__class__` attribute --- the | ||
| 193 | + class relationship of the value of that attribute with *cls* will be used | ||
| 194 | + to determine the result of this function. | ||
| 195 | 195 | ||
| 196 | 196 | ||
| 197 | 197 | Subclass determination is done in a fairly straightforward way, but includes a | |
@@ -201,9 +201,9 @@ of. If :class:`A` and :class:`B` are class objects, :class:`B` is a subclass of | |||
| 201 | 201 | either is not a class object, a more general mechanism is used to determine the | |
| 202 | 202 | class relationship of the two objects. When testing if *B* is a subclass of | |
| 203 | 203 | *A*, if *A* is *B*, :c:func:`PyObject_IsSubclass` returns true. If *A* and *B* | |
| 204 | - are different objects, *B*'s :attr:`__bases__` attribute is searched in a | ||
| 205 | - depth-first fashion for *A* --- the presence of the :attr:`__bases__` attribute | ||
| 206 | - is considered sufficient for this determination. | ||
| 204 | + are different objects, *B*'s :attr:`~class.__bases__` attribute is searched in | ||
| 205 | + a depth-first fashion for *A* --- the presence of the :attr:`~class.__bases__` | ||
| 206 | + attribute is considered sufficient for this determination. | ||
| 207 | 207 | ||
| 208 | 208 | ||
| 209 | 209 | .. c:function:: int PyObject_IsSubclass(PyObject *derived, PyObject *cls) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -140,7 +140,7 @@ subtypes but not for instances of :class:`frozenset` or its subtypes. | |||
| 140 | 140 | ||
| 141 | 141 | Return 1 if found and removed, 0 if not found (no action taken), and -1 if an | |
| 142 | 142 | error is encountered. Does not raise :exc:`KeyError` for missing keys. Raise a | |
| 143 | - :exc:`TypeError` if the *key* is unhashable. Unlike the Python :meth:`discard` | ||
| 143 | + :exc:`TypeError` if the *key* is unhashable. Unlike the Python :meth:`~set.discard` | ||
| 144 | 144 | method, this function does not automatically convert unhashable sets into | |
| 145 | 145 | temporary frozensets. Raise :exc:`PyExc_SystemError` if *set* is an not an | |
| 146 | 146 | instance of :class:`set` or its subtype. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -502,7 +502,7 @@ type objects) *must* have the :attr:`ob_size` field. | |||
| 502 | 502 | ||
| 503 | 503 | On the other hand, even if you know a member can never be part of a cycle, as a | |
| 504 | 504 | debugging aid you may want to visit it anyway just so the :mod:`gc` module's | |
| 505 | - :func:`get_referents` function will include it. | ||
| 505 | + :func:`~gc.get_referents` function will include it. | ||
| 506 | 506 | ||
| 507 | 507 | Note that :c:func:`Py_VISIT` requires the *visit* and *arg* parameters to | |
| 508 | 508 | :c:func:`local_traverse` to have these specific names; don't name them just | |
@@ -627,7 +627,7 @@ type objects) *must* have the :attr:`ob_size` field. | |||
| 627 | 627 | reference list head than the base type. Since the list head is always found via | |
| 628 | 628 | :c:member:`~PyTypeObject.tp_weaklistoffset`, this should not be a problem. | |
| 629 | 629 | ||
| 630 | - When a type defined by a class statement has no :attr:`__slots__` declaration, | ||
| 630 | + When a type defined by a class statement has no :attr:`~object.__slots__` declaration, | ||
| 631 | 631 | and none of its base types are weakly referenceable, the type is made weakly | |
| 632 | 632 | referenceable by adding a weak reference list head slot to the instance layout | |
| 633 | 633 | and setting the :c:member:`~PyTypeObject.tp_weaklistoffset` of that slot's offset. | |
@@ -817,15 +817,15 @@ type objects) *must* have the :attr:`ob_size` field. | |||
| 817 | 817 | dictionary at a difference offset than the base type. Since the dictionary is | |
| 818 | 818 | always found via :c:member:`~PyTypeObject.tp_dictoffset`, this should not be a problem. | |
| 819 | 819 | ||
| 820 | - When a type defined by a class statement has no :attr:`__slots__` declaration, | ||
| 820 | + When a type defined by a class statement has no :attr:`~object.__slots__` declaration, | ||
| 821 | 821 | and none of its base types has an instance variable dictionary, a dictionary | |
| 822 | 822 | slot is added to the instance layout and the :c:member:`~PyTypeObject.tp_dictoffset` is set to | |
| 823 | 823 | that slot's offset. | |
| 824 | 824 | ||
| 825 | 825 | When a type defined by a class statement has a :attr:`__slots__` declaration, | |
| 826 | 826 | the type inherits its :c:member:`~PyTypeObject.tp_dictoffset` from its base type. | |
| 827 | 827 | ||
| 828 | - (Adding a slot named :attr:`__dict__` to the :attr:`__slots__` declaration does | ||
| 828 | + (Adding a slot named :attr:`~object.__dict__` to the :attr:`__slots__` declaration does | ||
| 829 | 829 | not have the expected effect, it just causes confusion. Maybe this should be | |
| 830 | 830 | added as a feature just like :attr:`__weakref__` though.) | |
| 831 | 831 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -967,7 +967,7 @@ These are the generic codec APIs: | |||
| 967 | 967 | ||
| 968 | 968 | Create a Unicode object by decoding *size* bytes of the encoded string *s*. | |
| 969 | 969 | *encoding* and *errors* have the same meaning as the parameters of the same name | |
| 970 | - in the :func:`unicode` built-in function. The codec to be used is looked up | ||
| 970 | + in the :func:`str` built-in function. The codec to be used is looked up | ||
| 971 | 971 | using the Python codec registry. Return *NULL* if an exception was raised by | |
| 972 | 972 | the codec. | |
| 973 | 973 | ||
@@ -977,7 +977,7 @@ These are the generic codec APIs: | |||
| 977 | 977 | ||
| 978 | 978 | Encode a Unicode object and return the result as Python bytes object. | |
| 979 | 979 | *encoding* and *errors* have the same meaning as the parameters of the same | |
| 980 | - name in the Unicode :meth:`encode` method. The codec to be used is looked up | ||
| 980 | + name in the Unicode :meth:`~str.encode` method. The codec to be used is looked up | ||
| 981 | 981 | using the Python codec registry. Return *NULL* if an exception was raised by | |
| 982 | 982 | the codec. | |
| 983 | 983 | ||
@@ -987,7 +987,7 @@ These are the generic codec APIs: | |||
| 987 | 987 | ||
| 988 | 988 | Encode the :c:type:`Py_UNICODE` buffer *s* of the given *size* and return a Python | |
| 989 | 989 | bytes object. *encoding* and *errors* have the same meaning as the | |
| 990 | - parameters of the same name in the Unicode :meth:`encode` method. The codec | ||
| 990 | + parameters of the same name in the Unicode :meth:`~str.encode` method. The codec | ||
| 991 | 991 | to be used is looked up using the Python codec registry. Return *NULL* if an | |
| 992 | 992 | exception was raised by the codec. | |
| 993 | 993 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -283,7 +283,7 @@ the same library that the Python runtime is using. | |||
| 283 | 283 | frame *f* is executed, interpreting bytecode and executing calls as needed. | |
| 284 | 284 | The additional *throwflag* parameter can mostly be ignored - if true, then | |
| 285 | 285 | it causes an exception to immediately be thrown; this is used for the | |
| 286 | - :meth:`throw` methods of generator objects. | ||
| 286 | + :meth:`~generator.throw` methods of generator objects. | ||
| 287 | 287 | ||
| 288 | 288 | ||
| 289 | 289 | .. c:function:: int PyEval_MergeCompilerFlags(PyCompilerFlags *cf) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -58,8 +58,9 @@ distutils; this section explains building extension modules only. | |||
| 58 | 58 | It is common to pre-compute arguments to :func:`setup`, to better structure the | |
| 59 | 59 | driver script. In the example above, the\ ``ext_modules`` argument to | |
| 60 | 60 | :func:`setup` is a list of extension modules, each of which is an instance of | |
| 61 | - the :class:`Extension`. In the example, the instance defines an extension named | ||
| 62 | - ``demo`` which is build by compiling a single source file, :file:`demo.c`. | ||
| 61 | + the :class:`~distutils.extension.Extension`. In the example, the instance | ||
| 62 | + defines an extension named ``demo`` which is build by compiling a single source | ||
| 63 | + file, :file:`demo.c`. | ||
| 63 | 64 | ||
| 64 | 65 | In many cases, building an extension is more complex, since additional | |
| 65 | 66 | preprocessor defines and libraries may be needed. This is demonstrated in the | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -860,9 +860,9 @@ the cycle itself. | |||
| 860 | 860 | The cycle detector is able to detect garbage cycles and can reclaim them so long | |
| 861 | 861 | as there are no finalizers implemented in Python (:meth:`__del__` methods). | |
| 862 | 862 | When there are such finalizers, the detector exposes the cycles through the | |
| 863 | - :mod:`gc` module (specifically, the | ||
| 864 | - ``garbage`` variable in that module). The :mod:`gc` module also exposes a way | ||
| 865 | - to run the detector (the :func:`collect` function), as well as configuration | ||
| 863 | + :mod:`gc` module (specifically, the :attr:`~gc.garbage` variable in that module). | ||
| 864 | + The :mod:`gc` module also exposes a way to run the detector (the | ||
| 865 | + :func:`~gc.collect` function), as well as configuration | ||
| 866 | 866 | interfaces and the ability to disable the detector at runtime. The cycle | |
| 867 | 867 | detector is considered an optional component; though it is included by default, | |
| 868 | 868 | it can be disabled at build time using the :option:`--without-cycle-gc` option | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -137,7 +137,7 @@ This is so that Python knows how much memory to allocate when you call | |||
| 137 | 137 | If you want your type to be subclassable from Python, and your type has the same | |
| 138 | 138 | :c:member:`~PyTypeObject.tp_basicsize` as its base type, you may have problems with multiple | |
| 139 | 139 | inheritance. A Python subclass of your type will have to list your type first | |
| 140 | - in its :attr:`__bases__`, or else it will not be able to call your type's | ||
| 140 | + in its :attr:`~class.__bases__`, or else it will not be able to call your type's | ||
| 141 | 141 | :meth:`__new__` method without getting an error. You can avoid this problem by | |
| 142 | 142 | ensuring that your type has a larger value for :c:member:`~PyTypeObject.tp_basicsize` than its | |
| 143 | 143 | base type does. Most of the time, this will be true anyway, because either your | |
| Back | FazBrowse Home | New Git URL |
0 commit comments