mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
[Bug #683416] Make PEP263 coverage a bit more explicit, and add it to the
porting section
This commit is contained in:
parent
2ff51a87b3
commit
acddabc6ec
1 changed files with 14 additions and 6 deletions
|
@ -285,13 +285,16 @@ file. For example, a UTF-8 file can be declared with:
|
||||||
\end{verbatim}
|
\end{verbatim}
|
||||||
|
|
||||||
Without such an encoding declaration, the default encoding used is
|
Without such an encoding declaration, the default encoding used is
|
||||||
ISO-8859-1, also known as Latin1.
|
7-bit ASCII. Executing or importing modules containing string
|
||||||
|
literals with 8-bit characters and no encoding declaration will result
|
||||||
|
in a \exception{DeprecationWarning} being signalled by Python 2.3; in
|
||||||
|
2.4 this will be a syntax error.
|
||||||
|
|
||||||
The encoding declaration only affects Unicode string literals; the
|
The encoding declaration only affects Unicode string literals, which
|
||||||
text in the source code will be converted to Unicode using the
|
will be converted to Unicode using the specified encoding. Note that
|
||||||
specified encoding. Note that Python identifiers are still restricted
|
Python identifiers are still restricted to ASCII characters, so you
|
||||||
to ASCII characters, so you can't have variable names that use
|
can't have variable names that use characters outside of the usual
|
||||||
characters outside of the usual alphanumerics.
|
alphanumerics.
|
||||||
|
|
||||||
\begin{seealso}
|
\begin{seealso}
|
||||||
|
|
||||||
|
@ -2079,6 +2082,11 @@ if \var{X} is more than one character long.
|
||||||
integer instead of raising an \exception{OverflowError} when a string
|
integer instead of raising an \exception{OverflowError} when a string
|
||||||
or floating-point number is too large to fit into an integer.
|
or floating-point number is too large to fit into an integer.
|
||||||
|
|
||||||
|
\item If you have Unicode strings that contain 8-bit characters, you
|
||||||
|
must declare the file's encoding (UTF-8, Latin-1, or whatever) by
|
||||||
|
adding a comment to the top of the file. See
|
||||||
|
section~\ref{section-encodings} for more information.
|
||||||
|
|
||||||
\item Calling Tcl methods through \module{_tkinter} no longer
|
\item Calling Tcl methods through \module{_tkinter} no longer
|
||||||
returns only strings. Instead, if Tcl returns other objects those
|
returns only strings. Instead, if Tcl returns other objects those
|
||||||
objects are converted to their Python equivalent, if one exists, or
|
objects are converted to their Python equivalent, if one exists, or
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue