Commit e92818f5 authored by Georg Brandl's avatar Georg Brandl

Fix uses of the default role.

parent ae24e7b5
...@@ -63,8 +63,8 @@ change in future releases of Python. ...@@ -63,8 +63,8 @@ change in future releases of Python.
Return the file object associated with *p* as a :ctype:`FILE\*`. Return the file object associated with *p* as a :ctype:`FILE\*`.
If the caller will ever use the returned :ctype:`FILE\*` object while If the caller will ever use the returned :ctype:`FILE\*` object while
the GIL is released it must also call the `PyFile_IncUseCount` and the GIL is released it must also call the :cfunc:`PyFile_IncUseCount` and
`PyFile_DecUseCount` functions described below as appropriate. :cfunc:`PyFile_DecUseCount` functions described below as appropriate.
.. cfunction:: void PyFile_IncUseCount(PyFileObject \*p) .. cfunction:: void PyFile_IncUseCount(PyFileObject \*p)
...@@ -72,13 +72,13 @@ change in future releases of Python. ...@@ -72,13 +72,13 @@ change in future releases of Python.
Increments the PyFileObject's internal use count to indicate Increments the PyFileObject's internal use count to indicate
that the underlying :ctype:`FILE\*` is being used. that the underlying :ctype:`FILE\*` is being used.
This prevents Python from calling f_close() on it from another thread. This prevents Python from calling f_close() on it from another thread.
Callers of this must call `PyFile_DecUseCount` when they are Callers of this must call :cfunc:`PyFile_DecUseCount` when they are
finished with the :ctype:`FILE\*`. Otherwise the file object will finished with the :ctype:`FILE\*`. Otherwise the file object will
never be closed by Python. never be closed by Python.
The GIL must be held while calling this function. The GIL must be held while calling this function.
The suggested use is to call this after `PyFile_AsFile` just before The suggested use is to call this after :cfunc:`PyFile_AsFile` just before
you release the GIL. you release the GIL.
.. versionadded:: 2.6 .. versionadded:: 2.6
...@@ -88,7 +88,7 @@ change in future releases of Python. ...@@ -88,7 +88,7 @@ change in future releases of Python.
Decrements the PyFileObject's internal unlocked_count member to Decrements the PyFileObject's internal unlocked_count member to
indicate that the caller is done with its own use of the :ctype:`FILE\*`. indicate that the caller is done with its own use of the :ctype:`FILE\*`.
This may only be called to undo a prior call to `PyFile_IncUseCount`. This may only be called to undo a prior call to :cfunc:`PyFile_IncUseCount`.
The GIL must be held while calling this function. The GIL must be held while calling this function.
......
...@@ -35,9 +35,9 @@ uploaded file using GPG (GNU Privacy Guard). The :program:`gpg` program must ...@@ -35,9 +35,9 @@ uploaded file using GPG (GNU Privacy Guard). The :program:`gpg` program must
be available for execution on the system :envvar:`PATH`. You can also specify be available for execution on the system :envvar:`PATH`. You can also specify
which key to use for signing using the :option:`--identity=*name*` option. which key to use for signing using the :option:`--identity=*name*` option.
Other :command:`upload` options include :option:`--repository=*url*` Other :command:`upload` options include :option:`--repository=<url>` or
or :option:`--repository=*section*` where `url` is the url of the server :option:`--repository=<section>` where *url* is the url of the server and
and `section` the name of the section in :file:`$HOME/.pypirc`, and *section* the name of the section in :file:`$HOME/.pypirc`, and
:option:`--show-response` (which displays the full response text from the PyPI :option:`--show-response` (which displays the full response text from the PyPI
server for help in debugging upload problems). server for help in debugging upload problems).
...@@ -599,7 +599,7 @@ units as well as normal text: ...@@ -599,7 +599,7 @@ units as well as normal text:
Example:: Example::
.. versionadded:: 2.5 .. versionadded:: 2.5
The `spam` parameter. The *spam* parameter.
Note that there must be no blank line between the directive head and the Note that there must be no blank line between the directive head and the
explanation; this is to make these blocks visually continuous in the markup. explanation; this is to make these blocks visually continuous in the markup.
...@@ -760,7 +760,7 @@ the definition of the symbol. There is this directive: ...@@ -760,7 +760,7 @@ the definition of the symbol. There is this directive:
Blank lines are not allowed within ``productionlist`` directive arguments. Blank lines are not allowed within ``productionlist`` directive arguments.
The definition can contain token names which are marked as interpreted text The definition can contain token names which are marked as interpreted text
(e.g. ``sum ::= `integer` "+" `integer```) -- this generates cross-references (e.g. ``unaryneg ::= "-" `integer```) -- this generates cross-references
to the productions of these tokens. to the productions of these tokens.
Note that no further reST parsing is done in the production, so that you Note that no further reST parsing is done in the production, so that you
......
...@@ -191,7 +191,7 @@ and classes for traversing abstract syntax trees: ...@@ -191,7 +191,7 @@ and classes for traversing abstract syntax trees:
A node visitor base class that walks the abstract syntax tree and calls a A node visitor base class that walks the abstract syntax tree and calls a
visitor function for every node found. This function may return a value visitor function for every node found. This function may return a value
which is forwarded by the `visit` method. which is forwarded by the :meth:`visit` method.
This class is meant to be subclassed, with the subclass adding visitor This class is meant to be subclassed, with the subclass adding visitor
methods. methods.
...@@ -220,11 +220,11 @@ and classes for traversing abstract syntax trees: ...@@ -220,11 +220,11 @@ and classes for traversing abstract syntax trees:
A :class:`NodeVisitor` subclass that walks the abstract syntax tree and A :class:`NodeVisitor` subclass that walks the abstract syntax tree and
allows modification of nodes. allows modification of nodes.
The `NodeTransformer` will walk the AST and use the return value of the The :class:`NodeTransformer` will walk the AST and use the return value of
visitor methods to replace or remove the old node. If the return value of the visitor methods to replace or remove the old node. If the return value
the visitor method is ``None``, the node will be removed from its location, of the visitor method is ``None``, the node will be removed from its
otherwise it is replaced with the return value. The return value may be the location, otherwise it is replaced with the return value. The return value
original node in which case no replacement takes place. may be the original node in which case no replacement takes place.
Here is an example transformer that rewrites all occurrences of name lookups Here is an example transformer that rewrites all occurrences of name lookups
(``foo``) to ``data['foo']``:: (``foo``) to ``data['foo']``::
......
...@@ -11,9 +11,9 @@ ...@@ -11,9 +11,9 @@
.. note:: .. note::
The :mod:`ConfigParser` module has been renamed to `configparser` in Python The :mod:`ConfigParser` module has been renamed to :mod:`configparser` in
3.0. The :term:`2to3` tool will automatically adapt imports when converting Python 3.0. The :term:`2to3` tool will automatically adapt imports when
your sources to 3.0. converting your sources to 3.0.
.. index:: .. index::
pair: .ini; file pair: .ini; file
......
...@@ -1378,24 +1378,22 @@ it. ...@@ -1378,24 +1378,22 @@ it.
The *mode* parameter can be used to specify how the library is loaded. For The *mode* parameter can be used to specify how the library is loaded. For
details, consult the ``dlopen(3)`` manpage, on Windows, *mode* is ignored. details, consult the ``dlopen(3)`` manpage, on Windows, *mode* is ignored.
The *use_errno* parameter, when set to True, enables a ctypes The *use_errno* parameter, when set to True, enables a ctypes mechanism that
mechanism that allows to access the system `errno` error number in a allows to access the system :data:`errno` error number in a safe way.
safe way. `ctypes` maintains a thread-local copy of the systems :mod:`ctypes` maintains a thread-local copy of the systems :data:`errno`
`errno` variable; if you call foreign functions created with variable; if you call foreign functions created with ``use_errno=True`` then the
`use_errno=True` then the `errno` value before the function call is :data:`errno` value before the function call is swapped with the ctypes private
swapped with the ctypes private copy, the same happens immediately copy, the same happens immediately after the function call.
after the function call.
The function :func:`ctypes.get_errno` returns the value of the ctypes private
The function `ctypes.get_errno()` returns the value of the ctypes copy, and the function :func:`ctypes.set_errno` changes the ctypes private copy
private copy, and the function `ctypes.set_errno(value)` changes the to a new value and returns the former value.
ctypes private copy to `value` and returns the former value.
The *use_last_error* parameter, when set to True, enables the same mechanism for
The *use_last_error* parameter, when set to True, enables the same the Windows error code which is managed by the :func:`GetLastError` and
mechanism for the Windows error code which is managed by the :func:`SetLastError` Windows API functions; :func:`ctypes.get_last_error` and
:func:`GetLastError` and :func:`SetLastError` Windows API functions; :func:`ctypes.set_last_error` are used to request and change the ctypes private
`ctypes.get_last_error()` and `ctypes.set_last_error(value)` are used copy of the windows error code.
to request and change the ctypes private copy of the windows error
code.
.. versionadded:: 2.6 .. versionadded:: 2.6
The ``use_last_error`` and ``use_errno`` optional parameters The ``use_last_error`` and ``use_errno`` optional parameters
...@@ -1602,22 +1600,23 @@ type and the argument types of the function. ...@@ -1602,22 +1600,23 @@ type and the argument types of the function.
.. function:: CFUNCTYPE(restype, *argtypes, use_errno=False, use_last_error=False) .. function:: CFUNCTYPE(restype, *argtypes, use_errno=False, use_last_error=False)
The returned function prototype creates functions that use the standard C The returned function prototype creates functions that use the standard C
calling convention. The function will release the GIL during the call. calling convention. The function will release the GIL during the call. If
If `use_errno` is set to True, the ctypes private copy of the system `errno` *use_errno* is set to True, the ctypes private copy of the system
variable is exchanged with the real `errno` value bafore and after the call; :data:`errno` variable is exchanged with the real :data:`errno` value bafore
`use_last_error` does the same for the Windows error code. and after the call; *use_last_error* does the same for the Windows error
code.
.. versionchanged:: 2.6 .. versionchanged:: 2.6
The optional `use_errno` and `use_last_error` parameters were The optional *use_errno* and *use_last_error* parameters were added.
added.
.. function:: WINFUNCTYPE(restype, *argtypes, use_errno=False, use_last_error=False) .. function:: WINFUNCTYPE(restype, *argtypes, use_errno=False, use_last_error=False)
Windows only: The returned function prototype creates functions that use the Windows only: The returned function prototype creates functions that use the
``stdcall`` calling convention, except on Windows CE where :func:`WINFUNCTYPE` ``stdcall`` calling convention, except on Windows CE where
is the same as :func:`CFUNCTYPE`. The function will release the GIL during the :func:`WINFUNCTYPE` is the same as :func:`CFUNCTYPE`. The function will
call. `use_errno` and `use_last_error` have the same meaning as above. release the GIL during the call. *use_errno* and *use_last_error* have the
same meaning as above.
.. function:: PYFUNCTYPE(restype, *argtypes) .. function:: PYFUNCTYPE(restype, *argtypes)
...@@ -1864,10 +1863,10 @@ Utility functions ...@@ -1864,10 +1863,10 @@ Utility functions
.. function:: find_library(name) .. function:: find_library(name)
:module: ctypes.util :module: ctypes.util
Try to find a library and return a pathname. `name` is the library name without Try to find a library and return a pathname. *name* is the library name
any prefix like `lib`, suffix like ``.so``, ``.dylib`` or version number (this without any prefix like ``lib```, suffix like ``.so``, ``.dylib`` or version
is the form used for the posix linker option :option:`-l`). If no library can number (this is the form used for the posix linker option :option:`-l`). If
be found, returns ``None``. no library can be found, returns ``None``.
The exact functionality is system dependent. The exact functionality is system dependent.
...@@ -1905,14 +1904,14 @@ Utility functions ...@@ -1905,14 +1904,14 @@ Utility functions
.. function:: get_errno() .. function:: get_errno()
Returns the current value of the ctypes-private copy of the system Returns the current value of the ctypes-private copy of the system
`errno` variable in the calling thread. :data:`errno` variable in the calling thread.
.. versionadded:: 2.6 .. versionadded:: 2.6
.. function:: get_last_error() .. function:: get_last_error()
Windows only: returns the current value of the ctypes-private copy of the system Windows only: returns the current value of the ctypes-private copy of the system
`LastError` variable in the calling thread. :data:`LastError` variable in the calling thread.
.. versionadded:: 2.6 .. versionadded:: 2.6
...@@ -1969,17 +1968,16 @@ Utility functions ...@@ -1969,17 +1968,16 @@ Utility functions
.. function:: set_errno(value) .. function:: set_errno(value)
Set the current value of the ctypes-private copy of the system Set the current value of the ctypes-private copy of the system :data:`errno`
`errno` variable in the calling thread to `value` and return the variable in the calling thread to *value* and return the previous value.
previous value.
.. versionadded:: 2.6 .. versionadded:: 2.6
.. function:: set_last_error(value) .. function:: set_last_error(value)
Windows only: set the current value of the ctypes-private copy of Windows only: set the current value of the ctypes-private copy of the system
the system `LastError` variable in the calling thread to `value` :data:`LastError` variable in the calling thread to *value* and return the
and return the previous value. previous value.
.. versionadded:: 2.6 .. versionadded:: 2.6
......
...@@ -1211,7 +1211,7 @@ In addition to the three supplied contexts, new contexts can be created with the ...@@ -1211,7 +1211,7 @@ In addition to the three supplied contexts, new contexts can be created with the
.. method:: logical_and(x, y) .. method:: logical_and(x, y)
Applies the logical operation `and` between each operand's digits. Applies the logical operation *and* between each operand's digits.
.. method:: logical_invert(x) .. method:: logical_invert(x)
...@@ -1221,12 +1221,12 @@ In addition to the three supplied contexts, new contexts can be created with the ...@@ -1221,12 +1221,12 @@ In addition to the three supplied contexts, new contexts can be created with the
.. method:: logical_or(x, y) .. method:: logical_or(x, y)
Applies the logical operation `or` between each operand's digits. Applies the logical operation *or* between each operand's digits.
.. method:: logical_xor(x, y) .. method:: logical_xor(x, y)
Applies the logical operation `xor` between each operand's digits. Applies the logical operation *xor* between each operand's digits.
.. method:: max(x, y) .. method:: max(x, y)
...@@ -1337,8 +1337,8 @@ In addition to the three supplied contexts, new contexts can be created with the ...@@ -1337,8 +1337,8 @@ In addition to the three supplied contexts, new contexts can be created with the
.. method:: remainder_near(x, y) .. method:: remainder_near(x, y)
Returns `x - y * n`, where *n* is the integer nearest the exact value Returns ``x - y * n``, where *n* is the integer nearest the exact value
of `x / y` (if the result is `0` then its sign will be the sign of *x*). of ``x / y`` (if the result is 0 then its sign will be the sign of *x*).
.. method:: rotate(x, y) .. method:: rotate(x, y)
......
...@@ -101,11 +101,11 @@ another rational number, or from a string. ...@@ -101,11 +101,11 @@ another rational number, or from a string.
.. function:: gcd(a, b) .. function:: gcd(a, b)
Return the greatest common divisor of the integers `a` and `b`. If Return the greatest common divisor of the integers *a* and *b*. If either
either `a` or `b` is nonzero, then the absolute value of `gcd(a, *a* or *b* is nonzero, then the absolute value of ``gcd(a, b)`` is the
b)` is the largest integer that divides both `a` and `b`. `gcd(a,b)` largest integer that divides both *a* and *b*. ``gcd(a,b)`` has the same
has the same sign as `b` if `b` is nonzero; otherwise it takes the sign sign as *b* if *b* is nonzero; otherwise it takes the sign of *a*. ``gcd(0,
of `a`. `gcd(0, 0)` returns `0`. 0)`` returns ``0``.
.. seealso:: .. seealso::
......
...@@ -125,15 +125,15 @@ The use of dynamic dispatching by :meth:`Repr.repr1` allows subclasses of ...@@ -125,15 +125,15 @@ The use of dynamic dispatching by :meth:`Repr.repr1` allows subclasses of
the handling of types already supported. This example shows how special support the handling of types already supported. This example shows how special support
for file objects could be added:: for file objects could be added::
import repr import repr as reprlib
import sys import sys
class MyRepr(repr.Repr): class MyRepr(reprlib.Repr):
def repr_file(self, obj, level): def repr_file(self, obj, level):
if obj.name in ['<stdin>', '<stdout>', '<stderr>']: if obj.name in ['<stdin>', '<stdout>', '<stderr>']:
return obj.name return obj.name
else: else:
return `obj` return repr(obj)
aRepr = MyRepr() aRepr = MyRepr()
print aRepr.repr(sys.stdin) # prints '<stdin>' print aRepr.repr(sys.stdin) # prints '<stdin>'
......
...@@ -7,9 +7,9 @@ ...@@ -7,9 +7,9 @@
.. note:: .. note::
The :mod:`SocketServer` module has been renamed to `socketserver` in Python The :mod:`SocketServer` module has been renamed to :mod:`socketserver` in
3.0. The :term:`2to3` tool will automatically adapt imports when converting Python 3.0. The :term:`2to3` tool will automatically adapt imports when
your sources to 3.0. converting your sources to 3.0.
The :mod:`SocketServer` module simplifies the task of writing network servers. The :mod:`SocketServer` module simplifies the task of writing network servers.
......
...@@ -164,11 +164,11 @@ The module defines the following user-callable functions: ...@@ -164,11 +164,11 @@ The module defines the following user-callable functions:
.. warning:: .. warning::
Use of this function may introduce a security hole in your program. Use of this function may introduce a security hole in your program. By
By the time you get around to doing anything with the file name it the time you get around to doing anything with the file name it returns,
returns, someone else may have beaten you to the punch. someone else may have beaten you to the punch. :func:`mktemp` usage can
:func:`mktemp` usage can be replaced easily with be replaced easily with :func:`NamedTemporaryFile`, passing it the
:func:`NamedTemporaryFile`, passing it the `delete=False` parameter:: ``delete=False`` parameter::
>>> f = NamedTemporaryFile(delete=False) >>> f = NamedTemporaryFile(delete=False)
>>> f >>> f
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment