diff --git a/.github/workflows/packages.yml b/.github/workflows/packages.yml new file mode 100644 index 000000000000000..766f5837b087762 --- /dev/null +++ b/.github/workflows/packages.yml @@ -0,0 +1,84 @@ +name: builder + +on: + workflow_dispatch: + push: + schedule: + - cron: '30 5 * * *' + +jobs: + packages: + runs-on: ubuntu-24.04 + steps: + - name: Check out the repo + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: merge upstream + run: | + git remote add upstream https://github.com/python/cpython.git + git fetch upstream + git -c user.name=Github -c user.email=none merge upstream/main + + - name: Cache ccache + uses: actions/cache@v4 + with: + path: /home/runner/.cache/ccache + key: ccache + + - name: Prepare build environment + run: | + sudo DEBIAN_FRONTEND=noninteractive apt update && sudo DEBIAN_FRONTEND=noninteractive apt install -y --no-install-recommends sbuild mmdebstrap debian-archive-keyring ccache uidmap + + mkdir -p "$HOME/.cache/sbuild" + # shellcheck disable=SC2016 + mmdebstrap --variant=buildd --include=apt,ccache,ca-certificates \ + --keyring=/usr/share/keyrings/debian-archive-keyring.gpg \ + --customize-hook='chroot "$1" update-ccache-symlinks' \ + testing "$HOME/.cache/sbuild/testing-amd64.tar" + + ccache --zero-stats --max-size=10.0G + chmod a+X "$HOME" "$HOME/.cache" + chmod -R a+rwX "$HOME/.cache/ccache" + + cat << "EOF" > "$HOME/.sbuildrc" + $build_environment = { "CCACHE_DIR" => "/build/ccache" }; + $path = "/usr/lib/ccache:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"; + $build_path = "/build/package/"; + $dsc_dir = "package"; + $unshare_bind_mounts = [ { directory => "$HOME/.cache/ccache", mountpoint => "/build/ccache" } ]; + $verbose = 1; + EOF + mkdir "$HOME/apt_repo" + + - name: Run sbuild + run: | + # shellcheck disable=SC2016 + sed -i "1 s/([^)]*)/($(git describe --tags | sed 's/^[^0-9]*//;s/-/./g;s/_/./g')-$(date -u '+%Y%m%d.%H%M%S%N'))/" debian/changelog + sbuild -d testing --chroot-mode=unshare --no-clean-source --no-run-lintian \ + --extra-repository="deb [trusted=yes] https://github.com/defo-project/openssl/raw/packages/ ./" \ + --dpkg-source-opts="-Zgzip -z1 --format=1.0 -sn" --build-dir="$HOME/apt_repo" + cd "$HOME/apt_repo" + apt-ftparchive packages . > Packages + apt-ftparchive release . > Release + +# - name: Test packages +# run: | +# mmdebstrap --verbose --chrooted-customize-hook="curl --ech true --doh-url 'https://1.1.1.1/dns-query' 'https://defo.ie/ech-check.php' | grep 'SSL_ECH_STATUS: success'" \ +# --variant=essential --include=ca-certificates,curl testing /dev/null \ +# "deb [signed-by=/usr/share/keyrings/debian-archive-keyring.gpg] http://deb.debian.org/debian testing main" \ +# "deb [trusted=yes] https://github.com/defo-project/openssl/raw/packages/ /" \ +# "deb [trusted=yes] copy:/$HOME/apt_repo /" + + - name: Upload apt repository + run: | + cd "$HOME/apt_repo" + BRANCH=packages + REPOSITORY="$(printf "%s" "$GITHUB_REPOSITORY" | tr / _)" + echo "echo \"deb [trusted=yes] $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/raw/$BRANCH/ /\" | sudo tee /etc/apt/sources.list.d/$REPOSITORY.list" >> README.md + git init -b "$BRANCH" + git remote add origin "$(echo "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY.git" | sed "s#https://#https://x-access-token:${{ secrets.GITHUB_TOKEN }}@#")" + git add . + git -c user.name=Github -c user.email=none commit --message="Generated with $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" + git push --force origin "$BRANCH" diff --git a/Doc/library/ssl.rst b/Doc/library/ssl.rst index b7fb1fc07d199f4..054415833d98fb4 100644 --- a/Doc/library/ssl.rst +++ b/Doc/library/ssl.rst @@ -214,7 +214,6 @@ purposes. The context now uses :data:`VERIFY_X509_PARTIAL_CHAIN` and :data:`VERIFY_X509_STRICT` in its default verify flags. - Exceptions ^^^^^^^^^^ @@ -990,6 +989,13 @@ Constants .. versionadded:: 3.6 +.. class:: ECHStatus + + :class:`enum.IntEnum` collection of Encrypted Client Hello (ECH) statuses + returned by :meth:`SSLSocket.get_ech_status`. + + .. versionadded:: TODO XXX + .. data:: Purpose.SERVER_AUTH Option for :func:`create_default_context` and @@ -1294,6 +1300,22 @@ SSL sockets also have the following additional methods and attributes: .. versionadded:: 3.3 +.. method:: SSLSocket.get_ech_retry_config() + + When the status returned by :meth:`SSLSocket.get_ech_status` after completion of the + handshake is :data:`ECHStatus.ECH_STATUS_GREASE_ECH`, this method returns the + configuration value provided by the server to be used for a new connection using + ECH. + + .. versionadded:: TODO XXX + +.. method:: SSLSocket.get_ech_status() + + Gets the status of Encrypted Client Hello (ECH) processing. Returns an + :class:`ECHStatus` instance. + + .. versionadded:: TODO XXX + .. method:: SSLSocket.selected_alpn_protocol() Return the protocol that was selected during the TLS handshake. If @@ -1366,6 +1388,15 @@ SSL sockets also have the following additional methods and attributes: .. versionadded:: 3.2 +.. attribute:: SSLSocket.outer_server_hostname + + Hostname of the server name used in the outer ClientHello when Encrypted Client + Hello (ECH) is used: :class:`str` type, or ``None`` for server-side socket or + if the outer server name was not specified in the constructor or the ECH + configuration. + + .. versionadded:: TODO XXX + .. attribute:: SSLSocket.server_side A boolean which is ``True`` for server-side sockets and ``False`` for @@ -1667,6 +1698,24 @@ to speed up repeated connections from the same clients. .. versionadded:: 3.5 +.. method:: SSLContext.set_ech_config(ech_config) + + Sets an Encrypted Client Hello (ECH) configuration, which may be discovered from + an HTTPS resource record in DNS or from :meth:`SSLSocket.get_ech_retry_config`. + Multiple calls to this functions will accumulate the set of values available for + a connection. + + If the input value provided contains no suitable value (e.g. if it only contains + ECH configuration versions that are not supported), an :class:`SSLError` will be + raised. + + The ech_config parameter should be a bytes-like object containing the raw ECH + configuration. + + This method will raise :exc:`NotImplementedError` if :data:`HAS_ECH` is ``False``. + + .. versionadded:: TODO XXX + .. method:: SSLContext.set_npn_protocols(protocols) Specify which protocols the socket should advertise during the SSL/TLS @@ -1686,6 +1735,28 @@ to speed up repeated connections from the same clients. NPN has been superseded by ALPN +.. method:: SSLContext.set_outer_alpn_protocols(protocols) + + Specify which protocols the socket should advertise during the TLS + handshake in the outer ClientHello when ECH is used. The *protocols* + argument accepts the same values as for + :meth:`~SSLContext.set_alpn_protocols`. + + This method will raise :exc:`NotImplementedError` if :data:`HAS_ECH` is + ``False``. + + .. versionadded:: TODO XXX + +.. method:: SSLContext.set_outer_server_hostname(server_hostname) + + Specify which hostname the socket should advertise during the TLS + handshake in the outer ClientHello when ECH is used. + + This method will raise :exc:`NotImplementedError` if :data:`HAS_ECH` is + ``False``. + + .. versionadded:: TODO XXX + .. attribute:: SSLContext.sni_callback Register a callback function that will be called after the TLS Client Hello @@ -2581,6 +2652,8 @@ provided. - :meth:`~SSLSocket.verify_client_post_handshake` - :meth:`~SSLSocket.unwrap` - :meth:`~SSLSocket.get_channel_binding` + - :meth:`~SSLSocket.get_ech_retry_config` + - :meth:`~SSLSocket.get_ech_status` - :meth:`~SSLSocket.version` When compared to :class:`SSLSocket`, this object lacks the following @@ -2800,6 +2873,52 @@ of TLS/SSL. Some new TLS 1.3 features are not yet available. - TLS 1.3 features like early data, deferred TLS client cert request, signature algorithm configuration, and rekeying are not supported yet. +Encrypted Client Hello +^^^^^^^^^^^^^^^^^^^^^^ + +.. versionadded:: TODO XXX + +Encrypted Client Hello (ECH) allows for encrypting values that have previously only been +included unencrypted in the ClientHello records when establishing a TLS connection. To use +ECH it is necessary to provide configuration values that contain a version, algorithm +parameters, the public key to use for HPKE encryption and the "public_name" that is by +default used for the unencrypted (outer) SNI when ECH is attempted. These configuration +values may be discovered through DNS or through the "retry config" mechanism. + +The following example assumes that you have discovered a set of ECH configuration values +from DNS, or *ech_configs* may be an empty list to rely on the "retry config" mechanism:: + + import socket + import ssl + + + def connect_with_tls_ech(hostname: str, ech_configs: List[str], + use_retry_config: bool=True) -> ssl.SSLSocket: + context = ssl.create_default_context() + for ech_config in ech_configs: + context.set_ech_config(ech_config) + with socket.create_connection((hostname, 443)) as sock: + with context.wrap_socket(sock, server_hostname=hostname) as ssock: + if (ssock.get_ech_status == ECHStatus.ECH_STATUS_GREASE_ECH + and use_retry_config): + return connect_with_ech(hostname, [ssock.get_ech_retry_config()], + False) + return ssock + + hostname = "www.python.org" + ech_configs = [] # Replace with a call to a function to lookup + # ECH configurations in DNS + + ssock = connect_with_tls_ech(hostname, ech_configs) + +The following classes, methods, and attributes will be useful for using ECH: + + - :class:`ECHStatus` + - :meth:`SSLContext.set_ech_config` + - :meth:`SSLContext.set_outer_alpn_protocols` + - :meth:`SSLContext.set_outer_server_hostname` + - :meth:`SSLSocket.get_ech_status` + - :meth:`SSLSocket.get_ech_retry_config` .. seealso:: diff --git a/Lib/ssl.py b/Lib/ssl.py index c8703b046cfd4b3..032e10b32631c75 100644 --- a/Lib/ssl.py +++ b/Lib/ssl.py @@ -150,6 +150,11 @@ lambda name: name.startswith('CERT_'), source=_ssl) +_IntEnum._convert_( + 'ECHStatus', __name__, + lambda name: name.startswith('ECH_STATUS_'), + source=_ssl) + PROTOCOL_SSLv23 = _SSLMethod.PROTOCOL_SSLv23 = _SSLMethod.PROTOCOL_TLS _PROTOCOL_NAMES = {value: name for name, value in _SSLMethod.__members__.items()} @@ -459,7 +464,7 @@ def wrap_socket(self, sock, server_side=False, suppress_ragged_eofs=suppress_ragged_eofs, server_hostname=server_hostname, context=self, - session=session + session=session, ) def wrap_bio(self, incoming, outgoing, server_side=False, @@ -502,16 +507,13 @@ def shim_cb(sslobj, servername, sslctx): self.sni_callback = shim_cb def set_alpn_protocols(self, alpn_protocols): - protos = bytearray() - for protocol in alpn_protocols: - b = bytes(protocol, 'ascii') - if len(b) == 0 or len(b) > 255: - raise SSLError('ALPN protocols must be 1 to 255 in length') - protos.append(len(b)) - protos.extend(b) - + protos = encode_alpn_protocol_list(alpn_protocols) self._set_alpn_protocols(protos) + def set_outer_alpn_protocols(self, alpn_protocols): + protos = encode_alpn_protocol_list(alpn_protocols) + self._set_outer_alpn_protocols(protos) + def _load_windows_store_certs(self, storename, purpose): try: for cert, encoding, trust in enum_certificates(storename): @@ -831,6 +833,14 @@ def context(self): def context(self, ctx): self._sslobj.context = ctx + @property + def outer_server_hostname(self) -> str: + """The server name used in the outer ClientHello.""" + if self._sslobj: + return self._sslobj.get_ech_status()[2] + else: + raise ValueError("No SSL wrapper around " + str(self)) + @property def session(self): """The SSLSession for client socket.""" @@ -968,6 +978,9 @@ def version(self): def verify_client_post_handshake(self): return self._sslobj.verify_client_post_handshake() + def get_ech_status(self): + return ECHStatus(self._sslobj.get_ech_status()[0]) + def _sslcopydoc(func): """Copy docstring from SSLObject to SSLSocket""" @@ -990,13 +1003,16 @@ def __init__(self, *args, **kwargs): @classmethod def _create(cls, sock, server_side=False, do_handshake_on_connect=True, suppress_ragged_eofs=True, server_hostname=None, - context=None, session=None): + context=None, session=None, outer_server_hostname=None): if sock.getsockopt(SOL_SOCKET, SO_TYPE) != SOCK_STREAM: raise NotImplementedError("only stream sockets are supported") if server_side: if server_hostname: raise ValueError("server_hostname can only be specified " "in client mode") + if outer_server_hostname: + raise ValueError("outer_server_hostname can only be specified " + "in client mode") if session is not None: raise ValueError("session can only be specified in " "client mode") @@ -1092,6 +1108,14 @@ def context(self, ctx): self._context = ctx self._sslobj.context = ctx + @property + def outer_server_hostname(self) -> str: + """The server name used in the outer ClientHello.""" + if self._sslobj: + return self._sslobj.get_ech_status()[2] + else: + raise ValueError("No SSL wrapper around " + str(self)) + @property @_sslcopydoc def session(self): @@ -1358,6 +1382,13 @@ def verify_client_post_handshake(self): else: raise ValueError("No SSL wrapper around " + str(self)) + + def get_ech_status(self): + if self._sslobj: + return ECHStatus(self._sslobj.get_ech_status()[0]) + else: + raise ValueError("No SSL wrapper around " + str(self)) + def _real_close(self): self._sslobj = None super()._real_close() @@ -1527,3 +1558,13 @@ def get_server_certificate(addr, ssl_version=PROTOCOL_TLS_CLIENT, def get_protocol_name(protocol_code): return _PROTOCOL_NAMES.get(protocol_code, '') + +def encode_alpn_protocol_list(alpn_protocols): + protos = bytearray() + for protocol in alpn_protocols: + b = bytes(protocol, 'ascii') + if len(b) == 0 or len(b) > 255: + raise SSLError('ALPN protocols must be 1 to 255 in length') + protos.append(len(b)) + protos.extend(b) + return protos diff --git a/Modules/_ssl.c b/Modules/_ssl.c index b6b5ebf094c938a..e2d5c54c0564d72 100644 --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -69,6 +69,10 @@ #include "openssl/bio.h" #include "openssl/dh.h" +#if __has_include("openssl/ech.h") +#include "openssl/ech.h" +#endif + #ifndef OPENSSL_THREADS # error "OPENSSL_THREADS is not defined, Python requires thread-safe OpenSSL" #endif @@ -2020,6 +2024,111 @@ cipher_to_dict(const SSL_CIPHER *cipher) ); } +/*[clinic input] +_ssl._SSLSocket.get_ech_status +[clinic start generated code]*/ + +static PyObject * +_ssl__SSLSocket_get_ech_status_impl(PySSLSocket *self) +/*[clinic end generated code: output=263bf7fc7888e2d6 input=4f68a05d59f39372]*/ +{ +#ifdef OPENSSL_ECH + char *inner_sni = NULL, *outer_sni = NULL; + + if (self->ssl == NULL) { + Py_RETURN_NONE; + } + + int status = SSL_ech_get_status(self->ssl, &inner_sni, &outer_sni); + PyObject *retval = PyTuple_New(3); + PyTuple_SetItem(retval, 0, PyLong_FromLong(status)); + + if (inner_sni != NULL) { + PyTuple_SetItem(retval, 1, PyUnicode_FromString(inner_sni)); + OPENSSL_free(inner_sni); + } else { + PyTuple_SetItem(retval, 1, Py_None); + Py_INCREF(Py_None); + } + + if (outer_sni != NULL) { + PyTuple_SetItem(retval, 2, PyUnicode_FromString(outer_sni)); + OPENSSL_free(outer_sni); + } else { + PyTuple_SetItem(retval, 2, Py_None); + Py_INCREF(Py_None); + } + + return retval; +#else + PyErr_SetString(PyExc_NotImplementedError, "OpenSSL does not have ECH support"); + return NULL; +#endif +} + +/*[clinic input] +_ssl._SSLSocket.get_ech_retry_config +[clinic start generated code]*/ + +static PyObject * +_ssl__SSLSocket_get_ech_retry_config_impl(PySSLSocket *self) +/*[clinic end generated code: output=967da2032df9a37a input=b9b3cee90aedc05d]*/ +{ +#ifdef OPENSSL_ECH + unsigned char *ec; + size_t eclen; + + if (self->ssl == NULL) { + Py_RETURN_NONE; + } + + SSL_ech_get_retry_config(self->ssl, &ec, &eclen); + + return PyBytes_FromStringAndSize((char *)ec, eclen); +#else + PyErr_SetString(PyExc_NotImplementedError, "OpenSSL does not have ECH support"); + return NULL; +#endif +} + +/*[clinic input] +_ssl._SSLSocket.set_outer_server_name + + outer_server_name: str + / +[clinic start generated code]*/ + +static PyObject * +_ssl__SSLSocket_set_outer_server_name_impl(PySSLSocket *self, + const char *outer_server_name) +/*[clinic end generated code: output=24e7c6b7b3c2ce84 input=5f68803fbe85a69c]*/ +{ +#ifdef OPENSSL_ECH + if (self->ssl == NULL) { + Py_RETURN_NONE; + } + + int result; + + if (outer_server_name != NULL) { + result = SSL_ech_set_outer_server_name(self->ssl, outer_server_name, 0); + } else { + /* Do not send an outer SNI */ + result = SSL_ech_set_outer_server_name(self->ssl, NULL, 1); + } + + if (result != 1) { + _setSSLError(get_state_sock(self), NULL, 0, __FILE__, __LINE__); + return NULL; + } + + Py_RETURN_NONE; +#else + PyErr_SetString(PyExc_NotImplementedError, "OpenSSL does not have ECH support"); + return NULL; +#endif +} + /*[clinic input] @critical_section _ssl._SSLSocket.shared_ciphers @@ -2961,6 +3070,9 @@ static PyMethodDef PySSLMethods[] = { _SSL__SSLSOCKET_COMPRESSION_METHODDEF _SSL__SSLSOCKET_SHUTDOWN_METHODDEF _SSL__SSLSOCKET_VERIFY_CLIENT_POST_HANDSHAKE_METHODDEF + _SSL__SSLSOCKET_GET_ECH_STATUS_METHODDEF + _SSL__SSLSOCKET_SET_OUTER_SERVER_NAME_METHODDEF + _SSL__SSLSOCKET_GET_ECH_RETRY_CONFIG_METHODDEF _SSL__SSLSOCKET_GET_UNVERIFIED_CHAIN_METHODDEF _SSL__SSLSOCKET_GET_VERIFIED_CHAIN_METHODDEF {NULL, NULL} @@ -3402,6 +3514,43 @@ _ssl__SSLContext__set_alpn_protocols_impl(PySSLContext *self, Py_RETURN_NONE; } +/*[clinic input] +@critical_section +_ssl._SSLContext._set_outer_alpn_protocols + protos: Py_buffer + / +[clinic start generated code]*/ + +static PyObject * +_ssl__SSLContext__set_outer_alpn_protocols_impl(PySSLContext *self, + Py_buffer *protos) +/*[clinic end generated code: output=823aea95e8dea835 input=b6ddf7d0791afd0e]*/ +{ +#ifdef OPENSSL_ECH + if ((size_t)protos->len > UINT_MAX) { + PyErr_Format(PyExc_OverflowError, + "protocols longer than %u bytes", UINT_MAX); + return NULL; + } + + PyMem_Free(self->alpn_protocols); + self->alpn_protocols = PyMem_Malloc(protos->len); + if (!self->alpn_protocols) { + return PyErr_NoMemory(); + } + memcpy(self->alpn_protocols, protos->buf, protos->len); + self->alpn_protocols_len = (unsigned int)protos->len; + if (SSL_CTX_ech_set_outer_alpn_protos(self->ctx, self->alpn_protocols, self->alpn_protocols_len)) { + return PyErr_NoMemory(); + } + + Py_RETURN_NONE; +#else + PyErr_SetString(PyExc_NotImplementedError, "OpenSSL does not have ECH support"); + return NULL; +#endif +} + /*[clinic input] @critical_section @getter @@ -4517,6 +4666,36 @@ _ssl__SSLContext_set_default_verify_paths_impl(PySSLContext *self) Py_RETURN_NONE; } +/*[clinic input] +_ssl._SSLContext.set_ech_config + + ech_config: Py_buffer + / + +Set the ECH configuration on the SSL context. + +The echconfig parameter should be a bytes-like object containing the raw ECH configuration. +[clinic start generated code]*/ + +static PyObject * +_ssl__SSLContext_set_ech_config_impl(PySSLContext *self, + Py_buffer *ech_config) +/*[clinic end generated code: output=cea53188b338cf80 input=09f9a38c5aaef091]*/ +{ +#ifdef OPENSSL_ECH + if (!SSL_CTX_ech_set1_echconfig(self->ctx, ech_config->buf, ech_config->len)) { + _setSSLError(get_state_ctx(self), NULL, 0, __FILE__, __LINE__); + return NULL; + } + + PyBuffer_Release(ech_config); + Py_RETURN_NONE; +#else + PyErr_SetString(PyExc_NotImplementedError, "OpenSSL does not have ECH support"); + return NULL; +#endif +} + /*[clinic input] @critical_section _ssl._SSLContext.set_ecdh_curve @@ -5153,6 +5332,8 @@ static struct PyMethodDef context_methods[] = { _SSL__SSLCONTEXT_SESSION_STATS_METHODDEF _SSL__SSLCONTEXT_SET_DEFAULT_VERIFY_PATHS_METHODDEF _SSL__SSLCONTEXT_SET_ECDH_CURVE_METHODDEF + _SSL__SSLCONTEXT_SET_ECH_CONFIG_METHODDEF + _SSL__SSLCONTEXT__SET_OUTER_ALPN_PROTOCOLS_METHODDEF _SSL__SSLCONTEXT_CERT_STORE_STATS_METHODDEF _SSL__SSLCONTEXT_GET_CA_CERTS_METHODDEF _SSL__SSLCONTEXT_GET_CIPHERS_METHODDEF @@ -6307,6 +6488,20 @@ sslmodule_init_constants(PyObject *m) ADD_INT_CONST("VERIFY_X509_PARTIAL_CHAIN", X509_V_FLAG_PARTIAL_CHAIN); #endif +#ifdef OPENSSL_ECH + ADD_INT_CONST("ECH_STATUS_BACKEND", SSL_ECH_STATUS_BACKEND); + ADD_INT_CONST("ECH_STATUS_GREASE_ECH", SSL_ECH_STATUS_GREASE_ECH); + ADD_INT_CONST("ECH_STATUS_GREASE", SSL_ECH_STATUS_GREASE); + ADD_INT_CONST("ECH_STATUS_SUCCESS", SSL_ECH_STATUS_SUCCESS); + ADD_INT_CONST("ECH_STATUS_FAILED", SSL_ECH_STATUS_FAILED); + ADD_INT_CONST("ECH_STATUS_BAD_CALL", SSL_ECH_STATUS_BAD_CALL); + ADD_INT_CONST("ECH_STATUS_NOT_TRIED", SSL_ECH_STATUS_NOT_TRIED); + ADD_INT_CONST("ECH_STATUS_BAD_NAME", SSL_ECH_STATUS_BAD_NAME); + ADD_INT_CONST("ECH_STATUS_NOT_CONFIGURED", SSL_ECH_STATUS_NOT_CONFIGURED); + ADD_INT_CONST("ECH_STATUS_FAILED_ECH", SSL_ECH_STATUS_FAILED_ECH); + ADD_INT_CONST("ECH_STATUS_FAILED_ECH_BAD_NAME", SSL_ECH_STATUS_FAILED_ECH_BAD_NAME); +#endif + /* Alert Descriptions from ssl.h */ /* note RESERVED constants no longer intended for use have been removed */ /* http://www.iana.org/assignments/tls-parameters/tls-parameters.xml#tls-parameters-6 */ @@ -6390,6 +6585,13 @@ sslmodule_init_constants(PyObject *m) ADD_OPTION("OP_NO_TICKET", SSL_OP_NO_TICKET); ADD_OPTION("OP_LEGACY_SERVER_CONNECT", SSL_OP_LEGACY_SERVER_CONNECT); +#ifdef OPENSSL_ECH + ADD_OPTION("OP_ECH_GREASE", SSL_OP_ECH_GREASE); + ADD_OPTION("OP_ECH_TRIALDECRYPT", SSL_OP_ECH_TRIALDECRYPT); + ADD_OPTION("OP_ECH_IGNORE_CID", SSL_OP_ECH_IGNORE_CID); + ADD_OPTION("OP_ECH_GREASE_RETRY_CONFIG", SSL_OP_ECH_GREASE_RETRY_CONFIG); + ADD_OPTION("OP_ECH_SPECIFIC_PADDING", SSL_OP_ECH_SPECIFIC_PADDING); +#endif #ifdef SSL_OP_SINGLE_ECDH_USE ADD_OPTION("OP_SINGLE_ECDH_USE", SSL_OP_SINGLE_ECDH_USE); #endif @@ -6505,6 +6707,12 @@ sslmodule_init_constants(PyObject *m) addbool(m, "HAS_PSK", 1); #endif +#ifdef OPENSSL_NO_ECH + addbool(m, "HAS_ECH", 0); +#else + addbool(m, "HAS_ECH", 1); +#endif + #undef addbool #undef ADD_INT_CONST diff --git a/Modules/clinic/_ssl.c.h b/Modules/clinic/_ssl.c.h index 582eef16c132446..55a610c98087bb6 100644 --- a/Modules/clinic/_ssl.c.h +++ b/Modules/clinic/_ssl.c.h @@ -149,6 +149,77 @@ _ssl__SSLSocket_get_unverified_chain(PySSLSocket *self, PyObject *Py_UNUSED(igno return return_value; } +PyDoc_STRVAR(_ssl__SSLSocket_get_ech_status__doc__, +"get_ech_status($self, /)\n" +"--\n" +"\n"); + +#define _SSL__SSLSOCKET_GET_ECH_STATUS_METHODDEF \ + {"get_ech_status", (PyCFunction)_ssl__SSLSocket_get_ech_status, METH_NOARGS, _ssl__SSLSocket_get_ech_status__doc__}, + +static PyObject * +_ssl__SSLSocket_get_ech_status_impl(PySSLSocket *self); + +static PyObject * +_ssl__SSLSocket_get_ech_status(PySSLSocket *self, PyObject *Py_UNUSED(ignored)) +{ + return _ssl__SSLSocket_get_ech_status_impl(self); +} + +PyDoc_STRVAR(_ssl__SSLSocket_get_ech_retry_config__doc__, +"get_ech_retry_config($self, /)\n" +"--\n" +"\n"); + +#define _SSL__SSLSOCKET_GET_ECH_RETRY_CONFIG_METHODDEF \ + {"get_ech_retry_config", (PyCFunction)_ssl__SSLSocket_get_ech_retry_config, METH_NOARGS, _ssl__SSLSocket_get_ech_retry_config__doc__}, + +static PyObject * +_ssl__SSLSocket_get_ech_retry_config_impl(PySSLSocket *self); + +static PyObject * +_ssl__SSLSocket_get_ech_retry_config(PySSLSocket *self, PyObject *Py_UNUSED(ignored)) +{ + return _ssl__SSLSocket_get_ech_retry_config_impl(self); +} + +PyDoc_STRVAR(_ssl__SSLSocket_set_outer_server_name__doc__, +"set_outer_server_name($self, outer_server_name, /)\n" +"--\n" +"\n"); + +#define _SSL__SSLSOCKET_SET_OUTER_SERVER_NAME_METHODDEF \ + {"set_outer_server_name", (PyCFunction)_ssl__SSLSocket_set_outer_server_name, METH_O, _ssl__SSLSocket_set_outer_server_name__doc__}, + +static PyObject * +_ssl__SSLSocket_set_outer_server_name_impl(PySSLSocket *self, + const char *outer_server_name); + +static PyObject * +_ssl__SSLSocket_set_outer_server_name(PySSLSocket *self, PyObject *arg) +{ + PyObject *return_value = NULL; + const char *outer_server_name; + + if (!PyUnicode_Check(arg)) { + _PyArg_BadArgument("set_outer_server_name", "argument", "str", arg); + goto exit; + } + Py_ssize_t outer_server_name_length; + outer_server_name = PyUnicode_AsUTF8AndSize(arg, &outer_server_name_length); + if (outer_server_name == NULL) { + goto exit; + } + if (strlen(outer_server_name) != (size_t)outer_server_name_length) { + PyErr_SetString(PyExc_ValueError, "embedded null character"); + goto exit; + } + return_value = _ssl__SSLSocket_set_outer_server_name_impl(self, outer_server_name); + +exit: + return return_value; +} + PyDoc_STRVAR(_ssl__SSLSocket_shared_ciphers__doc__, "shared_ciphers($self, /)\n" "--\n" @@ -873,6 +944,40 @@ _ssl__SSLContext__set_alpn_protocols(PySSLContext *self, PyObject *arg) return return_value; } +PyDoc_STRVAR(_ssl__SSLContext__set_outer_alpn_protocols__doc__, +"_set_outer_alpn_protocols($self, protos, /)\n" +"--\n" +"\n"); + +#define _SSL__SSLCONTEXT__SET_OUTER_ALPN_PROTOCOLS_METHODDEF \ + {"_set_outer_alpn_protocols", (PyCFunction)_ssl__SSLContext__set_outer_alpn_protocols, METH_O, _ssl__SSLContext__set_outer_alpn_protocols__doc__}, + +static PyObject * +_ssl__SSLContext__set_outer_alpn_protocols_impl(PySSLContext *self, + Py_buffer *protos); + +static PyObject * +_ssl__SSLContext__set_outer_alpn_protocols(PySSLContext *self, PyObject *arg) +{ + PyObject *return_value = NULL; + Py_buffer protos = {NULL, NULL}; + + if (PyObject_GetBuffer(arg, &protos, PyBUF_SIMPLE) != 0) { + goto exit; + } + Py_BEGIN_CRITICAL_SECTION(self); + return_value = _ssl__SSLContext__set_outer_alpn_protocols_impl(self, &protos); + Py_END_CRITICAL_SECTION(); + +exit: + /* Cleanup for protos */ + if (protos.obj) { + PyBuffer_Release(&protos); + } + + return return_value; +} + #if defined(_ssl__SSLContext_verify_mode_HAS_DOCSTR) # define _ssl__SSLContext_verify_mode_DOCSTR _ssl__SSLContext_verify_mode__doc__ #else @@ -1776,6 +1881,41 @@ _ssl__SSLContext_set_default_verify_paths(PySSLContext *self, PyObject *Py_UNUSE return return_value; } +PyDoc_STRVAR(_ssl__SSLContext_set_ech_config__doc__, +"set_ech_config($self, ech_config, /)\n" +"--\n" +"\n" +"Set the ECH configuration on the SSL context.\n" +"\n" +"The echconfig parameter should be a bytes-like object containing the raw ECH configuration."); + +#define _SSL__SSLCONTEXT_SET_ECH_CONFIG_METHODDEF \ + {"set_ech_config", (PyCFunction)_ssl__SSLContext_set_ech_config, METH_O, _ssl__SSLContext_set_ech_config__doc__}, + +static PyObject * +_ssl__SSLContext_set_ech_config_impl(PySSLContext *self, + Py_buffer *ech_config); + +static PyObject * +_ssl__SSLContext_set_ech_config(PySSLContext *self, PyObject *arg) +{ + PyObject *return_value = NULL; + Py_buffer ech_config = {NULL, NULL}; + + if (PyObject_GetBuffer(arg, &ech_config, PyBUF_SIMPLE) != 0) { + goto exit; + } + return_value = _ssl__SSLContext_set_ech_config_impl(self, &ech_config); + +exit: + /* Cleanup for ech_config */ + if (ech_config.obj) { + PyBuffer_Release(&ech_config); + } + + return return_value; +} + PyDoc_STRVAR(_ssl__SSLContext_set_ecdh_curve__doc__, "set_ecdh_curve($self, name, /)\n" "--\n" @@ -2839,4 +2979,4 @@ _ssl_enum_crls(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObje #ifndef _SSL_ENUM_CRLS_METHODDEF #define _SSL_ENUM_CRLS_METHODDEF #endif /* !defined(_SSL_ENUM_CRLS_METHODDEF) */ -/*[clinic end generated code: output=4c2af0c8fab7ec4e input=a9049054013a1b77]*/ +/*[clinic end generated code: output=3b9063915c60ea1a input=a9049054013a1b77]*/ diff --git a/configure b/configure index b1ced3106618ba6..71977670cdceeed 100755 --- a/configure +++ b/configure @@ -28951,6 +28951,50 @@ LIBS=$save_LIBS + for ac_header in openssl/ech.h +do : + ac_fn_c_check_header_compile "$LINENO" "openssl/ech.h" "ac_cv_header_openssl_ech_h" "$ac_includes_default" +if test "x$ac_cv_header_openssl_ech_h" = xyes +then : + printf "%s\n" "#define HAVE_OPENSSL_ECH_H 1" >>confdefs.h + have_openssl_ech_h=yes +else $as_nop + have_openssl_ech_h=no +fi + +done +if test "$have_openssl_ech_h" = "yes"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for OpenSSL ECH support" >&5 +printf %s "checking for OpenSSL ECH support... " >&6; } + ac_fn_check_decl "$LINENO" "SSL_ECH_STATUS_GREASE_ECH" "ac_cv_have_decl_SSL_ECH_STATUS_GREASE_ECH" "#include +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_SSL_ECH_STATUS_GREASE_ECH" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 +fi +printf "%s\n" "#define HAVE_DECL_SSL_ECH_STATUS_GREASE_ECH $ac_have_decl" >>confdefs.h +if test $ac_have_decl = 1 +then : + +printf "%s\n" "#define OPENSSL_ECH 1" >>confdefs.h + +else $as_nop + +printf "%s\n" "#define OPENSSL_NO_ECH 1" >>confdefs.h + +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have_decl_SSL_ECH_STATUS_GREASE_ECH" >&5 +printf "%s\n" "$ac_cv_have_decl_SSL_ECH_STATUS_GREASE_ECH" >&6; } +else + +printf "%s\n" "#define OPENSSL_NO_ECH 1" >>confdefs.h + +fi + + # ssl module default cipher suite string diff --git a/configure.ac b/configure.ac index 3a55cbc13203933..f35bb405f74e7b5 100644 --- a/configure.ac +++ b/configure.ac @@ -7384,6 +7384,22 @@ WITH_SAVE_ENV([ ]) ]) +AC_CHECK_HEADERS([openssl/ech.h], [have_openssl_ech_h=yes], [have_openssl_ech_h=no]) +if test "$have_openssl_ech_h" = "yes"; then + AC_MSG_CHECKING([for OpenSSL ECH support]) + AC_CHECK_DECLS([SSL_ECH_STATUS_GREASE_ECH], + [AC_DEFINE([OPENSSL_ECH], [1], + [Define if OpenSSL has ECH support])], + [AC_DEFINE([OPENSSL_NO_ECH], [1], + [Define if OpenSSL does not have ECH support])], + [#include ]) + AC_MSG_RESULT([$ac_cv_have_decl_SSL_ECH_STATUS_GREASE_ECH]) +else + AC_DEFINE([OPENSSL_NO_ECH], [1], + [Define if OpenSSL does not have ECH support]) +fi + + # ssl module default cipher suite string AH_TEMPLATE([PY_SSL_DEFAULT_CIPHERS], [Default cipher suites list for ssl module. diff --git a/debian/EXTERNALLY-MANAGED.in b/debian/EXTERNALLY-MANAGED.in new file mode 100644 index 000000000000000..4dbc602df6e170f --- /dev/null +++ b/debian/EXTERNALLY-MANAGED.in @@ -0,0 +1,15 @@ +[externally-managed] +Error=To install Python packages system-wide, try apt install + python3-xyz, where xyz is the package you are trying to + install. + + If you wish to install a non-Debian-packaged Python package, + create a virtual environment using python3 -m venv path/to/venv. + Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make + sure you have python3-full installed. + + If you wish to install a non-Debian packaged Python application, + it may be easiest to use pipx install xyz, which will manage a + virtual environment for you. Make sure you have pipx installed. + + See /usr/share/doc/@PVER@/README.venv for more information. diff --git a/debian/FAQ.html b/debian/FAQ.html new file mode 100644 index 000000000000000..389b7a2dd522e9a --- /dev/null +++ b/debian/FAQ.html @@ -0,0 +1,8997 @@ + + +The Whole Python FAQ + + + +

The Whole Python FAQ

+Last changed on Wed Feb 12 21:31:08 2003 CET + +

(Entries marked with ** were changed within the last 24 hours; +entries marked with * were changed within the last 7 days.) +

+ +

+


+

1. General information and availability

+ + +

+


+

2. Python in the real world

+ + +

+


+

3. Building Python and Other Known Bugs

+ + +

+


+

4. Programming in Python

+ + +

+


+

5. Extending Python

+ + +

+


+

6. Python's design

+ + +

+


+

7. Using Python on non-UNIX platforms

+ + +

+


+

8. Python on Windows

+ + +
+

1. General information and availability

+ +
+

1.1. What is Python?

+Python is an interpreted, interactive, object-oriented programming +language. It incorporates modules, exceptions, dynamic typing, very +high level dynamic data types, and classes. Python combines +remarkable power with very clear syntax. It has interfaces to many +system calls and libraries, as well as to various window systems, and +is extensible in C or C++. It is also usable as an extension language +for applications that need a programmable interface. Finally, Python +is portable: it runs on many brands of UNIX, on the Mac, and on PCs +under MS-DOS, Windows, Windows NT, and OS/2. +

+To find out more, the best thing to do is to start reading the +tutorial from the documentation set (see a few questions further +down). +

+See also question 1.17 (what is Python good for). +

+ +Edit this entry / +Log info + +/ Last changed on Mon May 26 16:05:18 1997 by +GvR +

+ +


+

1.2. Why is it called Python?

+Apart from being a computer scientist, I'm also a fan of "Monty +Python's Flying Circus" (a BBC comedy series from the seventies, in +the -- unlikely -- case you didn't know). It occurred to me one day +that I needed a name that was short, unique, and slightly mysterious. +And I happened to be reading some scripts from the series at the +time... So then I decided to call my language Python. +

+By now I don't care any more whether you use a Python, some other +snake, a foot or 16-ton weight, or a wood rat as a logo for Python! +

+ +Edit this entry / +Log info + +/ Last changed on Thu Aug 24 00:50:41 2000 by +GvR +

+ +


+

1.3. How do I obtain a copy of the Python source?

+The latest Python source distribution is always available from +python.org, at http://www.python.org/download. The latest development sources can be obtained via anonymous CVS from SourceForge, at http://www.sf.net/projects/python . +

+The source distribution is a gzipped tar file containing the complete C source, LaTeX +documentation, Python library modules, example programs, and several +useful pieces of freely distributable software. This will compile and +run out of the box on most UNIX platforms. (See section 7 for +non-UNIX information.) +

+Older versions of Python are also available from python.org. +

+ +Edit this entry / +Log info + +/ Last changed on Tue Apr 9 17:06:16 2002 by +A.M. Kuchling +

+ +


+

1.4. How do I get documentation on Python?

+All documentation is available on-line, starting at http://www.python.org/doc/. +

+The LaTeX source for the documentation is part of the source +distribution. If you don't have LaTeX, the latest Python +documentation set is available, in various formats like postscript +and html, by anonymous ftp - visit the above URL for links to the +current versions. +

+PostScript for a high-level description of Python is in the file nluug-paper.ps +(a separate file on the ftp site). +

+ +Edit this entry / +Log info + +/ Last changed on Wed Jan 21 12:02:55 1998 by +Ken Manheimer +

+ +


+

1.5. Are there other ftp sites that mirror the Python distribution?

+The following anonymous ftp sites keep mirrors of the Python +distribution: +

+USA: +

+

+        ftp://ftp.python.org/pub/python/
+        ftp://gatekeeper.dec.com/pub/plan/python/
+        ftp://ftp.uu.net/languages/python/
+        ftp://ftp.wustl.edu/graphics/graphics/sgi-stuff/python/
+        ftp://ftp.sterling.com/programming/languages/python/
+        ftp://uiarchive.cso.uiuc.edu/pub/lang/python/
+        ftp://ftp.pht.com/mirrors/python/python/
+	ftp://ftp.cdrom.com/pub/python/
+
+Europe: +

+

+        ftp://ftp.cwi.nl/pub/python/
+        ftp://ftp.funet.fi/pub/languages/python/
+        ftp://ftp.sunet.se/pub/lang/python/
+        ftp://unix.hensa.ac.uk/mirrors/uunet/languages/python/
+        ftp://ftp.lip6.fr/pub/python/
+        ftp://sunsite.cnlab-switch.ch/mirror/python/
+        ftp://ftp.informatik.tu-muenchen.de/pub/comp/programming/languages/python/
+
+Australia: +

+

+        ftp://ftp.dstc.edu.au/pub/python/
+
+

+ +Edit this entry / +Log info + +/ Last changed on Wed Mar 24 09:20:49 1999 by +A.M. Kuchling +

+ +


+

1.6. Is there a newsgroup or mailing list devoted to Python?

+There is a newsgroup, comp.lang.python, +and a mailing list. The newsgroup and mailing list are gatewayed into +each other -- if you can read news it's unnecessary to subscribe to +the mailing list. To subscribe to the mailing list +(python-list@python.org) visit its Mailman webpage at +http://www.python.org/mailman/listinfo/python-list +

+More info about the newsgroup and mailing list, and about other lists, +can be found at +http://www.python.org/psa/MailingLists.html. +

+Archives of the newsgroup are kept by Deja News and accessible +through the "Python newsgroup search" web page, +http://www.python.org/search/search_news.html. +This page also contains pointer to other archival collections. +

+ +Edit this entry / +Log info + +/ Last changed on Wed Jun 23 09:29:36 1999 by +GvR +

+ +


+

1.7. Is there a WWW page devoted to Python?

+Yes, http://www.python.org/ is the official Python home page. +

+ +Edit this entry / +Log info + +/ Last changed on Fri May 23 14:42:59 1997 by +Ken Manheimer +

+ +


+

1.8. Is the Python documentation available on the WWW?

+Yes. Python 2.0 documentation is available from +http://www.pythonlabs.com/tech/python2.0/doc/ and from +http://www.python.org/doc/. Note that most documentation +is available for on-line browsing as well as for downloading. +

+ +Edit this entry / +Log info + +/ Last changed on Tue Jan 2 03:14:08 2001 by +Moshe Zadka +

+ +


+

1.9. Are there any books on Python?

+Yes, many, and more are being published. See +the python.org Wiki at http://www.python.org/cgi-bin/moinmoin/PythonBooks for a list. +

+You can also search online bookstores for "Python" +(and filter out the Monty Python references; or +perhaps search for "Python" and "language"). +

+ +Edit this entry / +Log info + +/ Last changed on Mon Aug 5 19:08:49 2002 by +amk +

+ +


+

1.10. Are there any published articles about Python that I can reference?

+If you can't reference the web site, and you don't want to reference the books +(see previous question), there are several articles on Python that you could +reference. +

+Most publications about Python are collected on the Python web site: +

+

+    http://www.python.org/doc/Publications.html
+
+It is no longer recommended to reference this +very old article by Python's author: +

+

+    Guido van Rossum and Jelke de Boer, "Interactively Testing Remote
+    Servers Using the Python Programming Language", CWI Quarterly, Volume
+    4, Issue 4 (December 1991), Amsterdam, pp 283-303.
+
+

+ +Edit this entry / +Log info + +/ Last changed on Sat Jul 4 20:52:31 1998 by +GvR +

+ +


+

1.11. Are there short introductory papers or talks on Python?

+There are several - you can find links to some of them collected at +http://www.python.org/doc/Hints.html#intros. +

+ +Edit this entry / +Log info + +/ Last changed on Fri May 23 15:04:05 1997 by +Ken Manheimer +

+ +


+

1.12. How does the Python version numbering scheme work?

+Python versions are numbered A.B.C or A.B. A is the major version +number -- it is only incremented for really major changes in the +language. B is the minor version number, incremented for less +earth-shattering changes. C is the micro-level -- it is +incremented for each bugfix release. See PEP 6 for more information +about bugfix releases. +

+Not all releases have bugfix releases. +Note that in the past (ending with 1.5.2), +micro releases have added significant changes; +in fact the changeover from 0.9.9 to 1.0.0 was the first time +that either A or B changed! +

+Alpha, beta and release candidate versions have an additional suffixes. +The suffix for an alpha version is "aN" for some small number N, the +suffix for a beta version is "bN" for some small number N, and the +suffix for a release candidate version is "cN" for some small number N. +

+Note that (for instance) all versions labeled 2.0aN precede the +versions labeled 2.0bN, which precede versions labeled 2.0cN, and +those precede 2.0. +

+As a rule, no changes are made between release candidates and the final +release unless there are show-stopper bugs. +

+You may also find version numbers with a "+" suffix, e.g. "2.2+". +These are unreleased versions, built directly from the CVS trunk. +

+See also the documentation for sys.version, sys.hexversion, and +sys.version_info. +

+ +Edit this entry / +Log info + +/ Last changed on Mon Jan 14 06:34:17 2002 by +GvR +

+ +


+

1.13. How do I get a beta test version of Python?

+All releases, including alphas, betas and release candidates, are announced on +comp.lang.python and comp.lang.python.announce newsgroups, +which are gatewayed into the python-list@python.org and +python-announce@python.org. In addition, all these announcements appear on +the Python home page, at http://www.python.org. +

+You can also access the development version of Python through CVS. See http://sourceforge.net/cvs/?group_id=5470 for details. If you're not familiar with CVS, documents like http://linux.oreillynet.com/pub/a/linux/2002/01/03/cvs_intro.html +provide an introduction. +

+ +Edit this entry / +Log info + +/ Last changed on Mon Jun 3 00:57:08 2002 by +Neal Norwitz +

+ +


+

1.14. Are there copyright restrictions on the use of Python?

+Hardly. You can do anything you want with the source, as long as +you leave the copyrights in, and display those copyrights in any +documentation about Python that you produce. Also, don't use the +author's institute's name in publicity without prior written +permission, and don't hold them responsible for anything (read the +actual copyright for a precise legal wording). +

+In particular, if you honor the copyright rules, it's OK to use Python +for commercial use, to sell copies of Python in source or binary form, +or to sell products that enhance Python or incorporate Python (or part +of it) in some form. I would still like to know about all commercial +use of Python! +

+ +Edit this entry / +Log info +

+ +


+

1.15. Why was Python created in the first place?

+Here's a very brief summary of what got me started: +

+I had extensive experience with implementing an interpreted language +in the ABC group at CWI, and from working with this group I had +learned a lot about language design. This is the origin of many +Python features, including the use of indentation for statement +grouping and the inclusion of very-high-level data types (although the +details are all different in Python). +

+I had a number of gripes about the ABC language, but also liked many +of its features. It was impossible to extend the ABC language (or its +implementation) to remedy my complaints -- in fact its lack of +extensibility was one of its biggest problems. +I had some experience with using Modula-2+ and talked with the +designers of Modula-3 (and read the M3 report). M3 is the origin of +the syntax and semantics used for exceptions, and some other Python +features. +

+I was working in the Amoeba distributed operating system group at +CWI. We needed a better way to do system administration than by +writing either C programs or Bourne shell scripts, since Amoeba had +its own system call interface which wasn't easily accessible from the +Bourne shell. My experience with error handling in Amoeba made me +acutely aware of the importance of exceptions as a programming +language feature. +

+It occurred to me that a scripting language with a syntax like ABC +but with access to the Amoeba system calls would fill the need. I +realized that it would be foolish to write an Amoeba-specific +language, so I decided that I needed a language that was generally +extensible. +

+During the 1989 Christmas holidays, I had a lot of time on my hand, +so I decided to give it a try. During the next year, while still +mostly working on it in my own time, Python was used in the Amoeba +project with increasing success, and the feedback from colleagues made +me add many early improvements. +

+In February 1991, after just over a year of development, I decided +to post to USENET. The rest is in the Misc/HISTORY file. +

+ +Edit this entry / +Log info + +/ Last changed on Fri May 23 00:06:23 1997 by +GvR +

+ +


+

1.16. Do I have to like "Monty Python's Flying Circus"?

+No, but it helps. Pythonistas like the occasional reference to SPAM, +and of course, nobody expects the Spanish Inquisition +

+The two main reasons to use Python are: +

+

+ - Portable
+ - Easy to learn
+
+The three main reasons to use Python are: +

+

+ - Portable
+ - Easy to learn
+ - Powerful standard library
+
+(And nice red uniforms.) +

+And remember, there is no rule six. +

+ +Edit this entry / +Log info + +/ Last changed on Wed May 28 10:39:21 1997 by +GvR +

+ +


+

1.17. What is Python good for?

+Python is used in many situations where a great deal of dynamism, +ease of use, power, and flexibility are required. +

+In the area of basic text +manipulation core Python (without any non-core extensions) is easier +to use and is roughly as fast as just about any language, and this makes Python +good for many system administration type tasks and for CGI programming +and other application areas that manipulate text and strings and such. +

+When augmented with +standard extensions (such as PIL, COM, Numeric, oracledb, kjbuckets, +tkinter, win32api, etc.) +or special purpose extensions (that you write, perhaps using helper tools such +as SWIG, or using object protocols such as ILU/CORBA or COM) Python +becomes a very convenient "glue" or "steering" +language that helps make heterogeneous collections of unrelated +software packages work together. +For example by combining Numeric with oracledb you can help your +SQL database do statistical analysis, or even Fourier transforms. +One of the features that makes Python excel in the "glue language" role +is Python's simple, usable, and powerful C language runtime API. +

+Many developers also use Python extensively as a graphical user +interface development aide. +

+ +Edit this entry / +Log info + +/ Last changed on Sat May 24 10:13:11 1997 by +Aaron Watters +

+ +


+

1.18. Can I use the FAQ Wizard software to maintain my own FAQ?

+Sure. It's in Tools/faqwiz/ of the python source tree. +

+ +Edit this entry / +Log info + +/ Last changed on Fri Mar 29 06:50:32 2002 by +Aahz +

+ +


+

1.19. Which editor has good support for editing Python source code?

+On Unix, the first choice is Emacs/XEmacs. There's an elaborate +mode for editing Python code, which is available from the Python +source distribution (Misc/python-mode.el). It's also bundled +with XEmacs (we're still working on legal details to make it possible +to bundle it with FSF Emacs). And it has its own web page: +

+

+    http://www.python.org/emacs/python-mode/index.html
+
+There are many other choices, for Unix, Windows or Macintosh. +Richard Jones compiled a table from postings on the Python newsgroup: +

+

+    http://www.bofh.asn.au/~richard/editors.html
+
+See also FAQ question 7.10 for some more Mac and Win options. +

+ +Edit this entry / +Log info + +/ Last changed on Mon Jun 15 23:21:04 1998 by +Gvr +

+ +


+

1.20. I've never programmed before. Is there a Python tutorial?

+There are several, and at least one book. +All information for beginning Python programmers is collected here: +

+

+    http://www.python.org/doc/Newbies.html
+
+

+ +Edit this entry / +Log info + +/ Last changed on Wed Sep 5 05:34:07 2001 by +GvR +

+ +


+

1.21. Where in the world is www.python.org located?

+It's currently in Amsterdam, graciously hosted by XS4ALL: +

+

+    http://www.xs4all.nl
+
+Thanks to Thomas Wouters for setting this up!!!! +

+ +Edit this entry / +Log info + +/ Last changed on Fri Aug 3 21:49:27 2001 by +GvR +

+ +


+

2. Python in the real world

+ +
+

2.1. How many people are using Python?

+Certainly thousands, and quite probably tens of thousands of users. +More are seeing the light each day. The comp.lang.python newsgroup is +very active, but overall there is no accurate estimate of the number of subscribers or Python users. +

+Jacek Artymiak has created a Python Users Counter; you can see the +current count by visiting +http://www.wszechnica.safenet.pl/cgi-bin/checkpythonuserscounter.py +(this will not increment the counter; use the link there if you haven't +added yourself already). Most Python users appear not to have registered themselves. +

+ +Edit this entry / +Log info + +/ Last changed on Thu Feb 21 23:29:18 2002 by +GvR +

+ +


+

2.2. Have any significant projects been done in Python?

+At CWI (the former home of Python), we have written a 20,000 line +authoring environment for transportable hypermedia presentations, a +5,000 line multimedia teleconferencing tool, as well as many many +smaller programs. +

+At CNRI (Python's new home), we have written two large applications: +Grail, a fully featured web browser (see +http://grail.cnri.reston.va.us), +and the Knowbot Operating Environment, +a distributed environment for mobile code. +

+The University of Virginia uses Python to control a virtual reality +engine. See http://alice.cs.cmu.edu. +

+The ILU project at Xerox PARC can generate Python glue for ILU +interfaces. See ftp://ftp.parc.xerox.com/pub/ilu/ilu.html. ILU +is a free CORBA compliant ORB which supplies distributed object +connectivity to a host of platforms using a host of languages. +

+Mark Hammond and Greg Stein and others are interfacing Python to +Microsoft's COM and ActiveX architectures. This means, among other +things, that Python may be used in active server pages or as a COM +controller (for example to automatically extract from or insert information +into Excel or MSAccess or any other COM aware application). +Mark claims Python can even be a ActiveX scripting host (which +means you could embed JScript inside a Python application, if you +had a strange sense of humor). Python/AX/COM is distributed as part +of the PythonWin distribution. +

+The University of California, Irvine uses a student administration +system called TELE-Vision written entirely in Python. Contact: Ray +Price rlprice@uci.edu. +

+The Melbourne Cricket Ground (MCG) in Australia (a 100,000+ person venue) +has it's scoreboard system written largely in Python on MS Windows. +Python expressions are used to create almost every scoring entry that +appears on the board. The move to Python/C++ away from exclusive C++ +has provided a level of functionality that would simply not have been +viable otherwise. +

+See also the next question. +

+Note: this FAQ entry is really old. +See http://www.python.org/psa/Users.html for a more recent list. +

+ +Edit this entry / +Log info + +/ Last changed on Wed Oct 25 13:24:15 2000 by +GvR +

+ +


+

2.3. Are there any commercial projects going on using Python?

+Yes, there's lots of commercial activity using Python. See +http://www.python.org/psa/Users.html for a list. +

+ +Edit this entry / +Log info + +/ Last changed on Wed Oct 14 18:17:33 1998 by +ken +

+ +


+

2.4. How stable is Python?

+Very stable. New, stable releases have been coming out roughly every 3 to 12 months since 1991, and this seems likely to continue. +

+With the introduction of retrospective "bugfix" releases the stability of the language implementations can be, and is being, improved independently of the new features offered by more recent major or minor releases. Bugfix releases, indicated by a third component of the version number, only fix known problems and do not gratuitously introduce new and possibly incompatible features or modified library functionality. +

+Release 2.2 got its first bugfix on April 10, 2002. The new version +number is now 2.2.1. The 2.1 release, at 2.1.3, can probably be +considered the "most stable" platform because it has been bugfixed +twice. +

+ +Edit this entry / +Log info + +/ Last changed on Tue Jul 23 10:20:04 2002 by +Jens Kubieziel +

+ +


+

2.5. What new developments are expected for Python in the future?

+See http://www.python.org/peps/ for the Python Enhancement +Proposals (PEPs). PEPs are design +documents +describing a suggested new feature for Python, providing +a concise technical specification and a rationale. +

+Also, follow the discussions on the python-dev mailing list. +

+ +Edit this entry / +Log info + +/ Last changed on Tue Apr 9 17:09:51 2002 by +A.M. Kuchling +

+ +


+

2.6. Is it reasonable to propose incompatible changes to Python?

+In general, no. There are already millions of lines of Python code +around the world, so any changes in the language that invalidates more +than a very small fraction of existing programs has to be frowned +upon. Even if you can provide a conversion program, there still is +the problem of updating all documentation. Providing a gradual +upgrade path is the only way if a feature has to be changed. +

+See http://www.python.org/peps/pep-0005.html for the proposed +mechanism for creating backwards-incompatibilities. +

+ +Edit this entry / +Log info + +/ Last changed on Mon Apr 1 22:13:47 2002 by +Fred Drake +

+ +


+

2.7. What is the future of Python?

+Please see http://www.python.org/peps/ for proposals of future +activities. One of the PEPs (Python Enhancement Proposals) deals +with the PEP process and PEP format -- see +http://www.python.org/peps/pep-0001.html if you want to +submit a PEP. In http://www.python.org/peps/pep-0042.html there +is a list of wishlists the Python Development team plans to tackle. +

+ +Edit this entry / +Log info + +/ Last changed on Mon Apr 1 22:15:46 2002 by +Fred Drake +

+ +


+

2.8. What was the PSA, anyway?

+The Python Software Activity was +created by a number of Python aficionados who want Python to be more +than the product and responsibility of a single individual. +The PSA was not an independent organization, but lived +under the umbrealla of CNRI. +

+The PSA has been superseded by the Python Software Foundation, +an independent non-profit organization. The PSF's home page +is at http://www.python.org/psf/. +

+Some pages created by the PSA still live at +http://www.python.org/psa/ +

+ +Edit this entry / +Log info + +/ Last changed on Thu Jul 25 18:19:44 2002 by +GvR +

+ +


+

2.9. Deleted

+

+

+ +Edit this entry / +Log info + +/ Last changed on Tue Jan 2 02:51:30 2001 by +Moshe Zadka +

+ +


+

2.10. Deleted

+

+

+ +Edit this entry / +Log info + +/ Last changed on Tue Jan 2 02:52:19 2001 by +Moshe Zadka +

+ +


+

2.11. Is Python Y2K (Year 2000) Compliant?

+As of January, 2001 no major problems have been reported and Y2K +compliance seems to be a non-issue. +

+Since Python is available free of charge, there are no absolute +guarantees. If there are unforeseen problems, liability is the +user's rather than the developers', and there is nobody you can sue for damages. +

+Python does few +date manipulations, and what it does is all based on the Unix +representation for time (even on non-Unix systems) which uses seconds +since 1970 and won't overflow until 2038. +

+ +Edit this entry / +Log info + +/ Last changed on Mon Jan 8 17:19:32 2001 by +Steve Holden +

+ +


+

2.12. Is Python a good language in a class for beginning programmers?

+Yes. This long answer attempts to address any concerns you might +have with teaching Python as a programmer's first language. +(If you want to discuss Python's use in education, then +you may be interested in joining the edu-sig mailinglist. +See http://www.python.org/sigs/edu-sig/ ) +

+It is still common to start students with a procedural +(subset of a) statically typed language such as Pascal, C, or +a subset of C++ or Java. I think that students may be better +served by learning Python as their first language. Python has +a very simple and consistent syntax and a large standard library. +Most importantly, using Python in a beginning programming course +permits students to concentrate on important programming skills, +such as problem decomposition and data type design. +

+With Python, students can be quickly introduced to basic concepts +such as loops and procedures. They can even probably work with +user-defined objects in their very first course. They could +implement a tree structure as nested Python lists, for example. +They could be introduced to objects in their first course if +desired. For a student who has never programmed before, using +a statically typed language seems unnatural. It presents +additional complexity that the student must master and slows +the pace of the course. The students are trying to learn to +think like a computer, decompose problems, design consistent +interfaces, and encapsulate data. While learning to use a +statically typed language is important, it is not necessarily the +best topic to address in the students' first programming course. +

+Many other aspects of Python make it a good first language. +Python has a large standard library (like Java) so that +students can be assigned programming projects very early in the +course that do something. Assignments aren't restricted to the +standard four-function calculator and check balancing programs. +By using the standard library, students can gain the satisfaction +of working on realistic applications as they learn the fundamentals +of programming. Using the standard library also teaches students +about code reuse. +

+Python's interactive interpreter also enables students to +test language features while they're programming. They can keep +a window with the interpreter running while they enter their +programs' source in another window. If they can't remember the +methods for a list, they can do something like this: +

+

+ >>> L = []
+ >>> dir(L)
+ ['append', 'count', 'extend', 'index', 'insert', 'pop', 'remove',
+ 'reverse', 'sort']
+ >>> print L.append.__doc__
+ L.append(object) -- append object to end
+ >>> L.append(1)
+ >>> L
+ [1]
+
+With the interpreter, documentation is never far from the +student as he's programming. +

+There are also good IDEs for Python. Guido van Rossum's IDLE +is a cross-platform IDE for Python that is written in Python +using Tk. There is also a Windows specific IDE called PythonWin. +Emacs users will be happy to know that there is a very good Python +mode for Emacs. All of these programming environments provide +syntax highlighting, auto-indenting, and access to the interactive +interpreter while coding. For more information about IDEs, see XXX. +

+If your department is currently using Pascal because it was +designed to be a teaching language, then you'll be happy to +know that Guido van Rossum designed Python to be simple to +teach to everyone but powerful enough to implement real world +applications. Python makes a good language for first time +programmers because that was one of Python's design goals. +There are papers at http://www.python.org/doc/essays/ on the Python website +by Python's creator explaining his objectives for the language. +One that may interest you is titled "Computer Programming for Everybody" +http://www.python.org/doc/essays/cp4e.html +

+If you're seriously considering Python as a language for your +school, Guido van Rossum may even be willing to correspond with +you about how the language would fit in your curriculum. +See http://www.python.org/doc/FAQ.html#2.2 for examples of +Python's use in the "real world." +

+While Python, its source code, and its IDEs are freely +available, this consideration should not rule +out other languages. There are other free languages (Java, +free C compilers), and many companies are willing to waive some +or all of their fees for student programming tools if it +guarantees that a whole graduating class will know how to +use their tools. That is, if one of the requirements for +the language that will be taught is that it be freely +available, then Python qualifies, but this requirement +does not preclude other languages. +

+While Python jobs may not be as prevalent as C/C++/Java jobs, +teachers should not worry about teaching students critical job +skills in their first course. The skills that win students a +job are those they learn in their senior classes and internships. +Their first programming courses are there to lay a solid +foundation in programming fundamentals. The primary question +in choosing the language for such a course should be which +language permits the students to learn this material without +hindering or limiting them. +

+Another argument for Python is that there are many tasks for +which something like C++ is overkill. That's where languages +like Python, Perl, Tcl, and Visual Basic thrive. It's critical +for students to know something about these languages. (Every +employer for whom I've worked used at least one such language.) +Of the languages listed above, Python probably makes the best +language in a programming curriculum since its syntax is simple, +consistent, and not unlike other languages (C/C++/Java) that +are probably in the curriculum. By starting students with +Python, a department simultaneously lays the foundations for +other programming courses and introduces students to the type +of language that is often used as a "glue" language. As an +added bonus, Python can be used to interface with Microsoft's +COM components (thanks to Mark Hammond). There is also Jython, +a Java implementation of the Python interpreter, that can be +used to connect Java components. +

+If you currently start students with Pascal or C/C++ or Java, +you may be worried they will have trouble learning a statically +typed language after starting with Python. I think that this +fear most often stems from the fact that the teacher started +with a statically typed language, and we tend to like to teach +others in the same way we were taught. In reality, the +transition from Python to one of these other languages is +quite simple. +

+To motivate a statically typed language such as C++, begin the +course by explaining that unlike Python, their first language, +C++ is compiled to a machine dependent executable. Explain +that the point is to make a very fast executable. To permit +the compiler to make optimizations, programmers must help it +by specifying the "types" of variables. By restricting each +variable to a specific type, the compiler can reduce the +book-keeping it has to do to permit dynamic types. The compiler +also has to resolve references at compile time. Thus, the +language gains speed by sacrificing some of Python's dynamic +features. Then again, the C++ compiler provides type safety +and catches many bugs at compile time instead of run time (a +critical consideration for many commercial applications). C++ +is also designed for very large programs where one may want to +guarantee that others don't touch an object's implementation. +C++ provides very strong language features to separate an object's +implementation from its interface. Explain why this separation +is a good thing. +

+The first day of a C++ course could then be a whirlwind introduction +to what C++ requires and provides. The point here is that after +a semester or two of Python, students are hopefully competent +programmers. They know how to handle loops and write procedures. +They've also worked with objects, thought about the benefits of +consistent interfaces, and used the technique of subclassing to +specialize behavior. Thus, a whirlwind introduction to C++ could +show them how objects and subclassing looks in C++. The +potentially difficult concepts of object-oriented design were +taught without the additional obstacles presented by a language +such as C++ or Java. When learning one of these languages, +the students would already understand the "road map." They +understand objects; they would just be learning how objects +fit in a statically typed languages. Language requirements +and compiler errors that seem unnatural to beginning programmers +make sense in this new context. Many students will find it +helpful to be able to write a fast prototype of their algorithms +in Python. Thus, they can test and debug their ideas before +they attempt to write the code in the new language, saving the +effort of working with C++ types for when they've discovered a +working solution for their assignments. When they get annoyed +with the rigidity of types, they'll be happy to learn about +containers and templates to regain some of the lost flexibility +Python afforded them. Students may also gain an appreciation +for the fact that no language is best for every task. They'll +see that C++ is faster, but they'll know that they can gain +flexibility and development speed with a Python when execution +speed isn't critical. +

+If you have any concerns that weren't addressed here, try +posting to the Python newsgroup. Others there have done some +work with using Python as an instructional tool. Good luck. +We'd love to hear about it if you choose Python for your course. +

+ +Edit this entry / +Log info + +/ Last changed on Mon Dec 2 19:32:35 2002 by +Bill Sconce +

+ +


+

3. Building Python and Other Known Bugs

+ +
+

3.1. Is there a test set?

+Sure. You can run it after building with "make test", or you can +run it manually with this command at the Python prompt: +

+

+ import test.autotest
+
+In Python 1.4 or earlier, use +

+

+ import autotest
+
+The test set doesn't test all features of Python, +but it goes a long way to confirm that Python is actually working. +

+NOTE: if "make test" fails, don't just mail the output to the +newsgroup -- this doesn't give enough information to debug the +problem. Instead, find out which test fails, and run that test +manually from an interactive interpreter. For example, if +"make test" reports that test_spam fails, try this interactively: +

+

+ import test.test_spam
+
+This generally produces more verbose output which can be diagnosed +to debug the problem. If you find a bug in Python or the libraries, or in the tests, please report this in the Python bug tracker at SourceForge: +

+http://sourceforge.net/tracker/?func=add&group_id=5470&atid=105470 +

+ +Edit this entry / +Log info + +/ Last changed on Fri Apr 27 10:29:36 2001 by +Fred Drake +

+ +


+

3.2. When running the test set, I get complaints about floating point operations, but when playing with floating point operations I cannot find anything wrong with them.

+The test set makes occasional unwarranted assumptions about the +semantics of C floating point operations. Until someone donates a +better floating point test set, you will have to comment out the +offending floating point tests and execute similar tests manually. +

+ +Edit this entry / +Log info +

+ +


+

3.3. Link errors after rerunning the configure script.

+It is generally necessary to run "make clean" after a configuration +change. +

+ +Edit this entry / +Log info +

+ +


+

3.4. The python interpreter complains about options passed to a script (after the script name).

+You are probably linking with GNU getopt, e.g. through -liberty. +Don't. The reason for the complaint is that GNU getopt, unlike System +V getopt and other getopt implementations, doesn't consider a +non-option to be the end of the option list. A quick (and compatible) +fix for scripts is to add "--" to the interpreter, like this: +

+

+        #! /usr/local/bin/python --
+
+You can also use this interactively: +

+

+        python -- script.py [options]
+
+Note that a working getopt implementation is provided in the Python +distribution (in Python/getopt.c) but not automatically used. +

+ +Edit this entry / +Log info +

+ +


+

3.5. When building on the SGI, make tries to run python to create glmodule.c, but python hasn't been built or installed yet.

+Comment out the line mentioning glmodule.c in Setup and build a +python without gl first; install it or make sure it is in your $PATH, +then edit the Setup file again to turn on the gl module, and make +again. You don't need to do "make clean"; you do need to run "make +Makefile" in the Modules subdirectory (or just run "make" at the +toplevel). +

+ +Edit this entry / +Log info +

+ +


+

3.6. I use VPATH but some targets are built in the source directory.

+On some systems (e.g. Sun), if the target already exists in the +source directory, it is created there instead of in the build +directory. This is usually because you have previously built without +VPATH. Try running "make clobber" in the source directory. +

+ +Edit this entry / +Log info +

+ +


+

3.7. Trouble building or linking with the GNU readline library.

+You can use the GNU readline library to improve the interactive user +interface: this gives you line editing and command history when +calling python interactively. Its sources are distributed with +Python (at least for 2.0). Uncomment the line +

+#readline readline.c -lreadline -ltermcap +

+in Modules/Setup. The configuration option --with-readline +is no longer supported, at least in Python 2.0. Some hints on +building and using the readline library: +On SGI IRIX 5, you may have to add the following +to rldefs.h: +

+

+        #ifndef sigmask
+        #define sigmask(sig) (1L << ((sig)-1))
+        #endif
+
+On some systems, you will have to add #include "rldefs.h" to the +top of several source files, and if you use the VPATH feature, you +will have to add dependencies of the form foo.o: foo.c to the +Makefile for several values of foo. +The readline library requires use of the termcap library. A +known problem with this is that it contains entry points which +cause conflicts with the STDWIN and SGI GL libraries. The STDWIN +conflict can be solved by adding a line saying '#define werase w_erase' to the +stdwin.h file (in the STDWIN distribution, subdirectory H). The +GL conflict has been solved in the Python configure script by a +hack that forces use of the static version of the termcap library. +Check the newsgroup gnu.bash.bug news:gnu.bash.bug for +specific problems with the readline library (I don't read this group +but I've been told that it is the place for readline bugs). +

+ +Edit this entry / +Log info + +/ Last changed on Sat Dec 2 18:23:48 2000 by +Issac Trotts +

+ +


+

3.8. Trouble with socket I/O on older Linux 1.x versions.

+Once you've built Python, use it to run the regen script in the +Lib/plat-linux2 directory. Apparently the files as distributed don't match the system headers on some Linux versions. +

+Note that this FAQ entry only applies to Linux kernel versions 1.x.y; +these are hardly around any more. +

+ +Edit this entry / +Log info + +/ Last changed on Tue Jul 30 20:05:52 2002 by +Jens Kubieziel +

+ +


+

3.9. Trouble with prototypes on Ultrix.

+Ultrix cc seems broken -- use gcc, or edit config.h to #undef +HAVE_PROTOTYPES. +

+ +Edit this entry / +Log info +

+ +


+

3.10. Other trouble building Python on platform X.

+Please submit the details to the SourceForge bug tracker: +

+

+  http://sourceforge.net/tracker/?group_id=5470&atid=105470
+
+and we'll look +into it. Please provide as many details as possible. In particular, +if you don't tell us what type of computer and what operating system +(and version) you are using it will be difficult for us to figure out +what is the matter. If you have compilation output logs, +please use file uploads -- don't paste everything in the message box. +

+In many cases, we won't have access to the same hardware or operating system version, so please, if you have a SourceForge account, log in before filing your report, or if you don't have an account, include an email address at which we can reach you for further questions. Logging in to SourceForge first will also cause SourceForge to send you updates as we act on your report. +

+ +Edit this entry / +Log info + +/ Last changed on Fri Apr 27 10:53:18 2001 by +Fred Drake +

+ +


+

3.11. How to configure dynamic loading on Linux.

+This is now automatic as long as your Linux version uses the ELF +object format (all recent Linuxes do). +

+ +Edit this entry / +Log info +

+ +


+

3.12. I can't get shared modules to work on Linux 2.0 (Slackware96)?

+This is a bug in the Slackware96 release. The fix is simple: Make sure +that there is a link from /lib/libdl.so to /lib/libdl.so.1 so that the +following links are setup: /lib/libdl.so -> /lib/libdl.so.1 +/lib/libdl.so.1 -> /lib/libdl.so.1.7.14 You may have to rerun the +configure script, after rm'ing the config.cache file, before you +attempt to rebuild python after this fix. +

+ +Edit this entry / +Log info + +/ Last changed on Wed May 21 15:45:03 1997 by +GvR +

+ +


+

3.13. Trouble when making modules shared on Linux.

+This happens when you have built Python for static linking and then +enable +
+  *shared*
+
+in the Setup file. Shared library code must be +compiled with "-fpic". If a .o file for the module already exist that +was compiled for static linking, you must remove it or do "make clean" +in the Modules directory. +

+ +Edit this entry / +Log info + +/ Last changed on Fri May 23 13:42:30 1997 by +GvR +

+ +


+

3.14. [deleted]

+[ancient information on threads on linux (when thread support +was not standard) used to be here] +

+ +Edit this entry / +Log info + +/ Last changed on Sun Jun 2 17:27:13 2002 by +Erno Kuusela +

+ +


+

3.15. Errors when linking with a shared library containing C++ code.

+Link the main Python binary with C++. Change the definition of +LINKCC in Modules/Makefile to be your C++ compiler. You may have to +edit config.c slightly to make it compilable with C++. +

+ +Edit this entry / +Log info +

+ +


+

3.16. Deleted

+

+

+ +Edit this entry / +Log info + +/ Last changed on Tue Sep 11 16:02:22 2001 by +GvR +

+ +


+

3.17. Deleted.

+

+

+ +Edit this entry / +Log info + +/ Last changed on Tue Sep 11 15:54:57 2001 by +GvR +

+ +


+

3.18. Compilation or link errors for the _tkinter module

+Most likely, there's a version mismatch between the Tcl/Tk header +files (tcl.h and tk.h) and the Tcl/Tk libraries you are using e.g. +"-ltk8.0" and "-ltcl8.0" arguments for _tkinter in the Setup file). +It is possible to install several versions of the Tcl/Tk libraries, +but there can only be one version of the tcl.h and tk.h header +files. If the library doesn't match the header, you'll get +problems, either when linking the module, or when importing it. +Fortunately, the version number is clearly stated in each file, +so this is easy to find. Reinstalling and using the latest +version usually fixes the problem. +

+(Also note that when compiling unpatched Python 1.5.1 against +Tcl/Tk 7.6/4.2 or older, you get an error on Tcl_Finalize. See +the 1.5.1 patch page at http://www.python.org/1.5/patches-1.5.1/.) +

+ +Edit this entry / +Log info + +/ Last changed on Thu Jun 11 00:49:14 1998 by +Gvr +

+ +


+

3.19. I configured and built Python for Tcl/Tk but "import Tkinter" fails.

+Most likely, you forgot to enable the line in Setup that says +"TKPATH=:$(DESTLIB)/tkinter". +

+ +Edit this entry / +Log info +

+ +


+

3.20. [deleted]

+[ancient information on a gcc+tkinter bug on alpha was here] +

+ +Edit this entry / +Log info + +/ Last changed on Mon Jun 3 16:46:23 2002 by +Erno Kuusela +

+ +


+

3.21. Several common system calls are missing from the posix module.

+Most likely, all test compilations run by the configure script +are failing for some reason or another. Have a look in config.log to +see what could be the reason. A common reason is specifying a +directory to the --with-readline option that doesn't contain the +libreadline.a file. +

+ +Edit this entry / +Log info +

+ +


+

3.22. ImportError: No module named string, on MS Windows.

+Most likely, your PYTHONPATH environment variable should be set to +something like: +

+set PYTHONPATH=c:\python;c:\python\lib;c:\python\scripts +

+(assuming Python was installed in c:\python) +

+ +Edit this entry / +Log info +

+ +


+

3.23. Core dump on SGI when using the gl module.

+There are conflicts between entry points in the termcap and curses +libraries and an entry point in the GL library. There's a hack of a +fix for the termcap library if it's needed for the GNU readline +library, but it doesn't work when you're using curses. Concluding, +you can't build a Python binary containing both the curses and gl +modules. +

+ +Edit this entry / +Log info +

+ +


+

3.24. "Initializer not a constant" while building DLL on MS-Windows

+Static type object initializers in extension modules may cause compiles to +fail with an error message like "initializer not a constant". +Fredrik Lundh <Fredrik.Lundh@image.combitech.se> explains: +

+This shows up when building DLL under MSVC. There's two ways to +address this: either compile the module as C++, or change your code to +something like: +

+

+  statichere PyTypeObject bstreamtype = {
+      PyObject_HEAD_INIT(NULL) /* must be set by init function */
+      0,
+      "bstream",
+      sizeof(bstreamobject),
+
+
+  ...
+
+
+  void
+  initbstream()
+  {
+      /* Patch object type */
+      bstreamtype.ob_type = &PyType_Type;
+      Py_InitModule("bstream", functions);
+      ...
+  }
+
+

+ +Edit this entry / +Log info + +/ Last changed on Sun May 25 14:58:05 1997 by +Aaron Watters +

+ +


+

3.25. Output directed to a pipe or file disappears on Linux.

+Some people have reported that when they run their script +interactively, it runs great, but that when they redirect it +to a pipe or file, no output appears. +

+

+    % python script.py
+    ...some output...
+    % python script.py >file
+    % cat file
+    % # no output
+    % python script.py | cat
+    % # no output
+    %
+
+This was a bug in Linux kernel. It is fixed and should not appear anymore. So most Linux users are not affected by this. +

+If redirection doesn't work on your Linux system, check what shell you are using. Shells like (t)csh doesn't support redirection. +

+ +Edit this entry / +Log info + +/ Last changed on Thu Jan 16 13:38:30 2003 by +Jens Kubieziel +

+ +


+

3.26. [deleted]

+[ancient libc/linux problem was here] +

+ +Edit this entry / +Log info + +/ Last changed on Mon Jun 3 16:48:08 2002 by +Erno Kuusela +

+ +


+

3.27. [deleted]

+[ancient linux + threads + tk problem was described here] +

+ +Edit this entry / +Log info + +/ Last changed on Mon Jun 3 16:49:08 2002 by +Erno Kuusela +

+ +


+

3.28. How can I test if Tkinter is working?

+Try the following: +

+

+  python
+  >>> import _tkinter
+  >>> import Tkinter
+  >>> Tkinter._test()
+
+This should pop up a window with two buttons, +one "Click me" and one "Quit". +

+If the first statement (import _tkinter) fails, your Python +installation probably has not been configured to support Tcl/Tk. +On Unix, if you have installed Tcl/Tk, you have to rebuild Python +after editing the Modules/Setup file to enable the _tkinter module +and the TKPATH environment variable. +

+It is also possible to get complaints about Tcl/Tk version +number mismatches or missing TCL_LIBRARY or TK_LIBRARY +environment variables. These have to do with Tcl/Tk installation +problems. +

+A common problem is to have installed versions of tcl.h and tk.h +that don't match the installed version of the Tcl/Tk libraries; +this usually results in linker errors or (when using dynamic +loading) complaints about missing symbols during loading +the shared library. +

+ +Edit this entry / +Log info + +/ Last changed on Thu Aug 28 17:01:46 1997 by +Guido van Rossum +

+ +


+

3.29. Is there a way to get the interactive mode of the python interpreter to perform function/variable name completion?

+(From a posting by Guido van Rossum) +

+On Unix, if you have enabled the readline module (i.e. if Emacs-style +command line editing and bash-style history works for you), you can +add this by importing the undocumented standard library module +"rlcompleter". When completing a simple identifier, it +completes keywords, built-ins and globals in __main__; when completing +NAME.NAME..., it evaluates (!) the expression up to the last dot and +completes its attributes. +

+This way, you can do "import string", type "string.", hit the +completion key twice, and see the list of names defined by the +string module. +

+Tip: to use the tab key as the completion key, call +

+

+    readline.parse_and_bind("tab: complete")
+
+You can put this in a ~/.pythonrc file, and set the PYTHONSTARTUP +environment variable to ~/.pythonrc. This will cause the completion to be enabled +whenever you run Python interactively. +

+Notes (see the docstring for rlcompleter.py for more information): +

+* The evaluation of the NAME.NAME... form may cause arbitrary +application defined code to be executed if an object with a +__getattr__ hook is found. Since it is the responsibility of the +application (or the user) to enable this feature, I consider this an +acceptable risk. More complicated expressions (e.g. function calls or +indexing operations) are not evaluated. +

+* GNU readline is also used by the built-in functions input() and +raw_input(), and thus these also benefit/suffer from the complete +features. Clearly an interactive application can benefit by +specifying its own completer function and using raw_input() for all +its input. +

+* When stdin is not a tty device, GNU readline is never +used, and this module (and the readline module) are silently inactive. +

+ +Edit this entry / +Log info + +/ Last changed on Fri Jun 12 09:55:24 1998 by +A.M. Kuchling +

+ +


+

3.30. Why is the Python interpreter not built as a shared library?

+(This is a Unix question; on Mac and Windows, it is a shared +library.) +

+It's just a nightmare to get this to work on all different platforms. +Shared library portability is a pain. And yes, I know about GNU libtool +-- but it requires me to use its conventions for filenames etc, and it +would require a complete and utter rewrite of all the makefile and +config tools I'm currently using. +

+In practice, few applications embed Python -- it's much more common to +have Python extensions, which already are shared libraries. Also, +serious embedders often want total control over which Python version +and configuration they use so they wouldn't want to use a standard +shared library anyway. So while the motivation of saving space +when lots of apps embed Python is nice in theory, I +doubt that it will save much in practice. (Hence the low priority I +give to making a shared library.) +

+For Linux systems, the simplest method of producing libpython1.5.so seems to +be (originally from the Minotaur project web page, +http://www.equi4.com/minotaur/minotaur.html): +

+

+  make distclean 
+  ./configure 
+  make OPT="-fpic -O2" 
+  mkdir .extract 
+  (cd .extract; ar xv ../libpython1.5.a) 
+  gcc -shared -o libpython1.5.so .extract/*.o 
+  rm -rf .extract
+
+In Python 2.3 this will be supported by the standard build routine +(at least on Linux) with --enable-shared. Note however that there +is little advantage, and it slows down Python because of the need +for PIC code and the extra cost at startup time to find the library. +

+ +Edit this entry / +Log info + +/ Last changed on Thu May 30 13:36:55 2002 by +GvR +

+ +


+

3.31. Build with GCC on Solaris 2.6 (SunOS 5.6) fails

+If you have upgraded Solaris 2.5 or 2.5.1 to Solaris 2.6, +but you have not upgraded +your GCC installation, the compile may fail, e.g. like this: +

+

+ In file included from /usr/include/sys/stream.h:26,
+                  from /usr/include/netinet/in.h:38,
+                  from /usr/include/netdb.h:96,
+                  from ./socketmodule.c:121:
+ /usr/include/sys/model.h:32: #error "No DATAMODEL_NATIVE specified"
+
+Solution: rebuild GCC for Solaris 2.6. +You might be able to simply re-run fixincludes, but +people have had mixed success with doing that. +

+ +Edit this entry / +Log info + +/ Last changed on Wed Oct 21 11:18:46 1998 by +GvR +

+ +


+

3.32. Running "make clean" seems to leave problematic files that cause subsequent builds to fail.

+Use "make clobber" instead. +

+Use "make clean" to reduce the size of the source/build directory +after you're happy with your build and installation. +If you have already tried to build python and you'd like to start +over, you should use "make clobber". It does a "make clean" and also +removes files such as the partially built Python library from a previous build. +

+ +Edit this entry / +Log info + +/ Last changed on Thu Jun 24 20:39:26 1999 by +TAB +

+ +


+

3.33. Submitting bug reports and patches

+To report a bug or submit a patch, please use the relevant service +from the Python project at SourceForge. +

+Bugs: http://sourceforge.net/tracker/?group_id=5470&atid=105470 +

+Patches: http://sourceforge.net/tracker/?group_id=5470&atid=305470 +

+If you have a SourceForge account, please log in before submitting your bug report; this will make it easier for us to contact you regarding your report in the event we have follow-up questions. It will also enable SourceForge to send you update information as we act on your bug. If you do not have a SourceForge account, please consider leaving your name and email address as part of the report. +

+ +Edit this entry / +Log info + +/ Last changed on Fri Apr 27 10:58:26 2001 by +Fred Drake +

+ +


+

3.34. I can't load shared libraries under Python 1.5.2, Solaris 7, and gcc 2.95.2

+When trying to load shared libraries, you may see errors like: +ImportError: ld.so.1: python: fatal: relocation error: file /usr/local/lib/python1.5/site-packages/Perp/util/du_SweepUtilc.so: +
+ symbol PyExc_RuntimeError: referenced symbol not found
+
+

+There is a problem with the configure script for Python 1.5.2 +under Solaris 7 with gcc 2.95 . configure should set the make variable +LINKFORSHARED=-Xlinker -export-dynamic +

+

+in Modules/Makefile, +

+Manually add this line to the Modules/Makefile. +This builds a Python executable that can load shared library extensions (xxx.so) . +

+ +Edit this entry / +Log info + +/ Last changed on Mon Feb 19 10:37:05 2001 by +GvR +

+ +


+

3.35. In the regression test, test___all__ fails for the profile module. What's wrong?

+If you have been using the profile module, and have properly calibrated a copy of the module as described in the documentation for the profiler: +

+http://www.python.org/doc/current/lib/profile-calibration.html +

+then it is possible that the regression test "test___all__" will fail if you run the regression test manually rather than using "make test" in the Python source directory. This will happen if you have set your PYTHONPATH environment variable to include the directory containing your calibrated profile module. You have probably calibrated the profiler using an older version of the profile module which does not define the __all__ value, added to the module as of Python 2.1. +

+The problem can be fixed by removing the old calibrated version of the profile module and using the latest version to do a fresh calibration. In general, you will need to re-calibrate for each version of Python anyway, since the performance characteristics can change in subtle ways that impact profiling. +

+ +Edit this entry / +Log info + +/ Last changed on Fri Apr 27 10:44:10 2001 by +Fred Drake +

+ +


+

3.36. relocations remain against allocatable but non-writable sections

+This linker error occurs on Solaris if you attempt to build an extension module which incorporates position-dependent (non-PIC) code. A common source of problems is that a static library (.a file), such as libreadline.a or libcrypto.a is linked with the extension module. The error specifically occurs when using gcc as the compiler, but /usr/ccs/bin/ld as the linker. +

+The following solutions and work-arounds are known: +

+1. Rebuild the libraries (libreadline, libcrypto) with -fPIC (-KPIC if using the system compiler). This is recommended; all object files in a shared library should be position-independent. +

+2. Statically link the extension module and its libraries into the Python interpreter, by editing Modules/Setup. +

+3. Use GNU ld instead of /usr/ccs/bin/ld; GNU ld will accept non-PIC code in shared libraries (and mark the section writable) +

+4. Pass -mimpure-text to GCC when linking the module. This will force gcc to not pass -z text to ld; in turn, ld will make all text sections writable. +

+Options 3 and 4 are not recommended, since the ability to share code across processes is lost. +

+ +Edit this entry / +Log info + +/ Last changed on Tue Jan 29 12:05:11 2002 by +Martin v. Löwis +

+ +


+

4. Programming in Python

+ +
+

4.1. Is there a source code level debugger with breakpoints, step, etc.?

+Yes. +

+Module pdb is a rudimentary but adequate console-mode debugger for Python. It is part of the standard Python library, and is documented in the Library Reference Manual. (You can also write your own debugger by using the code for pdb as an example.) +

+The IDLE interactive development environment, which is part of the standard Python distribution (normally available in Tools/idle), includes a graphical debugger. There is documentation for the IDLE debugger at http://www.python.org/idle/doc/idle2.html#Debugger +

+Pythonwin is a Python IDE that includes a GUI debugger based on bdb. The Pythonwin debugger colors breakpoints and has quite a few cool features (including debugging non-Pythonwin programs). A reference can be found at http://www.python.org/ftp/python/pythonwin/pwindex.html +More recent versions of PythonWin are available as a part of the ActivePython distribution (see http://www.activestate.com/Products/ActivePython/index.html). +

+Pydb is a version of the standard Python debugger pdb, modified for use with DDD (Data Display Debugger), a popular graphical debugger front end. Pydb can be found at http://packages.debian.org/unstable/devel/pydb.html +and DDD can be found at http://www.gnu.org/software/ddd/ +

+There are a number of commmercial Python IDEs that include graphical debuggers. They include: +

+

+ * Wing IDE (http://wingide.com/) 
+ * Komodo IDE (http://www.activestate.com/Products/Komodo/)
+
+

+ +Edit this entry / +Log info + +/ Last changed on Tue Jan 28 01:43:41 2003 by +Stephen Ferg +

+ +


+

4.2. Can I create an object class with some methods implemented in C and others in Python (e.g. through inheritance)? (Also phrased as: Can I use a built-in type as base class?)

+In Python 2.2, you can inherit from builtin classes such as int, list, dict, etc. +

+In previous versions of Python, you can easily create a Python class which serves as a wrapper around a built-in object, e.g. (for dictionaries): +

+

+        # A user-defined class behaving almost identical
+        # to a built-in dictionary.
+        class UserDict:
+                def __init__(self): self.data = {}
+                def __repr__(self): return repr(self.data)
+                def __cmp__(self, dict):
+                        if type(dict) == type(self.data):
+                                return cmp(self.data, dict)
+                        else:
+                                return cmp(self.data, dict.data)
+                def __len__(self): return len(self.data)
+                def __getitem__(self, key): return self.data[key]
+                def __setitem__(self, key, item): self.data[key] = item
+                def __delitem__(self, key): del self.data[key]
+                def keys(self): return self.data.keys()
+                def items(self): return self.data.items()
+                def values(self): return self.data.values()
+                def has_key(self, key): return self.data.has_key(key)
+
+A2. See Jim Fulton's ExtensionClass for an example of a mechanism +which allows you to have superclasses which you can inherit from in +Python -- that way you can have some methods from a C superclass (call +it a mixin) and some methods from either a Python superclass or your +subclass. ExtensionClass is distributed as a part of Zope (see +http://www.zope.org), but will be phased out with Zope 3, since +Zope 3 uses Python 2.2 or later which supports direct inheritance +from built-in types. Here's a link to the original paper about +ExtensionClass: +http://debian.acm.ndsu.nodak.edu/doc/python-extclass/ExtensionClass.html +

+A3. The Boost Python Library (BPL, http://www.boost.org/libs/python/doc/index.html) +provides a way of doing this from C++ (i.e. you can inherit from an +extension class written in C++ using the BPL). +

+ +Edit this entry / +Log info + +/ Last changed on Tue May 28 21:09:52 2002 by +GvR +

+ +


+

4.3. Is there a curses/termcap package for Python?

+The standard Python source distribution comes with a curses module in +the Modules/ subdirectory, though it's not compiled by default (note +that this is not available in the Windows distribution -- there is +no curses module for Windows). +

+In Python versions before 2.0 the module only supported plain curses; +you couldn't use ncurses features like colors with it (though it would +link with ncurses). +

+In Python 2.0, the curses module has been greatly extended, starting +from Oliver Andrich's enhanced version, to provide many additional +functions from ncurses and SYSV curses, such as colour, alternative +character set support, pads, and mouse support. This means the +module is no longer compatible with operating systems that only +have BSD curses, but there don't seem to be any currently +maintained OSes that fall into this category. +

+ +Edit this entry / +Log info + +/ Last changed on Sun Jun 23 20:24:06 2002 by +Tim Peters +

+ +


+

4.4. Is there an equivalent to C's onexit() in Python?

+For Python 2.0: The new atexit module provides a register function that +is similar to C's onexit. See the Library Reference for details. For +2.0 you should not assign to sys.exitfunc! +

+For Python 1.5.2: You need to import sys and assign a function to +sys.exitfunc, it will be called when your program exits, is +killed by an unhandled exception, or (on UNIX) receives a +SIGHUP or SIGTERM signal. +

+ +Edit this entry / +Log info + +/ Last changed on Thu Dec 28 12:14:55 2000 by +Bjorn Pettersen +

+ +


+

4.5. [deleted]

+[python used to lack nested scopes, it was explained here] +

+ +Edit this entry / +Log info + +/ Last changed on Thu Mar 21 05:18:22 2002 by +Erno Kuusela +

+ +


+

4.6. How do I iterate over a sequence in reverse order?

+If it is a list, the fastest solution is +

+

+        list.reverse()
+        try:
+                for x in list:
+                        "do something with x"
+        finally:
+                list.reverse()
+
+This has the disadvantage that while you are in the loop, the list +is temporarily reversed. If you don't like this, you can make a copy. +This appears expensive but is actually faster than other solutions: +

+

+        rev = list[:]
+        rev.reverse()
+        for x in rev:
+                <do something with x>
+
+If it's not a list, a more general but slower solution is: +

+

+        for i in range(len(sequence)-1, -1, -1):
+                x = sequence[i]
+                <do something with x>
+
+A more elegant solution, is to define a class which acts as a sequence +and yields the elements in reverse order (solution due to Steve +Majewski): +

+

+        class Rev:
+                def __init__(self, seq):
+                        self.forw = seq
+                def __len__(self):
+                        return len(self.forw)
+                def __getitem__(self, i):
+                        return self.forw[-(i + 1)]
+
+You can now simply write: +

+

+        for x in Rev(list):
+                <do something with x>
+
+Unfortunately, this solution is slowest of all, due to the method +call overhead... +

+ +Edit this entry / +Log info + +/ Last changed on Sun May 25 21:10:50 1997 by +GvR +

+ +


+

4.7. My program is too slow. How do I speed it up?

+That's a tough one, in general. There are many tricks to speed up +Python code; I would consider rewriting parts in C only as a last +resort. One thing to notice is that function and (especially) method +calls are rather expensive; if you have designed a purely OO interface +with lots of tiny functions that don't do much more than get or set an +instance variable or call another method, you may consider using a +more direct way, e.g. directly accessing instance variables. Also see +the standard module "profile" (described in the Library Reference +manual) which makes it possible to find out where +your program is spending most of its time (if you have some patience +-- the profiling itself can slow your program down by an order of +magnitude). +

+Remember that many standard optimization heuristics you +may know from other programming experience may well apply +to Python. For example it may be faster to send output to output +devices using larger writes rather than smaller ones in order to +avoid the overhead of kernel system calls. Thus CGI scripts +that write all output in "one shot" may be notably faster than +those that write lots of small pieces of output. +

+Also, be sure to use "aggregate" operations where appropriate. +For example the "slicing" feature allows programs to chop up +lists and other sequence objects in a single tick of the interpreter +mainloop using highly optimized C implementations. Thus to +get the same effect as +

+

+  L2 = []
+  for i in range[3]:
+       L2.append(L1[i])
+
+it is much shorter and far faster to use +

+

+  L2 = list(L1[:3]) # "list" is redundant if L1 is a list.
+
+Note that the map() function, particularly used with +builtin methods or builtin functions can be a convenient +accelerator. For example to pair the elements of two +lists together: +

+

+  >>> map(None, [1,2,3], [4,5,6])
+  [(1, 4), (2, 5), (3, 6)]
+
+or to compute a number of sines: +

+

+  >>> map( math.sin, (1,2,3,4))
+  [0.841470984808, 0.909297426826, 0.14112000806,   -0.756802495308]
+
+The map operation completes very quickly in such cases. +

+Other examples of aggregate operations include the join and split +methods of string objects. For example if s1..s7 are large (10K+) strings then +"".join([s1,s2,s3,s4,s5,s6,s7]) may be far faster than +the more obvious s1+s2+s3+s4+s5+s6+s7, since the "summation" +will compute many subexpressions, whereas join does all +copying in one pass. For manipulating strings also consider the +regular expression libraries and the "substitution" operations +String % tuple and String % dictionary. Also be sure to use +the list.sort builtin method to do sorting, and see FAQ's 4.51 +and 4.59 for examples of moderately advanced usage -- list.sort beats +other techniques for sorting in all but the most extreme +circumstances. +

+There are many other aggregate operations +available in the standard libraries and in contributed libraries +and extensions. +

+Another common trick is to "push loops into functions or methods." +For example suppose you have a program that runs slowly and you +use the profiler (profile.run) to determine that a Python function ff +is being called lots of times. If you notice that ff +

+

+   def ff(x):
+       ...do something with x computing result...
+       return result
+
+tends to be called in loops like (A) +

+

+   list = map(ff, oldlist)
+
+or (B) +

+

+   for x in sequence:
+       value = ff(x)
+       ...do something with value...
+
+then you can often eliminate function call overhead by rewriting +ff to +

+

+   def ffseq(seq):
+       resultseq = []
+       for x in seq:
+           ...do something with x computing result...
+           resultseq.append(result)
+       return resultseq
+
+and rewrite (A) to +

+

+    list = ffseq(oldlist)
+
+and (B) to +

+

+    for value in ffseq(sequence):
+        ...do something with value...
+
+Other single calls ff(x) translate to ffseq([x])[0] with little +penalty. Of course this technique is not always appropriate +and there are other variants, which you can figure out. +

+You can gain some performance by explicitly storing the results of +a function or method lookup into a local variable. A loop like +

+

+    for key in token:
+        dict[key] = dict.get(key, 0) + 1
+
+resolves dict.get every iteration. If the method isn't going to +change, a faster implementation is +

+

+    dict_get = dict.get  # look up the method once
+    for key in token:
+        dict[key] = dict_get(key, 0) + 1
+
+Default arguments can be used to determine values once, at +compile time instead of at run time. This can only be done for +functions or objects which will not be changed during program +execution, such as replacing +

+

+    def degree_sin(deg):
+        return math.sin(deg * math.pi / 180.0)
+
+with +

+

+    def degree_sin(deg, factor = math.pi/180.0, sin = math.sin):
+        return sin(deg * factor)
+
+Because this trick uses default arguments for terms which should +not be changed, it should only be used when you are not concerned +with presenting a possibly confusing API to your users. +

+

+For an anecdote related to optimization, see +

+

+	http://www.python.org/doc/essays/list2str.html
+
+

+ +Edit this entry / +Log info + +/ Last changed on Mon Jun 3 01:03:54 2002 by +Neal Norwitz +

+ +


+

4.8. When I have imported a module, then edit it, and import it again (into the same Python process), the changes don't seem to take place. What is going on?

+For reasons of efficiency as well as consistency, Python only reads +the module file on the first time a module is imported. (Otherwise a +program consisting of many modules, each of which imports the same +basic module, would read the basic module over and over again.) To +force rereading of a changed module, do this: +

+

+        import modname
+        reload(modname)
+
+Warning: this technique is not 100% fool-proof. In particular, +modules containing statements like +

+

+        from modname import some_objects
+
+will continue to work with the old version of the imported objects. +

+ +Edit this entry / +Log info +

+ +


+

4.9. How do I find the current module name?

+A module can find out its own module name by looking at the +(predefined) global variable __name__. If this has the value +'__main__' you are running as a script. +

+ +Edit this entry / +Log info +

+ +


+

4.10. I have a module in which I want to execute some extra code when it is run as a script. How do I find out whether I am running as a script?

+See the previous question. E.g. if you put the following on the +last line of your module, main() is called only when your module is +running as a script: +

+

+        if __name__ == '__main__': main()
+
+

+ +Edit this entry / +Log info +

+ +


+

4.11. I try to run a program from the Demo directory but it fails with ImportError: No module named ...; what gives?

+This is probably an optional module (written in C!) which hasn't +been configured on your system. This especially happens with modules +like "Tkinter", "stdwin", "gl", "Xt" or "Xm". For Tkinter, STDWIN and +many other modules, see Modules/Setup.in for info on how to add these +modules to your Python, if it is possible at all. Sometimes you will +have to ftp and build another package first (e.g. Tcl and Tk for Tkinter). +Sometimes the module only works on specific platforms (e.g. gl only works +on SGI machines). +

+NOTE: if the complaint is about "Tkinter" (upper case T) and you have +already configured module "tkinter" (lower case t), the solution is +not to rename tkinter to Tkinter or vice versa. There is probably +something wrong with your module search path. Check out the value of +sys.path. +

+For X-related modules (Xt and Xm) you will have to do more work: they +are currently not part of the standard Python distribution. You will +have to ftp the Extensions tar file, i.e. +ftp://ftp.python.org/pub/python/src/X-extension.tar.gz and follow +the instructions there. +

+ +Edit this entry / +Log info + +/ Last changed on Wed Feb 12 21:31:08 2003 by +Jens Kubieziel +

+ +


+

4.12. [deleted]

+[stdwin (long dead windowing library) entry deleted] +

+ +Edit this entry / +Log info + +/ Last changed on Thu Mar 21 08:30:13 2002 by +Erno Kuusela +

+ +


+

4.13. What GUI toolkits exist for Python?

+Depending on what platform(s) you are aiming at, there are several. +

+Currently supported solutions: +

+Cross-platform: +

+Tk: +

+There's a neat object-oriented interface to the Tcl/Tk widget set, +called Tkinter. It is part of the standard Python distribution and +well-supported -- all you need to do is build and install Tcl/Tk and +enable the _tkinter module and the TKPATH definition in Modules/Setup +when building Python. This is probably the easiest to install and +use, and the most complete widget set. It is also very likely that in +the future the standard Python GUI API will be based on or at least +look very much like the Tkinter interface. For more info about Tk, +including pointers to the source, see the Tcl/Tk home page at +http://www.scriptics.com. Tcl/Tk is now fully +portable to the Mac and Windows platforms (NT and 95 only); you need +Python 1.4beta3 or later and Tk 4.1patch1 or later. +

+wxWindows: +

+There's an interface to wxWindows called wxPython. wxWindows is a +portable GUI class library written in C++. It supports GTK, Motif, +MS-Windows and Mac as targets. Ports to other platforms are being +contemplated or have already had some work done on them. wxWindows +preserves the look and feel of the underlying graphics toolkit, and +there is quite a rich widget set and collection of GDI classes. +See the wxWindows page at http://www.wxwindows.org/ for more details. +wxPython is a python extension module that wraps many of the wxWindows +C++ classes, and is quickly gaining popularity amongst Python +developers. You can get wxPython as part of the source or CVS +distribution of wxWindows, or directly from its home page at +http://alldunn.com/wxPython/. +

+Gtk+: +

+PyGtk bindings for the Gtk+ Toolkit by James Henstridge exist; see ftp://ftp.daa.com.au/pub/james/python/. Note that there are two incompatible bindings. If you are using Gtk+ 1.2.x you should get the 0.6.x PyGtk bindings from +

+

+    ftp://ftp.gtk.org/pub/python/v1.2
+
+If you plan to use Gtk+ 2.0 with Python (highly recommended if you are just starting with Gtk), get the most recent distribution from +

+

+    ftp://ftp.gtk.org/pub/python/v2.0
+
+If you are adventurous, you can also check out the source from the Gnome CVS repository. Set your CVS directory to :pserver:anonymous@anoncvs.gnome.org:/cvs/gnome and check the gnome-python module out from the repository. +

+Other: +

+There are also bindings available for the Qt toolkit (PyQt), and for KDE (PyKDE); see http://www.thekompany.com/projects/pykde/. +

+For OpenGL bindings, see http://starship.python.net/~da/PyOpenGL. +

+Platform specific: +

+The Mac port has a rich and ever-growing set of modules that support +the native Mac toolbox calls. See the documentation that comes with +the Mac port. See ftp://ftp.python.org/pub/python/mac. Support +by Jack Jansen jack@cwi.nl. +

+Pythonwin by Mark Hammond (MHammond@skippinet.com.au) +includes an interface to the Microsoft Foundation +Classes and a Python programming environment using it that's written +mostly in Python. See http://www.python.org/windows/. +

+There's an object-oriented GUI based on the Microsoft Foundation +Classes model called WPY, supported by Jim Ahlstrom jim@interet.com. +Programs written in WPY run unchanged and with native look and feel on +Windows NT/95, Windows 3.1 (using win32s), and on Unix (using Tk). +Source and binaries for Windows and Linux are available in +ftp://ftp.python.org/pub/python/wpy/. +

+Obsolete or minority solutions: +

+There's an interface to X11, including the Athena and Motif widget +sets (and a few individual widgets, like Mosaic's HTML widget and +SGI's GL widget) available from +ftp://ftp.python.org/pub/python/src/X-extension.tar.gz. +Support by Sjoerd Mullender sjoerd@cwi.nl. +

+On top of the X11 interface there's the vpApp +toolkit by Per Spilling, now also maintained by Sjoerd Mullender +sjoerd@cwi.nl. See ftp://ftp.cwi.nl/pub/sjoerd/vpApp.tar.gz. +

+For SGI IRIX only, there are unsupported interfaces to the complete +GL (Graphics Library -- low level but very good 3D capabilities) as +well as to FORMS (a buttons-and-sliders-etc package built on top of GL +by Mark Overmars -- ftp'able from +ftp://ftp.cs.ruu.nl/pub/SGI/FORMS/). This is probably also +becoming obsolete, as OpenGL takes over (see above). +

+There's an interface to STDWIN, a platform-independent low-level +windowing interface for Mac and X11. This is totally unsupported and +rapidly becoming obsolete. The STDWIN sources are at +ftp://ftp.cwi.nl/pub/stdwin/. +

+There is an interface to WAFE, a Tcl interface to the X11 +Motif and Athena widget sets. WAFE is at +http://www.wu-wien.ac.at/wafe/wafe.html. +

+ +Edit this entry / +Log info + +/ Last changed on Mon May 13 21:40:39 2002 by +Skip Montanaro +

+ +


+

4.14. Are there any interfaces to database packages in Python?

+Yes! See the Database Topic Guide at +http://www.python.org/topics/database/ for details. +

+ +Edit this entry / +Log info + +/ Last changed on Tue Jan 4 20:12:19 2000 by +Barney Warplug +

+ +


+

4.15. Is it possible to write obfuscated one-liners in Python?

+Yes. See the following three examples, due to Ulf Bartelt: +

+

+        # Primes < 1000
+        print filter(None,map(lambda y:y*reduce(lambda x,y:x*y!=0,
+        map(lambda x,y=y:y%x,range(2,int(pow(y,0.5)+1))),1),range(2,1000)))
+
+
+        # First 10 Fibonacci numbers
+        print map(lambda x,f=lambda x,f:(x<=1) or (f(x-1,f)+f(x-2,f)): f(x,f),
+        range(10))
+
+
+        # Mandelbrot set
+        print (lambda Ru,Ro,Iu,Io,IM,Sx,Sy:reduce(lambda x,y:x+y,map(lambda y,
+        Iu=Iu,Io=Io,Ru=Ru,Ro=Ro,Sy=Sy,L=lambda yc,Iu=Iu,Io=Io,Ru=Ru,Ro=Ro,i=IM,
+        Sx=Sx,Sy=Sy:reduce(lambda x,y:x+y,map(lambda x,xc=Ru,yc=yc,Ru=Ru,Ro=Ro,
+        i=i,Sx=Sx,F=lambda xc,yc,x,y,k,f=lambda xc,yc,x,y,k,f:(k<=0)or (x*x+y*y
+        >=4.0) or 1+f(xc,yc,x*x-y*y+xc,2.0*x*y+yc,k-1,f):f(xc,yc,x,y,k,f):chr(
+        64+F(Ru+x*(Ro-Ru)/Sx,yc,0,0,i)),range(Sx))):L(Iu+y*(Io-Iu)/Sy),range(Sy
+        ))))(-2.1, 0.7, -1.2, 1.2, 30, 80, 24)
+        #    \___ ___/  \___ ___/  |   |   |__ lines on screen
+        #        V          V      |   |______ columns on screen
+        #        |          |      |__________ maximum of "iterations"
+        #        |          |_________________ range on y axis
+        #        |____________________________ range on x axis
+
+Don't try this at home, kids! +

+ +Edit this entry / +Log info + +/ Last changed on Wed May 21 15:48:33 1997 by +GvR +

+ +


+

4.16. Is there an equivalent of C's "?:" ternary operator?

+Not directly. In many cases you can mimic a?b:c with "a and b or +c", but there's a flaw: if b is zero (or empty, or None -- anything +that tests false) then c will be selected instead. In many cases you +can prove by looking at the code that this can't happen (e.g. because +b is a constant or has a type that can never be false), but in general +this can be a problem. +

+Tim Peters (who wishes it was Steve Majewski) suggested the following +solution: (a and [b] or [c])[0]. Because [b] is a singleton list it +is never false, so the wrong path is never taken; then applying [0] to +the whole thing gets the b or c that you really wanted. Ugly, but it +gets you there in the rare cases where it is really inconvenient to +rewrite your code using 'if'. +

+As a last resort it is possible to implement the "?:" operator as a function: +

+

+    def q(cond,on_true,on_false):
+        from inspect import isfunction
+
+
+        if cond:
+            if not isfunction(on_true): return on_true
+            else: return apply(on_true)
+        else:
+            if not isfunction(on_false): return on_false 
+            else: return apply(on_false)
+
+In most cases you'll pass b and c directly: q(a,b,c). To avoid evaluating b +or c when they shouldn't be, encapsulate them +within a lambda function, e.g.: q(a,lambda: b, lambda: c). +

+

+

+It has been asked why Python has no if-then-else expression, +since most language have one; it is a frequently requested feature. +

+There are several possible answers: just as many languages do +just fine without one; it can easily lead to less readable code; +no sufficiently "Pythonic" syntax has been discovered; a search +of the standard library found remarkably few places where using an +if-then-else expression would make the code more understandable. +

+Nevertheless, in an effort to decide once and for all whether +an if-then-else expression should be added to the language, +PEP 308 (http://www.python.org/peps/pep-0308.html) has been +put forward, proposing a specific syntax. The community can +now vote on this issue. +

+ +Edit this entry / +Log info + +/ Last changed on Fri Feb 7 19:41:13 2003 by +David Goodger +

+ +


+

4.17. My class defines __del__ but it is not called when I delete the object.

+There are several possible reasons for this. +

+The del statement does not necessarily call __del__ -- it simply +decrements the object's reference count, and if this reaches zero +__del__ is called. +

+If your data structures contain circular links (e.g. a tree where +each child has a parent pointer and each parent has a list of +children) the reference counts will never go back to zero. You'll +have to define an explicit close() method which removes those +pointers. Please don't ever call __del__ directly -- __del__ should +call close() and close() should make sure that it can be called more +than once for the same object. +

+If the object has ever been a local variable (or argument, which is +really the same thing) to a function that caught an expression in an +except clause, chances are that a reference to the object still exists +in that function's stack frame as contained in the stack trace. +Normally, deleting (better: assigning None to) sys.exc_traceback will +take care of this. If a stack was printed for an unhandled +exception in an interactive interpreter, delete sys.last_traceback +instead. +

+There is code that deletes all objects when the interpreter exits, +but it is not called if your Python has been configured to support +threads (because other threads may still be active). You can define +your own cleanup function using sys.exitfunc (see question 4.4). +

+Finally, if your __del__ method raises an exception, a warning message is printed to sys.stderr. +

+

+Starting with Python 2.0, a garbage collector periodically reclaims the space used by most cycles with no external references. (See the "gc" module documentation for details.) There are, however, pathological cases where it can be expected to fail. Moreover, the garbage collector runs some time after the last reference to your data structure vanishes, so your __del__ method may be called at an inconvenient and random time. This is inconvenient if you're trying to reproduce a problem. Worse, the order in which object's __del__ methods are executed is arbitrary. +

+Another way to avoid cyclical references is to use the "weakref" module, which allows you to point to objects without incrementing their reference count. Tree data structures, for instance, should use weak references for their parent and sibling pointers (if they need them!). +

+Question 6.14 is intended to explain the new garbage collection algorithm. +

+ +Edit this entry / +Log info + +/ Last changed on Mon Jun 10 15:27:28 2002 by +Matthias Urlichs +

+ +


+

4.18. How do I change the shell environment for programs called using os.popen() or os.system()? Changing os.environ doesn't work.

+You must be using either a version of python before 1.4, or on a +(rare) system that doesn't have the putenv() library function. +

+Before Python 1.4, modifying the environment passed to subshells was +left out of the interpreter because there seemed to be no +well-established portable way to do it (in particular, some systems, +have putenv(), others have setenv(), and some have none at all). As +of Python 1.4, almost all Unix systems do have putenv(), and so does +the Win32 API, and thus the os module was modified so that changes to +os.environ are trapped and the corresponding putenv() call is made. +

+ +Edit this entry / +Log info +

+ +


+

4.19. What is a class?

+A class is the particular object type created by executing +a class statement. Class objects are used as templates, to create +instance objects, which embody both the data structure +(attributes) and program routines (methods) specific to a datatype. +

+A class can be based on one or more other classes, called its base +class(es). It then inherits the attributes and methods of its base classes. This allows an object model to be successively refined +by inheritance. +

+The term "classic class" is used to refer to the original +class implementation in Python. One problem with classic +classes is their inability to use the built-in data types +(such as list and dictionary) as base classes. Starting +with Python 2.2 an attempt is in progress to unify user-defined +classes and built-in types. It is now possible to declare classes +that inherit from built-in types. +

+ +Edit this entry / +Log info + +/ Last changed on Mon May 27 01:31:21 2002 by +Steve Holden +

+ +


+

4.20. What is a method?

+A method is a function that you normally call as +x.name(arguments...) for some object x. The term is used for methods +of classes and class instances as well as for methods of built-in +objects. (The latter have a completely different implementation and +only share the way their calls look in Python code.) Methods of +classes (and class instances) are defined as functions inside the +class definition. +

+ +Edit this entry / +Log info +

+ +


+

4.21. What is self?

+Self is merely a conventional name for the first argument of a +method -- i.e. a function defined inside a class definition. A method +defined as meth(self, a, b, c) should be called as x.meth(a, b, c) for +some instance x of the class in which the definition occurs; +the called method will think it is called as meth(x, a, b, c). +

+ +Edit this entry / +Log info +

+ +


+

4.22. What is an unbound method?

+An unbound method is a method defined in a class that is not yet +bound to an instance. You get an unbound method if you ask for a +class attribute that happens to be a function. You get a bound method +if you ask for an instance attribute. A bound method knows which +instance it belongs to and calling it supplies the instance automatically; +an unbound method only knows which class it wants for its first +argument (a derived class is also OK). Calling an unbound method +doesn't "magically" derive the first argument from the context -- you +have to provide it explicitly. +

+Trivia note regarding bound methods: each reference to a bound +method of a particular object creates a bound method object. If you +have two such references (a = inst.meth; b = inst.meth), they will +compare equal (a == b) but are not the same (a is not b). +

+ +Edit this entry / +Log info + +/ Last changed on Wed May 6 18:07:25 1998 by +Clarence Gardner +

+ +


+

4.23. How do I call a method defined in a base class from a derived class that overrides it?

+If your class definition starts with "class Derived(Base): ..." +then you can call method meth defined in Base (or one of Base's base +classes) as Base.meth(self, arguments...). Here, Base.meth is an +unbound method (see previous question). +

+ +Edit this entry / +Log info +

+ +


+

4.24. How do I call a method from a base class without using the name of the base class?

+DON'T DO THIS. REALLY. I MEAN IT. It appears that you could call +self.__class__.__bases__[0].meth(self, arguments...) but this fails when +a doubly-derived method is derived from your class: for its instances, +self.__class__.__bases__[0] is your class, not its base class -- so +(assuming you are doing this from within Derived.meth) you would start +a recursive call. +

+Often when you want to do this you are forgetting that classes +are first class in Python. You can "point to" the class you want +to delegate an operation to either at the instance or at the +subclass level. For example if you want to use a "glorp" +operation of a superclass you can point to the right superclass +to use. +

+

+  class subclass(superclass1, superclass2, superclass3):
+      delegate_glorp = superclass2
+      ...
+      def glorp(self, arg1, arg2):
+            ... subclass specific stuff ...
+            self.delegate_glorp.glorp(self, arg1, arg2)
+       ...
+
+
+  class subsubclass(subclass):
+       delegate_glorp = superclass3
+       ...
+
+Note, however that setting delegate_glorp to subclass in +subsubclass would cause an infinite recursion on subclass.delegate_glorp. Careful! Maybe you are getting too fancy for your own good. Consider simplifying the design (?). +

+ +Edit this entry / +Log info + +/ Last changed on Mon Jul 28 13:58:22 1997 by +aaron watters +

+ +


+

4.25. How can I organize my code to make it easier to change the base class?

+You could define an alias for the base class, assign the real base +class to it before your class definition, and use the alias throughout +your class. Then all you have to change is the value assigned to the +alias. Incidentally, this trick is also handy if you want to decide +dynamically (e.g. depending on availability of resources) which base +class to use. Example: +

+

+        BaseAlias = <real base class>
+        class Derived(BaseAlias):
+                def meth(self):
+                        BaseAlias.meth(self)
+                        ...
+
+

+ +Edit this entry / +Log info + +/ Last changed on Wed May 21 15:49:57 1997 by +GvR +

+ +


+

4.26. How can I find the methods or attributes of an object?

+This depends on the object type. +

+For an instance x of a user-defined class, instance attributes are +found in the dictionary x.__dict__, and methods and attributes defined +by its class are found in x.__class__.__bases__[i].__dict__ (for i in +range(len(x.__class__.__bases__))). You'll have to walk the tree of +base classes to find all class methods and attributes. +

+Many, but not all built-in types define a list of their method names +in x.__methods__, and if they have data attributes, their names may be +found in x.__members__. However this is only a convention. +

+For more information, read the source of the standard (but +undocumented) module newdir. +

+ +Edit this entry / +Log info +

+ +


+

4.27. I can't seem to use os.read() on a pipe created with os.popen().

+os.read() is a low-level function which takes a file descriptor (a +small integer). os.popen() creates a high-level file object -- the +same type used for sys.std{in,out,err} and returned by the builtin +open() function. Thus, to read n bytes from a pipe p created with +os.popen(), you need to use p.read(n). +

+ +Edit this entry / +Log info +

+ +


+

4.28. How can I create a stand-alone binary from a Python script?

+Even though there are Python compilers being developed, +you probably don't need a real compiler, if all you want +is a stand-alone program. There are three solutions to that. +

+One is to use the freeze tool, which is included in the Python +source tree as Tools/freeze. It converts Python byte +code to C arrays. Using a C compiler, you can embed all +your modules into a new program, which is then linked +with the standard Python modules. +

+It works by scanning your source recursively for import statements +(in both forms) and looking for the modules in the standard Python path +as well as in the source directory (for built-in modules). It then +1 the modules written in Python to C code (array initializers +that can be turned into code objects using the marshal module) and +creates a custom-made config file that only contains those built-in +modules which are actually used in the program. It then compiles the +generated C code and links it with the rest of the Python interpreter +to form a self-contained binary which acts exactly like your script. +

+(Hint: the freeze program only works if your script's filename ends in +".py".) +

+There are several utilities which may be helpful. The first is Gordon McMillan's installer at +

+

+    http://www.mcmillan-inc.com/install1.html
+
+which works on Windows, Linux and at least some forms of Unix. +

+Another is Thomas Heller's py2exe (Windows only) at +

+

+    http://starship.python.net/crew/theller/py2exe/
+
+A third is Christian Tismer's SQFREEZE +(http://starship.python.net/crew/pirx/) which appends the byte code +to a specially-prepared Python interpreter, which +will find the byte code in executable. +

+A fourth is Fredrik Lundh's Squeeze +(http://www.pythonware.com/products/python/squeeze/). +

+ +Edit this entry / +Log info + +/ Last changed on Wed Jun 19 14:01:30 2002 by +Gordon McMillan +

+ +


+

4.29. What WWW tools are there for Python?

+See the chapters titled "Internet Protocols and Support" and +"Internet Data Handling" in the Library Reference +Manual. Python is full of good things which will help you build server-side and client-side web systems. +

+A summary of available frameworks is maintained by Paul Boddie at +

+

+    http://thor.prohosting.com/~pboddie/Python/web_modules.html
+
+Cameron Laird maintains a useful set of pages about Python web technologies at +

+

+   http://starbase.neosoft.com/~claird/comp.lang.python/web_python.html/
+
+There was a web browser written in Python, called Grail -- +see http://sourceforge.net/project/grail/. This project has been terminated; http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/grail/grail/README gives more details. +

+ +Edit this entry / +Log info + +/ Last changed on Mon Nov 11 22:48:25 2002 by +GvR +

+ +


+

4.30. How do I run a subprocess with pipes connected to both input and output?

+Use the standard popen2 module. For example: +

+

+	import popen2
+	fromchild, tochild = popen2.popen2("command")
+	tochild.write("input\n")
+	tochild.flush()
+	output = fromchild.readline()
+
+Warning: in general, it is unwise to +do this, because you can easily cause a deadlock where your +process is blocked waiting for output from the child, while the child +is blocked waiting for input from you. This can be caused +because the parent expects the child to output more text than it does, +or it can be caused by data being stuck in stdio buffers due to lack +of flushing. The Python parent can of course explicitly flush the data +it sends to the child before it reads any output, but if the child is +a naive C program it can easily have been written to never explicitly +flush its output, even if it is interactive, since flushing is +normally automatic. +

+Note that a deadlock is also possible if you use popen3 to read +stdout and stderr. If one of the two is too large for the internal +buffer (increasing the buffersize does not help) and you read() +the other one first, there is a deadlock, too. +

+Note on a bug in popen2: unless your program calls wait() +or waitpid(), finished child processes are never removed, +and eventually calls to popen2 will fail because of a limit on +the number of child processes. Calling os.waitpid with the +os.WNOHANG option can prevent this; a good place to insert such +a call would be before calling popen2 again. +

+Another way to produce a deadlock: Call a wait() and there is +still more output from the program than what fits into the +internal buffers. +

+In many cases, all you really need is to run some data through a +command and get the result back. Unless the data is infinite in size, +the easiest (and often the most efficient!) way to do this is to write +it to a temporary file and run the command with that temporary file as +input. The standard module tempfile exports a function mktemp() which +generates unique temporary file names. +

+

+ import tempfile
+ import os
+ class Popen3:
+    """
+    This is a deadlock-save version of popen, that returns
+    an object with errorlevel, out (a string) and err (a string).
+    (capturestderr may not work under windows.)
+    Example: print Popen3('grep spam','\n\nhere spam\n\n').out
+    """
+    def __init__(self,command,input=None,capturestderr=None):
+        outfile=tempfile.mktemp()
+        command="( %s ) > %s" % (command,outfile)
+        if input:
+            infile=tempfile.mktemp()
+            open(infile,"w").write(input)
+            command=command+" <"+infile
+        if capturestderr:
+            errfile=tempfile.mktemp()
+            command=command+" 2>"+errfile
+        self.errorlevel=os.system(command) >> 8
+        self.out=open(outfile,"r").read()
+        os.remove(outfile)
+        if input:
+            os.remove(infile)
+        if capturestderr:
+            self.err=open(errfile,"r").read()
+            os.remove(errfile)
+
+Note that many interactive programs (e.g. vi) don't work well with +pipes substituted for standard input and output. You will have to use +pseudo ttys ("ptys") instead of pipes. There is some undocumented +code to use these in the library module pty.py -- I'm afraid you're on +your own here. +

+A different answer is a Python interface to Don Libes' "expect" +library. A Python extension that interfaces to expect is called "expy" +and available from +http://expectpy.sourceforge.net/. +

+A pure Python solution that works like expect is pexpect of Noah Spurrier. +A beta version is available from +http://pexpect.sourceforge.net/ +

+ +Edit this entry / +Log info + +/ Last changed on Tue Sep 3 16:31:31 2002 by +Tobias Polzin +

+ +


+

4.31. How do I call a function if I have the arguments in a tuple?

+Use the built-in function apply(). For instance, +

+

+    func(1, 2, 3)
+
+is equivalent to +

+

+    args = (1, 2, 3)
+    apply(func, args)
+
+Note that func(args) is not the same -- it calls func() with exactly +one argument, the tuple args, instead of three arguments, the integers +1, 2 and 3. +

+In Python 2.0, you can also use extended call syntax: +

+f(*args) is equivalent to apply(f, args) +

+ +Edit this entry / +Log info + +/ Last changed on Tue Jan 2 03:42:50 2001 by +Moshe Zadka +

+ +


+

4.32. How do I enable font-lock-mode for Python in Emacs?

+If you are using XEmacs 19.14 or later, any XEmacs 20, FSF Emacs 19.34 +or any Emacs 20, font-lock should work automatically for you if you +are using the latest python-mode.el. +

+If you are using an older version of XEmacs or Emacs you will need +to put this in your .emacs file: +

+

+        (defun my-python-mode-hook ()
+          (setq font-lock-keywords python-font-lock-keywords)
+          (font-lock-mode 1))
+        (add-hook 'python-mode-hook 'my-python-mode-hook)
+
+

+ +Edit this entry / +Log info + +/ Last changed on Mon Apr 6 16:18:46 1998 by +Barry Warsaw +

+ +


+

4.33. Is there a scanf() or sscanf() equivalent?

+Not as such. +

+For simple input parsing, the easiest approach is usually to split +the line into whitespace-delimited words using string.split(), and to +convert decimal strings to numeric values using int(), +long() or float(). (Python's int() is 32-bit and its +long() is arbitrary precision.) string.split supports an optional +"sep" parameter which is useful if the line uses something other +than whitespace as a delimiter. +

+For more complicated input parsing, regular expressions (see module re) +are better suited and more powerful than C's sscanf(). +

+There's a contributed module that emulates sscanf(), by Steve Clift; +see contrib/Misc/sscanfmodule.c of the ftp site: +

+

+    http://www.python.org/ftp/python/contrib-09-Dec-1999/Misc/
+
+

+ +Edit this entry / +Log info + +/ Last changed on Mon Jun 3 01:07:51 2002 by +Neal Norwitz +

+ +


+

4.34. Can I have Tk events handled while waiting for I/O?

+Yes, and you don't even need threads! But you'll have to +restructure your I/O code a bit. Tk has the equivalent of Xt's +XtAddInput() call, which allows you to register a callback function +which will be called from the Tk mainloop when I/O is possible on a +file descriptor. Here's what you need: +

+

+        from Tkinter import tkinter
+        tkinter.createfilehandler(file, mask, callback)
+
+The file may be a Python file or socket object (actually, anything +with a fileno() method), or an integer file descriptor. The mask is +one of the constants tkinter.READABLE or tkinter.WRITABLE. The +callback is called as follows: +

+

+        callback(file, mask)
+
+You must unregister the callback when you're done, using +

+

+        tkinter.deletefilehandler(file)
+
+Note: since you don't know *how many bytes* are available for reading, +you can't use the Python file object's read or readline methods, since +these will insist on reading a predefined number of bytes. For +sockets, the recv() or recvfrom() methods will work fine; for other +files, use os.read(file.fileno(), maxbytecount). +

+ +Edit this entry / +Log info +

+ +


+

4.35. How do I write a function with output parameters (call by reference)?

+[Mark Lutz] The thing to remember is that arguments are passed by +assignment in Python. Since assignment just creates references to +objects, there's no alias between an argument name in the caller and +callee, and so no call-by-reference per se. But you can simulate it +in a number of ways: +

+1) By using global variables; but you probably shouldn't :-) +

+2) By passing a mutable (changeable in-place) object: +

+

+      def func1(a):
+          a[0] = 'new-value'     # 'a' references a mutable list
+          a[1] = a[1] + 1        # changes a shared object
+
+
+      args = ['old-value', 99]
+      func1(args)
+      print args[0], args[1]     # output: new-value 100
+
+3) By returning a tuple, holding the final values of arguments: +

+

+      def func2(a, b):
+          a = 'new-value'        # a and b are local names
+          b = b + 1              # assigned to new objects
+          return a, b            # return new values
+
+
+      x, y = 'old-value', 99
+      x, y = func2(x, y)
+      print x, y                 # output: new-value 100
+
+4) And other ideas that fall-out from Python's object model. For instance, it might be clearer to pass in a mutable dictionary: +

+

+      def func3(args):
+          args['a'] = 'new-value'     # args is a mutable dictionary
+          args['b'] = args['b'] + 1   # change it in-place
+
+
+      args = {'a':' old-value', 'b': 99}
+      func3(args)
+      print args['a'], args['b']
+
+5) Or bundle-up values in a class instance: +

+

+      class callByRef:
+          def __init__(self, **args):
+              for (key, value) in args.items():
+                  setattr(self, key, value)
+
+
+      def func4(args):
+          args.a = 'new-value'        # args is a mutable callByRef
+          args.b = args.b + 1         # change object in-place
+
+
+      args = callByRef(a='old-value', b=99)
+      func4(args)
+      print args.a, args.b
+
+
+   But there's probably no good reason to get this complicated :-).
+
+[Python's author favors solution 3 in most cases.] +

+ +Edit this entry / +Log info + +/ Last changed on Sun Jun 8 23:49:46 1997 by +David Ascher +

+ +


+

4.36. Please explain the rules for local and global variables in Python.

+[Ken Manheimer] In Python, procedure variables are implicitly +global, unless they are assigned anywhere within the block. +In that case +they are implicitly local, and you need to explicitly declare them as +'global'. +

+Though a bit surprising at first, a moment's consideration explains +this. On one hand, requirement of 'global' for assigned vars provides +a bar against unintended side-effects. On the other hand, if global +were required for all global references, you'd be using global all the +time. Eg, you'd have to declare as global every reference to a +builtin function, or to a component of an imported module. This +clutter would defeat the usefulness of the 'global' declaration for +identifying side-effects. +

+ +Edit this entry / +Log info + +/ Last changed on Fri Aug 28 09:53:27 1998 by +GvR +

+ +


+

4.37. How can I have modules that mutually import each other?

+Suppose you have the following modules: +

+foo.py: +

+

+	from bar import bar_var
+	foo_var=1
+
+bar.py: +

+

+	from foo import foo_var
+	bar_var=2
+
+The problem is that the above is processed by the interpreter thus: +

+

+	main imports foo
+	Empty globals for foo are created
+	foo is compiled and starts executing
+	foo imports bar
+	Empty globals for bar are created
+	bar is compiled and starts executing
+	bar imports foo (which is a no-op since there already is a module named foo)
+	bar.foo_var = foo.foo_var
+	...
+
+The last step fails, because Python isn't done with interpreting foo yet and the global symbol dict for foo is still empty. +

+The same thing happens when you use "import foo", and then try to access "foo.one" in global code. +

+

+There are (at least) three possible workarounds for this problem. +

+Guido van Rossum recommends to avoid all uses of "from <module> import ..." (so everything from an imported module is referenced as <module>.<name>) and to place all code inside functions. Initializations of global variables and class variables should use constants or built-in functions only. +

+

+Jim Roskind suggests the following order in each module: +

+

+ exports (globals, functions, and classes that don't need imported base classes)
+ import statements
+ active code (including globals that are initialized from imported values).
+
+Python's author doesn't like this approach much because the imports +appear in a strange place, but has to admit that it works. +

+

+

+Matthias Urlichs recommends to restructure your code so that the recursive import is not necessary in the first place. +

+

+These solutions are not mutually exclusive. +

+ +Edit this entry / +Log info + +/ Last changed on Mon Jun 3 06:52:51 2002 by +Matthias Urlichs +

+ +


+

4.38. How do I copy an object in Python?

+Try copy.copy() or copy.deepcopy() for the general case. Not all objects can be copied, but most can. +

+Dictionaries have a copy method. Sequences can be copied by slicing: +

+ new_l = l[:]
+
+

+ +Edit this entry / +Log info + +/ Last changed on Thu Mar 21 05:40:26 2002 by +Erno Kuusela +

+ +


+

4.39. How to implement persistent objects in Python? (Persistent == automatically saved to and restored from disk.)

+The library module "pickle" now solves this in a very general way +(though you still can't store things like open files, sockets or +windows), and the library module "shelve" uses pickle and (g)dbm to +create persistent mappings containing arbitrary Python objects. +For possibly better performance also look for the latest version +of the relatively recent cPickle module. +

+A more awkward way of doing things is to use pickle's little sister, +marshal. The marshal module provides very fast ways to store +noncircular basic Python types to files and strings, and back again. +Although marshal does not do fancy things like store instances or +handle shared references properly, it does run extremely fast. For +example loading a half megabyte of data may take less than a +third of a second (on some machines). This often beats doing +something more complex and general such as using gdbm with +pickle/shelve. +

+ +Edit this entry / +Log info + +/ Last changed on Sun Jun 8 22:59:00 1997 by +David Ascher +

+ +


+

4.40. I try to use __spam and I get an error about _SomeClassName__spam.

+Variables with double leading underscore are "mangled" to provide a +simple but effective way to define class private variables. See the +chapter "New in Release 1.4" in the Python Tutorial. +

+ +Edit this entry / +Log info +

+ +


+

4.41. How do I delete a file? And other file questions.

+Use os.remove(filename) or os.unlink(filename); for documentation, +see the posix section of the library manual. They are the same, +unlink() is simply the Unix name for this function. In earlier +versions of Python, only os.unlink() was available. +

+To remove a directory, use os.rmdir(); use os.mkdir() to create one. +

+To rename a file, use os.rename(). +

+To truncate a file, open it using f = open(filename, "r+"), and use +f.truncate(offset); offset defaults to the current seek position. +(The "r+" mode opens the file for reading and writing.) +There's also os.ftruncate(fd, offset) for files opened with os.open() +-- for advanced Unix hacks only. +

+The shutil module also contains a number of functions to work on files +including copyfile, copytree, and rmtree amongst others. +

+ +Edit this entry / +Log info + +/ Last changed on Thu Dec 28 12:30:01 2000 by +Bjorn Pettersen +

+ +


+

4.42. How to modify urllib or httplib to support HTTP/1.1?

+Recent versions of Python (2.0 and onwards) support HTTP/1.1 natively. +

+ +Edit this entry / +Log info + +/ Last changed on Tue Jan 2 02:56:56 2001 by +Moshe Zadka +

+ +


+

4.43. Unexplicable syntax errors in compile() or exec.

+When a statement suite (as opposed to an expression) is compiled by +compile(), exec or execfile(), it must end in a newline. In some +cases, when the source ends in an indented block it appears that at +least two newlines are required. +

+ +Edit this entry / +Log info +

+ +


+

4.44. How do I convert a string to a number?

+For integers, use the built-in int() function, e.g. int('144') == 144. Similarly, long() converts from string to long integer, e.g. long('144') == 144L; and float() to floating-point, e.g. float('144') == 144.0. +

+Note that these are restricted to decimal interpretation, so +that int('0144') == 144 and int('0x144') raises ValueError. For Python +2.0 int takes the base to convert from as a second optional argument, so +int('0x144', 16) == 324. +

+For greater flexibility, or before Python 1.5, import the module +string and use the string.atoi() function for integers, +string.atol() for long integers, or string.atof() for +floating-point. E.g., +string.atoi('100', 16) == string.atoi('0x100', 0) == 256. +See the library reference manual section for the string module for +more details. +

+While you could use the built-in function eval() instead of +any of those, this is not recommended, because someone could pass you +a Python expression that might have unwanted side effects (like +reformatting your disk). It also has the effect of interpreting numbers +as Python expressions, so that e.g. eval('09') gives a syntax error +since Python regards numbers starting with '0' as octal (base 8). +

+ +Edit this entry / +Log info + +/ Last changed on Thu Dec 28 12:37:34 2000 by +Bjorn Pettersen +

+ +


+

4.45. How do I convert a number to a string?

+To convert, e.g., the number 144 to the string '144', use the +built-in function repr() or the backquote notation (these are +equivalent). If you want a hexadecimal or octal representation, use +the built-in functions hex() or oct(), respectively. For fancy +formatting, use the % operator on strings, just like C printf formats, +e.g. "%04d" % 144 yields '0144' and "%.3f" % (1/3.0) yields '0.333'. +See the library reference manual for details. +

+ +Edit this entry / +Log info +

+ +


+

4.46. How do I copy a file?

+There's the shutil module which contains a copyfile() +function that implements a copy loop; +it isn't good enough for the Macintosh, though: +it doesn't copy the resource fork and Finder info. +

+ +Edit this entry / +Log info + +/ Last changed on Tue Jan 2 02:59:40 2001 by +Moshe Zadka +

+ +


+

4.47. How do I check if an object is an instance of a given class or of a subclass of it?

+If you are developing the classes from scratch it might be better to +program in a more proper object-oriented style -- instead of doing a different +thing based on class membership, why not use a method and define the +method differently in different classes? +

+However, there are some legitimate situations +where you need to test for class membership. +

+In Python 1.5, you can use the built-in function isinstance(obj, cls). +

+The following approaches can be used with earlier Python versions: +

+An unobvious method is to raise the object +as an exception and to try to catch the exception with the class you're +testing for: +

+

+	def is_instance_of(the_instance, the_class):
+	    try:
+		raise the_instance
+	    except the_class:
+		return 1
+	    except:
+		return 0
+
+This technique can be used to distinguish "subclassness" +from a collection of classes as well +

+

+                try:
+                              raise the_instance
+                except Audible:
+                              the_instance.play(largo)
+                except Visual:
+                              the_instance.display(gaudy)
+                except Olfactory:
+                              sniff(the_instance)
+                except:
+                              raise ValueError, "dunno what to do with this!"
+
+This uses the fact that exception catching tests for class or subclass +membership. +

+A different approach is to test for the presence of a class attribute that +is presumably unique for the given class. For instance: +

+

+	class MyClass:
+	    ThisIsMyClass = 1
+	    ...
+
+
+	def is_a_MyClass(the_instance):
+	    return hasattr(the_instance, 'ThisIsMyClass')
+
+This version is easier to inline, and probably faster (inlined it +is definitely faster). The disadvantage is that someone else could cheat: +

+

+	class IntruderClass:
+	    ThisIsMyClass = 1    # Masquerade as MyClass
+	    ...
+
+but this may be seen as a feature (anyway, there are plenty of other ways +to cheat in Python). Another disadvantage is that the class must be +prepared for the membership test. If you do not "control the +source code" for the class it may not be advisable to modify the +class to support testability. +

+ +Edit this entry / +Log info + +/ Last changed on Fri Jan 2 15:16:04 1998 by +GvR +

+ +


+

4.48. What is delegation?

+Delegation refers to an object oriented technique Python programmers +may implement with particular ease. Consider the following: +

+

+  from string import upper
+
+
+  class UpperOut:
+        def __init__(self, outfile):
+              self.__outfile = outfile
+        def write(self, str):
+              self.__outfile.write( upper(str) )
+        def __getattr__(self, name):
+              return getattr(self.__outfile, name)
+
+Here the UpperOut class redefines the write method +to convert the argument string to upper case before +calling the underlying self.__outfile.write method, but +all other methods are delegated to the underlying +self.__outfile object. The delegation is accomplished +via the "magic" __getattr__ method. Please see the +language reference for more information on the use +of this method. +

+Note that for more general cases delegation can +get trickier. Particularly when attributes must be set +as well as gotten the class must define a __settattr__ +method too, and it must do so carefully. +

+The basic implementation of __setattr__ is roughly +equivalent to the following: +

+

+   class X:
+        ...
+        def __setattr__(self, name, value):
+             self.__dict__[name] = value
+        ...
+
+Most __setattr__ implementations must modify +self.__dict__ to store local state for self without +causing an infinite recursion. +

+ +Edit this entry / +Log info + +/ Last changed on Wed Aug 13 07:11:24 1997 by +aaron watters +

+ +


+

4.49. How do I test a Python program or component.

+We presume for the purposes of this question you are interested +in standalone testing, rather than testing your components inside +a testing framework. The best-known testing framework for Python +is the PyUnit module, maintained at +

+

+    http://pyunit.sourceforge.net/
+
+For standalone testing, it helps to write the program so that +it may be easily tested by using good modular design. +In particular your program +should have almost all functionality encapsulated in either functions +or class methods -- and this sometimes has the surprising and +delightful effect of making the program run faster (because +local variable accesses are faster than global accesses). +Furthermore the program should avoid depending on mutating +global variables, since this makes testing much more difficult to do. +

+The "global main logic" of your program may be as simple +as +

+

+  if __name__=="__main__":
+       main_logic()
+
+at the bottom of the main module of your program. +

+Once your program is organized as a tractable collection +of functions and class behaviours you should write test +functions that exercise the behaviours. A test suite +can be associated with each module which automates +a sequence of tests. This sounds like a lot of work, but +since Python is so terse and flexible it's surprisingly easy. +You can make coding much more pleasant and fun by +writing your test functions in parallel with the "production +code", since this makes it easy to find bugs and even +design flaws earlier. +

+"Support modules" that are not intended to be the main +module of a program may include a "test script interpretation" +which invokes a self test of the module. +

+

+   if __name__ == "__main__":
+      self_test()
+
+Even programs that interact with complex external +interfaces may be tested when the external interfaces are +unavailable by using "fake" interfaces implemented in +Python. For an example of a "fake" interface, the following +class defines (part of) a "fake" file interface: +

+

+ import string
+ testdata = "just a random sequence of characters"
+
+
+ class FakeInputFile:
+   data = testdata
+   position = 0
+   closed = 0
+
+
+   def read(self, n=None):
+       self.testclosed()
+       p = self.position
+       if n is None:
+          result= self.data[p:]
+       else:
+          result= self.data[p: p+n]
+       self.position = p + len(result)
+       return result
+
+
+   def seek(self, n, m=0):
+       self.testclosed()
+       last = len(self.data)
+       p = self.position
+       if m==0: 
+          final=n
+       elif m==1:
+          final=n+p
+       elif m==2:
+          final=len(self.data)+n
+       else:
+          raise ValueError, "bad m"
+       if final<0:
+          raise IOError, "negative seek"
+       self.position = final
+
+
+   def isatty(self):
+       return 0
+
+
+   def tell(self):
+       return self.position
+
+
+   def close(self):
+       self.closed = 1
+
+
+   def testclosed(self):
+       if self.closed:
+          raise IOError, "file closed"
+
+Try f=FakeInputFile() and test out its operations. +

+ +Edit this entry / +Log info + +/ Last changed on Mon Jun 3 01:12:10 2002 by +Neal Norwitz +

+ +


+

4.50. My multidimensional list (array) is broken! What gives?

+You probably tried to make a multidimensional array like this. +

+

+   A = [[None] * 2] * 3
+
+This makes a list containing 3 references to the same list of length +two. Changes to one row will show in all rows, which is probably not +what you want. The following works much better: +

+

+   A = [None]*3
+   for i in range(3):
+        A[i] = [None] * 2
+
+This generates a list containing 3 different lists of length two. +

+If you feel weird, you can also do it in the following way: +

+

+   w, h = 2, 3
+   A = map(lambda i,w=w: [None] * w, range(h))
+
+For Python 2.0 the above can be spelled using a list comprehension: +

+

+   w,h = 2,3
+   A = [ [None]*w for i in range(h) ]
+
+

+ +Edit this entry / +Log info + +/ Last changed on Thu Dec 28 12:18:35 2000 by +Bjorn Pettersen +

+ +


+

4.51. I want to do a complicated sort: can you do a Schwartzian Transform in Python?

+Yes, and in Python you only have to write it once: +

+

+ def st(List, Metric):
+     def pairing(element, M = Metric):
+           return (M(element), element)
+     paired = map(pairing, List)
+     paired.sort()
+     return map(stripit, paired)
+
+
+ def stripit(pair):
+     return pair[1]
+
+This technique, attributed to Randal Schwartz, sorts the elements +of a list by a metric which maps each element to its "sort value". +For example, if L is a list of string then +

+

+   import string
+   Usorted = st(L, string.upper)
+
+
+   def intfield(s):
+         return string.atoi( string.strip(s[10:15] ) )
+
+
+   Isorted = st(L, intfield)
+
+Usorted gives the elements of L sorted as if they were upper +case, and Isorted gives the elements of L sorted by the integer +values that appear in the string slices starting at position 10 +and ending at position 15. In Python 2.0 this can be done more +naturally with list comprehensions: +

+

+  tmp1 = [ (x.upper(), x) for x in L ] # Schwartzian transform
+  tmp1.sort()
+  Usorted = [ x[1] for x in tmp1 ]
+
+
+  tmp2 = [ (int(s[10:15]), s) for s in L ] # Schwartzian transform
+  tmp2.sort()
+  Isorted = [ x[1] for x in tmp2 ]
+
+

+Note that Isorted may also be computed by +

+

+   def Icmp(s1, s2):
+         return cmp( intfield(s1), intfield(s2) )
+
+
+   Isorted = L[:]
+   Isorted.sort(Icmp)
+
+but since this method computes intfield many times for each +element of L, it is slower than the Schwartzian Transform. +

+ +Edit this entry / +Log info + +/ Last changed on Sat Jun 1 19:18:46 2002 by +Neal Norwitz +

+ +


+

4.52. How to convert between tuples and lists?

+The function tuple(seq) converts any sequence into a tuple with +the same items in the same order. +For example, tuple([1, 2, 3]) yields (1, 2, 3) and tuple('abc') +yields ('a', 'b', 'c'). If the argument is +a tuple, it does not make a copy but returns the same object, so +it is cheap to call tuple() when you aren't sure that an object +is already a tuple. +

+The function list(seq) converts any sequence into a list with +the same items in the same order. +For example, list((1, 2, 3)) yields [1, 2, 3] and list('abc') +yields ['a', 'b', 'c']. If the argument is a list, +it makes a copy just like seq[:] would. +

+ +Edit this entry / +Log info + +/ Last changed on Sun Jun 14 14:18:53 1998 by +Tim Peters +

+ +


+

4.53. Files retrieved with urllib contain leading garbage that looks like email headers.

+Extremely old versions of Python supplied libraries which +did not support HTTP/1.1; the vanilla httplib in Python 1.4 +only recognized HTTP/1.0. In Python 2.0 full HTTP/1.1 support is included. +

+ +Edit this entry / +Log info + +/ Last changed on Mon Jan 8 17:26:18 2001 by +Steve Holden +

+ +


+

4.54. How do I get a list of all instances of a given class?

+Python does not keep track of all instances of a class (or of a +built-in type). +

+You can program the class's constructor to keep track of all +instances, but unless you're very clever, this has the disadvantage +that the instances never get deleted,because your list of all +instances keeps a reference to them. +

+(The trick is to regularly inspect the reference counts of the +instances you've retained, and if the reference count is below a +certain level, remove it from the list. Determining that level is +tricky -- it's definitely larger than 1.) +

+ +Edit this entry / +Log info + +/ Last changed on Tue May 27 23:52:16 1997 by +GvR +

+ +


+

4.55. A regular expression fails with regex.error: match failure.

+This is usually caused by too much backtracking; the regular +expression engine has a fixed size stack which holds at most 4000 +backtrack points. Every character matched by e.g. ".*" accounts for a +backtrack point, so even a simple search like +

+

+  regex.match('.*x',"x"*5000)
+
+will fail. +

+This is fixed in the re module introduced with +Python 1.5; consult the Library Reference section on re for more information. +

+ +Edit this entry / +Log info + +/ Last changed on Thu Jul 30 12:35:49 1998 by +A.M. Kuchling +

+ +


+

4.56. I can't get signal handlers to work.

+The most common problem is that the signal handler is declared +with the wrong argument list. It is called as +

+

+	handler(signum, frame)
+
+so it should be declared with two arguments: +

+

+	def handler(signum, frame):
+		...
+
+

+ +Edit this entry / +Log info + +/ Last changed on Wed May 28 09:29:08 1997 by +GvR +

+ +


+

4.57. I can't use a global variable in a function? Help!

+Did you do something like this? +

+

+   x = 1 # make a global
+
+
+   def f():
+         print x # try to print the global
+         ...
+         for j in range(100):
+              if q>3:
+                 x=4
+
+Any variable assigned in a function is local to that function. +unless it is specifically declared global. Since a value is bound +to x as the last statement of the function body, the compiler +assumes that x is local. Consequently the "print x" +attempts to print an uninitialized local variable and will +trigger a NameError. +

+In such cases the solution is to insert an explicit global +declaration at the start of the function, making it +

+

+

+   def f():
+         global x
+         print x # try to print the global
+         ...
+         for j in range(100):
+              if q>3:
+                 x=4
+
+

+In this case, all references to x are interpreted as references +to the x from the module namespace. +

+ +Edit this entry / +Log info + +/ Last changed on Mon Feb 12 15:52:12 2001 by +Steve Holden +

+ +


+

4.58. What's a negative index? Why doesn't list.insert() use them?

+Python sequences are indexed with positive numbers and +negative numbers. For positive numbers 0 is the first index +1 is the second index and so forth. For negative indices -1 +is the last index and -2 is the pentultimate (next to last) index +and so forth. Think of seq[-n] as the same as seq[len(seq)-n]. +

+Using negative indices can be very convenient. For example +if the string Line ends in a newline then Line[:-1] is all of Line except +the newline. +

+Sadly the list builtin method L.insert does not observe negative +indices. This feature could be considered a mistake but since +existing programs depend on this feature it may stay around +forever. L.insert for negative indices inserts at the start of the +list. To get "proper" negative index behaviour use L[n:n] = [x] +in place of the insert method. +

+ +Edit this entry / +Log info + +/ Last changed on Wed Aug 13 07:03:18 1997 by +aaron watters +

+ +


+

4.59. How can I sort one list by values from another list?

+You can sort lists of tuples. +

+

+  >>> list1 = ["what", "I'm", "sorting", "by"]
+  >>> list2 = ["something", "else", "to", "sort"]
+  >>> pairs = map(None, list1, list2)
+  >>> pairs
+  [('what', 'something'), ("I'm", 'else'), ('sorting', 'to'), ('by', 'sort')]
+  >>> pairs.sort()
+  >>> pairs
+  [("I'm", 'else'), ('by', 'sort'), ('sorting', 'to'), ('what', 'something')]
+  >>> result = pairs[:]
+  >>> for i in xrange(len(result)): result[i] = result[i][1]
+  ...
+  >>> result
+  ['else', 'sort', 'to', 'something']
+
+And if you didn't understand the question, please see the +example above ;c). Note that "I'm" sorts before "by" because +uppercase "I" comes before lowercase "b" in the ascii order. +Also see 4.51. +

+In Python 2.0 this can be done like: +

+

+ >>> list1 = ["what", "I'm", "sorting", "by"]
+ >>> list2 = ["something", "else", "to", "sort"]
+ >>> pairs = zip(list1, list2)
+ >>> pairs
+ [('what', 'something'), ("I'm", 'else'), ('sorting', 'to'), ('by', 'sort')]
+ >>> pairs.sort()
+ >>> result = [ x[1] for x in pairs ]
+ >>> result
+ ['else', 'sort', 'to', 'something']
+
+[Followup] +

+Someone asked, why not this for the last steps: +

+

+  result = []
+  for p in pairs: result.append(p[1])
+
+This is much more legible. However, a quick test shows that +it is almost twice as slow for long lists. Why? First of all, +the append() operation has to reallocate memory, and while it +uses some tricks to avoid doing that each time, it still has +to do it occasionally, and apparently that costs quite a bit. +Second, the expression "result.append" requires an extra +attribute lookup. The attribute lookup could be done away +with by rewriting as follows: +

+

+  result = []
+  append = result.append
+  for p in pairs: append(p[1])
+
+which gains back some speed, but is still considerably slower +than the original solution, and hardly less convoluted. +

+ +Edit this entry / +Log info + +/ Last changed on Thu Dec 28 12:56:35 2000 by +Bjorn Pettersen +

+ +


+

4.60. Why doesn't dir() work on builtin types like files and lists?

+It does starting with Python 1.5. +

+Using 1.4, you can find out which methods a given object supports +by looking at its __methods__ attribute: +

+

+    >>> List = []
+    >>> List.__methods__
+    ['append', 'count', 'index', 'insert', 'remove', 'reverse', 'sort']
+
+

+ +Edit this entry / +Log info + +/ Last changed on Thu Sep 16 14:56:42 1999 by +Skip Montanaro +

+ +


+

4.61. How can I mimic CGI form submission (METHOD=POST)?

+I would like to retrieve web pages that are the result of POSTing a +form. Is there existing code that would let me do this easily? +

+Yes. Here's a simple example that uses httplib. +

+

+    #!/usr/local/bin/python
+
+
+    import httplib, sys, time
+
+
+    ### build the query string
+    qs = "First=Josephine&MI=Q&Last=Public"
+
+
+    ### connect and send the server a path
+    httpobj = httplib.HTTP('www.some-server.out-there', 80)
+    httpobj.putrequest('POST', '/cgi-bin/some-cgi-script')
+    ### now generate the rest of the HTTP headers...
+    httpobj.putheader('Accept', '*/*')
+    httpobj.putheader('Connection', 'Keep-Alive')
+    httpobj.putheader('Content-type', 'application/x-www-form-urlencoded')
+    httpobj.putheader('Content-length', '%d' % len(qs))
+    httpobj.endheaders()
+    httpobj.send(qs)
+    ### find out what the server said in response...
+    reply, msg, hdrs = httpobj.getreply()
+    if reply != 200:
+	sys.stdout.write(httpobj.getfile().read())
+
+Note that in general for "url encoded posts" (the default) query strings must be "quoted" to, for example, change equals signs and spaces to an encoded form when they occur in name or value. Use urllib.quote to perform this quoting. For example to send name="Guy Steele, Jr.": +

+

+   >>> from urllib import quote
+   >>> x = quote("Guy Steele, Jr.")
+   >>> x
+   'Guy%20Steele,%20Jr.'
+   >>> query_string = "name="+x
+   >>> query_string
+   'name=Guy%20Steele,%20Jr.'
+
+

+ +Edit this entry / +Log info + +/ Last changed on Mon Jun 21 03:47:07 1999 by +TAB +

+ +


+

4.62. If my program crashes with a bsddb (or anydbm) database open, it gets corrupted. How come?

+Databases opened for write access with the bsddb module (and often by +the anydbm module, since it will preferentially use bsddb) must +explicitly be closed using the close method of the database. The +underlying libdb package caches database contents which need to be +converted to on-disk form and written, unlike regular open files which +already have the on-disk bits in the kernel's write buffer, where they +can just be dumped by the kernel with the program exits. +

+If you have initialized a new bsddb database but not written anything to +it before the program crashes, you will often wind up with a zero-length +file and encounter an exception the next time the file is opened. +

+ +Edit this entry / +Log info + +/ Last changed on Mon Jun 3 01:15:01 2002 by +Neal Norwitz +

+ +


+

4.63. How do I make a Python script executable on Unix?

+You need to do two things: the script file's mode must be executable +(include the 'x' bit), and the first line must begin with #! +followed by the pathname for the Python interpreter. +

+The first is done by executing 'chmod +x scriptfile' or perhaps +'chmod 755 scriptfile'. +

+The second can be done in a number of way. The most straightforward +way is to write +

+

+  #!/usr/local/bin/python
+
+as the very first line of your file - or whatever the pathname is +where the python interpreter is installed on your platform. +

+If you would like the script to be independent of where the python +interpreter lives, you can use the "env" program. On almost all +platforms, the following will work, assuming the python interpreter +is in a directory on the user's $PATH: +

+

+  #! /usr/bin/env python
+
+Note -- *don't* do this for CGI scripts. The $PATH variable for +CGI scripts is often very minimal, so you need to use the actual +absolute pathname of the interpreter. +

+Occasionally, a user's environment is so full that the /usr/bin/env +program fails; or there's no env program at all. +In that case, you can try the following hack (due to Alex Rezinsky): +

+

+  #! /bin/sh
+  """:"
+  exec python $0 ${1+"$@"}
+  """
+
+The disadvantage is that this defines the script's __doc__ string. +However, you can fix that by adding +

+

+  __doc__ = """...Whatever..."""
+
+

+ +Edit this entry / +Log info + +/ Last changed on Mon Jan 15 09:19:16 2001 by +Neal Norwitz +

+ +


+

4.64. How do you remove duplicates from a list?

+See the Python Cookbook for a long discussion of many cool ways: +

+

+    http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52560
+
+Generally, if you don't mind reordering the List +

+

+   if List:
+      List.sort()
+      last = List[-1]
+      for i in range(len(List)-2, -1, -1):
+          if last==List[i]: del List[i]
+          else: last=List[i]
+
+If all elements of the list may be used as +dictionary keys (ie, they are all hashable) +this is often faster +

+

+   d = {}
+   for x in List: d[x]=x
+   List = d.values()
+
+Also, for extremely large lists you might +consider more optimal alternatives to the first one. +The second one is pretty good whenever it can +be used. +

+ +Edit this entry / +Log info + +/ Last changed on Fri May 24 21:56:33 2002 by +Tim Peters +

+ +


+

4.65. Are there any known year 2000 problems in Python?

+I am not aware of year 2000 deficiencies in Python 1.5. Python does +very few date calculations and for what it does, it relies on the C +library functions. Python generally represent times either as seconds +since 1970 or as a tuple (year, month, day, ...) where the year is +expressed with four digits, which makes Y2K bugs unlikely. So as long +as your C library is okay, Python should be okay. Of course, I cannot +vouch for your Python code! +

+Given the nature of freely available software, I have to add that this statement is not +legally binding. The Python copyright notice contains the following +disclaimer: +

+

+  STICHTING MATHEMATISCH CENTRUM AND CNRI DISCLAIM ALL WARRANTIES WITH
+  REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
+  MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH
+  CENTRUM OR CNRI BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+  DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+  PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+  TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+  PERFORMANCE OF THIS SOFTWARE.
+
+The good news is that if you encounter a problem, you have full +source available to track it down and fix it! +

+ +Edit this entry / +Log info + +/ Last changed on Fri Apr 10 14:59:31 1998 by +GvR +

+ +


+

4.66. I want a version of map that applies a method to a sequence of objects! Help!

+Get fancy! +

+

+  def method_map(objects, method, arguments):
+       """method_map([a,b], "flog", (1,2)) gives [a.flog(1,2), b.flog(1,2)]"""
+       nobjects = len(objects)
+       methods = map(getattr, objects, [method]*nobjects)
+       return map(apply, methods, [arguments]*nobjects)
+
+It's generally a good idea to get to know the mysteries of map and apply +and getattr and the other dynamic features of Python. +

+ +Edit this entry / +Log info + +/ Last changed on Mon Jan 5 14:21:14 1998 by +Aaron Watters +

+ +


+

4.67. How do I generate random numbers in Python?

+The standard library module "random" implements a random number +generator. Usage is simple: +

+

+    import random
+
+
+    random.random()
+
+This returns a random floating point number in the range [0, 1). +

+There are also many other specialized generators in this module, such +as +

+

+    randrange(a, b) chooses an integer in the range [a, b)
+    uniform(a, b) chooses a floating point number in the range [a, b)
+    normalvariate(mean, sdev) sample from normal (Gaussian) distribution
+
+Some higher-level functions operate on sequences directly, such as +

+

+    choice(S) chooses random element from a given sequence
+    shuffle(L) shuffles a list in-place, i.e. permutes it randomly
+
+There's also a class, Random, which you can instantiate +to create independent multiple random number generators. +

+All this is documented in the library reference manual. Note that +the module "whrandom" is obsolete. +

+ +Edit this entry / +Log info + +/ Last changed on Mon Jun 3 01:16:51 2002 by +Neal Norwitz +

+ +


+

4.68. How do I access the serial (RS232) port?

+There's a Windows serial communication module (for communication +over RS 232 serial ports) at +

+

+  ftp://ftp.python.org/pub/python/contrib/sio-151.zip
+  http://www.python.org/ftp/python/contrib/sio-151.zip
+
+For DOS, try Hans Nowak's Python-DX, which supports this, at: +

+

+  http://www.cuci.nl/~hnowak/
+
+For Unix, see a usenet post by Mitch Chapman: +

+

+  http://groups.google.com/groups?selm=34A04430.CF9@ohioee.com
+
+For Win32, POSIX(Linux, BSD, *), Jython, Chris': +

+

+  http://pyserial.sourceforge.net
+
+

+ +Edit this entry / +Log info + +/ Last changed on Tue Jul 2 21:11:07 2002 by +Chris Liechti +

+ +


+

4.69. Images on Tk-Buttons don't work in Py15?

+They do work, but you must keep your own reference to the image +object now. More verbosely, you must make sure that, say, a global +variable or a class attribute refers to the object. +

+Quoting Fredrik Lundh from the mailinglist: +

+

+  Well, the Tk button widget keeps a reference to the internal
+  photoimage object, but Tkinter does not.  So when the last
+  Python reference goes away, Tkinter tells Tk to release the
+  photoimage.  But since the image is in use by a widget, Tk
+  doesn't destroy it.  Not completely.  It just blanks the image,
+  making it completely transparent...
+
+
+  And yes, there was a bug in the keyword argument handling
+  in 1.4 that kept an extra reference around in some cases.  And
+  when Guido fixed that bug in 1.5, he broke quite a few Tkinter
+  programs...
+
+

+ +Edit this entry / +Log info + +/ Last changed on Tue Feb 3 11:31:03 1998 by +Case Roole +

+ +


+

4.70. Where is the math.py (socket.py, regex.py, etc.) source file?

+If you can't find a source file for a module it may be a builtin +or dynamically loaded module implemented in C, C++ or other +compiled language. In this case you may not have the source +file or it may be something like mathmodule.c, somewhere in +a C source directory (not on the Python Path). +

+Fredrik Lundh (fredrik@pythonware.com) explains (on the python-list): +

+There are (at least) three kinds of modules in Python: +1) modules written in Python (.py); +2) modules written in C and dynamically loaded (.dll, .pyd, .so, .sl, etc); +3) modules written in C and linked with the interpreter; to get a list +of these, type: +

+

+    import sys
+    print sys.builtin_module_names
+
+

+ +Edit this entry / +Log info + +/ Last changed on Tue Feb 3 13:55:33 1998 by +Aaron Watters +

+ +


+

4.71. How do I send mail from a Python script?

+The standard library module smtplib does this. +Here's a very simple interactive mail +sender that uses it. This method will work on any host that +supports an SMTP listener. +

+

+    import sys, smtplib
+
+
+    fromaddr = raw_input("From: ")
+    toaddrs  = raw_input("To: ").split(',')
+    print "Enter message, end with ^D:"
+    msg = ''
+    while 1:
+        line = sys.stdin.readline()
+        if not line:
+            break
+        msg = msg + line
+
+
+    # The actual mail send
+    server = smtplib.SMTP('localhost')
+    server.sendmail(fromaddr, toaddrs, msg)
+    server.quit()
+
+If the local host doesn't have an SMTP listener, you need to find one. The simple method is to ask the user. Alternately, you can use the DNS system to find the mail gateway(s) responsible for the source address. +

+A Unix-only alternative uses sendmail. The location of the +sendmail program varies between systems; sometimes it is +/usr/lib/sendmail, sometime /usr/sbin/sendmail. The sendmail manual +page will help you out. Here's some sample code: +

+

+  SENDMAIL = "/usr/sbin/sendmail" # sendmail location
+  import os
+  p = os.popen("%s -t -i" % SENDMAIL, "w")
+  p.write("To: cary@ratatosk.org\n")
+  p.write("Subject: test\n")
+  p.write("\n") # blank line separating headers from body
+  p.write("Some text\n")
+  p.write("some more text\n")
+  sts = p.close()
+  if sts != 0:
+      print "Sendmail exit status", sts
+
+

+ +Edit this entry / +Log info + +/ Last changed on Mon Jun 3 07:05:12 2002 by +Matthias Urlichs +

+ +


+

4.72. How do I avoid blocking in connect() of a socket?

+The select module is widely known to help with asynchronous +I/O on sockets once they are connected. However, it is less +than common knowledge how to avoid blocking on the initial +connect() call. Jeremy Hylton has the following advice (slightly +edited): +

+To prevent the TCP connect from blocking, you can set the socket to +non-blocking mode. Then when you do the connect(), you will either +connect immediately (unlikely) or get an exception that contains the +errno. errno.EINPROGRESS indicates that the connection is in +progress, but hasn't finished yet. Different OSes will return +different errnos, so you're going to have to check. I can tell you +that different versions of Solaris return different errno values. +

+In Python 1.5 and later, you can use connect_ex() to avoid +creating an exception. It will just return the errno value. +

+To poll, you can call connect_ex() again later -- 0 or errno.EISCONN +indicate that you're connected -- or you can pass this socket to +select (checking to see if it is writeable). +

+ +Edit this entry / +Log info + +/ Last changed on Tue Feb 24 21:30:45 1998 by +GvR +

+ +


+

4.73. How do I specify hexadecimal and octal integers?

+To specify an octal digit, precede the octal value with a zero. For example, +to set the variable "a" to the octal value "10" (8 in decimal), type: +

+

+    >>> a = 010
+
+To verify that this works, you can type "a" and hit enter while in the +interpreter, which will cause Python to spit out the current value of "a" +in decimal: +

+

+    >>> a
+    8
+
+Hexadecimal is just as easy. Simply precede the hexadecimal number with a +zero, and then a lower or uppercase "x". Hexadecimal digits can be specified +in lower or uppercase. For example, in the Python interpreter: +

+

+    >>> a = 0xa5
+    >>> a
+    165
+    >>> b = 0XB2
+    >>> b
+    178
+
+

+ +Edit this entry / +Log info + +/ Last changed on Tue Mar 3 12:53:16 1998 by +GvR +

+ +


+

4.74. How to get a single keypress at a time?

+For Windows, see question 8.2. Here is an answer for Unix (see also 4.94). +

+There are several solutions; some involve using curses, which is a +pretty big thing to learn. Here's a solution without curses, due +to Andrew Kuchling (adapted from code to do a PGP-style +randomness pool): +

+

+        import termios, sys, os
+        fd = sys.stdin.fileno()
+        old = termios.tcgetattr(fd)
+        new = termios.tcgetattr(fd)
+        new[3] = new[3] & ~termios.ICANON & ~termios.ECHO
+        new[6][termios.VMIN] = 1
+        new[6][termios.VTIME] = 0
+        termios.tcsetattr(fd, termios.TCSANOW, new)
+        s = ''    # We'll save the characters typed and add them to the pool.
+        try:
+            while 1:
+                c = os.read(fd, 1)
+                print "Got character", `c`
+                s = s+c
+        finally:
+            termios.tcsetattr(fd, termios.TCSAFLUSH, old)
+
+You need the termios module for any of this to work, and I've only +tried it on Linux, though it should work elsewhere. It turns off +stdin's echoing and disables canonical mode, and then reads a +character at a time from stdin, noting the time after each keystroke. +

+ +Edit this entry / +Log info + +/ Last changed on Thu Oct 24 00:36:56 2002 by +chris +

+ +


+

4.75. How can I overload constructors (or methods) in Python?

+(This actually applies to all methods, but somehow the question +usually comes up first in the context of constructors.) +

+Where in C++ you'd write +

+

+    class C {
+        C() { cout << "No arguments\n"; }
+        C(int i) { cout << "Argument is " << i << "\n"; }
+    }
+
+in Python you have to write a single constructor that catches all +cases using default arguments. For example: +

+

+    class C:
+        def __init__(self, i=None):
+            if i is None:
+                print "No arguments"
+            else:
+                print "Argument is", i
+
+This is not entirely equivalent, but close enough in practice. +

+You could also try a variable-length argument list, e.g. +

+

+        def __init__(self, *args):
+            ....
+
+The same approach works for all method definitions. +

+ +Edit this entry / +Log info + +/ Last changed on Mon Apr 20 11:55:55 1998 by +GvR +

+ +


+

4.76. How do I pass keyword arguments from one method to another?

+Use apply. For example: +

+

+    class Account:
+        def __init__(self, **kw):
+            self.accountType = kw.get('accountType')
+            self.balance = kw.get('balance')
+
+
+    class CheckingAccount(Account):
+        def __init__(self, **kw):
+            kw['accountType'] = 'checking'
+            apply(Account.__init__, (self,), kw)
+
+
+    myAccount = CheckingAccount(balance=100.00)
+
+In Python 2.0 you can call it directly using the new ** syntax: +

+

+    class CheckingAccount(Account):
+        def __init__(self, **kw):
+            kw['accountType'] = 'checking'
+            Account.__init__(self, **kw)
+
+or more generally: +

+

+ >>> def f(x, *y, **z):
+ ...  print x,y,z
+ ...
+ >>> Y = [1,2,3]
+ >>> Z = {'foo':3,'bar':None}
+ >>> f('hello', *Y, **Z)
+ hello (1, 2, 3) {'foo': 3, 'bar': None}
+
+

+ +Edit this entry / +Log info + +/ Last changed on Thu Dec 28 13:04:01 2000 by +Bjorn Pettersen +

+ +


+

4.77. What module should I use to help with generating HTML?

+Check out HTMLgen written by Robin Friedrich. It's a class library +of objects corresponding to all the HTML 3.2 markup tags. It's used +when you are writing in Python and wish to synthesize HTML pages for +generating a web or for CGI forms, etc. +

+It can be found in the FTP contrib area on python.org or on the +Starship. Use the search engines there to locate the latest version. +

+It might also be useful to consider DocumentTemplate, which offers clear +separation between Python code and HTML code. DocumentTemplate is part +of the Bobo objects publishing system (http:/www.digicool.com/releases) +but can be used independantly of course! +

+ +Edit this entry / +Log info + +/ Last changed on Fri Aug 28 09:54:58 1998 by +GvR +

+ +


+

4.78. How do I create documentation from doc strings?

+Use gendoc, by Daniel Larson. See +

+http://starship.python.net/crew/danilo/ +

+It can create HTML from the doc strings in your Python source code. +

+ +Edit this entry / +Log info + +/ Last changed on Mon Oct 7 17:15:51 2002 by +Phil Rittenhouse +

+ +


+

4.79. How do I read (or write) binary data?

+For complex data formats, it's best to use +use the struct module. It's documented in the library reference. +It allows you to take a string read from a file containing binary +data (usually numbers) and convert it to Python objects; and vice +versa. +

+For example, the following code reads two 2-byte integers +and one 4-byte integer in big-endian format from a file: +

+

+  import struct
+
+
+  f = open(filename, "rb")  # Open in binary mode for portability
+  s = f.read(8)
+  x, y, z = struct.unpack(">hhl", s)
+
+The '>' in the format string forces bin-endian data; the letter +'h' reads one "short integer" (2 bytes), and 'l' reads one +"long integer" (4 bytes) from the string. +

+For data that is more regular (e.g. a homogeneous list of ints or +floats), you can also use the array module, also documented +in the library reference. +

+ +Edit this entry / +Log info + +/ Last changed on Wed Oct 7 09:16:45 1998 by +GvR +

+ +


+

4.80. I can't get key bindings to work in Tkinter

+An oft-heard complaint is that event handlers bound to events +with the bind() method don't get handled even when the appropriate +key is pressed. +

+The most common cause is that the widget to which the binding applies +doesn't have "keyboard focus". Check out the Tk documentation +for the focus command. Usually a widget is given the keyboard +focus by clicking in it (but not for labels; see the taketocus +option). +

+ +Edit this entry / +Log info + +/ Last changed on Fri Jun 12 09:37:33 1998 by +GvR +

+ +


+

4.81. "import crypt" fails

+[Unix] +

+Starting with Python 1.5, the crypt module is disabled by default. +In order to enable it, you must go into the Python source tree and +edit the file Modules/Setup to enable it (remove a '#' sign in +front of the line starting with '#crypt'). Then rebuild. +You may also have to add the string '-lcrypt' to that same line. +

+ +Edit this entry / +Log info + +/ Last changed on Wed Aug 5 08:57:09 1998 by +GvR +

+ +


+

4.82. Are there coding standards or a style guide for Python programs?

+Yes, Guido has written the "Python Style Guide". See +http://www.python.org/doc/essays/styleguide.html +

+ +Edit this entry / +Log info + +/ Last changed on Tue Sep 29 09:50:27 1998 by +Joseph VanAndel +

+ +


+

4.83. How do I freeze Tkinter applications?

+Freeze is a tool to create stand-alone applications (see 4.28). +

+When freezing Tkinter applications, the applications will not be +truly stand-alone, as the application will still need the tcl and +tk libraries. +

+One solution is to ship the application with the tcl and tk libraries, +and point to them at run-time using the TCL_LIBRARY and TK_LIBRARY +environment variables. +

+To get truly stand-alone applications, the Tcl scripts that form +the library have to be integrated into the application as well. One +tool supporting that is SAM (stand-alone modules), which is part +of the Tix distribution (http://tix.mne.com). Build Tix with SAM +enabled, perform the appropriate call to Tclsam_init etc inside +Python's Modules/tkappinit.c, and link with libtclsam +and libtksam (you might include the Tix libraries as well). +

+ +Edit this entry / +Log info + +/ Last changed on Wed Jan 20 17:35:01 1999 by +Martin v. Löwis +

+ +


+

4.84. How do I create static class data and static class methods?

+[Tim Peters, tim_one@email.msn.com] +

+Static data (in the sense of C++ or Java) is easy; static methods (again in the sense of C++ or Java) are not supported directly. +

+STATIC DATA +

+For example, +

+

+    class C:
+        count = 0   # number of times C.__init__ called
+
+
+        def __init__(self):
+            C.count = C.count + 1
+
+
+        def getcount(self):
+            return C.count  # or return self.count
+
+c.count also refers to C.count for any c such that isinstance(c, C) holds, unless overridden by c itself or by some class on the base-class search path from c.__class__ back to C. +

+Caution: within a method of C, +

+

+    self.count = 42
+
+creates a new and unrelated instance vrbl named "count" in self's own dict. So rebinding of a class-static data name needs the +

+

+    C.count = 314
+
+form whether inside a method or not. +

+

+STATIC METHODS +

+Static methods (as opposed to static data) are unnatural in Python, because +

+

+    C.getcount
+
+returns an unbound method object, which can't be invoked without supplying an instance of C as the first argument. +

+The intended way to get the effect of a static method is via a module-level function: +

+

+    def getcount():
+        return C.count
+
+If your code is structured so as to define one class (or tightly related class hierarchy) per module, this supplies the desired encapsulation. +

+Several tortured schemes for faking static methods can be found by searching DejaNews. Most people feel such cures are worse than the disease. Perhaps the least obnoxious is due to Pekka Pessi (mailto:ppessi@hut.fi): +

+

+    # helper class to disguise function objects
+    class _static:
+        def __init__(self, f):
+            self.__call__ = f
+
+
+    class C:
+        count = 0
+
+
+        def __init__(self):
+            C.count = C.count + 1
+
+
+        def getcount():
+            return C.count
+        getcount = _static(getcount)
+
+
+        def sum(x, y):
+            return x + y
+        sum = _static(sum)
+
+
+    C(); C()
+    c = C()
+    print C.getcount()  # prints 3
+    print c.getcount()  # prints 3
+    print C.sum(27, 15) # prints 42
+
+

+ +Edit this entry / +Log info + +/ Last changed on Thu Jan 21 21:35:38 1999 by +Tim Peters +

+ +


+

4.85. __import__('x.y.z') returns <module 'x'>; how do I get z?

+Try +

+

+   __import__('x.y.z').y.z
+
+For more realistic situations, you may have to do something like +

+

+   m = __import__(s)
+   for i in string.split(s, ".")[1:]:
+       m = getattr(m, i)
+
+

+ +Edit this entry / +Log info + +/ Last changed on Thu Jan 28 11:01:43 1999 by +GvR +

+ +


+

4.86. Basic thread wisdom

+Please note that there is no way to take advantage of +multiprocessor hardware using the Python thread model. The interpreter +uses a global interpreter lock (GIL), +which does not allow multiple threads to be concurrently active. +

+If you write a simple test program like this: +

+

+  import thread
+  def run(name, n):
+      for i in range(n): print name, i
+  for i in range(10):
+      thread.start_new(run, (i, 100))
+
+none of the threads seem to run! The reason is that as soon as +the main thread exits, all threads are killed. +

+A simple fix is to add a sleep to the end of the program, +sufficiently long for all threads to finish: +

+

+  import thread, time
+  def run(name, n):
+      for i in range(n): print name, i
+  for i in range(10):
+      thread.start_new(run, (i, 100))
+  time.sleep(10) # <----------------------------!
+
+But now (on many platforms) the threads don't run in parallel, +but appear to run sequentially, one at a time! The reason is +that the OS thread scheduler doesn't start a new thread until +the previous thread is blocked. +

+A simple fix is to add a tiny sleep to the start of the run +function: +

+

+  import thread, time
+  def run(name, n):
+      time.sleep(0.001) # <---------------------!
+      for i in range(n): print name, i
+  for i in range(10):
+      thread.start_new(run, (i, 100))
+  time.sleep(10)
+
+Some more hints: +

+Instead of using a time.sleep() call at the end, it's +better to use some kind of semaphore mechanism. One idea is to +use a the Queue module to create a queue object, let each thread +append a token to the queue when it finishes, and let the main +thread read as many tokens from the queue as there are threads. +

+Use the threading module instead of the thread module. It's part +of Python since version 1.5.1. It takes care of all these details, +and has many other nice features too! +

+ +Edit this entry / +Log info + +/ Last changed on Fri Feb 7 16:21:55 2003 by +GvR +

+ +


+

4.87. Why doesn't closing sys.stdout (stdin, stderr) really close it?

+Python file objects are a high-level layer of abstraction on top of C streams, which in turn are a medium-level layer of abstraction on top of (among other things) low-level C file descriptors. +

+For most file objects f you create in Python via the builtin "open" function, f.close() marks the Python file object as being closed from Python's point of view, and also arranges to close the underlying C stream. This happens automatically too, in f's destructor, when f becomes garbage. +

+But stdin, stdout and stderr are treated specially by Python, because of the special status also given to them by C: doing +

+

+    sys.stdout.close() # ditto for stdin and stderr
+
+marks the Python-level file object as being closed, but does not close the associated C stream (provided sys.stdout is still bound to its default value, which is the stream C also calls "stdout"). +

+To close the underlying C stream for one of these three, you should first be sure that's what you really want to do (e.g., you may confuse the heck out of extension modules trying to do I/O). If it is, use os.close: +

+

+    os.close(0)   # close C's stdin stream
+    os.close(1)   # close C's stdout stream
+    os.close(2)   # close C's stderr stream
+
+

+ +Edit this entry / +Log info + +/ Last changed on Sat Apr 17 02:22:35 1999 by +Tim Peters +

+ +


+

4.88. What kinds of global value mutation are thread-safe?

+[adapted from c.l.py responses by Gordon McMillan & GvR] +

+A global interpreter lock (GIL) is used internally to ensure that only one thread runs in the Python VM at a time. In general, Python offers to switch among threads only between bytecode instructions (how frequently it offers to switch can be set via sys.setcheckinterval). Each bytecode instruction-- and all the C implementation code reached from it --is therefore atomic. +

+In theory, this means an exact accounting requires an exact understanding of the PVM bytecode implementation. In practice, it means that operations on shared vrbls of builtin data types (ints, lists, dicts, etc) that "look atomic" really are. +

+For example, these are atomic (L, L1, L2 are lists, D, D1, D2 are dicts, x, y +are objects, i, j are ints): +

+

+    L.append(x)
+    L1.extend(L2)
+    x = L[i]
+    x = L.pop()
+    L1[i:j] = L2
+    L.sort()
+    x = y
+    x.field = y
+    D[x] = y
+    D1.update(D2)
+    D.keys()
+
+These aren't: +

+

+    i = i+1
+    L.append(L[-1])
+    L[i] = L[j]
+    D[x] = D[x] + 1
+
+Note: operations that replace other objects may invoke those other objects' __del__ method when their reference count reaches zero, and that can affect things. This is especially true for the mass updates to dictionaries and lists. When in doubt, use a mutex! +

+ +Edit this entry / +Log info + +/ Last changed on Fri Feb 7 16:21:03 2003 by +GvR +

+ +


+

4.89. How do I modify a string in place?

+Strings are immutable (see question 6.2) so you cannot modify a string +directly. If you need an object with this ability, try converting the +string to a list or take a look at the array module. +

+

+    >>> s = "Hello, world"
+    >>> a = list(s)
+    >>> print a
+    ['H', 'e', 'l', 'l', 'o', ',', ' ', 'w', 'o', 'r', 'l', 'd']
+    >>> a[7:] = list("there!")
+    >>> import string
+    >>> print string.join(a, '')
+    'Hello, there!'
+
+
+    >>> import array
+    >>> a = array.array('c', s)
+    >>> print a
+    array('c', 'Hello, world')
+    >>> a[0] = 'y' ; print a
+    array('c', 'yello world')
+    >>> a.tostring()
+    'yello, world'
+
+

+ +Edit this entry / +Log info + +/ Last changed on Tue May 18 01:22:47 1999 by +Andrew Dalke +

+ +


+

4.90. How to pass on keyword/optional parameters/arguments

+Q: How can I pass on optional or keyword parameters from one function to another? +

+

+	def f1(a, *b, **c):
+		...
+
+A: In Python 2.0 and above: +

+

+	def f2(x, *y, **z):
+		...
+		z['width']='14.3c'
+		...
+		f1(x, *y, **z)
+
+
+   Note: y can be any sequence (e.g., list or tuple) and z must be a dict.
+
+

+A: For versions prior to 2.0, use 'apply', like: +

+

+	def f2(x, *y, **z):
+		...
+		z['width']='14.3c'
+		...
+		apply(f1, (x,)+y, z)
+
+

+ +Edit this entry / +Log info + +/ Last changed on Mon Jun 3 07:20:56 2002 by +Matthias Urlichs +

+ +


+

4.91. How can I get a dictionary to display its keys in a consistent order?

+In general, dictionaries store their keys in an unpredictable order, +so the display order of a dictionary's elements will be similarly +unpredictable. +(See +Question 6.12 +to understand why this is so.) +

+This can be frustrating if you want to save a printable version to a +file, make some changes and then compare it with some other printed +dictionary. If you have such needs you can subclass UserDict.UserDict +to create a SortedDict class that prints itself in a predictable order. +Here's one simpleminded implementation of such a class: +

+

+  import UserDict, string
+
+
+  class SortedDict(UserDict.UserDict):
+    def __repr__(self):
+      result = []
+      append = result.append
+      keys = self.data.keys()
+      keys.sort()
+      for k in keys:
+        append("%s: %s" % (`k`, `self.data[k]`))
+      return "{%s}" % string.join(result, ", ")
+
+
+    ___str__ = __repr__
+
+

+This will work for many common situations you might encounter, though +it's far from a perfect solution. (It won't have any effect on the +pprint module and does not transparently handle values that are or +contain dictionaries. +

+ +Edit this entry / +Log info + +/ Last changed on Thu Sep 16 17:31:06 1999 by +Skip Montanaro +

+ +


+

4.92. Is there a Python tutorial?

+Yes. See question 1.20 at +http://www.python.org/doc/FAQ.html#1.20 +

+ +Edit this entry / +Log info + +/ Last changed on Sat Dec 4 16:04:00 1999 by +TAB +

+ +


+

4.93. Deleted

+See 4.28 +

+ +Edit this entry / +Log info + +/ Last changed on Tue May 28 20:40:37 2002 by +GvR +

+ +


+

4.94. How do I get a single keypress without blocking?

+There are several solutions; some involve using curses, which is a +pretty big thing to learn. Here's a solution without curses. (see also 4.74, for Windows, see question 8.2) +

+

+  import termios, fcntl, sys, os
+  fd = sys.stdin.fileno()
+
+
+  oldterm = termios.tcgetattr(fd)
+  newattr = termios.tcgetattr(fd)
+  newattr[3] = newattr[3] & ~termios.ICANON & ~termios.ECHO
+  termios.tcsetattr(fd, termios.TCSANOW, newattr)
+
+
+  oldflags = fcntl.fcntl(fd, fcntl.F_GETFL)
+  fcntl.fcntl(fd, fcntl.F_SETFL, oldflags | os.O_NONBLOCK)
+
+
+  try:
+      while 1:
+          try:
+              c = sys.stdin.read(1)
+              print "Got character", `c`
+          except IOError: pass
+  finally:
+      termios.tcsetattr(fd, termios.TCSAFLUSH, oldterm)
+      fcntl.fcntl(fd, fcntl.F_SETFL, oldflags)
+
+

+You need the termios and the fcntl module for any of this to work, +and I've only tried it on Linux, though it should work elsewhere. +

+In this code, characters are read and printed one at a time. +

+termios.tcsetattr() turns off stdin's echoing and disables canonical +mode. fcntl.fnctl() is used to obtain stdin's file descriptor flags +and modify them for non-blocking mode. Since reading stdin when it is +empty results in an IOError, this error is caught and ignored. +

+ +Edit this entry / +Log info + +/ Last changed on Thu Oct 24 00:39:06 2002 by +chris +

+ +


+

4.95. Is there an equivalent to Perl chomp()? (Remove trailing newline from string)

+There are two partial substitutes. If you want to remove all trailing +whitespace, use the method string.rstrip(). Otherwise, if there is only +one line in the string, use string.splitlines()[0]. +

+

+ -----------------------------------------------------------------------
+
+
+ rstrip() is too greedy, it strips all trailing white spaces.
+ splitlines() takes ControlM as line boundary.
+ Consider these strings as input:
+   "python python    \r\n"
+   "python\rpython\r\n"
+   "python python   \r\r\r\n"
+ The results from rstrip()/splitlines() are perhaps not what we want.
+
+
+ It seems re can perform this task.
+
+

+

+ #!/usr/bin/python 
+ # requires python2                                                             
+
+
+ import re, os, StringIO
+
+
+ lines=StringIO.StringIO(
+   "The Python Programming Language\r\n"
+   "The Python Programming Language \r \r \r\r\n"
+   "The\rProgramming\rLanguage\r\n"
+   "The\rProgramming\rLanguage\r\r\r\r\n"
+   "The\r\rProgramming\r\rLanguage\r\r\r\r\n"
+ )
+
+
+ ln=re.compile("(?:[\r]?\n|\r)$") # dos:\r\n, unix:\n, mac:\r, others: unknown
+ # os.linesep does not work if someone ftps(in binary mode) a dos/mac text file
+ # to your unix box
+ #ln=re.compile(os.linesep + "$")
+
+
+ while 1:
+   s=lines.readline()
+   if not s: break
+   print "1.(%s)" % `s.rstrip()`
+   print "2.(%s)" % `ln.sub( "", s, 1)`
+   print "3.(%s)" % `s.splitlines()[0]`
+   print "4.(%s)" % `s.splitlines()`
+   print
+
+
+ lines.close()
+
+

+ +Edit this entry / +Log info + +/ Last changed on Wed Aug 8 09:51:34 2001 by +Crystal +

+ +


+

4.96. Why is join() a string method when I'm really joining the elements of a (list, tuple, sequence)?

+Strings became much more like other standard types starting in release 1.6, when methods were added which give the same functionality that has always been available using the functions of the string module. These new methods have been widely accepted, but the one which appears to make (some) programmers feel uncomfortable is: +

+

+    ", ".join(['1', '2', '4', '8', '16'])
+
+which gives the result +

+

+    "1, 2, 4, 8, 16"
+
+There are two usual arguments against this usage. +

+The first runs along the lines of: "It looks really ugly using a method of a string literal (string constant)", to which the answer is that it might, but a string literal is just a fixed value. If the methods are to be allowed on names bound to strings there is no logical reason to make them unavailable on literals. Get over it! +

+The second objection is typically cast as: "I am really telling a sequence to join its members together with a string constant". Sadly, you aren't. For some reason there seems to be much less difficulty with having split() as a string method, since in that case it is easy to see that +

+

+    "1, 2, 4, 8, 16".split(", ")
+
+is an instruction to a string literal to return the substrings delimited by the given separator (or, by default, arbitrary runs of white space). In this case a Unicode string returns a list of Unicode strings, an ASCII string returns a list of ASCII strings, and everyone is happy. +

+join() is a string method because in using it you are telling the separator string to iterate over an arbitrary sequence, forming string representations of each of the elements, and inserting itself between the elements' representations. This method can be used with any argument which obeys the rules for sequence objects, inluding any new classes you might define yourself. +

+Because this is a string method it can work for Unicode strings as well as plain ASCII strings. If join() were a method of the sequence types then the sequence types would have to decide which type of string to return depending on the type of the separator. +

+If none of these arguments persuade you, then for the moment you can continue to use the join() function from the string module, which allows you to write +

+

+    string.join(['1', '2', '4', '8', '16'], ", ")
+
+You will just have to try and forget that the string module actually uses the syntax you are compaining about to implement the syntax you prefer! +

+ +Edit this entry / +Log info + +/ Last changed on Fri Aug 2 15:51:58 2002 by +Steve Holden +

+ +


+

4.97. How can my code discover the name of an object?

+Generally speaking, it can't, because objects don't really have names. The assignment statement does not store the assigned value in the name but a reference to it. Essentially, assignment creates a binding of a name to a value. The same is true of def and class statements, but in that case the value is a callable. Consider the following code: +

+

+    class A:
+        pass
+
+
+    B = A
+
+
+    a = B()
+    b = a
+    print b
+    <__main__.A instance at 016D07CC>
+    print a
+    <__main__.A instance at 016D07CC>
+
+

+Arguably the class has a name: even though it is bound to two names and invoked through the name B the created instance is still reported as an instance of class A. However, it is impossible to say whether the instance's name is a or b, since both names are bound to the same value. +

+Generally speaking it should not be necessary for your code to "know the names" of particular values. Unless you are deliberately writing introspective programs, this is usually an indication that a change of approach might be beneficial. +

+ +Edit this entry / +Log info + +/ Last changed on Thu Mar 8 03:53:39 2001 by +Steve Holden +

+ +


+

4.98. Why are floating point calculations so inaccurate?

+The development version of the Python Tutorial now contains an Appendix with more info: +
+    http://www.python.org/doc/current/tut/node14.html
+
+People are often very surprised by results like this: +

+

+ >>> 1.2-1.0
+ 0.199999999999999996
+
+And think it is a bug in Python. It's not. It's a problem caused by +the internal representation of a floating point number. A floating point +number is stored as a fixed number of binary digits. +

+In decimal math, there are many numbers that can't be represented +with a fixed number of decimal digits, i.e. +1/3 = 0.3333333333....... +

+In the binary case, 1/2 = 0.1, 1/4 = 0.01, 1/8 = 0.001, etc. There are +a lot of numbers that can't be represented. The digits are cut off at +some point. +

+Since Python 1.6, a floating point's repr() function prints as many +digits are necessary to make eval(repr(f)) == f true for any float f. +The str() function prints the more sensible number that was probably +intended: +

+

+ >>> 0.2
+ 0.20000000000000001
+ >>> print 0.2
+ 0.2
+
+Again, this has nothing to do with Python, but with the way the +underlying C platform handles floating points, and ultimately with +the inaccuracy you'll always have when writing down numbers of fixed +number of digit strings. +

+One of the consequences of this is that it is dangerous to compare +the result of some computation to a float with == ! +Tiny inaccuracies may mean that == fails. +

+Instead try something like this: +

+

+ epsilon = 0.0000000000001 # Tiny allowed error
+ expected_result = 0.4
+
+
+ if expected_result-epsilon <= computation() <= expected_result+epsilon:
+    ...
+
+

+ +Edit this entry / +Log info + +/ Last changed on Mon Apr 1 22:18:47 2002 by +Fred Drake +

+ +


+

4.99. I tried to open Berkeley DB file, but bsddb produces bsddb.error: (22, 'Invalid argument'). Help! How can I restore my data?

+Don't panic! Your data are probably intact. The most frequent cause +for the error is that you tried to open an earlier Berkeley DB file +with a later version of the Berkeley DB library. +

+Many Linux systems now have all three versions of Berkeley DB +available. If you are migrating from version 1 to a newer version use +db_dump185 to dump a plain text version of the database. +If you are migrating from version 2 to version 3 use db2_dump to create +a plain text version of the database. In either case, use db_load to +create a new native database for the latest version installed on your +computer. If you have version 3 of Berkeley DB installed, you should +be able to use db2_load to create a native version 2 database. +

+You should probably move away from Berkeley DB version 1 files because +the hash file code contains known bugs that can corrupt your data. +

+ +Edit this entry / +Log info + +/ Last changed on Wed Aug 29 16:04:29 2001 by +Skip Montanaro +

+ +


+

4.100. What are the "best practices" for using import in a module?

+First, the standard modules are great. Use them! The standard Python library is large and varied. Using modules can save you time and effort and will reduce maintainenance cost of your code. (Other programs are dedicated to supporting and fixing bugs in the standard Python modules. Coworkers may also be familiar with themodules that you use, reducing the amount of time it takes them to understand your code.) +

+The rest of this answer is largely a matter of personal preference, but here's what some newsgroup posters said (thanks to all who responded) +

+In general, don't use +

+ from modulename import *
+
+Doing so clutters the importer's namespace. Some avoid this idiom even with the few modules that were designed to be imported in this manner. (Modules designed in this manner include Tkinter, thread, and wxPython.) +

+Import modules at the top of a file, one module per line. Doing so makes it clear what other modules your code requires and avoids questions of whether the module name is in scope. Using one import per line makes it easy to add and delete module imports. +

+Move imports into a local scope (such as at the top of a function definition) if there are a lot of imports, and you're trying to avoid the cost (lots of initialization time) of many imports. This technique is especially helpful if many of the imports are unnecessary depending on how the program executes. You may also want to move imports into a function if the modules are only ever used in that function. Note that loading a module the first time may be expensive (because of the one time initialization of the module) but that loading a module multiple times is virtually free (a couple of dictionary lookups). Even if the module name has gone out of scope, the module is probably available in sys.modules. Thus, there isn't really anything wrong with putting no imports at the module level (if they aren't needed) and putting all of the imports at the function level. +

+It is sometimes necessary to move imports to a function or class to avoid problems with circular imports. Gordon says: +

+ Circular imports are fine where both modules use the "import <module>"
+ form of import. They fail when the 2nd module wants to grab a name
+ out of the first ("from module import name") and the import is at
+ the top level. That's because names in the 1st are not yet available,
+ (the first module is busy importing the 2nd).  
+
+In this case, if the 2nd module is only used in one function, then the import can easily be moved into that function. By the time the import is called, the first module will have finished initializing, and the second module can do its import. +

+It may also be necessary to move imports out of the top level of code +if some of the modules are platform-specific. In that case, it may not even be possible to import all of the modules at the top of the file. In this case, importing the correct modules in the corresponding platform-specific code is a good option. +

+If only instances of a specific class uses a module, then it is reasonable to import the module in the class's __init__ method and then assign the module to an instance variable so that the module is always available (via that instance variable) during the life of the object. Note that to delay an import until the class is instantiated, the import must be inside a method. Putting the import inside the class but outside of any method still causes the import to occur when the module is initialized. +

+ +Edit this entry / +Log info + +/ Last changed on Sat Aug 4 04:44:47 2001 by +TAB +

+ +


+

4.101. Is there a tool to help find bugs or perform static analysis?

+Yes. PyChecker is a static analysis tool for finding bugs +in Python source code as well as warning about code complexity +and style. +

+You can get PyChecker from: http://pychecker.sf.net. +

+ +Edit this entry / +Log info + +/ Last changed on Fri Aug 10 15:42:11 2001 by +Neal +

+ +


+

4.102. UnicodeError: ASCII [decoding,encoding] error: ordinal not in range(128)

+This error indicates that your Python installation can handle +only 7-bit ASCII strings. There are a couple ways to fix or +workaround the problem. +

+If your programs must handle data in arbitary character set encodings, the environment the application runs in will generally identify the encoding of the data it is handing you. You need to convert the input to Unicode data using that encoding. For instance, a program that handles email or web input will typically find character set encoding information in Content-Type headers. This can then be used to properly convert input data to Unicode. Assuming the string referred to by "value" is encoded as UTF-8: +

+

+    value = unicode(value, "utf-8")
+
+will return a Unicode object. If the data is not correctly encoded as UTF-8, the above call will raise a UnicodeError. +

+If you only want strings coverted to Unicode which have non-ASCII data, you can try converting them first assuming an ASCII encoding, and then generate Unicode objects if that fails: +

+

+    try:
+        x = unicode(value, "ascii")
+    except UnicodeError:
+        value = unicode(value, "utf-8")
+    else:
+        # value was valid ASCII data
+        pass
+
+

+If you normally use a character set encoding other than US-ASCII and only need to handle data in that encoding, the simplest way to fix the problem may be simply to set the encoding in sitecustomize.py. The following code is just a modified version of the encoding setup code from site.py with the relevant lines uncommented. +

+

+    # Set the string encoding used by the Unicode implementation.
+    # The default is 'ascii'
+    encoding = "ascii" # <= CHANGE THIS if you wish
+
+
+    # Enable to support locale aware default string encodings.
+    import locale
+    loc = locale.getdefaultlocale()
+    if loc[1]:
+        encoding = loc[1]
+    if encoding != "ascii":
+        import sys
+        sys.setdefaultencoding(encoding)
+
+

+Also note that on Windows, there is an encoding known as "mbcs", which uses an encoding specific to your current locale. In many cases, and particularly when working with COM, this may be an appropriate default encoding to use. +

+ +Edit this entry / +Log info + +/ Last changed on Sat Apr 13 04:45:41 2002 by +Skip Montanaro +

+ +


+

4.103. Using strings to call functions/methods

+There are various techniques: +

+* Use a dictionary pre-loaded with strings and functions. The primary +advantage of this technique is that the strings do not need to match the +names of the functions. This is also the primary technique used to +emulate a case construct: +

+

+    def a():
+        pass
+
+
+    def b():
+        pass
+
+
+    dispatch = {'go': a, 'stop': b}  # Note lack of parens for funcs
+
+
+    dispatch[get_input()]()  # Note trailing parens to call function
+
+* Use the built-in function getattr(): +

+

+    import foo
+    getattr(foo, 'bar')()
+
+Note that getattr() works on any object, including classes, class +instances, modules, and so on. +

+This is used in several places in the standard library, like +this: +

+

+    class Foo:
+        def do_foo(self):
+            ...
+
+
+        def do_bar(self):
+            ...
+
+
+     f = getattr(foo_instance, 'do_' + opname)
+     f()
+
+

+* Use locals() or eval() to resolve the function name: +

+def myFunc(): +

+    print "hello"
+
+fname = "myFunc" +

+f = locals()[fname] +f() +

+f = eval(fname) +f() +

+Note: Using eval() can be dangerous. If you don't have absolute control +over the contents of the string, all sorts of things could happen... +

+ +Edit this entry / +Log info + +/ Last changed on Thu Mar 21 08:14:58 2002 by +Erno Kuusela +

+ +


+

4.104. How fast are exceptions?

+A try/except block is extremely efficient. Actually executing an +exception is expensive. In older versions of Python (prior to 2.0), it +was common to code this idiom: +

+

+    try:
+        value = dict[key]
+    except KeyError:
+        dict[key] = getvalue(key)
+        value = dict[key]
+
+This idiom only made sense when you expected the dict to have the key +95% of the time or more; other times, you coded it like this: +

+

+    if dict.has_key(key):
+        value = dict[key]
+    else:
+        dict[key] = getvalue(key)
+        value = dict[key]
+
+In Python 2.0 and higher, of course, you can code this as +

+

+    value = dict.setdefault(key, getvalue(key))
+
+However this evaluates getvalue(key) always, regardless of whether it's needed or not. So if it's slow or has a side effect you should use one of the above variants. +

+ +Edit this entry / +Log info + +/ Last changed on Mon Dec 9 10:12:30 2002 by +Yeti +

+ +


+

4.105. Sharing global variables across modules

+The canonical way to share information across modules within a single +program is to create a special module (often called config or cfg). +Just import the config module in all modules of your application; the +module then becomes available as a global name. Because there is only +one instance of each module, any changes made to the module object get +reflected everywhere. For example: +

+config.py: +

+

+    pass
+
+mod.py: +

+

+    import config
+    config.x = 1
+
+main.py: +

+

+    import config
+    import mod
+    print config.x
+
+Note that using a module is also the basis for implementing the +Singleton design pattern, for the same reason. +

+ +Edit this entry / +Log info + +/ Last changed on Tue Apr 23 23:07:19 2002 by +Aahz +

+ +


+

4.106. Why is cPickle so slow?

+Use the binary option. We'd like to make that the default, but it would +break backward compatibility: +

+

+    largeString = 'z' * (100 * 1024)
+    myPickle = cPickle.dumps(largeString, 1)
+
+

+ +Edit this entry / +Log info + +/ Last changed on Thu Aug 22 19:54:25 2002 by +Aahz +

+ +


+

4.107. When importing module XXX, why do I get "undefined symbol: PyUnicodeUCS2_..." ?

+You are using a version of Python that uses a 4-byte representation for +Unicode characters, but the extension module you are importing (possibly +indirectly) was compiled using a Python that uses a 2-byte representation +for Unicode characters (the default). +

+If instead the name of the undefined symbol starts with PyUnicodeUCS4_, +the problem is the same by the relationship is reversed: Python was +built using 2-byte Unicode characters, and the extension module was +compiled using a Python with 4-byte Unicode characters. +

+This can easily occur when using pre-built extension packages. RedHat +Linux 7.x, in particular, provides a "python2" binary that is compiled +with 4-byte Unicode. This only causes the link failure if the extension +uses any of the PyUnicode_*() functions. It is also a problem if if an +extension uses any of the Unicode-related format specifiers for +Py_BuildValue (or similar) or parameter-specifications for +PyArg_ParseTuple(). +

+You can check the size of the Unicode character a Python interpreter is +using by checking the value of sys.maxunicode: +

+

+  >>> import sys
+  >>> if sys.maxunicode > 65535:
+  ...     print 'UCS4 build'
+  ... else:
+  ...     print 'UCS2 build'
+
+The only way to solve this problem is to use extension modules compiled +with a Python binary built using the same size for Unicode characters. +

+ +Edit this entry / +Log info + +/ Last changed on Tue Aug 27 15:00:17 2002 by +Fred Drake +

+ +


+

4.108. How do I create a .pyc file?

+QUESTION: +

+I have a module and I wish to generate a .pyc file. +How do I do it? Everything I read says that generation of a .pyc file is +"automatic", but I'm not getting anywhere. +

+

+ANSWER: +

+When a module is imported for the first time (or when the source is more +recent than the current compiled file) a .pyc file containing the compiled code should be created in the +same directory as the .py file. +

+One reason that a .pyc file may not be created is permissions problems with the directory. This can happen, for example, if you develop as one user but run as another, such as if you are testing with a web server. +

+However, in most cases, that's not the problem. +

+Creation of a .pyc file is "automatic" if you are importing a module and Python has the +ability (permissions, free space, etc...) to write the compiled module +back to the directory. But note that running Python on a top level script is not considered an +import and so no .pyc will be created automatically. For example, if you have a top-level module abc.py that imports another module xyz.py, when you run abc, xyz.pyc will be created since xyz is imported, but no abc.pyc file will be created since abc isn't imported. +

+If you need to create abc.pyc -- that is, to create a .pyc file for a +module that is not imported -- you can. (Look up +the py_compile and compileall modules in the Library Reference.) +

+You can manually compile any module using the "py_compile" module. One +way is to use the compile() function in that module interactively: +

+

+    >>> import py_compile
+    >>> py_compile.compile('abc.py')
+
+This will write the .pyc to the same location as abc.py (or you +can override that with the optional parameter cfile). +

+You can also automatically compile all files in a directory or +directories using the "compileall" module, which can also be run +straight from the command line. +

+You can do it from the shell (or DOS) prompt by entering: +

+       python compile.py abc.py
+
+or +
+       python compile.py *
+
+Or you can write a script to do it on a list of filenames that you enter. +

+

+     import sys
+     from py_compile import compile
+
+
+     if len(sys.argv) <= 1:
+        sys.exit(1)
+
+
+     for file in sys.argv[1:]:
+        compile(file)
+
+ACKNOWLEDGMENTS: +

+Steve Holden, David Bolen, Rich Somerfield, Oleg Broytmann, Steve Ferg +

+ +Edit this entry / +Log info + +/ Last changed on Wed Feb 12 15:58:25 2003 by +Stephen Ferg +

+ +


+

5. Extending Python

+ +
+

5.1. Can I create my own functions in C?

+Yes, you can create built-in modules containing functions, +variables, exceptions and even new types in C. This is explained in +the document "Extending and Embedding the Python Interpreter" (http://www.python.org/doc/current/ext/ext.html). Also read the chapter +on dynamic loading. +

+There's more information on this in each of the Python books: +Programming Python, Internet Programming with Python, and Das Python-Buch +(in German). +

+ +Edit this entry / +Log info + +/ Last changed on Mon Dec 10 05:18:57 2001 by +Fred L. Drake, Jr. +

+ +


+

5.2. Can I create my own functions in C++?

+Yes, using the C-compatibility features found in C++. Basically +you place extern "C" { ... } around the Python include files and put +extern "C" before each function that is going to be called by the +Python interpreter. Global or static C++ objects with constructors +are probably not a good idea. +

+ +Edit this entry / +Log info +

+ +


+

5.3. How can I execute arbitrary Python statements from C?

+The highest-level function to do this is PyRun_SimpleString() which takes +a single string argument which is executed in the context of module +__main__ and returns 0 for success and -1 when an exception occurred +(including SyntaxError). If you want more control, use PyRun_String(); +see the source for PyRun_SimpleString() in Python/pythonrun.c. +

+ +Edit this entry / +Log info + +/ Last changed on Fri May 23 20:08:14 1997 by +Bill Tutt +

+ +


+

5.4. How can I evaluate an arbitrary Python expression from C?

+Call the function PyRun_String() from the previous question with the +start symbol eval_input (Py_eval_input starting with 1.5a1); it +parses an expression, evaluates it and returns its value. +

+ +Edit this entry / +Log info + +/ Last changed on Wed May 21 22:23:18 1997 by +David Ascher +

+ +


+

5.5. How do I extract C values from a Python object?

+That depends on the object's type. If it's a tuple, +PyTupleSize(o) returns its length and PyTuple_GetItem(o, i) +returns its i'th item; similar for lists with PyListSize(o) +and PyList_GetItem(o, i). For strings, PyString_Size(o) returns +its length and PyString_AsString(o) a pointer to its value +(note that Python strings may contain null bytes so strlen() +is not safe). To test which type an object is, first make sure +it isn't NULL, and then use PyString_Check(o), PyTuple_Check(o), +PyList_Check(o), etc. +

+There is also a high-level API to Python objects which is +provided by the so-called 'abstract' interface -- read +Include/abstract.h for further details. It allows for example +interfacing with any kind of Python sequence (e.g. lists and tuples) +using calls like PySequence_Length(), PySequence_GetItem(), etc.) +as well as many other useful protocols. +

+ +Edit this entry / +Log info + +/ Last changed on Wed May 21 22:34:20 1997 by +David Ascher +

+ +


+

5.6. How do I use Py_BuildValue() to create a tuple of arbitrary length?

+You can't. Use t = PyTuple_New(n) instead, and fill it with +objects using PyTuple_SetItem(t, i, o) -- note that this "eats" a +reference count of o. Similar for lists with PyList_New(n) and +PyList_SetItem(l, i, o). Note that you must set all the tuple items to +some value before you pass the tuple to Python code -- +PyTuple_New(n) initializes them to NULL, which isn't a valid Python +value. +

+ +Edit this entry / +Log info + +/ Last changed on Thu Jul 31 18:15:29 1997 by +Guido van Rossum +

+ +


+

5.7. How do I call an object's method from C?

+The PyObject_CallMethod() function can be used to call an arbitrary +method of an object. The parameters are the object, the name of the +method to call, a format string like that used with Py_BuildValue(), and the argument values: +

+

+    PyObject *
+    PyObject_CallMethod(PyObject *object, char *method_name,
+                        char *arg_format, ...);
+
+This works for any object that has methods -- whether built-in or +user-defined. You are responsible for eventually DECREF'ing the +return value. +

+To call, e.g., a file object's "seek" method with arguments 10, 0 +(assuming the file object pointer is "f"): +

+

+        res = PyObject_CallMethod(f, "seek", "(ii)", 10, 0);
+        if (res == NULL) {
+                ... an exception occurred ...
+        }
+        else {
+                Py_DECREF(res);
+        }
+
+Note that since PyObject_CallObject() always wants a tuple for the +argument list, to call a function without arguments, pass "()" for the +format, and to call a function with one argument, surround the argument +in parentheses, e.g. "(i)". +

+ +Edit this entry / +Log info + +/ Last changed on Thu Jun 6 16:15:46 2002 by +Neal Norwitz +

+ +


+

5.8. How do I catch the output from PyErr_Print() (or anything that prints to stdout/stderr)?

+(Due to Mark Hammond): +

+In Python code, define an object that supports the "write()" method. +Redirect sys.stdout and sys.stderr to this object. +Call print_error, or just allow the standard traceback mechanism to +work. Then, the output will go wherever your write() method sends it. +

+The easiest way to do this is to use the StringIO class in the standard +library. +

+Sample code and use for catching stdout: +

+	>>> class StdoutCatcher:
+	...  def __init__(self):
+	...   self.data = ''
+	...  def write(self, stuff):
+	...   self.data = self.data + stuff
+	...  
+	>>> import sys
+	>>> sys.stdout = StdoutCatcher()
+	>>> print 'foo'
+	>>> print 'hello world!'
+	>>> sys.stderr.write(sys.stdout.data)
+	foo
+	hello world!
+
+

+ +Edit this entry / +Log info + +/ Last changed on Wed Dec 16 18:34:25 1998 by +Richard Jones +

+ +


+

5.9. How do I access a module written in Python from C?

+You can get a pointer to the module object as follows: +

+

+        module = PyImport_ImportModule("<modulename>");
+
+If the module hasn't been imported yet (i.e. it is not yet present in +sys.modules), this initializes the module; otherwise it simply returns +the value of sys.modules["<modulename>"]. Note that it doesn't enter +the module into any namespace -- it only ensures it has been +initialized and is stored in sys.modules. +

+You can then access the module's attributes (i.e. any name defined in +the module) as follows: +

+

+        attr = PyObject_GetAttrString(module, "<attrname>");
+
+Calling PyObject_SetAttrString(), to assign to variables in the module, also works. +

+ +Edit this entry / +Log info + +/ Last changed on Wed May 21 22:56:40 1997 by +david ascher +

+ +


+

5.10. How do I interface to C++ objects from Python?

+Depending on your requirements, there are many approaches. To do +this manually, begin by reading the "Extending and Embedding" document +(Doc/ext.tex, see also http://www.python.org/doc/). Realize +that for the Python run-time system, there isn't a whole lot of +difference between C and C++ -- so the strategy to build a new Python +type around a C structure (pointer) type will also work for C++ +objects. +

+A useful automated approach (which also works for C) is SWIG: +http://www.swig.org/. +

+ +Edit this entry / +Log info + +/ Last changed on Fri Oct 15 05:14:01 1999 by +Sjoerd Mullender +

+ +


+

5.11. mSQLmodule (or other old module) won't build with Python 1.5 (or later)

+Since python-1.4 "Python.h" will have the file includes needed in an +extension module. +Backward compatibility is dropped after version 1.4 and therefore +mSQLmodule.c will not build as "allobjects.h" cannot be found. +The following change in mSQLmodule.c is harmless when building it with +1.4 and necessary when doing so for later python versions: +

+Remove lines: +

+

+	#include "allobjects.h"
+	#include "modsupport.h"
+
+And insert instead: +

+

+	#include "Python.h"
+
+You may also need to add +

+

+                #include "rename2.h"
+
+if the module uses "old names". +

+This may happen with other ancient python modules as well, +and the same fix applies. +

+ +Edit this entry / +Log info + +/ Last changed on Sun Dec 21 02:03:35 1997 by +GvR +

+ +


+

5.12. I added a module using the Setup file and the make fails! Huh?

+Setup must end in a newline, if there is no newline there it gets +very sad. Aside from this possibility, maybe you have other +non-Python-specific linkage problems. +

+ +Edit this entry / +Log info + +/ Last changed on Tue Jun 24 15:54:01 1997 by +aaron watters +

+ +


+

5.13. I want to compile a Python module on my Red Hat Linux system, but some files are missing.

+Red Hat's RPM for Python doesn't include the +/usr/lib/python1.x/config/ directory, which contains various files required +for compiling Python extensions. +Install the python-devel RPM to get the necessary files. +

+ +Edit this entry / +Log info + +/ Last changed on Tue Jan 26 13:44:04 1999 by +A.M. Kuchling +

+ +


+

5.14. What does "SystemError: _PyImport_FixupExtension: module yourmodule not loaded" mean?

+This means that you have created an extension module named "yourmodule", but your module init function does not initialize with that name. +

+Every module init function will have a line similar to: +

+

+  module = Py_InitModule("yourmodule", yourmodule_functions);
+
+If the string passed to this function is not the same name as your extenion module, the SystemError will be raised. +

+ +Edit this entry / +Log info + +/ Last changed on Thu Mar 25 07:16:08 1999 by +Mark Hammond +

+ +


+

5.15. How to tell "incomplete input" from "invalid input"?

+Sometimes you want to emulate the Python interactive interpreter's +behavior, where it gives you a continuation prompt when the input +is incomplete (e.g. you typed the start of an "if" statement +or you didn't close your parentheses or triple string quotes), +but it gives you a syntax error message immediately when the input +is invalid. +

+In Python you can use the codeop module, which approximates the +parser's behavior sufficiently. IDLE uses this, for example. +

+The easiest way to do it in C is to call PyRun_InteractiveLoop() +(in a separate thread maybe) and let the Python interpreter handle +the input for you. You can also set the PyOS_ReadlineFunctionPointer +to point at your custom input function. See Modules/readline.c and +Parser/myreadline.c for more hints. +

+However sometimes you have to run the embedded Python interpreter +in the same thread as your rest application and you can't allow the +PyRun_InteractiveLoop() to stop while waiting for user input. +The one solution then is to call PyParser_ParseString() +and test for e.error equal to E_EOF (then the input is incomplete). +Sample code fragment, untested, inspired by code from Alex Farber: +

+

+  #include <Python.h>
+  #include <node.h>
+  #include <errcode.h>
+  #include <grammar.h>
+  #include <parsetok.h>
+  #include <compile.h>
+
+
+  int testcomplete(char *code)
+    /* code should end in \n */
+    /* return -1 for error, 0 for incomplete, 1 for complete */
+  {
+    node *n;
+    perrdetail e;
+
+
+    n = PyParser_ParseString(code, &_PyParser_Grammar,
+                             Py_file_input, &e);
+    if (n == NULL) {
+      if (e.error == E_EOF) 
+        return 0;
+      return -1;
+    }
+
+
+    PyNode_Free(n);
+    return 1;
+  }
+
+Another solution is trying to compile the received string with +Py_CompileString(). If it compiles fine - try to execute the returned +code object by calling PyEval_EvalCode(). Otherwise save the input for +later. If the compilation fails, find out if it's an error or just +more input is required - by extracting the message string from the +exception tuple and comparing it to the "unexpected EOF while parsing". +Here is a complete example using the GNU readline library (you may +want to ignore SIGINT while calling readline()): +

+

+  #include <stdio.h>
+  #include <readline.h>
+
+
+  #include <Python.h>
+  #include <object.h>
+  #include <compile.h>
+  #include <eval.h>
+
+
+  int main (int argc, char* argv[])
+  {
+    int i, j, done = 0;                          /* lengths of line, code */
+    char ps1[] = ">>> ";
+    char ps2[] = "... ";
+    char *prompt = ps1;
+    char *msg, *line, *code = NULL;
+    PyObject *src, *glb, *loc;
+    PyObject *exc, *val, *trb, *obj, *dum;
+
+
+    Py_Initialize ();
+    loc = PyDict_New ();
+    glb = PyDict_New ();
+    PyDict_SetItemString (glb, "__builtins__", PyEval_GetBuiltins ());
+
+
+    while (!done)
+    {
+      line = readline (prompt);
+
+
+      if (NULL == line)                          /* CTRL-D pressed */
+      {
+        done = 1;
+      }
+      else
+      {
+        i = strlen (line);
+
+
+        if (i > 0)
+          add_history (line);                    /* save non-empty lines */
+
+
+        if (NULL == code)                        /* nothing in code yet */
+          j = 0;
+        else
+          j = strlen (code);
+
+
+        code = realloc (code, i + j + 2);
+        if (NULL == code)                        /* out of memory */
+          exit (1);
+
+
+        if (0 == j)                              /* code was empty, so */
+          code[0] = '\0';                        /* keep strncat happy */
+
+
+        strncat (code, line, i);                 /* append line to code */
+        code[i + j] = '\n';                      /* append '\n' to code */
+        code[i + j + 1] = '\0';
+
+
+        src = Py_CompileString (code, "<stdin>", Py_single_input);       
+
+
+        if (NULL != src)                         /* compiled just fine - */
+        {
+          if (ps1  == prompt ||                  /* ">>> " or */
+              '\n' == code[i + j - 1])           /* "... " and double '\n' */
+          {                                               /* so execute it */
+            dum = PyEval_EvalCode ((PyCodeObject *)src, glb, loc);
+            Py_XDECREF (dum);
+            Py_XDECREF (src);
+            free (code);
+            code = NULL;
+            if (PyErr_Occurred ())
+              PyErr_Print ();
+            prompt = ps1;
+          }
+        }                                        /* syntax error or E_EOF? */
+        else if (PyErr_ExceptionMatches (PyExc_SyntaxError))           
+        {
+          PyErr_Fetch (&exc, &val, &trb);        /* clears exception! */
+
+
+          if (PyArg_ParseTuple (val, "sO", &msg, &obj) &&
+              !strcmp (msg, "unexpected EOF while parsing")) /* E_EOF */
+          {
+            Py_XDECREF (exc);
+            Py_XDECREF (val);
+            Py_XDECREF (trb);
+            prompt = ps2;
+          }
+          else                                   /* some other syntax error */
+          {
+            PyErr_Restore (exc, val, trb);
+            PyErr_Print ();
+            free (code);
+            code = NULL;
+            prompt = ps1;
+          }
+        }
+        else                                     /* some non-syntax error */
+        {
+          PyErr_Print ();
+          free (code);
+          code = NULL;
+          prompt = ps1;
+        }
+
+
+        free (line);
+      }
+    }
+
+
+    Py_XDECREF(glb);
+    Py_XDECREF(loc);
+    Py_Finalize();
+    exit(0);
+  }
+
+

+ +Edit this entry / +Log info + +/ Last changed on Wed Mar 15 09:47:24 2000 by +Alex Farber +

+ +


+

5.16. How do I debug an extension?

+When using gdb with dynamically loaded extensions, you can't set a +breakpoint in your extension until your extension is loaded. +

+In your .gdbinit file (or interactively), add the command +

+br _PyImport_LoadDynamicModule +

+

+$ gdb /local/bin/python +

+gdb) run myscript.py +

+gdb) continue # repeat until your extension is loaded +

+gdb) finish # so that your extension is loaded +

+gdb) br myfunction.c:50 +

+gdb) continue +

+ +Edit this entry / +Log info + +/ Last changed on Fri Oct 20 11:10:32 2000 by +Joe VanAndel +

+ +


+

5.17. How do I find undefined Linux g++ symbols, __builtin_new or __pure_virtural

+To dynamically load g++ extension modules, you must recompile python, relink python using g++ (change LINKCC in the python Modules Makefile), and link your extension module using g++ (e.g., "g++ -shared -o mymodule.so mymodule.o"). +

+ +Edit this entry / +Log info + +/ Last changed on Sun Jan 14 18:03:51 2001 by +douglas orr +

+ +


+

5.18. How do I define and create objects corresponding to built-in/extension types

+Usually you would like to be able to inherit from a Python type when +you ask this question. The bottom line for Python 2.2 is: types and classes are miscible. You build instances by calling classes, and you can build subclasses to your heart's desire. +

+You need to be careful when instantiating immutable types like integers or strings. See http://www.amk.ca/python/2.2/, section 2, for details. +

+Prior to version 2.2, Python (like Java) insisted that there are first-class and second-class objects (the former are types, the latter classes), and never the twain shall meet. +

+The library has, however, done a good job of providing class wrappers for the more commonly desired objects (see UserDict, UserList and UserString for examples), and more are always welcome if you happen to be in the mood to write code. These wrappers still exist in Python 2.2. +

+ +Edit this entry / +Log info + +/ Last changed on Mon Jun 10 15:14:07 2002 by +Matthias Urlichs +

+ +


+

6. Python's design

+ +
+

6.1. Why isn't there a switch or case statement in Python?

+You can do this easily enough with a sequence of +if... elif... elif... else. There have been some proposals for switch +statement syntax, but there is no consensus (yet) on whether and how +to do range tests. +

+ +Edit this entry / +Log info +

+ +


+

6.2. Why does Python use indentation for grouping of statements?

+Basically I believe that using indentation for grouping is +extremely elegant and contributes a lot to the clarity of the average +Python program. Most people learn to love this feature after a while. +Some arguments for it: +

+Since there are no begin/end brackets there cannot be a disagreement +between grouping perceived by the parser and the human reader. I +remember long ago seeing a C fragment like this: +

+

+        if (x <= y)
+                x++;
+                y--;
+        z++;
+
+and staring a long time at it wondering why y was being decremented +even for x > y... (And I wasn't a C newbie then either.) +

+Since there are no begin/end brackets, Python is much less prone to +coding-style conflicts. In C there are loads of different ways to +place the braces (including the choice whether to place braces around +single statements in certain cases, for consistency). If you're used +to reading (and writing) code that uses one style, you will feel at +least slightly uneasy when reading (or being required to write) +another style. +Many coding styles place begin/end brackets on a line by themself. +This makes programs considerably longer and wastes valuable screen +space, making it harder to get a good overview over a program. +Ideally, a function should fit on one basic tty screen (say, 20 +lines). 20 lines of Python are worth a LOT more than 20 lines of C. +This is not solely due to the lack of begin/end brackets (the lack of +declarations also helps, and the powerful operations of course), but +it certainly helps! +

+ +Edit this entry / +Log info + +/ Last changed on Wed May 21 16:00:15 1997 by +GvR +

+ +


+

6.3. Why are Python strings immutable?

+There are two advantages. One is performance: knowing that a +string is immutable makes it easy to lay it out at construction time +-- fixed and unchanging storage requirements. (This is also one of +the reasons for the distinction between tuples and lists.) The +other is that strings in Python are considered as "elemental" as +numbers. No amount of activity will change the value 8 to anything +else, and in Python, no amount of activity will change the string +"eight" to anything else. (Adapted from Jim Roskind) +

+ +Edit this entry / +Log info +

+ +


+

6.4. Delete

+

+

+ +Edit this entry / +Log info + +/ Last changed on Tue Jan 2 03:05:25 2001 by +Moshe Zadka +

+ +


+

6.5. Why does Python use methods for some functionality (e.g. list.index()) but functions for other (e.g. len(list))?

+The major reason is history. Functions were used for those +operations that were generic for a group of types and which +were intended to work even for objects that didn't have +methods at all (e.g. numbers before type/class unification +began, or tuples). +

+It is also convenient to have a function that can readily be applied +to an amorphous collection of objects when you use the functional features of Python (map(), apply() et al). +

+In fact, implementing len(), max(), min() as a built-in function is +actually less code than implementing them as methods for each type. +One can quibble about individual cases but it's a part of Python, +and it's too late to change such things fundamentally now. The +functions have to remain to avoid massive code breakage. +

+Note that for string operations Python has moved from external functions +(the string module) to methods. However, len() is still a function. +

+ +Edit this entry / +Log info + +/ Last changed on Thu May 30 14:08:58 2002 by +Steve Holden +

+ +


+

6.6. Why can't I derive a class from built-in types (e.g. lists or files)?

+As of Python 2.2, you can derive from built-in types. For previous versions, the answer is: +

+This is caused by the relatively late addition of (user-defined) +classes to the language -- the implementation framework doesn't easily +allow it. See the answer to question 4.2 for a work-around. This +may be fixed in the (distant) future. +

+ +Edit this entry / +Log info + +/ Last changed on Thu May 23 02:53:22 2002 by +Neal Norwitz +

+ +


+

6.7. Why must 'self' be declared and used explicitly in method definitions and calls?

+So, is your current programming language C++ or Java? :-) +When classes were added to Python, this was (again) the simplest way of +implementing methods without too many changes to the interpreter. The +idea was borrowed from Modula-3. It turns out to be very useful, for +a variety of reasons. +

+First, it makes it more obvious that you are using a method or +instance attribute instead of a local variable. Reading "self.x" or +"self.meth()" makes it absolutely clear that an instance variable or +method is used even if you don't know the class definition by heart. +In C++, you can sort of tell by the lack of a local variable +declaration (assuming globals are rare or easily recognizable) -- but +in Python, there are no local variable declarations, so you'd have to +look up the class definition to be sure. +

+Second, it means that no special syntax is necessary if you want to +explicitly reference or call the method from a particular class. In +C++, if you want to use a method from base class that is overridden in +a derived class, you have to use the :: operator -- in Python you can +write baseclass.methodname(self, <argument list>). This is +particularly useful for __init__() methods, and in general in cases +where a derived class method wants to extend the base class method of +the same name and thus has to call the base class method somehow. +

+Lastly, for instance variables, it solves a syntactic problem with +assignment: since local variables in Python are (by definition!) those +variables to which a value assigned in a function body (and that +aren't explicitly declared global), there has to be some way to tell +the interpreter that an assignment was meant to assign to an instance +variable instead of to a local variable, and it should preferably be +syntactic (for efficiency reasons). C++ does this through +declarations, but Python doesn't have declarations and it would be a +pity having to introduce them just for this purpose. Using the +explicit "self.var" solves this nicely. Similarly, for using instance +variables, having to write "self.var" means that references to +unqualified names inside a method don't have to search the instance's +directories. +

+ +Edit this entry / +Log info + +/ Last changed on Fri Jan 12 08:01:50 2001 by +Steve Holden +

+ +


+

6.8. Can't you emulate threads in the interpreter instead of relying on an OS-specific thread implementation?

+Answer 1: Unfortunately, the interpreter pushes at least one C stack +frame for each Python stack frame. Also, extensions can call back into +Python at almost random moments. Therefore a complete threads +implementation requires thread support for C. +

+Answer 2: Fortunately, there is Stackless Python, which has a completely redesigned interpreter loop that avoids the C stack. It's still experimental but looks very promising. Although it is binary compatible with standard Python, it's still unclear whether Stackless will make it into the core -- maybe it's just too revolutionary. Stackless Python currently lives here: http://www.stackless.com. A microthread implementation that uses it can be found here: http://world.std.com/~wware/uthread.html. +

+ +Edit this entry / +Log info + +/ Last changed on Sat Apr 15 08:18:16 2000 by +Just van Rossum +

+ +


+

6.9. Why can't lambda forms contain statements?

+Python lambda forms cannot contain statements because Python's +syntactic framework can't handle statements nested inside expressions. +

+However, in Python, this is not a serious problem. Unlike lambda +forms in other languages, where they add functionality, Python lambdas +are only a shorthand notation if you're too lazy to define a function. +

+Functions are already first class objects in Python, and can be +declared in a local scope. Therefore the only advantage of using a +lambda form instead of a locally-defined function is that you don't need to invent a name for the function -- but that's just a local variable to which the function object (which is exactly the same type of object that a lambda form yields) is assigned! +

+ +Edit this entry / +Log info + +/ Last changed on Sun Jun 14 14:15:17 1998 by +Tim Peters +

+ +


+

6.10. [deleted]

+[lambda vs non-nested scopes used to be here] +

+ +Edit this entry / +Log info + +/ Last changed on Thu Mar 21 05:20:56 2002 by +Erno Kuusela +

+ +


+

6.11. [deleted]

+[recursive functions vs non-nested scopes used to be here] +

+ +Edit this entry / +Log info + +/ Last changed on Thu Mar 21 05:22:04 2002 by +Erno Kuusela +

+ +


+

6.12. Why is there no more efficient way of iterating over a dictionary than first constructing the list of keys()?

+As of Python 2.2, you can now iterate over a dictionary directly, +using the new implied dictionary iterator: +

+

+    for k in d: ...
+
+There are also methods returning iterators over the values and items: +

+

+    for k in d.iterkeys(): # same as above
+    for v in d.itervalues(): # iterate over values
+    for k, v in d.iteritems(): # iterate over items
+
+All these require that you do not modify the dictionary during the loop. +

+For previous Python versions, the following defense should do: +

+Have you tried it? I bet it's fast enough for your purposes! In +most cases such a list takes only a few percent of the space occupied +by the dictionary. Apart from the fixed header, +the list needs only 4 bytes (the size of a pointer) per +key. A dictionary uses 12 bytes per key plus between 30 and 70 +percent hash table overhead, plus the space for the keys and values. +By necessity, all keys are distinct objects, and a string object (the most +common key type) costs at least 20 bytes plus the length of the +string. Add to that the values contained in the dictionary, and you +see that 4 bytes more per item really isn't that much more memory... +

+A call to dict.keys() makes one fast scan over the dictionary +(internally, the iteration function does exist) copying the pointers +to the key objects into a pre-allocated list object of the right size. +The iteration time isn't lost (since you'll have to iterate anyway -- +unless in the majority of cases your loop terminates very prematurely +(which I doubt since you're getting the keys in random order). +

+I don't expose the dictionary iteration operation to Python +programmers because the dictionary shouldn't be modified during the +entire iteration -- if it is, there's a small chance that the +dictionary is reorganized because the hash table becomes too full, and +then the iteration may miss some items and see others twice. Exactly +because this only occurs rarely, it would lead to hidden bugs in +programs: it's easy never to have it happen during test runs if you +only insert or delete a few items per iteration -- but your users will +surely hit upon it sooner or later. +

+ +Edit this entry / +Log info + +/ Last changed on Fri May 24 21:24:08 2002 by +GvR +

+ +


+

6.13. Can Python be compiled to machine code, C or some other language?

+Not easily. Python's high level data types, dynamic typing of +objects and run-time invocation of the interpreter (using eval() or +exec) together mean that a "compiled" Python program would probably +consist mostly of calls into the Python run-time system, even for +seemingly simple operations like "x+1". +

+Several projects described in the Python newsgroup or at past +Python conferences have shown that this approach is feasible, +although the speedups reached so far are only modest (e.g. 2x). +JPython uses the same strategy for compiling to Java bytecode. +(Jim Hugunin has demonstrated that in combination with whole-program +analysis, speedups of 1000x are feasible for small demo programs. +See the website for the 1997 Python conference.) +

+Internally, Python source code is always translated into a "virtual +machine code" or "byte code" representation before it is interpreted +(by the "Python virtual machine" or "bytecode interpreter"). In order +to avoid the overhead of parsing and translating modules that rarely +change over and over again, this byte code is written on a file whose +name ends in ".pyc" whenever a module is parsed (from a file whose +name ends in ".py"). When the corresponding .py file is changed, it +is parsed and translated again and the .pyc file is rewritten. +

+There is no performance difference once the .pyc file has been loaded +(the bytecode read from the .pyc file is exactly the same as the bytecode +created by direct translation). The only difference is that loading +code from a .pyc file is faster than parsing and translating a .py +file, so the presence of precompiled .pyc files will generally improve +start-up time of Python scripts. If desired, the Lib/compileall.py +module/script can be used to force creation of valid .pyc files for a +given set of modules. +

+Note that the main script executed by Python, even if its filename +ends in .py, is not compiled to a .pyc file. It is compiled to +bytecode, but the bytecode is not saved to a file. +

+If you are looking for a way to translate Python programs in order to +distribute them in binary form, without the need to distribute the +interpreter and library as well, have a look at the freeze.py script +in the Tools/freeze directory. This creates a single binary file +incorporating your program, the Python interpreter, and those parts of +the Python library that are needed by your program. Of course, the +resulting binary will only run on the same type of platform as that +used to create it. +

+Newsflash: there are now several programs that do this, to some extent. +Look for Psyco, Pyrex, PyInline, Py2Cmod, and Weave. +

+ +Edit this entry / +Log info + +/ Last changed on Fri May 24 21:26:19 2002 by +GvR +

+ +


+

6.14. How does Python manage memory?

+The details of Python memory management depend on the implementation. +The standard Python implementation (the C implementation) uses reference +counting and another mechanism to collect reference cycles. +

+Jython relies on the Java runtime; so it uses +the JVM's garbage collector. This difference can cause some subtle +porting problems if your Python code depends on the behavior of +the reference counting implementation. +

+The reference cycle collector was added in CPython 2.0. It +periodically executes a cycle detection algorithm which looks for inaccessible cycles and deletes the objects involved. A new gc module provides functions to perform a garbage collection, obtain debugging statistics, and tuning the collector's parameters. +

+The detection of cycles can be disabled when Python is compiled, if you can't afford even a tiny speed penalty or suspect that the cycle collection is buggy, by specifying the "--without-cycle-gc" switch when running the configure script. +

+Sometimes objects get stuck in "tracebacks" temporarily and hence are not deallocated when you might expect. Clear the tracebacks via +

+

+       import sys
+       sys.exc_traceback = sys.last_traceback = None
+
+Tracebacks are used for reporting errors and implementing debuggers and related things. They contain a portion of the program state extracted during the handling of an exception (usually the most recent exception). +

+In the absence of circularities and modulo tracebacks, Python programs need not explicitly manage memory. +

+Why python doesn't use a more traditional garbage collection +scheme? For one thing, unless this were +added to C as a standard feature, it's a portability pain in the ass. +And yes, I know about the Xerox library. It has bits of assembler +code for most common platforms. Not for all. And although it is +mostly transparent, it isn't completely transparent (when I once +linked Python with it, it dumped core). +

+Traditional GC also becomes a problem when Python gets embedded into +other applications. While in a stand-alone Python it may be fine to +replace the standard malloc() and free() with versions provided by the +GC library, an application embedding Python may want to have its own +substitute for malloc() and free(), and may not want Python's. Right +now, Python works with anything that implements malloc() and free() +properly. +

+In Jython, the following code (which is +fine in C Python) will probably run out of file descriptors long before +it runs out of memory: +

+

+        for file in <very long list of files>:
+                f = open(file)
+                c = f.read(1)
+
+Using the current reference counting and destructor scheme, each new +assignment to f closes the previous file. Using GC, this is not +guaranteed. Sure, you can think of ways to fix this. But it's not +off-the-shelf technology. If you want to write code that will +work with any Python implementation, you should explicitly close +the file; this will work regardless of GC: +

+

+       for file in <very long list of files>:
+                f = open(file)
+                c = f.read(1)
+                f.close()
+
+

+ +Edit this entry / +Log info + +/ Last changed on Thu Mar 21 05:35:38 2002 by +Erno Kuusela +

+ +


+

6.15. Why are there separate tuple and list data types?

+This is done so that tuples can be immutable while lists are mutable. +

+Immutable tuples are useful in situations where you need to pass a few +items to a function and don't want the function to modify the tuple; +for example, +

+

+	point1 = (120, 140)
+	point2 = (200, 300)
+	record(point1, point2)
+	draw(point1, point2)
+
+You don't want to have to think about what would happen if record() +changed the coordinates -- it can't, because the tuples are immutable. +

+On the other hand, when creating large lists dynamically, it is +absolutely crucial that they are mutable -- adding elements to a tuple +one by one requires using the concatenation operator, which makes it +quadratic in time. +

+As a general guideline, use tuples like you would use structs in C or +records in Pascal, use lists like (variable length) arrays. +

+ +Edit this entry / +Log info + +/ Last changed on Fri May 23 15:26:03 1997 by +GvR +

+ +


+

6.16. How are lists implemented?

+Despite what a Lisper might think, Python's lists are really +variable-length arrays. The implementation uses a contiguous +array of references to other objects, and keeps a pointer +to this array (as well as its length) in a list head structure. +

+This makes indexing a list (a[i]) an operation whose cost is +independent of the size of the list or the value of the index. +

+When items are appended or inserted, the array of references is resized. +Some cleverness is applied to improve the performance of appending +items repeatedly; when the array must be grown, some extra space +is allocated so the next few times don't require an actual resize. +

+ +Edit this entry / +Log info + +/ Last changed on Fri May 23 15:32:24 1997 by +GvR +

+ +


+

6.17. How are dictionaries implemented?

+Python's dictionaries are implemented as resizable hash tables. +

+Compared to B-trees, this gives better performance for lookup +(the most common operation by far) under most circumstances, +and the implementation is simpler. +

+ +Edit this entry / +Log info + +/ Last changed on Fri May 23 23:51:14 1997 by +Vladimir Marangozov +

+ +


+

6.18. Why must dictionary keys be immutable?

+The hash table implementation of dictionaries uses a hash value +calculated from the key value to find the key. If the key were +a mutable object, its value could change, and thus its hash could +change. But since whoever changes the key object can't tell that +is incorporated in a dictionary, it can't move the entry around in +the dictionary. Then, when you try to look up the same object +in the dictionary, it won't be found, since its hash value is different; +and if you try to look up the old value, it won't be found either, +since the value of the object found in that hash bin differs. +

+If you think you need to have a dictionary indexed with a list, +try to use a tuple instead. The function tuple(l) creates a tuple +with the same entries as the list l. +

+Some unacceptable solutions that have been proposed: +

+- Hash lists by their address (object ID). This doesn't work because +if you construct a new list with the same value it won't be found; +e.g., +

+

+  d = {[1,2]: '12'}
+  print d[[1,2]]
+
+will raise a KeyError exception because the id of the [1,2] used +in the second line differs from that in the first line. +In other words, dictionary keys should be compared using '==', not using 'is'. +

+- Make a copy when using a list as a key. This doesn't work because +the list (being a mutable object) could contain a reference to itself, +and then the copying code would run into an infinite loop. +

+- Allow lists as keys but tell the user not to modify them. This would +allow a class of hard-to-track bugs in programs that I'd rather not see; +it invalidates an important invariant of dictionaries (every value in +d.keys() is usable as a key of the dictionary). +

+- Mark lists as read-only once they are used as a dictionary key. +The problem is that it's not just the top-level object that could change +its value; you could use a tuple containing a list as a key. Entering +anything as a key into a dictionary would require marking all objects +reachable from there as read-only -- and again, self-referential objects +could cause an infinite loop again (and again and again). +

+There is a trick to get around this if you need to, but +use it at your own risk: You +can wrap a mutable structure inside a class instance which +has both a __cmp__ and a __hash__ method. +

+

+   class listwrapper:
+        def __init__(self, the_list):
+              self.the_list = the_list
+        def __cmp__(self, other):
+              return self.the_list == other.the_list
+        def __hash__(self):
+              l = self.the_list
+              result = 98767 - len(l)*555
+              for i in range(len(l)):
+                   try:
+                        result = result + (hash(l[i]) % 9999999) * 1001 + i
+                   except:
+                        result = (result % 7777777) + i * 333
+              return result
+
+Note that the hash computation is complicated by the +possibility that some members of the list may be unhashable +and also by the possibility of arithmetic overflow. +

+You must make +sure that the hash value for all such wrapper objects that reside in a +dictionary (or other hash based structure), remain fixed while +the object is in the dictionary (or other structure). +

+Furthermore it must always be the case that if +o1 == o2 (ie o1.__cmp__(o2)==0) then hash(o1)==hash(o2) +(ie, o1.__hash__() == o2.__hash__()), regardless of whether +the object is in a dictionary or not. +If you fail to meet these restrictions dictionaries and other +hash based structures may misbehave! +

+In the case of listwrapper above whenever the wrapper +object is in a dictionary the wrapped list must not change +to avoid anomalies. Don't do this unless you are prepared +to think hard about the requirements and the consequences +of not meeting them correctly. You've been warned! +

+ +Edit this entry / +Log info + +/ Last changed on Thu Jul 10 10:08:40 1997 by +aaron watters +

+ +


+

6.19. How the heck do you make an array in Python?

+["this", 1, "is", "an", "array"] +

+Lists are arrays in the C or Pascal sense of the word (see question +6.16). The array module also provides methods for creating arrays +of fixed types with compact representations (but they are slower to +index than lists). Also note that the Numerics extensions and others +define array-like structures with various characteristics as well. +

+To get Lisp-like lists, emulate cons cells +

+

+    lisp_list = ("like",  ("this",  ("example", None) ) )
+
+using tuples (or lists, if you want mutability). Here the analogue +of lisp car is lisp_list[0] and the analogue of cdr is lisp_list[1]. +Only do this if you're sure you really need to (it's usually a lot +slower than using Python lists). +

+Think of Python lists as mutable heterogeneous arrays of +Python objects (say that 10 times fast :) ). +

+ +Edit this entry / +Log info + +/ Last changed on Wed Aug 13 07:08:27 1997 by +aaron watters +

+ +


+

6.20. Why doesn't list.sort() return the sorted list?

+In situations where performance matters, making a copy of the list +just to sort it would be wasteful. Therefore, list.sort() sorts +the list in place. In order to remind you of that fact, it does +not return the sorted list. This way, you won't be fooled into +accidentally overwriting a list when you need a sorted copy but also +need to keep the unsorted version around. +

+As a result, here's the idiom to iterate over the keys of a dictionary +in sorted order: +

+

+	keys = dict.keys()
+	keys.sort()
+	for key in keys:
+		...do whatever with dict[key]...
+
+

+ +Edit this entry / +Log info + +/ Last changed on Thu Dec 2 17:01:52 1999 by +Fred L. Drake, Jr. +

+ +


+

6.21. How do you specify and enforce an interface spec in Python?

+An interfaces specification for a module as provided +by languages such as C++ and java describes the prototypes +for the methods and functions of the module. Many feel +that compile time enforcement of interface specifications +help aid in the construction of large programs. Python +does not support interface specifications directly, but many +of their advantages can be obtained by an appropriate +test discipline for components, which can often be very +easily accomplished in Python. There is also a tool, PyChecker, +which can be used to find problems due to subclassing. +

+A good test suite for a module can at +once provide a regression test and serve as a module interface +specification (even better since it also gives example usage). Look to +many of the standard libraries which often have a "script +interpretation" which provides a simple "self test." Even +modules which use complex external interfaces can often +be tested in isolation using trivial "stub" emulations of the +external interface. +

+An appropriate testing discipline (if enforced) can help +build large complex applications in Python as well as having interface +specifications would do (or better). Of course Python allows you +to get sloppy and not do it. Also you might want to design +your code with an eye to make it easily tested. +

+ +Edit this entry / +Log info + +/ Last changed on Thu May 23 03:05:29 2002 by +Neal Norwitz +

+ +


+

6.22. Why do all classes have the same type? Why do instances all have the same type?

+The Pythonic use of the word "type" is quite different from +common usage in much of the rest of the programming language +world. A "type" in Python is a description for an object's operations +as implemented in C. All classes have the same operations +implemented in C which sometimes "call back" to differing program +fragments implemented in Python, and hence all classes have the +same type. Similarly at the C level all class instances have the +same C implementation, and hence all instances have the same +type. +

+Remember that in Python usage "type" refers to a C implementation +of an object. To distinguish among instances of different classes +use Instance.__class__, and also look to 4.47. Sorry for the +terminological confusion, but at this point in Python's development +nothing can be done! +

+ +Edit this entry / +Log info + +/ Last changed on Tue Jul 1 12:35:47 1997 by +aaron watters +

+ +


+

6.23. Why isn't all memory freed when Python exits?

+Objects referenced from Python module global name spaces are +not always deallocated when Python exits. +

+This may happen if there are circular references (see question +4.17). There are also certain bits of memory that are allocated +by the C library that are impossible to free (e.g. a tool +like Purify will complain about these). +

+But in general, Python 1.5 and beyond +(in contrast with earlier versions) is quite agressive about +cleaning up memory on exit. +

+If you want to force Python to delete certain things on deallocation +use the sys.exitfunc hook to force those deletions. For example +if you are debugging an extension module using a memory analysis +tool and you wish to make Python deallocate almost everything +you might use an exitfunc like this one: +

+

+  import sys
+
+
+  def my_exitfunc():
+       print "cleaning up"
+       import sys
+       # do order dependant deletions here
+       ...
+       # now delete everything else in arbitrary order
+       for x in sys.modules.values():
+            d = x.__dict__
+            for name in d.keys():
+                 del d[name]
+
+
+  sys.exitfunc = my_exitfunc
+
+Other exitfuncs can be less drastic, of course. +

+(In fact, this one just does what Python now already does itself; +but the example of using sys.exitfunc to force cleanups is still +useful.) +

+ +Edit this entry / +Log info + +/ Last changed on Tue Sep 29 09:46:26 1998 by +GvR +

+ +


+

6.24. Why no class methods or mutable class variables?

+The notation +

+

+    instance.attribute(arg1, arg2)
+
+usually translates to the equivalent of +

+

+    Class.attribute(instance, arg1, arg2)
+
+where Class is a (super)class of instance. Similarly +

+

+    instance.attribute = value
+
+sets an attribute of an instance (overriding any attribute of a class +that instance inherits). +

+Sometimes programmers want to have +different behaviours -- they want a method which does not bind +to the instance and a class attribute which changes in place. +Python does not preclude these behaviours, but you have to +adopt a convention to implement them. One way to accomplish +this is to use "list wrappers" and global functions. +

+

+   def C_hello():
+         print "hello"
+
+
+   class C:
+        hello = [C_hello]
+        counter = [0]
+
+
+    I = C()
+
+Here I.hello[0]() acts very much like a "class method" and +I.counter[0] = 2 alters C.counter (and doesn't override it). +If you don't understand why you'd ever want to do this, that's +because you are pure of mind, and you probably never will +want to do it! This is dangerous trickery, not recommended +when avoidable. (Inspired by Tim Peter's discussion.) +

+In Python 2.2, you can do this using the new built-in operations +classmethod and staticmethod. +See http://www.python.org/2.2/descrintro.html#staticmethods +

+ +Edit this entry / +Log info + +/ Last changed on Tue Sep 11 15:59:37 2001 by +GvR +

+ +


+

6.25. Why are default values sometimes shared between objects?

+It is often expected that a function CALL creates new objects for default +values. This is not what happens. Default values are created when the +function is DEFINED, that is, there is only one such object that all +functions refer to. If that object is changed, subsequent calls to the +function will refer to this changed object. By definition, immutable objects +(like numbers, strings, tuples, None) are safe from change. Changes to mutable +objects (like dictionaries, lists, class instances) is what causes the +confusion. +

+Because of this feature it is good programming practice not to use mutable +objects as default values, but to introduce them in the function. +Don't write: +

+

+	def foo(dict={}):  # XXX shared reference to one dict for all calls
+	    ...
+
+but: +
+	def foo(dict=None):
+		if dict is None:
+			dict = {} # create a new dict for local namespace
+
+See page 182 of "Internet Programming with Python" for one discussion +of this feature. Or see the top of page 144 or bottom of page 277 in +"Programming Python" for another discussion. +

+ +Edit this entry / +Log info + +/ Last changed on Sat Aug 16 07:03:35 1997 by +Case Roole +

+ +


+

6.26. Why no goto?

+Actually, you can use exceptions to provide a "structured goto" +that even works across function calls. Many feel that exceptions +can conveniently emulate all reasonable uses of the "go" or "goto" +constructs of C, Fortran, and other languages. For example: +

+

+   class label: pass # declare a label
+   try:
+        ...
+        if (condition): raise label() # goto label
+        ...
+   except label: # where to goto
+        pass
+   ...
+
+This doesn't allow you to jump into the middle of a loop, but +that's usually considered an abuse of goto anyway. Use sparingly. +

+ +Edit this entry / +Log info + +/ Last changed on Wed Sep 10 07:16:44 1997 by +aaron watters +

+ +


+

6.27. How do you make a higher order function in Python?

+You have two choices: you can use default arguments and override +them or you can use "callable objects." For example suppose you +wanted to define linear(a,b) which returns a function f where f(x) +computes the value a*x+b. Using default arguments: +

+

+     def linear(a,b):
+         def result(x, a=a, b=b):
+             return a*x + b
+         return result
+
+Or using callable objects: +

+

+     class linear:
+        def __init__(self, a, b):
+            self.a, self.b = a,b
+        def __call__(self, x):
+            return self.a * x + self.b
+
+In both cases: +

+

+     taxes = linear(0.3,2)
+
+gives a callable object where taxes(10e6) == 0.3 * 10e6 + 2. +

+The defaults strategy has the disadvantage that the default arguments +could be accidentally or maliciously overridden. The callable objects +approach has the disadvantage that it is a bit slower and a bit +longer. Note however that a collection of callables can share +their signature via inheritance. EG +

+

+      class exponential(linear):
+         # __init__ inherited
+         def __call__(self, x):
+             return self.a * (x ** self.b)
+
+On comp.lang.python, zenin@bawdycaste.org points out that +an object can encapsulate state for several methods in order +to emulate the "closure" concept from functional programming +languages, for example: +

+

+    class counter:
+        value = 0
+        def set(self, x): self.value = x
+        def up(self): self.value=self.value+1
+        def down(self): self.value=self.value-1
+
+
+    count = counter()
+    inc, dec, reset = count.up, count.down, count.set
+
+Here inc, dec and reset act like "functions which share the +same closure containing the variable count.value" (if you +like that way of thinking). +

+ +Edit this entry / +Log info + +/ Last changed on Fri Sep 25 08:38:35 1998 by +Aaron Watters +

+ +


+

6.28. Why do I get a SyntaxError for a 'continue' inside a 'try'?

+This is an implementation limitation, +caused by the extremely simple-minded +way Python generates bytecode. The try block pushes something on the +"block stack" which the continue would have to pop off again. The +current code generator doesn't have the data structures around so that +'continue' can generate the right code. +

+Note that JPython doesn't have this restriction! +

+ +Edit this entry / +Log info + +/ Last changed on Fri May 22 15:01:07 1998 by +GvR +

+ +


+

6.29. Why can't raw strings (r-strings) end with a backslash?

+More precisely, they can't end with an odd number of backslashes: +the unpaired backslash at the end escapes the closing quote character, +leaving an unterminated string. +

+Raw strings were designed to ease creating input for processors (chiefly +regular expression engines) that want to do their own backslash escape processing. Such processors consider an unmatched trailing backslash to be an error anyway, so raw strings disallow that. In return, they allow you to pass on the string quote character by escaping it with a backslash. These rules work well when r-strings are used for their intended purpose. +

+If you're trying to build Windows pathnames, note that all Windows system calls accept forward slashes too: +

+

+    f = open("/mydir/file.txt") # works fine!
+
+If you're trying to build a pathname for a DOS command, try e.g. one of +

+

+    dir = r"\this\is\my\dos\dir" "\\"
+    dir = r"\this\is\my\dos\dir\ "[:-1]
+    dir = "\\this\\is\\my\\dos\\dir\\"
+
+

+ +Edit this entry / +Log info + +/ Last changed on Mon Jul 13 20:50:20 1998 by +Tim Peters +

+ +


+

6.30. Why can't I use an assignment in an expression?

+Many people used to C or Perl complain that they want to be able to +use e.g. this C idiom: +

+

+    while (line = readline(f)) {
+        ...do something with line...
+    }
+
+where in Python you're forced to write this: +

+

+    while 1:
+        line = f.readline()
+        if not line:
+            break
+        ...do something with line...
+
+This issue comes up in the Python newsgroup with alarming frequency +-- search Deja News for past messages about assignment expression. +The reason for not allowing assignment in Python expressions +is a common, hard-to-find bug in those other languages, +caused by this construct: +

+

+    if (x = 0) {
+        ...error handling...
+    }
+    else {
+        ...code that only works for nonzero x...
+    }
+
+Many alternatives have been proposed. Most are hacks that save some +typing but use arbitrary or cryptic syntax or keywords, +and fail the simple criterion that I use for language change proposals: +it should intuitively suggest the proper meaning to a human reader +who has not yet been introduced with the construct. +

+The earliest time something can be done about this will be with +Python 2.0 -- if it is decided that it is worth fixing. +An interesting phenomenon is that most experienced Python programmers +recognize the "while 1" idiom and don't seem to be missing the +assignment in expression construct much; it's only the newcomers +who express a strong desire to add this to the language. +

+One fairly elegant solution would be to introduce a new operator +for assignment in expressions spelled ":=" -- this avoids the "=" +instead of "==" problem. It would have the same precedence +as comparison operators but the parser would flag combination with +other comparisons (without disambiguating parentheses) as an error. +

+Finally -- there's an alternative way of spelling this that seems +attractive but is generally less robust than the "while 1" solution: +

+

+    line = f.readline()
+    while line:
+        ...do something with line...
+        line = f.readline()
+
+The problem with this is that if you change your mind about exactly +how you get the next line (e.g. you want to change it into +sys.stdin.readline()) you have to remember to change two places +in your program -- the second one hidden at the bottom of the loop. +

+ +Edit this entry / +Log info + +/ Last changed on Tue May 18 00:57:41 1999 by +Andrew Dalke +

+ +


+

6.31. Why doesn't Python have a "with" statement like some other languages?

+Basically, because such a construct would be terribly ambiguous. Thanks to Carlos Ribeiro for the following remarks: +

+Some languages, such as Object Pascal, Delphi, and C++, use static types. So it is possible to know, in an unambiguous way, what member is being assigned in a "with" clause. This is the main point - the compiler always knows the scope of every variable at compile time. +

+Python uses dynamic types. It is impossible to know in advance which +attribute will be referenced at runtime. Member attributes may be added or removed from objects on the fly. This would make it impossible to know, from a simple reading, what attribute is being referenced - a local one, a global one, or a member attribute. +

+For instance, take the following snippet (it is incomplete btw, just to +give you the idea): +

+

+   def with_is_broken(a):
+      with a:
+         print x
+
+The snippet assumes that "a" must have a member attribute called "x". +However, there is nothing in Python that guarantees that. What should +happen if "a" is, let us say, an integer? And if I have a global variable named "x", will it end up being used inside the with block? As you see, the dynamic nature of Python makes such choices much harder. +

+The primary benefit of "with" and similar language features (reduction of code volume) can, however, easily be achieved in Python by assignment. Instead of: +

+

+    function(args).dict[index][index].a = 21
+    function(args).dict[index][index].b = 42
+    function(args).dict[index][index].c = 63
+
+would become: +

+

+    ref = function(args).dict[index][index]
+    ref.a = 21
+    ref.b = 42
+    ref.c = 63
+
+This also has the happy side-effect of increasing execution speed, since name bindings are resolved at run-time in Python, and the second method only needs to perform the resolution once. If the referenced object does not have a, b and c attributes, of course, the end result is still a run-time exception. +

+ +Edit this entry / +Log info + +/ Last changed on Fri Jan 11 14:32:58 2002 by +Steve Holden +

+ +


+

6.32. Why are colons required for if/while/def/class?

+The colon is required primarily to enhance readability (one of the +results of the experimental ABC language). Consider this: +

+

+    if a==b
+        print a
+
+versus +

+

+    if a==b:
+        print a
+
+Notice how the second one is slightly easier to read. Notice further how +a colon sets off the example in the second line of this FAQ answer; it's +a standard usage in English. Finally, the colon makes it easier for +editors with syntax highlighting. +

+ +Edit this entry / +Log info + +/ Last changed on Mon Jun 3 07:22:57 2002 by +Matthias Urlichs +

+ +


+

6.33. Can't we get rid of the Global Interpreter Lock?

+The Global Interpreter Lock (GIL) is often seen as a hindrance to +Python's deployment on high-end multiprocessor server machines, +because a multi-threaded Python program effectively only uses +one CPU, due to the insistence that (almost) all Python code +can only run while the GIL is held. +

+Back in the days of Python 1.5, Greg Stein actually implemented +a comprehensive patch set ("free threading") +that removed the GIL, replacing it with +fine-grained locking. Unfortunately, even on Windows (where locks +are very efficient) this ran ordinary Python code about twice as +slow as the interpreter using the GIL. On Linux the performance +loss was even worse (pthread locks aren't as efficient). +

+Since then, the idea of getting rid of the GIL has occasionally +come up but nobody has found a way to deal with the expected slowdown; +Greg's free threading patch set has not been kept up-to-date for +later Python versions. +

+This doesn't mean that you can't make good use of Python on +multi-CPU machines! You just have to be creative with dividing +the work up between multiple processes rather than multiple +threads. +

+

+It has been suggested that the GIL should be a per-interpreter-state +lock rather than truly global; interpreters then wouldn't be able +to share objects. Unfortunately, this isn't likely to happen either. +

+It would be a tremendous amount of work, because many object +implementations currently have global state. E.g. small ints and +small strings are cached; these caches would have to be moved to the +interpreter state. Other object types have their own free list; these +free lists would have to be moved to the interpreter state. And so +on. +

+And I doubt that it can even be done in finite time, because the same +problem exists for 3rd party extensions. It is likely that 3rd party +extensions are being written at a faster rate than you can convert +them to store all their global state in the interpreter state. +

+And finally, once you have multiple interpreters not sharing any +state, what have you gained over running each interpreter +in a separate process? +

+ +Edit this entry / +Log info + +/ Last changed on Fri Feb 7 16:34:01 2003 by +GvR +

+ +


+

7. Using Python on non-UNIX platforms

+ +
+

7.1. Is there a Mac version of Python?

+Yes, it is maintained by Jack Jansen. See Jack's MacPython Page: +

+

+  http://www.cwi.nl/~jack/macpython.html
+
+

+ +Edit this entry / +Log info + +/ Last changed on Fri May 4 09:33:42 2001 by +GvR +

+ +


+

7.2. Are there DOS and Windows versions of Python?

+Yes. The core windows binaries are available from http://www.python.org/windows/. There is a plethora of Windows extensions available, including a large number of not-always-compatible GUI toolkits. The core binaries include the standard Tkinter GUI extension. +

+Most windows extensions can be found (or referenced) at http://www.python.org/windows/ +

+Windows 3.1/DOS support seems to have dropped off recently. You may need to settle for an old version of Python one these platforms. One such port is WPY +

+WPY: Ports to DOS, Windows 3.1(1), Windows 95, Windows NT and OS/2. +Also contains a GUI package that offers portability between Windows +(not DOS) and Unix, and native look and feel on both. +ftp://ftp.python.org/pub/python/wpy/. +

+ +Edit this entry / +Log info + +/ Last changed on Tue Jun 2 20:21:57 1998 by +Mark Hammond +

+ +


+

7.3. Is there an OS/2 version of Python?

+Yes, see http://www.python.org/download/download_os2.html. +

+ +Edit this entry / +Log info + +/ Last changed on Tue Sep 7 11:33:16 1999 by +GvR +

+ +


+

7.4. Is there a VMS version of Python?

+Jean-François Piéronne has ported 2.1.3 to OpenVMS. It can be found at +<http://vmspython.dyndns.org/>. +

+ +Edit this entry / +Log info + +/ Last changed on Thu Sep 19 15:40:38 2002 by +Skip Montanaro +

+ +


+

7.5. What about IBM mainframes, or other non-UNIX platforms?

+I haven't heard about these, except I remember hearing about an +OS/9 port and a port to Vxworks (both operating systems for embedded +systems). If you're interested in any of this, go directly to the +newsgroup and ask there, you may find exactly what you need. For +example, a port to MPE/iX 5.0 on HP3000 computers was just announced, +see http://www.allegro.com/software/. +

+On the IBM mainframe side, for Z/OS there's a port of python 1.4 that goes with their open-unix package, formely OpenEdition MVS, (http://www-1.ibm.com/servers/eserver/zseries/zos/unix/python.html). On a side note, there's also a java vm ported - so, in theory, jython could run too. +

+ +Edit this entry / +Log info + +/ Last changed on Mon Nov 18 03:18:39 2002 by +Bruno Jessen +

+ +


+

7.6. Where are the source or Makefiles for the non-UNIX versions?

+The standard sources can (almost) be used. Additional sources can +be found in the platform-specific subdirectories of the distribution. +

+ +Edit this entry / +Log info +

+ +


+

7.7. What is the status and support for the non-UNIX versions?

+I don't have access to most of these platforms, so in general I am +dependent on material submitted by volunteers. However I strive to +integrate all changes needed to get it to compile on a particular +platform back into the standard sources, so porting of the next +version to the various non-UNIX platforms should be easy. +(Note that Linux is classified as a UNIX platform here. :-) +

+Some specific platforms: +

+Windows: all versions (95, 98, ME, NT, 2000, XP) are supported, +all python.org releases come with a Windows installer. +

+MacOS: Jack Jansen does an admirable job of keeping the Mac version +up to date (both MacOS X and older versions); +see http://www.cwi.nl/~jack/macpython.html +

+For all supported platforms, see http://www.python.org/download/ +(follow the link to "Other platforms" for less common platforms) +

+ +Edit this entry / +Log info + +/ Last changed on Fri May 24 21:34:24 2002 by +GvR +

+ +


+

7.8. I have a PC version but it appears to be only a binary. Where's the library?

+If you are running any version of Windows, then you have the wrong distribution. The FAQ lists current Windows versions. Notably, Pythonwin and wpy provide fully functional installations. +

+But if you are sure you have the only distribution with a hope of working on +your system, then... +

+You still need to copy the files from the distribution directory +"python/Lib" to your system. If you don't have the full distribution, +you can get the file lib<version>.tar.gz from most ftp sites carrying +Python; this is a subset of the distribution containing just those +files, e.g. ftp://ftp.python.org/pub/python/src/lib1.4.tar.gz. +

+Once you have installed the library, you need to point sys.path to it. +Assuming the library is in C:\misc\python\lib, the following commands +will point your Python interpreter to it (note the doubled backslashes +-- you can also use single forward slashes instead): +

+

+        >>> import sys
+        >>> sys.path.insert(0, 'C:\\misc\\python\\lib')
+        >>>
+
+For a more permanent effect, set the environment variable PYTHONPATH, +as follows (talking to a DOS prompt): +

+

+        C> SET PYTHONPATH=C:\misc\python\lib
+
+

+ +Edit this entry / +Log info + +/ Last changed on Fri May 23 16:28:27 1997 by +Ken Manheimer +

+ +


+

7.9. Where's the documentation for the Mac or PC version?

+The documentation for the Unix version also applies to the Mac and +PC versions. Where applicable, differences are indicated in the text. +

+ +Edit this entry / +Log info +

+ +


+

7.10. How do I create a Python program file on the Mac or PC?

+Use an external editor. On the Mac, BBEdit seems to be a popular +no-frills text editor. I work like this: start the interpreter; edit +a module file using BBedit; import and test it in the interpreter; +edit again in BBedit; then use the built-in function reload() to +re-read the imported module; etc. In the 1.4 distribution +you will find a BBEdit extension that makes life a little easier: +it can tell the interpreter to execute the current window. +See :Mac:Tools:BBPy:README. +

+Regarding the same question for the PC, Kurt Wm. Hemr writes: "While +anyone with a pulse could certainly figure out how to do the same on +MS-Windows, I would recommend the NotGNU Emacs clone for MS-Windows. +Not only can you easily resave and "reload()" from Python after making +changes, but since WinNot auto-copies to the clipboard any text you +select, you can simply select the entire procedure (function) which +you changed in WinNot, switch to QWPython, and shift-ins to reenter +the changed program unit." +

+If you're using Windows95 or Windows NT, you should also know about +PythonWin, which provides a GUI framework, with an mouse-driven +editor, an object browser, and a GUI-based debugger. See +

+       http://www.python.org/ftp/python/pythonwin/
+
+for details. +

+ +Edit this entry / +Log info + +/ Last changed on Sun May 25 10:04:25 1997 by +GvR +

+ +


+

7.11. How can I use Tkinter on Windows 95/NT?

+Starting from Python 1.5, it's very easy -- just download and install +Python and Tcl/Tk and you're in business. See +

+

+  http://www.python.org/download/download_windows.html
+
+One warning: don't attempt to use Tkinter from PythonWin +(Mark Hammond's IDE). Use it from the command line interface +(python.exe) or the windowless interpreter (pythonw.exe). +

+ +Edit this entry / +Log info + +/ Last changed on Fri Jun 12 09:32:48 1998 by +GvR +

+ +


+

7.12. cgi.py (or other CGI programming) doesn't work sometimes on NT or win95!

+Be sure you have the latest python.exe, that you are using +python.exe rather than a GUI version of python and that you +have configured the server to execute +

+

+     "...\python.exe -u ..."
+
+for the cgi execution. The -u (unbuffered) option on NT and +win95 prevents the interpreter from altering newlines in the +standard input and output. Without it post/multipart requests +will seem to have the wrong length and binary (eg, GIF) +responses may get garbled (resulting in, eg, a "broken image"). +

+ +Edit this entry / +Log info + +/ Last changed on Wed Jul 30 10:48:02 1997 by +aaron watters +

+ +


+

7.13. Why doesn't os.popen() work in PythonWin on NT?

+The reason that os.popen() doesn't work from within PythonWin is due to a bug in Microsoft's C Runtime Library (CRT). The CRT assumes you have a Win32 console attached to the process. +

+You should use the win32pipe module's popen() instead which doesn't depend on having an attached Win32 console. +

+Example: +

+ import win32pipe
+ f = win32pipe.popen('dir /c c:\\')
+ print f.readlines()
+ f.close()
+
+

+ +Edit this entry / +Log info + +/ Last changed on Thu Jul 31 15:34:09 1997 by +Bill Tutt +

+ +


+

7.14. How do I use different functionality on different platforms with the same program?

+Remember that Python is extremely dynamic and that you +can use this dynamism to configure a program at run-time to +use available functionality on different platforms. For example +you can test the sys.platform and import different modules based +on its value. +

+

+   import sys
+   if sys.platform == "win32":
+      import win32pipe
+      popen = win32pipe.popen
+   else:
+      import os
+      popen = os.popen
+
+(See FAQ 7.13 for an explanation of why you might want to +do something like this.) Also you can try to import a module +and use a fallback if the import fails: +

+

+    try:
+         import really_fast_implementation
+         choice = really_fast_implementation
+    except ImportError:
+         import slower_implementation
+         choice = slower_implementation
+
+

+ +Edit this entry / +Log info + +/ Last changed on Wed Aug 13 07:39:06 1997 by +aaron watters +

+ +


+

7.15. Is there an Amiga version of Python?

+Yes. See the AmigaPython homepage at http://www.bigfoot.com/~irmen/python.html. +

+ +Edit this entry / +Log info + +/ Last changed on Mon Dec 14 06:53:32 1998 by +Irmen de Jong +

+ +


+

7.16. Why doesn't os.popen()/win32pipe.popen() work on Win9x?

+There is a bug in Win9x that prevents os.popen/win32pipe.popen* from working. The good news is there is a way to work around this problem. +The Microsoft Knowledge Base article that you need to lookup is: Q150956. You will find links to the knowledge base at: +http://www.microsoft.com/kb. +

+ +Edit this entry / +Log info + +/ Last changed on Fri Jun 25 10:45:38 1999 by +Bill Tutt +

+ +


+

8. Python on Windows

+ +
+

8.1. Using Python for CGI on Microsoft Windows

+** Setting up the Microsoft IIS Server/Peer Server +

+On the Microsoft IIS +server or on the Win95 MS Personal Web Server +you set up python in the same way that you +would set up any other scripting engine. +

+Run regedt32 and go to: +

+HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W3SVC\Parameters\ScriptMap +

+and enter the following line (making any specific changes that your system may need) +

+.py :REG_SZ: c:\<path to python>\python.exe -u %s %s +

+This line will allow you to call your script with a simple reference like: +http://yourserver/scripts/yourscript.py +provided "scripts" is an "executable" directory for your server (which +it usually is by default). +The "-u" flag specifies unbuffered and binary mode for stdin - needed when working with binary data +

+In addition, it is recommended by people who would know that using ".py" may +not be a good idea for the file extensions when used in this context +(you might want to reserve *.py for support modules and use *.cgi or *.cgp +for "main program" scripts). +However, that issue is beyond this Windows FAQ entry. +

+

+** Apache configuration +

+In the Apache configuration file httpd.conf, add the following line at +the end of the file: +

+ScriptInterpreterSource Registry +

+Then, give your Python CGI-scripts the extension .py and put them in the cgi-bin directory. +

+

+** Netscape Servers: +Information on this topic exists at: +http://home.netscape.com/comprod/server_central/support/fasttrack_man/programs.htm#1010870 +

+ +Edit this entry / +Log info + +/ Last changed on Wed Mar 27 12:25:54 2002 by +Gerhard Häring +

+ +


+

8.2. How to check for a keypress without blocking?

+Use the msvcrt module. This is a standard Windows-specific extensions +in Python 1.5 and beyond. It defines a function kbhit() which checks +whether a keyboard hit is present; also getch() which gets one +character without echo. Plus a few other goodies. +

+(Search for "keypress" to find an answer for Unix as well.) +

+ +Edit this entry / +Log info + +/ Last changed on Mon Mar 30 16:21:46 1998 by +GvR +

+ +


+

8.3. $PYTHONPATH

+In MS-DOS derived environments, a unix variable such as $PYTHONPATH is +set as PYTHONPATH, without the dollar sign. PYTHONPATH is useful for +specifying the location of library files. +

+ +Edit this entry / +Log info + +/ Last changed on Thu Jun 11 00:41:26 1998 by +Gvr +

+ +


+

8.4. dedent syntax errors

+The FAQ does not recommend using tabs, and Guido's Python Style Guide recommends 4 spaces for distributed Python code; this is also the Emacs python-mode default; see +

+

+    http://www.python.org/doc/essays/styleguide.html
+
+Under any editor mixing tabs and spaces is a bad idea. MSVC is no different in this respect, and is easily configured to use spaces: Take Tools -> Options -> Tabs, and for file type "Default" set "Tab size" and "Indent size" to 4, and select the "Insert spaces" radio button. +

+If you suspect mixed tabs and spaces are causing problems in leading whitespace, run Python with the -t switch or, run Tools/Scripts/tabnanny.py to check a directory tree in batch mode. +

+ +Edit this entry / +Log info + +/ Last changed on Mon Feb 12 15:04:14 2001 by +Steve Holden +

+ +


+

8.5. How do I emulate os.kill() in Windows?

+Use win32api: +

+

+    def kill(pid):
+        """kill function for Win32"""
+        import win32api
+        handle = win32api.OpenProcess(1, 0, pid)
+        return (0 != win32api.TerminateProcess(handle, 0))
+
+

+ +Edit this entry / +Log info + +/ Last changed on Sat Aug 8 18:55:06 1998 by +Jeff Bauer +

+ +


+

8.6. Why does os.path.isdir() fail on NT shared directories?

+The solution appears to be always append the "\\" on +the end of shared drives. +

+

+  >>> import os
+  >>> os.path.isdir( '\\\\rorschach\\public')
+  0
+  >>> os.path.isdir( '\\\\rorschach\\public\\')
+  1
+
+[Blake Winton responds:] +I've had the same problem doing "Start >> Run" and then a +directory on a shared drive. If I use "\\rorschach\public", +it will fail, but if I use "\\rorschach\public\", it will +work. For that matter, os.stat() does the same thing (well, +it gives an error for "\\\\rorschach\\public", but you get +the idea)... +

+I've got a theory about why this happens, but it's only +a theory. NT knows the difference between shared directories, +and regular directories. "\\rorschach\public" isn't a +directory, it's _really_ an IPC abstraction. This is sort +of lended credence to by the fact that when you're mapping +a network drive, you can't map "\\rorschach\public\utils", +but only "\\rorschach\public". +

+[Clarification by funkster@midwinter.com] +It's not actually a Python +question, as Python is working just fine; it's clearing up something +a bit muddled about Windows networked drives. +

+It helps to think of share points as being like drive letters. +Example: +

+        k: is not a directory
+        k:\ is a directory
+        k:\media is a directory
+        k:\media\ is not a directory
+
+The same rules apply if you substitute "k:" with "\\conky\foo": +
+        \\conky\foo  is not a directory
+        \\conky\foo\ is a directory
+        \\conky\foo\media is a directory
+        \\conky\foo\media\ is not a directory
+
+

+ +Edit this entry / +Log info + +/ Last changed on Sun Jan 31 08:44:48 1999 by +GvR +

+ +


+

8.7. PyRun_SimpleFile() crashes on Windows but not on Unix

+I've seen a number of reports of PyRun_SimpleFile() failing +in a Windows port of an application embedding Python that worked +fine on Unix. PyRun_SimpleString() works fine on both platforms. +

+I think this happens because the application was compiled with a +different set of compiler flags than Python15.DLL. It seems that some +compiler flags affect the standard I/O library in such a way that +using different flags makes calls fail. You need to set it for +the non-debug multi-threaded DLL (/MD on the command line, or can be set via MSVC under Project Settings->C++/Code Generation then the "Use rum-time library" dropdown.) +

+Also note that you can not mix-and-match Debug and Release versions. If you wish to use the Debug Multithreaded DLL, then your module _must_ have an "_d" appended to the base name. +

+ +Edit this entry / +Log info + +/ Last changed on Wed Nov 17 17:37:07 1999 by +Mark Hammond +

+ +


+

8.8. Import of _tkinter fails on Windows 95/98

+Sometimes, the import of _tkinter fails on Windows 95 or 98, +complaining with a message like the following: +

+

+  ImportError: DLL load failed: One of the library files needed
+  to run this application cannot be found.
+
+It could be that you haven't installed Tcl/Tk, but if you did +install Tcl/Tk, and the Wish application works correctly, +the problem may be that its installer didn't +manage to edit the autoexec.bat file correctly. It tries to add a +statement that changes the PATH environment variable to include +the Tcl/Tk 'bin' subdirectory, but sometimes this edit doesn't +quite work. Opening it with notepad usually reveals what the +problem is. +

+(One additional hint, noted by David Szafranski: you can't use +long filenames here; e.g. use C:\PROGRA~1\Tcl\bin instead of +C:\Program Files\Tcl\bin.) +

+ +Edit this entry / +Log info + +/ Last changed on Wed Dec 2 22:32:41 1998 by +GvR +

+ +


+

8.9. Can't extract the downloaded documentation on Windows

+Sometimes, when you download the documentation package to a Windows +machine using a web browser, the file extension of the saved file +ends up being .EXE. This is a mistake; the extension should be .TGZ. +

+Simply rename the downloaded file to have the .TGZ extension, and +WinZip will be able to handle it. (If your copy of WinZip doesn't, +get a newer one from http://www.winzip.com.) +

+ +Edit this entry / +Log info + +/ Last changed on Sat Nov 21 13:41:35 1998 by +GvR +

+ +


+

8.10. Can't get Py_RunSimpleFile() to work.

+This is very sensitive to the compiler vendor, version and (perhaps) +even options. If the FILE* structure in your embedding program isn't +the same as is assumed by the Python interpreter it won't work. +

+The Python 1.5.* DLLs (python15.dll) are all compiled +with MS VC++ 5.0 and with multithreading-DLL options (/MD, I think). +

+If you can't change compilers or flags, try using Py_RunSimpleString(). +A trick to get it to run an arbitrary file is to construct a call to +execfile() with the name of your file as argument. +

+ +Edit this entry / +Log info + +/ Last changed on Wed Jan 13 10:58:14 1999 by +GvR +

+ +


+

8.11. Where is Freeze for Windows?

+("Freeze" is a program that allows you to ship a Python program +as a single stand-alone executable file. It is not a compiler, +your programs don't run any faster, but they are more easily +distributable (to platforms with the same OS and CPU). Read the +README file of the freeze program for more disclaimers.) +

+You can use freeze on Windows, but you must download the source +tree (see http://www.python.org/download/download_source.html). +This is recommended for Python 1.5.2 (and betas thereof) only; +older versions don't quite work. +

+You need the Microsoft VC++ 5.0 compiler (maybe it works with +6.0 too). You probably need to build Python -- the project files +are all in the PCbuild directory. +

+The freeze program is in the Tools\freeze subdirectory of the source +tree. +

+ +Edit this entry / +Log info + +/ Last changed on Wed Feb 17 18:47:24 1999 by +GvR +

+ +


+

8.12. Is a *.pyd file the same as a DLL?

+Yes, .pyd files are dll's. But there are a few differences. If you +have a DLL named foo.pyd, then it must have a function initfoo(). You +can then write Python "import foo", and Python will search for foo.pyd +(as well as foo.py, foo.pyc) and if it finds it, will attempt to call +initfoo() to initialize it. You do not link your .exe with foo.lib, +as that would cause Windows to require the DLL to be present. +

+Note that the search path for foo.pyd is PYTHONPATH, not the same as +the path that Windows uses to search for foo.dll. Also, foo.pyd need +not be present to run your program, whereas if you linked your program +with a dll, the dll is required. Of course, foo.pyd is required if +you want to say "import foo". In a dll, linkage is declared in the +source code with __declspec(dllexport). In a .pyd, linkage is defined +in a list of available functions. +

+ +Edit this entry / +Log info + +/ Last changed on Tue Nov 23 02:40:08 1999 by +Jameson Quinn +

+ +


+

8.13. Missing cw3215mt.dll (or missing cw3215.dll)

+Sometimes, when using Tkinter on Windows, you get an error that +cw3215mt.dll or cw3215.dll is missing. +

+Cause: you have an old Tcl/Tk DLL built with cygwin in your path +(probably C:\Windows). You must use the Tcl/Tk DLLs from the +standard Tcl/Tk installation (Python 1.5.2 comes with one). +

+ +Edit this entry / +Log info + +/ Last changed on Fri Jun 11 00:54:13 1999 by +GvR +

+ +


+

8.14. How to make python scripts executable:

+[Blake Coverett] +

+Win2K: +

+The standard installer already associates the .py extension with a file type +(Python.File) and gives that file type an open command that runs the +interpreter (D:\Program Files\Python\python.exe "%1" %*). This is enough to +make scripts executable from the command prompt as 'foo.py'. If you'd +rather be able to execute the script by simple typing 'foo' with no +extension you need to add .py to the PATHEXT environment variable. +

+WinNT: +

+The steps taken by the installed as described above allow you do run a +script with 'foo.py', but a long time bug in the NT command processor +prevents you from redirecting the input or output of any script executed in +this way. This is often important. +

+An appropriate incantation for making a Python script executable under WinNT +is to give the file an extension of .cmd and add the following as the first +line: +

+

+    @setlocal enableextensions & python -x %~f0 %* & goto :EOF
+
+Win9x: +

+[Due to Bruce Eckel] +

+

+  @echo off
+  rem = """
+  rem run python on this bat file. Needs the full path where
+  rem you keep your python files. The -x causes python to skip
+  rem the first line of the file:
+  python -x c:\aaa\Python\\"%0".bat %1 %2 %3 %4 %5 %6 %7 %8 %9
+  goto endofpython
+  rem """
+
+
+  # The python program goes here:
+
+
+  print "hello, Python"
+
+
+  # For the end of the batch file:
+  rem = """
+  :endofpython
+  rem """
+
+

+ +Edit this entry / +Log info + +/ Last changed on Tue Nov 30 10:25:17 1999 by +GvR +

+ +


+

8.15. Warning about CTL3D32 version from installer

+The Python installer issues a warning like this: +

+

+  This version uses CTL3D32.DLL whitch is not the correct version.
+  This version is used for windows NT applications only.
+
+[Tim Peters] +This is a Microsoft DLL, and a notorious +source of problems. The msg means what it says: you have the wrong version +of this DLL for your operating system. The Python installation did not +cause this -- something else you installed previous to this overwrote the +DLL that came with your OS (probably older shareware of some sort, but +there's no way to tell now). If you search for "CTL3D32" using any search +engine (AltaVista, for example), you'll find hundreds and hundreds of web +pages complaining about the same problem with all sorts of installation +programs. They'll point you to ways to get the correct version reinstalled +on your system (since Python doesn't cause this, we can't fix it). +

+David A Burton has written a little program to fix this. Go to +http://www.burtonsys.com/download.html and click on "ctl3dfix.zip" +

+ +Edit this entry / +Log info + +/ Last changed on Thu Oct 26 15:42:00 2000 by +GvR +

+ +


+

8.16. How can I embed Python into a Windows application?

+Edward K. Ream <edream@tds.net> writes +

+When '##' appears in a file name below, it is an abbreviated version number. For example, for Python 2.1.1, ## will be replaced by 21. +

+Embedding the Python interpreter in a Windows app can be summarized as +follows: +

+1. Do _not_ build Python into your .exe file directly. On Windows, +Python must be a DLL to handle importing modules that are themselves +DLL's. (This is the first key undocumented fact.) Instead, link to +python##.dll; it is typically installed in c:\Windows\System. +

+You can link to Python statically or dynamically. Linking statically +means linking against python##.lib The drawback is that your app won't +run if python##.dll does not exist on your system. +

+General note: python##.lib is the so-called "import lib" corresponding +to python.dll. It merely defines symbols for the linker. +

+Borland note: convert python##.lib to OMF format using Coff2Omf.exe +first. +

+Linking dynamically greatly simplifies link options; everything happens +at run time. Your code must load python##.dll using the Windows +LoadLibraryEx() routine. The code must also use access routines and +data in python##.dll (that is, Python's C API's) using pointers +obtained by the Windows GetProcAddress() routine. Macros can make +using these pointers transparent to any C code that calls routines in +Python's C API. +

+2. If you use SWIG, it is easy to create a Python "extension module" +that will make the app's data and methods available to Python. SWIG +will handle just about all the grungy details for you. The result is C +code that you link _into your .exe file_ (!) You do _not_ have to +create a DLL file, and this also simplifies linking. +

+3. SWIG will create an init function (a C function) whose name depends +on the name of the extension module. For example, if the name of the +module is leo, the init function will be called initleo(). If you use +SWIG shadow classes, as you should, the init function will be called +initleoc(). This initializes a mostly hidden helper class used by the +shadow class. +

+The reason you can link the C code in step 2 into your .exe file is that +calling the initialization function is equivalent to importing the +module into Python! (This is the second key undocumented fact.) +

+4. In short, you can use the following code to initialize the Python +interpreter with your extension module. +

+

+    #include "python.h"
+    ...
+    Py_Initialize();  // Initialize Python.
+    initmyAppc();  // Initialize (import) the helper class. 
+    PyRun_SimpleString("import myApp") ;  // Import the shadow class.
+
+5. There are two problems with Python's C API which will become apparent +if you use a compiler other than MSVC, the compiler used to build +python##.dll. +

+Problem 1: The so-called "Very High Level" functions that take FILE * +arguments will not work in a multi-compiler environment; each compiler's +notion of a struct FILE will be different. From an implementation +standpoint these are very _low_ level functions. +

+Problem 2: SWIG generates the following code when generating wrappers to +void functions: +

+

+    Py_INCREF(Py_None);
+    _resultobj = Py_None;
+    return _resultobj;
+
+Alas, Py_None is a macro that expands to a reference to a complex data +structure called _Py_NoneStruct inside python##.dll. Again, this code +will fail in a mult-compiler environment. Replace such code by: +

+

+    return Py_BuildValue("");
+
+It may be possible to use SWIG's %typemap command to make the change +automatically, though I have not been able to get this to work (I'm a +complete SWIG newbie). +

+6. Using a Python shell script to put up a Python interpreter window +from inside your Windows app is not a good idea; the resulting window +will be independent of your app's windowing system. Rather, you (or the +wxPythonWindow class) should create a "native" interpreter window. It +is easy to connect that window to the Python interpreter. You can +redirect Python's i/o to _any_ object that supports read and write, so +all you need is a Python object (defined in your extension module) that +contains read() and write() methods. +

+ +Edit this entry / +Log info + +/ Last changed on Thu Jan 31 16:29:34 2002 by +Victor Kryukov +

+ +


+

8.17. Setting up IIS 5 to use Python for CGI

+In order to set up Internet Information Services 5 to use Python for CGI processing, please see the following links: +

+http://www.e-coli.net/pyiis_server.html (for Win2k Server) +http://www.e-coli.net/pyiis.html (for Win2k pro) +

+ +Edit this entry / +Log info + +/ Last changed on Fri Mar 22 22:05:51 2002 by +douglas savitsky +

+ +


+

8.18. How do I run a Python program under Windows?

+This is not necessarily quite the straightforward question it appears +to be. If you are already familiar with running programs from the +Windows command line then everything will seem really easy and +obvious. If your computer experience is limited then you might need a +little more guidance. Also there are differences between Windows 95, +98, NT, ME, 2000 and XP which can add to the confusion. You might +think of this as "why I pay software support charges" if you have a +helpful and friendly administrator to help you set things up without +having to understand all this yourself. If so, then great! Show them +this page and it should be a done deal. +

+Unless you use some sort of integrated development environment (such +as PythonWin or IDLE, to name only two in a growing family) then you +will end up typing Windows commands into what is variously referred +to as a "DOS window" or "Command prompt window". Usually you can +create such a window from your Start menu (under Windows 2000 I use +"Start | Programs | Accessories | Command Prompt"). You should be +able to recognize when you have started such a window because you will +see a Windows "command prompt", which usually looks like this: +

+

+    C:\>
+
+The letter may be different, and there might be other things after it, +so you might just as easily see something like: +

+

+    D:\Steve\Projects\Python>
+
+depending on how your computer has been set up and what else you have +recently done with it. Once you have started such a window, you are +well on the way to running Python programs. +

+You need to realize that your Python scripts have to be processed by +another program, usually called the "Python interpreter". The +interpreter reads your script, "compiles" it into "Python bytecodes" +(which are instructions for an imaginary computer known as the "Python +Virtual Machine") and then executes the bytecodes to run your +program. So, how do you arrange for the interpreter to handle your +Python? +

+First, you need to make sure that your command window recognises the +word "python" as an instruction to start the interpreter. If you have +opened a command window, you should try entering the command: +

+

+    python
+
+and hitting return. If you then see something like: +

+

+    Python 2.2 (#28, Dec 21 2001, 12:21:22) [MSC 32 bit (Intel)] on win32
+    Type "help", "copyright", "credits" or "license" for more information.
+    >>>
+
+then this part of the job has been correctly managed during Python's +installation process, and you have started the interpreter in +"interactive mode". That means you can enter Python statements or +expressions interactively and have them executed or evaluated while +you wait. This is one of Python's strongest features, but it takes a +little getting used to. Check it by entering a few expressions of your +choice and seeing the results... +

+

+    >>> print "Hello"
+    Hello
+    >>> "Hello" * 3
+    HelloHelloHello
+
+When you want to end your interactive Python session, enter a +terminator (hold the Ctrl key down while you enter a Z, then hit the +"Enter" key) to get back to your Windows command prompt. You may also +find that you have a Start-menu entry such as "Start | Programs | +Python 2.2 | Python (command line)" that results in you seeing the +">>>" prompt in a new window. If so, the window will disappear after +you enter the terminator -- Windows runs a single "python" command in +the window, which terminates when you terminate the interpreter. +

+If the "python" command, instead of displaying the interpreter prompt ">>>", gives you a message like +

+

+    'python' is not recognized as an internal or external command,
+    operable program or batch file.
+
+or +

+

+    Bad command or filename
+
+then you need to make sure that your computer knows where to find the +Python interpreter. To do this you will have to modify a setting +called the PATH, which is a just list of directories where Windows +will look for programs. Rather than just enter the right command every +time you create a command window, you should arrange for Python's +installation directory to be added to the PATH of every command window +as it starts. If you installed Python fairly recently then the command +

+

+    dir C:\py*
+
+will probably tell you where it is installed. Alternatively, perhaps +you made a note. Otherwise you will be reduced to a search of your +whole disk ... break out the Windows explorer and use "Tools | Find" +or hit the "Search" button and look for "python.exe". Suppose you +discover that Python is installed in the C:\Python22 directory (the +default at the time of writing) then you should make sure that +entering the command +

+

+    c:\Python22\python
+
+starts up the interpreter as above (and don't forget you'll need a +"CTRL-Z" and an "Enter" to get out of it). Once you have verified the +directory, you need to add it to the start-up routines your computer +goes through. For older versions of Windows the easiest way to do +this is to edit the C:\AUTOEXEC.BAT file. You would want to add a line +like the following to AUTOEXEC.BAT: +

+

+    PATH C:\Python22;%PATH%
+
+For Windows NT, 2000 and (I assume) XP, you will need to add a string +such as +

+

+    ;C:\Python22
+
+to the current setting for the PATH environment variable, which you +will find in the properties window of "My Computer" under the +"Advanced" tab. Note that if you have sufficient privilege you might +get a choice of installing the settings either for the Current User or +for System. The latter is preferred if you want everybody to be able +to run Python on the machine. +

+If you aren't confident doing any of these manipulations yourself, ask +for help! At this stage you may or may not want to reboot your system +to make absolutely sure the new setting has "taken" (don't you love +the way Windows gives you these freqeuent coffee breaks). You probably +won't need to for Windows NT, XP or 2000. You can also avoid it in +earlier versions by editing the file C:\WINDOWS\COMMAND\CMDINIT.BAT +instead of AUTOEXEC.BAT. +

+You should now be able to start a new command window, enter +

+

+    python
+
+at the "C:>" (or whatever) prompt, and see the ">>>" prompt that +indicates the Python interpreter is reading interactive commands. +

+Let's suppose you have a program called "pytest.py" in directory +"C:\Steve\Projects\Python". A session to run that program might look +like this: +

+

+    C:\> cd \Steve\Projects\Python
+    C:\Steve\Projects\Python> python pytest.py
+
+Because you added a file name to the command to start the interpreter, +when it starts up it reads the Python script in the named file, +compiles it, executes it, and terminates (so you see another "C:\>" +prompt). You might also have entered +

+

+    C:\> python \Steve\Projects\Python\pytest.py
+
+if you hadn't wanted to change your current directory. +

+Under NT, 2000 and XP you may well find that the installation process +has also arranged that the command +

+

+    pytest.py
+
+(or, if the file isn't in the current directory) +

+

+    C:\Steve\Projects\Python\pytest.py
+
+will automatically recognize the ".py" extension and run the Python +interpreter on the named file. Using this feature is fine, but some +versions of Windows have bugs which mean that this form isn't exactly +equivalent to using the interpreter explicitly, so be careful. Easier +to remember, for now, that +

+

+    python C:\Steve\Projects\Python\pytest.py
+
+works pretty close to the same, and redirection will work (more) +reliably. +

+The important things to remember are: +

+1. Start Python from the Start Menu, or make sure the PATH is set +correctly so Windows can find the Python interpreter. +

+

+    python
+
+should give you a '>>>" prompt from the Python interpreter. Don't +forget the CTRL-Z and ENTER to terminate the interpreter (and, if you +started the window from the Start Menu, make the window disappear). +

+2. Once this works, you run programs with commands: +

+

+    python {program-file}
+
+3. When you know the commands to use you can build Windows shortcuts +to run the Python interpreter on any of your scripts, naming +particular working directories, and adding them to your menus, but +that's another lessFAQ. Take a look at +

+

+    python --help
+
+if your needs are complex. +

+4. Interactive mode (where you see the ">>>" prompt) is best used +not for running programs, which are better executed as in steps 2 +and 3, but for checking that individual statements and expressions do +what you think they will, and for developing code by experiment. +

+ +Edit this entry / +Log info + +/ Last changed on Tue Aug 20 16:19:53 2002 by +GvR +

+ +


+Python home / +Python FAQ Wizard 1.0.3 / +Feedback to GvR +

Python Powered
+ + diff --git a/debian/PVER-dbg.README.Debian.in b/debian/PVER-dbg.README.Debian.in new file mode 100644 index 000000000000000..b30149bec44a0e7 --- /dev/null +++ b/debian/PVER-dbg.README.Debian.in @@ -0,0 +1,52 @@ +Contents of the @PVER@-dbg package +------------------------------------- + +For debugging python and extension modules, you may want to add the contents +of /usr/share/doc/@PVER@/gdbinit (found in the @PVER@-dev package) to your +~/.gdbinit file. + +@PVER@-dbg contains two sets of packages: + + - debugging symbols for the standard @PVER@ build. When this package + is installed, gdb will automatically load up the debugging symbols + from it when debugging @PVER@ or one of the included extension + modules. + + - a separate @PVER@-dbg binary, configured --with-pydebug, enabling the + additional debugging code to help debug memory management problems. + +For the latter, all extension modules have to be recompiled to +correctly load with an pydebug enabled build. + + +Debian and Ubuntu specific changes to the debug interpreter +----------------------------------------------------------- +The python2.4 and python2.5 packages in Ubuntu feisty are modified to +first look for extension modules under a different name. + + normal build: foo.so + debug build: foo_d.so foo.so + +This naming schema allows installation of the extension modules into +the same path (The naming is directly taken from the Windows builds +which already uses this naming scheme). + +See https://wiki.ubuntu.com/PyDbgBuilds for more information. + + +Using the python-dbg builds +--------------------------- + + * Call the python-dbg or the pythonX.Y-dbg binaries instead of the + python or pythonX.Y binaries. + + * Properties of the debug build are described in + /usr/share/doc/@PVER@/SpecialBuilds.txt.gz. + The debug interpreter is built with Py_DEBUG defined. + + * From SpecialBuilds.txt: This is what is generally meant by "a debug + build" of Python. Py_DEBUG implies LLTRACE, Py_REF_DEBUG, + Py_TRACE_REFS, and PYMALLOC_DEBUG (if WITH_PYMALLOC is enabled). + In addition, C assert()s are enabled (via the C way: by not defining + NDEBUG), and some routines do additional sanity checks inside + "#ifdef Py_DEBUG" blocks. diff --git a/debian/PVER-dbg.overrides.in b/debian/PVER-dbg.overrides.in new file mode 100644 index 000000000000000..bf59df9820523a9 --- /dev/null +++ b/debian/PVER-dbg.overrides.in @@ -0,0 +1,13 @@ +# just the gdb debug file +@PVER@-dbg binary: python3-script-but-no-python3-dep + +# pointless lintian ... +@PVER@-dbg binary: hardening-no-fortify-functions + +@PVER@-dbg binary: command-with-path-in-maintainer-script + +# pyexpat.c contains expat error messages that lintian mis-attributes to embedding +@PVER@-dbg binary: embedded-library + +# no, it's not unusual +@PVER@-dbg binary: unusual-interpreter diff --git a/debian/PVER-dbg.postinst.in b/debian/PVER-dbg.postinst.in new file mode 100644 index 000000000000000..2f015f9ac5b25a7 --- /dev/null +++ b/debian/PVER-dbg.postinst.in @@ -0,0 +1,19 @@ +#! /bin/sh + +set -e + +if [ "$1" = configure ]; then + files=$(LC_ALL=C.UTF8 dpkg -L @PVER@-dbg | sed -n '/^\/usr\/lib\/@PVER@\/.*\.py$/p') + if [ -n "$files" ]; then + /usr/bin/@PVER@ -E -S /usr/lib/@PVER@/py_compile.py $files + if grep -sq '^byte-compile[^#]*optimize' /etc/python/debian_config; then + /usr/bin/@PVER@ -E -S -O /usr/lib/@PVER@/py_compile.py $files + fi + else + echo >&2 "@PVER@-dbg: can't get files for byte-compilation" + fi +fi + +#DEBHELPER# + +exit 0 diff --git a/debian/PVER-dbg.prerm.in b/debian/PVER-dbg.prerm.in new file mode 100644 index 000000000000000..fa1c5bb2d72b022 --- /dev/null +++ b/debian/PVER-dbg.prerm.in @@ -0,0 +1,35 @@ +#! /bin/sh + +set -e + +remove_bytecode() +{ + pkg=$1 + max=$(LANG=C LC_ALL=C xargs --show-limits < /dev/null 2>&1 | awk '/Maximum length/ {print int($NF / 4)}') + LC_ALL=C.UTF8 dpkg -L $pkg \ + | awk -F/ 'BEGIN {OFS="/"} /\.py$/ {$NF=sprintf("__pycache__/%s.*.py[co]", substr($NF,1,length($NF)-3)); print}' \ + | xargs --max-chars=$max echo \ + | while read files; do rm -f $files; done + if [ -d /usr/bin/__pycache__ ]; then + rmdir --ignore-fail-on-non-empty /usr/bin/__pycache__ + fi +} + +case "$1" in + remove) + remove_bytecode @PVER@-dbg + ;; + upgrade) + remove_bytecode @PVER@-dbg + ;; + deconfigure) + ;; + failed-upgrade) + ;; + *) + echo "prerm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +#DEBHELPER# diff --git a/debian/PVER-doc.doc-base.PVER-api.in b/debian/PVER-doc.doc-base.PVER-api.in new file mode 100644 index 000000000000000..e4fdd43349f5548 --- /dev/null +++ b/debian/PVER-doc.doc-base.PVER-api.in @@ -0,0 +1,13 @@ +Document: @PVER@-api +Title: Python/C API Reference Manual (v@VER@) +Author: Guido van Rossum +Abstract: This manual documents the API used by C (or C++) programmers who + want to write extension modules or embed Python. It is a + companion to *Extending and Embedding the Python Interpreter*, + which describes the general principles of extension writing but + does not document the API functions in detail. +Section: Programming/Python + +Format: HTML +Index: /usr/share/doc/@PVER@/html/c-api/index.html +Files: /usr/share/doc/@PVER@/html/c-api/*.html diff --git a/debian/PVER-doc.doc-base.PVER-ext.in b/debian/PVER-doc.doc-base.PVER-ext.in new file mode 100644 index 000000000000000..ce7d2b56a35098b --- /dev/null +++ b/debian/PVER-doc.doc-base.PVER-ext.in @@ -0,0 +1,16 @@ +Document: @PVER@-ext +Title: Extending and Embedding the Python Interpreter (v@VER@) +Author: Guido van Rossum +Abstract: This document describes how to write modules in C or C++ to extend + the Python interpreter with new modules. Those modules can define + new functions but also new object types and their methods. The + document also describes how to embed the Python interpreter in + another application, for use as an extension language. Finally, + it shows how to compile and link extension modules so that they + can be loaded dynamically (at run time) into the interpreter, if + the underlying operating system supports this feature. +Section: Programming/Python + +Format: HTML +Index: /usr/share/doc/@PVER@/html/extending/index.html +Files: /usr/share/doc/@PVER@/html/extending/*.html diff --git a/debian/PVER-doc.doc-base.PVER-lib.in b/debian/PVER-doc.doc-base.PVER-lib.in new file mode 100644 index 000000000000000..1bd47ac43822d93 --- /dev/null +++ b/debian/PVER-doc.doc-base.PVER-lib.in @@ -0,0 +1,15 @@ +Document: @PVER@-lib +Title: Python Library Reference (v@VER@) +Author: Guido van Rossum +Abstract: This library reference manual documents Python's standard library, + as well as many optional library modules (which may or may not be + available, depending on whether the underlying platform supports + them and on the configuration choices made at compile time). It + also documents the standard types of the language and its built-in + functions and exceptions, many of which are not or incompletely + documented in the Reference Manual. +Section: Programming/Python + +Format: HTML +Index: /usr/share/doc/@PVER@/html/library/index.html +Files: /usr/share/doc/@PVER@/html/library/*.html diff --git a/debian/PVER-doc.doc-base.PVER-new.in b/debian/PVER-doc.doc-base.PVER-new.in new file mode 100644 index 000000000000000..f6133957d2129e0 --- /dev/null +++ b/debian/PVER-doc.doc-base.PVER-new.in @@ -0,0 +1,10 @@ +Document: @PVER@-new +Title: What's new in Python @VER@ +Author: A.M. Kuchling +Abstract: This documents lists new features and changes worth mentioning + in Python @VER@. +Section: Programming/Python + +Format: HTML +Index: /usr/share/doc/@PVER@/html/whatsnew/@VER@.html +Files: /usr/share/doc/@PVER@/html/whatsnew/@VER@.html diff --git a/debian/PVER-doc.doc-base.PVER-ref.in b/debian/PVER-doc.doc-base.PVER-ref.in new file mode 100644 index 000000000000000..4a48a65222c76ff --- /dev/null +++ b/debian/PVER-doc.doc-base.PVER-ref.in @@ -0,0 +1,18 @@ +Document: @PVER@-ref +Title: Python Reference Manual (v@VER@) +Author: Guido van Rossum +Abstract: This reference manual describes the syntax and "core semantics" of + the language. It is terse, but attempts to be exact and complete. + The semantics of non-essential built-in object types and of the + built-in functions and modules are described in the *Python + Library Reference*. For an informal introduction to the language, + see the *Python Tutorial*. For C or C++ programmers, two + additional manuals exist: *Extending and Embedding the Python + Interpreter* describes the high-level picture of how to write a + Python extension module, and the *Python/C API Reference Manual* + describes the interfaces available to C/C++ programmers in detail. +Section: Programming/Python + +Format: HTML +Index: /usr/share/doc/@PVER@/html/reference/index.html +Files: /usr/share/doc/@PVER@/html/reference/*.html diff --git a/debian/PVER-doc.doc-base.PVER-tut.in b/debian/PVER-doc.doc-base.PVER-tut.in new file mode 100644 index 000000000000000..8021e2dc0de34fd --- /dev/null +++ b/debian/PVER-doc.doc-base.PVER-tut.in @@ -0,0 +1,13 @@ +Document: @PVER@-tut +Title: Python Tutorial (v@VER@) +Author: Guido van Rossum, Fred L. Drake, Jr., editor +Abstract: This tutorial introduces the reader informally to the basic + concepts and features of the Python language and system. It helps + to have a Python interpreter handy for hands-on experience, but + all examples are self-contained, so the tutorial can be read + off-line as well. +Section: Programming/Python + +Format: HTML +Index: /usr/share/doc/@PVER@/html/tutorial/index.html +Files: /usr/share/doc/@PVER@/html/tutorial/*.html diff --git a/debian/PVER-doc.info.in b/debian/PVER-doc.info.in new file mode 100644 index 000000000000000..7476490a97ac27c --- /dev/null +++ b/debian/PVER-doc.info.in @@ -0,0 +1 @@ +Doc/build/texinfo/@PVER@.info diff --git a/debian/PVER-doc.overrides.in b/debian/PVER-doc.overrides.in new file mode 100644 index 000000000000000..9aafae41af088ba --- /dev/null +++ b/debian/PVER-doc.overrides.in @@ -0,0 +1,2 @@ +# this is referenced by the html docs +@PVER@-doc binary: extra-license-file diff --git a/debian/PVER-examples.overrides.in b/debian/PVER-examples.overrides.in new file mode 100644 index 000000000000000..666c82b1cab6ea3 --- /dev/null +++ b/debian/PVER-examples.overrides.in @@ -0,0 +1,5 @@ +# don't care about permissions of the example files +@PVER@-examples binary: executable-not-elf-or-script +@PVER@-examples binary: package-contains-vcs-control-file +@PVER@-examples binary: privacy-breach-generic +@PVER@-examples binary: unusual-interpreter diff --git a/debian/PVER-minimal.README.Debian.in b/debian/PVER-minimal.README.Debian.in new file mode 100644 index 000000000000000..265c2bdebeb7ab6 --- /dev/null +++ b/debian/PVER-minimal.README.Debian.in @@ -0,0 +1,192 @@ +Contents of the @PVER@-minimal package +----------------------------------------- + +@PVER@-minimal consists of a minimum set of modules which may be needed +for python scripts used during the boot process. If other packages +are needed in these scripts, don't work around the missing module, but +file a bug report against this package. The modules in this package +are: + + __builtin__ builtin + __future__ module + _abc extension + _ast extension + _bisect extension + _blake2 extension + _bytesio builtin + _codecs builtin + _collections extension + _collections_abc module + _colorize module + _compat_pickle module + _csv extension + _datetime extension + _elementtree extension + _fileio builtin + _functools extension + _hashlib extensionx + _heapq extension + _imp builtin + _io builtin + _json extension + _locale extension + _md5 extension + _opcode extension + _opcode_metadata module + _operator extension + _pickle extension + _posixsubprocess extension + _py_abc module + _random extension + _sha1 extension + _sha2 extension + _sha3 extension + _signal builtin + _sitebuiltins module + _socket extension + _sre builtin + _ssl extensionx + _stat extension + _stringio extension + _struct extension + _string builtin + _stringio builtin + _strptime module + _symtable builtin + _sysconfig builtin + _thread builtin + _threading_local module + _tracemalloc extension + _types builtin + _typing builtin + _weakref builtin + _weakrefset module + _warnings builtin + configparser module + abc module + argparse module + array extension + ast module + atexit extension + base64 module + binascii extension + bisect module + builtins builtin + calendar module + cmath extension + codecs module + collections package + compileall module + contextlib module + copy module + copyreg module + csv module + dataclasses module + datetime module + dis module + email package + encodings package + enum module + errno builtin + exceptions builtin + fcntl extension + filecmp module + fnmatch module + functools module + gc builtin + genericpath module + getopt module + glob module + grp extension + hashlib module + heapq module + importlib package + inspect module + io module + ipaddress module + itertools extension + json package + keyword module + linecache module + locale module + logging package + marshal builtin + math extension + opcode module + operator module + optparse module + os module + pathlib package + pickle module + pkgutil module + platform module + posix builtin + posixpath module + pwd builtin + pyexpat extension + py_compile module + quopri module + random module + re package + reprlib module + runpy module + select extension + selectors module + signal module + socket module + spwd extension + sre_compile module + sre_constants module + sre_parse module + ssl module + stat module + string module + struct module + subprocess module + sys builtin + sysconfig package + syslog extension + tempfile module + textwrap module + threading module + time extension + token module + tokenize module + traceback module + tracemalloc module + types module + typing module + unicodedata extension + urllib package + warnings module + weakref module + zipfile package + zipimport module + zlib extension + +Included are as well the codecs and stringprep modules, and the encodings +modules for all encodings except the multibyte encodings and the bz2 codec. + +The following modules are excluded, their import is guarded from the +importing module: + + Used in Excluded + ------------ ------------------------------------ + io _dummy_thread + os nt ntpath os2 os2emxpath mac macpath + riscos riscospath riscosenviron + optparse gettext + pickle doctest + subprocess threading_dummy + +This list was derived by looking at the modules in the perl-base package, +then adding python specific "core modules". + +TODO's +------ + +- time.strptime cannot be used. The required _strptime module is not + included in the -minimal package yet. _strptime, locale, _locale and + calendar have to be added. + +- modules used very often in the testsuite: copy, cPickle, operator. diff --git a/debian/PVER-minimal.overrides.in b/debian/PVER-minimal.overrides.in new file mode 100644 index 000000000000000..8d3cd74b6b5e7c3 --- /dev/null +++ b/debian/PVER-minimal.overrides.in @@ -0,0 +1,5 @@ +@PVER@-minimal binary: command-with-path-in-maintainer-script +@PVER@-minimal binary: unknown-field + +# pyexpat.c contains expat error messages that lintian mis-attributes to embedding +@PVER@-minimal binary: embedded-library diff --git a/debian/PVER-minimal.postinst.in b/debian/PVER-minimal.postinst.in new file mode 100644 index 000000000000000..6a4a390ec31fd75 --- /dev/null +++ b/debian/PVER-minimal.postinst.in @@ -0,0 +1,87 @@ +#! /bin/sh + +set -e + +if [ ! -f /etc/@PVER@/sitecustomize.py ]; then + cat <<-EOF + # Empty sitecustomize.py to avoid a dangling symlink +EOF +fi + +case "$1" in + configure) + # Create empty directories in /usr/local + if [ -e /etc/staff-group-for-usr-local ]; then + perm=2755; group=staff + else + perm=755; group=root + fi + if [ ! -e /usr/local/lib/@PVER@ ]; then + mkdir -p /usr/local/lib/@PVER@ 2> /dev/null || true + chmod $perm /usr/local/lib/@PVER@ 2> /dev/null || true + chown root:$group /usr/local/lib/@PVER@ 2> /dev/null || true + fi + localsite=/usr/local/lib/@PVER@/dist-packages + if [ ! -e $localsite ]; then + mkdir -p $localsite 2> /dev/null || true + chmod $perm $localsite 2> /dev/null || true + chown root:$group $localsite 2> /dev/null || true + fi + + if command -v update-binfmts >/dev/null; then + update-binfmts --import @PVER@ + fi + + ;; +esac + +if [ "$1" = configure ]; then + + # only available before removal of the packaging package + rm -f /etc/@PVER@/sysconfig.cfg + + if ls -L /usr/lib/@PVER@/sitecustomize.py >/dev/null 2>&1; then + filt='cat' + else + filt='fgrep -v sitecustomize.py' + fi + files=$(dpkg -L lib@PVER@-minimal@HOST_QUAL@ \ + | sed -n '/^\/usr\/lib\/@PVER@\/.*\.py$/p' | $filt) + if [ -n "$files" ]; then + /usr/bin/@PVER@ -E -S /usr/lib/@PVER@/py_compile.py $files + if grep -sq '^byte-compile[^#]*optimize' /etc/python/debian_config; then + /usr/bin/@PVER@ -E -S -O /usr/lib/@PVER@/py_compile.py $files + fi + else + echo >&2 "@PVER@-minimal: can't get files for byte-compilation" + fi + bc=no + #if [ -z "$2" ] || dpkg --compare-versions "$2" lt 2.5-3 \ + # || [ -f /var/lib/python/@PVER@_installed ]; then + # bc=yes + #fi + if ! grep -sq '^supported-versions[^#]*@PVER@' /usr/share/python/debian_defaults + then + # FIXME: byte compile anyway? + bc=no + fi + if [ "$bc" = yes ]; then + # new installation or installation of first version with hook support + if [ "$DEBIAN_FRONTEND" != noninteractive ]; then + echo "Linking and byte-compiling packages for runtime @PVER@..." + fi + version=$(dpkg -s @PVER@-minimal | awk '/^Version:/ {print $2}') + for hook in /usr/share/python3/runtime.d/*.rtinstall; do + [ -x $hook ] || continue + $hook rtinstall @PVER@ "$2" "$version" + done + if [ -f /var/lib/python/@PVER@_installed ]; then + rm -f /var/lib/python/@PVER@_installed + rmdir --ignore-fail-on-non-empty /var/lib/python 2>/dev/null + fi + fi +fi + +#DEBHELPER# + +exit 0 diff --git a/debian/PVER-minimal.postrm.in b/debian/PVER-minimal.postrm.in new file mode 100644 index 000000000000000..3f73f54e7f7bece --- /dev/null +++ b/debian/PVER-minimal.postrm.in @@ -0,0 +1,13 @@ +#! /bin/sh + +set -e + +if [ "$1" = "remove" ]; then + + if [ -f /var/lib/python/@PVER@_installed ]; then + rm -f /var/lib/python/@PVER@_installed + rmdir --ignore-fail-on-non-empty /var/lib/python 2>/dev/null + fi + + rmdir --parents /usr/local/lib/@PVER@ 2>/dev/null || true +fi diff --git a/debian/PVER-minimal.preinst.in b/debian/PVER-minimal.preinst.in new file mode 100644 index 000000000000000..382e0995b24fcd7 --- /dev/null +++ b/debian/PVER-minimal.preinst.in @@ -0,0 +1,26 @@ +#!/bin/sh + +set -e + +case "$1" in + install) + # remember newly installed runtime + mkdir -p /var/lib/python + touch /var/lib/python/@PVER@_installed + ;; + upgrade) + : + ;; + + abort-upgrade) + ;; + + *) + echo "preinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +#DEBHELPER# + +exit 0 diff --git a/debian/PVER-minimal.prerm.in b/debian/PVER-minimal.prerm.in new file mode 100644 index 000000000000000..3a89a3f6c931842 --- /dev/null +++ b/debian/PVER-minimal.prerm.in @@ -0,0 +1,36 @@ +#! /bin/sh + +set -e + +case "$1" in + remove) + if [ "$DEBIAN_FRONTEND" != noninteractive ]; then + echo "Unlinking and removing bytecode for runtime @PVER@" + fi + for hook in /usr/share/python3/runtime.d/*.rtremove; do + [ -x $hook ] || continue + $hook rtremove @PVER@ || continue + done + + if command -v update-binfmts >/dev/null; then + update-binfmts --package @PVER@ --remove @PVER@ /usr/bin/@PVER@ + fi + + localsite=/usr/local/lib/@PVER@/dist-packages + [ -d $localsite ] && rmdir $localsite 2>/dev/null || true + [ -d $(dirname $localsite) ] \ + && rmdir $(dirname $localsite) 2>/dev/null || true + ;; + upgrade) + ;; + deconfigure) + ;; + failed-upgrade) + ;; + *) + echo "prerm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +#DEBHELPER# diff --git a/debian/PVER-nopie.overrides.in b/debian/PVER-nopie.overrides.in new file mode 100644 index 000000000000000..b37d0668b25977b --- /dev/null +++ b/debian/PVER-nopie.overrides.in @@ -0,0 +1,7 @@ +# yes, we have to +@PVER@-nopie binary: depends-on-python-minimal + +# pyexpat.c contains expat error messages that lintian mis-attributes to embedding +@PVER@-nopie binary: embedded-library + +@PVER@-nopie binary: unknown-field diff --git a/debian/PVER-nopie.postrm.in b/debian/PVER-nopie.postrm.in new file mode 100644 index 000000000000000..506f81d4678965a --- /dev/null +++ b/debian/PVER-nopie.postrm.in @@ -0,0 +1,13 @@ +#! /bin/sh + +set -e + +if [ "$1" = "remove" ]; then + dpkg-divert --package @PVER@-nopie \ + --remove --rename \ + --divert /usr/bin/@PVER@-pie /usr/bin/@PVER@ +fi + +#DEBHELPER# + +exit 0 diff --git a/debian/PVER-nopie.preinst.in b/debian/PVER-nopie.preinst.in new file mode 100644 index 000000000000000..0d0445dd2fc8d95 --- /dev/null +++ b/debian/PVER-nopie.preinst.in @@ -0,0 +1,26 @@ +#!/bin/sh + +set -e + +case "$1" in + install|upgrade) + dpkg-divert --package @PVER@-nopie \ + --add --rename \ + --divert /usr/bin/@PVER@-pie /usr/bin/@PVER@ + ;; + upgrade) + : + ;; + + abort-upgrade) + ;; + + *) + echo "preinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +#DEBHELPER# + +exit 0 diff --git a/debian/PVER-tk.postinst.in b/debian/PVER-tk.postinst.in new file mode 100644 index 000000000000000..da1df3c7681b9ce --- /dev/null +++ b/debian/PVER-tk.postinst.in @@ -0,0 +1,22 @@ +#! /bin/sh + +set -e + +case "$1" in + configure) + files=$(LC_ALL=C.UTF8 dpkg -L @PVER@-tk | sed -n '/^\/usr\/lib\/@PVER@\/.*\.py$/p') + if [ -n "$files" ]; then + if command -v @PVER@ >/dev/null; then + /usr/bin/@PVER@ -E -S /usr/lib/@PVER@/py_compile.py $files + if grep -sq '^byte-compile[^#]*optimize' /etc/python/debian_config; then + /usr/bin/@PVER@ -E -S -O /usr/lib/@PVER@/py_compile.py $files + fi + fi + else + echo >&2 "@PVER@: can't get files for byte-compilation" + fi +esac + +#DEBHELPER# + +exit 0 diff --git a/debian/PVER-tk.prerm.in b/debian/PVER-tk.prerm.in new file mode 100644 index 000000000000000..c0c9d3246c4ca45 --- /dev/null +++ b/debian/PVER-tk.prerm.in @@ -0,0 +1,35 @@ +#! /bin/sh + +set -e + +remove_bytecode() +{ + pkg=$1 + max=$(LANG=C LC_ALL=C xargs --show-limits < /dev/null 2>&1 | awk '/Maximum length/ {print int($NF / 4)}') + LC_ALL=C.UTF8 dpkg -L $pkg \ + | awk -F/ 'BEGIN {OFS="/"} /\.py$/ {$NF=sprintf("__pycache__/%s.*.py[co]", substr($NF,1,length($NF)-3)); print}' \ + | xargs --max-chars="$max" echo \ + | while read files; do rm -f $files; done + + find /usr/lib/@PVER@/tkinter \ + -name __pycache__ -type d -empty -print \ + | xargs -r rm -rf +} + +case "$1" in + remove) + remove_bytecode @PVER@-tk + ;; + upgrade) + ;; + deconfigure) + ;; + failed-upgrade) + ;; + *) + echo "prerm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +#DEBHELPER# diff --git a/debian/PVER-venv.overrides.in b/debian/PVER-venv.overrides.in new file mode 100644 index 000000000000000..df5377ce51884a2 --- /dev/null +++ b/debian/PVER-venv.overrides.in @@ -0,0 +1 @@ +@PVER@-venv binary: command-with-path-in-maintainer-script diff --git a/debian/PVER-venv.postinst.in b/debian/PVER-venv.postinst.in new file mode 100644 index 000000000000000..654a75e2ff98114 --- /dev/null +++ b/debian/PVER-venv.postinst.in @@ -0,0 +1,20 @@ +#! /bin/sh + +set -e + +case "$1" in + configure) + files=$(LC_ALL=C.UTF8 dpkg -L @PVER@-venv | sed -n '/^\/usr\/lib\/@PVER@\/.*\.py$/p') + if [ -n "$files" ]; then + /usr/bin/@PVER@ -E -S /usr/lib/@PVER@/py_compile.py $files + if grep -sq '^byte-compile[^#]*optimize' /etc/python/debian_config; then + /usr/bin/@PVER@ -E -S -O /usr/lib/@PVER@/py_compile.py $files + fi + else + echo >&2 "@PVER@: can't get files for byte-compilation" + fi +esac + +#DEBHELPER# + +exit 0 diff --git a/debian/PVER-venv.postrm.in b/debian/PVER-venv.postrm.in new file mode 100644 index 000000000000000..ed12298c402c364 --- /dev/null +++ b/debian/PVER-venv.postrm.in @@ -0,0 +1,12 @@ +#! /bin/sh + +set -e + +if [ "$1" = "purge" ]; then + rm -rf /usr/lib/python-wheels + rm -rf /var/lib/python-wheels +fi + +#DEBHELPER# + +exit 0 diff --git a/debian/PVER-venv.prerm.in b/debian/PVER-venv.prerm.in new file mode 100644 index 000000000000000..ad7706f263f2932 --- /dev/null +++ b/debian/PVER-venv.prerm.in @@ -0,0 +1,35 @@ +#! /bin/sh + +set -e + +remove_bytecode() +{ + pkg=$1 + max=$(LANG=C LC_ALL=C xargs --show-limits < /dev/null 2>&1 | awk '/Maximum length/ {print int($NF / 4)}') + LC_ALL=C.UTF8 dpkg -L $pkg \ + | awk -F/ 'BEGIN {OFS="/"} /\.py$/ {$NF=sprintf("__pycache__/%s.*.py[co]", substr($NF,1,length($NF)-3)); print}' \ + | xargs --max-chars="$max" echo \ + | while read files; do rm -f $files; done + + find /usr/lib/@PVER@/ensurepip \ + -name __pycache__ -type d -empty -print \ + | xargs -r rm -rf +} + +case "$1" in + remove) + remove_bytecode @PVER@-venv + ;; + upgrade) + ;; + deconfigure) + ;; + failed-upgrade) + ;; + *) + echo "prerm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +#DEBHELPER# diff --git a/debian/PVER.desktop.in b/debian/PVER.desktop.in new file mode 100644 index 000000000000000..0f954c9fb89157d --- /dev/null +++ b/debian/PVER.desktop.in @@ -0,0 +1,10 @@ +[Desktop Entry] +Name=Python (v@VER@) +Comment=Python Interpreter (v@VER@) +Exec=/usr/bin/@PVER@ +Icon=/usr/share/pixmaps/@PVER@.xpm +Terminal=true +Type=Application +Categories=Development; +StartupNotify=true +NoDisplay=true diff --git a/debian/PVER.overrides.in b/debian/PVER.overrides.in new file mode 100644 index 000000000000000..44e696956c2a0d9 --- /dev/null +++ b/debian/PVER.overrides.in @@ -0,0 +1,14 @@ +# yes, we have to +@PVER@ binary: depends-on-python-minimal + +@PVER@ binary: desktop-command-not-in-package +@PVER@ binary: menu-command-not-in-package +@PVER@ binary: unusual-interpreter +@PVER@ binary: python3-script-but-no-python3-dep + +# no, not useless +@PVER@ binary: manpage-has-useless-whatis-entry + +@PVER@ binary: command-with-path-in-maintainer-script + +@PVER@ binary: python3-script-but-no-python3-dep [usr/bin/pygettext@VER@] diff --git a/debian/PVER.postinst.in b/debian/PVER.postinst.in new file mode 100644 index 000000000000000..b158aecd24d7b32 --- /dev/null +++ b/debian/PVER.postinst.in @@ -0,0 +1,20 @@ +#! /bin/sh + +set -e + +case "$1" in + configure) + files=$(LC_ALL=C.UTF8 dpkg -L lib@PVER@-stdlib@HOST_QUAL@ | sed -n '/^\/usr\/lib\/@PVER@\/.*\.py$/p') + if [ -n "$files" ]; then + /usr/bin/@PVER@ -E -S /usr/lib/@PVER@/py_compile.py $files + if grep -sq '^byte-compile[^#]*optimize' /etc/python/debian_config; then + /usr/bin/@PVER@ -E -S -O /usr/lib/@PVER@/py_compile.py $files + fi + else + echo >&2 "@PVER@: can't get files for byte-compilation" + fi +esac + +#DEBHELPER# + +exit 0 diff --git a/debian/PVER.prerm.in b/debian/PVER.prerm.in new file mode 100644 index 000000000000000..a3cf30aaafec7a7 --- /dev/null +++ b/debian/PVER.prerm.in @@ -0,0 +1,31 @@ +#! /bin/sh + +set -e + +remove_bytecode() +{ + pkg=$1 + max=$(LANG=C LC_ALL=C xargs --show-limits < /dev/null 2>&1 | awk '/Maximum length/ {print int($NF / 4)}') + LC_ALL=C.UTF8 dpkg -L $pkg \ + | awk -F/ 'BEGIN {OFS="/"} /\.py$/ {$NF=sprintf("__pycache__/%s.*.py[co]", substr($NF,1,length($NF)-3)); print}' \ + | xargs --max-chars="$max" echo \ + | while read files; do rm -f $files; done + find /usr/lib/python3 /usr/lib/@PVER@ -name dist-packages -prune -o -name __pycache__ -empty -print \ + | xargs -r rm -rf +} + +case "$1" in + remove|upgrade) + remove_bytecode lib@PVER@-stdlib@HOST_QUAL@ + ;; + deconfigure) + ;; + failed-upgrade) + ;; + *) + echo "prerm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +#DEBHELPER# diff --git a/debian/README.Debian.in b/debian/README.Debian.in new file mode 100644 index 000000000000000..20138c178d855cf --- /dev/null +++ b/debian/README.Debian.in @@ -0,0 +1,8 @@ +The documentation for this package is in /usr/share/doc/@PVER@/. + +A draft of the "Debian Python Policy" can be found in + + /usr/share/doc/python + +Sometime it will be moved to /usr/share/doc/debian-policy in the +debian-policy package. diff --git a/debian/README.PVER.in b/debian/README.PVER.in new file mode 100644 index 000000000000000..d051a99d14e7332 --- /dev/null +++ b/debian/README.PVER.in @@ -0,0 +1,94 @@ + + Python @VER@ for Debian + --------------------- + +This is Python @VER@ packaged for Debian. + +This document contains information specific to the Debian packages of +Python @VER@. + + + + [TODO: This document is not yet up-to-date with the packages.] + +Currently, it features those two main topics: + + 1. Release notes for the Debian packages: + 2. Notes for developers using the Debian Python packages: + +Release notes and documentation from the upstream package are installed +in /usr/share/doc/@PVER@/. + +There's a mailing list for discussion of issues related to Python on Debian +systems: debian-python@lists.debian.org. The list is not intended for +general Python problems, but as a forum for maintainers of Python-related +packages and interested third parties. + + + +1. Release notes for the Debian packages: + + +Results of the regression test: +------------------------------ + +The package does successfully run the regression tests for all included +modules. Seven packages are skipped since they are platform-dependent and +can't be used with Linux. + + +2. Notes for developers using the Debian python packages: + +See the draft of the Debian Python policy in /usr/share/doc/python. + +Development files like the python library or Makefiles can be found in the +@PVER@-dev package in /usr/lib/@PVER@/config. Therefore, if you need to install +a pure python extension, you only need @PVER@. On the other hand, to install a +C extension, you need @PVER@-dev. + +a) Locally installed Python add-ons + + /usr/local/lib/@PVER@/site-packages/ + /usr/local/lib/site-python/ (version-independent modules) + +b) Python add-ons packaged for Debian + + /usr/lib/@PVER@/site-packages/ + /usr/lib/site-python/ (version-independent modules) + +Note that no package must install files directly into /usr/lib/@PVER@/ +or /usr/local/lib/@PVER@/. Only the site-packages directory is allowed +for third-party extensions. + +Use of the new `package' scheme is strongly encouraged. The `ni' interface +is obsolete in python 1.5. + +Header files for extensions go into /usr/include/@PVER@/. + + +Installing extensions for local use only: +---------------------------------------- + +Consider using setuptools ... + +Most extensions use Python's Makefile.pre.in. Note that Makefile.pre.in +by default will install files into /usr/lib/, not into /usr/local/lib/, +which is not allowed for local extensions. You'll have to change the +Makefile accordingly. Most times, "make prefix=/usr/local install" will +work. + + +Packaging python extensions for Debian: +-------------------------------------- + +Maintainers of Python extension packages should read + + /usr/share/doc/python/python-policy.txt.gz + + + + + 03/09/98 + Gregor Hoffleit + +Last change: 2001-12-14 diff --git a/debian/README.Tk b/debian/README.Tk new file mode 100644 index 000000000000000..7067ecb41c94f02 --- /dev/null +++ b/debian/README.Tk @@ -0,0 +1,8 @@ +Tkinter documentation can be found at + + http://www.pythonware.com/library/index.htm + +more specific: + + http://www.pythonware.com/library/tkinter/introduction/index.htm + http://www.pythonware.com/library/tkinter/an-introduction-to-tkinter.pdf diff --git a/debian/README.dbm b/debian/README.dbm new file mode 100644 index 000000000000000..3c5e2bcbca199ed --- /dev/null +++ b/debian/README.dbm @@ -0,0 +1,72 @@ + + Python and dbm modules on Debian + -------------------------------- + +This file documents the configuration of the dbm modules for Debian. It +gives hints at the preferred use of the dbm modules. + + +The preferred way to access dbm databases in Python is the anydbm module. +dbm databases behave like mappings (dictionaries). + +Since there exist several dbm database formats, we choose the following +layout for Python on Debian: + + * creating a new database with anydbm will create a Berkeley DB 2.X Hash + database file. This is the standard format used by libdb starting + with glibc 2.1. + + * opening an existing database with anydbm will try to guess the format + of the file (using whichdb) and then load it using one of the bsddb, + bsddb1, gdbm or dbm (only if the python-gdbm package is installed) + or dumbdbm modules. + + * The modules use the following database formats: + + - bsddb: Berkeley DB 2.X Hash (as in libc6 >=2.1 or libdb2) + - bsddb1: Berkeley DB 1.85 Hash (as in libc6 >=2.1 or libdb2) + - gdbm: GNU dbm 1.x or ndbm + - dbm: " (nearly the same as the gdbm module for us) + - dumbdbm: a hand-crafted format only used in this module + + That means that all usual formats should be readable with anydbm. + + * If you want to create a database in a format different from DB 2.X, + you can still directly use the specified module. + + * I.e. bsddb is the preferred module, and DB 2.X is the preferred format. + + * Note that the db1hash and bsddb1 modules are Debian specific. anydbm + and whichdb have been modified to support DB 2.X Hash files (see + below for details). + + + +For experts only: +---------------- + +Although bsddb employs the new DB 2.X format and uses the new Sleepycat +DB 2 library as included with glibc >= 2.1, it's still using the old +DB 1.85 API (which is still supported by DB 2). + +A more recent version 1.1 of the BSD DB module (available from +http://starship.skyport.net/robind/python/) directly uses the DB 2.X API. +It has a richer set of features. + + +On a glibc 2.1 system, bsddb is linked with -ldb, bsddb1 is linked with +-ldb1 and gdbm as well as dbm are linked with -lgdbm. + +On a glibc 2.0 system (e.g. potato for m68k or slink), bsddb will be +linked with -ldb2 while bsddb1 will be linked with -ldb (therefore +python-base here depends on libdb2). + + +db1hash and bsddb1 nearly completely identical to dbhash and bsddb. The +only difference is that bsddb is linked with the real DB 2 library, while +bsddb1 is linked with an library which provides compatibility with legacy +DB 1.85 databases. + + + July 16, 1999 + Gregor Hoffleit diff --git a/debian/README.idle-PVER.in b/debian/README.idle-PVER.in new file mode 100644 index 000000000000000..6705049d20e3ad5 --- /dev/null +++ b/debian/README.idle-PVER.in @@ -0,0 +1,14 @@ + + The Python IDLE package for Debian + ---------------------------------- + +This package contains Python @VER@'s Integrated DeveLopment Environment, IDLE. + +IDLE is included in the Python @VER@ upstream distribution (Tools/idle) and +depends on Tkinter (available as @PVER@-tk package). + +I have written a simple man page. + + + 06/16/1999 + Gregor Hoffleit diff --git a/debian/README.maintainers.in b/debian/README.maintainers.in new file mode 100644 index 000000000000000..c0b0cab3924f94d --- /dev/null +++ b/debian/README.maintainers.in @@ -0,0 +1,88 @@ + +Hints for maintainers of Debian packages of Python extensions +------------------------------------------------------------- + +Most of the content of this README can be found in the Debian Python policy. +See /usr/share/doc/python/python-policy.txt.gz. + +Documentation Tools +------------------- + +If your package ships documentation produced in the Python +documentation format, you can generate it at build-time by +build-depending on @PVER@-dev, and you will find the +templates, tools and scripts in /usr/lib/@PVER@/doc/tools -- +adjust your build scripts accordingly. + + +Makefile.pre.in issues +---------------------- + +Python comes with a `universal Unix Makefile for Python extensions' in +/usr/lib/@PVER@/config/Makefile.pre.in (with Debian, this is included +in the python-dev package), which is used by most Python extensions. + +In general, packages using the Makefile.pre.in approach can be packaged +simply by running dh_make or by using one of debhelper's rules' templates +(see /usr/doc/debhelper/examples/). Makefile.pre.in works fine with e.g. +"make prefix=debian/tmp/usr install". + +One glitch: You may be running into the problem that Makefile.pre.in +doesn't try to create all the directories when they don't exist. Therefore, +you may have to create them manually before "make install". In most cases, +the following should work: + + ... + dh_installdirs /usr/lib/@PVER@ + $(MAKE) prefix=debian/tmp/usr install + ... + + +Byte-compilation +---------------- + +For speed reasons, Python internally compiles source files into a byte-code. +To speed up subsequent imports, it tries to save the byte-code along with +the source with an extension .pyc (resp. pyo). This will fail if the +libraries are installed in a non-writable directory, which may be the +case for /usr/lib/@PVER@/. + +Not that .pyc and .pyo files should not be relocated, since for debugging +purposes the path of the source for is hard-coded into them. + +To precompile files in batches after installation, Python has a script +compileall.py, which compiles all files in a given directory tree. The +Debian version of compileall has been enhanced to support incremental +compilation and to feature a ddir (destination dir) option. ddir is +used to compile files in debian/usr/lib/python/ when they will be +installed into /usr/lib/python/. + + +Currently, there are two ways to use compileall for Debian packages. The +first has a speed penalty, the second has a space penalty in the package. + +1.) Compiling and removing .pyc files in postinst/prerm: + + Use dh_python(1) from the debhelper packages to add commands to byte- + compile on installation and to remove the byte-compiled files on removal. + Your package has to build-depend on: debhelper (>= 4.1.67), python. + + In /usr/share/doc/@PVER@, you'll find sample.postinst and sample.prerm. + If you set the directory where the .py files are installed, these + scripts will install and remove the .pyc and .pyo files for your + package after unpacking resp. before removing the package. + +2.) Compiling the .pyc files `out of place' during installation: + + As of 1.5.1, compileall.py allows you to specify a faked installation + directory using the "-d destdir" option, so that you can precompile + the files in their temporary directory + (e.g. debian/tmp/usr/lib/python2.1/site-packages/PACKAGE). + + + + 11/02/98 + Gregor Hoffleit + + +Last modified: 2007-10-14 diff --git a/debian/README.python b/debian/README.python new file mode 100644 index 000000000000000..5aacdf79f8d648c --- /dev/null +++ b/debian/README.python @@ -0,0 +1,153 @@ + + Python 2.x for Debian + --------------------- + +This is Python 2.x packaged for Debian. + +This document contains information specific to the Debian packages of +Python 2.x. + + + + [TODO: This document is not yet up-to-date with the packages.] + + + + + + +Currently, it features those two main topics: + + 1. Release notes for the Debian packages: + 2. Notes for developers using the Debian Python packages: + +Release notes and documentation from the upstream package are installed +in /usr/share/doc/python/. + +Up-to-date information regarding Python on Debian systems is also +available as http://www.debian.org/~flight/python/. + +There's a mailing list for discussion of issues related to Python on Debian +systems: debian-python@lists.debian.org. The list is not intended for +general Python problems, but as a forum for maintainers of Python-related +packages and interested third parties. + + + +1. Release notes for the Debian packages: + + +Results of the regression test: +------------------------------ + +The package does successfully run the regression tests for all included +modules. Seven packages are skipped since they are platform-dependent and +can't be used with Linux. + + +Noteworthy changes since the 1.4 packages: +----------------------------------------- + +- Threading support enabled. +- Tkinter for Tcl/Tk 8.x. +- New package python-zlib. +- The dbmmodule was dropped. Use bsddb instead. gdbmmodule is provided + for compatibility's sake. +- python-elisp adheres to the new emacs add-on policy; it now depends + on emacsen. python-elisp probably won't work correctly with emacs19. + Refer to /usr/doc/python-elisp/ for more information. +- Remember that 1.5 has dropped the `ni' interface in favor of a generic + `packages' concept. +- Python 1.5 regression test as additional package python-regrtest. You + don't need to install this package unless you don't trust the + maintainer ;-). +- once again, modified upstream's compileall.py and py_compile.py. + Now they support compilation of optimized byte-code (.pyo) for use + with "python -O", removal of .pyc and .pyo files where the .py source + files are missing (-d) and finally the fake of a installation directory + when .py files have to be compiled out of place for later installation + in a different directory (-i destdir, used in ./debian/rules). +- The Debian packages for python 1.4 do call + /usr/lib/python1.4/compileall.py in their postrm script. Therefore + I had to provide a link from /usr/lib/python1.5/compileall.py, otherwise + the old packages won't be removed completely. THIS IS A SILLY HACK! + + + +2. Notes for developers using the Debian python packages: + + +Embedding python: +---------------- + +The files for embedding python resp. extending the python interpreter +are included in the python-dev package. With the configuration in the +Debian GNU/Linux packages of python 1.5, you will want to use something +like + + -I/usr/include/python1.5 (e.g. for config.h) + -L/usr/lib/python1.5/config -lpython1.5 (... -lpthread) + (also for Makefile.pre.in, Setup etc.) + +Makefile.pre.in automatically gets that right. Note that unlike 1.4, +python 1.5 has only one library, libpython1.5.a. + +Currently, there's no shared version of libpython. Future version of +the Debian python packages will support this. + + +Python extension packages: +------------------------- + +According to www.python.org/doc/essays/packages.html, extension packages +should only install into /usr/lib/python1.5/site-packages/ (resp. +/usr/lib/site-python/ for packages that are definitely version independent). +No extension package should install files directly into /usr/lib/python1.5/. + +But according to the FSSTND, only Debian packages are allowed to use +/usr/lib/python1.5/. Therefore Debian Python additionally by default +searches a second hierarchy in /usr/local/lib/. These directories take +precedence over their equivalents in /usr/lib/. + +a) Locally installed Python add-ons + + /usr/local/lib/python1.5/site-packages/ + /usr/local/lib/site-python/ (version-independent modules) + +b) Python add-ons packaged for Debian + + /usr/lib/python1.5/site-packages/ + /usr/lib/site-python/ (version-independent modules) + +Note that no package must install files directly into /usr/lib/python1.5/ +or /usr/local/lib/python1.5/. Only the site-packages directory is allowed +for third-party extensions. + +Use of the new `package' scheme is strongly encouraged. The `ni' interface +is obsolete in python 1.5. + +Header files for extensions go into /usr/include/python1.5/. + + +Installing extensions for local use only: +---------------------------------------- + +Most extensions use Python's Makefile.pre.in. Note that Makefile.pre.in +by default will install files into /usr/lib/, not into /usr/local/lib/, +which is not allowed for local extensions. You'll have to change the +Makefile accordingly. Most times, "make prefix=/usr/local install" will +work. + + +Packaging python extensions for Debian: +-------------------------------------- + +Maintainers of Python extension packages should read README.maintainers. + + + + + 03/09/98 + Gregor Hoffleit + +Last change: 07/16/1999 diff --git a/debian/README.source b/debian/README.source new file mode 100644 index 000000000000000..f31e27c1cb1c47d --- /dev/null +++ b/debian/README.source @@ -0,0 +1,7 @@ +The source tarball is lacking the files Lib/profile.py and Lib/pstats.py, +which Debian considers to have a license non-suitable for main (the use +of these modules limited to python). + +The package uses quilt to apply / unapply patches. +See /usr/share/doc/quilt/README.source. The series file is generated +during the build. diff --git a/debian/README.venv b/debian/README.venv new file mode 100644 index 000000000000000..a69bb39ef165084 --- /dev/null +++ b/debian/README.venv @@ -0,0 +1,79 @@ +Installing Python Packages in Debian +==================================== + +It is recommended to let Debian's package managers manage Python packages in +/usr/lib/ and /usr/share/, and avoid installing packages in your user directory (~/.local). + +Python applications +------------------- + +If you need to install a Python application (or version) that isn't packaged in +Debian, we recommend that you install it with pipx (in the "pipx" Debian +package). pipx will set up an environment isolated from other applications and +system Python modules, and install the application and its dependencies into +that. + +Python library modules +---------------------- + +If you need to install a Python library module (or version) that isn't packaged +in Debian, we recommend installing it into a virtualenv, where possible. You +can create virtualenvs with the venv Python stdlib module (in the +"python3-venv" Debian package) or the virtualenv Python 3rd-party tool (in the +"virtualenv" Debian package). + +Both of these will create an isolated environment, with a copy of pip in it. +After activating the environment, you can install python applications and +library modules into the virtual environment. + +e.g. instead of running: +$ pip install --user foo +run: +$ mkdir -p ~/.venvs +$ python3 -m venv ~/.venvs/foo +$ ~/.venvs/foo/bin/python -m pip install foo + +If needed, the isolated environment can also have access to system Python +modules, with the "--system-site-packages" flag. + +Installing things system-wide +----------------------------- + +Because Debian declares its Python install to be EXTERNALLY-MANAGED [0], pip +(and other installers) will refuse to install packages system-wide. +Installation is only possible in virtual environments or separate Python +installs. + +[0]: https://peps.python.org/pep-0668/ + +This is because Python package installers (like pip) are unaware of the +constraints that APT-managed packages have on libraries and versions. See +PEP-668 for a full discussion of the problems that can occur when multiple +installers operate on the same Python install. + +This can be overriden by passing the --break-system-packages option to pip. You +do this at your own risk: pip may break Python modules that part of your Debian +system depends on. This option can also be specified by exporting +PIP_BREAK_SYSTEM_PACKAGES=1 or configuring the following in +~/.config/pip/pip.conf or /etc/pip.conf: + +[global] +break-system-packages = true + +You can also override this system-wide by removing +/usr/lib/python3.*/EXTERNALLY-MANAGED. Again, you do this at your own risk, +with the understanding that Debian-provided Python modules may be broken by pip +/ other installers. The best way to do this is to move it with dpkg-divert, +which will survive security updates): + +# dpkg-divert --rename --add /usr/lib/$(py3versions -d)/EXTERNALLY-MANAGED + +A clean option is to install your own Python (from source) in /usr/local, that +isn't EXTERNALLY-MANAGED. + +Installing things in your home directory +---------------------------------------- + +The EXTERNALLY-MANAGED policy also disables installation into your home +directory (pip install --user). This is to protect your ability to execute +system Python packages. The same --break-system-packages option can override it. diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 000000000000000..4138d2cf2217903 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5279 @@ +python3.13 (3.13.0-2) unstable; urgency=medium + + [ Stefano Rivera ] + * Adjust lib-argparse.diff to avoid failing test_argparse's translation + test. + + [ Matthias Klose ] + * Update to the 3.13 branch 2024-11-12. + * Refresh patches. + + -- Matthias Klose Tue, 12 Nov 2024 10:54:22 +0100 + +python3.13 (3.13.0-1) unstable; urgency=medium + + * Python 3.13.0 final. + * Add DEP-12 metadata. + * Update symbols file. + * Patch: Allow stable API extensions to include a multiarch tuple in the + filename. + + -- Stefano Rivera Mon, 07 Oct 2024 14:58:50 -0700 + +python3.13 (3.13.0~rc3-1) unstable; urgency=medium + + * Python 3.13.0 release candidate 3. + * Refresh patches. + * Remove debian/locale-gen, we use locales-all. (Closes: #1076778) + * Re-enable build-time tests. (Closes: #1076779) + - Build-Depend on xvfb and xauth again. + - Build-Depend on python3-{pip,setuptools,wheel}-whl for tests. + * Verify upstream PGP signature. + * Patch: Strip absolute --libdir paths from configure args in test_freeze. + + -- Stefano Rivera Thu, 03 Oct 2024 09:12:35 -0600 + +python3.13 (3.13.0~rc2-1) unstable; urgency=medium + + * Python 3.13.0 release candidate 2. + * Refresh patches. + + -- Stefano Rivera Sat, 07 Sep 2024 10:52:38 +0200 + +python3.13 (3.13.0~rc1-4) unstable; urgency=medium + + * python3.x-tk: Make byte-compilation depend on the availability of + the interpreter. + + -- Matthias Klose Thu, 22 Aug 2024 15:07:31 +0200 + +python3.13 (3.13.0~rc1-3) unstable; urgency=medium + + * Add python3.x-tk maintainer scripts. + * Call dpkg with LC_ALL=C.UTF8 set. + + -- Matthias Klose Thu, 22 Aug 2024 09:53:05 +0200 + +python3.13 (3.13.0~rc1-2) experimental; urgency=medium + + [ Stefano Rivera ] + * Drop patch ctypes-arm. Superseded upstream in 2.7.5. + * Drop patch fix-py_compile. Superseded upstream in 3.11. + * Drop patch sphinx3, superseded upstream in 3.10. + * Expand on patch comments. + * Forward some patches. + * Update pydoc-use-pager patch. + + [ Matthias Klose ] + * Build python3.13-gdbm and python3.13-tk packages again; Having these + extensions hidden in the libpython-stdlib packages raises some chrootkit + warnings. These packages should not be used as dependencies, and do not + depend on the Python interpreter. For dependencies, the existing + python3-gdbm and python3-tk packages should be used. + + -- Matthias Klose Wed, 21 Aug 2024 11:23:04 +0200 + +python3.13 (3.13.0~rc1-1) unstable; urgency=medium + + * Python 3.13.0 release candidate 1. + * Don't pass -specs=package-metadata.specs. + * Don't mention 2to3 in package description anymore. Closes: #1077957. + * Prefix patches for python3-minimal with 'min-'. + * libpython-stdlib: Include the _gdbm and _tkinter extensions, prefixed + with a dot, and no dependencies on the gbm and tcl/tk libraries. + * Update symbols files. + + -- Matthias Klose Tue, 06 Aug 2024 08:03:09 +0200 + +python3.13 (3.13.0~b4-1) unstable; urgency=medium + + [ Stefano Rivera ] + * New upstream beta. + * Drop patches superseded upstream: riscv64-no-perf-trampoline, + skip-unallocated-arena-free. + + -- Stefano Rivera Fri, 19 Jul 2024 10:12:48 +0900 + +python3.13 (3.13.0~b3-6) unstable; urgency=medium + + * Don't consider fixing interpreters in .so files, fixing a FTBFS on s390x. + * Instead of exporting ELF_PACKAGE_METADATA, which isn't consumed directly, + export the environment variables required by the metadata spec file. + + -- Stefano Rivera Thu, 18 Jul 2024 11:00:47 +0900 + +python3.13 (3.13.0~b3-5) unstable; urgency=medium + + [ Matthias Klose ] + * Set ELF_PACKAGE_METADATA, if unset. + * Fix multiarch path for hurd-amd64. Addresses: #1076321. + + [ Benjamin Drung ] + * debian/rules: Use pkg-info.mk + * debian/rules: Use architecture.mk + * Rely on SOURCE_DATE_EPOCH for reproducibility + + [ Graham Inggs ] + * Skip test_exceptions and test_repl which never run to + completion on the Ubuntu autopkgtest infrastructure + + -- Matthias Klose Wed, 17 Jul 2024 12:23:29 +0200 + +python3.13 (3.13.0~b3-3) unstable; urgency=medium + + * Remove distutils references, it was removed in 3.12. + * Remove pysetup3(1), it was removed in 3.2. + * Patch: Avoid munmap() of the zero page when freeing unallocated arenas. + + -- Stefano Rivera Tue, 09 Jul 2024 01:33:11 +0200 + +python3.13 (3.13.0~b3-2) unstable; urgency=medium + + * Patch: Disable perf_trampoline or riscv64, for now. + + -- Stefano Rivera Wed, 03 Jul 2024 17:05:54 +0200 + +python3.13 (3.13.0~b3-1) unstable; urgency=medium + + * New upstream beta. + * Use https in watch file. + * Refresh patches. + * Migrate some more bits of packaging from 3.12 to 3.13. + * Drop old breaks+replace. + * Rename python3.12-updates.diff to compileall-minimal.diff. + * Document that _typing is included in -minimal. + * Update symbols file. + * Install python3-wheel-whl in the testsuite autopkgtests. Not installed in + venvs by default (so not a dependency of python3-venv) but required by + tests. + * Add a missing import to ntpath-import.diff. + * Patch: Handle missing _pyrepl in the -minimal interpreter. + + -- Stefano Rivera Wed, 03 Jul 2024 12:17:07 +0200 + +python3.13 (3.13.0~b2-1) unstable; urgency=medium + + [ Matthias Klose ] + * Configure without --with-dtrace on the Hurd. + + [ Stefano Rivera ] + * Python 3.13.0 beta 2 snapshot. + * Refresh patches. + * Bump watch file to 3.13. + + -- Stefano Rivera Tue, 11 Jun 2024 15:14:35 +0100 + +python3.13 (3.13.0~b1-2) unstable; urgency=medium + + * Configure --with-system-libmpdec=no. + + -- Matthias Klose Wed, 15 May 2024 12:13:44 +0200 + +python3.13 (3.13.0~b1-1) unstable; urgency=medium + + * Python 3.13.0 beta 1 snapshot. + * Update symbols files. + * Refresh patches. + + -- Matthias Klose Wed, 15 May 2024 08:57:29 +0200 + +python3.13 (3.13.0~a6-1) experimental; urgency=medium + + * Python 3.13.0 alpha 6 snapshot. + * Refresh patches. + + -- Matthias Klose Wed, 01 May 2024 07:51:20 +0200 + +python3.12 (3.12.3-1) unstable; urgency=medium + + * Python 3.12.3 release. + + -- Matthias Klose Wed, 10 Apr 2024 07:33:47 +0200 + +python3.12 (3.12.2-5) unstable; urgency=medium + + * Update to the 3.12 branch 2024-02-02. + - Make C API compatible with ISO C90 (GH-116950). Closes: #1064028. + - Upstream patch for GH-115874. + - Still identify as "3.12.2", because "3.12.2+" is mis-treated by some + third-party packages. + * Use CFLAGS_NODIST, LDFLAGS_NODIST for passing build flags. + * d/rules: Move configure/build targets for each build together. + * Drop ffi configure options, obsolete. + * Re-enable PGO/LTO builds. + + -- Matthias Klose Tue, 02 Apr 2024 16:53:02 +0200 + +python3.12 (3.12.2-4) unstable; urgency=medium + + [ Stefano Rivera ] + * Build-Depend on libnsl-dev for NIS support. Closes: #1065128. + + [ Matthias Klose ] + * Fix override files for renamed t64 packages. + * Fix package names in PVER-dbg maintainer scripts. Addresses: #1065164. + * Really build without LTO when requested. + * Disable LTO builds and testsuite for now (mesa t64 transition ...). + + -- Matthias Klose Sun, 03 Mar 2024 10:11:00 +0100 + +python3.12 (3.12.2-3) unstable; urgency=medium + + * Actually apply the teedataobject_clear patch. Closes: #1063345. + + -- Stefano Rivera Thu, 29 Feb 2024 11:43:19 -0400 + +python3.12 (3.12.2-2) unstable; urgency=medium + + [ Colin Watson ] + * Don't rely on module state in teedataobject_clear (from Brandt Bucher in + https://github.com/python/cpython/issues/115874). Closes: #1063345. + + [ Steve Langasek ] + * Rename libraries for 64-bit time_t transition, declare X-Time64-Compat + to get proper Provides (Steve Langasek). Closes: #1064336. + + -- Matthias Klose Thu, 29 Feb 2024 02:56:09 +0100 + +python3.12 (3.12.2-1) unstable; urgency=medium + + * Python 3.12.2 release. + * Don't build-depend on systemtap-sdt-dev on the Hurd. + * Refresh patches. + + -- Matthias Klose Wed, 07 Feb 2024 21:47:03 +0100 + +python3.12 (3.12.1-2) unstable; urgency=medium + + * Fix build with WITH_PYMALLOC_RADIX_TREE=0 (needed for ia64). + + -- Matthias Klose Fri, 08 Dec 2023 17:20:54 +0100 + +python3.12 (3.12.1-1) unstable; urgency=high + + * Python 3.12.1 release. + - Fix gh-105716, breaking greenlet/eventlet. + * Update symbols files. + * Add platform triplets for x86_64 GNU/Hurd (Samuel Thibault). + Addresses: #1055960. + + -- Matthias Klose Fri, 08 Dec 2023 10:36:47 +0100 + +python3.12 (3.12.0-7) unstable; urgency=medium + + * Update to the 3.12 branch 2023-12-02. + * Identify as version "3.12.0" instead of "3.12.0+", confusing some + third party packages. + * Remove references to the avr architecture. Closes: #1056761. + * Fix more shebangs. Closes: #1057192. + + -- Matthias Klose Sat, 02 Dec 2023 13:35:02 +0100 + +python3.12 (3.12.0-6) unstable; urgency=medium + + * Fix syntax error in the python3.12-dbg-config script. + + -- Matthias Klose Sun, 19 Nov 2023 12:32:56 +0100 + +python3.12 (3.12.0-5) unstable; urgency=medium + + * libpython3.12-testsuite: Don't attempt to byte-compile files name + badsyntax_*. Update path for tokenizedata's bad_coding samples. + * libpython3.12-testsuite: Ignore warnings during byte compilation. + Closes: #1040279. + * Replace (currently disabled) hurd_kfreebsd_thread_native_id.diff with + simply ignoring the relevant symbol on non-Linux. Closes: #1055820. + + -- Stefano Rivera Sun, 12 Nov 2023 15:37:07 +0200 + +python3.12 (3.12.0-4) unstable; urgency=medium + + * Add breaks/replaces for typinganndata move. Closes: #1055680. + + -- Matthias Klose Fri, 10 Nov 2023 12:33:26 +0100 + +python3.12 (3.12.0-3) unstable; urgency=medium + + * Update to the 3.12 branch 2023-11-09. + + [ Stefano Rivera ] + * Add myself as an uploader. + * Depend on netbase in libpython3.12-stdlib. Closes: #1055172. + + [ Matthias Klose ] + * Fix some lintian warnings. + * Add loong64 to the multiarch header file. Closes: #1053835. + + -- Matthias Klose Thu, 09 Nov 2023 11:45:17 +0100 + +python3.12 (3.12.0-1) unstable; urgency=medium + + * Python 3.12.0 release. + + -- Matthias Klose Wed, 04 Oct 2023 08:27:34 +0200 + +python3.12 (3.12.0~rc2-1) unstable; urgency=medium + + * Python 3.12.0 release candidate 2. + + -- Matthias Klose Thu, 14 Sep 2023 06:33:29 +0200 + +python3.12 (3.12.0~rc1-2) unstable; urgency=medium + + * Update to the 3.12 branch 2023-08-29. + - Add loongarch support. Addresses: #1049963. + - Address CVE-2023-41105, CVE-2023-40217. + * libpython3.12-stdlib: Depend on tzdata. Closes: #1050529. + * Add proposed patch to avoid tzdata-legacy, and drop again the + dependency on it. See https://github.com/python/cpython/pull/108533. + + -- Matthias Klose Tue, 29 Aug 2023 17:33:03 +0200 + +python3.12 (3.12.0~rc1-1) unstable; urgency=medium + + * Python 3.12.0 release candidate 1. + * Update symbols files. + + -- Matthias Klose Thu, 10 Aug 2023 06:02:50 +0200 + +python3.12 (3.12.0~b4-1) unstable; urgency=medium + + * Python 3.12.0 beta 3 snapshot. + * libpython3.12-stdlib: Depend on tzdata. Addresses: #1037168. + + -- Matthias Klose Thu, 13 Jul 2023 16:24:02 +0200 + +python3.12 (3.12.0~b3-1) unstable; urgency=medium + + * Python 3.12.0 beta 3 snapshot. + + -- Matthias Klose Fri, 23 Jun 2023 17:06:58 +0200 + +python3.12 (3.12.0~b2-3) unstable; urgency=medium + + [ Matthias Klose ] + * libpython3.12-testsuite: Don't install ctypes/test_macholib. + * Add test_cppext to the failing tests, requires pip. + + [ Stefano Rivera ] + * Drop python3.12-venv's dependency on python3-setuptools-whl. venv doesn't + include setuptools in venvs, any more in Python 3.12. + * Remove autopkgtest coverage of SETUPTOOLS_USE_DISTUTILS=local, there is no + stdlib distutils in Python 3.12. + * Adapt the venv/virtualenv autopkgtests to not expect setuptools & wheel to + be installed. + + -- Matthias Klose Tue, 20 Jun 2023 10:44:07 +0200 + +python3.12 (3.12.0~b2-2) unstable; urgency=medium + + * Fix bytecode compilation for python3.12-testsuite. Closes: #1036789. + * Tighten autopkg test dependencies on python3-tk and python3-gdbm. + + -- Matthias Klose Tue, 13 Jun 2023 06:48:48 +0200 + +python3.12 (3.12.0~b2-1) unstable; urgency=medium + + * Python 3.12.0 beta 2 snapshot. + + -- Matthias Klose Wed, 07 Jun 2023 12:16:56 +0200 + +python3.12 (3.12.0~b1-1) unstable; urgency=medium + + * Python 3.12.0 beta 1 snapshot. + * Update symbols files. + * Refresh patches. + + -- Matthias Klose Thu, 25 May 2023 06:54:11 +0200 + +python3.12 (3.12.0~a7-1) experimental; urgency=medium + + * Python 3.12.0 alpha 7 snapshot. + + [ Stefano Rivera ] + * Explain more ways to pass --break-system-packages to pip. + * In distutils-install-layout.diff: + - Restore _distutils_system_mod, this is how we configure setuptools' + internal distutils behaviour. Thanks Eli Schwartz for noticing it was + missing. + - Remove support for patching the stdlib distutils, no longer needed. + + [ Matthias Klose ] + * Package _sha2 instead of _sha256 and _sha512. + * Don't ship gdbinit anymore, removed upstream. + * Update symbols files. + * Update and refresh patches. + + -- Matthias Klose Tue, 11 Apr 2023 10:54:41 +0200 + +python3.12 (3.12.0~a5-1) experimental; urgency=medium + + * Python 3.12.0 alpha 5 snapshot. + + [ Matthias Klose ] + * Fix error message for 'python3 -m venv dir`, when python3-venv + is not installed. Closes: #1026268. + + [ Stefano Rivera ] + * Mention that deleting EXTERNALLY-MANAGED is an option, in README.venv. + * Update watch file for Python 3.12. + * Override expat embedded-library lintian false-positives. (See: #1031859) + * Update lintian overrides for reorganization in lintian 2.100.0. + * Override depends-on-python-minimal in python3.12-nopie. + * Override python3-script-but-no-python3-dep in python3.12. + + -- Matthias Klose Thu, 02 Mar 2023 19:00:33 +0100 + +python3.11 (3.11.2-4) unstable; urgency=medium + + [ Stefano Rivera ] + * Revert the CCSHARED patch to test_customize_compiler, this was WIP and + didn't work. + + [Matthias Klose] + * Remove build dependency on libb2-dev, oldish library. + * Build with internal mpdecimal library, so that mpdecimal can be removed + for bookworm. + + -- Matthias Klose Sun, 12 Feb 2023 01:48:52 +0100 + +python3.11 (3.11.2-3) unstable; urgency=medium + + [ Stefano Rivera ] + * Refresh patches. + * Revert pip importlib.metadata workaround, fixed in pip 22.2. + * Declare python3.11 to be PEP 668 EXTERNALLY-MANAGED. + * Update and install README.venv, explaining this. + * Recommend ca-certificates from python3.11. Closes: #960869. + * Configure --with-ssl-default-suites=openssl. Closes: #1026802. + * Update watch file. + * Include CCSHARED override in distutils test_customize_compiler. + + [Matthias Klose] + * Really new upstream version. + * Configure --with-ssl-default-suites=openssl. Closes: #1009189. + * Build-depend on libb2-dev. + * Fix removing Debian build flags from _sysconfigdata. LP: #2006738. + + -- Matthias Klose Fri, 10 Feb 2023 05:59:34 +0100 + +python3.11 (3.11.2-1) unstable; urgency=medium + + * New upstream version. + + -- Matthias Klose Mon, 06 Feb 2023 21:27:04 +0100 + +python3.11 (3.11.1-2) unstable; urgency=medium + + * Fix NameError exception in venv init (Daniel Andersson). Closes: #1026448. + * Fix FTCBFS: Pass --with-build-python (Helmut Grohne). Closes: #1024297. + + -- Matthias Klose Sat, 31 Dec 2022 11:23:59 +0100 + +python3.11 (3.11.1-1) unstable; urgency=medium + + * Python 3.11.1 release. + + -- Matthias Klose Wed, 07 Dec 2022 09:49:13 +0100 + +python3.11 (3.11.0-3) unstable; urgency=medium + + * Fix valgrind detection. + + -- Matthias Klose Fri, 04 Nov 2022 10:23:33 +0100 + +python3.11 (3.11.0-2) unstable; urgency=medium + + * Update to the 3.11 branch 2022-11-03. + - debian/patches/CVE-2022-42919.patch: don't use Linux abstract sockets + in Lib/multiprocessing/connection.py. + - CVE-2022-42919 + * Fix GDB auto-load files. Closes: #1017913. + * Add support for systemd-binfmt. Closes: #1013973. + * libpython3.11-dev: Install Python.asdl and python.gram. Closes: #1022951. + * Configure the python3-dbg interpreter --with-valgrind. Closes: #1006315. + * Bump standards version. + + -- Matthias Klose Thu, 03 Nov 2022 16:41:50 +0100 + +python3.11 (3.11.0-1) unstable; urgency=medium + + * Python 3.11.0 release. + * Update symbols files. + + -- Matthias Klose Mon, 24 Oct 2022 23:26:25 +0200 + +python3.11 (3.11.0~rc2-2) unstable; urgency=medium + + [ Stefano Rivera ] + * autopkgtests: Support python3-setuptools >= 64, which does PEP-660 + editable installs. + + -- Matthias Klose Sat, 01 Oct 2022 06:34:05 +0200 + +python3.11 (3.11.0~rc2-1) unstable; urgency=medium + + * Python 3.11.0 release candidate 2. + + -- Matthias Klose Mon, 12 Sep 2022 18:20:24 +0200 + +python3.11 (3.11.0~rc1-1) unstable; urgency=medium + + * Python 3.11.0 release candidate 1. + * Add python3.11-venv as a dependency for the testsuite* autopkg tests. + * Don't run the cppext test during the build. + * Fix two site and sysconfig tests. + + -- Matthias Klose Wed, 10 Aug 2022 13:16:05 +0200 + +python3.11 (3.11.0~b4-2) unstable; urgency=medium + + * Work around https://github.com/pypa/pip/issues/11183. + + -- Matthias Klose Wed, 20 Jul 2022 12:00:00 +0200 + +python3.11 (3.11.0~b4-1) unstable; urgency=medium + + * Python 3.11.0 beta 4 snapshot. + * Fix more references to 3.11 in the autopkg tests. + * Update local-doc-references patch for 3.11. + * Remove i386 specific symbols files. + * Update symbols files. + + -- Matthias Klose Wed, 13 Jul 2022 11:00:16 +0200 + +python3.11 (3.11.0~b3-2) unstable; urgency=medium + + * Update symbols files for i386. + + -- Matthias Klose Thu, 09 Jun 2022 16:59:45 +0200 + +python3.11 (3.11.0~b3-1) unstable; urgency=medium + + * Python 3.11.0 beta 3 snapshot. + * Refresh patches. + * Update symbols files. + * Adjust the minimal set (re now a package), make the ntpath import + conditional. + * Update autopkg tests for 3.11. + + -- Matthias Klose Wed, 08 Jun 2022 12:09:22 +0200 + +python3.10 (3.10.4-4) unstable; urgency=medium + + * Source-only upload. + * Backport gh-78214: marshal: Stabilize FLAG_REF usage. Closes: #1010368. + + -- Matthias Klose Fri, 13 May 2022 14:08:11 +0200 + +python3.10 (3.10.4-3) unstable; urgency=medium + + * Build a python3.10-nopie package, diverting the python3.10 + executable. + * Build the python3.10 interpreter with PIE enabled. Closes: ##919134. + LP: #1452115. + * Fix build on ia64 (Adrian Glaubitz). Closes: #1008576. + + -- Matthias Klose Sat, 02 Apr 2022 11:04:19 +0200 + +python3.10 (3.10.4-2) unstable; urgency=medium + + [ Stefano Rivera ] + * Avoid infinite recursion in _distutils_system_mod when + SETUPTOOLS_USE_DISTUTILS=local. + * Avoid crashing in `_distutils_system_mod` if we find an older version of + distutils (from before `_distutils_system_mod` was implemented). + + -- Matthias Klose Fri, 01 Apr 2022 17:03:31 +0200 + +python3.10 (3.10.4-1) unstable; urgency=medium + + * Python 3.10.4 release. + + -- Matthias Klose Thu, 24 Mar 2022 14:07:27 +0100 + +python3.10 (3.10.3-2) unstable; urgency=medium + + [ Stefano Rivera ] + * Change the "include" and "platinclude" paths in the "posix_local" + scheme to refer to the location of Python's headers, not the install + location for modules' C headers. Closes: #1007966 + + [ Matthias Klose ] + * Allow to build with PIE enabled by default, and build a separate + python3.10-nopie package. Not yet enabled for Debian. + + -- Matthias Klose Thu, 24 Mar 2022 12:42:32 +0100 + +python3.10 (3.10.3-1) unstable; urgency=medium + + * Python 3.10.3 release. + + -- Matthias Klose Wed, 16 Mar 2022 18:19:40 +0100 + +python3.10 (3.10.2-7) unstable; urgency=medium + + [ Stefano Rivera ] + * Use the same is_virtual_environment() proposed in PEP 668 across the site, + sysconfig, and distutils modules. Stop checking for PYTHONUSERBASE or + VIRTUAL_ENV environment variables. + * Correct assertion descriptions in module-install-* autopkgtests. + * Extend module-install-* autopkgtests to catch the issues fixed in -6: + - Check the directory that the modules are installed to. + - Check editable installs. + - Check pip-driven PEP-517 installs. + - Check that virtualenvs are seeded with the correct layout. + * Re-enable module-install-virtualenv. + + -- Matthias Klose Mon, 14 Mar 2022 06:18:40 +0100 + +python3.10 (3.10.2-6) unstable; urgency=medium + + [ Matthias Klose ] + * Update to the 3.10 branch 2022-03-13. + * Add the test_multiprocessing_fork test to the failing autopkg tests, + and run them with a 2h timeout. + * Don't run the test_multiprocessing tests in the profile run. + + [ Stefano Rivera ] + * Re-add accidentally dropped /local/ to paths in distutils unix_local + scheme. + * Add missing /local/ to data path in sysconfig posix_local scheme. + LP: #1964588. + * Improve support for setuptools > 60's bundled distutils in + _distutils_system_mod, supporting a wider range of versions and more + reliably selecting the posix_local scheme. Closes: #1004149. + * Use the same heuristics for scheme selection in sysconfig, as we use in + distutils.command.install. Closes: #1006707, LP: #1962791. + * Run the test suite with a 1hr timeout per module. Closes: #1000188. + + -- Matthias Klose Sun, 13 Mar 2022 07:20:35 +0100 + +python3.10 (3.10.2-5) unstable; urgency=medium + + * Fix the marshal test after applying the fix for #1004558. + + -- Matthias Klose Sat, 26 Feb 2022 09:21:15 +0100 + +python3.10 (3.10.2-4) unstable; urgency=medium + + * Provide a _distutils_system_mod module to customize distutils behaviour + for Debian's install layout (Stefano Rivera). + + -- Matthias Klose Fri, 25 Feb 2022 22:04:33 +0100 + +python3.10 (3.10.2-3) unstable; urgency=medium + + * Apply again the updated sysconfig-debian-schemes patch (Alexandre Ghiti). + + -- Matthias Klose Fri, 25 Feb 2022 21:13:53 +0100 + +python3.10 (3.10.2-2) unstable; urgency=medium + + * Make test suite support Expat >=2.4.5. Closes: #1006219. + * Build again using readline instead of libedit. Closes: #1005761. + * Serialize frozenset elements deterministically, taken from the trunk. + Closes: #1004558. + + -- Matthias Klose Tue, 22 Feb 2022 14:57:42 +0100 + +python3.10 (3.10.2-1) unstable; urgency=medium + + * Python 3.10.2 release. + + [ Stefano Rivera ] + * Migrate to individual wheel packages. Drop ensurepip-pkg-resources.diff, + pkg_resources is now shipped in the setuptools wheel. (Closes: #1003573) + * Mark module-install-user autopkgtest allow-stderr. (Closes: #1001722) + + -- Matthias Klose Sun, 16 Jan 2022 18:11:27 +0100 + +python3.10 (3.10.1-5) unstable; urgency=medium + + * Allow stderr in the module-install-venv autopkg test. + + -- Matthias Klose Wed, 12 Jan 2022 16:42:55 +0100 + +python3.10 (3.10.1-4) unstable; urgency=medium + + * Also apply the openssl-3 patch. + + -- Matthias Klose Wed, 12 Jan 2022 15:08:13 +0100 + +python3.10 (3.10.1-3) unstable; urgency=medium + + * d/p/openssl-3.0.1-version-check.diff: cherry-picked from upstream + to fix the test suite against OpenSSL 3.0.1 (Simon Chopin). + LP: #1956765. + + -- Matthias Klose Mon, 10 Jan 2022 12:07:18 +0100 + +python3.10 (3.10.1-2) unstable; urgency=medium + + * Run the module-install-local test with allow-stderr. Closes: #1001722. + + -- Matthias Klose Fri, 17 Dec 2021 00:04:04 +0100 + +python3.10 (3.10.1-1) unstable; urgency=medium + + * Python 3.10.1 release. + * Depend on media-types instead of mime-support. Closes: #1000366. + * Update symbols files. + + -- Matthias Klose Tue, 07 Dec 2021 14:27:28 +0100 + +python3.10 (3.10.0-5) unstable; urgency=medium + + * Build again the _dbm extension using libdb-dev. + + -- Matthias Klose Wed, 17 Nov 2021 07:49:13 +0100 + +python3.10 (3.10.0-4) unstable; urgency=medium + + * Revert the backport for issue #45235 (argparse does not preserve + namespace with subparser defaults). + + -- Matthias Klose Thu, 11 Nov 2021 16:08:14 +0100 + +python3.10 (3.10.0-3) unstable; urgency=medium + + * Update to the 3.10 branch 2021-10-17. + + -- Matthias Klose Sun, 17 Oct 2021 11:10:32 +0200 + +python3.10 (3.10.0-2) unstable; urgency=medium + + * ensurepip: Install pkg_resources as well as setuptools (Stefano Rivera). + * Strip trailing '\n' from file names in py_compile (Graham Inggs). + * Update ia64 build flags (Adrian Glaubitz). Closes: #995987, #996002. + + -- Matthias Klose Mon, 11 Oct 2021 07:33:59 +0200 + +python3.10 (3.10.0-1) unstable; urgency=medium + + * Python 3.10.0 release. + * Update symbols files. + * Annotate patches (Stefano Rivera). + * Use Python 3.10's native --with-wheel-pkg-dir= mechanism (Stefano Rivera). + + -- Matthias Klose Fri, 08 Oct 2021 14:10:19 +0200 + +python3.10 (3.10.0~rc2-2) unstable; urgency=medium + + * More flags substitutions for LDFLAGS in _sysconfigdata. + * Bump standards version. + + -- Matthias Klose Fri, 24 Sep 2021 11:47:58 +0200 + +python3.10 (3.10.0~rc2-1) unstable; urgency=medium + + * Python 3.10.0 release candidate 2. + * Update symbols files. + + -- Matthias Klose Thu, 09 Sep 2021 11:19:38 +0200 + +python3.10 (3.10.0~rc1-4) unstable; urgency=medium + + * Fix the test_site test. + + -- Matthias Klose Mon, 06 Sep 2021 10:17:55 +0200 + +python3.10 (3.10.0~rc1-3) unstable; urgency=medium + + * Tighten autopkg test dependencies. + + -- Matthias Klose Sun, 05 Sep 2021 11:32:32 +0200 + +python3.10 (3.10.0~rc1-2) unstable; urgency=medium + + * Fix path to mkdir on a unified-/usr system. Addresses: #992775. + * Use command -v instead of which in shell scripts. + * Also don't run the test_concurrent_futures test on armhf and sparc64. + Closes: #991111. + + -- Matthias Klose Fri, 03 Sep 2021 09:33:09 +0200 + +python3.10 (3.10.0~rc1-1) unstable; urgency=medium + + * Python 3.10.0 release candidate 1. + * Update symbols files. + * Fix CFLAGS in the python3.x-config scripts. Addresses: #992669. + * Support arc-linux-gnu in the multiarch header. Addresses: #992091. + * Don't run the test_concurrent_futures test on alpha. Addresses: #991110. + + -- Matthias Klose Thu, 02 Sep 2021 13:49:53 +0200 + +python3.10 (3.10.0~b4-1) experimental; urgency=medium + + * Python 3.10.0 beta 4 snapshot. + + -- Matthias Klose Mon, 12 Jul 2021 22:28:24 +0200 + +python3.10 (3.10.0~b3-1) experimental; urgency=medium + + * Python 3.10.0 beta 3 snapshot. + + -- Matthias Klose Fri, 18 Jun 2021 08:25:12 +0200 + +python3.10 (3.10.0~b2-1) experimental; urgency=medium + + * Python 3.10.0 beta 2 snapshot. + + -- Matthias Klose Fri, 04 Jun 2021 10:45:30 +0200 + +python3.10 (3.10.0~b1-3) experimental; urgency=medium + + * Try to detect whether python3-venv is missing (Stefano Rivera). + Closes: #977887. + + -- Matthias Klose Tue, 11 May 2021 08:19:33 +0200 + +python3.10 (3.10.0~b1-2) experimental; urgency=medium + + * Add the headers key to the added Debian INSTALL_SCHEMES. + * Use libeditreadline-dev instead of libedit-dev as a build dependency. + * Refresh patches. + * When building 3.10 for releases newer than Debian 11 (bullseye) or + Ubuntu 21.04 (hirsute), build the _dbm extension using gdbm, and + include it in the python3-gdbm package. + Raise an ImportError when trying to import the _dbm module, if the + python3-gdbm package is not installed. + * Call python with -S when checking the minimal set of modules. + + -- Matthias Klose Thu, 06 May 2021 11:07:08 +0200 + +python3.10 (3.10.0~b1-1) experimental; urgency=medium + + * Python 3.10.0 beta 1 snapshot. + * Drop the unused build dependency on libdb-dev. + * Prefer to build with libedit-dev instead of libreadline-dev. See #977732. + * Update symbols files. + + -- Matthias Klose Tue, 04 May 2021 06:21:11 +0200 + +python3.10 (3.10.0~a7-3) experimental; urgency=medium + + * Build a python3.10-full package. + + -- Matthias Klose Tue, 06 Apr 2021 17:05:58 +0200 + +python3.10 (3.10.0~a7-1) experimental; urgency=medium + + * Python 3.10.0 alpha 7 snapshot. + * Depend on media-types instead of mime-support. Addresses: #981016. + * Fix permissions and group for local directories. Addresses: #962422. + * Revert the fix for issue 42856 for now, need to update patches, to + not require particular wheel versions. + * Update symbols files. + * Move zlib1g-dev dependency to libpython3.9-dev. Addresses: #984580. + * Configure with --libdir=/usr/lib/$(DEB_HOST_MULTIARCH), recording the + correct LIBDIR in _sysconfigdata. Also adjust DESTSHARED to install + lib-dynload into the same location as before the configure change. + See issue #43229. + * Fix flags substitutions for _sysconfigdata. + * Autopkg tests: + - Run testsuite{,-dbg} autopkg tests with allow-stderr. Closes: #983305. + - Run again in testsuite instead of failing-tests: test_ftplib, + test_httplib test_imaplib test_nntplib test_poplib test_ssl. + - Run test_distutils and test_site tests again. + * Build idlelib/help.html from source, don't ship the pre-generated file. + + -- Matthias Klose Tue, 06 Apr 2021 14:56:07 +0200 + +python3.10 (3.10.0~a4-2) experimental; urgency=medium + + * Configure again --with-system-libmpdec. + + -- Matthias Klose Mon, 11 Jan 2021 11:15:34 +0100 + +python3.10 (3.10.0~a4-1) experimental; urgency=medium + + * Python 3.10.0 alpha 4 snapshot. + * Update symbols files. + + -- Matthias Klose Sun, 10 Jan 2021 14:40:53 +0100 + +python3.10 (3.10.0~a3-1) experimental; urgency=medium + + * Python 3.10.0 alpha 3 snapshot. + * Update symbols files. + + -- Matthias Klose Tue, 08 Dec 2020 14:18:31 +0100 + +python3.10 (3.10.0~a2-1) experimental; urgency=medium + + * Python 3.10.0 alpha 2 snapshot. + + -- Matthias Klose Sat, 07 Nov 2020 09:09:33 +0100 + +python3.9 (3.9.0-5~20.04) focal-proposed; urgency=medium + + * SRU: LP: #1899954. Backport Python 3.9.0 to 20.04 LTS. + + -- Matthias Klose Tue, 20 Oct 2020 10:43:38 +0200 + +python3.9 (3.9.0-5) unstable; urgency=medium + + * Update to the 3.9 branch 2020-10-19. + * python3.9-venv: Depend on python3-distutils. + + -- Matthias Klose Mon, 19 Oct 2020 11:51:18 +0200 + +python3.9 (3.9.0-4) unstable; urgency=medium + + * Fix module-install-venv autopkg test dependency. + + -- Matthias Klose Sun, 18 Oct 2020 11:42:38 +0200 + +python3.9 (3.9.0-3) unstable; urgency=high + + * Update to the 3.9 branch 2020-10-16. + * ensurepip: Don't try to import the _bundled module. + * Refresh patches. + * Add some autopkg tests for venv (Stefano Rivera). + + -- Matthias Klose Fri, 16 Oct 2020 19:57:59 +0200 + +python3.9 (3.9.0-2) unstable; urgency=medium + + * Update to the 3.9 branch 2020-10-15. + * Build with -O1 on sh4 (Adrian Glaubitz). Closes: #972202. + * Don't run test_ttk_guionly test, timing on many buildds. + + -- Matthias Klose Thu, 15 Oct 2020 13:54:52 +0200 + +python3.9 (3.9.0-1) unstable; urgency=medium + + * Python 3.9.0 release. + + -- Matthias Klose Mon, 05 Oct 2020 22:56:51 +0200 + +python3.9 (3.9.0~rc2-1) unstable; urgency=medium + + * Python 3.9.0 release candidate 2. + + -- Matthias Klose Thu, 17 Sep 2020 12:40:00 +0200 + +python3.9 (3.9.0~rc1-1) unstable; urgency=medium + + * Python 3.9.0 release candidate 1. + + -- Matthias Klose Wed, 12 Aug 2020 12:42:16 +0200 + +python3.9 (3.9.0~b5-2) unstable; urgency=medium + + * Move typing.py into libpython3.9-minimal. + + -- Matthias Klose Thu, 23 Jul 2020 11:11:14 +0200 + +python3.9 (3.9.0~b5-1) unstable; urgency=medium + + * Python 3.9.0 beta 5. + + -- Matthias Klose Wed, 22 Jul 2020 11:03:53 +0200 + +python3.9 (3.9.0~b4-2) unstable; urgency=medium + + * Fix symbols file on i386. + * Don't run test_concurrent_futures on riscv64, takes ages. + + -- Matthias Klose Thu, 16 Jul 2020 13:24:24 +0200 + +python3.9 (3.9.0~b4-1) unstable; urgency=medium + + * Python 3.9.0 beta 4. + + -- Matthias Klose Mon, 06 Jul 2020 15:22:12 +0200 + +python3.8 (3.8.4~rc1-1) unstable; urgency=medium + + * Python 3.8.4 release candidate 1. + + -- Matthias Klose Wed, 01 Jul 2020 17:31:45 +0200 + +python3.8 (3.8.3-1) unstable; urgency=medium + + * Python 3.8.3 release. + * Add XB-Cnf-Visible-Pkgname header on the python*-minimal package to + point command-not-found at the full one. LP: #1867157 + + -- Matthias Klose Thu, 14 May 2020 13:03:12 +0200 + +python3.8 (3.8.3~rc1-1) unstable; urgency=medium + + * Python 3.8.3 release candidate 1. + - Issue #38576, CVE-2019-18348: Disallow control characters in hostnames + in http.client. + - Issue #39503, CVE-2020-8492: Denial of service in + urllib.request.AbstractBasicAuthHandler. + + -- Matthias Klose Thu, 30 Apr 2020 09:33:30 +0200 + +python3.8 (3.8.2-1) unstable; urgency=medium + + * Python 3.8.2 release. + + -- Matthias Klose Tue, 25 Feb 2020 14:04:52 +0100 + +python3.8 (3.8.2~rc2-2) unstable; urgency=medium + + * Ignore some autopkg test failures: + - test_ssl: Fails with OPENSSL_TLS_SECURITY_LEVEL=2. + - test_io: Fails on Ubuntu's autopkg test infrastructure. + - Lower OpenSSL security level from 2 to 1 during testing as test_ssl + assumes that (Dimitri John Ledkov). + + -- Matthias Klose Fri, 21 Feb 2020 12:37:41 +0100 + +python3.8 (3.8.2~rc2-1) unstable; urgency=medium + + * Python 3.8.2 release candidate 2. + + -- Matthias Klose Tue, 18 Feb 2020 11:16:50 +0100 + +python3.8 (3.8.2~rc1-1) unstable; urgency=medium + + * Python 3.8.2 release candidate 1. + * Make autopkgtests cross-test-friendly (Steve Langasek). + * Bump standards version. + + -- Matthias Klose Tue, 11 Feb 2020 16:26:48 +0100 + +python3.8 (3.8.1-2) unstable; urgency=medium + + * Fix KFreeBSD builds (James Cowgill). + + -- Matthias Klose Mon, 06 Jan 2020 09:48:53 +0100 + +python3.8 (3.8.1-1) unstable; urgency=medium + + * Python 3.8.1 release. + + -- Matthias Klose Thu, 19 Dec 2019 10:21:09 +0100 + +python3.8 (3.8.1~rc1-1) unstable; urgency=medium + + * Python 3.8.1 release candidate 1. + + -- Matthias Klose Tue, 10 Dec 2019 10:38:12 +0100 + +python3.8 (3.8.0-5) unstable; urgency=medium + + * Update to 20191123 from the 3.8 branch. + * libpython3.8-dbg: Provide a python-$(VER)-dbg-embed.pc pkg-config file. + Closes: #944852. + + -- Matthias Klose Sat, 23 Nov 2019 05:55:55 +0100 + +python3.8 (3.8.0-4) unstable; urgency=medium + + * Move the test/ann_module{,2,3} modules into libpython-stdlib. + Closes: #944303. + * Annote python-examples dependency on python. + + -- Matthias Klose Thu, 07 Nov 2019 16:14:28 +0100 + +python3.8 (3.8.0-3) unstable; urgency=medium + + * python3.8-dev: Depend on zlib1g-dev, needed to link as an + embedded interpreter. + + -- Matthias Klose Sun, 27 Oct 2019 17:36:55 +0200 + +python3.8 (3.8.0-2) unstable; urgency=medium + + * Fix a symlink to the shared debug library. + * Install the python3.8d-embed pkg-config file. + * Don't ship the python3-embed pkg-config file. + + -- Matthias Klose Sun, 20 Oct 2019 18:00:25 +0200 + +python3.8 (3.8.0-1) unstable; urgency=medium + + * Python 3.8.0 release. + + -- Matthias Klose Tue, 15 Oct 2019 11:10:20 +0200 + +python3.8 (3.8.0~rc1-3) unstable; urgency=medium + + * Apply proposed patch for issue 38368. LP: #1847036. Addresses: #941650. + + -- Matthias Klose Wed, 09 Oct 2019 11:06:01 +0200 + +python3.8 (3.8.0~rc1-2) unstable; urgency=medium + + * Python 3.8.0 release candidate 1. + * Refresh patches. + * Update symbols files. + * Bump standards version. + + -- Matthias Klose Wed, 02 Oct 2019 05:45:03 +0200 + +python3.8 (3.8.0~b4-1) unstable; urgency=medium + + * Python 3.8.0 beta 4 release. + + -- Matthias Klose Sat, 31 Aug 2019 16:07:24 +0200 + +python3.8 (3.8.0~b3-1) unstable; urgency=medium + + * Python 3.8.0 beta 3 release. + * Fix FTCBFS: (Helmut Grohne). Closes: #932077. + + Build-Depends, when cross compiling we need python3.8. + + Export CC, because dtrace needs it. + + Honour DEB_BUILD_OPTIONS=nocheck more thoroughly. + + Fix up sysconfigdata-name.diff. + * Implement the native thread ids for the Hurd and KFreeBSD (Samuel + Thibault). Closes: #931624. + * Enable pgo/lto builds on arm64. Addresses: #934812. + * Update symbols files. + * Don't propagate lto flags to the _sysconfigdata module. Addresses: #934771. + * d/patches/issue35998.diff: Disable TLS1.3 in the client on all platforms + rather than just reducing the payload size (Michael Hudson-Doyle). + + -- Matthias Klose Wed, 21 Aug 2019 17:32:52 +0200 + +python3.8 (3.8.0~b2-5) unstable; urgency=high + + * Bump standards version. + * Revert the KFreeBSD and Hurd fix for PyThread_get_thread_native_id, + and use the implementation from Python3.7. Mark the symbol as linux only. + * Don't encode the MACHDEP into the _sysconfigdata file name. + + -- Matthias Klose Thu, 11 Jul 2019 11:55:03 +0200 + +python3.8 (3.8.0~b2-4) unstable; urgency=medium + + * Fix the LTO build. + + -- Matthias Klose Sun, 07 Jul 2019 14:23:41 +0200 + +python3.8 (3.8.0~b2-3) unstable; urgency=medium + + * Define PY_HAVE_THREAD_NATIVE_ID for KFreeBSD and Hurd builds. + * Fix issue #37504, building the texinfo docs (Dmitry Shachnev). + * Enable LTO/PGO builds on some architectures. + + -- Matthias Klose Sat, 06 Jul 2019 12:00:08 +0200 + +python3.8 (3.8.0~b2-1) experimental; urgency=medium + + * Python 3.8.0 beta 2 release. + * Refresh patches. + * Update the symbols files. + * Don't build the texinfo documentation, fails. See issue #37504. + + -- Matthias Klose Fri, 05 Jul 2019 11:20:35 +0200 + +python3.8 (3.8.0~b1-2) experimental; urgency=medium + + * Fix include links in python3.8-dbg. + + -- Matthias Klose Mon, 17 Jun 2019 11:41:06 +0200 + +python3.8 (3.8.0~b1-1) experimental; urgency=medium + + * Python 3.8.0 beta 1 release. + * Refresh patches. + * Add new importlib dependencies to python3-minimal. + * Update symbols files. + + -- Matthias Klose Wed, 05 Jun 2019 11:23:02 +0200 + +python3.8 (3.8.0~a4-3) experimental; urgency=medium + + * Update symbols files. + + -- Matthias Klose Wed, 15 May 2019 00:30:25 +0200 + +python3.8 (3.8.0~a4-2) experimental; urgency=medium + + * Update to 20190514 from the trunk. + * Fix interpreter name in the -dbg autopkg tests. + * Enable dtrace/USDT probe support (--with-dtrace) and build-dep on + systemtap-sdt-dev (Trent Lloyd). LP: #1818778. + + -- Matthias Klose Tue, 14 May 2019 15:45:29 +0200 + +python3.8 (3.8.0~a4-1) experimental; urgency=medium + + * Python 3.8.0 alpha 4 release. + * Upstream removed the "m" modifier, directory names now don't have the + "m" encoded anymore in file and directory names. + * Refresh patches. + * Update symbols files. + + -- Matthias Klose Tue, 07 May 2019 20:35:18 +0200 + +python3.8 (3.8.0~a3-2) experimental; urgency=medium + + * d/p/arm-alignment.diff: Don't allow unaligned memory accesses in the + _sha3 extension (Dave Jones). LP: #1821869. Issue #36515. + * Tweak the asyncio/ssl test again. + + -- Matthias Klose Wed, 03 Apr 2019 09:37:42 +0200 + +python3.8 (3.8.0~a3-1) experimental; urgency=medium + + * Python 3.8.0 alpha 3 release. + * Work around issue #35988, reducing the payload size for the asyncio/ssl + tests. + + -- Matthias Klose Tue, 26 Mar 2019 10:17:13 +0100 + +python3.8 (3.8.0~a2-1ubuntu1) disco; urgency=medium + + * Update to 20190314 from the trunk. + * Use a build profile for libbluetooth-dev (). + + -- Matthias Klose Thu, 14 Mar 2019 16:06:36 +0100 + +python3.8 (3.8.0~a2-1) experimental; urgency=medium + + * Python 3.8.0 alpha 2 release. + * Update symbols files and refresh patches. + + -- Matthias Klose Thu, 14 Mar 2019 10:20:00 +0100 + +python3.8 (3.8.0~a1-1) experimental; urgency=medium + + * Python 3.8.0 alpha 1 release. + * Update VCS attributes. + * Refresh patches. + * Update symbols files. + * Fix some lintian warnings. + * Add pathlib to the set of the minimal modules. + + -- Matthias Klose Wed, 06 Feb 2019 16:07:30 +0100 + +python3.7 (3.7.1-1) unstable; urgency=medium + + * Python 3.7.1 release. + + -- Matthias Klose Sun, 21 Oct 2018 10:03:53 +0200 + +python3.7 (3.7.1~rc2-1) unstable; urgency=medium + + * Python 3.7.1 release candidate 2. + + -- Matthias Klose Mon, 15 Oct 2018 11:24:12 +0200 + +python3.7 (3.7.1~rc1-1) unstable; urgency=medium + + * Python 3.7.1 release candidate 1. + + -- Matthias Klose Thu, 27 Sep 2018 11:41:42 +0200 + +python3.7 (3.7.0-7) unstable; urgency=medium + + * Update to 20180925 from the 3.7 branch. + * Don't run OpenSSL related tests during the build. Hanging on + some buildds. + + -- Matthias Klose Tue, 25 Sep 2018 16:01:24 +0200 + +python3.7 (3.7.0-6) unstable; urgency=medium + + * Update to 20180901 from the 3.7 branch. + - Fixes the build with OpenSSL 1.1.1. Closes: #907031. + * Don't run the test_ftplib and test_ssl autopkg tests, not yet ready + for OpenSSL 1.1.1. + + -- Matthias Klose Sat, 01 Sep 2018 01:21:37 +0200 + +python3.7 (3.7.0-5) unstable; urgency=medium + + * Update to 20180820 from the 3.7 branch. + * Avoid usage of distutils in the platform module. See issue #26544. + * Fix some issues on architectures from the computer museum (Jason Duerstock). + Closes: #905536. + - Disable -O3 on ia64 (see PR rtl-optimization/85412). + - Remove the -O2 override on m68k (see Debian #326903). + - Remove the -mieee and -O2 overrides for DEC Alpha (see Debian #212912). + * Add more breaks for packages not compatible with Python 3.7: + - python3-aiomeasures. See #906159. + - python3-motor (updated). See #903527. + * Again close the RC issue about the syntax errors triggered by Python 3.7. + Closes: #902788. + * Update symbols files. + + -- Matthias Klose Mon, 20 Aug 2018 19:52:20 +0200 + +python3.7 (3.7.0-4) unstable; urgency=medium + + * Update to 20180802 from the 3.7 branch. + * Add more breaks for packages not compatible with Python 3.7: + - python3-pyatspi. See #902989. + * Move test/__main__.py into libpython3.7-stdlib. + + -- Matthias Klose Thu, 02 Aug 2018 08:46:56 +0200 + +python3.7 (3.7.0-3) unstable; urgency=medium + + * Update to 20180730 from the 3.7 branch. + * Add more breaks for packages not compatible with Python 3.7: + - python3-trollius. See #903888. + - python3-sleekxmpp. See #904453. + - voltron. See #904657. + - visidata. See #904656. + - salt-common. See #903654. + - python3-yowsup. See #904653. + - python3-websockets. See #904650. + - python3-txfixtures. See #904649. + - python3-tweepy. See #904648. + - python3-slixmpp. See #904644. + - python3-signaller. See #904642. + - python3-rpyc. See #904615. + - python3-protorpc-standalone. See #904603. + - python3-nova. See #904587. + - python3-murano. See #904581. + - python3-mastodon. See #904579. + - python3-hug. See #904576. + - python3-async. See #904492. + - python3-pylama. See #904491. + - python3-exabgp. See #904390. + - python3-glance. See #904389. + - python3-gbulb. See #904388. + - python3-engineio. See #904383. + - python3-doublex. See #904382. + - python3-dns. See #904381. + - python3-opcua. See #904373. + - openscap-daemon. See #904. + - oca-core. See #904370. + - patroni. See #904369. + - python3-panoramisk. See #904368. + - linux-show-player-. See #904367. + - python3-cs. See #904365. + - python3-azure. See #904364. + - python3-applicationinsights. See #904363. + - python3-aiopg. See #904361. + - python3-aiozmq. See #904358. + - python3-pysnmp4. See #904357. + - python3-astroquery. See #904351. + - snakemake. See #904350. + - fail2ban. See #902817. + - python3-morse-simulator. See #904343. + - python3-tango. See #904298. + - python3-pycuda. See #903826. + - python3-pycsw. See #903784. + - gnome3-builder. See #903558. + * Close the RC issue about the syntax errors triggered by Python 3.7, now + that all the breaks are in place. Closes: #902788. + * Mark the lib2to3 and site tests as succeeding again, mark the tcl test + as failing (issue #34178). + + -- Matthias Klose Mon, 30 Jul 2018 06:39:20 +0200 + +python3.7 (3.7.0-2) unstable; urgency=medium + + * Update to 20180720 from the 3.7 branch. + * Add breaks for packages not compatible with Python 3.7: + - python3-twisted. See #902766. + - python3-pexpect. See #902646. + - python3-cxx-dev. See #902673. + - libboost-python1.62.0. See #902702. + - python3-psycopg2. See #902715. + - python3-maxminddb. See #902756. + - python3-blist. See #902757. + - python3-django. See #902761. + - diffoscope. See #902650. + - gpodder. See #902704. + - python3-http-parser. See: #902759. + - python3-celery. See #902900. + - python3-astroid. See #902631. + - python3-ubjson. See #902762. + - python3-protobuf. See #902597. + - python3-opengl. See #903218. + - python3-ws4py. See #903529. + - python3-dropbox. See #903525. + - python3-pycuda. See #903826. + - python3-libcloud. See #903388. + - python3-motor. See #903527. + - python3-jira. See #903526. + + -- Matthias Klose Fri, 20 Jul 2018 15:51:14 +0200 + +python3.7 (3.7.0-1~18.04) bionic-proposed; urgency=medium + + * SRU: LP: #1792140. Update Python 3.7 to the final 3.7.0 release. + + -- Matthias Klose Wed, 12 Sep 2018 20:30:08 +0200 + +python3.7 (3.7.0-1) unstable; urgency=medium + + * Python 3.7.0 release. + + -- Matthias Klose Wed, 27 Jun 2018 16:40:03 +0200 + +python3.7 (3.7.0~rc1-3) unstable; urgency=medium + + * Update to 20180622 from the 3.7 branch. + - Fix installation of the idlelib tests. + + -- Matthias Klose Fri, 22 Jun 2018 10:11:22 +0200 + +python3.7 (3.7.0~rc1-2) unstable; urgency=medium + + * Update to 20180619 from the 3.7 branch. + * Let ensurepip work with pip versions 9 or 10. Addresses: #901797. + * pdb(1): Fix pointer to HTML documentation. Addresses: #901603. + + -- Matthias Klose Tue, 19 Jun 2018 09:10:27 +0200 + +python3.7 (3.7.0~rc1-1) unstable; urgency=medium + + * Python 3.7.0 release candidate 1. + + -- Matthias Klose Wed, 13 Jun 2018 10:04:13 +0200 + +python3.7 (3.7.0~b5-1) unstable; urgency=medium + + * Python 3.7.0 beta 5 release. + + -- Matthias Klose Thu, 31 May 2018 12:14:46 +0200 + +python3.7 (3.7.0~b4-5) unstable; urgency=medium + + * Update to 20180529 from the 3.7 branch. + * sysconfig: The 'posix_local' schema name is the default unless the env var + DEB_PYTHON_INSTALL_LAYOUT is set to 'deb' or 'deb_system'. Use the latter + for package buillds. + + -- Matthias Klose Tue, 29 May 2018 13:54:38 +0200 + +python3.7 (3.7.0~b4-4) unstable; urgency=medium + + * Update to 20180516 from the 3.7 branch. + * Fix building cmath and build cmath as a builtin instead of an extension. + * Run the test_code_module, test_dbm, test_zipfile tests in the autopkg + tests again. + + -- Matthias Klose Wed, 16 May 2018 16:51:00 -0400 + +python3.7 (3.7.0~b4-3) unstable; urgency=medium + + * python3.7: Add breaks on python3-all (<< 3.6.5~rc1-1), + python3-dev (<< 3.6.5~rc1-1), python3-venv (<< 3.6.5-2). Addresses: #898401. + * Restore the sysconfig-debian-schemes patch. + + -- Matthias Klose Fri, 11 May 2018 11:18:40 -0400 + +python3.7 (3.7.0~b4-2) unstable; urgency=medium + + * Fix the lto build for extensions, passing -fPIC to the linker. + + -- Matthias Klose Mon, 07 May 2018 19:24:57 +0200 + +python3.7 (3.7.0~b4-1) unstable; urgency=medium + + * Python 3.7.0 beta 4 release. + * Fix library name in python debug pkgconfig file. Addresses: #894498. + * Re-enable pgo/lto builds. + * Update autopkg tests to really run with 3.7. + * Make the build of the shared modules verbose again. + + -- Matthias Klose Thu, 03 May 2018 13:45:04 +0200 + +python3.7 (3.7.0~b3-1) unstable; urgency=medium + + * Python 3.7.0 beta 3 release. + * libpython3.7-stdlib: Add missing python3-distutils breaks. Closes: #894204. + + -- Matthias Klose Fri, 30 Mar 2018 12:35:22 +0800 + +python3.7 (3.7.0~b2-2) unstable; urgency=medium + + * libpython3.7-stdlib: Ship again distutils/{__init__,version}.py. + + -- Matthias Klose Fri, 23 Mar 2018 11:21:34 +0800 + +python3.7 (3.7.0~b2-1) unstable; urgency=medium + + * Python 3.7.0 beta 2 release. + - Fix issue #32185: The SSL module no longer sends IP addresses in SNI TLS + extension on platforms with OpenSSL 1.0.2+ or inet_pton. See #892814. + * Add support for riscv64 (Aurelien Jarno). Addresses: #892328. + * Update symbols files. + + -- Matthias Klose Tue, 13 Mar 2018 20:55:14 +0100 + +python3.7 (3.7.0~b1-1) unstable; urgency=medium + + * Python 3.7.0 beta 1 release. + * Update symbols files. + + -- Matthias Klose Thu, 01 Feb 2018 08:36:28 +0100 + +python3.7 (3.7.0~a4-1) unstable; urgency=medium + + * Python 3.7.0 alpha 4 release. + + -- Matthias Klose Wed, 10 Jan 2018 13:34:16 +0100 + +python3.7 (3.7.0~a3-4) unstable; urgency=medium + + * Stop building python3.7-2to3, now replaced by 2to3 and python3-lib2to3. + + -- Matthias Klose Fri, 05 Jan 2018 03:45:13 +0100 + +python3.7 (3.7.0~a3-3) unstable; urgency=medium + + * Stop shipping lib2to3, now shipped in python3-lib2to3. + + -- Matthias Klose Wed, 27 Dec 2017 14:04:53 +0100 + +python3.7 (3.7.0~a3-2) unstable; urgency=medium + + * Split out a python3.7-2to3 package. + * Stop shipping the tkinter and distutils modules in libpython3.7-stdlib. + + -- Matthias Klose Wed, 13 Dec 2017 12:18:54 +0100 + +python3.7 (3.7.0~a3-1) unstable; urgency=medium + + * Python 3.7.0 alpha 3 release. + * Add support for mipsr6 triplets (YunQiang Su). Addresses: #881942. + * Move the idle library into the idle-python3.7 package. + * Build documentation in info format (Benjamin Moody). Addresses: #881959. + + -- Matthias Klose Wed, 06 Dec 2017 13:24:25 +0100 + +python3.7 (3.7.0~a2-1) experimental; urgency=medium + + * Python 3.7.0 alpha 2 release. + + -- Matthias Klose Wed, 18 Oct 2017 20:58:26 +0200 + +python3.7 (3.7.0~a1-2) experimental; urgency=medium + + * Build with -fstack-protector instead of -fstack-protector-strong. + Performance improvements of around 1-2% according to LP #1638695. + + -- Matthias Klose Wed, 20 Sep 2017 14:12:51 +0200 + +python3.7 (3.7.0~a1-1) experimental; urgency=medium + + * Python 3.7.0 alpha 1 release. + * Explicitly use the system python for byte compilation in postinst scripts. + Addresses: #852163. LP: #1682934. + * Build using -fexceptions on ppc64 and ppc64el. + Addresses: #862925. LP: #1691848. + + -- Matthias Klose Wed, 20 Sep 2017 14:12:51 +0200 + +python3.7 (3.7-20170522-1) experimental; urgency=medium + + * Python 3.7 snapshot 20170522. + + -- Matthias Klose Mon, 22 May 2017 14:32:31 -0700 + +python3.6 (3.6.0~b4-1) experimental; urgency=medium + + * Python 3.6.0 beta 4. + * Update symbols files. + + -- Matthias Klose Tue, 22 Nov 2016 14:41:03 +0100 + +python3.6 (3.6.0~b3-1) experimental; urgency=medium + + * Python 3.6.0 beta 3. + * Update symbols files. + + -- Matthias Klose Wed, 02 Nov 2016 14:33:32 +0200 + +python3.6 (3.6.0~b2-1) experimental; urgency=medium + + * Python 3.6.0 beta 2. + + -- Matthias Klose Tue, 11 Oct 2016 07:27:10 +0200 + +python3.6 (3.6.0~b1-1) experimental; urgency=medium + + * Python 3.6.0 beta 1. + * Don't build the fpectl module on hppa. Addresses: #837314. + + -- Matthias Klose Tue, 13 Sep 2016 13:59:11 +0200 + +python3.6 (3.6.0~a4-1) experimental; urgency=medium + + * Python 3.6.0 alpha 4. + + -- Matthias Klose Tue, 16 Aug 2016 08:29:13 +0200 + +python3.6 (3.6.0~a3-1) experimental; urgency=medium + + * Python 3.6.0 alpha 3. + + -- Matthias Klose Mon, 25 Jul 2016 11:12:59 +0200 + +python3.6 (3.6.0~a2-1) experimental; urgency=medium + + * Python 3.6.0 alpha 2. + * Update to 20160614 from the trunk. + * Update symbols files. + + -- Matthias Klose Tue, 14 Jun 2016 13:36:38 +0200 + +python3.6 (3.6.0~a1-1) experimental; urgency=medium + + * Python 3.6.0 alpha 1. + + -- Matthias Klose Wed, 18 May 2016 10:11:08 +0200 + +python3.5 (3.5.1-12) unstable; urgency=medium + + * Update to 20160509 from the 3.5 branch. + - Issue #26811: gc.get_objects() no longer contains a broken tuple with + NULL pointer. + - Issue #20120: Use RawConfigParser for .pypirc parsing, removing support + for interpolation unintentionally added with move to Python 3. Behavior + no longer does any interpolation in .pypirc files, matching behavior in + Python 2.7 and Setuptools 19.0. + - Issue #25745: Fixed leaking a userptr in curses panel destructor. + - Issue #26881: The modulefinder module now supports extended opcode + arguments. + - Issue #23815: Fixed crashes related to directly created instances of + types in _tkinter and curses.panel modules. + - Issue #17765: weakref.ref() no longer silently ignores keyword arguments. + - Issue #26873: xmlrpc now raises ResponseError on unsupported type tags + instead of silently return incorrect result. + - Issue #26881: modulefinder now works with bytecode with extended args. + - Issue #26711: Fixed the comparison of plistlib.Data with other types. + - Issue #24114: Fix an uninitialized variable in `ctypes.util`. + - Issue #26864: In urllib.request, change the proxy bypass host checking + against no_proxy to be case-insensitive, and to not match unrelated host + names that happen to have a bypassed hostname as a suffix. + - Issue #26634: recursive_repr() now sets __qualname__ of wrapper. + - Issue #26804: urllib.request will prefer lower_case proxy environment + variables over UPPER_CASE or Mixed_Case ones. + - Issue #26837: assertSequenceEqual() now correctly outputs non-stringified + differing items (like bytes in the -b mode). + This affects assertListEqual() and assertTupleEqual(). + - Issue #26041: Remove "will be removed in Python 3.7" from deprecation + messages of platform.dist() and platform.linux_distribution(). + - Issue #26822: itemgetter, attrgetter and methodcaller objects no longer + silently ignore keyword arguments. + - Issue #26733: Disassembling a class now disassembles class and static + methods. + - Issue #26801: Fix error handling in :func:`shutil.get_terminal_size`, + catch :exc:`AttributeError` instead of :exc:`NameError`. + - Issue #24838: tarfile's ustar and gnu formats now correctly calculate name + and link field limits for multibyte character encodings like utf-8. + - Issue #26657: Fix directory traversal vulnerability with http.server on + Windows. + - Issue #26736: Used HTTPS for external links in the documentation if + possible. + - Issue #22359: Disable the rules for running _freeze_importlib and pgen + when cross-compiling. The output of these programs is normally saved + with the source code anyway, and is still regenerated when doing a + native build. Closes: #820509. + - Issue #21668: Link audioop, _datetime, _ctypes_test modules to libm. + - Issue #26799: Fix python-gdb.py: don't get C types once when the Python + code is loaded, but get C types on demand. The C types can change if + python-gdb.py is loaded before the Python executable. + * Fix issue #26673, runtime error in idle3. LP: #1574892. + * Update symbols files. + + -- Matthias Klose Mon, 09 May 2016 13:00:17 +0200 + +python3.5 (3.5.1-11) unstable; urgency=medium + + * Update to 20160330 from the 3.5 branch. + - Issue #26659: Make the builtin slice type support cycle collection. + - Issue #26718: super.__init__ no longer leaks memory if called multiple + times. NOTE: A direct call of super.__init__ is not endorsed! + - Issue #25339: PYTHONIOENCODING now has priority over locale in setting + the error handler for stdin and stdout. + - Issue #26717: Stop encoding Latin-1-ized WSGI paths with UTF-8. + - Issue #26735: Fix :func:`os.urandom` on Solaris 11.3 and newer when + reading more than 1,024 bytes: call ``getrandom()`` multiple times with + a limit of 1024 bytes per call. + - Issue #16329: Add .webm to mimetypes.types_map. + - Issue #13952: Add .csv to mimetypes.types_map. + - Issue #26709: Fixed Y2038 problem in loading binary PLists. + - Issue #23735: Handle terminal resizing with Readline 6.3+ by installing + our own SIGWINCH handler. + - Issue #26586: In http.server, respond with "413 Request header fields too + large" if there are too many header fields to parse, rather than killing + the connection and raising an unhandled exception. + - Issue #22854: Change BufferedReader.writable() and + BufferedWriter.readable() to always return False. + - Issue #6953: Rework the Readline module documentation to group related + functions together, and add more details such as what underlying Readline + functions and variables are accessed. + + -- Matthias Klose Sun, 17 Apr 2016 18:14:06 +0200 + +python3.5 (3.5.1-10) unstable; urgency=medium + + * Update to 20160330 from the 3.5 branch. + + -- Matthias Klose Thu, 31 Mar 2016 00:46:26 +0200 + +python3.5 (3.5.1-9) unstable; urgency=medium + + * Update to 20160323 from the 3.5 branch. + * Always build _math.o with -fPIC. + + -- Matthias Klose Wed, 23 Mar 2016 11:47:21 +0100 + +python3.5 (3.5.1-8) unstable; urgency=medium + + * Update to 20160318 from the 3.5 branch. + * Fix python3-venv with updated python-pip packages (Barry Warsaw). + Closes: #815014, #815864. + * Fix generating devhelp documentation (Simon McVittie). + Closes: #816299. LP: #1553633. + + -- Matthias Klose Fri, 18 Mar 2016 16:12:19 +0100 + +python3.5 (3.5.1-7) unstable; urgency=medium + + * Update to 20160224 from the 3.5 branch. + * python3.5-venv: Drop the dependency on python-setuptools-whl, + depend on python-pip-whl (>= 8.0.2-7). + * Don't run the test_socket test, hangs on some buildds. + + -- Matthias Klose Wed, 24 Feb 2016 12:28:57 +0100 + +python3.5 (3.5.1-6) unstable; urgency=medium + + * Update to 20160221 from the 3.5 branch. + + -- Matthias Klose Mon, 22 Feb 2016 00:11:32 +0100 + +python3.5 (3.5.1-5) unstable; urgency=medium + + * Update to 20160113 from the 3.5 branch. + + -- Matthias Klose Wed, 13 Jan 2016 16:09:18 +0100 + +python3.5 (3.5.1-4) unstable; urgency=medium + + * Update to 20160111 from the 3.5 branch. + + -- Matthias Klose Mon, 11 Jan 2016 21:50:55 +0100 + +python3.5 (3.5.1-3) unstable; urgency=medium + + * Update to 20160105 from the 3.5 branch. + * Fix maintainer scripts with findutils 4.6. Closes: #809079. + + -- Matthias Klose Tue, 05 Jan 2016 12:13:30 +0100 + +python3.5 (3.5.1-2) unstable; urgency=medium + + * Disable LTO on Debian/s390x. + * Don't run test_signal on alpha, currently breaks the testsuite. + + -- Matthias Klose Thu, 10 Dec 2015 15:34:41 +0100 + +python3.5 (3.5.1-1) unstable; urgency=medium + + * Python 3.5.1 release. + * Fix building architecture independent packages only. Closes: #806870. + * Update symbols files for i386. + * d/p/fix-sslv3-test.diff: properly handle Ubuntu's openssl having OP_NO_SSLv3 + forced on by default (Marc Deslauriers). + + -- Matthias Klose Mon, 07 Dec 2015 11:34:52 +0100 + +python3.5 (3.5.1~rc1-2) unstable; urgency=medium + + * Build-depend on time. + + -- Matthias Klose Tue, 24 Nov 2015 08:26:06 +0100 + +python3.5 (3.5.1~rc1-1) unstable; urgency=medium + + * Python 3.5.1 release candidate 1. + * Don't ship menu files anymore, just desktop files. + * Update symbols file. + + -- Matthias Klose Mon, 23 Nov 2015 22:10:38 +0100 + +python3.5 (3.5.0-4) unstable; urgency=medium + + * Update to 20151028 from the 3.5 branch. + - Issue #25274: sys.setrecursionlimit() now raises a RecursionError if the + new recursion limit is too low depending at the current recursion depth. + Modify also the "lower-water mark" formula to make it monotonic. This mark + is used to decide when the overflowed flag of the thread state is reset. + - Issue #25447: The lru_cache() wrapper objects now can be copied and + pickled (by returning the original object unchanged). + - Issue #25390: typing: Don't crash on Union[str, Pattern]. + - Issue #25441: asyncio: Raise error from drain() when socket is closed. + - Issue #25410: Cleaned up and fixed minor bugs in C implementation of + OrderedDict. + - Issue #25411: Improved Unicode support in SMTPHandler through better use + of the email package. + - Issue #25407: Remove mentions of the formatter module being removed in + Python 3.6. + - Issue #25406: Fixed a bug in C implementation of OrderedDict.move_to_end() + that caused segmentation fault or hang in iterating after moving several + items to the start of ordered dict. + - Issue #25380: Fixed protocol for the STACK_GLOBAL opcode in + pickletools.opcodes. + - Issue #25471: Sockets returned from accept() shouldn't appear to be + nonblocking. + - Issue #25440: Fix output of python-config --extension-suffix. + + -- Matthias Klose Wed, 28 Oct 2015 16:31:37 +0100 + +python3.5 (3.5.0-3) unstable; urgency=medium + + * Update to 20151011 from the 3.5 branch. + - Idle updates. + - Issue #24402: Fix input() to prompt to the redirected stdout when + sys.stdout.fileno() fails. + - Issue #24806: Prevent builtin types that are not allowed to be subclassed + from being subclassed through multiple inheritance. + - Issue #24848: Fixed a number of bugs in UTF-7 decoding of misformed data. + - Issue #25280: Import trace messages emitted in verbose (-v) mode are no + longer formatted twice. + - Issue #25003: On Solaris 11.3 or newer, os.urandom() now uses the + getrandom() function instead of the getentropy() function. The getentropy() + function is blocking to generate very good quality entropy, os.urandom() + doesn't need such high-quality entropy. + - Issue #25182: The stdprinter (used as sys.stderr before the io module is + imported at startup) now uses the backslashreplace error handler. + - Issue #25131: Make the line number and column offset of set/dict literals + and comprehensions correspond to the opening brace. + - Issue #25364: zipfile now works in threads disabled builds. + - Issue #25328: smtpd's SMTPChannel now correctly raises a ValueError if + both decode_data and enable_SMTPUTF8 are set to true. + - Issue #25316: distutils raises OSError instead of DistutilsPlatformError + when MSVC is not installed. + - Issue #23972: Updates asyncio datagram create method allowing reuseport + and reuseaddr socket options to be set prior to binding the socket. + Mirroring the existing asyncio create_server method the reuseaddr option + for datagram sockets defaults to True if the O/S is 'posix' (except if + the platform is Cygwin). + - Issue #25304: Add asyncio.run_coroutine_threadsafe(). This lets you + submit a coroutine to a loop from another thread, returning a + concurrent.futures.Future. + - Issue #25232: Fix CGIRequestHandler to split the query from the URL at the + first question mark (?) rather than the last. + - Issue #24657: Prevent CGIRequestHandler from collapsing slashes in the + query part of the URL as if it were a path. + - Issue #24483: C implementation of functools.lru_cache() now calculates + key's hash only once. + - Issue #22958: Constructor and update method of weakref.WeakValueDictionary + now accept the self and the dict keyword arguments. + - Issue #22609: Constructor of collections.UserDict now accepts the self + keyword argument. + - Issue #25111: Fixed comparison of traceback.FrameSummary. + - Issue #25262. Added support for BINBYTES8 opcode in Python implementation + of unpickler. + - Issue #25034: Fix string.Formatter problem with auto-numbering and + nested format_specs. + - Issue #25233: Rewrite the guts of asyncio.Queue and + asyncio.Semaphore to be more understandable and correct. + - Issue #25203: Failed readline.set_completer_delims() no longer left the + module in inconsistent state. + - Issue #23600: Default implementation of tzinfo.fromutc() was returning + wrong results in some cases. + - Issue #23329: Allow the ssl module to be built with older versions of + LibreSSL. + - Issue #25319: When threading.Event is reinitialized, the underlying + condition should use a regular lock rather than a recursive lock. + - Issue #25099: Make test_compileall not fail when a entry on sys.path + cannot be written to. + - Issue #23919: Prevents assert dialogs appearing in the test suite. + * Back-out the local patch for issue 21264, supposed to be fixed by #25099. + * Adjust setting DH_COMPAT for dh_movefiles with updated debhelper supporting + globbing of arguments. Closes: #800247. + * pydoc: use the pager command if available. Addresses: #799555. + + -- Matthias Klose Sun, 11 Oct 2015 11:05:38 +0200 + +python3.5 (3.5.0-2) unstable; urgency=medium + + * Update to 20150924 from the 3.5 branch. + * Expect the test_code_module test to fail in the autopkg tests. + See upstream issue #25109. + * Provide some user-friendly advice when `python3 -m venv` fails because the + python3-venv package is not installed (Barry Warsaw). + + -- Matthias Klose Thu, 24 Sep 2015 01:01:34 +0200 + +python3.5 (3.5.0-1) unstable; urgency=medium + + * Python 3.5.0 release. + * Drop the no-zip-on-sys.path patch; not worth saving, and the test suite + needs adjustments ... + * Mark the test_site test as failing. Investigate why this fails. + The package has one sitedir less than expected. + + -- Matthias Klose Sun, 13 Sep 2015 16:38:26 +0200 + +python3.5 (3.5.0~rc3-1) unstable; urgency=medium + + * Python 3.5.0 release candidate 3. + + -- Matthias Klose Tue, 08 Sep 2015 09:56:15 +0200 + +python3.5 (3.5.0~rc2-1) unstable; urgency=medium + + * Python 3.5.0 release candidate 2. + + -- Matthias Klose Tue, 25 Aug 2015 22:29:07 +0200 + +python3.5 (3.5.0~rc1-1) unstable; urgency=medium + + * Python 3.5.0 release candidate 1. + * Update symbols file. + + -- Matthias Klose Wed, 12 Aug 2015 16:57:46 +0200 + +python3.5 (3.5.0~b4-1) unstable; urgency=medium + + * Python 3.5.0 beta 4. + + -- Matthias Klose Mon, 27 Jul 2015 12:27:48 +0200 + +python3.5 (3.5.0~b3-2) unstable; urgency=medium + + * Fix expansion of makefile macros for _sysconfigdata. Issue #24705. + LP: #1477759. + + -- Matthias Klose Fri, 24 Jul 2015 15:25:23 +0200 + +python3.5 (3.5.0~b3-1) unstable; urgency=medium + + * Python 3.5.0 beta 3. + + -- Matthias Klose Mon, 06 Jul 2015 13:55:07 +0200 + +python3.5 (3.5.0~b2-1) unstable; urgency=medium + + * Python 3.5.0 beta 2. + * Make the build reproducible (Jérémy Bobbio). Closes: #786959. + - Pass time of latest debian/changelog entry to sphinx via SPHINXOPTS. + - Do not store a timestamps when compressing devhelp. + * Pass DATE and TIME macros matching the current debian/changelog entry + when building getbuildinfo.o. + + -- Matthias Klose Mon, 01 Jun 2015 12:18:33 +0200 + +python3.5 (3.5.0~b1-1ubuntu1) wily; urgency=medium + + * Disable pgo optimization on i386. + + -- Matthias Klose Tue, 26 May 2015 23:30:38 +0200 + +python3.5 (3.5.0~b1-1) unstable; urgency=medium + + * Python 3.5.0 beta 1. + * Refresh patches. + * Update symbols files. + + -- Matthias Klose Tue, 26 May 2015 02:08:13 +0200 + +python3.5 (3.5.0~a4-5) unstable; urgency=medium + + * Update to 20150519 from the trunk. + - Fix issue #24226, parsing of many sequential one-line 'def' statements. + * Don't rename extensions when they already have the multiarch tag. + + -- Matthias Klose Tue, 19 May 2015 09:55:39 +0200 + +python3.5 (3.5.0~a4-4) unstable; urgency=medium + + * Update to 20150518 from the trunk. + - Fix build on big endian targets. + * Work around issue #24226, byte compilation of IN.py. + * Disable PGO (fails to build in unstable). + + -- Matthias Klose Mon, 18 May 2015 13:48:38 +0200 + +python3.5 (3.5.0~a4-3) unstable; urgency=medium + + * Update to 20150517 from the trunk. + + -- Matthias Klose Sun, 17 May 2015 17:22:56 +0200 + +python3.5 (3.5.0~a4-2) experimental; urgency=medium + + * Update to 20150421 from the trunk. + * Fix renaming of extensions. Closes: #783090. + + -- Matthias Klose Wed, 22 Apr 2015 14:41:45 +0200 + +python3.5 (3.5.0~a4-1) experimental; urgency=medium + + * Python 3.5.0 alpha 4. + * Update to 20150420 from the trunk. + * Build debug builds with -Og. + + -- Matthias Klose Mon, 20 Apr 2015 20:59:53 +0200 + +python3.5 (3.5.0~a3-1) experimental; urgency=medium + + * Python 3.5.0 alpha 3. + * Update to 20150415 from the trunk. + + -- Matthias Klose Wed, 15 Apr 2015 21:43:00 +0200 + +python3.4 (3.4.3-3) experimental; urgency=medium + + * Update to 20150311 from the 3.4 branch. + * Relax the version check for mpdecimal (all required patches applied + in the distro version of mpdecimal 2.4.0). + * When using GCC versions older than 4.9 for extension builds, automagically + mangle -fstack-protector-strong to -fstack-protector. + + -- Matthias Klose Sat, 11 Apr 2015 20:50:40 +0200 + +python3.4 (3.4.3-2) experimental; urgency=medium + + * debian/tests: Use init system agnostic "service" command instead of + upstart specific "stop". Also drop unnecessary "status" call right after + stopping apport (Martin Pitt). + + -- Matthias Klose Tue, 10 Mar 2015 20:28:20 +0100 + +python3.4 (3.4.3-1) experimental; urgency=medium + + * Python 3.4.3 release. + * Changes since 20141202 (3.4.2-4): + - Issue #22896: Avoid using PyObject_AsCharBuffer(), + PyObject_AsReadBuffer(), and PyObject_AsWriteBuffer(). + - Issue #21295: Revert some changes (issue #16795) to AST line numbers and + column offsets that constituted a regression. + - Issue #21408: The default __ne__() now returns NotImplemented if __eq__() + returned NotImplemented. + - Issue #23321: Fixed a crash in str.decode() when error handler returned + replacment string longer than mailformed input data. + - Issue #23048: Fix jumping out of an infinite while loop in the pdb. + - Issue #23165: Perform overflow checks before allocating memory in the + _Py_char2wchar function. + - Issue #23099: Closing io.BytesIO with exported buffer is rejected now to + prevent corrupting exported buffer. + - Issue #23363: Fix possible overflow in itertools.permutations. + - Issue #23364: Fix possible overflow in itertools.product. + - Issue #23366: Fixed possible integer overflow in itertools.combinations. + - Issue #23369: Fixed possible integer overflow in + _json.encode_basestring_ascii. + - Issue #23353: Fix the exception handling of generators in + PyEval_EvalFrameEx(). At entry, save or swap the exception state even if + PyEval_EvalFrameEx() is called with throwflag=0. At exit, the exception + state is now always restored or swapped, not only if why is WHY_YIELD or + WHY_RETURN. + - Issue #18518: timeit now rejects statements which can't be compiled + outside a function or a loop (e.g. "return" or "break"). + - Issue #23094: Fixed readline with frames in Python implementation of + pickle. + - Issue #23268: Fixed bugs in the comparison of ipaddress classes. + - Issue #21408: Removed incorrect implementations of __ne__() which didn't + returned NotImplemented if __eq__() returned NotImplemented. The default + __ne__() now works correctly. + - Issue #19996: :class:`email.feedparser.FeedParser` now handles + (malformed) headers with no key rather than amusing the body has started. + - Issue #23248: Update ssl error codes from latest OpenSSL git master. + - Issue #23098: 64-bit dev_t is now supported in the os module. + - Issue #23250: In the http.cookies module, capitalize "HttpOnly" and + "Secure" as they are written in the standard. + - Issue #23063: In the disutils' check command, fix parsing of reST with + code or code-block directives. + - Issue #23209, #23225: selectors.BaseSelector.close() now clears its + internal reference to the selector mapping to break a reference cycle. + - Issue #21356: Make ssl.RAND_egd() optional to support LibreSSL. The + availability of the function is checked during the compilation. + - Issue #20896, #22935: The :func:`ssl.get_server_certificate` function + now uses the :data:`~ssl.PROTOCOL_SSLv23` protocol by default, not + :data:`~ssl.PROTOCOL_SSLv3`, for maximum compatibility and support + platforms where :data:`~ssl.PROTOCOL_SSLv3` support is disabled. + - Issue #23111: In the ftplib, make ssl.PROTOCOL_SSLv23 the default + protocol version. + - Issue #23132: Mitigate regression in speed and clarity in + functools.total_ordering. + - Issue #22585: On OpenBSD 5.6 and newer, os.urandom() now calls + getentropy(), instead of reading /dev/urandom, to get pseudo-random + bytes. + - Issue #23112: Fix SimpleHTTPServer to correctly carry the query string + and fragment when it redirects to add a trailing slash. + - Issue #23093: In the io, module allow more operations to work on detached + streams. + - Issue #19104: pprint now produces evaluable output for wrapped strings. + - Issue #23071: Added missing names to codecs.__all__. + - Issue #15513: Added a __sizeof__ implementation for pickle classes. + - Issue #19858: pickletools.optimize() now aware of the MEMOIZE opcode, can + produce more compact result and no longer produces invalid output if + input data contains MEMOIZE opcodes together with PUT or BINPUT opcodes. + - Issue #22095: Fixed HTTPConnection.set_tunnel with default port. + The port value in the host header was set to "None". + - Issue #23016: A warning no longer produces an AttributeError when the + program is run with pythonw.exe. + - Issue #21775: shutil.copytree(): fix crash when copying to VFAT. An + exception handler assumed that that OSError objects always have a + 'winerror' attribute. That is not the case, so the exception handler + itself raised AttributeError when run on Linux (and, presumably, + any other non-Windows OS). + - Issue #1218234: Fix inspect.getsource() to load updated source of + reloaded module. + - Issue #22959: In the constructor of http.client.HTTPSConnection, prefer + the context's check_hostname attribute over the *check_hostname* + parameter. + - Issue #23009: Make sure selectors.EpollSelecrtor.select() works when no + FD is registered. + - Issue #20577: Configuration of the max line length for the + FormatParagraph extension has been moved from the General tab of the + Idle preferences dialog to the FormatParagraph tab of the Config + Extensions dialog. + - Issue #16893: Update Idle doc chapter to match current Idle and add new + information. + - Issue #23180: Rename IDLE "Windows" menu item to "Window". + - Issue #19548: Added some additional checks to test_codecs to ensure that + statements in the updated documentation remain accurate. + - Issue #15506: Use standard PKG_PROG_PKG_CONFIG autoconf macro in the + configure script. + - Issue #22935: Allow the ssl module to be compiled if openssl doesn't + support SSL 3. + - Issue #22079: PyType_Ready() now checks that statically allocated type + has no dynamically allocated bases. + - Issue #19548: Update the codecs module documentation to better cover the + distinction between text encodings and other codecs, together with other + clarifications. + - Issue #22914: Update the Python 2/3 porting HOWTO to describe a more + automated approach. + - Issue #22735: Fix many edge cases (including crashes) involving custom + mro() implementations. + - Issue #23399: pyvenv creates relative symlinks where possible. + - Issue #23392: Added tests for marshal C API that works with FILE*. + - Issue #18982: Add tests for CLI of the calendar module. + - Issue #23345: Prevent test_ssl failures with large OpenSSL patch level + values (like 0.9.8zc). + * Remove LTO sections from the static libraries. + + -- Matthias Klose Thu, 26 Feb 2015 10:07:08 +0100 + +python3.4 (3.4.2-4) unstable; urgency=medium + + * Fix issue #22935: Fix ssl module when SSLv3 protocol is not supported. + * Fix issue #16043: Add a default limit for the amount of data + xmlrpclib.gzip_decode will return. CVE-2013-1753. Closes: #742927. + * Disable ensurepip for the system installation, only enable it for virtual + environments. Closes: #772730. + + -- Matthias Klose Sat, 27 Dec 2014 12:23:33 +0100 + +python3.4 (3.4.2-3) unstable; urgency=medium + + * Update to 20141202 from the 3.4 branch. + - Issue #20335: bytes constructor now raises TypeError when encoding or + errors is specified with non-string argument. + - Issue #21971: Update turtledemo doc and add module to the index. + - Issue #21032. Fixed socket leak if HTTPConnection.getresponse() fails. + - Issue #22960: Add a context argument to xmlrpclib.ServerProxy constructor. + - Issue #22915: SAX parser now supports files opened with file descriptor + or bytes path. + - Issue #22609: Constructors and update methods of mapping classes in the + collections module now accept the self keyword argument. + - Issue #22788: Add *context* parameter to logging.handlers.HTTPHandler. + - Issue #22921: Allow SSLContext to take the *hostname* parameter even if + OpenSSL doesn't support SNI. + - Issue #22894: TestCase.subTest() would cause the test suite to be stopped + when in failfast mode, even in the absence of failures. + - Issue #22638: SSLv3 is now disabled throughout the standard library. + It can still be enabled by instantiating a SSLContext manually. + - Issue #22370: Windows detection in pathlib is now more robust. + - Issue #22841: Reject coroutines in asyncio add_signal_handler(). + - Issue #22838: All test_re tests now work with unittest test discovery. + - Issue #21514: The documentation of the json module now refers to new + JSON RFC 7159 instead of obsoleted RFC 4627. + - Issue #22314: pydoc now works when the LINES environment variable is set. + - IDLE updates. + * Fix byte-code removal for the __phello__ module (mismatching source + and byte-code file name). Closes: #769769. + * Let ensurepip use a temporary location for the copy of the wheels. + Remove the ad-hoc /usr/lib/python-wheels location on package purge. + Let python3.4-venv break python3-pip (<< 1.5.6-4). Closes: #769449. + * Don't pass default compiler search directories in the pkgconfig file. + Closes: #770936. + * Don't run pyexpat.test_exception as an autopkg test, requires a source + file. + * Allow building and testing without SSLv3 support (Kurt Roeckx). + Addresses: #768611. + * Fix issue 22966, when byte compiling, keep the base name of a file + containing dots. Closes: #769769. + + -- Matthias Klose Tue, 02 Dec 2014 14:39:00 +0100 + +python3.4 (3.4.2-2) unstable; urgency=medium + + * Repackage the upstream source without the bundled ensurepip wheels (using + package format 3.0 (quilt)). + * Update to 20141112 from the 3.4 branch. + - Issue #19524: Fixed resource leak in the HTTP connection when an invalid + response is received. + - Issue #22216: smtplib now resets its state more completely after a quit. + The most obvious consequence of the previous behavior was a STARTTLS + failure during a connect/starttls/quit/connect/starttls sequence. + - Issue #22185: Fix an occasional RuntimeError in threading.Condition.wait() + caused by mutation of the waiters queue without holding the lock. + - Issue #22182: Use e.args to unpack exceptions correctly in + distutils.file_util.move_file. + - The webbrowser module now uses subprocess's start_new_session=True rather + than a potentially risky preexec_fn=os.setsid call. + - Issue #22191: Fix warnings.__all__. + - Issue #8797: Raise HTTPError on failed Basic Authentication immediately. + - Issue #21166: Prevent possible segfaults and other random failures of + python --generate-posix-vars in pybuilddir.txt build target. + - Idle changes: + - Issue #17390: Adjust Editor window title; remove 'Python', + move version to end. + - Issue #14105: Idle debugger breakpoints no longer disappear + when inseting or deleting lines. + - Issue #17172: Turtledemo can now be run from Idle. + - Issue #22236: Tkinter tests now don't reuse default root window. + New root window is created for every test class. + - Tk changes: + - Issue #22226: First letter no longer is stripped from the "status" key + in the result of Treeview.heading(). + - Issue #22051: turtledemo no longer reloads examples to re-run them. + Initialization of variables and gui setup should be done in main(), + which is called each time a demo is run, but not on import. + - Issue #21933: Turtledemo users can change the code font size with a + menu selection or control(command) '-' or '+' or control-mousewheel. + - Issue #21597: The separator between the turtledemo text pane and the + drawing canvas can now be grabbed and dragged with a mouse. The code + text pane can be widened to easily view or copy the full width of the + text. + The canvas can be widened on small screens. + - Issue #18132: Turtledemo buttons no longer disappear when the window + is shrunk. + - Issue #22236: Fixed Tkinter images copying operations in NoDefaultRoot + mode. + * Fix maintainer scripts for byte-code removal. Closes: #769079. + + -- Matthias Klose Thu, 13 Nov 2014 04:33:52 +0100 + +python3.4 (3.4.2-1) unstable; urgency=medium + + * Python 3.4.2 release. + * Refresh patches. + * Bump standards version to 3.9.6. + + -- Matthias Klose Wed, 08 Oct 2014 11:25:34 +0200 + +python3.4 (3.4.2~rc1-1) unstable; urgency=medium + + * Python 3.4.2 release candidate 1. + * Update to 20140930 from the 3.4 branch. + + -- Matthias Klose Tue, 30 Sep 2014 01:51:50 +0200 + +python3.4 (3.4.1-11) unstable; urgency=medium + + * Update to 20140910 from the 3.4 branch. + + -- Matthias Klose Wed, 10 Sep 2014 20:21:04 +0200 + +python3.4 (3.4.1-10) unstable; urgency=medium + + * Update to 20140818 from the 3.4 branch. + * Build-depend on dpkg-dev (>= 1.17.11). + + -- Matthias Klose Mon, 18 Aug 2014 10:00:55 +0200 + +python3.4 (3.4.1-9) unstable; urgency=medium + + * Update to 20140810 from the 3.4 branch. + + -- Matthias Klose Sun, 10 Aug 2014 14:53:46 +0200 + +python3.4 (3.4.1-8) unstable; urgency=medium + + * Update to 20140726 from the 3.4 branch. + * Move turtledemo from libpython3.4-testsuite to python3.4-examples. + * Call dpkg -L in the maintainer scripts with an architecture qualifier + for M-A: same packages. Closes: #754914. + + -- Matthias Klose Sat, 26 Jul 2014 14:16:56 +0200 + +python3.4 (3.4.1-7) unstable; urgency=medium + + * Update to 20140706 from the 3.4 branch. + + -- Matthias Klose Sun, 06 Jul 2014 21:37:36 +0200 + +python3.4 (3.4.1-6) unstable; urgency=medium + + * Fix logic to disable running the pystone benchmark on KFreeBSD (Steven + Chamberlain). + + -- Matthias Klose Mon, 09 Jun 2014 12:06:18 +0200 + +python3.4 (3.4.1-5) unstable; urgency=medium + + * Update to 20140608 from the 3.4 branch. + * Disable running the pystone benchmark on KFreeBSD. + + -- Matthias Klose Sun, 08 Jun 2014 11:43:44 +0200 + +python3.4 (3.4.1-4) unstable; urgency=medium + + * Disable running the pybench benchmark on KFreeBSD. + + -- Matthias Klose Sat, 07 Jun 2014 14:01:35 +0200 + +python3.4 (3.4.1-3) unstable; urgency=medium + + * Update to 20140605 from the 3.4 branch. + - pull in pyvenv changes. + * Update the ensurepip-wheels patch (Barry Warsaw). + * Fix python3.4-venv package removal. + + -- Matthias Klose Thu, 05 Jun 2014 11:57:51 +0200 + +python3.4 (3.4.1-2) unstable; urgency=medium + + * Update to 20140603 from the 3.4 branch. + * Remove the __pycache__ directories on libpython3.4-testsuite package + removal. Closes: #749999. + * In the autopkg tests, set HOME to the temporary home directory after + the su call. + * In the autopkg tests, make $ADTTMP accessible to the su user, and + re-enable the test_site autopkg test. + * Don't try to access the pip module in ensurepip, when the wheels + are not available. + + -- Matthias Klose Tue, 03 Jun 2014 23:58:48 +0200 + +python3.4 (3.4.1-1) unstable; urgency=medium + + * Python 3.4.1 release. + * Set a temporary home directory for the build and the autopkg tests. + * Fix issue #17752, test_distutils failures in the installed location. + * Update pydoc_data/topics.py, broken in the release candidate. + * Run again the test_code_module test in the autopkg tests. + * Fix issue #21264, test_compileall test failures in the installed + location. Re-enable in autopkg tests. LP: #1264554. + * ensurepip and pyvenv: + - Split out a python3.4-venv package, include the pyvenv-3.4 binary + and the ensurepip package. + - Adjust the ensurepip patch so that the wheels are installed from + the universal wheel packages (Barry Warsaw). + - Let ensurepip read wheel dependencies from a file shipped in the + -whl packages. + - Remove any version check on required pip and setuptools versions. + These are handled within these packages if necessary. + * Re-enable the pgo build. + + -- Matthias Klose Wed, 21 May 2014 22:17:32 +0200 + +python3.4 (3.4.1~rc1-1) unstable; urgency=medium + + * Python 3.4.1 release candidate 1. + * Don't run test_code_module in the autopkg test environment, fails there + but succeeds during the build. See issue #17756. Applied workaround + for the test case. + + -- Matthias Klose Mon, 05 May 2014 16:10:23 +0200 + +python3.4 (3.4.0+20140427-1) unstable; urgency=medium + + * Update to 20140427 from the 3.4 branch. + * Fix dependency for the -testsuite package: Closes: #745879. + + -- Matthias Klose Sun, 27 Apr 2014 18:48:54 +0200 + +python3.4 (3.4.0+20140425-1) unstable; urgency=medium + + * Update to 20140425 from the 3.4 branch. + * Don't try to byte-compile bad syntax files in the testsuite. + + -- Matthias Klose Fri, 25 Apr 2014 13:52:11 +0200 + +python3.4 (3.4.0+20140417-1) unstable; urgency=medium + + * Update to 20140417 from the 3.4 branch. + - Fix the test_site test failure. + * Repackage as a new tarball and remove the wheels shipped with ensurepip. + * Re-enable running some tests, disable some tests: + - Re-enable test_platform, test_subprocess, test_code_module, test_pydoc, + - Fix a distutils test error, skip a Solaris distutils test error. + - Skip the test_platform encoding test, failing with the lsb-release patch. + - Skip tests which are failing with python3.4.zip removed from sys.path. + Tracked in issue #21249. + * Byte-compile the files in the libpython3.4-testsuite package. + * d/p/distutils-install-layout.diff, d/p/site-locations.diff: Adjust the + "am I in a virtual environment" tests to include checking + sys.base_prefix != sys.prefix. This is the definitive such test for + pyvenv created virtual environments (Barry Warsaw). + * Disallow running ensurepip with the system python, when not used in + a virtual environment (Barry Warsaw). + * Don't yet install the ensurepip module, requires further work. + ensurepip wants to install bundled modules setuptools and python-pip, + which should be built from the distro packages instead of using the + bundled code. + * python3.4-dbg: Add a python3.4-dbg.py symlink. + * Remove the linecache patch, not needed anymore in 3.4. + * Remove the disable-utimes patch, not needed anymore since glibc-2.4. + * Remove the statvfs-f_flag-constants, avoid-rpath, hurd-path_max, + kfreebsd-xattrs, freebsd-testsuite and ncurses-configure patches + applied upstream. + * Don't add runtime paths for libraries found in multiarch locations. + + -- Matthias Klose Thu, 17 Apr 2014 21:05:04 +0200 + +python3.4 (3.4.0-2) unstable; urgency=medium + + * Update to 20140407 from the 3.4 branch. + - Issue #21134: Fix segfault when str is called on an uninitialized + UnicodeEncodeError, UnicodeDecodeError, or UnicodeTranslateError object. + - Issue #19537: Fix PyUnicode_DATA() alignment under m68k. + - Issue #21155: asyncio.EventLoop.create_unix_server() now raises + a ValueError if path and sock are specified at the same time. + - Issue #21149: Improved thread-safety in logging cleanup during + interpreter shutdown. + - Issue #20145: `assertRaisesRegex` and `assertWarnsRegex` now raise a + TypeError if the second argument is not a string or compiled regex. + - Issue #21058: Fix a leak of file descriptor in + :func:`tempfile.NamedTemporaryFile`, close the file descriptor if + :func:`io.open` fails. + - Issue #21013: Enhance ssl.create_default_context() when used for server + side sockets to provide better security by default. + - Issue #20633: Replace relative import by absolute import. + - Issue #20980: Stop wrapping exception when using ThreadPool. + - Issue #21082: In os.makedirs, do not set the process-wide umask. + Note this changes behavior of makedirs when exist_ok=True. + - Issue #20990: Fix issues found by pyflakes for multiprocessing. + - Issue #21015: SSL contexts will now automatically select an elliptic + curve for ECDH key exchange on OpenSSL 1.0.2 and later, and otherwise + default to "prime256v1". + - Issue #20816: Fix inspect.getcallargs() to raise correct TypeError for + missing keyword-only arguments. + - Issue #20817: Fix inspect.getcallargs() to fail correctly if more + than 3 arguments are missing. + - Issue #6676: Ensure a meaningful exception is raised when attempting + to parse more than one XML document per pyexpat xmlparser instance. + - Issue #20942: PyImport_ImportFrozenModuleObject() no longer sets __file__ + to match what importlib does; this affects _frozen_importlib as well as + any module loaded using imp.init_frozen(). + - Documentation, tools, demo and test updates. + * Depend on the python3-tk packages in the autopkg tests. + * Fix LTO builds with GCC 4.9. + + -- Matthias Klose Mon, 07 Apr 2014 11:46:02 +0200 + +python3.4 (3.4.0-1) unstable; urgency=medium + + * Python 3.4.0 release. + * Update to 20140322 from the 3.4 branch. + + * Build without ffi on or1k. Addresses: #738519. + * Update autopkg tests (Martin Pitt): + - Don't fail if apport is not installed. + - Call su with explicit shell, as nobody has nologin as default shell now. + - Only use $SUDO_USER if that user actually exists in the testbed. + - Drop obsolete chowning of $TMPDIR and $ADTTMP; with current autopkgtest + $TMPDIR has appropriate permissions, and $ADTTMP is not being used. + + -- Matthias Klose Sat, 22 Mar 2014 13:39:34 +0100 + +python3.4 (3.4~rc2-1) unstable; urgency=medium + + * Python 3.4 release candidate 2. + + -- Matthias Klose Mon, 24 Feb 2014 10:40:55 +0100 + +python3.4 (3.4~rc1-1) unstable; urgency=medium + + * Python 3.4 release candidate 1. + + -- Matthias Klose Tue, 11 Feb 2014 13:38:50 +0100 + +python3.4 (3.4~b3-1) unstable; urgency=medium + + * Python 3.4 beta 3. + + -- Matthias Klose Mon, 27 Jan 2014 10:54:10 +0000 + +python3.4 (3.4~b2-1) unstable; urgency=medium + + * Python 3.4 beta 2. + * Configure --with-system-libmpdec. + + -- Matthias Klose Sun, 05 Jan 2014 23:34:17 +0100 + +python3.4 (3.4~b1-5ubuntu2) trusty; urgency=medium + + * Disable the test_dbm autopkg test, failing from time to time ... + + -- Matthias Klose Fri, 03 Jan 2014 02:25:31 +0100 + +python3.4 (3.4~b1-5ubuntu1) trusty; urgency=medium + + * Build for Tcl/Tk 8.6. + + -- Matthias Klose Thu, 02 Jan 2014 18:05:27 +0100 + +python3.4 (3.4~b1-5) unstable; urgency=medium + + * Update to 20131231 from the trunk. + - Fix issue #20070, don't run test_urllib2net when network resources + are not enabled. + * Move the _sitebuiltins module into libpython3.4-minimal. + * distutils: On installation with --install-layout=deb, rename extensions + to include the multiarch tag. + Renaming of extensions for python3.4 is currently not done by dh-python. + See Debian #733128. + * autopkg tests: + - Update debian/tests/control to refer to python3.4. + - Generate locales for running the autopkg tests. + - Disable some currently failing autopkg tests. LP: #1264554. + - Disable test_compileall for the autopkg tests, fails only there. + * Don't run test_faulthandler on Aarch64, hangs on the buildds. + See LP: #1264354. + + -- Matthias Klose Tue, 31 Dec 2013 13:29:08 +0100 + +python3.4 (3.4~b1-4) unstable; urgency=medium + + * Update to 20131225 from the trunk. + * Fix python3.4--config --configdir. Closes: #733050. + + -- Matthias Klose Wed, 25 Dec 2013 21:56:04 +0100 + +python3.4 (3.4~b1-3) experimental; urgency=medium + + * Update to 20131221 from the trunk. + + -- Matthias Klose Sat, 21 Dec 2013 15:20:38 +0100 + +python3.4 (3.4~b1-2) experimental; urgency=low + + * Update to 20131202 from the trunk. + * Fix dbg symbols file for i386. + * Don't provide python3.4-dbm, available in a separate package. + * (Build-)depend on net-tools, test_uuid requires ifconfig. + * Fix distutils.sysconfig.get_makefile_filename(). + * Move operator module to the -minimal package. Closes: #731100. + + -- Matthias Klose Mon, 02 Dec 2013 14:36:44 +0100 + +python3.4 (3.4~b1-1) experimental; urgency=low + + * Python 3.4 beta 1. + + -- Matthias Klose Sun, 24 Nov 2013 23:21:49 +0100 + +python3.3 (3.3.3-2) unstable; urgency=low + + * Update to 20131123 from the 3.3 branch. + * Update hurd-path_max.diff. + + -- Matthias Klose Sat, 23 Nov 2013 08:57:21 +0100 + +python3.3 (3.3.3-1) unstable; urgency=low + + * Python 3.3.3 release. + * Update to 20131119 from the 3.3 branch. + * Regenerate the patches. + * Update the symbols files. + * Fix test support when the running kernel doesn't handle port reuse. + * libpython3.3-minimal replaces libpython3.3-stdlib (<< 3.2.3-7). + Closes: #725240. + + -- Matthias Klose Tue, 19 Nov 2013 08:46:55 +0100 + +python3.3 (3.3.2-7) unstable; urgency=low + + * Update to 20130918 from the 3.3 branch. + * Update symbols file. + * Fail the build if extensions for the minimal package are not in + the libpython-minimal package. Closes: #723624. + * Fix indentation in regenerated platform-lsbrelease.diff (Dmitry Shachnev). + LP: #1220508. + * Point to the python3-tk (instead of the python-tk) package when missing. + LP: #1184082. + + -- Matthias Klose Wed, 18 Sep 2013 12:19:47 +0200 + +python3.3 (3.3.2-6) unstable; urgency=medium + + * Update to 20130917 from the 3.3 branch. + - Fix SSL module to handle NULL bytes inside subjectAltNames general + names (CVE-2013-4238). Closes: #719567. + * Don't run the curses autopkg test. + * Set Multi-Arch attributes for binary packages. + * Fix multiarch include header for sparc64. Closes: #714802. + + -- Matthias Klose Tue, 17 Sep 2013 15:12:00 +0200 + +python3.3 (3.3.2-5) unstable; urgency=low + + * Update to 20130803 from the 3.3 branch. + - Fix fcntl test case on KFreeBSD (Petr Salinger). + * Disable some socket tests on KFreeBSD (Petr Salinger). + * Fix multiarch include header for sparc64. Closes: #714802. + * Update package descriptions (Filipus Klutiero). Closes: #715801. + + -- Matthias Klose Sun, 04 Aug 2013 17:38:35 +0200 + +python3.3 (3.3.2-4) unstable; urgency=low + + * Update to 20130612 from the 3.3 branch. + * Refresh patches. + * Don't run consistency check for cross builds. + * Really skip byte compile of non-existing sitecustomize.py. + * Fix the multiarch header file for mips64 (YunQiang Su). Closes: #710374. + + -- Matthias Klose Wed, 12 Jun 2013 22:55:02 +0200 + +python3.3 (3.3.2-3) unstable; urgency=low + + * Update to 20130527 from the 3.3 branch. + - Fix #17980, possible abuse of ssl.match_hostname() for denial of service + using certificates with many wildcards (CVE-2013-2099). Closes: #708530. + * Disable the test_io test on armel, armhf, mips, mipsel. Hangs the + buildds. + * Don't try to byte-compile sitecustomize.py if the target of the + symlink doesn't exist anymore. Addresses: #709157. + * Fix directory removal in maintainer scripts. Closes: #709963. + * Handle byte compilation in python3.3{-minimal,}, byte removal in + libpython3.3{-minimal,-stdlib}. + * Backport patch to fix issue #13146, possible race conditions when writing + .pyc/.pyo files in py_compile.py (Barry Warsaw). LP: #1058884. + * Mark all _Py_dg_* symbols as optional on m68k. Closes: #709888. + + -- Matthias Klose Mon, 27 May 2013 20:44:03 +0200 + +python3.3 (3.3.2-2) unstable; urgency=high + + * Fix the multiarch header file for ppc64. Closes: #708646. + * Disable running the tests on kfreebsd and the hurd. Please + follow-up in #708652 and #708653. + + -- Matthias Klose Fri, 17 May 2013 23:16:04 +0200 + +python3.3 (3.3.2-1) unstable; urgency=low + + * Python 3.3.2 release. + * Fix sysconfig.get_makefile_name() for the multiarch location. + * Set the platinclude dir back to the non-multiarch include path, + where the multiarch pyconfig.h compatibility header is found. + * Remove obsolete profile-doc patch. + * Run the pgo profile task in batches to avoid crashes during the + pgo profile run. + * Don't set yet any Multi-Arch: attributes in Debian. + * Build a libpython3.3-testsuite package. + * Add autopkg tests to run the installed testsuite in normal and debug + mode. + * Re-enable running the tests during the build. + * Add pyconfig.h compatibility headers. + + -- Matthias Klose Wed, 15 May 2013 19:41:15 +0200 + +python3.3 (3.3.1-1ubuntu5) raring; urgency=low + + * Remove obsolete profile-doc patch. + * Run the pgo profile task in batches to avoid crashes during the + pgo profile run. + * Disable the lto build on armhf for now. + * Final (?) set of autopkg test fixes. + * Issue #17012: shutil.which() no longer fallbacks to the PATH environment. + variable if empty path argument is specified. + * Issue #17782: Fix undefined behaviour on platforms where + ``struct timespec``'s "tv_nsec" member is not a C long. + + -- Matthias Klose Wed, 17 Apr 2013 23:35:49 +0200 + +python3.3 (3.3.1-1ubuntu4) raring; urgency=low + + * Don't run the test suite in random order. + * More autopkg test fixes. + + -- Matthias Klose Wed, 17 Apr 2013 13:33:00 +0200 + +python3.3 (3.3.1-1ubuntu3) raring; urgency=low + + * Fix sysconfig.get_makefile_name() for the multiarch location. + * Set the platinclude dir back to the non-multiarch include path, + where the multiarch pyconfig.h compatibility header is found. + * Fix autopkg tests. + * More autopkgtest fixes (Jean-Baptiste Lallement): + - redirect stderr of command 'stop apport' to /dev/null. output to stderr + is an error for adt. + - script.py waits for child to exit and exit with child's return code. + - xpickle is not a valid value for option -u of regrtest.py. Removed it + LP: #1169150. + * Issue #17754, setting LANG and LC_ALL for the compiler call in ctypes/util. + * Issue #17761, platform._parse_release_file doesn't close the + /etc/lsb-release file, and doesn't know about 'Ubuntu'. + + -- Matthias Klose Tue, 16 Apr 2013 17:33:35 +0200 + +python3.3 (3.3.1-1ubuntu2) raring; urgency=low + + * Idle updates: + - Issue #17657: Show full Tk version in IDLE's about dialog. + - Issue #17613: Prevent traceback when removing syntax colorizer. + - Issue #1207589: Backwards-compatibility patch for right-click menu. + - Issue #16887: Now accepts Cancel in tabify/untabify dialog box. + - Issue #17625: Close the replace dialog after it is used. + - Issue #14254: Now handles readline correctly across shell restarts. + - Issue #17614: No longer raises exception when quickly closing a file. + - Issue #6698: Now opens just an editor window when configured to do so. + - Issue #8900: Using keyboard shortcuts in IDLE to open a file no longer + raises an exception. + - Issue #6649: Fixed missing exit status. + * Build a libpython3.3-testsuite package. LP: #301629. + * Add autopkg tests to run the installed testsuite in normal and debug + mode. + * Re-enable running the tests during the build. + * Add pyconfig.h compatibility headers. LP: #1094246. + + -- Matthias Klose Wed, 10 Apr 2013 23:05:23 +0200 + +python3.3 (3.3.1-1ubuntu1) raring; urgency=low + + * Merge with Debian; remaining changes: + - Build-depend on python3:any instead of python3. + + -- Matthias Klose Sat, 06 Apr 2013 16:21:34 +0200 + +python3.3 (3.3.1-1) unstable; urgency=low + + * Python 3.3.1 release. + * Call python with -E -S for the byte compilation. + + -- Matthias Klose Sat, 06 Apr 2013 15:12:07 +0200 + +python3.3 (3.3.1~rc1-2) experimental; urgency=low + + * Fix byte-compiliation/-removal for the split-out library packages. + LP: #1160944. + + -- Matthias Klose Sat, 30 Mar 2013 13:36:40 +0100 + +python3.3 (3.3.1~rc1-1) experimental; urgency=low + + * Python 3.3.1 release candidate 1. + + -- Matthias Klose Tue, 26 Mar 2013 10:45:37 +0100 + +python3.3 (3.3.0-12) experimental; urgency=low + + * Update to 20130306 from the 3.3 branch. + * Remove the HAVE_FSYNC configure workaround, not needed for 3.3. + * Remove the python3 manual symlink (now shipped upstream by default). + Closes: #701051. + + -- Matthias Klose Wed, 06 Mar 2013 16:38:41 +0800 + +python3.3 (3.3.0-11) experimental; urgency=low + + * Update to 20130220 from the 3.3 branch. + + -- Matthias Klose Wed, 20 Feb 2013 15:40:05 +0100 + +python3.3 (3.3.0-10) experimental; urgency=low + + * Update to 20130126 from the 3.3 branch. + * Update hurd patches. + * python3.3-dbg, libpython3.3-dbg: Drop dependency on python. + * python3.3-dbg: Make gdb (not gdb-minimal) a recommendation. + * Git rid of build-dependency on python. + * Add site-packages in virtual environments created by pyvenv. + Closes: #698777. + + -- Matthias Klose Sat, 26 Jan 2013 12:17:05 +0100 + +python3.3 (3.3.0-9) experimental; urgency=low + + * Update to 20130125 from the 3.3 branch. + * Update cross build patches, and allow the package to cross build. + + -- Matthias Klose Fri, 25 Jan 2013 17:06:25 +0100 + +python3.3 (3.3.0-8) experimental; urgency=low + + * Update to 20130105 from the 3.3 branch. + * python-config --help returns with an exit value 0. LP: #1093860. + * Update package description for the -dbg packages. Closes: #696616. + + -- Matthias Klose Sat, 05 Jan 2013 18:39:32 +0100 + +python3.3 (3.3.0-7) experimental; urgency=low + + * Update to 20121220 from the 3.3 branch. + * debian/patches/sys-multiarch.diff: Expose multiarch triplet value + as sys.implementation._multiarch (Barry Warsaw). Closes: #695959. + Note: Usage of sysconfig.get_config_var('MULTIARCH') is preferred. + * Set the install schema to `unix_prefix', if a virtual environment + is detected (VIRTUAL_ENV env var present). Closes: #695758. + * python3.3-dev, libpython3.3-dev: Drop the dependency on libssl-dev. + + -- Matthias Klose Fri, 21 Dec 2012 07:24:41 +0100 + +python3.3 (3.3.0-6) experimental; urgency=low + + * Don't use xattrs on kfreebsd and the Hurd. + + -- Matthias Klose Tue, 04 Dec 2012 04:36:42 +0100 + +python3.3 (3.3.0-5) experimental; urgency=low + + * Update to 20121203 from the 3.3 branch. + * Make python3.3, python3.3-{minimal,dev,dbg} Multi-Arch: allowed. + * Use a shell implementation for the python-config script. + + -- Matthias Klose Mon, 03 Dec 2012 21:52:33 +0100 + +python3.3 (3.3.0-4) experimental; urgency=low + + * Update to 20121128 from the 3.3 branch. + * Don't link extensions with the shared libpython library. + * Override pointless lintian warning `hardening-no-fortify-functions' + for binaries built without optimization. + + -- Matthias Klose Wed, 28 Nov 2012 13:47:16 +0100 + +python3.3 (3.3.0-3) experimental; urgency=low + + * Update to 20121106 from the 3.3 branch. + * Filter-out cflags for profiled builds from _sysconfigdata. + * Fix multiarch plat-linux installation. LP: #1075891. + * Install _sysconfigdata.py from the shared builds. LP: #1075903. + + -- Matthias Klose Wed, 07 Nov 2012 14:31:02 +0100 + +python3.3 (3.3.0-2) experimental; urgency=low + + * Update to 20121021 from the 3.3 branch. + * Fix the interpreter name for the python3.3-dbg-config script. + + -- Matthias Klose Sun, 21 Oct 2012 09:51:05 +0200 + +python3.3 (3.3.0-1) experimental; urgency=low + + * Python 3.3.0 release. + + -- Matthias Klose Sat, 29 Sep 2012 12:59:24 +0200 + +python3.3 (3.3.0~rc3-1) experimental; urgency=low + + * Python 3.3.0 release candidate 3. + * Don't try to write lib2to3's pickled grammar files. Closes: #687200. + * Fix python-config manpage symlink. Closes: #687201. + + -- Matthias Klose Mon, 24 Sep 2012 16:22:17 +0200 + +python3.3 (3.3.0~rc2-2ubuntu1) quantal; urgency=low + + * Encode the version in the devhelp documentation name. LP: #787039. + + -- Matthias Klose Mon, 10 Sep 2012 12:56:13 +0200 + +python3.3 (3.3.0~rc2-2) experimental; urgency=low + + * Fix typo fixing the pkgconfig file. + + -- Matthias Klose Mon, 10 Sep 2012 11:13:51 +0200 + +python3.3 (3.3.0~rc2-1) experimental; urgency=low + + * Python 3.3.0 release candidate 2. + * Add the platform include dir to pkgconfig's CFlags. + * Hint on installing the python-gdbm package on failing _gdbm import. + LP: #995616. + * libpython3.3: Fix libpython3.3.so symlink. Closes: #686377. + * Don't use `-n' anymore to start idle in the desktop/menu files. + + -- Matthias Klose Sun, 09 Sep 2012 13:38:55 +0200 + +python3.3 (3.3.0~rc1-2) experimental; urgency=low + + * distutils: Add the multiarch python path to the include directories. + Closes: #685041. + * Remove /etc/python3.3 in libpython3.3-minimal instead of python3.3-minimal. + Closes: #681979. + * Remove /etc/python/sysconfig.cfg, not available anymore in python3.3. + Closes: #685016. + * Don't ship the _gdbm and _tkinter extensions in the -dbg package. + Closes: #685261. + * Fix verbose parallel builds for the sharedmods target. + * Don't install the pickled lib2to3 grammar files. Closes: #685214. + * Build extensions with fortify flags. + * Overwrite arch-dependent-file-not-in-arch-specific-directory warnings. + + -- Matthias Klose Tue, 28 Aug 2012 19:47:58 +0200 + +python3.3 (3.3.0~rc1-1) experimental; urgency=low + + * Python 3.3.0 release candidate 1. + + -- Matthias Klose Sun, 26 Aug 2012 23:15:00 +0200 + +python3.3 (3.3.0~b2-1) experimental; urgency=low + + * Python 3.3.0 beta2 release. + * Fix removal of the _tkinter and dbm extensions for multiarch builds. + Closes: #684461. + * Use _sysconfigdata.py in distutils to initialize distutils. + Closes: #682475. + * Fix symlink for static libpython. Closes: #684608. + + -- Matthias Klose Mon, 13 Aug 2012 11:05:00 +0200 + +python3.3 (3.3.0~b1-3) experimental; urgency=low + + * Update to 20120712 from the trunk. + * Install separate _sysconfigdata.py for normal and debug builds. + * Install into multiarch locations. + * Split out multiarch packages libpython3.3-{minimal,stdlib,dev,dbg}. + + -- Matthias Klose Fri, 13 Jul 2012 00:43:42 +0200 + +python3.3 (3.3.0~b1-2) experimental; urgency=low + + * Update to 20120701 from the trunk. + + -- Matthias Klose Sun, 01 Jul 2012 11:45:12 +0200 + +python3.3 (3.3.0~b1-1) experimental; urgency=low + + * Python 3.3.0 beta1 release. + * Fix symlink for the -gdb.py file. + * debian/copyright: Add libmpdec license. + * Enable fortified build. + + -- Matthias Klose Wed, 27 Jun 2012 08:44:56 +0200 + +python3.3 (3.3.0~a4-1) experimental; urgency=low + + * Python 3.3.0 alpha4 release. + * Update to 20120620 from the trunk. + * Build _ctypes as an extension, not a builtin. + * Mark symbols defined in the _ctypes extension as optional. + * Remove references to the removed pyton3.3-documenting file. + * The wininst-* files cannot be built within Debian from the included + sources, needing a zlib mingw build, which the zlib maintainer isn't + going to provide. + * Use the underscore.js file provided by the libjs-underscore package. + * Let pydoc handle dist-packages the same as site-packages. + * Avoid runtime path for the sqlite extension. + + -- Matthias Klose Wed, 20 Jun 2012 13:09:19 +0200 + +python3.3 (3.3.0~a3-1) experimental; urgency=low + + * Python 3.3.0 alpha3 release. + * Build the dbm extension using db5.3. + * Update symbols file for a3. + + -- Matthias Klose Wed, 02 May 2012 23:28:46 +0200 + +python3.3 (3.3.0~a2-1) experimental; urgency=low + + * Python 3.3.0 alpha2 release. + * Update to 20120404 from the trunk. + * Build-depend on expat (>= 2.1). + + -- Matthias Klose Wed, 04 Apr 2012 16:31:34 +0200 + +python3.3 (3.3.0~a1-1) experimental; urgency=low + + * Python 3.3.0 alpha1 release. + * Update to 20120321 from the trunk. + * Update debian/copyright. + * Build-depend on expat (>= 2.1~). + + -- Matthias Klose Thu, 22 Mar 2012 06:14:01 +0100 + +python3.3 (3.3~20120109-1) experimental; urgency=low + + * 3.3 20120109 snapshot from the trunk. + * Merge packaging from python3.2 3.2.2-4. + + -- Matthias Klose Sun, 08 Jan 2012 09:44:33 +0100 + +python3.3 (3.3~20110523-1) experimental; urgency=low + + * Initial Python 3.3 packaging. + + -- Matthias Klose Mon, 23 May 2011 09:20:52 +0200 + +python3.2 (3.2.2-4) unstable; urgency=low + + * The static library belongs into the -dev package. + * Remove obsolete attributes in the control file. + + -- Matthias Klose Sat, 07 Jan 2012 20:46:39 +0100 + +python3.2 (3.2.2-3) unstable; urgency=low + + * Update to 20120106 from the 3.2 branch. + * Install manual pages for 2to3 and python-config. + * Fix file permission of token.py module. + * Add the ability to build an python3.x udeb, as copy of the + python3.x-minimal package (Colin Watson). + * Overwrite some lintian warnings: + - The -dbg interpreters are not unusual. + - The -gdb.py files don't need a python dependency. + - lintian can't handle a whatis entry starting with one word on the line. + * Fix test failures related to distutils debian installation layout. + * Update symbols files. + * Add build-arch/build-indep targets. + * Regenerate Setup and Makefiles after correcting Setup.local. + * profiled-build.diff: Pass PY_CFLAGS instead of CFLAGS for the profiled + build. + * Pass dpkg-buildflags to the build process, and build third party + extensions with these flags. + * Add support to build using -flto (and -g1) on some architectures. + * Disable pgo builds for some architectures (for now, keep just + amd64 armel armhf i386 powerpc ppc64). + * Build-depend on libgdbm-dev to build and run the gdbm tests. + * Build-depend on xvfb to run the tkinter tests. + + -- Matthias Klose Fri, 06 Jan 2012 20:10:13 +0100 + +python3.2 (3.2.2-2) unstable; urgency=low + + * Update platform patches (alpha, hppa, mips, sparc). + + -- Matthias Klose Fri, 02 Dec 2011 10:24:05 +0100 + +python3.2 (3.2.2-1) unstable; urgency=low + + * Python 3.2.2 release. + * Update to 20111201 from the 3.2 branch. + * Search headers in /usr/include/ncursesw for the curses/panel extensions. + * New patch, ctypes-arm, allow for ",hard-float" after libc6 in ldconfig -p + output (Loic Minier). LP: #898172. + + -- Matthias Klose Thu, 01 Dec 2011 13:19:16 +0100 + +python3.2 (3.2.2~rc1-1) unstable; urgency=low + + * Python 3.2.2 release candidate 1. + + -- Matthias Klose Sun, 14 Aug 2011 20:25:35 +0200 + +python3.2 (3.2.1-2) unstable; urgency=low + + * Update to 20110803 from the 3.2 branch. + * Revert previous change to treat Linux 3.x as Linux 2. Use the + plat-linux3 directory instead. + * Use linux-any for some build dependencies. Closes: #634310. + + -- Matthias Klose Wed, 03 Aug 2011 15:16:05 +0200 + +python3.2 (3.2.1-1) unstable; urgency=medium + + * Python 3.2.1 release. + * Update lib-argparse patch (Pino Toscano). Closes: #631635. + * Treat Linux 3.x as Linux 2. Closes: #633015. + + -- Matthias Klose Sun, 10 Jul 2011 21:46:36 +0200 + +python3.2 (3.2.1~rc2-1) unstable; urgency=low + + * Python 3.2.1 release candidate 2. + * Add profile/pstats to the python3.2 package, update debian copyright. + * Don't run the benchmark on hurd-i386. + * Disable threading tests on hurd-i386. Closes: #631634. + * Don't add the bsddb multilib path, if already in the standard lib path. + + -- Matthias Klose Mon, 04 Jul 2011 20:27:52 +0200 + +python3.2 (3.2.1~rc1-1) unstable; urgency=low + + * Python 3.2.1 release candidate 1. + * Only enable sphinx-0.x patches when building with sphinx-0.x. + + -- Matthias Klose Wed, 18 May 2011 12:15:47 +0200 + +python3.2 (3.2-4) unstable; urgency=low + + * Update to 20110504 from the 3.2 branch. + * Disable the profiled build on ia64 and m68k. + * Update symbols file for m68k (Thorsten Glaser). + + -- Matthias Klose Wed, 04 May 2011 21:32:08 +0200 + +python3.2 (3.2-3) unstable; urgency=low + + * Update to 20110427 from the 3.2 branch. + - Fix argparse import. Closes: #624277. + * Keep the ssl.PROTOCOL_SSLv2 module constant , just raise an exception + when trying to create a PySSL object. #624127. + * Don't depend on the locale and specific awk implementations in prerm. + Closes: #623466, #620836. + * Remove the old local site directory. Closes: #623057. + + -- Matthias Klose Wed, 27 Apr 2011 20:40:29 +0200 + +python3.2 (3.2-2) unstable; urgency=low + + * Update to 20110419 from the 3.2 branch. + * Re-enable profile-guided builds. + * Build without OpenSSL v2 support. Closes: #622004. + * Force linking the curses module against libncursesw. Closes: #622064. + * Re-enable running the testsuite during the build. + + -- Matthias Klose Tue, 19 Apr 2011 17:54:36 +0200 + +python3.2 (3.2-1) unstable; urgency=low + + * Python 3.2 final release. + + -- Matthias Klose Sun, 20 Feb 2011 19:22:24 +0100 + +python3.2 (3.2~rc3-1) experimental; urgency=low + + * Python 3.2 release candidate 3. + + -- Matthias Klose Mon, 14 Feb 2011 16:12:14 +0100 + +python3.2 (3.2~rc1-2) experimental; urgency=low + + * Fix upgrade of the python3.2-dev package. Closes: #610370. + + -- Matthias Klose Wed, 19 Jan 2011 02:21:19 +0100 + +python3.2 (3.2~rc1-1) experimental; urgency=low + + * Python 3.2 release candidate 1. + + -- Matthias Klose Sun, 16 Jan 2011 22:17:09 +0100 + +python3.2 (3.2~b2-1) experimental; urgency=low + + * Python 3.2 beta2 release. + * Fix FTBFS on hurd-i386 (Pino Toscano). Closes: #606152). + + -- Matthias Klose Tue, 21 Dec 2010 21:23:21 +0100 + +python3.2 (3.2~b1-1) experimental; urgency=low + + * Python 3.2 beta1 release. + * Configure with --enable-loadable-sqlite-extensions. + + -- Matthias Klose Mon, 06 Dec 2010 12:19:09 +0100 + +python3.2 (3.2~a4-2) experimental; urgency=low + + * Fix build failure on the hurd. + + -- Matthias Klose Fri, 26 Nov 2010 06:38:41 +0100 + +python3.2 (3.2~a4-1) experimental; urgency=low + + * Python 3.2 alpha4 release. + * Update to the py3k branch (20101124). + * Move the Makefile into the -min package, required by sysconfig. + Addresses: #603237. + + -- Matthias Klose Wed, 24 Nov 2010 22:20:32 +0100 + +python3.2 (3.2~a3-2) experimental; urgency=low + + * Update to the py3k branch (20101018). + - Issue #10094: Use versioned .so files on GNU/kfreeBSD and the GNU Hurd. + Closes: #600183. + + -- Matthias Klose Mon, 18 Oct 2010 19:34:39 +0200 + +python3.2 (3.2~a3-1) experimental; urgency=low + + * Python 3.2 alpha3 release. + * Make Lib/plat-gnukfreebsd[78] ready for python3. Closes: #597874. + + -- Matthias Klose Tue, 12 Oct 2010 16:13:15 +0200 + +python3.2 (3.2~a2-7) experimental; urgency=low + + * Update to the py3k branch (20100926). + + -- Matthias Klose Sun, 26 Sep 2010 14:41:18 +0200 + +python3.2 (3.2~a2-6) experimental; urgency=low + + * Update to the py3k branch (20100919). + * Update GNU/Hurd patches (Pino Toscano). Closes: #597320. + + -- Matthias Klose Sun, 19 Sep 2010 12:45:14 +0200 + +python3.2 (3.2~a2-5) experimental; urgency=low + + * Update to the py3k branch (20100916). + * Provide Lib/plat-gnukfreebsd[78] (Jakub Wilk). Addresses: #593818. + * Assume working semaphores, don't rely on running kernel for the check. + LP: #630511. + + -- Matthias Klose Thu, 16 Sep 2010 14:41:58 +0200 + +python3.2 (3.2~a2-4) experimental; urgency=low + + * Update to the py3k branch (20100911). + * Add the sysconfig module to python3.2-minimal. + * Remove dist-packages/README. + * Make xargs --show-limits in the maintainer scripts independent from + the locale. + + -- Matthias Klose Sat, 11 Sep 2010 20:59:47 +0200 + +python3.2 (3.2~a2-3) experimental; urgency=low + + * Update to the py3k branch (20100910). + * Disable profile feedback based optimization on armel. + * Add copyright information for expat, libffi and zlib. Sources + for the wininst-* files are in PC/bdist_wininst. Closes: #596276. + * Run the testsuite in parallel, when parallel= is set in DEB_BUILD_OPTIONS. + + -- Matthias Klose Fri, 10 Sep 2010 20:28:16 +0200 + +python3.2 (3.2~a2-2) experimental; urgency=low + + * Fix distutils.sysconfig.get_makefile_name for debug builds. + + -- Matthias Klose Thu, 09 Sep 2010 02:40:11 +0200 + +python3.2 (3.2~a2-1) experimental; urgency=low + + * Python 3.2 alpha2 release. + * Update to the py3k branch (20100908). + * Provide /usr/lib/python3/dist-packages as location for public python + packages. + + -- Matthias Klose Wed, 08 Sep 2010 17:36:06 +0200 + +python3.2 (3.2~a1-1) experimental; urgency=low + + * Python 3.2 alpha1 release. + - Files removed: Lib/profile.py, Lib/pstats.py, PC/icons/source.xar. + * Update to the py3k branch (20100827). + * Fix detection of ffi.h header file. Closes: #591408. + * python3.1-dev: Depend on libssl-dev. LP: #611845. + + -- Matthias Klose Fri, 27 Aug 2010 21:40:31 +0200 + +python3.2 (3.2~~20100707-0ubuntu1) maverick; urgency=low + + * Move the pkgconfig file into the -dev package. + * Update preremoval scripts for __pycache__ layout. + * Run hooks from /usr/share/python3/runtime.d/ + * Update distutils-install-layout and debug-build patches. + + -- Matthias Klose Wed, 07 Jul 2010 12:38:52 +0200 + +python3.2 (3.2~~20100706-0ubuntu1) maverick; urgency=low + + * Test build, taken from the py3k branch (20100706). + * Merge with the python3.1 packaging. + + -- Matthias Klose Tue, 06 Jul 2010 17:10:51 +0200 + +python3.2 (3.2~~20100704-0ubuntu1) maverick; urgency=low + + * Test build, taken from the py3k branch (20100704). + + -- Matthias Klose Sun, 04 Jul 2010 16:04:45 +0200 + +python3.2 (3.2~~20100421-0ubuntu1) lucid; urgency=low + + * Test build, taken from the py3k branch (20100421). + + -- Matthias Klose Wed, 21 Apr 2010 22:04:14 +0200 + +python3.1 (3.1.2+20100703-1) unstable; urgency=low + + * Update to the 3.1 release branch, 20100703. + * Convert internal dpatch system to quilt. + * Update module list for python3-minimal. + + -- Matthias Klose Sat, 03 Jul 2010 14:18:18 +0200 + +python3.1 (3.1.2-3) unstable; urgency=low + + * Update to the 3.1 release branch, 20100508. + * Fix backport of issue #8140. Closes: #578896. + + -- Matthias Klose Sat, 08 May 2010 15:37:35 +0200 + +python3.1 (3.1.2-2) unstable; urgency=low + + * Update to the 3.1 release branch, 20100421. + * Update patch for issue #8032, gdb7 hooks for debugging. + * Fix issue #8233: When run as a script, py_compile.py optionally + takes a single argument `-`. + * Don't build-depend on locales on avr32. + + -- Matthias Klose Wed, 21 Apr 2010 21:12:37 +0200 + +python3.1 (3.1.2-1) unstable; urgency=low + + * Python 3.1.2 release. + * Fix issue #4961: Inconsistent/wrong result of askyesno function in + tkMessageBox with Tcl8.5. LP: #462950. + * Don't complain when /usr/local is not writable on installation. + * Apply proposed patch for issue #8032, gdb7 hooks for debugging. + + -- Matthias Klose Sun, 21 Mar 2010 17:59:49 +0100 + +python3.1 (3.1.2~rc1-2) unstable; urgency=low + + * Update to the 3.1 release branch, 20100316. + * Backport issue #8140: Extend compileall to compile single files. + Add -i option. + + -- Matthias Klose Tue, 16 Mar 2010 02:38:45 +0100 + +python3.1 (3.1.2~rc1-1) unstable; urgency=low + + * Python 3.1.2 release candidate 1. + - Replace the Monty Python audio test file. Closes: #568676. + * Build using libdb4.8-dev. Only used for the dbm extension; the bsddb3 + extension isn't built from the core packages anymore. + + -- Matthias Klose Thu, 11 Mar 2010 17:26:17 +0100 + +python3.1 (3.1.1-3) unstable; urgency=low + + * Update to the 3.1 release branch, 20100119. + * Hurd fixes (Pino Toscano): + - hurd-broken-poll.dpatch: ported from 2.5. + - hurd-disable-nonworking-constants.dpatch: disable a few constants from + the public API whose C counterparts are not implemented, so using them + either always blocks or always fails (caused issues in the test suite). + - hurd-path_max.dpatch (hurd only): change few PATH_MAX occurrences to + MAXPATHLEN (which is defined by the python lib if not defined by the OS). + - cthreads.dpatch: Refresh. + - Exclude the profiled build for hurd. + - Disable six blocking tests from the test suite. + * Don't run the testsuite on armel and hppa until someone figures out + the blocking tests. + + -- Matthias Klose Tue, 19 Jan 2010 22:02:14 +0100 + +python3.1 (3.1.1-2) unstable; urgency=low + + * Update to the 3.1 release branch, 20100116. + * Fix bashism in makesetup shell script. Closes: #530170, #530171. + * Fix build issues on avr (Bradley Smith). Closes: #528439. + - Configure --without-ffi. + - Don't run lengthly tests. + + -- Matthias Klose Sat, 16 Jan 2010 23:28:05 +0100 + +python3.1 (3.1.1-1) experimental; urgency=low + + * Python 3.1.1 final release. + * Update to the 3.1 release branch, 20091011. + * Remove /usr/local/lib/python3.1 on package removal, if empty. + * Build _hashlib as a builtin. LP: #445530. + * python3.1-doc: Don't compress the sphinx inventory. + * python3.1-doc: Fix jquery.js symlink. LP: #447370. + * Run the benchmark with -C 2 -n 5 -w 4 on all architectures. + * python3.1-dbg: Don't create debug subdirectory in /usr/local. No + separate debug directory needed anymore. + * Fix title of devhelp document. LP: #423551. + + -- Matthias Klose Sun, 11 Oct 2009 22:01:57 +0200 + +python3.1 (3.1-1) experimental; urgency=low + + * Python 3.1 final release. + * Update to the 3.1 release branch, 20090723. + * Add explicit build dependency on tk8.5-dev. + + -- Matthias Klose Thu, 23 Jul 2009 15:20:35 +0200 + +python3.1 (3.1-0ubuntu2) karmic; urgency=low + + * Disable profile feedback based optimization on amd64 (GCC + PR gcov-profile/38292). + + -- Matthias Klose Fri, 24 Jul 2009 16:27:22 +0200 + +python3.1 (3.1-0ubuntu1) karmic; urgency=low + + * Python 3.1 final release. + * Update to the 3.1 release branch, 20090723. + * Add explicit build dependency on tk8.5-dev. + + -- Matthias Klose Thu, 23 Jul 2009 18:52:17 +0200 + +python3.1 (3.1~rc2+20090622-1) experimental; urgency=low + + [Matthias Klose] + * Python 3.1 rc2 release. Closes: #529320. + * Update to the trunk, 20090622, remove patches integrated upstream. + * Configure with --with-fpectl --with-dbmliborder=bdb --with-wide-unicode. + NOTE: The --with-wide-unicode configuration will break most extensions + built with 3.1~a1, but is consistent with python2.x configurations. + * Add symbols files for libpython3.1 and python3.1-dbg, don't include symbols + from builtins, which can either be built as builtins or extensions. + * Keep an empty lib-dynload in python3.1-minimal to avoid a warning on + startup. + * python3.1-doc: Depend on libjs-jquery, use jquery.js from this package. + Closes: #523485. + * Do not add /usr/lib/pythonXY.zip on sys.path. + * Add symbols files for libpython3.1 and python3.1-dbg, don't include symbols + from builtins, which can either be built as builtins or extensions. + * Keep an empty lib-dynload in python3.1-minimal to avoid a warning on + startup. + * Fix some lintian warnings. + * Use the information in /etc/lsb-release for platform.dist(). LP: #196526. + * Move the bdist_wininst files into the -dev package (only needed to build + windows installers). + * Document changes to the site directory name in the installation manual. + * Don't build a profiled binary. Closes: #521811. + + * Address issues when working with PYTHONUSERBASE and non standard prefix + (pointed out by Larry Hastings): + - distutils.sysconfig.get_python_lib(): Only return ".../dist-packages" if + prefix is the default prefix and if PYTHONUSERBASE is not set in the + environment. + - site.addusersitepackages(): Add USER_BASE/.../dist-packages to sys.path. + * Always use the `unix_prefix' scheme for setup.py install in a virtualenv + setup. LP: #339904. + * Don't make the setup.py install options --install-layout=deb and --prefix + conflict with each other. + * distutils: Always install into `/usr/local/lib/python3.1/dist-packages' + if an option `--prefix=/usr/local' is present (except for virtualenv + and PYTHONUSERBASE installations). LP: #362570. + * Always use `site-packages' as site directory name in virtualenv. + + [Marc Deslauriers] + * debian/pyhtml2devhelp.py: update for sphinx generated documentation. + * debian/rules: re-enable documentation files for devhelp. + + -- Matthias Klose Mon, 22 Jun 2009 16:18:39 +0200 + +python3.1 (3.1~a1+20090322-1) experimental; urgency=low + + * Python 3.1 alpha1 release. + * Update to the trunk, 20090322. + * Update installation schemes: LP: #338395. + - When the --prefix option is used for setup.py install, Use the + `unix_prefix' scheme. + - Use the `deb_system' scheme if --install-layout=deb is specified. + - Use the the `unix_local' scheme if neither --install-layout=deb + nor --prefix is specified. + * Use the information in /etc/lsb-release for platform.dist(). LP: #196526. + * pydoc: Fix detection of local documentation files. + * Build a shared library configured --with-pydebug. LP: #322580. + * Fix some lintian warnings. + + -- Matthias Klose Mon, 23 Mar 2009 00:01:27 +0100 + +python3.1 (3.1~~20090226-1) experimental; urgency=low + + * Python-3.1 snapshot (20090226), upload to experimental. + + -- Matthias Klose Thu, 26 Feb 2009 16:18:41 +0100 + +python3.1 (3.1~~20090222-0ubuntu1) jaunty; urgency=low + + * Python-3.1 snapshot (20090222). + * Build the _dbm extension using the Berkeley DB backend. + + -- Matthias Klose Sun, 22 Feb 2009 12:58:58 +0100 + +python3.0 (3.0.1-0ubuntu4) jaunty; urgency=low + + * Don't build-depend on locales on sparc. Currently not installable. + + -- Matthias Klose Sun, 22 Feb 2009 12:48:38 +0100 + +python3.0 (3.0.1-0ubuntu3) jaunty; urgency=low + + * Update to 20090222 from the release30-maint branch. + + -- Matthias Klose Sun, 22 Feb 2009 11:09:58 +0100 + +python3.0 (3.0.1-0ubuntu2) jaunty; urgency=low + + * Allow docs to be built with Sphinx 0.5.x. + + -- Matthias Klose Tue, 17 Feb 2009 12:58:02 +0100 + +python3.0 (3.0.1-0ubuntu1) jaunty; urgency=low + + * New upstream version. + + -- Matthias Klose Mon, 16 Feb 2009 17:18:23 +0100 + +python3.0 (3.0-0ubuntu2) jaunty; urgency=low + + * Update to 20090213 from the release30-maint branch. + + -- Matthias Klose Fri, 13 Feb 2009 15:49:12 +0100 + +python3.0 (3.0-0ubuntu1) jaunty; urgency=low + + * Final Python-3.0 release. + + -- Matthias Klose Thu, 04 Dec 2008 09:00:09 +0100 + +python3.0 (3.0~rc3-0ubuntu4) jaunty; urgency=low + + * Update to 20081127 from the py3k branch. + * Ensure that all extensions from the -minimal package are statically + linked into the interpreter. LP: #301597. + * Include expat, _elementtree, datetime in -minimal to link + these extensions statically. + + -- Matthias Klose Thu, 27 Nov 2008 08:49:02 +0100 + +python3.0 (3.0~rc3-0ubuntu3) jaunty; urgency=low + + * Ignore errors when running the profile task. + + -- Matthias Klose Sun, 23 Nov 2008 15:50:17 +0100 + +python3.0 (3.0~rc3-0ubuntu2) jaunty; urgency=low + + * Don't run test_ioctl on the buildd, before the buildd chroot is fixed: + Unable to open /dev/tty. + + -- Matthias Klose Sun, 23 Nov 2008 15:28:02 +0100 + +python3.0 (3.0~rc3-0ubuntu1) jaunty; urgency=low + + * Update to the python-3.0 release candidate 3. + + -- Matthias Klose Sun, 23 Nov 2008 13:14:20 +0100 + +python3.0 (3.0~rc1+20081027-0ubuntu1) intrepid; urgency=low + + * Update to 20081027 from the py3k branch. LP: #279227. + * Fix typos and section names in doc-base files. LP: #273344. + * Build a new package libpython3.0. + * For locally installed packages, create a directory + /usr/local/lib/python3.0/dist-packages. This is the default for + installations done with distutils and setuptools. Third party stuff + packaged within the distribution goes to /usr/lib/python3.0/dist-packages. + There is no /usr/lib/python3.0/site-packages in the file system and + on sys.path. No package within the distribution must not install + anything in this location. + * distutils: Add an option --install-layout=deb, which + - installs into $prefix/dist-packages instead of $prefix/site-packages. + - doesn't encode the python version into the egg name. + + -- Matthias Klose Mon, 27 Oct 2008 23:38:42 +0100 + +python3.0 (3.0~b3+20080915-0ubuntu1) intrepid; urgency=low + + * Update to 20080915 from the py3k branch. + * Build gdbm + + -- Matthias Klose Mon, 15 Sep 2008 23:56:44 +0200 + +python3.0 (3.0~b3-0ubuntu1~ppa1) intrepid; urgency=low + + * Python 3.0 beta3 release. + + -- Matthias Klose Sun, 24 Aug 2008 03:49:26 +0200 + +python3.0 (3.0~b2-0ubuntu1~ppa1) intrepid; urgency=low + + * Python 3.0 beta2 release. + + -- Matthias Klose Thu, 07 Aug 2008 14:57:02 +0000 + +python3.0 (3.0~b1-0ubuntu1~ppa1) intrepid; urgency=low + + * Python 3.0 beta1 release. + + -- Matthias Klose Tue, 15 Jul 2008 16:10:52 +0200 + +python3.0 (3.0~a5+0530-0ubuntu1) intrepid; urgency=low + + * Update to snapshot taken from the py3k branch. + + -- Matthias Klose Thu, 29 May 2008 15:50:55 +0200 + +python3.0 (3.0~a1-0ubuntu2) gutsy; urgency=low + + * Disable running the benchmark. + + -- Matthias Klose Fri, 31 Aug 2007 23:22:34 +0000 + +python3.0 (3.0~a1-0ubuntu1) gutsy; urgency=low + + * First Python-3.0 alpha release. + + -- Matthias Klose Fri, 31 Aug 2007 21:26:21 +0200 + +python2.6 (2.6~alpha~pre1-~0ubuntu1~ppa1) gutsy; urgency=low + + * Snapshot build, an "how to use tilde in version numbers" upload. + * SVN 20070831. + + -- Matthias Klose Fri, 31 Aug 2007 15:56:09 +0200 + +python2.5 (2.5.2-4) unstable; urgency=low + + * Update to 20080427, taken from the 2.5 release branch. + - Fix issues #2670, #2682. + * Disable running pybench on the hppa buildd (ftbfs). + * Allow setting BASECFLAGS, OPT and EXTRA_LDFLAGS (like, CC, CXX, CPP, + CFLAGS, CPPFLAGS, CCSHARED, LDSHARED) from the environment. + * Support parallel= in DEB_BUILD_OPTIONS (see #209008). + + -- Matthias Klose Sun, 27 Apr 2008 10:40:51 +0200 + +python2.5 (2.5.2-3) unstable; urgency=medium + + * Update to 20080416, taken from the 2.5 release branch. + - Fix CVE-2008-1721, integer signedness error in the zlib extension module. + - Fix urllib2 file descriptor happens byte-at-a-time, reverting + a fix for excessively large memory allocations when calling .read() + on a socket object wrapped with makefile(). + * Disable some regression tests on some architectures: + - arm: test_compiler, test_ctypes. + - armel: test_compiler. + - hppa: test_fork1, test_wait3. + - m68k: test_bsddb3, test_compiler. + * Build-depend on libffi-dev instead of libffi4-dev. + * Fix CVE-2008-1679, integer overflows in the imageop module. + + -- Matthias Klose Wed, 16 Apr 2008 23:37:46 +0200 + +python2.5 (2.5.2-2) unstable; urgency=low + + * Use site.addsitedir() to add directories in /usr/local to sys.path. + Addresses: #469157, #469818. + + -- Matthias Klose Sat, 08 Mar 2008 16:11:23 +0100 + +python2.5 (2.5.2-1) unstable; urgency=low + + * Python 2.5.2 release. + * Merge from Ubuntu: + - Move site customization into sitecustomize.py, don't make site.py + a config file. Addresses: #309719, #413172, #457361. + - Move site.py to python2.4-minimal, remove `addbuilddir' from site.py, + which is unnecessary for installed builds. + - python2.5-dev: Recommend libc-dev instead of suggesting it. LP: #164909. + - Fix issue 961805, Tk Text.edit_modified() fails. LP: #84720. + + -- Matthias Klose Thu, 28 Feb 2008 23:18:52 +0100 + +python2.5 (2.5.1-7) unstable; urgency=low + + * Update to 20080209, taken from the 2.5 release branch. + * Build the _bsddb extension with db-4.5 again; 4.6 is seriously + broken when used with the _bsddb extension. + * Do not run pybench on arm and armel. + * python2.5: Provide python2.5-wsgiref. + * Fix a pseudo RC report with duplicated attributes in the control + file. Closes: #464307. + + -- Matthias Klose Sun, 10 Feb 2008 00:22:57 +0100 + +python2.5 (2.5.1-6) unstable; urgency=low + + * Update to 20080102, taken from the 2.5 release branch. + - Only define _BSD_SOURCE on OpenBSD systems. Closes: #455400. + * Fix handling of packages in linecache.py (Kevin Goodsell). LP: #70902. + * Bump debhelper to v5. + * Register binfmt for .py[co] files. + * Use absolute paths when byte-compiling files. Addresses: #453346. + Closes: #413566, LP: #177722. + * CVE-2007-4965, http://bugs.python.org/issue1179: + Multiple integer overflows in the imageop module in Python 2.5.1 and + earlier allow context-dependent attackers to cause a denial of service + (application crash) and possibly obtain sensitive information (memory + contents) via crafted arguments to (1) the tovideo method, and unspecified + other vectors related to (2) imageop.c, (3) rbgimgmodule.c, and other + files, which trigger heap-based buffer overflows. + Patch prepared by Stephan Herrmann. Closes: #443333, LP: #163845. + * Register info docs when doing source only uploads. LP: #174786. + * Remove deprecated value from categories in desktop file. LP: #172874. + * python2.5-dbg: Don't include the gdbm and _tkinter extensions, now provided + in separate packages. + * Provide a symlink changelog -> NEWS. Closes: #439271. + * Fix build failure on hurd, working around poll() on systems on which it + returns an error on invalid FDs. Closes: #438914. + * Configure --with-system-ffi on all architectures. Closes: #448520. + * Fix version numbers in copyright and README files (Dan O'Huiginn). + Closes: #446682. + * Move some documents from python2.5 to python2.5-dev. + + -- Matthias Klose Wed, 02 Jan 2008 22:22:19 +0100 + +python2.5 (2.5.1-5) unstable; urgency=low + + * Build the _bsddb extension with db-4.6. + + -- Matthias Klose Fri, 17 Aug 2007 00:39:35 +0200 + +python2.5 (2.5.1-4) unstable; urgency=low + + * Update to 20070813, taken from the 2.5 release branch. + * Include plat-mac/plistlib.py (plat-mac is not in sys.path by default. + Closes: #435826. + * Use emacs22 to build the documentation in info format. Closes: #434969. + * Build-depend on db-dev (>= 4.6). Closes: #434965. + + -- Matthias Klose Mon, 13 Aug 2007 22:22:44 +0200 + +python2.5 (2.5.1-3) unstable; urgency=high + + * Support mixed-endian IEEE floating point, as found in the ARM old-ABI + (Aurelien Jarno). Closes: #434905. + + -- Matthias Klose Fri, 27 Jul 2007 20:01:35 +0200 + +python2.5 (2.5.1-2) unstable; urgency=low + + * Update to 20070717, taken from the 2.5 release branch. + * Fix reference count for sys.pydebug variable. Addresses: #431393. + * Build depend on libbluetooth-dev instead of libbluetooth2-dev. + + -- Matthias Klose Tue, 17 Jul 2007 14:09:47 +0200 + +python2.5 (2.5.1-1) unstable; urgency=low + + * Python-2.5.1 release. + * Build-depend on gcc-4.1 (>= 4.1.2-4) on alpha, powerpc, s390, sparc. + * Merge from Ubuntu: + - Add debian/patches/subprocess-eintr-safety.dpatch (LP: #87292): + - Create and use wrappers around read(), write(), and os.waitpid() in the + subprocess module which retry the operation on an EINTR (which happens + if e. g. an alarm was raised while the system call was in progress). + It is incredibly hard and inconvenient to sensibly handle this in + applications, so let's fix this at the right level. + - Patch based on original proposal of Peter <85>strand + in http://python.org/sf/1068268. + - Add two test cases. + - Change the interpreter to build and install python extensions + built with the python-dbg interpreter with a different name into + the same path (by appending `_d' to the extension name). The debug build + of the interpreter tries to first load a foo_d.so or foomodule_d.so + extension, then tries again with the normal name. + - When trying to import the profile and pstats modules, don't + exit, add a hint to the exception pointing to the python-profiler + package, don't exit. + - Keep the module version in the .egg-info name, only remove the + python version. + - python2.5-dbg: Install Misc/SpecialBuilds.txt, document the + debug changes in README.debug. + * Update to 20070425, taken from the 2.5 release branch. + + -- Matthias Klose Wed, 25 Apr 2007 22:12:50 +0200 + +python2.5 (2.5-6) unstable; urgency=medium + + * webbrowser.py: Recognize other browsers: www-browser, x-www-browser, + iceweasel, iceape. + * Move pyconfig.h from the python2.5-dev into the python2.5 package; + required by builds for pure python modules without having python2.5-dev + installed (matching the functionality in python2.4). + * Move the unicodedata module into python2.5-minimal; allows byte compilation + of UTF8 encoded files. + * Do not install anymore outdated debhelper sample scripts. + * Install Misc/SpecialBuilds.txt as python2.5-dbg document. + + -- Matthias Klose Wed, 21 Feb 2007 01:17:12 +0100 + +python2.5 (2.5-5) unstable; urgency=high + + * Do not run the python benchmark on m68k. Timer problems. + Fixes FTBFS on m68k. + * Update to 20061209, taken from the 2.5 release branch. + - Fixes building the library reference in info format. + + -- Matthias Klose Sat, 9 Dec 2006 13:40:48 +0100 + +python2.5 (2.5-4) unstable; urgency=medium + + * Update to 20061203, taken from the 2.5 release branch. + - Fixes build failures on knetfreebsd and the hurd. Closes: #397000. + * Clarify README about distutils. Closes: #396394. + * Move python2.5-config to python2.5-dev. Closes: #401451. + * Cleanup build-conflicts. Addresses: #394512. + + -- Matthias Klose Sun, 3 Dec 2006 18:22:49 +0100 + +python2.5 (2.5-3.1) unstable; urgency=low + + * Non-maintainer upload. + * python2.5-minimal depends on python-minimal (>= 2.4.4-1) because it's the + first version which lists python2.5 as an unsupported runtime (ie a + runtime that is available but for which modules are not auto-compiled). + And being listed there is required for python-central to accept the + installation of python2.5-minimal. Closes: #397006 + + -- Raphael Hertzog Wed, 22 Nov 2006 15:41:06 +0100 + +python2.5 (2.5-3) unstable; urgency=medium + + * Update to 20061029 (2.4.4 was released on 20061019), taken from + the 2.5 release branch. We do not want to have regressions in + 2.5 compared to the 2.4.4 release. + * Don't run pybench on m68k, fails in the calibration loop. Closes: #391030. + * Run the installation/removal hooks. Closes: #383292, #391036. + + -- Matthias Klose Sun, 29 Oct 2006 11:35:19 +0100 + +python2.5 (2.5-2) unstable; urgency=medium + + * Update to 20061003, taken from the 2.5 release branch. + * On arm and m68k, don't run the pybench in debug mode. + * Fix building the source within exec_prefix (Alexander Wirt). + Closes: #385336. + + -- Matthias Klose Tue, 3 Oct 2006 10:08:36 +0200 + +python2.5 (2.5-1) unstable; urgency=low + + * Python 2.5 release. + * Update to 20060926, taken from the 2.5 release branch. + * Run the Python benchmark during the build, compare the results + of the static and shared builds. + * Fix invalid html in python2.5.devhelp.gz. + * Add a python2.5 console entry to the menu (hidden by default). + * python2.5: Suggest python-profiler. + + -- Matthias Klose Tue, 26 Sep 2006 02:36:11 +0200 + +python2.5 (2.5~c1-1) unstable; urgency=low + + * Python 2.5 release candidate 1. + * Update to trunk 20060818. + + -- Matthias Klose Sat, 19 Aug 2006 19:21:05 +0200 + +python2.5 (2.5~b3-1) unstable; urgency=low + + * Build the _ctypes module for m68k-linux. + + -- Matthias Klose Fri, 11 Aug 2006 18:19:19 +0000 + +python2.5 (2.5~b3-0ubuntu1) edgy; urgency=low + + * Python 2.5 beta3 release. + * Update to trunk 20060811. + * Rebuild the documentation. + * Fix value of sys.exec_prefix in the debug build. + * Do not build the library reference in info format; fails to build. + * Link the interpreter against the shared runtime library. With + gcc-4.1 the difference in the pystones benchmark dropped from about + 12% to about 6%. + * Install the statically linked version of the interpreter as + python2.5-static for now. + * Link the shared libpython with -O1. + + -- Matthias Klose Thu, 10 Aug 2006 14:04:48 +0000 + +python2.5 (2.4.3+2.5b2-3) unstable; urgency=low + + * Disable the testsuite on s390; don't care about "minimally configured" + buildd's. + + -- Matthias Klose Sun, 23 Jul 2006 11:45:03 +0200 + +python2.5 (2.4.3+2.5b2-2) unstable; urgency=low + + * Update to trunk 20060722. + * Merge idle-lib from idle-python2.5 into python2.5. + * Merge lib-tk from python-tk into python2.5. + * Tkinter.py: Suggest installation of python-tk package on failed + import of the _tkinter extension. + * Don't run the testsuite for the debug build on alpha. + * Don't run the test_compiler test on m68k. Just takes too long. + * Disable building ctypes on m68k (requires support for closures). + + -- Matthias Klose Sat, 22 Jul 2006 22:26:42 +0200 + +python2.5 (2.4.3+2.5b2-1) unstable; urgency=low + + * Python 2.5 beta2 release. + * Update to trunk 20060716. + * When built on a buildd, do not run the following test which try to + access the network: test_codecmaps_cn, test_codecmaps_hk, test_codecmaps_jp, + test_codecmaps_kr, test_codecmaps_tw, test_normalization. + * When built on a buildd, do not run tests requiring missing write permissions: + test_ossaudiodev. + + -- Matthias Klose Sun, 16 Jul 2006 02:53:50 +0000 + +python2.5 (2.4.3+2.5b2-0ubuntu1) edgy; urgency=low + + * Python 2.5 beta2 release. + + -- Matthias Klose Thu, 13 Jul 2006 17:16:52 +0000 + +python2.5 (2.4.3+2.5b1-1ubuntu2) edgy; urgency=low + + * Fix python-dev dependencies. + * Update to trunk 20060709. + + -- Matthias Klose Sun, 9 Jul 2006 18:50:32 +0200 + +python2.5 (2.4.3+2.5b1-1ubuntu1) edgy; urgency=low + + * Python 2.5 beta1 release. + * Update to trunk 20060623. + * Merge changes from the python2.4 packages. + * python2.5-minimal: Add _struct. + + -- Matthias Klose Fri, 23 Jun 2006 16:04:46 +0200 + +python2.5 (2.4.3+2.5a1-1) experimental; urgency=low + + * Update to trunk 20060409. + * Run testsuite for debug build as well. + * Build-depend on gcc-4.1. + + -- Matthias Klose Sun, 9 Apr 2006 22:27:05 +0200 + +python2.5 (2.4.3+2.5a1-0ubuntu1) dapper; urgency=low + + * Python 2.5 alpha1 release. + * Drop integrated patches. + * Add build dependencies on libsqlite3-dev and libffi4-dev. + * Add (build-)dependency on mime-support, libgpmg1 (test suite). + * Build using the system FFI. + * python2.5 provides python2.5-ctypes and python2.5-pysqlite2, + python2.5-elementtree. + * Move hashlib.py to python-minimal. + * Lib/hotshot/pstats.py: Error out on missing profile/pstats modules. + + -- Matthias Klose Wed, 5 Apr 2006 14:56:15 +0200 + +python2.4 (2.4.3-8ubuntu1) edgy; urgency=low + + * Resynchronize with Debian unstable. Remaining changes: + - Apply langpack-gettext patch. + - diff.gz contains pregenerated html and info docs. + - Build the -doc package from this source. + + -- Matthias Klose Thu, 22 Jun 2006 18:39:57 +0200 + +python2.4 (2.4.3-8) unstable; urgency=low + + * Remove python2.4's dependency on python-central. On installation of + the runtime, call hooks /usr/share/python/runtime.d/*.rtinstall. + On removal, call hooks /usr/share/python/runtime.d/*.rtremove. + Addresses: #372658. + * Call the rtinstall hooks only, if it's a new installation, or the first + installation using the hooks. Adresses: #373677. + + -- Matthias Klose Sun, 18 Jun 2006 00:56:13 +0200 + +python2.4 (2.4.3-7) unstable; urgency=medium + + * Reupload, depend on python-central (>= 0.4.15). + * Add build-conflict on python-xml. + + -- Matthias Klose Wed, 14 Jun 2006 18:56:57 +0200 + +python2.4 (2.4.3-6) medium; urgency=low + + * idle-python2.4: Remove the old postinst and prerm scripts. + * Name the runtime correctly in python2.4-minimal's installation + scripts. + + -- Matthias Klose Mon, 12 Jun 2006 17:39:56 +0000 + +python2.4 (2.4.3-5) unstable; urgency=low + + * python2.4-prerm: Handle the case, when python-central is not installed. + * idle-python2.4: Depend on python-tk instead of python2.4-tk. + + -- Matthias Klose Fri, 9 Jun 2006 05:17:17 +0200 + +python2.4 (2.4.3-4) unstable; urgency=low + + * SVN update up to 2006-06-07 + * Use python-central. + * Don't build the -tk and -gdbm packages from this source; now built + from the python-stdlib-extensions source. + * Remove leftover build dependency on libgmp3-dev. + * Do not build-depend on libbluetooth1-dev and libgpmg1-dev on + hurd-i386, kfreebsd-i386, kfreebsd-amd64. Closes: #365830. + * Do not run the test_tcl test; hangs for unknown reasons on at least + the following buildds: vivaldi(m68k), goedel (alpha), mayer (mipsel). + And no virtual package to file bug reports for the buildds ... + Closes: #364419. + * Move the Makefile from python2.4-dev to python2.4. Closes: #366473. + * Fix typo in pdb(1). Closes: #365772. + * New autoconf likes the mandir in /usr/share instead of /usr; work + with both locations. Closes: #367618. + + -- Matthias Klose Wed, 7 Jun 2006 21:37:20 +0200 + +python2.4 (2.4.3-3) unstable; urgency=low + + * SVN update up to 2006-04-21 + * Update locale aliases from /usr/share/X11/locale/locale.alias. + * Start idle with option -n from the desktop menu, so that the program + can be started in parallel. + * Testsuite related changes only: + - Add build dependencies mime-support, libgpmg1 (needed by test cases). + - Run the testsuite with bsddb, audio and curses resources enabled. + - Re-run the failed tests in verbose mode. + - Run the test suite for the debug build as well. + - Build depend on netbase, needed by test_socketmodule. + - Build depend on libgpmg1, needed by test_curses. + - On the buildds do not run the tests needing the network resource. + * Update python logo. + * Check for the availability of the profile and pstats modules when + importing hotshot.pstats. Closes: #334067. + * Don't build the -doc package from the python2.4 source. + * Set OPT in the installed Makefile to -O2. + + -- Matthias Klose Fri, 21 Apr 2006 19:58:43 +0200 + +python2.4 (2.4.3-2) unstable; urgency=low + + * Add (build-)dependency on mime-support. + + -- Matthias Klose Tue, 4 Apr 2006 22:21:41 +0200 + +python2.4 (2.4.3-1) unstable; urgency=low + + * Python 2.4.3 release. + + -- Matthias Klose Thu, 30 Mar 2006 23:42:37 +0200 + +python2.4 (2.4.3-0ubuntu1) dapper; urgency=low + + * Python 2.4.3 release. + - Fixed a bug that the gb18030 codec raises RuntimeError on encoding + surrogate pair area on UCS4 build. Ubuntu: #29289. + + -- Matthias Klose Thu, 30 Mar 2006 10:57:32 +0200 + +python2.4 (2.4.2+2.4.3c1-0ubuntu1) dapper; urgency=low + + * SVN update up to 2006-03-25 (2.4.3 candidate 1). + - Regenerate the documentation. + + -- Matthias Klose Mon, 27 Mar 2006 12:03:05 +0000 + +python2.4 (2.4.2-1ubuntu3) dapper; urgency=low + + * SVN update up to 2006-03-04 + - Regenerate the documentation. + - map.mmap(-1, size, ...) can return anonymous memory again on Unix. + Ubuntu #26201. + * Build-depend on libncursesw5-dev, ncursesw5 is preferred for linking. + Provides UTF-8 compliant curses bindings. + * Fix difflib where certain patterns of differences were making difflib + touch the recursion limit. + + -- Matthias Klose Sat, 4 Mar 2006 21:38:24 +0000 + +python2.4 (2.4.2-1ubuntu2) dapper; urgency=low + + * SVN update up to 2006-01-17 + - pwd is now a builtin module, remove it from python-minimal. + - Regenerate the documentation. + * python2.4-tk: Suggest tix instead of tix8.1. + * Move config/Makefile from the -dev package into the runtime package + to be able to use the bdist_wininst distutils command. Closes: #348335. + + -- Matthias Klose Tue, 17 Jan 2006 11:02:24 +0000 + +python2.4 (2.4.2-1ubuntu1) dapper; urgency=low + + * Temporarily remove build dependency on lsb-release. + + -- Matthias Klose Sun, 20 Nov 2005 17:40:18 +0100 + +python2.4 (2.4.2-1build1) dapper; urgency=low + + * Rebuild (openssl-0.9.8). + + -- Matthias Klose Sun, 20 Nov 2005 15:27:24 +0000 + +python2.4 (2.4.2-1) unstable; urgency=low + + * Python 2.4.2 release. + + -- Matthias Klose Thu, 29 Sep 2005 01:49:28 +0200 + +python2.4 (2.4.1+2.4.2rc1-1) unstable; urgency=low + + * Python 2.4.2 release candidate 1. + * Fix "Fatal Python error" from cStringIO's writelines. + Patch by Andrew Bennetts. + + -- Matthias Klose Thu, 22 Sep 2005 10:33:22 +0200 + +python2.4 (2.4.1-5) unstable; urgency=low + + * CVS update up to 2005-09-14 + - Regenerate the html and info docs. + * Add some more locale aliases. + * Fix substitution pf python version in README.python2.4-minimal. + Closes: #327487. + * On m68k, build using -O2 (closes: #326903). + * On Debian, don't configure --with-fpectl, which stopped working with + glibc-2.3.5. + + -- Matthias Klose Wed, 14 Sep 2005 17:32:56 +0200 + +python2.4 (2.4.1-4) unstable; urgency=low + + * CVS update up to 2005-09-04 + - teTeX 3.0 related fixes (closes: #322407). + - Regenerate the html and info docs. + * Add entry for IDLE in the Gnome menus. + * Don't build-depend on libbluetooth-dev on the Hurd (closes: #307037). + * Reenable the cthreads patch for the Hurd (closes: #307052). + + -- Matthias Klose Sun, 4 Sep 2005 18:31:42 +0200 + +python2.4 (2.4.1-3) unstable; urgency=low + + * Synchronise with Ubuntu: + - Build a python2.4-minimal package. + + -- Matthias Klose Tue, 12 Jul 2005 00:23:10 +0000 + +python2.4 (2.4.1-2ubuntu3) breezy; urgency=low + + * CVS update up to 2005-07-07 + * Regenerate the documentation. + + -- Matthias Klose Thu, 7 Jul 2005 09:21:28 +0200 + +python2.4 (2.4.1-2ubuntu2) breezy; urgency=low + + * CVS update up to 2005-06-15 + * Regenerate the documentation. + * Synchronize with Debian. Ubuntu 10485. + * idle-python2.4 enhances python2.4. Ubuntu 11562. + * README.Debian: Fix reference to the doc directory (closes: #311677). + + -- Matthias Klose Wed, 15 Jun 2005 08:56:57 +0200 + +python2.4 (2.4.1-2ubuntu1) breezy; urgency=low + + * Update build dependencies: + db4.2-dev -> db4.3-dev, + libreadline4-dev -> libreadline5-dev. + * python2.4-dev: Add missing templates to generate HTML docs. Ubuntu 11531. + + -- Matthias Klose Sun, 29 May 2005 00:01:05 +0200 + +python2.4 (2.4.1-2) unstable; urgency=low + + * Add the debug symbols for the python2.4, python2.4-gdbm + and python2.4-tk packages to the python2.4-dbg package. + * Add gdbinit example to doc directory. + + -- Matthias Klose Thu, 5 May 2005 11:12:32 +0200 + +python2.4 (2.4.1-1ubuntu2) breezy; urgency=low + + * Add the debug symbols for the python2.4, python2.4-minimal, python2.4-gdbm + and python2.4-tk packages to the python2.4-dbg package. Ubuntu 10261, + * Add gdbinit example to doc directory. + * For os.utime, use utimes(2), correctly working with glibc-2.3.5. + Ubuntu 10294. + + -- Matthias Klose Thu, 5 May 2005 09:06:07 +0200 + +python2.4 (2.4.1-1ubuntu1) breezy; urgency=low + + * Reupload as 2.4.1-1ubuntu1. + + -- Matthias Klose Thu, 14 Apr 2005 10:46:32 +0200 + +python2.4 (2.4.1-1) unstable; urgency=low + + * Python 2.4.1 release. + * Fix noise in python-doc installation/removal. + * New Python section for the info docs. + + -- Matthias Klose Wed, 30 Mar 2005 19:42:03 +0200 + +python2.4 (2.4.1-0) hoary; urgency=low + + * Python 2.4.1 release. + * Fix noise in python-doc installation/removal. + * New Python section for the info docs. + + -- Matthias Klose Wed, 30 Mar 2005 16:35:34 +0200 + +python2.4 (2.4+2.4.1rc2-2) unstable; urgency=low + + * Add the valgrind support file to /etc/python2.4 + * Build the -dbg package with -DPy_USING_MEMORY_DEBUGGER. + * Lib/locale.py: + - correctly parse LANGUAGE as a colon separated list of languages. + - prefer LC_ALL, LC_CTYPE and LANG over LANGUAGE to get the correct + encoding. + - Don't map 'utf8', 'utf-8' to 'utf', which is not a known encoding + for glibc. + * Fix two typos in python(1). Addresses: #300124. + + -- Matthias Klose Sat, 19 Mar 2005 21:50:14 +0100 + +python2.4 (2.4+2.4.1rc2-1) unstable; urgency=low + + * Python 2.4.1 release candidate 2. + * Build-depend on libbluetooth1-dev. + + -- Matthias Klose Sat, 19 Mar 2005 00:57:14 +0100 + +python2.4 (2.4dfsg-2) unstable; urgency=low + + * CVS update up to 2005-03-03 + + -- Matthias Klose Thu, 3 Mar 2005 22:22:16 +0100 + +python2.4 (2.4dfsg-1ubuntu4) hoary; urgency=medium + + * Move exception finalisation later in the shutdown process - this + fixes the crash seen in bug #1165761, taken from CVS. + * codecs.StreamReader: Reset codec when seeking. Ubuntu #6972. + * Apply fix for SF1124295, fixing an obscure bit of Zope's security machinery. + * distutils: Don't add standard library dirs to library_dirs + and runtime_library_dirs. On amd64, runtime paths pointing to /usr/lib64 + aren't recognized by dpkg-shlibdeps, and the packages containing these + libraries aren't added to ${shlibs:Depends}. + * Lib/locale.py: + - correctly parse LANGUAGE as a colon separated list of languages. + - prefer LC_ALL, LC_CTYPE and LANG over LANGUAGE to get the correct + encoding. + - Don't map 'utf8', 'utf-8' to 'utf', which is not a known encoding + for glibc. + * os.py: Avoid using items() in environ.update(). Fixes #1124513. + * Python/pythonrun.c: + * Build depend on locales, generate the locales needed for the + testsuite. + * Add build dependency on libbluetooth1-dev, adding some bluetooth + functionality to the socket module. + * Lib/test/test_sundry.py: Don't fail on import of profile & pstats, + which are separated out to the python-profiler package. + * Fix typos in manpage. + + -- Matthias Klose Tue, 29 Mar 2005 13:35:53 +0200 + + +python2.4 (2.4dfsg-1ubuntu3) hoary; urgency=low + + * debian/patches/langpack-gettext.dpatch: + - langpack support for python-gettext added + + -- Michael Vogt Tue, 1 Mar 2005 13:13:36 +0100 + +python2.4 (2.4dfsg-1ubuntu2) hoary; urgency=low + + * Revert 'essential' status on python2.4-minimal. This status on + on python-minimal is sufficient (Ubuntu #6392). + + -- Matthias Klose Wed, 9 Feb 2005 23:09:42 +0100 + +python2.4 (2.4dfsg-1ubuntu1) hoary; urgency=low + + * Resyncronise with Debian. + * Mark the python2.4-minimal package as 'essential'. + + -- Matthias Klose Wed, 9 Feb 2005 13:31:09 +0100 + +python2.4 (2.4dfsg-1) unstable; urgency=medium + + * Add licenses and acknowledgements for incorporated software in the + debian/copyright file (addresses: #293932). + * Replace md5 implementation with one having a DFSG conforming license. + * Remove the profile.py and pstats.py modules from the source package, + not having a DFSG conforming license. The modules can be found in + the python2.x-profile package in the non-free section. + Addresses: #293932. + * Add missing norwegian locales (Tollef Fog Heen). + * CVS updates of the release24-maint branch upto 2005-02-08 (date of + the Python 2.3.5 release). + + -- Matthias Klose Tue, 8 Feb 2005 19:13:10 +0100 + +python2.4 (2.4-7ubuntu1) hoary; urgency=low + + * Fix the name of the python-dbg man page. + * Resyncronise with Debian. + * Move more modules to -minimal (new code in copy.py requires these): + dis, inspect, opcode, token, tokenize. + + -- Matthias Klose Tue, 8 Feb 2005 19:13:10 +0100 + +python2.4 (2.4-7) unstable; urgency=medium + + * Add licenses and acknowledgements for incorporated software in the + debian/copyright file (addresses: #293932). + * Replace md5 implementation with one having a DFSG conforming license. + * Add missing norwegian locales (Tollef Fog Heen). + * CVS updates of the release24-maint branch upto 2005-02-08 (date of + the Python 2.3.5 release). + + -- Matthias Klose Tue, 8 Feb 2005 19:13:10 +0100 + +python2.4 (2.4-6) unstable; urgency=low + + * Build a python2.4-dbg package using --with-pydebug. Add a debug + directory /lib-dynload/debug to sys.path instead of + /lib-dynload und install the extension modules of the + debug build in this directory. + Change the module load path to load extension modules from other + site-packages/debug directories (for further details see the + README in the python2.4-dbg package). Closes: #5415. + * Apply the pydebug-path patch. The package was already built in -5. + + -- Matthias Klose Fri, 4 Feb 2005 22:15:13 +0100 + +python2.4 (2.4-5) unstable; urgency=high + + * Fix a flaw in SimpleXMLRPCServerthat can affect any XML-RPC servers. + This affects any programs have been written that allow remote + untrusted users to do unrestricted traversal and can allow them to + access or change function internals using the im_* and func_* attributes. + References: CAN-2005-0089. + * CVS updates of the release24-maint branch upto 2005-02-04. + + -- Matthias Klose Fri, 4 Feb 2005 08:12:10 +0100 + +python2.4 (2.4-4) unstable; urgency=medium + + * Update debian/copyright to the 2.4 license text (closes: #290898). + * Remove /usr/bin/smtpd.py (closes: #291049). + + -- Matthias Klose Mon, 17 Jan 2005 23:54:37 +0100 + +python2.4 (2.4-3ubuntu6) hoary; urgency=low + + * Use old-style dpatches instead of dpatch-run. + + -- Tollef Fog Heen Mon, 7 Feb 2005 15:58:05 +0100 + +python2.4 (2.4-3ubuntu5) hoary; urgency=low + + * Actually apply the patch as well (add to list of patches in + debian/rules) + + -- Tollef Fog Heen Sun, 6 Feb 2005 15:12:58 +0100 + +python2.4 (2.4-3ubuntu4) hoary; urgency=low + + * Add nb_NO and nn_NO locales to Lib/locale.py + + -- Tollef Fog Heen Sun, 6 Feb 2005 14:33:05 +0100 + +python2.4 (2.4-3ubuntu3) hoary; urgency=low + + * Fix a flaw in SimpleXMLRPCServerthat can affect any XML-RPC servers. + This affects any programs have been written that allow remote + untrusted users to do unrestricted traversal and can allow them to + access or change function internals using the im_* and func_* attributes. + References: CAN-2005-0089. + + -- Matthias Klose Wed, 2 Feb 2005 09:08:20 +0000 + +python2.4 (2.4-3ubuntu2) hoary; urgency=low + + * Build a python2.4-dbg package using --with-pydebug. Add a debug + directory /lib-dynload/debug to sys.path instead of + /lib-dynload und install the extension modules of the + debug build in this directory. + Change the module load path to load extension modules from other + site-packages/debug directories (for further details see the + README in the python2.4-dbg package). Closes: #5415. + * Update debian/copyright to the 2.4 license text (closes: #290898). + * Add operator and copy to the -minimal package. + + -- Matthias Klose Mon, 17 Jan 2005 23:19:47 +0100 + +python2.4 (2.4-3ubuntu1) hoary; urgency=low + + * Resynchronise with Debian. + * python2.4: Depend on the very same version of python2.4-minimal. + * Docment, that time.strptime currently cannot be used, if the + python-minimal package is installed without the python package. + + -- Matthias Klose Sun, 9 Jan 2005 19:35:48 +0100 + +python2.4 (2.4-3) unstable; urgency=medium + + * Build the fpectl module. + * Updated to CVS release24-maint 20050107. + + -- Matthias Klose Sat, 8 Jan 2005 19:05:21 +0100 + +python2.4 (2.4-2ubuntu5) hoary; urgency=low + + * Updated to CVS release24-maint 20050102. + * python-minimal: + - os.py: Use dict instead of UserDict, remove UserDict from -minimal. + - add pickle, threading, needed for subprocess module. + - optparse.py: conditionally import gettext, if not available, + define _ as the identity function. Patch taken from the trunk. + Avoids import of _locale, locale, gettext, copy, repr, itertools, + collections, token, tokenize. + - Add a build check to make sure that the minimal module list is + closed under dependency. + * Fix lintian warnings. + + -- Matthias Klose Sun, 2 Jan 2005 22:00:14 +0100 + +python2.4 (2.4-2ubuntu4) hoary; urgency=low + + * Add UserDict.py to the -minimal package, since os.py needs it. + + -- Colin Watson Thu, 30 Dec 2004 20:41:28 +0000 + +python2.4 (2.4-2ubuntu3) hoary; urgency=low + + * Add os.py and traceback.py to the -minimal package, get the list + of modules from the README. + + -- Matthias Klose Mon, 27 Dec 2004 08:20:45 +0100 + +python2.4 (2.4-2ubuntu2) hoary; urgency=low + + * Add compileall.py and py_compile.py to the -minimal package, not + just to the README ... + + -- Matthias Klose Sat, 25 Dec 2004 22:24:56 +0100 + +python2.4 (2.4-2ubuntu1) hoary; urgency=low + + * Separate the interpreter and a minimal subset of modules into + a python2.4-minimal package. See the README.Debian.gz in this + package. + * Move site.py to python2.4-minimal as well. + * Add documentation files for devhelp. + + -- Matthias Klose Sun, 19 Dec 2004 22:47:32 +0100 + +python2.4 (2.4-2) unstable; urgency=medium + + * Updated patch for #283108. Thanks to Jim Meyering. + + -- Matthias Klose Fri, 3 Dec 2004 17:00:16 +0100 + +python2.4 (2.4-1) unstable; urgency=low + + * Final 2.4 release. + * Flush stdout/stderr if closed (SF #1074011). + + -- Matthias Klose Wed, 1 Dec 2004 07:54:34 +0100 + +python2.4 (2.3.97-2) unstable; urgency=low + + * Don't run test_tcl, hanging on the buildds. + + -- Matthias Klose Fri, 19 Nov 2004 23:48:42 +0100 + +python2.4 (2.3.97-1) unstable; urgency=low + + * Python 2.4 Release Candidate 1. + + -- Matthias Klose Fri, 19 Nov 2004 21:27:02 +0100 + +python2.4 (2.3.96-1) experimental; urgency=low + + * Updated to CVS release24-maint 20041113. + * Build the docs in info format again. + + -- Matthias Klose Sat, 13 Nov 2004 21:21:10 +0100 + +python2.4 (2.3.95-2) experimental; urgency=low + + * Move distutils package from the python2.4-dev into the python2.4 + package. + + -- Matthias Klose Thu, 11 Nov 2004 22:56:14 +0100 + +python2.4 (2.3.95-1) experimental; urgency=low + + * Python 2.4 beta2 release. + + -- Matthias Klose Thu, 4 Nov 2004 23:43:47 +0100 + +python2.4 (2.3.94-1) experimental; urgency=low + + * Python 2.4 beta1 release. + + -- Matthias Klose Sat, 16 Oct 2004 08:33:57 +0200 + +python2.4 (2.3.93-1) experimental; urgency=low + + * Python 2.4 alpha3 release. + + -- Matthias Klose Fri, 3 Sep 2004 21:53:47 +0200 + +python2.4 (2.3.92-1) experimental; urgency=low + + * Python 2.4 alpha2 release. + + -- Matthias Klose Thu, 5 Aug 2004 23:53:18 +0200 + +python2.4 (2.3.91-1) experimental; urgency=low + + * Python 2.4 alpha1 release. + Highlights: http://www.python.org/2.4/highlights.html + + -- Matthias Klose Fri, 9 Jul 2004 17:38:54 +0200 + +python2.4 (2.3.90-1) experimental; urgency=low + + * Package HEAD branch (pre alpha ..). + + -- Matthias Klose Mon, 14 Jun 2004 23:19:57 +0200 + +python2.3 (2.3.4-1) unstable; urgency=medium + + * Final Python 2.3.4 Release. + * In the API docs, fix signature of PyModule_AddIntConstant (closes: #250826). + * locale.getdefaultlocale: don't fail with empty environment variables. + Closes: #249816. + * Include distutils/command/wininst.exe in -dev package (closes: #249006). + * Disable cthreads on the Hurd (Michael Banck). Closes: #247211. + * Add a note to pygettext(1), that this program is deprecated in favour + of xgettext, which now includes support for Python as well. + Closes: #246332. + + -- Matthias Klose Fri, 28 May 2004 22:59:42 +0200 + +python2.3 (2.3.3.91-1) unstable; urgency=low + + * Python 2.3.4 Release Candidate 1. + * Do not use the default namespace for attributes. Patch taken from the + 2.3 maintenance branch. + The xmllib module is obsolete. Use xml.sax instead. + * http://python.org/sf/945642 - fix nonblocking i/o with ssl socket. + + -- Matthias Klose Thu, 13 May 2004 21:24:52 +0200 + +python2.3 (2.3.3-7) unstable; urgency=low + + * Add a workaround for GNU libc nl_langinfo()'s returning NULL. + Closes: #239237. + Patch taken from 2.3 maintenance branch. + * threading.py: Remove calls to currentThread() in _Condition methods that + were side-effect. Side-effects were deemed unnecessary and were causing + problems at shutdown time when threads were catching exceptions at start + time and then triggering exceptions trying to call currentThread() after + gc'ed. Masked the initial exception which was deemed bad. + Closes: #195812. + * Properly support normalization of empty unicode strings. Closes: #239986. + Patch taken from 2.3 maintenance branch. + * README.maintainers: Add section where to find the documentation tools. + * Fix crash in pyexpat module (closes: #229281). + * For the Hurd, set the interpreters recursion limit to 930. + * Do not try to byte-compile the test files on installation; this + currently breaks the Hurd install. + + -- Matthias Klose Sat, 1 May 2004 07:50:46 +0200 + +python2.3 (2.3.3-6) unstable; urgency=low + + * Don't build the unversioned python{,-*} packages anymore. Now + built from the python-defaults package. + * Update to the proposed python-policy: byte-compile using -E. + * Remove python-elisp's dependency on emacs20 (closes: #232785). + * Don't build python-elisp from the python2.3 source anymore, + get it from python-mode.sf.net as a separate source package. + * python2.3-dev suggests libc-dev (closes: #231091). + * get LDSHARED and CCSHARED (like, CC, CXX, CPP, CFLAGS) from + the environment + * Set CXX in installed config/Makefile (closes: #230273). + + -- Matthias Klose Tue, 24 Feb 2004 07:07:51 +0100 + +python2.3 (2.3.3-5) unstable; urgency=low + + * Build-depend on libdb4.2-dev, instead of libdb4.1-dev. According + to the docs the file format is compatible. + + -- Matthias Klose Mon, 12 Jan 2004 10:37:45 +0100 + +python2.3 (2.3.3-4) unstable; urgency=low + + * Fix broken _bsddb module. setup.py picked up the wrong library. + + -- Matthias Klose Sun, 4 Jan 2004 11:30:00 +0100 + +python2.3 (2.3.3-3) unstable; urgency=low + + * Fix typo in patch (closes: #224797, #226064). + + -- Matthias Klose Sun, 4 Jan 2004 09:23:21 +0100 + +python2.3 (2.3.3-2) unstable; urgency=medium + + * Lib/email/Charset: use locale unaware function to lower case of locale + name (closes: #224797). + * Update python-mode to version from python-mode.sf.net. Fixes highlighting + problems (closes: #223520). + * Backport from mainline: Add IPV6_ socket options from RFCs 3493 and 3542. + + -- Matthias Klose Fri, 2 Jan 2004 14:03:26 +0100 + +python2.3 (2.3.3-1) unstable; urgency=low + + * New upstream release. + * Copy the templates, tools and scripts from the Doc dir in the source + to /usr/share/lib/python2.3/doc in the python2.3-dev package. Needed + for packages building documentation like python does (closes: #207337). + + -- Matthias Klose Fri, 19 Dec 2003 10:57:39 +0100 + +python2.3 (2.3.2.91-1) unstable; urgency=low + + * New upstream version (2.3.3 release candidate). + * Update python-mode.el (closes: #158811, #159630). + Closing unreproducible report (closes: #159628). + + -- Matthias Klose Sat, 6 Dec 2003 14:41:14 +0100 + +python2.3 (2.3.2-7) unstable; urgency=low + + * Put the conflict in the correct direction. python2.3 (2.3.2-6) doesn't + conflict with python (<= 2.3.2-5) but python (2.3.2-6) conflicts with + python2.3 (<= 2.3.2-5) (thanks to Brian May). Really closes #221791. + + -- Matthias Klose Fri, 21 Nov 2003 00:20:02 +0100 + +python2.3 (2.3.2-6) unstable; urgency=low + + * Add conflicts with older python{,2.3} packages to fix overwrite + errors (closes: #221791). + + -- Matthias Klose Thu, 20 Nov 2003 07:24:36 +0100 + +python2.3 (2.3.2-5) unstable; urgency=low + + * Updated to CVS release23-maint 20031119. + * Re-upgrade the dependency of python2.3 on python (>= 2.3) to + a dependency (closes: #221523). + + -- Matthias Klose Wed, 19 Nov 2003 00:30:27 +0100 + +python2.3 (2.3.2-4) unstable; urgency=low + + * Don't build-depend on latex2html (moved to non-free), but keep + the prebuilt docs in debian/patches (closes: #221347). + * Fix typos in the library reference (closes: #220510, #220954). + * Fix typo in python-elisp's autoloading code (closes: #220308). + * Update proposed python policy: private modules can be installed + into /usr/lib/ (arch dependent) and into /usr/share/ + (arch independent). + + -- Matthias Klose Tue, 18 Nov 2003 00:41:39 +0100 + +python2.3 (2.3.2-3) unstable; urgency=low + + * Downgrade the dependency of python2.3 on python (>= 2.3) to + a recommendation. + * Fix path to interpreter in binfmt file. + * Fix segfault in unicodedata module (closes: #218697). + * Adjust python-elisp autoload code (closes: #219821). + + -- Matthias Klose Sun, 9 Nov 2003 19:43:37 +0100 + +python2.3 (2.3.2-2) unstable; urgency=medium + + * Fix broken doc link (closes: #214217). + * Disable wrongly detected large file support for GNU/Hurd. + * Really fix the FTBFS for the binary-indep target (closes: #214303). + + -- Matthias Klose Mon, 6 Oct 2003 07:54:58 +0200 + +python2.3 (2.3.2-1) unstable; urgency=low + + * New upstream version. + * Fix a FTBFS for the binary-indep target. + + -- Matthias Klose Sat, 4 Oct 2003 10:20:15 +0200 + +python2.3 (2.3.1-3) unstable; urgency=low + + * Fix names of codec packages in recommends. + * On alpha compile using -mieee (see #212912). + + -- Matthias Klose Sun, 28 Sep 2003 10:48:12 +0200 + +python2.3 (2.3.1-2) unstable; urgency=low + + * Update python policy draft (closes: #128911, #163785). + * Re-add os.fsync function (closes: #212672). + * Let python2.3-doc conflict with older python2.3 versions (closes: #211882). + * Add recommends for pythonX.Y-japanese-codecs, pythonX.Y-iconvcodec, + pythonX.Y-cjkcodecs, pythonX.Y-korean-codecs (closes: #207161). + * Generate binfmt file (closes: #208005). + * Add IPPROTO_IPV6 option to the socketmodule (closes: #206569). + * Bugs reported against python2.2 and fixed in python2.3: + - Crashes in idle (closes: #186887, #200084). + + -- Matthias Klose Sat, 27 Sep 2003 11:21:47 +0200 + +python2.3 (2.3.1-1) unstable; urgency=low + + * New upstream version (bug fix release). + + -- Matthias Klose Wed, 24 Sep 2003 11:27:43 +0200 + +python2.3 (2.3-4) unstable; urgency=high + + * Disable check for utimes function, which is broken in glibc-2.3.2. + Packages using distutils had '1970/01/01-01:00:01' timestamps in files. + * Bugs fixed by making python2.3 the default python version: + - Canvas.scan_dragto() takes a 3rd optional parmeter "gain". + Closes: #158168. + - New command line parsing module (closes: #38628). + - compileall.py allows compiling single files (closes: #139971). + * Bugs reported for 2.2 and fixed in 2.3: + - Idle does save files with ASCII characters (closes: #179313). + - imaplib support for prefix-quoted strings (closes: #150485). + - posixpath includes getctime (closes: #173827). + - pydoc has support for keywords (closes: #186775). + * Bugs reported for 2.1 and fixed in 2.3: + - Fix handling of "#anchor" URLs in urlparse (closes: #147844). + - Fix readline if C stdin is not a tty, even if sys.stdin is. + Closes: #131810. + * Updated to CVS release23-maint 20030810 (fixing memory leaks in + array and socket modules). + * pydoc's usage output uses the basename of the script. + * Don't explicitely remove /etc/python2.3 on purge (closes: #202864). + * python conflicts with python-xmlbase (closes: #204773). + * Add dependency python (>= 2.3) to python2.3, so make sure the + unversioned names can be used. + + -- Matthias Klose Sun, 10 Aug 2003 09:27:52 +0200 + +python2.3 (2.3-3) unstable; urgency=medium + + * Fix shlibs file. + + -- Matthias Klose Fri, 8 Aug 2003 08:45:12 +0200 + +python2.3 (2.3-2) unstable; urgency=medium + + * Make python2.3 the default python version. + + -- Matthias Klose Tue, 5 Aug 2003 22:13:22 +0200 + +python2.3 (2.3-1) unstable; urgency=low + + * Python 2.3 final release. + + -- Matthias Klose Wed, 30 Jul 2003 08:12:28 +0200 + +python2.3 (2.2.107-1rc2) unstable; urgency=medium + + * Python 2.3 release candidate 2. + * Don't compress .txt files referenced by the html docs (closes: #200298). + * Include the email/_compat* files (closes: #200349). + + -- Matthias Klose Fri, 25 Jul 2003 07:08:09 +0200 + +python2.3 (2.2.106-2beta2) unstable; urgency=medium + + * Python 2.3 beta2 release, updated to CVS 20030704. + - Fixes AssertionError in httplib (closed: #192452). + - Fixes uncaught division by zero in difflib.py (closed: #199287). + * Detect presence of setgroups(2) at configure time (closes: #199839). + * Use default gcc on arm as well. + + -- Matthias Klose Sat, 5 Jul 2003 10:21:33 +0200 + +python2.3 (2.2.105-1beta2) unstable; urgency=low + + * Python 2.3 beta2 release. + - Includes merged idle fork. + - Fixed socket.setdefaulttimeout(). Closes: #189380. + - socket.ssl works with _socketobj. Closes: #196082. + * Do not link libtix to the _tkinter module. It's loaded via + 'package require tix' at runtime. python2.3-tkinter now + suggests tix8.1 instead. + * On arm, use gcc-3.2 to build. + * Add -fno-strict-aliasing rules to OPT to avoid warnings + "dereferencing type-punned pointer will break strict-aliasing rules", + when building with gcc-3.3. + + -- Matthias Klose Mon, 30 Jun 2003 00:19:32 +0200 + +python2.3 (2.2.104-1beta1.1) unstable; urgency=low + + * Non-maintainer upload with maintainer consent. + * debian/control (Build-Depends): s/libgdbmg1-dev/libgdbm-dev/. + + -- James Troup Wed, 4 Jun 2003 02:24:27 +0100 + +python2.3 (2.2.104-1beta1) unstable; urgency=low + + * Python 2.3 beta1 release, updated to CVS 20030514. + - build the current documentation. + * Reenable Tix support. + + -- Matthias Klose Wed, 14 May 2003 07:38:57 +0200 + +python2.3 (2.2.103-1beta1) unstable; urgency=low + + * Python 2.3 beta1 release, updated to CVS 20030506. + - updated due to build problems on mips/mipsel. + - keep the 2.3b1 documentation (doc build problems with cvs). + + -- Matthias Klose Wed, 7 May 2003 06:26:39 +0200 + +python2.3 (2.2.102-1beta1) unstable; urgency=low + + * Python 2.3 beta1 release. + + -- Matthias Klose Sat, 3 May 2003 22:45:16 +0200 + +python2.3 (2.2.101-1exp1) unstable; urgency=medium + + * Python 2.3 alpha2 release, updated to CVS 20030321. + * Tkinter: Catch exceptions thrown for undefined substitutions in + events (needed for tk 8.4.2). + + -- Matthias Klose Fri, 21 Mar 2003 21:32:14 +0100 + +python2.3 (2.2.100-1exp1) unstable; urgency=low + + * Python 2.3 alpha2 release, updated to CVS 20030221. + + -- Matthias Klose Fri, 21 Feb 2003 19:37:17 +0100 + +python2.3 (2.2.99-1exp1) unstable; urgency=low + + * Python 2.3 alpha1 release updated to CVS 20030123. + - should fix the testsuite (and package build) failure on alpha. + * Remove build dependency on libexpat1-dev. Merge the python2.3-xmlbase + package into python2.3 (closes: #177739). + + -- Matthias Klose Thu, 23 Jan 2003 22:48:12 +0100 + +python2.3 (2.2.98-1exp1) unstable; urgency=low + + * Python 2.3 alpha1 release updated to CVS 20030117. + * Build using libdb4.1. + + -- Matthias Klose Sat, 18 Jan 2003 00:14:01 +0100 + +python2.3 (2.2.97-1exp1) unstable; urgency=low + + * Python 2.3 alpha1 release updated to CVS 20030109. + * Build-Depend on g++ (>= 3:3.2). + * Python package maintainers: please wait uploading python dependent + packages until python2.2 and python2.1 are compiled using gcc-3.2. + + -- Matthias Klose Thu, 9 Jan 2003 23:56:42 +0100 + +python2.3 (2.2.96-1exp1) unstable; urgency=low + + * Python 2.3 alpha1 release (not exactly the tarball, but taken from + CVS 20030101). + - Includes support for linking with threaded tk8.4 (closes: #172714). + * Install and register whatsnew document (closes: #173859). + * Properly unregister info documentation. + + -- Matthias Klose Wed, 1 Jan 2003 17:38:54 +0100 + +python2.3 (2.2.95-1exp1) unstable; urgency=low + + * Experimental packages from CVS 021212. + - data in unicodedate module is up to date (closes: #171061). + * Fix idle packaging (closes: #170394). + * Configure using unicode UCS-4 (closes: #171062). + This change breaks compatibility with binary modules, but what do you + expect from experimental packages ... Please recompile dependent packages. + * Don't strip binaries for now. + + -- Matthias Klose Thu, 12 Dec 2002 21:42:27 +0100 + +python2.3 (2.2.94-1exp1) unstable; urgency=low + + * Experimental packages from CVS 021120. + * Remove outdated README.dbm. + * Depend on tk8.4. + * python-elisp: Install emacsen install file with mode 644 (closes: #167718). + + -- Matthias Klose Thu, 21 Nov 2002 01:04:51 +0100 + +python2.3 (2.2.93-1exp1) unstable; urgency=medium + + * Experimental packages from CVS 021015. + * Build a static library libpython2.3-pic.a. + * Enable large file support for the Hurd (closes: #164602). + + -- Matthias Klose Tue, 15 Oct 2002 21:06:27 +0200 + +python2.3 (2.2.92-1exp1) unstable; urgency=low + + * Experimental packages from CVS 020922. + * Fix build error on ia64 (closes: #161234). + * Build depend on gcc-3.2-3.2.1-0pre2 to fix build error on arm. + + -- Matthias Klose Sun, 22 Sep 2002 18:30:28 +0200 + +python2.3 (2.2.91-1exp1) unstable; urgency=low + + * Experimental packages from CVS 020906. + * idle-python2.3: Fix conflict (closes: #159267). + * Fix location of python-mode.el (closes: #159564, #159619). + * Use tix8.1. + * Apply fix for distutils/ccompiler problem (closes: #159288). + + -- Matthias Klose Sat, 7 Sep 2002 09:55:07 +0200 + +python2.3 (2.2.90-1exp1) unstable; urgency=low + + * Experimental packages from CVS 020820. + * Don't build python2.3-elisp, but put the latest version into + python-elisp. + + -- Matthias Klose Thu, 22 Aug 2002 21:52:04 +0200 + +python2.2 (2.2.1-6) unstable; urgency=low + + * CVS updates of the release22-maint branch upto 2002-07-23. + * Enable IPv6 support (closes: #152543). + * Add python2.2-tk suggestion for python2.2 (pydoc -g). + * Fix from SF patch #527518: proxy config with user+pass authentication. + * Point pydoc to the correct location of the docs (closes: #147579). + * Remove '*.py[co]' files, when removing the python package, + not when purging (closes: #147130). + * Update to new py2texi.el version (Milan Zamazal). + + -- Matthias Klose Mon, 29 Jul 2002 23:11:32 +0200 + +python2.2 (2.2.1-5) unstable; urgency=low + + * CVS updates of the release22-maint branch upto 2002-05-03. + * Build the info docs (closes: #145653). + + -- Matthias Klose Fri, 3 May 2002 22:35:46 +0200 + +python2.2 (2.2.1-4) unstable; urgency=high + + * Fix indentation errors introduced in last upload (closes: #143809). + + -- Matthias Klose Sun, 21 Apr 2002 01:00:14 +0200 + +python2.2 (2.2.1-3) unstable; urgency=high + + * Add Build-Conflicts: tcl8.0-dev, tk8.0-dev, tcl8.2-dev, tk8.2-dev. + Closes: #143534 (build a working _tkinter module, on machines, where + 8.0's tk.h gets included). + * CVS updates of the release22-maint branch upto 2002-04-20. + + -- Matthias Klose Sat, 20 Apr 2002 09:22:37 +0200 + +python2.2 (2.2.1-2) unstable; urgency=low + + * Forgot to copy the dlmodule patch from the 2.1.3 package. Really + closes: #141681. + + -- Matthias Klose Sat, 13 Apr 2002 01:28:05 +0200 + +python2.2 (2.2.1-1) unstable; urgency=high + + * Final 2.2.1 release. + * According to report #131813, the python interpreter is much faster on some + architectures, when beeing linked statically with the python library (25%). + Gregor and me tested on i386, m68k and alpha, but we could not reproduce + such a speedup (generally between 5% and 10%). But we are linking the + python executable now statically ... + * Build info docs from the tex source, merge the python-doc-info + package into the python-doc package. + * Always build the dl module. Failure in case of + sizeof(int)!=sizeof(long)!=sizeof(void*) + is delayed until dl.open is called. Closes: #141681. + + -- Matthias Klose Thu, 11 Apr 2002 00:19:19 +0200 + +python2.2 (2.2.0.92-0) unstable; urgency=low + + * Package CVS sources, omit cvs-updates.dpatch (closes: #140977). + + -- Matthias Klose Wed, 3 Apr 2002 08:20:52 +0200 + +python2.2 (2.2-6) unstable; urgency=medium + + * Update to python-2.2.1 release candidate 2 (final release scheduled + for April 10). + * Enable dl module (closes: #138992). + * Build doc files with python binary from package (closes: #139657). + * Build _tkinter module with BLT and Tix support. + * python2.2-elisp: Conflict with python2-elisp (closes: #138970). + * string.split docs updated in python-2.2.1 (closes: #129272). + + -- Matthias Klose Mon, 1 Apr 2002 13:52:36 +0200 + +python2.2 (2.2-5) unstable; urgency=low + + * CVS updates of the release22-maint branch upto 20020310 (aproaching + the first 2.2.1 release candidate). + * Stolen from HEAD: check argument of locale.nl_langinfo (closes: #137371). + + -- Matthias Klose Fri, 15 Mar 2002 01:05:59 +0100 + +python2.2 (2.2-4) unstable; urgency=medium + + * Include test/{__init__.py,README,pystone.py} in package (closes: #129013). + * Fix python-elisp conflict (closes: #129046). + * Don't compress stylesheets (closes: #133179). + * CVS updates of the release22-maint branch upto 20020310. + + -- Matthias Klose Sun, 10 Mar 2002 23:32:28 +0100 + +python2.2 (2.2-3) unstable; urgency=medium + + * Updates from the CVS python22-maint branch up to 20020107. + webbrowser.py: properly escape url's. + * The Hurd does not have large file support: disabled. + + -- Matthias Klose Mon, 7 Jan 2002 21:55:57 +0100 + +python2.2 (2.2-2) unstable; urgency=medium + + * CVS updates of the release22-maint branch upto 20011229. Fixes: + - Include TCP_CORK flag in plat-linux2 headers (fixes: #84340). + - Update CDROM.py module (fixes: #125785). + * Add missing chunk of the GNU/Hurd patch (therefore urgency medium). + * Send anonymous password when using anonftp (closes: #126814). + + -- Matthias Klose Sat, 29 Dec 2001 20:18:26 +0100 + +python2.2 (2.2-1) unstable; urgency=low + + * New upstream version: 2.2. + * Bugs fixed upstream: + - Docs for os.kill reference the signal module for constants. + - Documentation strings in the tutorial end with a period (closes: #94770). + - Tk: grid_location method moved from Grid to Misc (closes: #98338). + - mhlib.SubMessage.getbodytext takes decode parameter (closes: #31876). + - Strings in modules are locale aware (closes: #51444). + - Printable 8-bit characters in strings are correctly printed + (closes: #64354). + - Dictionary can be updated with abstract mapping object (closes: #46566). + * Make site.py a config files. + + -- Matthias Klose Sat, 22 Dec 2001 00:51:46 +0100 + +python2.2 (2.1.99c1-1) unstable; urgency=low + + * New upstream version: 2.2c1 (release candidate). + * Do not provide python2.2-base anymore. + * Install correct README.Debian for python2.2 package. Include hint + where to find Makefile.pre.in. + * Suggest installation of python-ssl. + * Remove idle config files on purge. + * Remove empty /usr/lib/python2.2 directory on purge. + + -- Matthias Klose Sat, 15 Dec 2001 17:56:27 +0100 + +python2.2 (2.1.99beta2-1) unstable; urgency=high + + * debian/rules: Reflect removal of regrtest package (closes: #122278). + Resulted in build failures on all architectures. + * Build -doc package from source. + + -- Matthias Klose Sat, 8 Dec 2001 00:38:41 +0100 + +python2.2 (2.1.99beta2-0.1) unstable; urgency=low + + * Non maintainer upload. + * New upstream version (this is 2.2beta2). + * Do not build the python-regrtest package anymore; keep the test framework + components test/regrtest.py and test/test_support.py in the python + package (closes: #119408). + + -- Gregor Hoffleit Tue, 27 Nov 2001 09:53:26 +0100 + +python2.2 (2.1.99beta1-4) unstable; urgency=low + + * Configure with --with-fpectl (closes: #118125). + * setup.py: Remove broken check for _curses_panel module (#116081). + * idle: Move config-* files to /etc and mark as conffiles (#106390). + * Move idle packages to section `devel'. + + -- Matthias Klose Wed, 31 Oct 2001 10:56:45 +0100 + +python2.2 (2.1.99beta1-3) unstable; urgency=low + + * Fix shlibs file (was still referring to 2.1). Closes: #116810. + * README.Debian: point to draft of python-policy in the python package. + + -- Matthias Klose Wed, 31 Oct 2001 10:56:45 +0100 + +python2.2 (2.1.99beta1-2) unstable; urgency=medium + + * Fix shlibs file (was still referring to 2.1). Closes: #116810. + * Rename package python2.2-base to python2.2. + + -- Matthias Klose Wed, 24 Oct 2001 23:00:50 +0200 + +python2.2 (2.1.99beta1-1) unstable; urgency=low + + * New upstream version (beta). Call the package version 2.1.99beta1-1. + * New maintainer until the final 2.2 release. + * Updated the debian patches. + + -- Matthias Klose Sat, 20 Oct 2001 18:56:26 +0200 + +python2.1 (2.1.1-1.2) unstable; urgency=low + + * Really remove the python alternative. + + -- Matthias Klose Sat, 20 Oct 2001 15:16:56 +0200 + +python2.1 (2.1.1-1.1) unstable; urgency=low + + * README FOR PACKAGE MAINTAINERS: It is planned to remove the python2-XXX + packages from unstable and move on to python2.1. + If you repackage/adapt your modules for python2.1, don't build + python2-XXX and python2.1-XXX packages from the same source package, + so that the python2-XXX package can be removed without influencing the + python2.1-XXX package. + + See the debian-python mailing list at http://lists.debian.org/devel.html + for details and the current discussion and a draft for a debian-python + policy (August to October 2001). + + * Remove alternative for /usr/bin/python. The python-base package now + provides the default python version. + + * Regenerate control file to fix build dependencies (closes: #116190). + * Remove alternative for /usr/bin/{python,pydoc}. + * Provide a libpython2.1.so symlink in /usr/lib/python2.1/config, + so that the shared library is found when -L/usr/lib/python2.1/config + is specified. + * Conflict with old package versions, where /usr/bin/python is a real + program (closes: #115943). + * python2.1-elisp conflicts with python-elisp (closes: #115895). + * We now have 2.1 (closes: #96851, #107849, #110243). + + -- Matthias Klose Fri, 19 Oct 2001 17:34:41 +0200 + +python2.1 (2.1.1-1) unstable; urgency=low + + * Incorporated Matthias' modifications. + + -- Gregor Hoffleit Thu, 11 Oct 2001 00:16:42 +0200 + +python2.1 (2.1.1-0.2) unstable; urgency=low + + * New upstream 2.1.1. + * GPL compatible licence (fixes #84080, #102949, #110643). + * Fixed upstream (closes: #99692, #111340). + * Build in separate build directory. + * Split Debian patches into debian/patches directory. + * Build dependencies: Add libgmp3-dev, libexpat1-dev, tighten + debhelper dependency. + * debian/rules: Updated a "bit". + * python-elisp: Remove custom dependency (closes: #87783), + fix emacs path (closes: #89712), remove emacs19 dependency (#82694). + * Mention distutils in python-dev package description (closes: #108170). + * Update README.Debian (closes: #85430). + * Run versioned python in postinsts (closes: #113349). + * debian/sample.{postinst,prerm}: Change to version independent scripts. + * Use '/usr/bin/env python2.1' as interpreter for all python scripts. + * Add libssl-dev to Build-Conflicts. + * python-elisp: Add support for emacs21 (closes: #98635). + * Do not compress .py files in doc directories. + * Don't link explicitely with libc. + + -- Matthias Klose Wed, 3 Oct 2001 09:53:08 +0200 + +python2.1 (2.1.1-0.1) unstable; urgency=low + + * New upstream version (CVS branch release21-maint, will become 2.1.1): + This CVS branch will be released as 2.1.1 under a GPL compatible + license. + + -- Gregor Hoffleit Wed, 27 Jun 2001 22:47:58 +0200 + +python2 (2.1-0.1) unstable; urgency=low + + * Fixed Makefile.pre.in. + * Fixed the postinst files in order to use 2.1 (instead of 2.0). + * Mention the immanent release of 2.0.1 and 2.1.1, with a GPL + compatible license. + + -- Gregor Hoffleit Sun, 17 Jun 2001 21:05:25 +0200 + +python2 (2.1-0) unstable; urgency=low + + * New upstream version. + * Experimental packages. + + -- Gregor Hoffleit Thu, 10 May 2001 00:20:04 +0200 + +python2 (2.0-7) unstable; urgency=low + + * Rebuilt with recent tcl8.3-dev/tk8.3-dev in order to fix a + dependency problem with python2-tk (closes: #87793, #92962). + * Change postinst to create and update /usr/local/lib/python2.0 and + site-python with permissions and owner as mandated by policy: + 2775 and root:staff (closes: #89047). + * Fix to compileall.py: A superfluous argument made compileall without + options fail (cf. #92990 for python). + * Move the distutils module into python2-dev. It needs Makefile.pre.in + in order to work (closes: #89900). + * Remove build-dependency on libgdbm2-dev (which isn't built anyway). + * Add a build-dependency on libdb2-dev (cf. #90220 for python). + + -- Gregor Hoffleit Sat, 14 Apr 2001 21:07:51 +0200 + +python2 (2.0-6) unstable; urgency=low + + * Remove python-zlib package; merge it into python-base. + * Mark that README.python2 is not yet updated. + + -- Gregor Hoffleit Wed, 21 Feb 2001 12:34:18 +0100 + +python2 (2.0-5) unstable; urgency=low + + * Recompile with tcl/tk8.3 (closes: #82088). + * Modifications to README.why-python2 (closes: #82116). + * Add menu hint to idle2 menu entry. + * idle2 is renamed idle-python2 and now build correctly (closes: #82218). + * Add build-dependency on autoconf (closes: #85339). + * Build bsddbmodule as shared module (Modules/Setup.config.in), + and link libpython2.so with -lm in Makefile (closes: #86027). + * various cleanups in debian/rules, e.g. removing dh_suidregister. + * Make pdb available as /usr/bin/pdb-python2 in python2-dev + (cf. #79870 in python-base). + * Remove libgmp3 from build-dependencies, since we currently can't + build the mpzmodule for Python2 due to license problems. + + -- Gregor Hoffleit Sun, 18 Feb 2001 00:12:17 +0100 + +python2 (2.0-4) unstable; urgency=low + + * control: make python2-elisp conflict with python-elisp (it doesn't + make sense to have both of them installed, does it ?) + * include build-depend on libxmltok1-dev. + * again, build with tcl/tk8.0. + + -- Gregor Hoffleit Wed, 10 Jan 2001 23:37:01 +0100 + +python2 (2.0-3) unstable; urgency=low + + * Modules/Setup.in: Added a missing \ that made _tkinter be built + incorrectly. + * rules: on the fly, change all '#!' python scripts to use python2. + + -- Gregor Hoffleit Wed, 13 Dec 2000 20:07:24 +0100 + +python2 (2.0-2) unstable; urgency=low + + * Aaargh. Remove conflicts/provides/replaces on python-base to make + parallel installation of python-base and python2-base possible. + * Install examples into /usr/share/doc/python2 (not python) and fix + symlink to python2.0 (thanks to Rick Younie for + pointing out this). + * Rename man page to python2.1. + + -- Gregor Hoffleit Wed, 13 Dec 2000 09:31:05 +0100 + +python2 (2.0-1) unstable; urgency=low + + * New upstream version. Initial release for python2. + + -- Gregor Hoffleit Mon, 11 Dec 2000 22:39:46 +0100 diff --git a/debian/changelog.shared b/debian/changelog.shared new file mode 100644 index 000000000000000..60a99df59bef3dc --- /dev/null +++ b/debian/changelog.shared @@ -0,0 +1,3 @@ + * Link the interpreter against the shared runtime library. With + gcc-4.1 the difference in the pystones benchmark dropped from about + 12% to about 5%. diff --git a/debian/compat b/debian/compat new file mode 100644 index 000000000000000..b4de3947675361a --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +11 diff --git a/debian/control b/debian/control new file mode 100644 index 000000000000000..6009443fbead3e0 --- /dev/null +++ b/debian/control @@ -0,0 +1,307 @@ +Source: python3.13 +Section: python +Priority: optional +Maintainer: Matthias Klose +Uploaders: Stefano Rivera +Build-Depends: debhelper (>= 11), dpkg-dev (>= 1.17.11), + quilt, autoconf, + lsb-release, sharutils, + libreadline-dev | libeditreadline-dev, libncurses-dev, + zlib1g-dev, libbz2-dev, liblzma-dev, + libgdbm-dev, libdb-dev, + tk-dev, blt-dev (>= 2.4z), + libssl-dev, + libexpat1-dev, + libbluetooth-dev [linux-any] , + locales-all, + libnsl-dev, + libsqlite3-dev, libffi-dev (>= 3.0.5) [!or1k], + libgpm2 [linux-any], + media-types | mime-support, netbase, bzip2, time, python3:any, python3.13:any , + net-tools, + python3-pip-whl , + python3-setuptools-whl , + python3-wheel-whl , + xvfb , xauth , + tzdata , + systemtap-sdt-dev [!hurd-amd64 !hurd-i386], + valgrind-if-available, +Build-Depends-Indep: python3-sphinx, python3-docs-theme, texinfo +Standards-Version: 4.6.2 +Vcs-Browser: https://salsa.debian.org/cpython-team/python3 +Vcs-Git: https://salsa.debian.org/cpython-team/python3.git +XS-Testsuite: autopkgtest + +Package: python3.13 +Architecture: any +Multi-Arch: allowed +Priority: optional +Depends: python3.13-minimal (= ${binary:Version}), + libpython3.13-stdlib (= ${binary:Version}), + media-types | mime-support, tzdata, + ${shlibs:Depends}, ${misc:Depends} +Recommends: ca-certificates +Suggests: python3.13-venv, python3.13-doc, binutils +Breaks: python3-all (<< 3.6.5~rc1-1), + python3-dev (<< 3.6.5~rc1-1), + python3-venv (<< 3.6.5-2) +Description: Interactive high-level object-oriented language (version 3.13) + Python is a high-level, interactive, object-oriented language. Its 3.13 version + includes an extensive class library with lots of goodies for + network programming, system administration, sounds and graphics. + +Package: python3.13-venv +Architecture: any +Multi-Arch: allowed +Priority: optional +Depends: python3.13 (= ${binary:Version}), + python3-pip-whl (>= 22.2), + python3-setuptools-whl, + ${shlibs:Depends}, ${misc:Depends}, +Breaks: python3-pip (<< 1.5.6-4) +Description: Interactive high-level object-oriented language (pyvenv binary, version 3.13) + Python is a high-level, interactive, object-oriented language. Its 3.13 version + includes an extensive class library with lots of goodies for + network programming, system administration, sounds and graphics. + . + This package contains the pyvenv-3.13 binary. + +Package: libpython3.13-stdlib +Architecture: any +Multi-Arch: same +Priority: optional +Pre-Depends: ${misc:Pre-Depends} +Depends: libpython3.13-minimal (= ${binary:Version}), + media-types | mime-support, netbase, tzdata, + ${shlibs:Depends}, ${misc:Depends} +Description: Interactive high-level object-oriented language (standard library, version 3.13) + Python is a high-level, interactive, object-oriented language. Its 3.13 version + includes an extensive class library with lots of goodies for + network programming, system administration, sounds and graphics. + . + This package contains Python 3.13's standard library. It is normally not + used on its own, but as a dependency of python3.13. + +Package: python3.13-minimal +Architecture: any +Multi-Arch: allowed +Priority: optional +Pre-Depends: ${shlibs:Pre-Depends} +Depends: libpython3.13-minimal (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends} +Recommends: python3.13 +Suggests: binfmt-support +Conflicts: binfmt-support (<< 1.1.2) +Description: Minimal subset of the Python language (version 3.13) + This package contains the interpreter and some essential modules. It can + be used in the boot process for some basic tasks. + See /usr/share/doc/python3.13-minimal/README.Debian for a list of the modules + contained in this package. +XB-Cnf-Visible-Pkgname: python3.13 + +Package: python3.13-nopie +Architecture: any +Multi-Arch: allowed +Priority: optional +Depends: python3.13-minimal (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends} +Description: Python interpreter linked without PIE (version 3.13) + This package contains the interpreter not built as position independent + executable. This interpreter is diverting the python3.13 executable, and making + the interpreter built with PIE available as python3.13-pie. +XB-Cnf-Visible-Pkgname: python3.13 + +Package: libpython3.13-minimal +Architecture: any +Multi-Arch: same +Priority: optional +Pre-Depends: ${misc:Pre-Depends} +Depends: ${shlibs:Depends}, ${misc:Depends} +Recommends: libpython3.13-stdlib +Conflicts: binfmt-support (<< 1.1.2) +Description: Minimal subset of the Python language (version 3.13) + This package contains some essential modules. It is normally not + used on it's own, but as a dependency of python3.13-minimal. + +Package: libpython3.13 +Replaces: libpython3.13 +Architecture: any +Multi-Arch: same +Section: libs +Priority: optional +Pre-Depends: ${misc:Pre-Depends} +Depends: libpython3.13-stdlib (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends} +Description: Shared Python runtime library (version 3.13) + Python is a high-level, interactive, object-oriented language. Its 3.13 version + includes an extensive class library with lots of goodies for + network programming, system administration, sounds and graphics. + . + This package contains the shared runtime library, normally not needed + for programs using the statically linked interpreter. + +Package: python3.13-examples +Architecture: all +Depends: python3.13:any (>= ${source:Version}), ${misc:Depends} +Description: Examples for the Python language (v3.13) + Examples, Demos and Tools for Python (v3.13). These are files included in + the upstream Python distribution (v3.13). + +Package: python3.13-dev +Architecture: any +Multi-Arch: allowed +Depends: python3.13 (= ${binary:Version}), + libpython3.13-dev (= ${binary:Version}), + libpython3.13 (= ${binary:Version}), + ${shlibs:Depends}, ${misc:Depends} +Recommends: libc6-dev | libc-dev +Description: Header files and a static library for Python (v3.13) + Header files, a static library and development tools for building + Python (v3.13) modules, extending the Python interpreter or embedding + Python (v3.13) in applications. + . + Maintainers of Python packages should read README.maintainers. + +Package: libpython3.13-dev +Section: libdevel +Architecture: any +Multi-Arch: same +Pre-Depends: ${misc:Pre-Depends} +Depends: libpython3.13-stdlib (= ${binary:Version}), + libpython3.13 (= ${binary:Version}), + libexpat1-dev, zlib1g-dev, + ${shlibs:Depends}, ${misc:Depends} +Recommends: libc6-dev | libc-dev +Description: Header files and a static library for Python (v3.13) + Header files, a static library and development tools for building + Python (v3.13) modules, extending the Python interpreter or embedding + Python (v3.13) in applications. + . + Maintainers of Python packages should read README.maintainers. + . + This package contains development files. It is normally not + used on it's own, but as a dependency of python3.13-dev. + +Package: libpython3.13-testsuite +Section: libdevel +Architecture: all +Depends: python3.13 (>= ${binary:Version}), ${misc:Depends}, net-tools +Suggests: python3-gdbm, python3-tk +Description: Testsuite for the Python standard library (v3.13) + The complete testsuite for the Python standard library. Note that + a subset is found in the libpython3.13-stdlib package, which should + be enough for other packages to use (please do not build-depend + on this package, but file a bug report to include additional + testsuite files in the libpython3.13-stdlib package). + +Package: idle-python3.13 +Architecture: all +Depends: python3.13, python3-tk, python3.13-tk, + ${misc:Depends}, + libjs-mathjax, +Enhances: python3.13 +Description: IDE for Python (v3.13) using Tkinter + IDLE is an Integrated Development Environment for Python (v3.13). + IDLE is written using Tkinter and therefore quite platform-independent. + +Package: python3.13-doc +Section: doc +Architecture: all +Multi-Arch: foreign +Depends: libjs-jquery, libjs-underscore, ${misc:Depends} +Suggests: python3.13 +Description: Documentation for the high-level object-oriented language Python (v3.13) + These is the official set of documentation for the interactive high-level + object-oriented language Python (v3.13). All documents are provided + in HTML format. The package consists of ten documents: + . + * What's New in Python3.13 + * Tutorial + * Python Library Reference + * Macintosh Module Reference + * Python Language Reference + * Extending and Embedding Python + * Python/C API Reference + * Installing Python Modules + * Documenting Python + * Distributing Python Modules + +Package: python3.13-dbg +Section: debug +Architecture: any +Multi-Arch: allowed +Depends: python3.13 (= ${binary:Version}), libpython3.13-dbg (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends} +Recommends: gdb +Suggests: python3-gdbm-dbg, python3-tk-dbg +Description: Debug Build of the Python Interpreter (version 3.13) + The package holds two things: + . + - A Python interpreter configured with --pydebug. Dynamically loaded modules + are searched as _d.so first. Third party extensions need a separate + build to be used by this interpreter. + - Debug information for standard python interpreter and extensions. + . + See the README.debug for more information. + +Package: libpython3.13-dbg +Section: debug +Architecture: any +Multi-Arch: same +Pre-Depends: ${misc:Pre-Depends} +Depends: libpython3.13-stdlib (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends} +Breaks: libpython3.13-dbg (<< ${source:Version}), + python3-gdbm-dbg (<< 3.12.5-2~), python3-tk-dbg (<< 3.12.5-2~) +Replaces: libpython3.13-dbg, + python3-gdbm-dbg (<< 3.12.5-2~), python3-tk-dbg (<< 3.12.5-2~) +Description: Debug Build of the Python Interpreter (version 3.13) + The package holds two things: + . + - Extensions for a Python interpreter configured with --pydebug. + - Debug information for standard python extensions. + . + See the README.debug for more information. + +Package: python3.13-full +Architecture: any +Multi-Arch: allowed +Depends: python3.13 (= ${binary:Version}), + libpython3.13-testsuite, + python3.13-venv (= ${binary:Version}), + idle-python3.13, + python3.13-gdbm, + python3.13-tk, + ca-certificates, + ${shlibs:Depends}, ${misc:Depends} +Recommends: python3.13-doc, python3.13-examples, +Suggests: python3.13-dev +Description: Python Interpreter with complete class library (version 3.13) + Python, the high-level, interactive object oriented language, + includes an extensive class library with lots of goodies for + network programming, system administration, sounds and graphics. + . + This package is a dependency package, which depends on the full + standard library of Python for Python developers. Including modules + used only at build-time, such as venv, and modules with complex + dependencies, such as tk and IDLE. All batteries included. + . + According to the Debian Python policy, this package must not be used in + build dependencies, dependencies and recommendations. + +Package: python3.13-tk +Architecture: any +Depends: ${misc:Depends}, ${shlibs:Depends} +Enhances: python3.13 +Suggests: tix +Breaks: python3-tk (<< 3.12.5-2~) +Replaces: python3-tk (<< 3.12.5-2~) +XB-Python-Version: 3.13 +Description: Tkinter - Writing Tk applications with Python (v3.13) + A module for writing portable GUI applications with Python (v3.13) using Tk. + Also known as Tkinter. + +Package: python3.13-gdbm +Architecture: any +Depends: ${misc:Depends}, ${shlibs:Depends} +Enhances: python3.13 +Breaks: python3-gdbm (<< 3.12.5-2~) +Replaces: python3-gdbm (<< 3.12.5-2~) +Description: GNU dbm database support for Python (v3.13) + GNU dbm database module for Python. Install this if you want to + create or read GNU dbm database files with Python. diff --git a/debian/control.in b/debian/control.in new file mode 100644 index 000000000000000..e2bf439274bacdf --- /dev/null +++ b/debian/control.in @@ -0,0 +1,285 @@ +Source: @PVER@ +Section: python +Priority: optional +Maintainer: Matthias Klose +Uploaders: Stefano Rivera +Build-Depends: debhelper (>= 11), @bd_dpkgdev@ + quilt, autoconf, + lsb-release, sharutils, + libreadline-dev | libeditreadline-dev, libncurses-dev, @bd_gcc@ + zlib1g-dev, libbz2-dev, liblzma-dev, + libgdbm-dev, @bd_dbm@, + tk-dev, blt-dev (>= 2.4z), + libssl-dev, + libexpat1-dev, + libbluetooth-dev [linux-any] , + locales-all, + libnsl-dev, + libsqlite3-dev, libffi-dev (>= 3.0.5) [!or1k], + libgpm2 [linux-any], + media-types | mime-support, netbase, bzip2, time, python3@bd_qual@, @PVER@@bd_qual@ , + net-tools, + python3-pip-whl , + python3-setuptools-whl , + python3-wheel-whl , + xvfb , xauth , + tzdata , + systemtap-sdt-dev [!hurd-amd64 !hurd-i386], + valgrind-if-available, +Build-Depends-Indep: python3-sphinx, python3-docs-theme, texinfo +Standards-Version: 4.6.2 +Vcs-Browser: https://salsa.debian.org/cpython-team/python3 +Vcs-Git: https://salsa.debian.org/cpython-team/python3.git +XS-Testsuite: autopkgtest + +Package: @PVER@ +Architecture: any +Multi-Arch: allowed +Priority: @PRIO@ +Depends: @PVER@-minimal (= ${binary:Version}), + lib@PVER@-stdlib (= ${binary:Version}), + media-types | mime-support, tzdata, + ${shlibs:Depends}, ${misc:Depends} +Recommends: ca-certificates +Suggests: @PVER@-venv, @PVER@-doc, binutils +Breaks: python3-all (<< 3.6.5~rc1-1), + python3-dev (<< 3.6.5~rc1-1), + python3-venv (<< 3.6.5-2) +Description: Interactive high-level object-oriented language (version @VER@) + Python is a high-level, interactive, object-oriented language. Its @VER@ version + includes an extensive class library with lots of goodies for + network programming, system administration, sounds and graphics. + +Package: @PVER@-venv +Architecture: any +Multi-Arch: allowed +Priority: @PRIO@ +Depends: @PVER@ (= ${binary:Version}), + python3-pip-whl (>= 22.2), + python3-setuptools-whl, + ${shlibs:Depends}, ${misc:Depends}, +Breaks: python3-pip (<< 1.5.6-4) +Description: Interactive high-level object-oriented language (pyvenv binary, version @VER@) + Python is a high-level, interactive, object-oriented language. Its @VER@ version + includes an extensive class library with lots of goodies for + network programming, system administration, sounds and graphics. + . + This package contains the pyvenv-@VER@ binary. + +Package: lib@PVER@-stdlib +Architecture: any +Multi-Arch: same +Priority: @PRIO@ +Pre-Depends: ${misc:Pre-Depends} +Depends: lib@PVER@-minimal (= ${binary:Version}), + media-types | mime-support, netbase, tzdata, + ${shlibs:Depends}, ${misc:Depends} +Description: Interactive high-level object-oriented language (standard library, version @VER@) + Python is a high-level, interactive, object-oriented language. Its @VER@ version + includes an extensive class library with lots of goodies for + network programming, system administration, sounds and graphics. + . + This package contains Python @VER@'s standard library. It is normally not + used on its own, but as a dependency of python@VER@. + +Package: @PVER@-minimal +Architecture: any +Multi-Arch: allowed +Priority: @MINPRIO@ +Pre-Depends: ${shlibs:Pre-Depends} +Depends: lib@PVER@-minimal (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends} +Recommends: @PVER@ +Suggests: binfmt-support +Conflicts: binfmt-support (<< 1.1.2) +Description: Minimal subset of the Python language (version @VER@) + This package contains the interpreter and some essential modules. It can + be used in the boot process for some basic tasks. + See /usr/share/doc/@PVER@-minimal/README.Debian for a list of the modules + contained in this package. +XB-Cnf-Visible-Pkgname: @PVER@ + +Package: @PVER@-nopie +Architecture: any +Multi-Arch: allowed +Priority: @MINPRIO@ +Depends: @PVER@-minimal (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends} +Description: Python interpreter linked without PIE (version @VER@) + This package contains the interpreter not built as position independent + executable. This interpreter is diverting the @PVER@ executable, and making + the interpreter built with PIE available as @PVER@-pie. +XB-Cnf-Visible-Pkgname: @PVER@ + +Package: lib@PVER@-minimal +Architecture: any +Multi-Arch: same +Priority: @MINPRIO@ +Pre-Depends: ${misc:Pre-Depends} +Depends: ${shlibs:Depends}, ${misc:Depends} +Recommends: lib@PVER@-stdlib +Conflicts: binfmt-support (<< 1.1.2) +Description: Minimal subset of the Python language (version @VER@) + This package contains some essential modules. It is normally not + used on it's own, but as a dependency of @PVER@-minimal. + +Package: lib@PVER@ +Replaces: lib@PVER@ +Architecture: any +Multi-Arch: same +Section: libs +Priority: @PRIO@ +Pre-Depends: ${misc:Pre-Depends} +Depends: lib@PVER@-stdlib (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends} +Description: Shared Python runtime library (version @VER@) + Python is a high-level, interactive, object-oriented language. Its @VER@ version + includes an extensive class library with lots of goodies for + network programming, system administration, sounds and graphics. + . + This package contains the shared runtime library, normally not needed + for programs using the statically linked interpreter. + +Package: @PVER@-examples +Architecture: all +Depends: @PVER@:any (>= ${source:Version}), ${misc:Depends} +Description: Examples for the Python language (v@VER@) + Examples, Demos and Tools for Python (v@VER@). These are files included in + the upstream Python distribution (v@VER@). + +Package: @PVER@-dev +Architecture: any +Multi-Arch: allowed +Depends: @PVER@ (= ${binary:Version}), + lib@PVER@-dev (= ${binary:Version}), + lib@PVER@ (= ${binary:Version}), + ${shlibs:Depends}, ${misc:Depends} +Recommends: libc6-dev | libc-dev +Description: Header files and a static library for Python (v@VER@) + Header files, a static library and development tools for building + Python (v@VER@) modules, extending the Python interpreter or embedding + Python (v@VER@) in applications. + . + Maintainers of Python packages should read README.maintainers. + +Package: lib@PVER@-dev +Section: libdevel +Architecture: any +Multi-Arch: same +Pre-Depends: ${misc:Pre-Depends} +Depends: lib@PVER@-stdlib (= ${binary:Version}), + lib@PVER@ (= ${binary:Version}), + libexpat1-dev, zlib1g-dev, + ${shlibs:Depends}, ${misc:Depends} +Recommends: libc6-dev | libc-dev +Description: Header files and a static library for Python (v@VER@) + Header files, a static library and development tools for building + Python (v@VER@) modules, extending the Python interpreter or embedding + Python (v@VER@) in applications. + . + Maintainers of Python packages should read README.maintainers. + . + This package contains development files. It is normally not + used on it's own, but as a dependency of @PVER@-dev. + +Package: lib@PVER@-testsuite +Section: libdevel +Architecture: all +Depends: @PVER@ (>= ${binary:Version}), ${misc:Depends}, net-tools +Suggests: python3-gdbm, python3-tk +Description: Testsuite for the Python standard library (v@VER@) + The complete testsuite for the Python standard library. Note that + a subset is found in the lib@PVER@-stdlib package, which should + be enough for other packages to use (please do not build-depend + on this package, but file a bug report to include additional + testsuite files in the lib@PVER@-stdlib package). + +Package: idle-@PVER@ +Architecture: all +Depends: @PVER@, python3-tk, @PVER@-tk, + ${misc:Depends}, + libjs-mathjax, +Enhances: @PVER@ +Description: IDE for Python (v@VER@) using Tkinter + IDLE is an Integrated Development Environment for Python (v@VER@). + IDLE is written using Tkinter and therefore quite platform-independent. + +Package: @PVER@-doc +Section: doc +Architecture: all +Multi-Arch: foreign +Depends: libjs-jquery, libjs-underscore, ${misc:Depends} +Suggests: @PVER@ +Description: Documentation for the high-level object-oriented language Python (v@VER@) + These is the official set of documentation for the interactive high-level + object-oriented language Python (v@VER@). All documents are provided + in HTML format. The package consists of ten documents: + . + * What's New in Python@VER@ + * Tutorial + * Python Library Reference + * Macintosh Module Reference + * Python Language Reference + * Extending and Embedding Python + * Python/C API Reference + * Installing Python Modules + * Documenting Python + * Distributing Python Modules + +Package: @PVER@-dbg +Section: debug +Architecture: any +Multi-Arch: allowed +Depends: @PVER@ (= ${binary:Version}), lib@PVER@-dbg (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends} +Recommends: gdb +Suggests: python3-gdbm-dbg, python3-tk-dbg +Description: Debug Build of the Python Interpreter (version @VER@) + The package holds two things: + . + - A Python interpreter configured with --pydebug. Dynamically loaded modules + are searched as _d.so first. Third party extensions need a separate + build to be used by this interpreter. + - Debug information for standard python interpreter and extensions. + . + See the README.debug for more information. + +Package: lib@PVER@-dbg +Section: debug +Architecture: any +Multi-Arch: same +Pre-Depends: ${misc:Pre-Depends} +Depends: lib@PVER@-stdlib (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends} +Breaks: lib@PVER@-dbg (<< ${source:Version}), + python3-gdbm-dbg (<< 3.12.5-2~), python3-tk-dbg (<< 3.12.5-2~) +Replaces: lib@PVER@-dbg, + python3-gdbm-dbg (<< 3.12.5-2~), python3-tk-dbg (<< 3.12.5-2~) +Description: Debug Build of the Python Interpreter (version @VER@) + The package holds two things: + . + - Extensions for a Python interpreter configured with --pydebug. + - Debug information for standard python extensions. + . + See the README.debug for more information. + +Package: @PVER@-full +Architecture: any +Multi-Arch: allowed +Depends: @PVER@ (= ${binary:Version}), + lib@PVER@-testsuite, + @PVER@-venv (= ${binary:Version}), + idle-@PVER@, + @PVER@-gdbm, + @PVER@-tk, + ca-certificates, + ${shlibs:Depends}, ${misc:Depends} +Recommends: @PVER@-doc, @PVER@-examples, +Suggests: @PVER@-dev +Description: Python Interpreter with complete class library (version @VER@) + Python, the high-level, interactive object oriented language, + includes an extensive class library with lots of goodies for + network programming, system administration, sounds and graphics. + . + This package is a dependency package, which depends on the full + standard library of Python for Python developers. Including modules + used only at build-time, such as venv, and modules with complex + dependencies, such as tk and IDLE. All batteries included. + . + According to the Debian Python policy, this package must not be used in + build dependencies, dependencies and recommendations. diff --git a/debian/control.stdlib b/debian/control.stdlib new file mode 100644 index 000000000000000..c1c5c4d508d6c2f --- /dev/null +++ b/debian/control.stdlib @@ -0,0 +1,22 @@ + +Package: @PVER@-tk +Architecture: any +Depends: ${misc:Depends}, ${shlibs:Depends} +Enhances: @PVER@ +Suggests: tix +Breaks: python3-tk (<< 3.12.5-2~) +Replaces: python3-tk (<< 3.12.5-2~) +XB-Python-Version: @VER@ +Description: Tkinter - Writing Tk applications with Python (v@VER@) + A module for writing portable GUI applications with Python (v@VER@) using Tk. + Also known as Tkinter. + +Package: @PVER@-gdbm +Architecture: any +Depends: ${misc:Depends}, ${shlibs:Depends} +Enhances: @PVER@ +Breaks: python3-gdbm (<< 3.12.5-2~) +Replaces: python3-gdbm (<< 3.12.5-2~) +Description: GNU dbm database support for Python (v@VER@) + GNU dbm database module for Python. Install this if you want to + create or read GNU dbm database files with Python. diff --git a/debian/control.udeb b/debian/control.udeb new file mode 100644 index 000000000000000..3e1a35154707202 --- /dev/null +++ b/debian/control.udeb @@ -0,0 +1,11 @@ + +Package: @PVER@-udeb +XC-Package-Type: udeb +Section: debian-installer +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +XB-Python-Runtime: @PVER@ +XB-Python-Version: @VER@ +Description: A minimal subset of the Python language (version @VER@) + This package contains the interpreter and some essential modules, packaged + for use in the installer. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 000000000000000..1655fbe09cb4e0f --- /dev/null +++ b/debian/copyright @@ -0,0 +1,995 @@ +This package was put together by Klee Dienes from +sources from ftp.python.org:/pub/python, based on the Debianization by +the previous maintainers Bernd S. Brentrup and +Bruce Perens. Current maintainer is Matthias Klose . + +It was downloaded from http://python.org/ + +Copyright: + +Upstream Author: Guido van Rossum and others. + +License: + +The following text includes the Python license and licenses and +acknowledgements for incorporated software. The licenses can be read +in the HTML and texinfo versions of the documentation as well, after +installing the pythonx.y-doc package. Licenses for files not licensed +under the Python Licenses are found at the end of this file. + + +Python License +============== + +A. HISTORY OF THE SOFTWARE +========================== + +Python was created in the early 1990s by Guido van Rossum at Stichting +Mathematisch Centrum (CWI, see http://www.cwi.nl) in the Netherlands +as a successor of a language called ABC. Guido remains Python's +principal author, although it includes many contributions from others. + +In 1995, Guido continued his work on Python at the Corporation for +National Research Initiatives (CNRI, see http://www.cnri.reston.va.us) +in Reston, Virginia where he released several versions of the +software. + +In May 2000, Guido and the Python core development team moved to +BeOpen.com to form the BeOpen PythonLabs team. In October of the same +year, the PythonLabs team moved to Digital Creations (now Zope +Corporation, see http://www.zope.com). In 2001, the Python Software +Foundation (PSF, see http://www.python.org/psf/) was formed, a +non-profit organization created specifically to own Python-related +Intellectual Property. Zope Corporation is a sponsoring member of +the PSF. + +All Python releases are Open Source (see http://www.opensource.org for +the Open Source Definition). Historically, most, but not all, Python +releases have also been GPL-compatible; the table below summarizes +the various releases. + + Release Derived Year Owner GPL- + from compatible? (1) + + 0.9.0 thru 1.2 1991-1995 CWI yes + 1.3 thru 1.5.2 1.2 1995-1999 CNRI yes + 1.6 1.5.2 2000 CNRI no + 2.0 1.6 2000 BeOpen.com no + 1.6.1 1.6 2001 CNRI yes (2) + 2.1 2.0+1.6.1 2001 PSF no + 2.0.1 2.0+1.6.1 2001 PSF yes + 2.1.1 2.1+2.0.1 2001 PSF yes + 2.2 2.1.1 2001 PSF yes + 2.1.2 2.1.1 2002 PSF yes + 2.1.3 2.1.2 2002 PSF yes + 2.2 and above 2.1.1 2001-now PSF yes + +Footnotes: + +(1) GPL-compatible doesn't mean that we're distributing Python under + the GPL. All Python licenses, unlike the GPL, let you distribute + a modified version without making your changes open source. The + GPL-compatible licenses make it possible to combine Python with + other software that is released under the GPL; the others don't. + +(2) According to Richard Stallman, 1.6.1 is not GPL-compatible, + because its license has a choice of law clause. According to + CNRI, however, Stallman's lawyer has told CNRI's lawyer that 1.6.1 + is "not incompatible" with the GPL. + +Thanks to the many outside volunteers who have worked under Guido's +direction to make these releases possible. + + +B. TERMS AND CONDITIONS FOR ACCESSING OR OTHERWISE USING PYTHON +=============================================================== + +PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2 +-------------------------------------------- + +1. This LICENSE AGREEMENT is between the Python Software Foundation +("PSF"), and the Individual or Organization ("Licensee") accessing and +otherwise using this software ("Python") in source or binary form and +its associated documentation. + +2. Subject to the terms and conditions of this License Agreement, PSF +hereby grants Licensee a nonexclusive, royalty-free, world-wide +license to reproduce, analyze, test, perform and/or display publicly, +prepare derivative works, distribute, and otherwise use Python alone +or in any derivative version, provided, however, that PSF's License +Agreement and PSF's notice of copyright, i.e., "Copyright (c) 2001, +2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, +2013, 2014 Python Software Foundation; All Rights Reserved" are +retained in Python alone or in any derivative version prepared by +Licensee. + +3. In the event Licensee prepares a derivative work that is based on +or incorporates Python or any part thereof, and wants to make +the derivative work available to others as provided herein, then +Licensee hereby agrees to include in any such work a brief summary of +the changes made to Python. + +4. PSF is making Python available to Licensee on an "AS IS" +basis. PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR +IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND +DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS +FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON WILL NOT +INFRINGE ANY THIRD PARTY RIGHTS. + +5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON +FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS +A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON, +OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. + +6. This License Agreement will automatically terminate upon a material +breach of its terms and conditions. + +7. Nothing in this License Agreement shall be deemed to create any +relationship of agency, partnership, or joint venture between PSF and +Licensee. This License Agreement does not grant permission to use PSF +trademarks or trade name in a trademark sense to endorse or promote +products or services of Licensee, or any third party. + +8. By copying, installing or otherwise using Python, Licensee +agrees to be bound by the terms and conditions of this License +Agreement. + + +BEOPEN.COM LICENSE AGREEMENT FOR PYTHON 2.0 +------------------------------------------- + +BEOPEN PYTHON OPEN SOURCE LICENSE AGREEMENT VERSION 1 + +1. This LICENSE AGREEMENT is between BeOpen.com ("BeOpen"), having an +office at 160 Saratoga Avenue, Santa Clara, CA 95051, and the +Individual or Organization ("Licensee") accessing and otherwise using +this software in source or binary form and its associated +documentation ("the Software"). + +2. Subject to the terms and conditions of this BeOpen Python License +Agreement, BeOpen hereby grants Licensee a non-exclusive, +royalty-free, world-wide license to reproduce, analyze, test, perform +and/or display publicly, prepare derivative works, distribute, and +otherwise use the Software alone or in any derivative version, +provided, however, that the BeOpen Python License is retained in the +Software, alone or in any derivative version prepared by Licensee. + +3. BeOpen is making the Software available to Licensee on an "AS IS" +basis. BEOPEN MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR +IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, BEOPEN MAKES NO AND +DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS +FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE WILL NOT +INFRINGE ANY THIRD PARTY RIGHTS. + +4. BEOPEN SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF THE +SOFTWARE FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS +AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THE SOFTWARE, OR ANY +DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. + +5. This License Agreement will automatically terminate upon a material +breach of its terms and conditions. + +6. This License Agreement shall be governed by and interpreted in all +respects by the law of the State of California, excluding conflict of +law provisions. Nothing in this License Agreement shall be deemed to +create any relationship of agency, partnership, or joint venture +between BeOpen and Licensee. This License Agreement does not grant +permission to use BeOpen trademarks or trade names in a trademark +sense to endorse or promote products or services of Licensee, or any +third party. As an exception, the "BeOpen Python" logos available at +http://www.pythonlabs.com/logos.html may be used according to the +permissions granted on that web page. + +7. By copying, installing or otherwise using the software, Licensee +agrees to be bound by the terms and conditions of this License +Agreement. + + +CNRI LICENSE AGREEMENT FOR PYTHON 1.6.1 +--------------------------------------- + +1. This LICENSE AGREEMENT is between the Corporation for National +Research Initiatives, having an office at 1895 Preston White Drive, +Reston, VA 20191 ("CNRI"), and the Individual or Organization +("Licensee") accessing and otherwise using Python 1.6.1 software in +source or binary form and its associated documentation. + +2. Subject to the terms and conditions of this License Agreement, CNRI +hereby grants Licensee a nonexclusive, royalty-free, world-wide +license to reproduce, analyze, test, perform and/or display publicly, +prepare derivative works, distribute, and otherwise use Python 1.6.1 +alone or in any derivative version, provided, however, that CNRI's +License Agreement and CNRI's notice of copyright, i.e., "Copyright (c) +1995-2001 Corporation for National Research Initiatives; All Rights +Reserved" are retained in Python 1.6.1 alone or in any derivative +version prepared by Licensee. Alternately, in lieu of CNRI's License +Agreement, Licensee may substitute the following text (omitting the +quotes): "Python 1.6.1 is made available subject to the terms and +conditions in CNRI's License Agreement. This Agreement together with +Python 1.6.1 may be located on the Internet using the following +unique, persistent identifier (known as a handle): 1895.22/1013. This +Agreement may also be obtained from a proxy server on the Internet +using the following URL: http://hdl.handle.net/1895.22/1013". + +3. In the event Licensee prepares a derivative work that is based on +or incorporates Python 1.6.1 or any part thereof, and wants to make +the derivative work available to others as provided herein, then +Licensee hereby agrees to include in any such work a brief summary of +the changes made to Python 1.6.1. + +4. CNRI is making Python 1.6.1 available to Licensee on an "AS IS" +basis. CNRI MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR +IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, CNRI MAKES NO AND +DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS +FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON 1.6.1 WILL NOT +INFRINGE ANY THIRD PARTY RIGHTS. + +5. CNRI SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON +1.6.1 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS +A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON 1.6.1, +OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. + +6. This License Agreement will automatically terminate upon a material +breach of its terms and conditions. + +7. This License Agreement shall be governed by the federal +intellectual property law of the United States, including without +limitation the federal copyright law, and, to the extent such +U.S. federal law does not apply, by the law of the Commonwealth of +Virginia, excluding Virginia's conflict of law provisions. +Notwithstanding the foregoing, with regard to derivative works based +on Python 1.6.1 that incorporate non-separable material that was +previously distributed under the GNU General Public License (GPL), the +law of the Commonwealth of Virginia shall govern this License +Agreement only as to issues arising under or with respect to +Paragraphs 4, 5, and 7 of this License Agreement. Nothing in this +License Agreement shall be deemed to create any relationship of +agency, partnership, or joint venture between CNRI and Licensee. This +License Agreement does not grant permission to use CNRI trademarks or +trade name in a trademark sense to endorse or promote products or +services of Licensee, or any third party. + +8. By clicking on the "ACCEPT" button where indicated, or by copying, +installing or otherwise using Python 1.6.1, Licensee agrees to be +bound by the terms and conditions of this License Agreement. + + ACCEPT + + +CWI LICENSE AGREEMENT FOR PYTHON 0.9.0 THROUGH 1.2 +-------------------------------------------------- + +Copyright (c) 1991 - 1995, Stichting Mathematisch Centrum Amsterdam, +The Netherlands. All rights reserved. + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Stichting Mathematisch +Centrum or CWI not be used in advertising or publicity pertaining to +distribution of the software without specific, written prior +permission. + +STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO +THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE +FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT +OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + + +Licenses and Acknowledgements for Incorporated Software +======================================================= + +Mersenne Twister +---------------- + +The `_random' module includes code based on a download from +`http://www.math.keio.ac.jp/~matumoto/MT2002/emt19937ar.html'. The +following are the verbatim comments from the original code: + + A C-program for MT19937, with initialization improved 2002/1/26. + Coded by Takuji Nishimura and Makoto Matsumoto. + + Before using, initialize the state by using init_genrand(seed) + or init_by_array(init_key, key_length). + + Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + 3. The names of its contributors may not be used to endorse or promote + products derived from this software without specific prior written + permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + Any feedback is very welcome. + http://www.math.keio.ac.jp/matumoto/emt.html + email: matumoto@math.keio.ac.jp + + +Sockets +------- + +The `socket' module uses the functions, `getaddrinfo', and +`getnameinfo', which are coded in separate source files from the WIDE +Project, `http://www.wide.ad.jp/about/index.html'. + + Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. Neither the name of the project nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + GAI_ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + FOR GAI_ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON GAI_ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN GAI_ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + OF THE POSSIBILITY OF SUCH DAMAGE. + + +Floating point exception control +-------------------------------- + +The source for the `fpectl' module includes the following notice: + + --------------------------------------------------------------------- + / Copyright (c) 1996. \ + | The Regents of the University of California. | + | All rights reserved. | + | | + | Permission to use, copy, modify, and distribute this software for | + | any purpose without fee is hereby granted, provided that this en- | + | tire notice is included in all copies of any software which is or | + | includes a copy or modification of this software and in all | + | copies of the supporting documentation for such software. | + | | + | This work was produced at the University of California, Lawrence | + | Livermore National Laboratory under contract no. W-7405-ENG-48 | + | between the U.S. Department of Energy and The Regents of the | + | University of California for the operation of UC LLNL. | + | | + | DISCLAIMER | + | | + | This software was prepared as an account of work sponsored by an | + | agency of the United States Government. Neither the United States | + | Government nor the University of California nor any of their em- | + | ployees, makes any warranty, express or implied, or assumes any | + | liability or responsibility for the accuracy, completeness, or | + | usefulness of any information, apparatus, product, or process | + | disclosed, or represents that its use would not infringe | + | privately-owned rights. Reference herein to any specific commer- | + | cial products, process, or service by trade name, trademark, | + | manufacturer, or otherwise, does not necessarily constitute or | + | imply its endorsement, recommendation, or favoring by the United | + | States Government or the University of California. The views and | + | opinions of authors expressed herein do not necessarily state or | + | reflect those of the United States Government or the University | + | of California, and shall not be used for advertising or product | + \ endorsement purposes. / + --------------------------------------------------------------------- + + +Cookie management +----------------- + +The `Cookie' module contains the following notice: + + Copyright 2000 by Timothy O'Malley + + All Rights Reserved + + Permission to use, copy, modify, and distribute this software + and its documentation for any purpose and without fee is hereby + granted, provided that the above copyright notice appear in all + copies and that both that copyright notice and this permission + notice appear in supporting documentation, and that the name of + Timothy O'Malley not be used in advertising or publicity + pertaining to distribution of the software without specific, written + prior permission. + + Timothy O'Malley DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS + SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS, IN NO EVENT SHALL Timothy O'Malley BE LIABLE FOR + ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + PERFORMANCE OF THIS SOFTWARE. + + +Execution tracing +----------------- + +The `trace' module contains the following notice: + + portions copyright 2001, Autonomous Zones Industries, Inc., all rights... + err... reserved and offered to the public under the terms of the + Python 2.2 license. + Author: Zooko O'Whielacronx + http://zooko.com/ + mailto:zooko@zooko.com + + Copyright 2000, Mojam Media, Inc., all rights reserved. + Author: Skip Montanaro + + Copyright 1999, Bioreason, Inc., all rights reserved. + Author: Andrew Dalke + + Copyright 1995-1997, Automatrix, Inc., all rights reserved. + Author: Skip Montanaro + + Copyright 1991-1995, Stichting Mathematisch Centrum, all rights reserved. + + Permission to use, copy, modify, and distribute this Python software and + its associated documentation for any purpose without fee is hereby + granted, provided that the above copyright notice appears in all copies, + and that both that copyright notice and this permission notice appear in + supporting documentation, and that the name of neither Automatrix, + Bioreason or Mojam Media be used in advertising or publicity pertaining + to distribution of the software without specific, written prior + permission. + + +UUencode and UUdecode functions +------------------------------- + +The `uu' module contains the following notice: + + Copyright 1994 by Lance Ellinghouse + Cathedral City, California Republic, United States of America. + All Rights Reserved + Permission to use, copy, modify, and distribute this software and its + documentation for any purpose and without fee is hereby granted, + provided that the above copyright notice appear in all copies and that + both that copyright notice and this permission notice appear in + supporting documentation, and that the name of Lance Ellinghouse + not be used in advertising or publicity pertaining to distribution + of the software without specific, written prior permission. + LANCE ELLINGHOUSE DISCLAIMS ALL WARRANTIES WITH REGARD TO + THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + FITNESS, IN NO EVENT SHALL LANCE ELLINGHOUSE CENTRUM BE LIABLE + FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT + OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + + Modified by Jack Jansen, CWI, July 1995: + - Use binascii module to do the actual line-by-line conversion + between ascii and binary. This results in a 1000-fold speedup. The C + version is still 5 times faster, though. + - Arguments more compliant with python standard + + +XML Remote Procedure Calls +-------------------------- + +The `xmlrpclib' module contains the following notice: + + The XML-RPC client interface is + + Copyright (c) 1999-2002 by Secret Labs AB + Copyright (c) 1999-2002 by Fredrik Lundh + + By obtaining, using, and/or copying this software and/or its + associated documentation, you agree that you have read, understood, + and will comply with the following terms and conditions: + + Permission to use, copy, modify, and distribute this software and + its associated documentation for any purpose and without fee is + hereby granted, provided that the above copyright notice appears in + all copies, and that both that copyright notice and this permission + notice appear in supporting documentation, and that the name of + Secret Labs AB or the author not be used in advertising or publicity + pertaining to distribution of the software without specific, written + prior permission. + + SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD + TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT- + ABILITY AND FITNESS. IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR + BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY + DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + OF THIS SOFTWARE. + +Licenses for Software linked to +=============================== + +Note that the choice of GPL compatibility outlined above doesn't extend +to modules linked to particular libraries, since they change the +effective License of the module binary. + + +GNU Readline +------------ + +The 'readline' module makes use of GNU Readline. + + The GNU Readline Library is free software; you can redistribute it + and/or modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. + + On Debian systems, you can find the complete statement in + /usr/share/doc/readline-common/copyright'. A copy of the GNU General + Public License is available in /usr/share/common-licenses/GPL-2'. + + +OpenSSL +------- + +The '_ssl' module makes use of OpenSSL. + + The OpenSSL toolkit stays under a dual license, i.e. both the + conditions of the OpenSSL License and the original SSLeay license + apply to the toolkit. Actually both licenses are BSD-style Open + Source licenses. Note that both licenses are incompatible with + the GPL. + + On Debian systems, you can find the complete license text in + /usr/share/doc/openssl/copyright'. + + +Files with other licenses than the Python License +------------------------------------------------- + +Files: Include/dynamic_annotations.h +Files: Python/dynamic_annotations.c +Copyright: (c) 2008-2009, Google Inc. +License: Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Neither the name of Google Inc. nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +Files: Include/unicodeobject.h +Copyright: (c) Corporation for National Research Initiatives. +Copyright: (c) 1999 by Secret Labs AB. +Copyright: (c) 1999 by Fredrik Lundh. +License: By obtaining, using, and/or copying this software and/or its + associated documentation, you agree that you have read, understood, + and will comply with the following terms and conditions: + + Permission to use, copy, modify, and distribute this software and its + associated documentation for any purpose and without fee is hereby + granted, provided that the above copyright notice appears in all + copies, and that both that copyright notice and this permission notice + appear in supporting documentation, and that the name of Secret Labs + AB or the author not be used in advertising or publicity pertaining to + distribution of the software without specific, written prior + permission. + + SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO + THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + FITNESS. IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR BE LIABLE FOR + ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT + OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +Files: Lib/logging/* +Copyright: 2001-2010 by Vinay Sajip. All Rights Reserved. +License: Permission to use, copy, modify, and distribute this software and + its documentation for any purpose and without fee is hereby granted, + provided that the above copyright notice appear in all copies and that + both that copyright notice and this permission notice appear in + supporting documentation, and that the name of Vinay Sajip + not be used in advertising or publicity pertaining to distribution + of the software without specific, written prior permission. + VINAY SAJIP DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL + VINAY SAJIP BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER + IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT + OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +Files: Lib/multiprocessing/* +Files: Modules/_multiprocessing/* +Copyright: (c) 2006-2008, R Oudkerk. All rights reserved. +License: Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. Neither the name of author nor the names of any contributors may be + used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + +Files: Lib/sqlite3/* +Files: Modules/_sqlite/* +Copyright: (C) 2004-2005 Gerhard Häring +License: This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + +Files: Lib/async* +Copyright: Copyright 1996 by Sam Rushing +License: Permission to use, copy, modify, and distribute this software and + its documentation for any purpose and without fee is hereby + granted, provided that the above copyright notice appear in all + copies and that both that copyright notice and this permission + notice appear in supporting documentation, and that the name of Sam + Rushing not be used in advertising or publicity pertaining to + distribution of the software without specific, written prior + permission. + + SAM RUSHING DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN + NO EVENT SHALL SAM RUSHING BE LIABLE FOR ANY SPECIAL, INDIRECT OR + CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +Files: Lib/tarfile.py +Copyright: (C) 2002 Lars Gustaebel +License: Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + +Files: Lib/turtle.py +Copyright: (C) 2006 - 2010 Gregor Lingl +License: This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + is copyright Gregor Lingl and licensed under a BSD-like license + +Files: Modules/_ctypes/libffi/* +Copyright: Copyright (C) 1996-2011 Red Hat, Inc and others. + Copyright (C) 1996-2011 Anthony Green + Copyright (C) 1996-2010 Free Software Foundation, Inc + Copyright (c) 2003, 2004, 2006, 2007, 2008 Kaz Kojima + Copyright (c) 2010, 2011, Plausible Labs Cooperative , Inc. + Copyright (c) 2010 CodeSourcery + Copyright (c) 1998 Andreas Schwab + Copyright (c) 2000 Hewlett Packard Company + Copyright (c) 2009 Bradley Smith + Copyright (c) 2008 David Daney + Copyright (c) 2004 Simon Posnjak + Copyright (c) 2005 Axis Communications AB + Copyright (c) 1998 Cygnus Solutions + Copyright (c) 2004 Renesas Technology + Copyright (c) 2002, 2007 Bo Thorsen + Copyright (c) 2002 Ranjit Mathew + Copyright (c) 2002 Roger Sayle + Copyright (c) 2000, 2007 Software AG + Copyright (c) 2003 Jakub Jelinek + Copyright (c) 2000, 2001 John Hornkvist + Copyright (c) 1998 Geoffrey Keating + Copyright (c) 2008 Björn König + +License: Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + + Documentation: + Permission is granted to copy, distribute and/or modify this document + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any + later version. A copy of the license is included in the + section entitled ``GNU General Public License''. + +Files: Modules/_gestalt.c +Copyright: 1991-1997 by Stichting Mathematisch Centrum, Amsterdam. +License: Permission to use, copy, modify, and distribute this software and its + documentation for any purpose and without fee is hereby granted, + provided that the above copyright notice appear in all copies and that + both that copyright notice and this permission notice appear in + supporting documentation, and that the names of Stichting Mathematisch + Centrum or CWI not be used in advertising or publicity pertaining to + distribution of the software without specific, written prior permission. + + STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO + THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE + FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT + OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +Files: Modules/syslogmodule.c +Copyright: 1994 by Lance Ellinghouse +License: Permission to use, copy, modify, and distribute this software and its + documentation for any purpose and without fee is hereby granted, + provided that the above copyright notice appear in all copies and that + both that copyright notice and this permission notice appear in + supporting documentation, and that the name of Lance Ellinghouse + not be used in advertising or publicity pertaining to distribution + of the software without specific, written prior permission. + + LANCE ELLINGHOUSE DISCLAIMS ALL WARRANTIES WITH REGARD TO + THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + FITNESS, IN NO EVENT SHALL LANCE ELLINGHOUSE BE LIABLE FOR ANY SPECIAL, + INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING + FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION + WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +Files: Modules/zlib/* +Copyright: (C) 1995-2010 Jean-loup Gailly and Mark Adler +License: This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + Jean-loup Gailly Mark Adler + jloup@gzip.org madler@alumni.caltech.edu + + If you use the zlib library in a product, we would appreciate *not* receiving + lengthy legal documents to sign. The sources are provided for free but without + warranty of any kind. The library has been entirely written by Jean-loup + Gailly and Mark Adler; it does not include third-party code. + +Files: Modules/expat/* +Copyright: Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd + and Clark Cooper + Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006 Expat maintainers +License: Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Files: Modules/_decimal/libmpdec/* +Copyright: Copyright (c) 2008-2012 Stefan Krah. All rights reserved. +License: Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + . + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + . + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + , + THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + +Files: Misc/python-mode.el +Copyright: Copyright (C) 1992,1993,1994 Tim Peters +License: This software is provided as-is, without express or implied + warranty. Permission to use, copy, modify, distribute or sell this + software, without fee, for any purpose and by any individual or + organization, is hereby granted, provided that the above copyright + notice and this paragraph appear in all copies. + +Files: Python/dtoa.c +Copyright: (c) 1991, 2000, 2001 by Lucent Technologies. +License: Permission to use, copy, modify, and distribute this software for any + purpose without fee is hereby granted, provided that this entire notice + is included in all copies of any software which is or includes a copy + or modification of this software and in all copies of the supporting + documentation for such software. + + THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED + WARRANTY. IN PARTICULAR, NEITHER THE AUTHOR NOR LUCENT MAKES ANY + REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY + OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. + +Files: Python/getopt.c +Copyright: 1992-1994, David Gottner +License: Permission to use, copy, modify, and distribute this software and its + documentation for any purpose and without fee is hereby granted, + provided that the above copyright notice, this permission notice and + the following disclaimer notice appear unmodified in all copies. + + I DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL I + BE LIABLE FOR ANY SPECIAL, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY + DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER + IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT + OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +Files: PC/_subprocess.c +Copyright: Copyright (c) 2004 by Fredrik Lundh + Copyright (c) 2004 by Secret Labs AB, http://www.pythonware.com + Copyright (c) 2004 by Peter Astrand +License: + * Permission to use, copy, modify, and distribute this software and + * its associated documentation for any purpose and without fee is + * hereby granted, provided that the above copyright notice appears in + * all copies, and that both that copyright notice and this permission + * notice appear in supporting documentation, and that the name of the + * authors not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior + * permission. + * + * THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. + * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +Files: PC/winsound.c +Copyright: Copyright (c) 1999 Toby Dickenson +License: * Permission to use this software in any way is granted without + * fee, provided that the copyright notice above appears in all + * copies. This software is provided "as is" without any warranty. + */ + +/* Modified by Guido van Rossum */ +/* Beep added by Mark Hammond */ +/* Win9X Beep and platform identification added by Uncle Timmy */ + +Files: Tools/pybench/* +Copyright: (c), 1997-2006, Marc-Andre Lemburg (mal@lemburg.com) + (c), 2000-2006, eGenix.com Software GmbH (info@egenix.com) +License: Permission to use, copy, modify, and distribute this software and its + documentation for any purpose and without fee or royalty is hereby + granted, provided that the above copyright notice appear in all copies + and that both that copyright notice and this permission notice appear + in supporting documentation or portions thereof, including + modifications, that you make. + + THE AUTHOR MARC-ANDRE LEMBURG DISCLAIMS ALL WARRANTIES WITH REGARD TO + THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + FITNESS, IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, + INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING + FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION + WITH THE USE OR PERFORMANCE OF THIS SOFTWARE ! diff --git a/debian/depgraph.py b/debian/depgraph.py new file mode 100644 index 000000000000000..6b7ed135eff30a7 --- /dev/null +++ b/debian/depgraph.py @@ -0,0 +1,199 @@ +#! /usr/bin/python3 + +# Copyright 2004 Toby Dickenson +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject +# to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + +import sys, getopt, colorsys, imp, hashlib + +class pydepgraphdot: + + def main(self,argv): + opts,args = getopt.getopt(argv,'',['mono']) + self.colored = 1 + for o,v in opts: + if o=='--mono': + self.colored = 0 + self.render() + + def fix(self,s): + # Convert a module name to a syntactically correct node name + return s.replace('.','_') + + def render(self): + p,t = self.get_data() + + # normalise our input data + for k,d in list(p.items()): + for v in list(d.keys()): + if v not in p: + p[v] = {} + + f = self.get_output_file() + + f.write('digraph G {\n') + #f.write('concentrate = true;\n') + #f.write('ordering = out;\n') + f.write('ranksep=1.0;\n') + f.write('node [style=filled,fontname=Helvetica,fontsize=10];\n') + allkd = list(p.items()) + allkd.sort() + for k,d in allkd: + tk = t.get(k) + if self.use(k,tk): + allv = list(d.keys()) + allv.sort() + for v in allv: + tv = t.get(v) + if self.use(v,tv) and not self.toocommon(v,tv): + f.write('%s -> %s' % ( self.fix(k),self.fix(v) ) ) + self.write_attributes(f,self.edge_attributes(k,v)) + f.write(';\n') + f.write(self.fix(k)) + self.write_attributes(f,self.node_attributes(k,tk)) + f.write(';\n') + f.write('}\n') + + def write_attributes(self,f,a): + if a: + f.write(' [') + f.write(','.join(a)) + f.write(']') + + def node_attributes(self,k,type): + a = [] + a.append('label="%s"' % self.label(k)) + if self.colored: + a.append('fillcolor="%s"' % self.color(k,type)) + else: + a.append('fillcolor=white') + if self.toocommon(k,type): + a.append('peripheries=2') + return a + + def edge_attributes(self,k,v): + a = [] + weight = self.weight(k,v) + if weight!=1: + a.append('weight=%d' % weight) + length = self.alien(k,v) + if length: + a.append('minlen=%d' % length) + return a + + def get_data(self): + t = eval(sys.stdin.read()) + return t['depgraph'],t['types'] + + def get_output_file(self): + return sys.stdout + + def use(self,s,type): + # Return true if this module is interesting and should be drawn. Return false + # if it should be completely omitted. This is a default policy - please override. + if s=='__main__': + return 0 + #if s in ('os','sys','time','__future__','types','re','string'): + if s in ('sys'): + # nearly all modules use all of these... more or less. They add nothing to + # our diagram. + return 0 + if s.startswith('encodings.'): + return 0 + if self.toocommon(s,type): + # A module where we dont want to draw references _to_. Dot doesnt handle these + # well, so it is probably best to not draw them at all. + return 0 + return 1 + + def toocommon(self,s,type): + # Return true if references to this module are uninteresting. Such references + # do not get drawn. This is a default policy - please override. + # + if s=='__main__': + # references *to* __main__ are never interesting. omitting them means + # that main floats to the top of the page + return 1 + #if type==imp.PKG_DIRECTORY: + # # dont draw references to packages. + # return 1 + return 0 + + def weight(self,a,b): + # Return the weight of the dependency from a to b. Higher weights + # usually have shorter straighter edges. Return 1 if it has normal weight. + # A value of 4 is usually good for ensuring that a related pair of modules + # are drawn next to each other. This is a default policy - please override. + # + if b.split('.')[-1].startswith('_'): + # A module that starts with an underscore. You need a special reason to + # import these (for example random imports _random), so draw them close + # together + return 4 + return 1 + + def alien(self,a,b): + # Return non-zero if references to this module are strange, and should be drawn + # extra-long. the value defines the length, in rank. This is also good for putting some + # vertical space between seperate subsystems. This is a default policy - please override. + # + return 0 + + def label(self,s): + # Convert a module name to a formatted node label. This is a default policy - please override. + # + return '\\.\\n'.join(s.split('.')) + + def color(self,s,type): + # Return the node color for this module name. This is a default policy - please override. + # + # Calculate a color systematically based on the hash of the module name. Modules in the + # same package have the same color. Unpackaged modules are grey + t = self.normalise_module_name_for_hash_coloring(s,type) + return self.color_from_name(t) + + def normalise_module_name_for_hash_coloring(self,s,type): + if type==imp.PKG_DIRECTORY: + return s + else: + i = s.rfind('.') + if i<0: + return '' + else: + return s[:i] + + def color_from_name(self,name): + n = hashlib.md5(name.encode('utf-8')).digest() + hf = float(n[0]+n[1]*0xff)/0xffff + sf = float(n[2])/0xff + vf = float(n[3])/0xff + r,g,b = colorsys.hsv_to_rgb(hf, 0.3+0.6*sf, 0.8+0.2*vf) + return '#%02x%02x%02x' % (int(r*256),int(g*256),int(b*256)) + + +def main(): + pydepgraphdot().main(sys.argv[1:]) + +if __name__=='__main__': + main() + + + diff --git a/debian/dh_doclink b/debian/dh_doclink new file mode 100644 index 000000000000000..99a3f2a783d9df6 --- /dev/null +++ b/debian/dh_doclink @@ -0,0 +1,28 @@ +#! /bin/sh + +pkg=`echo $1 | sed 's/^-p//'` +target=$2 + +ln -sf $target debian/$pkg/usr/share/doc/$pkg + +f=debian/$pkg.postinst.debhelper +if [ ! -e $f ] || [ "`grep -c '^# dh_doclink' $f`" -eq 0 ]; then +cat >> $f <> $f <. +# + +set -e + +DIRLIST="/usr/lib/python@VER@/idlelib" + +case "$1" in + configure|abort-upgrade|abort-remove|abort-deconfigure) + + for i in $DIRLIST ; do + /usr/bin/@PVER@ /usr/lib/@PVER@/compileall.py -q $i + if grep -sq '^byte-compile[^#]*optimize' /etc/python/debian_config + then + /usr/bin/@PVER@ -O /usr/lib/@PVER@/compileall.py -q $i + fi + done + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; + +esac + +#DEBHELPER# + +exit 0 diff --git a/debian/idle-PVER.postrm.in b/debian/idle-PVER.postrm.in new file mode 100644 index 000000000000000..59742ee706f9c78 --- /dev/null +++ b/debian/idle-PVER.postrm.in @@ -0,0 +1,11 @@ +#! /bin/sh + +set -e + +if [ "$1" = "purge" ]; then + rm -rf /etc/idle-@PVER@ +fi + +#DEBHELPER# + +exit 0 diff --git a/debian/idle-PVER.prerm.in b/debian/idle-PVER.prerm.in new file mode 100644 index 000000000000000..de035f8bcfb7a1f --- /dev/null +++ b/debian/idle-PVER.prerm.in @@ -0,0 +1,33 @@ +#! /bin/sh + +set -e + +remove_bytecode() +{ + pkg=$1 + max=$(LANG=C LC_ALL=C xargs --show-limits < /dev/null 2>&1 | awk '/Maximum length/ {print int($NF / 4)}') + LC_ALL=C.UTF8 dpkg -L $pkg \ + | awk -F/ 'BEGIN {OFS="/"} /\.py$/ {$NF=sprintf("__pycache__/%s.*.py[co]", substr($NF,1,length($NF)-3)); print}' \ + | xargs --max-chars=$max echo \ + | while read files; do rm -f $files; done + find /usr/lib/@PVER@ -name dist-packages -prune -o -name __pycache__ -empty -print \ + | xargs -r rm -rf +} + +case "$1" in + remove|upgrade) + remove_bytecode idle-@PVER@ + ;; + deconfigure) + ;; + failed-upgrade) + ;; + *) + echo "prerm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +#DEBHELPER# + +exit 0 diff --git a/debian/idle.desktop.in b/debian/idle.desktop.in new file mode 100644 index 000000000000000..bfeb47a1fa7645e --- /dev/null +++ b/debian/idle.desktop.in @@ -0,0 +1,9 @@ +[Desktop Entry] +Name=IDLE (using Python-@VER@) +Comment=Integrated Development Environment for Python (using Python-@VER@) +Exec=/usr/bin/idle-@PVER@ +Icon=/usr/share/pixmaps/@PVER@.xpm +Terminal=false +Type=Application +Categories=Application;Development; +StartupNotify=true diff --git a/debian/imp.py b/debian/imp.py new file mode 100644 index 000000000000000..fc42c15765852e7 --- /dev/null +++ b/debian/imp.py @@ -0,0 +1,346 @@ +"""This module provides the components needed to build your own __import__ +function. Undocumented functions are obsolete. + +In most cases it is preferred you consider using the importlib module's +functionality over this module. + +""" +# (Probably) need to stay in _imp +from _imp import (lock_held, acquire_lock, release_lock, + get_frozen_object, is_frozen_package, + init_frozen, is_builtin, is_frozen, + _fix_co_filename, _frozen_module_names) +try: + from _imp import create_dynamic +except ImportError: + # Platform doesn't support dynamic loading. + create_dynamic = None + +from importlib._bootstrap import _ERR_MSG, _exec, _load, _builtin_from_name +from importlib._bootstrap_external import SourcelessFileLoader + +from importlib import machinery +from importlib import util +import importlib +import os +import sys +import tokenize +import types +import warnings + +warnings.warn("the imp module is deprecated in favour of importlib and slated " + "for removal in Python 3.12; " + "see the module's documentation for alternative uses", + DeprecationWarning, stacklevel=2) + +# DEPRECATED +SEARCH_ERROR = 0 +PY_SOURCE = 1 +PY_COMPILED = 2 +C_EXTENSION = 3 +PY_RESOURCE = 4 +PKG_DIRECTORY = 5 +C_BUILTIN = 6 +PY_FROZEN = 7 +PY_CODERESOURCE = 8 +IMP_HOOK = 9 + + +def new_module(name): + """**DEPRECATED** + + Create a new module. + + The module is not entered into sys.modules. + + """ + return types.ModuleType(name) + + +def get_magic(): + """**DEPRECATED** + + Return the magic number for .pyc files. + """ + return util.MAGIC_NUMBER + + +def get_tag(): + """Return the magic tag for .pyc files.""" + return sys.implementation.cache_tag + + +def cache_from_source(path, debug_override=None): + """**DEPRECATED** + + Given the path to a .py file, return the path to its .pyc file. + + The .py file does not need to exist; this simply returns the path to the + .pyc file calculated as if the .py file were imported. + + If debug_override is not None, then it must be a boolean and is used in + place of sys.flags.optimize. + + If sys.implementation.cache_tag is None then NotImplementedError is raised. + + """ + with warnings.catch_warnings(): + warnings.simplefilter('ignore') + return util.cache_from_source(path, debug_override) + + +def source_from_cache(path): + """**DEPRECATED** + + Given the path to a .pyc. file, return the path to its .py file. + + The .pyc file does not need to exist; this simply returns the path to + the .py file calculated to correspond to the .pyc file. If path does + not conform to PEP 3147 format, ValueError will be raised. If + sys.implementation.cache_tag is None then NotImplementedError is raised. + + """ + return util.source_from_cache(path) + + +def get_suffixes(): + """**DEPRECATED**""" + extensions = [(s, 'rb', C_EXTENSION) for s in machinery.EXTENSION_SUFFIXES] + source = [(s, 'r', PY_SOURCE) for s in machinery.SOURCE_SUFFIXES] + bytecode = [(s, 'rb', PY_COMPILED) for s in machinery.BYTECODE_SUFFIXES] + + return extensions + source + bytecode + + +class NullImporter: + + """**DEPRECATED** + + Null import object. + + """ + + def __init__(self, path): + if path == '': + raise ImportError('empty pathname', path='') + elif os.path.isdir(path): + raise ImportError('existing directory', path=path) + + def find_module(self, fullname): + """Always returns None.""" + return None + + +class _HackedGetData: + + """Compatibility support for 'file' arguments of various load_*() + functions.""" + + def __init__(self, fullname, path, file=None): + super().__init__(fullname, path) + self.file = file + + def get_data(self, path): + """Gross hack to contort loader to deal w/ load_*()'s bad API.""" + if self.file and path == self.path: + # The contract of get_data() requires us to return bytes. Reopen the + # file in binary mode if needed. + if not self.file.closed: + file = self.file + if 'b' not in file.mode: + file.close() + if self.file.closed: + self.file = file = open(self.path, 'rb') + + with file: + return file.read() + else: + return super().get_data(path) + + +class _LoadSourceCompatibility(_HackedGetData, machinery.SourceFileLoader): + + """Compatibility support for implementing load_source().""" + + +def load_source(name, pathname, file=None): + loader = _LoadSourceCompatibility(name, pathname, file) + spec = util.spec_from_file_location(name, pathname, loader=loader) + if name in sys.modules: + module = _exec(spec, sys.modules[name]) + else: + module = _load(spec) + # To allow reloading to potentially work, use a non-hacked loader which + # won't rely on a now-closed file object. + module.__loader__ = machinery.SourceFileLoader(name, pathname) + module.__spec__.loader = module.__loader__ + return module + + +class _LoadCompiledCompatibility(_HackedGetData, SourcelessFileLoader): + + """Compatibility support for implementing load_compiled().""" + + +def load_compiled(name, pathname, file=None): + """**DEPRECATED**""" + loader = _LoadCompiledCompatibility(name, pathname, file) + spec = util.spec_from_file_location(name, pathname, loader=loader) + if name in sys.modules: + module = _exec(spec, sys.modules[name]) + else: + module = _load(spec) + # To allow reloading to potentially work, use a non-hacked loader which + # won't rely on a now-closed file object. + module.__loader__ = SourcelessFileLoader(name, pathname) + module.__spec__.loader = module.__loader__ + return module + + +def load_package(name, path): + """**DEPRECATED**""" + if os.path.isdir(path): + extensions = (machinery.SOURCE_SUFFIXES[:] + + machinery.BYTECODE_SUFFIXES[:]) + for extension in extensions: + init_path = os.path.join(path, '__init__' + extension) + if os.path.exists(init_path): + path = init_path + break + else: + raise ValueError('{!r} is not a package'.format(path)) + spec = util.spec_from_file_location(name, path, + submodule_search_locations=[]) + if name in sys.modules: + return _exec(spec, sys.modules[name]) + else: + return _load(spec) + + +def load_module(name, file, filename, details): + """**DEPRECATED** + + Load a module, given information returned by find_module(). + + The module name must include the full package name, if any. + + """ + suffix, mode, type_ = details + if mode and (not mode.startswith('r') or '+' in mode): + raise ValueError('invalid file open mode {!r}'.format(mode)) + elif file is None and type_ in {PY_SOURCE, PY_COMPILED}: + msg = 'file object required for import (type code {})'.format(type_) + raise ValueError(msg) + elif type_ == PY_SOURCE: + return load_source(name, filename, file) + elif type_ == PY_COMPILED: + return load_compiled(name, filename, file) + elif type_ == C_EXTENSION and load_dynamic is not None: + if file is None: + with open(filename, 'rb') as opened_file: + return load_dynamic(name, filename, opened_file) + else: + return load_dynamic(name, filename, file) + elif type_ == PKG_DIRECTORY: + return load_package(name, filename) + elif type_ == C_BUILTIN: + return init_builtin(name) + elif type_ == PY_FROZEN: + return init_frozen(name) + else: + msg = "Don't know how to import {} (type code {})".format(name, type_) + raise ImportError(msg, name=name) + + +def find_module(name, path=None): + """**DEPRECATED** + + Search for a module. + + If path is omitted or None, search for a built-in, frozen or special + module and continue search in sys.path. The module name cannot + contain '.'; to search for a submodule of a package, pass the + submodule name and the package's __path__. + + """ + if not isinstance(name, str): + raise TypeError("'name' must be a str, not {}".format(type(name))) + elif not isinstance(path, (type(None), list)): + # Backwards-compatibility + raise RuntimeError("'path' must be None or a list, " + "not {}".format(type(path))) + + if path is None: + if is_builtin(name): + return None, None, ('', '', C_BUILTIN) + elif is_frozen(name): + return None, None, ('', '', PY_FROZEN) + else: + path = sys.path + + for entry in path: + package_directory = os.path.join(entry, name) + for suffix in ['.py', machinery.BYTECODE_SUFFIXES[0]]: + package_file_name = '__init__' + suffix + file_path = os.path.join(package_directory, package_file_name) + if os.path.isfile(file_path): + return None, package_directory, ('', '', PKG_DIRECTORY) + for suffix, mode, type_ in get_suffixes(): + file_name = name + suffix + file_path = os.path.join(entry, file_name) + if os.path.isfile(file_path): + break + else: + continue + break # Break out of outer loop when breaking out of inner loop. + else: + raise ImportError(_ERR_MSG.format(name), name=name) + + encoding = None + if 'b' not in mode: + with open(file_path, 'rb') as file: + encoding = tokenize.detect_encoding(file.readline)[0] + file = open(file_path, mode, encoding=encoding) + return file, file_path, (suffix, mode, type_) + + +def reload(module): + """**DEPRECATED** + + Reload the module and return it. + + The module must have been successfully imported before. + + """ + return importlib.reload(module) + + +def init_builtin(name): + """**DEPRECATED** + + Load and return a built-in module by name, or None is such module doesn't + exist + """ + try: + return _builtin_from_name(name) + except ImportError: + return None + + +if create_dynamic: + def load_dynamic(name, path, file=None): + """**DEPRECATED** + + Load an extension module. + """ + import importlib.machinery + loader = importlib.machinery.ExtensionFileLoader(name, path) + + # Issue #24748: Skip the sys.modules check in _load_module_shim; + # always load new extension + spec = importlib.machinery.ModuleSpec( + name=name, loader=loader, origin=path) + return _load(spec) + +else: + load_dynamic = None diff --git a/debian/libPVER-dbg.overrides.in b/debian/libPVER-dbg.overrides.in new file mode 100644 index 000000000000000..2496cd5f884feac --- /dev/null +++ b/debian/libPVER-dbg.overrides.in @@ -0,0 +1,20 @@ +lib@PVER@-dbg binary: package-name-doesnt-match-sonames +lib@PVER@-dbg binary: non-dev-pkg-with-shlib-symlink + +# no, it's not unusual +lib@PVER@-dbg binary: unusual-interpreter + +# just the gdb debug file +lib@PVER@-dbg binary: python3-script-but-no-python3-dep + +# pointless lintian ... +lib@PVER@-dbg binary: hardening-no-fortify-functions + +lib@PVER@-dbg binary: arch-dependent-file-not-in-arch-specific-directory + +# yes, some extensions don't have references to any external lib +lib@PVER@-dbg binary: shared-lib-without-dependency-information +lib@PVER@-dbg binary: library-not-linked-against-libc + +# pyexpat.c contains expat error messages that lintian mis-attributes to embedding +lib@PVER@-dbg binary: embedded-library diff --git a/debian/libPVER-dbg.prerm.in b/debian/libPVER-dbg.prerm.in new file mode 100644 index 000000000000000..a409ffee66d2083 --- /dev/null +++ b/debian/libPVER-dbg.prerm.in @@ -0,0 +1,23 @@ +#! /bin/sh + +set -e + +case "$1" in + remove) + LC_ALL=C.UTF8 dpkg -L lib@PVER@-dbg@HOST_QUAL@ \ + | awk '/\.py$/ {print $0"c\n" $0"o"}' \ + | xargs -r rm -f >&2 + ;; + upgrade) + ;; + deconfigure) + ;; + failed-upgrade) + ;; + *) + echo "prerm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +#DEBHELPER# diff --git a/debian/libPVER-dbg.symbols.in b/debian/libPVER-dbg.symbols.in new file mode 100644 index 000000000000000..de278dbb47520aa --- /dev/null +++ b/debian/libPVER-dbg.symbols.in @@ -0,0 +1,15 @@ +libpython@VER@d.so.1.0 libpython@VER@-dbg #MINVER# +#include "libpython.symbols" + _PyInterpreterState_GetRefTotal@Base @SVER@ + _PyObject_DebugMallocStats@Base @SVER@ + _PySet_Dummy@Base @SVER@ + _PyUnicode_CheckConsistency@Base @SVER@ + _Py_Dealloc@Base @SVER@ + _Py_DECREF_DecRefTotal@Base @SVER@ + _Py_GetGlobalRefTotal@Base @SVER@ + _Py_GetLegacyRefTotal@Base @SVER@ + _Py_INCREF_IncRefTotal@Base @SVER@ + _Py_NegativeRefcount@Base @SVER@ + _Py_RefTotal@Base @SVER@ + PyModule_Create2@Base @SVER@ + PyModule_FromDefAndSpec2@Base @SVER@ diff --git a/debian/libPVER-dev.overrides.in b/debian/libPVER-dev.overrides.in new file mode 100644 index 000000000000000..678a665ed62626e --- /dev/null +++ b/debian/libPVER-dev.overrides.in @@ -0,0 +1,9 @@ +lib@PVER@-dev binary: python3-script-but-no-python3-dep + +lib@PVER@-dev binary: arch-dependent-file-not-in-arch-specific-directory + +# lintian needs an update for 3.8 +lib@PVER@-dev binary: package-contains-python-header-in-incorrect-directory + +# no, it's not unusual +lib@PVER@-dev binary: unusual-interpreter diff --git a/debian/libPVER-minimal.overrides.in b/debian/libPVER-minimal.overrides.in new file mode 100644 index 000000000000000..426355cf4d3193b --- /dev/null +++ b/debian/libPVER-minimal.overrides.in @@ -0,0 +1,12 @@ +# intentional +lib@PVER@-minimal binary: python3-script-but-no-python3-dep + +# no, it's not unusual +lib@PVER@-minimal binary: unusual-interpreter + +# lintian omission, multiarch string is encoded in the filename +lib@PVER@-minimal binary: arch-dependent-file-not-in-arch-specific-directory + +# yes, some extensions don't have references to any external lib +lib@PVER@-minimal binary: shared-lib-without-dependency-information +lib@PVER@-minimal binary: library-not-linked-against-libc diff --git a/debian/libPVER-minimal.postinst.in b/debian/libPVER-minimal.postinst.in new file mode 100644 index 000000000000000..8cc1f117123f164 --- /dev/null +++ b/debian/libPVER-minimal.postinst.in @@ -0,0 +1,13 @@ +#! /bin/sh + +set -e + +if [ ! -f /etc/@PVER@/sitecustomize.py ]; then + cat <<-EOF + # Empty sitecustomize.py to avoid a dangling symlink +EOF +fi + +#DEBHELPER# + +exit 0 diff --git a/debian/libPVER-minimal.postrm.in b/debian/libPVER-minimal.postrm.in new file mode 100644 index 000000000000000..e44228d240874f3 --- /dev/null +++ b/debian/libPVER-minimal.postrm.in @@ -0,0 +1,21 @@ +#! /bin/sh + +set -e + +if [ "$1" = "purge" ]; then + pc=$(LC_ALL=C.UTF8 dpkg-query -f '${db:Status-Abbrev} ${binary:Package}\n' -W lib@PVER@-minimal \ + | grep -v '^.n' | wc -l) + if [ "$pc" -lt 1 ]; then + find /usr/lib/@PVER@ -depth -type d -name __pycache__ \ + | xargs -r rm -rf + rm -f /etc/@PVER@/sitecustomize.py + rm -rf /etc/@PVER@/__pycache__ + if [ -d /etc/@PVER@ ]; then + rmdir --ignore-fail-on-non-empty /etc/@PVER@ + fi + fi +fi + +#DEBHELPER# + +exit 0 diff --git a/debian/libPVER-minimal.prerm.in b/debian/libPVER-minimal.prerm.in new file mode 100644 index 000000000000000..65e75b927c45959 --- /dev/null +++ b/debian/libPVER-minimal.prerm.in @@ -0,0 +1,41 @@ +#! /bin/sh + +set -e + +remove_bytecode() +{ + pkg=$1 + max=$(LANG=C LC_ALL=C xargs --show-limits < /dev/null 2>&1 | awk '/Maximum length/ {print int($NF / 4)}') + LC_ALL=C.UTF8 dpkg -L $pkg \ + | awk -F/ 'BEGIN {OFS="/"} /\.py$/ {$NF=sprintf("__pycache__/%s.*.py[co]", substr($NF,1,length($NF)-3)); print}' \ + | xargs --max-chars="$max" echo \ + | while read files; do rm -f $files; done + find /usr/lib/python3 /usr/lib/@PVER@ \ + \( -name dist-packages -prune \) -o \ + \( -name __pycache__ -type d -empty -print \) \ + | xargs -r rm -rf +} + +case "$1" in + remove) + pc=$(LC_ALL=C.UTF8 dpkg-query -f '${db:Status-Abbrev} ${binary:Package}\n' -W lib@PVER@-minimal \ + | grep -v '^.n' | wc -l) + if [ "$pc" -le 1 ]; then + remove_bytecode lib@PVER@-minimal@HOST_QUAL@ + fi + ;; + upgrade) + remove_bytecode lib@PVER@-minimal@HOST_QUAL@ + # byte compilation in @PVER@-minimal postinst, strict dependency + ;; + deconfigure) + ;; + failed-upgrade) + ;; + *) + echo "prerm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +#DEBHELPER# diff --git a/debian/libPVER-stdlib.overrides.in b/debian/libPVER-stdlib.overrides.in new file mode 100644 index 000000000000000..9c7a89db24fb85d --- /dev/null +++ b/debian/libPVER-stdlib.overrides.in @@ -0,0 +1,22 @@ +# idlelib images +lib@PVER@-stdlib binary: image-file-in-usr-lib + +# license file referred by the standard library +lib@PVER@-stdlib binary: extra-license-file + +# template files +lib@PVER@-stdlib binary: interpreter-not-absolute usr/lib/@PVER@/venv/scripts/posix/pydoc #!__VENV_PYTHON__ +lib@PVER@-stdlib binary: unusual-interpreter usr/lib/@PVER@/venv/scripts/posix/pydoc #!__VENV_PYTHON__ + +# the split is the reason for that +lib@PVER@-stdlib binary: python3-script-but-no-python3-dep + +# no, it's not unusual +lib@PVER@-stdlib binary: unusual-interpreter + +# lintian omission, multiarch string is encoded in the filename +lib@PVER@-stdlib binary: arch-dependent-file-not-in-arch-specific-directory + +# yes, some extensions don't have references to any external lib +lib@PVER@-stdlib binary: shared-lib-without-dependency-information +lib@PVER@-stdlib binary: library-not-linked-against-libc diff --git a/debian/libPVER-stdlib.prerm.in b/debian/libPVER-stdlib.prerm.in new file mode 100644 index 000000000000000..897eabfa357e14b --- /dev/null +++ b/debian/libPVER-stdlib.prerm.in @@ -0,0 +1,43 @@ +#! /bin/sh + +set -e + +remove_bytecode() +{ + pkg=$1 + max=$(LANG=C LC_ALL=C xargs --show-limits < /dev/null 2>&1 | awk '/Maximum length/ {print int($NF / 4)}') + LC_ALL=C.UTF8 dpkg -L $pkg \ + | awk -F/ 'BEGIN {OFS="/"} /\.py$/ {$NF=sprintf("__pycache__/%s.*.py[co]", substr($NF,1,length($NF)-3)); print}' \ + | xargs --max-chars="$max" echo \ + | while read files; do rm -f $files; done + # source and bytecode filename mismatch + rm -f /usr/lib/@PVER@/__pycache__/__phello__.cpython-*.py* + find /usr/lib/python3 /usr/lib/@PVER@ \ + \( -name dist-packages -prune \) -o \ + \( -name __pycache__ -type d -empty -print \) \ + | xargs -r rm -rf +} + +case "$1" in + remove) + pc=$(LC_ALL=C.UTF8 dpkg-query -f '${db:Status-Abbrev} ${binary:Package}\n' -W lib@PVER@-stdlib \ + | grep -v '^.n' | wc -l) + if [ "$pc" -le 1 ]; then + remove_bytecode lib@PVER@-stdlib@HOST_QUAL@ + fi + ;; + upgrade) + remove_bytecode lib@PVER@-stdlib@HOST_QUAL@ + # byte compilation in @PVER@ postinst, strict dependency + ;; + deconfigure) + ;; + failed-upgrade) + ;; + *) + echo "prerm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +#DEBHELPER# diff --git a/debian/libPVER-testsuite.overrides.in b/debian/libPVER-testsuite.overrides.in new file mode 100644 index 000000000000000..58acc2c6551027d --- /dev/null +++ b/debian/libPVER-testsuite.overrides.in @@ -0,0 +1,8 @@ +lib@PVER@-testsuite binary: python3-script-but-no-python3-dep +lib@PVER@-testsuite binary: image-file-in-usr-lib +lib@PVER@-testsuite binary: privacy-breach-generic +lib@PVER@-testsuite binary: command-with-path-in-maintainer-script +lib@PVER@-testsuite binary: package-installs-python-egg +lib@PVER@-testsuite binary: national-encoding +lib@PVER@-testsuite binary: unusual-interpreter +lib@PVER@-testsuite binary: executable-not-elf-or-script diff --git a/debian/libPVER-testsuite.postinst.in b/debian/libPVER-testsuite.postinst.in new file mode 100644 index 000000000000000..d11ca2302a15ad1 --- /dev/null +++ b/debian/libPVER-testsuite.postinst.in @@ -0,0 +1,20 @@ +#! /bin/sh + +set -e + +case "$1" in + configure) + files=$(LC_ALL=C.UTF8 dpkg -L lib@PVER@-testsuite | sed -n '/^\/usr\/lib\/@PVER@\/.*\.py$/p' | grep -Ev '/test_lib2to3/data|/tokenizedata/bad_|/badsyntax_') + if [ -n "$files" ]; then + /usr/bin/@PVER@ -E -S -W ignore /usr/lib/@PVER@/py_compile.py $files + if grep -sq '^byte-compile[^#]*optimize' /etc/python/debian_config; then + /usr/bin/@PVER@ -E -S -O -W ignore /usr/lib/@PVER@/py_compile.py $files + fi + else + echo >&2 "@PVER@: can't get files for byte-compilation" + fi +esac + +#DEBHELPER# + +exit 0 diff --git a/debian/libPVER-testsuite.prerm.in b/debian/libPVER-testsuite.prerm.in new file mode 100644 index 000000000000000..eddeb91c150785d --- /dev/null +++ b/debian/libPVER-testsuite.prerm.in @@ -0,0 +1,36 @@ +#! /bin/sh + +set -e + +remove_bytecode() +{ + pkg=$1 + max=$(LANG=C LC_ALL=C xargs --show-limits < /dev/null 2>&1 | awk '/Maximum length/ {print int($NF / 4)}') + LC_ALL=C.UTF8 dpkg -L $pkg \ + | awk -F/ 'BEGIN {OFS="/"} /\.py$/ {$NF=sprintf("__pycache__/%s.*.py[co]", substr($NF,1,length($NF)-3)); print}' \ + | xargs --max-chars="$max" echo \ + | while read files; do rm -f $files; done + + find /usr/lib/@PVER@ \ + -name __pycache__ -type d -empty -print \ + | xargs -r rm -rf +} + +case "$1" in + remove) + remove_bytecode lib@PVER@-testsuite + ;; + upgrade) + remove_bytecode lib@PVER@-testsuite + ;; + deconfigure) + ;; + failed-upgrade) + ;; + *) + echo "prerm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +#DEBHELPER# diff --git a/debian/libPVER.overrides.in b/debian/libPVER.overrides.in new file mode 100644 index 000000000000000..062dd4693232357 --- /dev/null +++ b/debian/libPVER.overrides.in @@ -0,0 +1,4 @@ +lib@PVER@ binary: package-name-doesnt-match-sonames + +# pyexpat.c contains expat error messages that lintian mis-attributes to embedding +lib@PVER@ binary: embedded-library diff --git a/debian/libPVER.symbols.in b/debian/libPVER.symbols.in new file mode 100644 index 000000000000000..6b55def4d650e25 --- /dev/null +++ b/debian/libPVER.symbols.in @@ -0,0 +1,4 @@ +libpython@VER@.so.1.0 libpython@VER@ #MINVER# +#include "libpython.symbols" + PyModule_Create2@Base @SVER@ + PyModule_FromDefAndSpec2@Base @SVER@ diff --git a/debian/libpython.symbols.in b/debian/libpython.symbols.in new file mode 100644 index 000000000000000..5feff5b7d975aeb --- /dev/null +++ b/debian/libpython.symbols.in @@ -0,0 +1,1701 @@ + PY_TIMEOUT_MAX@Base @SVER@ + PyAIter_Check@Base @SVER@ + PyArg_Parse@Base @SVER@ + PyArg_ParseTuple@Base @SVER@ + PyArg_ParseTupleAndKeywords@Base @SVER@ + PyArg_UnpackTuple@Base @SVER@ + PyArg_VaParse@Base @SVER@ + PyArg_VaParseTupleAndKeywords@Base @SVER@ + PyArg_ValidateKeywordArguments@Base @SVER@ + PyAsyncGen_New@Base @SVER@ + PyAsyncGen_Type@Base @SVER@ + PyBaseObject_Type@Base @SVER@ + PyBool_FromLong@Base @SVER@ + PyBool_Type@Base @SVER@ + PyBuffer_FillContiguousStrides@Base @SVER@ + PyBuffer_FillInfo@Base @SVER@ + PyBuffer_FromContiguous@Base @SVER@ + PyBuffer_GetPointer@Base @SVER@ + PyBuffer_IsContiguous@Base @SVER@ + PyBuffer_Release@Base @SVER@ + PyBuffer_SizeFromFormat@Base @SVER@ + PyBuffer_ToContiguous@Base @SVER@ + PyByteArrayIter_Type@Base @SVER@ + PyByteArray_AsString@Base @SVER@ + PyByteArray_Concat@Base @SVER@ + PyByteArray_FromObject@Base @SVER@ + PyByteArray_FromStringAndSize@Base @SVER@ + PyByteArray_Resize@Base @SVER@ + PyByteArray_Size@Base @SVER@ + PyByteArray_Type@Base @SVER@ + PyBytesIter_Type@Base @SVER@ + PyBytes_AsString@Base @SVER@ + PyBytes_AsStringAndSize@Base @SVER@ + PyBytes_Concat@Base @SVER@ + PyBytes_ConcatAndDel@Base @SVER@ + PyBytes_DecodeEscape@Base @SVER@ + PyBytes_FromFormat@Base @SVER@ + PyBytes_FromFormatV@Base @SVER@ + PyBytes_FromObject@Base @SVER@ + PyBytes_FromString@Base @SVER@ + PyBytes_FromStringAndSize@Base @SVER@ + PyBytes_Repr@Base @SVER@ + PyBytes_Size@Base @SVER@ + PyBytes_Type@Base @SVER@ + PyCFunction_Call@Base @SVER@ + PyCFunction_GetFlags@Base @SVER@ + PyCFunction_GetFunction@Base @SVER@ + PyCFunction_GetSelf@Base @SVER@ + PyCFunction_New@Base @SVER@ + PyCFunction_NewEx@Base @SVER@ + PyCFunction_Type@Base @SVER@ + PyCMethod_New@Base @SVER@ + PyCMethod_Type@Base @SVER@ + PyCallIter_New@Base @SVER@ + PyCallIter_Type@Base @SVER@ + PyCallable_Check@Base @SVER@ + PyCapsule_GetContext@Base @SVER@ + PyCapsule_GetDestructor@Base @SVER@ + PyCapsule_GetName@Base @SVER@ + PyCapsule_GetPointer@Base @SVER@ + PyCapsule_Import@Base @SVER@ + PyCapsule_IsValid@Base @SVER@ + PyCapsule_New@Base @SVER@ + PyCapsule_SetContext@Base @SVER@ + PyCapsule_SetDestructor@Base @SVER@ + PyCapsule_SetName@Base @SVER@ + PyCapsule_SetPointer@Base @SVER@ + PyCapsule_Type@Base @SVER@ + PyCell_Get@Base @SVER@ + PyCell_New@Base @SVER@ + PyCell_Set@Base @SVER@ + PyCell_Type@Base @SVER@ + PyClassMethodDescr_Type@Base @SVER@ + PyClassMethod_New@Base @SVER@ + PyClassMethod_Type@Base @SVER@ + PyCode_AddWatcher@Base @SVER@ + PyCode_Addr2Line@Base @SVER@ + PyCode_Addr2Location@Base @SVER@ + PyCode_ClearWatcher@Base @SVER@ + PyCode_GetCellvars@Base @SVER@ + PyCode_GetCode@Base @SVER@ + PyCode_GetFreevars@Base @SVER@ + PyCode_GetVarnames@Base @SVER@ + PyCode_NewEmpty@Base @SVER@ + PyCode_Optimize@Base @SVER@ + PyCode_Type@Base @SVER@ + PyCodec_BackslashReplaceErrors@Base @SVER@ + PyCodec_Decode@Base @SVER@ + PyCodec_Decoder@Base @SVER@ + PyCodec_Encode@Base @SVER@ + PyCodec_Encoder@Base @SVER@ + PyCodec_IgnoreErrors@Base @SVER@ + PyCodec_IncrementalDecoder@Base @SVER@ + PyCodec_IncrementalEncoder@Base @SVER@ + PyCodec_KnownEncoding@Base @SVER@ + PyCodec_LookupError@Base @SVER@ + PyCodec_NameReplaceErrors@Base @SVER@ + PyCodec_Register@Base @SVER@ + PyCodec_RegisterError@Base @SVER@ + PyCodec_ReplaceErrors@Base @SVER@ + PyCodec_StreamReader@Base @SVER@ + PyCodec_StreamWriter@Base @SVER@ + PyCodec_StrictErrors@Base @SVER@ + PyCodec_Unregister@Base @SVER@ + PyCodec_XMLCharRefReplaceErrors@Base @SVER@ + PyCompile_OpcodeStackEffect@Base @SVER@ + PyCompile_OpcodeStackEffectWithJump@Base @SVER@ + PyComplex_AsCComplex@Base @SVER@ + PyComplex_FromCComplex@Base @SVER@ + PyComplex_FromDoubles@Base @SVER@ + PyComplex_ImagAsDouble@Base @SVER@ + PyComplex_RealAsDouble@Base @SVER@ + PyComplex_Type@Base @SVER@ + PyConfig_Clear@Base @SVER@ + PyConfig_InitIsolatedConfig@Base @SVER@ + PyConfig_InitPythonConfig@Base @SVER@ + PyConfig_Read@Base @SVER@ + PyConfig_SetArgv@Base @SVER@ + PyConfig_SetBytesArgv@Base @SVER@ + PyConfig_SetBytesString@Base @SVER@ + PyConfig_SetString@Base @SVER@ + PyConfig_SetWideStringList@Base @SVER@ + PyContextToken_Type@Base @SVER@ + PyContextVar_Get@Base @SVER@ + PyContextVar_New@Base @SVER@ + PyContextVar_Reset@Base @SVER@ + PyContextVar_Set@Base @SVER@ + PyContextVar_Type@Base @SVER@ + PyContext_Copy@Base @SVER@ + PyContext_CopyCurrent@Base @SVER@ + PyContext_Enter@Base @SVER@ + PyContext_Exit@Base @SVER@ + PyContext_New@Base @SVER@ + PyContext_Type@Base @SVER@ + PyCoro_New@Base @SVER@ + PyCoro_Type@Base @SVER@ + PyCriticalSection2_Begin@Base @SVER@ + PyCriticalSection2_End@Base @SVER@ + PyCriticalSection_Begin@Base @SVER@ + PyCriticalSection_End@Base @SVER@ + PyDescr_IsData@Base @SVER@ + PyDescr_NewClassMethod@Base @SVER@ + PyDescr_NewGetSet@Base @SVER@ + PyDescr_NewMember@Base @SVER@ + PyDescr_NewMethod@Base @SVER@ + PyDescr_NewWrapper@Base @SVER@ + PyDictItems_Type@Base @SVER@ + PyDictIterItem_Type@Base @SVER@ + PyDictIterKey_Type@Base @SVER@ + PyDictIterValue_Type@Base @SVER@ + PyDictKeys_Type@Base @SVER@ + PyDictProxy_New@Base @SVER@ + PyDictProxy_Type@Base @SVER@ + PyDictRevIterItem_Type@Base @SVER@ + PyDictRevIterKey_Type@Base @SVER@ + PyDictRevIterValue_Type@Base @SVER@ + PyDictValues_Type@Base @SVER@ + PyDict_AddWatcher@Base @SVER@ + PyDict_Clear@Base @SVER@ + PyDict_ClearWatcher@Base @SVER@ + PyDict_Contains@Base @SVER@ + PyDict_ContainsString@Base @SVER@ + PyDict_Copy@Base @SVER@ + PyDict_DelItem@Base @SVER@ + PyDict_DelItemString@Base @SVER@ + PyDict_GetItem@Base @SVER@ + PyDict_GetItemRef@Base @SVER@ + PyDict_GetItemString@Base @SVER@ + PyDict_GetItemStringRef@Base @SVER@ + PyDict_GetItemWithError@Base @SVER@ + PyDict_Items@Base @SVER@ + PyDict_Keys@Base @SVER@ + PyDict_Merge@Base @SVER@ + PyDict_MergeFromSeq2@Base @SVER@ + PyDict_New@Base @SVER@ + PyDict_Next@Base @SVER@ + PyDict_Pop@Base @SVER@ + PyDict_PopString@Base @SVER@ + PyDict_SetDefault@Base @SVER@ + PyDict_SetDefaultRef@Base @SVER@ + PyDict_SetItem@Base @SVER@ + PyDict_SetItemString@Base @SVER@ + PyDict_Size@Base @SVER@ + PyDict_Type@Base @SVER@ + PyDict_Unwatch@Base @SVER@ + PyDict_Update@Base @SVER@ + PyDict_Values@Base @SVER@ + PyDict_Watch@Base @SVER@ + PyEllipsis_Type@Base @SVER@ + PyEnum_Type@Base @SVER@ + PyErr_BadArgument@Base @SVER@ + PyErr_BadInternalCall@Base @SVER@ + PyErr_CheckSignals@Base @SVER@ + PyErr_Clear@Base @SVER@ + PyErr_Display@Base @SVER@ + PyErr_DisplayException@Base @SVER@ + PyErr_ExceptionMatches@Base @SVER@ + PyErr_Fetch@Base @SVER@ + PyErr_Format@Base @SVER@ + PyErr_FormatUnraisable@Base @SVER@ + PyErr_FormatV@Base @SVER@ + PyErr_GetExcInfo@Base @SVER@ + PyErr_GetHandledException@Base @SVER@ + PyErr_GetRaisedException@Base @SVER@ + PyErr_GivenExceptionMatches@Base @SVER@ + PyErr_NewException@Base @SVER@ + PyErr_NewExceptionWithDoc@Base @SVER@ + PyErr_NoMemory@Base @SVER@ + PyErr_NormalizeException@Base @SVER@ + PyErr_Occurred@Base @SVER@ + PyErr_Print@Base @SVER@ + PyErr_PrintEx@Base @SVER@ + PyErr_ProgramText@Base @SVER@ + PyErr_ProgramTextObject@Base @SVER@ + PyErr_RangedSyntaxLocationObject@Base @SVER@ + PyErr_ResourceWarning@Base @SVER@ + PyErr_Restore@Base @SVER@ + PyErr_SetExcInfo@Base @SVER@ + PyErr_SetFromErrno@Base @SVER@ + PyErr_SetFromErrnoWithFilename@Base @SVER@ + PyErr_SetFromErrnoWithFilenameObject@Base @SVER@ + PyErr_SetFromErrnoWithFilenameObjects@Base @SVER@ + PyErr_SetHandledException@Base @SVER@ + PyErr_SetImportError@Base @SVER@ + PyErr_SetImportErrorSubclass@Base @SVER@ + PyErr_SetInterrupt@Base @SVER@ + PyErr_SetInterruptEx@Base @SVER@ + PyErr_SetNone@Base @SVER@ + PyErr_SetObject@Base @SVER@ + PyErr_SetRaisedException@Base @SVER@ + PyErr_SetString@Base @SVER@ + PyErr_SyntaxLocation@Base @SVER@ + PyErr_SyntaxLocationEx@Base @SVER@ + PyErr_SyntaxLocationObject@Base @SVER@ + PyErr_WarnEx@Base @SVER@ + PyErr_WarnExplicit@Base @SVER@ + PyErr_WarnExplicitFormat@Base @SVER@ + PyErr_WarnExplicitObject@Base @SVER@ + PyErr_WarnFormat@Base @SVER@ + PyErr_WriteUnraisable@Base @SVER@ + PyEval_AcquireLock@Base @SVER@ + PyEval_AcquireThread@Base @SVER@ + PyEval_CallFunction@Base @SVER@ + PyEval_CallMethod@Base @SVER@ + PyEval_CallObjectWithKeywords@Base @SVER@ + PyEval_EvalCode@Base @SVER@ + PyEval_EvalCodeEx@Base @SVER@ + PyEval_EvalFrame@Base @SVER@ + PyEval_EvalFrameEx@Base @SVER@ + PyEval_GetBuiltins@Base @SVER@ + PyEval_GetFrame@Base @SVER@ + PyEval_GetFrameBuiltins@Base @SVER@ + PyEval_GetFrameGlobals@Base @SVER@ + PyEval_GetFrameLocals@Base @SVER@ + PyEval_GetFuncDesc@Base @SVER@ + PyEval_GetFuncName@Base @SVER@ + PyEval_GetGlobals@Base @SVER@ + PyEval_GetLocals@Base @SVER@ + PyEval_InitThreads@Base @SVER@ + PyEval_MergeCompilerFlags@Base @SVER@ + PyEval_ReleaseLock@Base @SVER@ + PyEval_ReleaseThread@Base @SVER@ + PyEval_RestoreThread@Base @SVER@ + PyEval_SaveThread@Base @SVER@ + PyEval_SetProfile@Base @SVER@ + PyEval_SetProfileAllThreads@Base @SVER@ + PyEval_SetTrace@Base @SVER@ + PyEval_SetTraceAllThreads@Base @SVER@ + PyEval_ThreadsInitialized@Base @SVER@ + PyEvent_Wait@Base @SVER@ + PyEvent_WaitTimed@Base @SVER@ + PyExc_ArithmeticError@Base @SVER@ + PyExc_AssertionError@Base @SVER@ + PyExc_AttributeError@Base @SVER@ + PyExc_BaseException@Base @SVER@ + PyExc_BaseExceptionGroup@Base @SVER@ + PyExc_BlockingIOError@Base @SVER@ + PyExc_BrokenPipeError@Base @SVER@ + PyExc_BufferError@Base @SVER@ + PyExc_BytesWarning@Base @SVER@ + PyExc_ChildProcessError@Base @SVER@ + PyExc_ConnectionAbortedError@Base @SVER@ + PyExc_ConnectionError@Base @SVER@ + PyExc_ConnectionRefusedError@Base @SVER@ + PyExc_ConnectionResetError@Base @SVER@ + PyExc_DeprecationWarning@Base @SVER@ + PyExc_EOFError@Base @SVER@ + PyExc_EncodingWarning@Base @SVER@ + PyExc_EnvironmentError@Base @SVER@ + PyExc_Exception@Base @SVER@ + PyExc_FileExistsError@Base @SVER@ + PyExc_FileNotFoundError@Base @SVER@ + PyExc_FloatingPointError@Base @SVER@ + PyExc_FutureWarning@Base @SVER@ + PyExc_GeneratorExit@Base @SVER@ + PyExc_IOError@Base @SVER@ + PyExc_ImportError@Base @SVER@ + PyExc_ImportWarning@Base @SVER@ + PyExc_IndentationError@Base @SVER@ + PyExc_IndexError@Base @SVER@ + PyExc_InterpreterError@Base @SVER@ + PyExc_InterpreterNotFoundError@Base @SVER@ + PyExc_InterruptedError@Base @SVER@ + PyExc_IsADirectoryError@Base @SVER@ + PyExc_KeyError@Base @SVER@ + PyExc_KeyboardInterrupt@Base @SVER@ + PyExc_LookupError@Base @SVER@ + PyExc_MemoryError@Base @SVER@ + PyExc_ModuleNotFoundError@Base @SVER@ + PyExc_NameError@Base @SVER@ + PyExc_NotADirectoryError@Base @SVER@ + PyExc_NotImplementedError@Base @SVER@ + PyExc_OSError@Base @SVER@ + PyExc_OverflowError@Base @SVER@ + PyExc_PendingDeprecationWarning@Base @SVER@ + PyExc_PermissionError@Base @SVER@ + PyExc_ProcessLookupError@Base @SVER@ + PyExc_PythonFinalizationError@Base @SVER@ + PyExc_RecursionError@Base @SVER@ + PyExc_ReferenceError@Base @SVER@ + PyExc_ResourceWarning@Base @SVER@ + PyExc_RuntimeError@Base @SVER@ + PyExc_RuntimeWarning@Base @SVER@ + PyExc_StopAsyncIteration@Base @SVER@ + PyExc_StopIteration@Base @SVER@ + PyExc_SyntaxError@Base @SVER@ + PyExc_SyntaxWarning@Base @SVER@ + PyExc_SystemError@Base @SVER@ + PyExc_SystemExit@Base @SVER@ + PyExc_TabError@Base @SVER@ + PyExc_TimeoutError@Base @SVER@ + PyExc_TypeError@Base @SVER@ + PyExc_UnboundLocalError@Base @SVER@ + PyExc_UnicodeDecodeError@Base @SVER@ + PyExc_UnicodeEncodeError@Base @SVER@ + PyExc_UnicodeError@Base @SVER@ + PyExc_UnicodeTranslateError@Base @SVER@ + PyExc_UnicodeWarning@Base @SVER@ + PyExc_UserWarning@Base @SVER@ + PyExc_ValueError@Base @SVER@ + PyExc_Warning@Base @SVER@ + PyExc_ZeroDivisionError@Base @SVER@ + PyExceptionClass_Name@Base @SVER@ + PyException_GetArgs@Base @SVER@ + PyException_GetCause@Base @SVER@ + PyException_GetContext@Base @SVER@ + PyException_GetTraceback@Base @SVER@ + PyException_SetArgs@Base @SVER@ + PyException_SetCause@Base @SVER@ + PyException_SetContext@Base @SVER@ + PyException_SetTraceback@Base @SVER@ + PyFile_FromFd@Base @SVER@ + PyFile_GetLine@Base @SVER@ + PyFile_NewStdPrinter@Base @SVER@ + PyFile_OpenCode@Base @SVER@ + PyFile_OpenCodeObject@Base @SVER@ + PyFile_SetOpenCodeHook@Base @SVER@ + PyFile_WriteObject@Base @SVER@ + PyFile_WriteString@Base @SVER@ + PyFilter_Type@Base @SVER@ + PyFloat_AsDouble@Base @SVER@ + PyFloat_FromDouble@Base @SVER@ + PyFloat_FromString@Base @SVER@ + PyFloat_GetInfo@Base @SVER@ + PyFloat_GetMax@Base @SVER@ + PyFloat_GetMin@Base @SVER@ + PyFloat_Pack2@Base @SVER@ + PyFloat_Pack4@Base @SVER@ + PyFloat_Pack8@Base @SVER@ + PyFloat_Type@Base @SVER@ + PyFloat_Unpack2@Base @SVER@ + PyFloat_Unpack4@Base @SVER@ + PyFloat_Unpack8@Base @SVER@ + PyFrameLocalsProxy_Type@Base @SVER@ + PyFrame_FastToLocals@Base @SVER@ + PyFrame_FastToLocalsWithError@Base @SVER@ + PyFrame_GetBack@Base @SVER@ + PyFrame_GetBuiltins@Base @SVER@ + PyFrame_GetCode@Base @SVER@ + PyFrame_GetGenerator@Base @SVER@ + PyFrame_GetGlobals@Base @SVER@ + PyFrame_GetLasti@Base @SVER@ + PyFrame_GetLineNumber@Base @SVER@ + PyFrame_GetLocals@Base @SVER@ + PyFrame_GetVar@Base @SVER@ + PyFrame_GetVarString@Base @SVER@ + PyFrame_LocalsToFast@Base @SVER@ + PyFrame_New@Base @SVER@ + PyFrame_Type@Base @SVER@ + PyFrozenSet_New@Base @SVER@ + PyFrozenSet_Type@Base @SVER@ + PyFunction_AddWatcher@Base @SVER@ + PyFunction_ClearWatcher@Base @SVER@ + PyFunction_GetAnnotations@Base @SVER@ + PyFunction_GetClosure@Base @SVER@ + PyFunction_GetCode@Base @SVER@ + PyFunction_GetDefaults@Base @SVER@ + PyFunction_GetGlobals@Base @SVER@ + PyFunction_GetKwDefaults@Base @SVER@ + PyFunction_GetModule@Base @SVER@ + PyFunction_New@Base @SVER@ + PyFunction_NewWithQualName@Base @SVER@ + PyFunction_SetAnnotations@Base @SVER@ + PyFunction_SetClosure@Base @SVER@ + PyFunction_SetDefaults@Base @SVER@ + PyFunction_SetKwDefaults@Base @SVER@ + PyFunction_SetVectorcall@Base @SVER@ + PyFunction_Type@Base @SVER@ + PyGC_Collect@Base @SVER@ + PyGC_Disable@Base @SVER@ + PyGC_Enable@Base @SVER@ + PyGC_IsEnabled@Base @SVER@ + PyGILState_Check@Base @SVER@ + PyGILState_Ensure@Base @SVER@ + PyGILState_GetThisThreadState@Base @SVER@ + PyGILState_Release@Base @SVER@ + PyGen_GetCode@Base @SVER@ + PyGen_New@Base @SVER@ + PyGen_NewWithQualName@Base @SVER@ + PyGen_Type@Base @SVER@ + PyGetSetDescr_Type@Base @SVER@ + PyHash_GetFuncDef@Base @SVER@ + PyImport_AddModule@Base @SVER@ + PyImport_AddModuleObject@Base @SVER@ + PyImport_AddModuleRef@Base @SVER@ + PyImport_AppendInittab@Base @SVER@ + PyImport_ExecCodeModule@Base @SVER@ + PyImport_ExecCodeModuleEx@Base @SVER@ + PyImport_ExecCodeModuleObject@Base @SVER@ + PyImport_ExecCodeModuleWithPathnames@Base @SVER@ + PyImport_ExtendInittab@Base @SVER@ + PyImport_FrozenModules@Base @SVER@ + PyImport_GetImporter@Base @SVER@ + PyImport_GetMagicNumber@Base @SVER@ + PyImport_GetMagicTag@Base @SVER@ + PyImport_GetModule@Base @SVER@ + PyImport_GetModuleDict@Base @SVER@ + PyImport_Import@Base @SVER@ + PyImport_ImportFrozenModule@Base @SVER@ + PyImport_ImportFrozenModuleObject@Base @SVER@ + PyImport_ImportModule@Base @SVER@ + PyImport_ImportModuleLevel@Base @SVER@ + PyImport_ImportModuleLevelObject@Base @SVER@ + PyImport_ImportModuleNoBlock@Base @SVER@ + PyImport_Inittab@Base @SVER@ + PyImport_ReloadModule@Base @SVER@ + PyIndex_Check@Base @SVER@ + PyInit__abc@Base @SVER@ + PyInit__ast@Base @SVER@ + PyInit__bisect@Base @SVER@ + PyInit__blake2@Base @SVER@ + PyInit__codecs@Base @SVER@ + PyInit__collections@Base @SVER@ + PyInit__csv@Base @SVER@ + PyInit__datetime@Base @SVER@ + PyInit__elementtree@Base @SVER@ + PyInit__functools@Base @SVER@ + PyInit__heapq@Base @SVER@ + PyInit__imp@Base @SVER@ + PyInit__io@Base @SVER@ + PyInit__locale@Base @SVER@ + PyInit__md5@Base @SVER@ + PyInit__opcode@Base @SVER@ + PyInit__operator@Base @SVER@ + PyInit__pickle@Base @SVER@ + PyInit__posixsubprocess@Base @SVER@ + PyInit__random@Base @SVER@ + PyInit__sha1@Base @SVER@ + PyInit__sha3@Base @SVER@ + PyInit__signal@Base @SVER@ + PyInit__socket@Base @SVER@ + PyInit__sre@Base @SVER@ + PyInit__stat@Base @SVER@ + PyInit__statistics@Base @SVER@ + PyInit__string@Base @SVER@ + PyInit__struct@Base @SVER@ + PyInit__symtable@Base @SVER@ + PyInit__thread@Base @SVER@ + PyInit__tokenize@Base @SVER@ + PyInit__tracemalloc@Base @SVER@ + PyInit__weakref@Base @SVER@ + PyInit_array@Base @SVER@ + PyInit_atexit@Base @SVER@ + PyInit_binascii@Base @SVER@ + PyInit_cmath@Base @SVER@ + PyInit_errno@Base @SVER@ + PyInit_faulthandler@Base @SVER@ + PyInit_fcntl@Base @SVER@ + PyInit_gc@Base @SVER@ + PyInit_grp@Base @SVER@ + PyInit_itertools@Base @SVER@ + PyInit_math@Base @SVER@ + PyInit_posix@Base @SVER@ + PyInit_pwd@Base @SVER@ + PyInit_pyexpat@Base @SVER@ + PyInit_select@Base @SVER@ + PyInit_syslog@Base @SVER@ + PyInit_time@Base @SVER@ + PyInit_unicodedata@Base @SVER@ + PyInit_zlib@Base @SVER@ + PyInstanceMethod_Function@Base @SVER@ + PyInstanceMethod_New@Base @SVER@ + PyInstanceMethod_Type@Base @SVER@ + PyInterpreterState_Clear@Base @SVER@ + PyInterpreterState_Delete@Base @SVER@ + PyInterpreterState_Get@Base @SVER@ + PyInterpreterState_GetDict@Base @SVER@ + PyInterpreterState_GetID@Base @SVER@ + PyInterpreterState_Head@Base @SVER@ + PyInterpreterState_Main@Base @SVER@ + PyInterpreterState_New@Base @SVER@ + PyInterpreterState_Next@Base @SVER@ + PyInterpreterState_ThreadHead@Base @SVER@ + PyIter_Check@Base @SVER@ + PyIter_Next@Base @SVER@ + PyIter_Send@Base @SVER@ + PyListIter_Type@Base @SVER@ + PyListRevIter_Type@Base @SVER@ + PyList_Append@Base @SVER@ + PyList_AsTuple@Base @SVER@ + PyList_Clear@Base @SVER@ + PyList_Extend@Base @SVER@ + PyList_GetItem@Base @SVER@ + PyList_GetItemRef@Base @SVER@ + PyList_GetSlice@Base @SVER@ + PyList_Insert@Base @SVER@ + PyList_New@Base @SVER@ + PyList_Reverse@Base @SVER@ + PyList_SetItem@Base @SVER@ + PyList_SetSlice@Base @SVER@ + PyList_Size@Base @SVER@ + PyList_Sort@Base @SVER@ + PyList_Type@Base @SVER@ + PyLongRangeIter_Type@Base @SVER@ + PyLong_AsDouble@Base @SVER@ + PyLong_AsInt@Base @SVER@ + PyLong_AsLong@Base @SVER@ + PyLong_AsLongAndOverflow@Base @SVER@ + PyLong_AsLongLong@Base @SVER@ + PyLong_AsLongLongAndOverflow@Base @SVER@ + PyLong_AsNativeBytes@Base @SVER@ + PyLong_AsSize_t@Base @SVER@ + PyLong_AsSsize_t@Base @SVER@ + PyLong_AsUnsignedLong@Base @SVER@ + PyLong_AsUnsignedLongLong@Base @SVER@ + PyLong_AsUnsignedLongLongMask@Base @SVER@ + PyLong_AsUnsignedLongMask@Base @SVER@ + PyLong_AsVoidPtr@Base @SVER@ + PyLong_FromDouble@Base @SVER@ + PyLong_FromLong@Base @SVER@ + PyLong_FromLongLong@Base @SVER@ + PyLong_FromNativeBytes@Base @SVER@ + PyLong_FromSize_t@Base @SVER@ + PyLong_FromSsize_t@Base @SVER@ + PyLong_FromString@Base @SVER@ + PyLong_FromUnicodeObject@Base @SVER@ + PyLong_FromUnsignedLong@Base @SVER@ + PyLong_FromUnsignedLongLong@Base @SVER@ + PyLong_FromUnsignedNativeBytes@Base @SVER@ + PyLong_FromVoidPtr@Base @SVER@ + PyLong_GetInfo@Base @SVER@ + PyLong_Type@Base @SVER@ + PyMap_Type@Base @SVER@ + PyMapping_Check@Base @SVER@ + PyMapping_GetItemString@Base @SVER@ + PyMapping_GetOptionalItem@Base @SVER@ + PyMapping_GetOptionalItemString@Base @SVER@ + PyMapping_HasKey@Base @SVER@ + PyMapping_HasKeyString@Base @SVER@ + PyMapping_HasKeyStringWithError@Base @SVER@ + PyMapping_HasKeyWithError@Base @SVER@ + PyMapping_Items@Base @SVER@ + PyMapping_Keys@Base @SVER@ + PyMapping_Length@Base @SVER@ + PyMapping_SetItemString@Base @SVER@ + PyMapping_Size@Base @SVER@ + PyMapping_Values@Base @SVER@ + PyMarshal_Init@Base @SVER@ + PyMarshal_ReadLastObjectFromFile@Base @SVER@ + PyMarshal_ReadLongFromFile@Base @SVER@ + PyMarshal_ReadObjectFromFile@Base @SVER@ + PyMarshal_ReadObjectFromString@Base @SVER@ + PyMarshal_ReadShortFromFile@Base @SVER@ + PyMarshal_WriteLongToFile@Base @SVER@ + PyMarshal_WriteObjectToFile@Base @SVER@ + PyMarshal_WriteObjectToString@Base @SVER@ + PyMem_Calloc@Base @SVER@ + PyMem_Free@Base @SVER@ + PyMem_GetAllocator@Base @SVER@ + PyMem_Malloc@Base @SVER@ + PyMem_RawCalloc@Base @SVER@ + PyMem_RawFree@Base @SVER@ + PyMem_RawMalloc@Base @SVER@ + PyMem_RawRealloc@Base @SVER@ + PyMem_Realloc@Base @SVER@ + PyMem_SetAllocator@Base @SVER@ + PyMem_SetupDebugHooks@Base @SVER@ + PyMemberDescr_Type@Base @SVER@ + PyMember_GetOne@Base @SVER@ + PyMember_SetOne@Base @SVER@ + PyMemoryView_FromBuffer@Base @SVER@ + PyMemoryView_FromMemory@Base @SVER@ + PyMemoryView_FromObject@Base @SVER@ + PyMemoryView_GetContiguous@Base @SVER@ + PyMemoryView_Type@Base @SVER@ + PyMethodDescr_Type@Base @SVER@ + PyMethod_Function@Base @SVER@ + PyMethod_New@Base @SVER@ + PyMethod_Self@Base @SVER@ + PyMethod_Type@Base @SVER@ + PyModuleDef_Init@Base @SVER@ + PyModuleDef_Type@Base @SVER@ + PyModule_Add@Base @SVER@ + PyModule_AddFunctions@Base @SVER@ + PyModule_AddIntConstant@Base @SVER@ + PyModule_AddObject@Base @SVER@ + PyModule_AddObjectRef@Base @SVER@ + PyModule_AddStringConstant@Base @SVER@ + PyModule_AddType@Base @SVER@ + PyModule_Create2@Base @SVER@ + PyModule_ExecDef@Base @SVER@ + PyModule_FromDefAndSpec2@Base @SVER@ + PyModule_GetDef@Base @SVER@ + PyModule_GetDict@Base @SVER@ + PyModule_GetFilename@Base @SVER@ + PyModule_GetFilenameObject@Base @SVER@ + PyModule_GetName@Base @SVER@ + PyModule_GetNameObject@Base @SVER@ + PyModule_GetState@Base @SVER@ + PyModule_New@Base @SVER@ + PyModule_NewObject@Base @SVER@ + PyModule_SetDocString@Base @SVER@ + PyModule_Type@Base @SVER@ + PyMonitoring_EnterScope@Base @SVER@ + PyMonitoring_ExitScope@Base @SVER@ + PyMutex_Lock@Base @SVER@ + PyMutex_Unlock@Base @SVER@ + PyNumber_Absolute@Base @SVER@ + PyNumber_Add@Base @SVER@ + PyNumber_And@Base @SVER@ + PyNumber_AsSsize_t@Base @SVER@ + PyNumber_Check@Base @SVER@ + PyNumber_Divmod@Base @SVER@ + PyNumber_Float@Base @SVER@ + PyNumber_FloorDivide@Base @SVER@ + PyNumber_InPlaceAdd@Base @SVER@ + PyNumber_InPlaceAnd@Base @SVER@ + PyNumber_InPlaceFloorDivide@Base @SVER@ + PyNumber_InPlaceLshift@Base @SVER@ + PyNumber_InPlaceMatrixMultiply@Base @SVER@ + PyNumber_InPlaceMultiply@Base @SVER@ + PyNumber_InPlaceOr@Base @SVER@ + PyNumber_InPlacePower@Base @SVER@ + PyNumber_InPlaceRemainder@Base @SVER@ + PyNumber_InPlaceRshift@Base @SVER@ + PyNumber_InPlaceSubtract@Base @SVER@ + PyNumber_InPlaceTrueDivide@Base @SVER@ + PyNumber_InPlaceXor@Base @SVER@ + PyNumber_Index@Base @SVER@ + PyNumber_Invert@Base @SVER@ + PyNumber_Long@Base @SVER@ + PyNumber_Lshift@Base @SVER@ + PyNumber_MatrixMultiply@Base @SVER@ + PyNumber_Multiply@Base @SVER@ + PyNumber_Negative@Base @SVER@ + PyNumber_Or@Base @SVER@ + PyNumber_Positive@Base @SVER@ + PyNumber_Power@Base @SVER@ + PyNumber_Remainder@Base @SVER@ + PyNumber_Rshift@Base @SVER@ + PyNumber_Subtract@Base @SVER@ + PyNumber_ToBase@Base @SVER@ + PyNumber_TrueDivide@Base @SVER@ + PyNumber_Xor@Base @SVER@ + PyODictItems_Type@Base @SVER@ + PyODictIter_Type@Base @SVER@ + PyODictKeys_Type@Base @SVER@ + PyODictValues_Type@Base @SVER@ + PyODict_DelItem@Base @SVER@ + PyODict_New@Base @SVER@ + PyODict_SetItem@Base @SVER@ + PyODict_Type@Base @SVER@ + PyOS_AfterFork@Base @SVER@ + PyOS_AfterFork_Child@Base @SVER@ + PyOS_AfterFork_Parent@Base @SVER@ + PyOS_BeforeFork@Base @SVER@ + PyOS_FSPath@Base @SVER@ + PyOS_InputHook@Base @SVER@ + PyOS_InterruptOccurred@Base @SVER@ + PyOS_Readline@Base @SVER@ + PyOS_ReadlineFunctionPointer@Base @SVER@ + PyOS_double_to_string@Base @SVER@ + PyOS_getsig@Base @SVER@ + PyOS_mystricmp@Base @SVER@ + PyOS_mystrnicmp@Base @SVER@ + PyOS_setsig@Base @SVER@ + PyOS_snprintf@Base @SVER@ + PyOS_string_to_double@Base @SVER@ + PyOS_strtol@Base @SVER@ + PyOS_strtoul@Base @SVER@ + PyOS_vsnprintf@Base @SVER@ + PyObject_ASCII@Base @SVER@ + PyObject_AsCharBuffer@Base @SVER@ + PyObject_AsFileDescriptor@Base @SVER@ + PyObject_AsReadBuffer@Base @SVER@ + PyObject_AsWriteBuffer@Base @SVER@ + PyObject_Bytes@Base @SVER@ + PyObject_Call@Base @SVER@ + PyObject_CallFinalizer@Base @SVER@ + PyObject_CallFinalizerFromDealloc@Base @SVER@ + PyObject_CallFunction@Base @SVER@ + PyObject_CallFunctionObjArgs@Base @SVER@ + PyObject_CallMethod@Base @SVER@ + PyObject_CallMethodObjArgs@Base @SVER@ + PyObject_CallNoArgs@Base @SVER@ + PyObject_CallObject@Base @SVER@ + PyObject_CallOneArg@Base @SVER@ + PyObject_Calloc@Base @SVER@ + PyObject_CheckBuffer@Base @SVER@ + PyObject_CheckReadBuffer@Base @SVER@ + PyObject_ClearManagedDict@Base @SVER@ + PyObject_ClearWeakRefs@Base @SVER@ + PyObject_CopyData@Base @SVER@ + PyObject_DelAttr@Base @SVER@ + PyObject_DelAttrString@Base @SVER@ + PyObject_DelItem@Base @SVER@ + PyObject_DelItemString@Base @SVER@ + PyObject_Dir@Base @SVER@ + PyObject_Format@Base @SVER@ + PyObject_Free@Base @SVER@ + PyObject_GC_Del@Base @SVER@ + PyObject_GC_IsFinalized@Base @SVER@ + PyObject_GC_IsTracked@Base @SVER@ + PyObject_GC_Track@Base @SVER@ + PyObject_GC_UnTrack@Base @SVER@ + PyObject_GET_WEAKREFS_LISTPTR@Base @SVER@ + PyObject_GenericGetAttr@Base @SVER@ + PyObject_GenericGetDict@Base @SVER@ + PyObject_GenericHash@Base @SVER@ + PyObject_GenericSetAttr@Base @SVER@ + PyObject_GenericSetDict@Base @SVER@ + PyObject_GetAIter@Base @SVER@ + PyObject_GetArenaAllocator@Base @SVER@ + PyObject_GetAttr@Base @SVER@ + PyObject_GetAttrString@Base @SVER@ + PyObject_GetBuffer@Base @SVER@ + PyObject_GetItem@Base @SVER@ + PyObject_GetItemData@Base @SVER@ + PyObject_GetIter@Base @SVER@ + PyObject_GetOptionalAttr@Base @SVER@ + PyObject_GetOptionalAttrString@Base @SVER@ + PyObject_GetTypeData@Base @SVER@ + PyObject_HasAttr@Base @SVER@ + PyObject_HasAttrString@Base @SVER@ + PyObject_HasAttrStringWithError@Base @SVER@ + PyObject_HasAttrWithError@Base @SVER@ + PyObject_Hash@Base @SVER@ + PyObject_HashNotImplemented@Base @SVER@ + PyObject_IS_GC@Base @SVER@ + PyObject_Init@Base @SVER@ + PyObject_InitVar@Base @SVER@ + PyObject_IsInstance@Base @SVER@ + PyObject_IsSubclass@Base @SVER@ + PyObject_IsTrue@Base @SVER@ + PyObject_Length@Base @SVER@ + PyObject_LengthHint@Base @SVER@ + PyObject_Malloc@Base @SVER@ + PyObject_Not@Base @SVER@ + PyObject_Print@Base @SVER@ + PyObject_Realloc@Base @SVER@ + PyObject_Repr@Base @SVER@ + PyObject_RichCompare@Base @SVER@ + PyObject_RichCompareBool@Base @SVER@ + PyObject_SelfIter@Base @SVER@ + PyObject_SetArenaAllocator@Base @SVER@ + PyObject_SetAttr@Base @SVER@ + PyObject_SetAttrString@Base @SVER@ + PyObject_SetItem@Base @SVER@ + PyObject_Size@Base @SVER@ + PyObject_Str@Base @SVER@ + PyObject_Type@Base @SVER@ + PyObject_Vectorcall@Base @SVER@ + PyObject_VectorcallDict@Base @SVER@ + PyObject_VectorcallMethod@Base @SVER@ + PyObject_VisitManagedDict@Base @SVER@ + PyPickleBuffer_FromObject@Base @SVER@ + PyPickleBuffer_GetBuffer@Base @SVER@ + PyPickleBuffer_Release@Base @SVER@ + PyPickleBuffer_Type@Base @SVER@ + PyPreConfig_InitIsolatedConfig@Base @SVER@ + PyPreConfig_InitPythonConfig@Base @SVER@ + PyProperty_Type@Base @SVER@ + PyRangeIter_Type@Base @SVER@ + PyRange_Type@Base @SVER@ + PyRefTracer_GetTracer@Base @SVER@ + PyRefTracer_SetTracer@Base @SVER@ + PyReversed_Type@Base @SVER@ + PyRun_AnyFile@Base @SVER@ + PyRun_AnyFileEx@Base @SVER@ + PyRun_AnyFileExFlags@Base @SVER@ + PyRun_AnyFileFlags@Base @SVER@ + PyRun_File@Base @SVER@ + PyRun_FileEx@Base @SVER@ + PyRun_FileExFlags@Base @SVER@ + PyRun_FileFlags@Base @SVER@ + PyRun_InteractiveLoop@Base @SVER@ + PyRun_InteractiveLoopFlags@Base @SVER@ + PyRun_InteractiveOne@Base @SVER@ + PyRun_InteractiveOneFlags@Base @SVER@ + PyRun_InteractiveOneObject@Base @SVER@ + PyRun_SimpleFile@Base @SVER@ + PyRun_SimpleFileEx@Base @SVER@ + PyRun_SimpleFileExFlags@Base @SVER@ + PyRun_SimpleString@Base @SVER@ + PyRun_SimpleStringFlags@Base @SVER@ + PyRun_String@Base @SVER@ + PyRun_StringFlags@Base @SVER@ + PySeqIter_New@Base @SVER@ + PySeqIter_Type@Base @SVER@ + PySequence_Check@Base @SVER@ + PySequence_Concat@Base @SVER@ + PySequence_Contains@Base @SVER@ + PySequence_Count@Base @SVER@ + PySequence_DelItem@Base @SVER@ + PySequence_DelSlice@Base @SVER@ + PySequence_Fast@Base @SVER@ + PySequence_GetItem@Base @SVER@ + PySequence_GetSlice@Base @SVER@ + PySequence_In@Base @SVER@ + PySequence_InPlaceConcat@Base @SVER@ + PySequence_InPlaceRepeat@Base @SVER@ + PySequence_Index@Base @SVER@ + PySequence_Length@Base @SVER@ + PySequence_List@Base @SVER@ + PySequence_Repeat@Base @SVER@ + PySequence_SetItem@Base @SVER@ + PySequence_SetSlice@Base @SVER@ + PySequence_Size@Base @SVER@ + PySequence_Tuple@Base @SVER@ + PySetIter_Type@Base @SVER@ + PySet_Add@Base @SVER@ + PySet_Clear@Base @SVER@ + PySet_Contains@Base @SVER@ + PySet_Discard@Base @SVER@ + PySet_New@Base @SVER@ + PySet_Pop@Base @SVER@ + PySet_Size@Base @SVER@ + PySet_Type@Base @SVER@ + PySignal_SetWakeupFd@Base @SVER@ + PySlice_AdjustIndices@Base @SVER@ + PySlice_GetIndices@Base @SVER@ + PySlice_GetIndicesEx@Base @SVER@ + PySlice_New@Base @SVER@ + PySlice_Type@Base @SVER@ + PySlice_Unpack@Base @SVER@ + PyState_AddModule@Base @SVER@ + PyState_FindModule@Base @SVER@ + PyState_RemoveModule@Base @SVER@ + PyStaticMethod_New@Base @SVER@ + PyStaticMethod_Type@Base @SVER@ + PyStatus_Error@Base @SVER@ + PyStatus_Exception@Base @SVER@ + PyStatus_Exit@Base @SVER@ + PyStatus_IsError@Base @SVER@ + PyStatus_IsExit@Base @SVER@ + PyStatus_NoMemory@Base @SVER@ + PyStatus_Ok@Base @SVER@ + PyStdPrinter_Type@Base @SVER@ + PyStructSequence_GetItem@Base @SVER@ + PyStructSequence_InitType2@Base @SVER@ + PyStructSequence_InitType@Base @SVER@ + PyStructSequence_New@Base @SVER@ + PyStructSequence_NewType@Base @SVER@ + PyStructSequence_SetItem@Base @SVER@ + PyStructSequence_UnnamedField@Base @SVER@ + PySuper_Type@Base @SVER@ + PySys_AddAuditHook@Base @SVER@ + PySys_AddWarnOption@Base @SVER@ + PySys_AddWarnOptionUnicode@Base @SVER@ + PySys_AddXOption@Base @SVER@ + PySys_Audit@Base @SVER@ + PySys_AuditTuple@Base @SVER@ + PySys_FormatStderr@Base @SVER@ + PySys_FormatStdout@Base @SVER@ + PySys_GetObject@Base @SVER@ + PySys_GetXOptions@Base @SVER@ + PySys_HasWarnOptions@Base @SVER@ + PySys_ResetWarnOptions@Base @SVER@ + PySys_SetArgv@Base @SVER@ + PySys_SetArgvEx@Base @SVER@ + PySys_SetObject@Base @SVER@ + PySys_SetPath@Base @SVER@ + PySys_WriteStderr@Base @SVER@ + PySys_WriteStdout@Base @SVER@ + PyThreadState_Clear@Base @SVER@ + PyThreadState_Delete@Base @SVER@ + PyThreadState_DeleteCurrent@Base @SVER@ + PyThreadState_EnterTracing@Base @SVER@ + PyThreadState_Get@Base @SVER@ + PyThreadState_GetDict@Base @SVER@ + PyThreadState_GetFrame@Base @SVER@ + PyThreadState_GetID@Base @SVER@ + PyThreadState_GetInterpreter@Base @SVER@ + PyThreadState_GetUnchecked@Base @SVER@ + PyThreadState_LeaveTracing@Base @SVER@ + PyThreadState_New@Base @SVER@ + PyThreadState_Next@Base @SVER@ + PyThreadState_SetAsyncExc@Base @SVER@ + PyThreadState_Swap@Base @SVER@ + PyThread_GetInfo@Base @SVER@ + PyThread_ParseTimeoutArg@Base @SVER@ + PyThread_ReInitTLS@Base @SVER@ + PyThread_acquire_lock@Base @SVER@ + PyThread_acquire_lock_timed@Base @SVER@ + PyThread_acquire_lock_timed_with_retries@Base @SVER@ + PyThread_allocate_lock@Base @SVER@ + PyThread_create_key@Base @SVER@ + PyThread_delete_key@Base @SVER@ + PyThread_delete_key_value@Base @SVER@ + PyThread_detach_thread@Base @SVER@ + PyThread_exit_thread@Base @SVER@ + PyThread_free_lock@Base @SVER@ + PyThread_get_key_value@Base @SVER@ + PyThread_get_stacksize@Base @SVER@ + PyThread_get_thread_ident@Base @SVER@ + PyThread_get_thread_ident_ex@Base @SVER@ + (arch=linux-any)PyThread_get_thread_native_id@Base @SVER@ + PyThread_init_thread@Base @SVER@ + PyThread_join_thread@Base @SVER@ + PyThread_release_lock@Base @SVER@ + PyThread_set_key_value@Base @SVER@ + PyThread_set_stacksize@Base @SVER@ + PyThread_start_joinable_thread@Base @SVER@ + PyThread_start_new_thread@Base @SVER@ + PyThread_tss_alloc@Base @SVER@ + PyThread_tss_create@Base @SVER@ + PyThread_tss_delete@Base @SVER@ + PyThread_tss_free@Base @SVER@ + PyThread_tss_get@Base @SVER@ + PyThread_tss_is_created@Base @SVER@ + PyThread_tss_set@Base @SVER@ + PyTime_AsSecondsDouble@Base @SVER@ + PyTime_Monotonic@Base @SVER@ + PyTime_MonotonicRaw@Base @SVER@ + PyTime_PerfCounter@Base @SVER@ + PyTime_PerfCounterRaw@Base @SVER@ + PyTime_Time@Base @SVER@ + PyTime_TimeRaw@Base @SVER@ + PyTraceBack_Here@Base @SVER@ + PyTraceBack_Print@Base @SVER@ + PyTraceBack_Type@Base @SVER@ + PyTraceMalloc_Track@Base @SVER@ + PyTraceMalloc_Untrack@Base @SVER@ + PyTupleIter_Type@Base @SVER@ + PyTuple_GetItem@Base @SVER@ + PyTuple_GetSlice@Base @SVER@ + PyTuple_New@Base @SVER@ + PyTuple_Pack@Base @SVER@ + PyTuple_SetItem@Base @SVER@ + PyTuple_Size@Base @SVER@ + PyTuple_Type@Base @SVER@ + PyType_AddWatcher@Base @SVER@ + PyType_ClearCache@Base @SVER@ + PyType_ClearWatcher@Base @SVER@ + PyType_FromMetaclass@Base @SVER@ + PyType_FromModuleAndSpec@Base @SVER@ + PyType_FromSpec@Base @SVER@ + PyType_FromSpecWithBases@Base @SVER@ + PyType_GenericAlloc@Base @SVER@ + PyType_GenericNew@Base @SVER@ + PyType_GetDict@Base @SVER@ + PyType_GetFlags@Base @SVER@ + PyType_GetFullyQualifiedName@Base @SVER@ + PyType_GetModule@Base @SVER@ + PyType_GetModuleByDef@Base @SVER@ + PyType_GetModuleName@Base @SVER@ + PyType_GetModuleState@Base @SVER@ + PyType_GetName@Base @SVER@ + PyType_GetQualName@Base @SVER@ + PyType_GetSlot@Base @SVER@ + PyType_GetTypeDataSize@Base @SVER@ + PyType_IsSubtype@Base @SVER@ + PyType_Modified@Base @SVER@ + PyType_Ready@Base @SVER@ + PyType_SUPPORTS_WEAKREFS@Base @SVER@ + PyType_Type@Base @SVER@ + PyType_Unwatch@Base @SVER@ + PyType_Watch@Base @SVER@ + PyUnicodeDecodeError_Create@Base @SVER@ + PyUnicodeDecodeError_GetEncoding@Base @SVER@ + PyUnicodeDecodeError_GetEnd@Base @SVER@ + PyUnicodeDecodeError_GetObject@Base @SVER@ + PyUnicodeDecodeError_GetReason@Base @SVER@ + PyUnicodeDecodeError_GetStart@Base @SVER@ + PyUnicodeDecodeError_SetEnd@Base @SVER@ + PyUnicodeDecodeError_SetReason@Base @SVER@ + PyUnicodeDecodeError_SetStart@Base @SVER@ + PyUnicodeEncodeError_GetEncoding@Base @SVER@ + PyUnicodeEncodeError_GetEnd@Base @SVER@ + PyUnicodeEncodeError_GetObject@Base @SVER@ + PyUnicodeEncodeError_GetReason@Base @SVER@ + PyUnicodeEncodeError_GetStart@Base @SVER@ + PyUnicodeEncodeError_SetEnd@Base @SVER@ + PyUnicodeEncodeError_SetReason@Base @SVER@ + PyUnicodeEncodeError_SetStart@Base @SVER@ + PyUnicodeIter_Type@Base @SVER@ + PyUnicodeTranslateError_GetEnd@Base @SVER@ + PyUnicodeTranslateError_GetObject@Base @SVER@ + PyUnicodeTranslateError_GetReason@Base @SVER@ + PyUnicodeTranslateError_GetStart@Base @SVER@ + PyUnicodeTranslateError_SetEnd@Base @SVER@ + PyUnicodeTranslateError_SetReason@Base @SVER@ + PyUnicodeTranslateError_SetStart@Base @SVER@ + PyUnicode_Append@Base @SVER@ + PyUnicode_AppendAndDel@Base @SVER@ + PyUnicode_AsASCIIString@Base @SVER@ + PyUnicode_AsCharmapString@Base @SVER@ + PyUnicode_AsDecodedObject@Base @SVER@ + PyUnicode_AsDecodedUnicode@Base @SVER@ + PyUnicode_AsEncodedObject@Base @SVER@ + PyUnicode_AsEncodedString@Base @SVER@ + PyUnicode_AsEncodedUnicode@Base @SVER@ + PyUnicode_AsLatin1String@Base @SVER@ + PyUnicode_AsRawUnicodeEscapeString@Base @SVER@ + PyUnicode_AsUCS4@Base @SVER@ + PyUnicode_AsUCS4Copy@Base @SVER@ + PyUnicode_AsUTF16String@Base @SVER@ + PyUnicode_AsUTF32String@Base @SVER@ + PyUnicode_AsUTF8@Base @SVER@ + PyUnicode_AsUTF8AndSize@Base @SVER@ + PyUnicode_AsUTF8String@Base @SVER@ + PyUnicode_AsUnicodeEscapeString@Base @SVER@ + PyUnicode_AsWideChar@Base @SVER@ + PyUnicode_AsWideCharString@Base @SVER@ + PyUnicode_BuildEncodingMap@Base @SVER@ + PyUnicode_Compare@Base @SVER@ + PyUnicode_CompareWithASCIIString@Base @SVER@ + PyUnicode_Concat@Base @SVER@ + PyUnicode_Contains@Base @SVER@ + PyUnicode_CopyCharacters@Base @SVER@ + PyUnicode_Count@Base @SVER@ + PyUnicode_Decode@Base @SVER@ + PyUnicode_DecodeASCII@Base @SVER@ + PyUnicode_DecodeCharmap@Base @SVER@ + PyUnicode_DecodeFSDefault@Base @SVER@ + PyUnicode_DecodeFSDefaultAndSize@Base @SVER@ + PyUnicode_DecodeLatin1@Base @SVER@ + PyUnicode_DecodeLocale@Base @SVER@ + PyUnicode_DecodeLocaleAndSize@Base @SVER@ + PyUnicode_DecodeRawUnicodeEscape@Base @SVER@ + PyUnicode_DecodeUTF16@Base @SVER@ + PyUnicode_DecodeUTF16Stateful@Base @SVER@ + PyUnicode_DecodeUTF32@Base @SVER@ + PyUnicode_DecodeUTF32Stateful@Base @SVER@ + PyUnicode_DecodeUTF7@Base @SVER@ + PyUnicode_DecodeUTF7Stateful@Base @SVER@ + PyUnicode_DecodeUTF8@Base @SVER@ + PyUnicode_DecodeUTF8Stateful@Base @SVER@ + PyUnicode_DecodeUnicodeEscape@Base @SVER@ + PyUnicode_EncodeFSDefault@Base @SVER@ + PyUnicode_EncodeLocale@Base @SVER@ + PyUnicode_EqualToUTF8@Base @SVER@ + PyUnicode_EqualToUTF8AndSize@Base @SVER@ + PyUnicode_FSConverter@Base @SVER@ + PyUnicode_FSDecoder@Base @SVER@ + PyUnicode_Fill@Base @SVER@ + PyUnicode_Find@Base @SVER@ + PyUnicode_FindChar@Base @SVER@ + PyUnicode_Format@Base @SVER@ + PyUnicode_FromEncodedObject@Base @SVER@ + PyUnicode_FromFormat@Base @SVER@ + PyUnicode_FromFormatV@Base @SVER@ + PyUnicode_FromKindAndData@Base @SVER@ + PyUnicode_FromObject@Base @SVER@ + PyUnicode_FromOrdinal@Base @SVER@ + PyUnicode_FromString@Base @SVER@ + PyUnicode_FromStringAndSize@Base @SVER@ + PyUnicode_FromWideChar@Base @SVER@ + PyUnicode_GetDefaultEncoding@Base @SVER@ + PyUnicode_GetLength@Base @SVER@ + PyUnicode_GetSize@Base @SVER@ + PyUnicode_InternFromString@Base @SVER@ + PyUnicode_InternImmortal@Base @SVER@ + PyUnicode_InternInPlace@Base @SVER@ + PyUnicode_IsIdentifier@Base @SVER@ + PyUnicode_Join@Base @SVER@ + PyUnicode_New@Base @SVER@ + PyUnicode_Partition@Base @SVER@ + PyUnicode_RPartition@Base @SVER@ + PyUnicode_RSplit@Base @SVER@ + PyUnicode_ReadChar@Base @SVER@ + PyUnicode_Replace@Base @SVER@ + PyUnicode_Resize@Base @SVER@ + PyUnicode_RichCompare@Base @SVER@ + PyUnicode_Split@Base @SVER@ + PyUnicode_Splitlines@Base @SVER@ + PyUnicode_Substring@Base @SVER@ + PyUnicode_Tailmatch@Base @SVER@ + PyUnicode_Translate@Base @SVER@ + PyUnicode_Type@Base @SVER@ + PyUnicode_WriteChar@Base @SVER@ + PyUnstable_AtExit@Base @SVER@ + PyUnstable_Code_GetExtra@Base @SVER@ + PyUnstable_Code_New@Base @SVER@ + PyUnstable_Code_NewWithPosOnlyArgs@Base @SVER@ + PyUnstable_Code_SetExtra@Base @SVER@ + PyUnstable_CopyPerfMapFile@Base @SVER@ + PyUnstable_Eval_RequestCodeExtraIndex@Base @SVER@ + PyUnstable_Exc_PrepReraiseStar@Base @SVER@ + PyUnstable_ExecutableKinds@Base @SVER@ + PyUnstable_GC_VisitObjects@Base @SVER@ + PyUnstable_InterpreterFrame_GetCode@Base @SVER@ + PyUnstable_InterpreterFrame_GetLasti@Base @SVER@ + PyUnstable_InterpreterFrame_GetLine@Base @SVER@ + PyUnstable_InterpreterState_GetMainModule@Base @SVER@ + PyUnstable_Long_CompactValue@Base @SVER@ + PyUnstable_Long_IsCompact@Base @SVER@ + PyUnstable_Object_ClearWeakRefsNoCallbacks@Base @SVER@ + PyUnstable_Object_GC_NewWithExtraData@Base @SVER@ + PyUnstable_PerfMapState_Fini@Base @SVER@ + PyUnstable_PerfMapState_Init@Base @SVER@ + PyUnstable_PerfTrampoline_CompileCode@Base @SVER@ + PyUnstable_PerfTrampoline_SetPersistAfterFork@Base @SVER@ + PyUnstable_Type_AssignVersionTag@Base @SVER@ + PyUnstable_WritePerfMapEntry@Base @SVER@ + PyVectorcall_Call@Base @SVER@ + PyVectorcall_Function@Base @SVER@ + PyVectorcall_NARGS@Base @SVER@ + PyWeakref_GetObject@Base @SVER@ + PyWeakref_GetRef@Base @SVER@ + PyWeakref_NewProxy@Base @SVER@ + PyWeakref_NewRef@Base @SVER@ + PyWideStringList_Append@Base @SVER@ + PyWideStringList_Insert@Base @SVER@ + PyWrapperDescr_Type@Base @SVER@ + PyWrapper_New@Base @SVER@ + PyZip_Type@Base @SVER@ + Py_AddPendingCall@Base @SVER@ + Py_AtExit@Base @SVER@ + Py_BuildValue@Base @SVER@ + Py_BytesMain@Base @SVER@ + Py_BytesWarningFlag@Base @SVER@ + Py_CompileString@Base @SVER@ + Py_CompileStringExFlags@Base @SVER@ + Py_CompileStringFlags@Base @SVER@ + Py_CompileStringObject@Base @SVER@ + Py_DebugFlag@Base @SVER@ + Py_DecRef@Base @SVER@ + Py_DecodeLocale@Base @SVER@ + Py_DontWriteBytecodeFlag@Base @SVER@ + Py_EncodeLocale@Base @SVER@ + Py_EndInterpreter@Base @SVER@ + Py_EnterRecursiveCall@Base @SVER@ + Py_Exit@Base @SVER@ + Py_ExitStatusException@Base @SVER@ + Py_FatalError@Base @SVER@ + Py_FdIsInteractive@Base @SVER@ + Py_FileSystemDefaultEncodeErrors@Base @SVER@ + Py_FileSystemDefaultEncoding@Base @SVER@ + Py_Finalize@Base @SVER@ + Py_FinalizeEx@Base @SVER@ + Py_FrozenFlag@Base @SVER@ + Py_FrozenMain@Base @SVER@ + Py_GETENV@Base @SVER@ + Py_GenericAlias@Base @SVER@ + Py_GenericAliasType@Base @SVER@ + Py_GetArgcArgv@Base @SVER@ + Py_GetBuildInfo@Base @SVER@ + Py_GetCompiler@Base @SVER@ + Py_GetConstant@Base @SVER@ + Py_GetConstantBorrowed@Base @SVER@ + Py_GetCopyright@Base @SVER@ + Py_GetExecPrefix@Base @SVER@ + Py_GetPath@Base @SVER@ + Py_GetPlatform@Base @SVER@ + Py_GetPrefix@Base @SVER@ + Py_GetProgramFullPath@Base @SVER@ + Py_GetProgramName@Base @SVER@ + Py_GetPythonHome@Base @SVER@ + Py_GetRecursionLimit@Base @SVER@ + Py_GetVersion@Base @SVER@ + Py_HasFileSystemDefaultEncoding@Base @SVER@ + Py_HashPointer@Base @SVER@ + Py_HashRandomizationFlag@Base @SVER@ + Py_IgnoreEnvironmentFlag@Base @SVER@ + Py_IncRef@Base @SVER@ + Py_Initialize@Base @SVER@ + Py_InitializeEx@Base @SVER@ + Py_InitializeFromConfig@Base @SVER@ + Py_InspectFlag@Base @SVER@ + Py_InteractiveFlag@Base @SVER@ + Py_Is@Base @SVER@ + Py_IsFalse@Base @SVER@ + Py_IsFinalizing@Base @SVER@ + Py_IsInitialized@Base @SVER@ + Py_IsNone@Base @SVER@ + Py_IsTrue@Base @SVER@ + Py_IsolatedFlag@Base @SVER@ + Py_LeaveRecursiveCall@Base @SVER@ + Py_Main@Base @SVER@ + Py_MakePendingCalls@Base @SVER@ + Py_NewInterpreter@Base @SVER@ + Py_NewInterpreterFromConfig@Base @SVER@ + Py_NewRef@Base @SVER@ + Py_NoSiteFlag@Base @SVER@ + Py_NoUserSiteDirectory@Base @SVER@ + Py_OptimizeFlag@Base @SVER@ + Py_PreInitialize@Base @SVER@ + Py_PreInitializeFromArgs@Base @SVER@ + Py_PreInitializeFromBytesArgs@Base @SVER@ + Py_QuietFlag@Base @SVER@ + Py_ReprEnter@Base @SVER@ + Py_ReprLeave@Base @SVER@ + Py_RunMain@Base @SVER@ + Py_SetPath@Base @SVER@ + Py_SetProgramName@Base @SVER@ + Py_SetPythonHome@Base @SVER@ + Py_SetRecursionLimit@Base @SVER@ + Py_UTF8Mode@Base @SVER@ + Py_UnbufferedStdioFlag@Base @SVER@ + Py_UniversalNewlineFgets@Base @SVER@ + Py_VaBuildValue@Base @SVER@ + Py_VerboseFlag@Base @SVER@ + Py_Version@Base @SVER@ + Py_XNewRef@Base @SVER@ + Py_hexdigits@Base @SVER@ + _PyAST_Compile@Base @SVER@ + _PyArena_AddPyObject@Base @SVER@ + _PyArena_Free@Base @SVER@ + _PyArena_Malloc@Base @SVER@ + _PyArena_New@Base @SVER@ + _PyArg_BadArgument@Base @SVER@ + _PyArg_CheckPositional@Base @SVER@ + _PyArg_NoKeywords@Base @SVER@ + _PyArg_NoPositional@Base @SVER@ + _PyArg_ParseStack@Base @SVER@ + _PyArg_ParseStackAndKeywords@Base @SVER@ + _PyArg_ParseTupleAndKeywordsFast@Base @SVER@ + _PyArg_ParseTupleAndKeywords_SizeT@Base @SVER@ + _PyArg_ParseTuple_SizeT@Base @SVER@ + _PyArg_Parse_SizeT@Base @SVER@ + _PyArg_UnpackKeywords@Base @SVER@ + _PyArg_UnpackKeywordsWithVararg@Base @SVER@ + _PyArg_VaParseTupleAndKeywords_SizeT@Base @SVER@ + _PyArg_VaParse_SizeT@Base @SVER@ + _PyAsyncGenASend_Type@Base @SVER@ + _PyBuffer_ReleaseInInterpreter@Base @SVER@ + _PyBuffer_ReleaseInInterpreterAndRawFree@Base @SVER@ + _PyByteArray_empty_string@Base @SVER@ + _PyBytesWriter_Alloc@Base @SVER@ + _PyBytesWriter_Dealloc@Base @SVER@ + _PyBytesWriter_Finish@Base @SVER@ + _PyBytesWriter_Init@Base @SVER@ + _PyBytesWriter_Prepare@Base @SVER@ + _PyBytesWriter_Resize@Base @SVER@ + _PyBytesWriter_WriteBytes@Base @SVER@ + _PyBytes_DecodeEscape@Base @SVER@ + _PyBytes_Find@Base @SVER@ + _PyBytes_Join@Base @SVER@ + _PyBytes_Repeat@Base @SVER@ + _PyBytes_Resize@Base @SVER@ + _PyBytes_ReverseFind@Base @SVER@ + _PyCapsule_SetTraverse@Base @SVER@ + _PyCode_CheckLineNumber@Base @SVER@ + _PyCode_ConstantKey@Base @SVER@ + _PyCompile_Assemble@Base @SVER@ + _PyCompile_CleanDoc@Base @SVER@ + _PyCompile_CodeGen@Base @SVER@ + _PyCompile_GetBinaryIntrinsicName@Base @SVER@ + _PyCompile_GetUnaryIntrinsicName@Base @SVER@ + _PyCompile_OpcodeHasArg@Base @SVER@ + _PyCompile_OpcodeHasConst@Base @SVER@ + _PyCompile_OpcodeHasExc@Base @SVER@ + _PyCompile_OpcodeHasFree@Base @SVER@ + _PyCompile_OpcodeHasJump@Base @SVER@ + _PyCompile_OpcodeHasLocal@Base @SVER@ + _PyCompile_OpcodeHasName@Base @SVER@ + _PyCompile_OpcodeIsValid@Base @SVER@ + _PyCompile_OptimizeCfg@Base @SVER@ + _PyConfig_AsDict@Base @SVER@ + _PyConfig_FromDict@Base @SVER@ + _PyConfig_InitCompatConfig@Base @SVER@ + _PyContext_NewHamtForTests@Base @SVER@ + _PyCoro_GetAwaitableIter@Base @SVER@ + _PyCriticalSection2_BeginSlow@Base @SVER@ + _PyCriticalSection_BeginSlow@Base @SVER@ + _PyCriticalSection_Resume@Base @SVER@ + _PyCriticalSection_SuspendAll@Base @SVER@ + _PyCrossInterpreterData_Clear@Base @SVER@ + _PyCrossInterpreterData_Free@Base @SVER@ + _PyCrossInterpreterData_Init@Base @SVER@ + _PyCrossInterpreterData_InitWithSize@Base @SVER@ + _PyCrossInterpreterData_Lookup@Base @SVER@ + _PyCrossInterpreterData_New@Base @SVER@ + _PyCrossInterpreterData_NewObject@Base @SVER@ + _PyCrossInterpreterData_RegisterClass@Base @SVER@ + _PyCrossInterpreterData_Release@Base @SVER@ + _PyCrossInterpreterData_ReleaseAndRawFree@Base @SVER@ + _PyCrossInterpreterData_UnregisterClass@Base @SVER@ + _PyDeadline_Get@Base @SVER@ + _PyDeadline_Init@Base @SVER@ + _PyDict_DelItemIf@Base @SVER@ + _PyDict_DelItem_KnownHash@Base @SVER@ + _PyDict_FromItems@Base @SVER@ + _PyDict_GetItemRef_KnownHash_LockHeld@Base @SVER@ + _PyDict_GetItemStringWithError@Base @SVER@ + _PyDict_GetItem_KnownHash@Base @SVER@ + _PyDict_LoadGlobal@Base @SVER@ + _PyDict_MergeEx@Base @SVER@ + _PyDict_NewPresized@Base @SVER@ + _PyDict_Pop@Base @SVER@ + _PyDict_SetItem_KnownHash@Base @SVER@ + _PyDict_SetItem_KnownHash_LockHeld@Base @SVER@ + _PyDict_SetItem_Take2@Base @SVER@ + _PyDict_SizeOf@Base @SVER@ + _PyErr_BadInternalCall@Base @SVER@ + _PyErr_ChainExceptions1@Base @SVER@ + _PyErr_Clear@Base @SVER@ + _PyErr_ExceptionMatches@Base @SVER@ + _PyErr_Format@Base @SVER@ + _PyErr_FormatFromCause@Base @SVER@ + _PyErr_ProgramDecodedTextObject@Base @SVER@ + _PyErr_SetFromPyStatus@Base @SVER@ + _PyErr_SetKeyError@Base @SVER@ + _PyErr_SetString@Base @SVER@ + _PyEvalFramePushAndInit@Base @SVER@ + _PyEval_AddPendingCall@Base @SVER@ + _PyEval_BinaryOps@Base @SVER@ + _PyEval_CheckExceptStarTypeValid@Base @SVER@ + _PyEval_CheckExceptTypeValid@Base @SVER@ + _PyEval_ConversionFuncs@Base @SVER@ + _PyEval_EvalFrameDefault@Base @SVER@ + _PyEval_ExceptionGroupMatch@Base @SVER@ + _PyEval_FormatAwaitableError@Base @SVER@ + _PyEval_FormatExcCheckArg@Base @SVER@ + _PyEval_FormatExcUnbound@Base @SVER@ + _PyEval_FormatKwargsError@Base @SVER@ + _PyEval_FrameClearAndPop@Base @SVER@ + _PyEval_GetBuiltin@Base @SVER@ + _PyEval_MakePendingCalls@Base @SVER@ + _PyEval_MatchClass@Base @SVER@ + _PyEval_MatchKeys@Base @SVER@ + _PyEval_MonitorRaise@Base @SVER@ + _PyEval_SetProfile@Base @SVER@ + _PyEval_SliceIndex@Base @SVER@ + _PyEval_SliceIndexNotNone@Base @SVER@ + _PyEval_UnpackIterable@Base @SVER@ + _PyEvent_IsSet@Base @SVER@ + _PyEvent_Notify@Base @SVER@ + _PyExc_IncompleteInputError@Base @SVER@ + _PyFloat_ExactDealloc@Base @SVER@ + _PyFrame_IsEntryFrame@Base @SVER@ + _PyFunction_SetVersion@Base @SVER@ + _PyGen_FetchStopIterationValue@Base @SVER@ + _PyGen_SetStopIterationValue@Base @SVER@ + _PyGen_yf@Base @SVER@ + _PyImport_ClearExtension@Base @SVER@ + _PyImport_FrozenBootstrap@Base @SVER@ + _PyImport_FrozenStdlib@Base @SVER@ + _PyImport_FrozenTest@Base @SVER@ + _PyImport_GetModuleAttr@Base @SVER@ + _PyImport_GetModuleAttrString@Base @SVER@ + _PyImport_SetModule@Base @SVER@ + _PyInstructionSequence_New@Base @SVER@ + _PyInterpreterConfig_AsDict@Base @SVER@ + _PyInterpreterConfig_InitFromDict@Base @SVER@ + _PyInterpreterConfig_InitFromState@Base @SVER@ + _PyInterpreterConfig_UpdateFromDict@Base @SVER@ + _PyInterpreterState_FailIfRunningMain@Base @SVER@ + _PyInterpreterState_GetConfigCopy@Base @SVER@ + _PyInterpreterState_GetEvalFrameFunc@Base @SVER@ + _PyInterpreterState_GetIDObject@Base @SVER@ + _PyInterpreterState_GetWhence@Base @SVER@ + _PyInterpreterState_IDDecref@Base @SVER@ + _PyInterpreterState_IDIncref@Base @SVER@ + _PyInterpreterState_IDInitref@Base @SVER@ + _PyInterpreterState_IsReady@Base @SVER@ + _PyInterpreterState_IsRunningMain@Base @SVER@ + _PyInterpreterState_LookUpID@Base @SVER@ + _PyInterpreterState_LookUpIDObject@Base @SVER@ + _PyInterpreterState_New@Base @SVER@ + _PyInterpreterState_ObjectToID@Base @SVER@ + _PyInterpreterState_RequireIDRef@Base @SVER@ + _PyInterpreterState_RequiresIDRef@Base @SVER@ + _PyInterpreterState_SetConfig@Base @SVER@ + _PyInterpreterState_SetEvalFrameFunc@Base @SVER@ + _PyInterpreterState_SetNotRunningMain@Base @SVER@ + _PyInterpreterState_SetRunningMain@Base @SVER@ + _PyIntrinsics_BinaryFunctions@Base @SVER@ + _PyIntrinsics_UnaryFunctions@Base @SVER@ + _PyList_AppendTakeRefListResize@Base @SVER@ + _PyList_Extend@Base @SVER@ + _PyList_FromArraySteal@Base @SVER@ + _PyLong_Add@Base @SVER@ + _PyLong_AsByteArray@Base @SVER@ + _PyLong_AsTime_t@Base @SVER@ + _PyLong_Copy@Base @SVER@ + _PyLong_DigitValue@Base @SVER@ + _PyLong_DivmodNear@Base @SVER@ + _PyLong_FileDescriptor_Converter@Base @SVER@ + _PyLong_Format@Base @SVER@ + _PyLong_Frexp@Base @SVER@ + _PyLong_FromByteArray@Base @SVER@ + _PyLong_FromDigits@Base @SVER@ + _PyLong_FromGid@Base @SVER@ + _PyLong_FromTime_t@Base @SVER@ + _PyLong_GCD@Base @SVER@ + _PyLong_Lshift@Base @SVER@ + _PyLong_Multiply@Base @SVER@ + _PyLong_New@Base @SVER@ + _PyLong_NumBits@Base @SVER@ + _PyLong_Rshift@Base @SVER@ + _PyLong_Sign@Base @SVER@ + _PyLong_Size_t_Converter@Base @SVER@ + _PyLong_Subtract@Base @SVER@ + _PyLong_UnsignedInt_Converter@Base @SVER@ + _PyLong_UnsignedLongLong_Converter@Base @SVER@ + _PyLong_UnsignedLong_Converter@Base @SVER@ + _PyLong_UnsignedShort_Converter@Base @SVER@ + _PyMem_GetCurrentAllocatorName@Base @SVER@ + _PyMem_Strdup@Base @SVER@ + _PyMonitoring_FireBranchEvent@Base @SVER@ + _PyMonitoring_FireCRaiseEvent@Base @SVER@ + _PyMonitoring_FireCReturnEvent@Base @SVER@ + _PyMonitoring_FireCallEvent@Base @SVER@ + _PyMonitoring_FireExceptionHandledEvent@Base @SVER@ + _PyMonitoring_FireJumpEvent@Base @SVER@ + _PyMonitoring_FireLineEvent@Base @SVER@ + _PyMonitoring_FirePyResumeEvent@Base @SVER@ + _PyMonitoring_FirePyReturnEvent@Base @SVER@ + _PyMonitoring_FirePyStartEvent@Base @SVER@ + _PyMonitoring_FirePyThrowEvent@Base @SVER@ + _PyMonitoring_FirePyUnwindEvent@Base @SVER@ + _PyMonitoring_FirePyYieldEvent@Base @SVER@ + _PyMonitoring_FireRaiseEvent@Base @SVER@ + _PyMonitoring_FireReraiseEvent@Base @SVER@ + _PyMonitoring_FireStopIterationEvent@Base @SVER@ + _PyNamespace_New@Base @SVER@ + _PyNone_Type@Base @SVER@ + _PyNotImplemented_Type@Base @SVER@ + _PyNumber_Index@Base @SVER@ + _PyOS_IsMainThread@Base @SVER@ + _PyOS_ReadlineTState@Base @SVER@ + _PyOS_URandomNonblock@Base @SVER@ + _PyObject_AssertFailed@Base @SVER@ + _PyObject_CallFunction_SizeT@Base @SVER@ + _PyObject_CallMethod@Base @SVER@ + _PyObject_CallMethodId@Base @SVER@ + _PyObject_CallMethod_SizeT@Base @SVER@ + _PyObject_CheckCrossInterpreterData@Base @SVER@ + _PyObject_DebugMallocStats@Base @SVER@ + _PyObject_Dump@Base @SVER@ + _PyObject_FunctionStr@Base @SVER@ + _PyObject_GC_New@Base @SVER@ + _PyObject_GC_NewVar@Base @SVER@ + _PyObject_GC_Resize@Base @SVER@ + _PyObject_GenericGetAttrWithDict@Base @SVER@ + _PyObject_GenericSetAttrWithDict@Base @SVER@ + _PyObject_GetAttrId@Base @SVER@ + _PyObject_GetCrossInterpreterData@Base @SVER@ + _PyObject_GetDictPtr@Base @SVER@ + _PyObject_GetMethod@Base @SVER@ + _PyObject_GetState@Base @SVER@ + _PyObject_IsFreed@Base @SVER@ + _PyObject_LookupSpecial@Base @SVER@ + _PyObject_MakeTpCall@Base @SVER@ + _PyObject_New@Base @SVER@ + _PyObject_NewVar@Base @SVER@ + _PyObject_SetManagedDict@Base @SVER@ + _PyOnceFlag_CallOnceSlow@Base @SVER@ + _PyParkingLot_AfterFork@Base @SVER@ + _PyParkingLot_Park@Base @SVER@ + _PyParkingLot_Unpark@Base @SVER@ + _PyParkingLot_UnparkAll@Base @SVER@ + _PyParser_TokenNames@Base @SVER@ + _PyPathConfig_ClearGlobal@Base @SVER@ + _PyPreConfig_InitCompatConfig@Base @SVER@ + _PyRWMutex_Lock@Base @SVER@ + _PyRWMutex_RLock@Base @SVER@ + _PyRWMutex_RUnlock@Base @SVER@ + _PyRWMutex_Unlock@Base @SVER@ + _PyRecursiveMutex_IsLockedByCurrentThread@Base @SVER@ + _PyRecursiveMutex_Lock@Base @SVER@ + _PyRecursiveMutex_Unlock@Base @SVER@ + _PyRuntime@Base @SVER@ + _PySemaphore_Destroy@Base @SVER@ + _PySemaphore_Init@Base @SVER@ + _PySemaphore_Wait@Base @SVER@ + _PySemaphore_Wakeup@Base @SVER@ + _PySeqLock_AbandonWrite@Base @SVER@ + _PySeqLock_AfterFork@Base @SVER@ + _PySeqLock_BeginRead@Base @SVER@ + _PySeqLock_EndRead@Base @SVER@ + _PySeqLock_LockWrite@Base @SVER@ + _PySeqLock_UnlockWrite@Base @SVER@ + _PySet_Contains@Base @SVER@ + _PySet_Dummy@Base @SVER@ + _PySet_NextEntry@Base @SVER@ + _PySet_NextEntryRef@Base @SVER@ + _PySet_Update@Base @SVER@ + _PySlice_FromIndices@Base @SVER@ + _PySlice_GetLongIndices@Base @SVER@ + _PyStack_AsDict@Base @SVER@ + _PyState_AddModule@Base @SVER@ + _PyStaticType_InitForExtension@Base @SVER@ + _PyStructSequence_NewType@Base @SVER@ + _PySuper_Lookup@Base @SVER@ + _PySys_GetAttr@Base @SVER@ + _PySys_GetSizeOf@Base @SVER@ + _PyThreadState_GetCurrent@Base @SVER@ + _PyThreadState_GetDict@Base @SVER@ + _PyThreadState_Init@Base @SVER@ + _PyThreadState_New@Base @SVER@ + _PyThreadState_NewBound@Base @SVER@ + _PyThreadState_PopFrame@Base @SVER@ + _PyThreadState_Prealloc@Base @SVER@ + _PyThread_CurrentFrames@Base @SVER@ + _PyTime_AsLong@Base @SVER@ + _PyTime_AsMicroseconds@Base @SVER@ + _PyTime_AsMilliseconds@Base @SVER@ + _PyTime_AsTimespec@Base @SVER@ + _PyTime_AsTimespec_clamp@Base @SVER@ + _PyTime_AsTimeval@Base @SVER@ + _PyTime_AsTimevalTime_t@Base @SVER@ + _PyTime_AsTimeval_clamp@Base @SVER@ + _PyTime_FromLong@Base @SVER@ + _PyTime_FromMillisecondsObject@Base @SVER@ + _PyTime_FromSeconds@Base @SVER@ + _PyTime_FromSecondsObject@Base @SVER@ + _PyTime_MonotonicWithInfo@Base @SVER@ + _PyTime_ObjectToTime_t@Base @SVER@ + _PyTime_ObjectToTimespec@Base @SVER@ + _PyTime_ObjectToTimeval@Base @SVER@ + _PyTime_gmtime@Base @SVER@ + _PyTime_localtime@Base @SVER@ + _PyToken_OneChar@Base @SVER@ + _PyToken_ThreeChars@Base @SVER@ + _PyToken_TwoChars@Base @SVER@ + _PyTraceMalloc_GetTraceback@Base @SVER@ + _PyTraceback_Add@Base @SVER@ + _PyTrash_thread_deposit_object@Base @SVER@ + _PyTrash_thread_destroy_chain@Base @SVER@ + _PyTuple_FromArraySteal@Base @SVER@ + _PyTuple_Resize@Base @SVER@ + _PyType_GetDict@Base @SVER@ + _PyType_GetModuleByDef2@Base @SVER@ + _PyType_Lookup@Base @SVER@ + _PyType_LookupRef@Base @SVER@ + _PyType_Name@Base @SVER@ + _PyUnicodeWriter_Dealloc@Base @SVER@ + _PyUnicodeWriter_Finish@Base @SVER@ + _PyUnicodeWriter_Init@Base @SVER@ + _PyUnicodeWriter_PrepareInternal@Base @SVER@ + _PyUnicodeWriter_PrepareKindInternal@Base @SVER@ + _PyUnicodeWriter_WriteASCIIString@Base @SVER@ + _PyUnicodeWriter_WriteChar@Base @SVER@ + _PyUnicodeWriter_WriteLatin1String@Base @SVER@ + _PyUnicodeWriter_WriteStr@Base @SVER@ + _PyUnicodeWriter_WriteSubstring@Base @SVER@ + _PyUnicode_AsUTF8NoNUL@Base @SVER@ + _PyUnicode_AsUTF8String@Base @SVER@ + _PyUnicode_CheckConsistency@Base @SVER@ + _PyUnicode_Copy@Base @SVER@ + _PyUnicode_DecodeUnicodeEscapeInternal@Base @SVER@ + _PyUnicode_EncodeUTF16@Base @SVER@ + _PyUnicode_EncodeUTF32@Base @SVER@ + _PyUnicode_Equal@Base @SVER@ + _PyUnicode_EqualToASCIIString@Base @SVER@ + _PyUnicode_ExactDealloc@Base @SVER@ + _PyUnicode_FromId@Base @SVER@ + _PyUnicode_InternImmortal@Base @SVER@ + _PyUnicode_InternInPlace@Base @SVER@ + _PyUnicode_InternMortal@Base @SVER@ + _PyUnicode_IsAlpha@Base @SVER@ + _PyUnicode_IsDecimalDigit@Base @SVER@ + _PyUnicode_IsDigit@Base @SVER@ + _PyUnicode_IsLinebreak@Base @SVER@ + _PyUnicode_IsLowercase@Base @SVER@ + _PyUnicode_IsNumeric@Base @SVER@ + _PyUnicode_IsPrintable@Base @SVER@ + _PyUnicode_IsTitlecase@Base @SVER@ + _PyUnicode_IsUppercase@Base @SVER@ + _PyUnicode_IsWhitespace@Base @SVER@ + _PyUnicode_JoinArray@Base @SVER@ + _PyUnicode_ScanIdentifier@Base @SVER@ + _PyUnicode_ToDecimalDigit@Base @SVER@ + _PyUnicode_ToDigit@Base @SVER@ + _PyUnicode_ToLowercase@Base @SVER@ + _PyUnicode_ToNumeric@Base @SVER@ + _PyUnicode_ToTitlecase@Base @SVER@ + _PyUnicode_ToUppercase@Base @SVER@ + _PyUnicode_TransformDecimalAndSpaceToASCII@Base @SVER@ + _PyUnion_Type@Base @SVER@ + _PyWarnings_Init@Base @SVER@ + _PyWeakref_CallableProxyType@Base @SVER@ + _PyWeakref_ClearRef@Base @SVER@ + _PyWeakref_IsDead@Base @SVER@ + _PyWeakref_ProxyType@Base @SVER@ + _PyWeakref_RefType@Base @SVER@ + _PyXI_ApplyCapturedException@Base @SVER@ + _PyXI_ApplyError@Base @SVER@ + _PyXI_ApplyNamespace@Base @SVER@ + _PyXI_ClearExcInfo@Base @SVER@ + _PyXI_EndInterpreter@Base @SVER@ + _PyXI_Enter@Base @SVER@ + _PyXI_ExcInfoAsObject@Base @SVER@ + _PyXI_Exit@Base @SVER@ + _PyXI_FillNamespaceFromDict@Base @SVER@ + _PyXI_FormatExcInfo@Base @SVER@ + _PyXI_FreeNamespace@Base @SVER@ + _PyXI_HasCapturedException@Base @SVER@ + _PyXI_InitExcInfo@Base @SVER@ + _PyXI_NamespaceFromNames@Base @SVER@ + _PyXI_NewInterpreter@Base @SVER@ + _Py_BreakPoint@Base @SVER@ + _Py_BuildValue_SizeT@Base @SVER@ + _Py_CheckFunctionResult@Base @SVER@ + _Py_CheckRecursiveCall@Base @SVER@ + _Py_Dealloc@Base @SVER@ + _Py_DecRef@Base @SVER@ + _Py_DecodeLocaleEx@Base @SVER@ + _Py_DisplaySourceLine@Base @SVER@ + _Py_EllipsisObject@Base @SVER@ + _Py_EncodeLocaleEx@Base @SVER@ + _Py_FalseStruct@Base @SVER@ + _Py_FatalErrorFunc@Base @SVER@ + _Py_FatalRefcountErrorFunc@Base @SVER@ + _Py_GetConfig@Base @SVER@ + _Py_GetConfigsAsDict@Base @SVER@ + _Py_GetErrorHandler@Base @SVER@ + _Py_Get_Getpath_CodeObject@Base @SVER@ + _Py_Gid_Converter@Base @SVER@ + _Py_HandlePending@Base @SVER@ + _Py_HashBytes@Base @SVER@ + _Py_HashDouble@Base @SVER@ + _Py_HashSecret@Base @SVER@ + _Py_IncRef@Base @SVER@ + _Py_InitializeMain@Base @SVER@ + _Py_IsInterpreterFinalizing@Base @SVER@ + _Py_IsValidFD@Base @SVER@ + _Py_MakeCoro@Base @SVER@ + _Py_NewReference@Base @SVER@ + _Py_NewReferenceNoTotal@Base @SVER@ + _Py_NoneStruct@Base @SVER@ + _Py_NotImplementedStruct@Base @SVER@ + _Py_RestoreSignals@Base @SVER@ + _Py_ResurrectReference@Base @SVER@ + _Py_SetLocaleFromEnv@Base @SVER@ + _Py_SetRefcnt@Base @SVER@ + _Py_SwappedOp@Base @SVER@ + _Py_TrueStruct@Base @SVER@ + _Py_UTF8_Edit_Cost@Base @SVER@ + _Py_Uid_Converter@Base @SVER@ + _Py_UniversalNewlineFgetsWithSize@Base @SVER@ + _Py_VaBuildValue_SizeT@Base @SVER@ + _Py_ascii_whitespace@Base @SVER@ + _Py_c_abs@Base @SVER@ + _Py_c_diff@Base @SVER@ + _Py_c_neg@Base @SVER@ + _Py_c_pow@Base @SVER@ + _Py_c_prod@Base @SVER@ + _Py_c_quot@Base @SVER@ + _Py_c_sum@Base @SVER@ + _Py_closerange@Base @SVER@ + _Py_convert_optional_to_ssize_t@Base @SVER@ + _Py_ctype_table@Base @SVER@ + _Py_ctype_tolower@Base @SVER@ + _Py_ctype_toupper@Base @SVER@ + _Py_dup@Base @SVER@ + _Py_fopen_obj@Base @SVER@ + _Py_fstat@Base @SVER@ + _Py_fstat_noraise@Base @SVER@ + _Py_hashtable_clear@Base @SVER@ + _Py_hashtable_compare_direct@Base @SVER@ + _Py_hashtable_destroy@Base @SVER@ + _Py_hashtable_foreach@Base @SVER@ + _Py_hashtable_get@Base @SVER@ + _Py_hashtable_hash_ptr@Base @SVER@ + _Py_hashtable_len@Base @SVER@ + _Py_hashtable_new@Base @SVER@ + _Py_hashtable_new_full@Base @SVER@ + _Py_hashtable_set@Base @SVER@ + _Py_hashtable_size@Base @SVER@ + _Py_hashtable_steal@Base @SVER@ + _Py_normpath@Base @SVER@ + _Py_open@Base @SVER@ + _Py_open_noraise@Base @SVER@ + _Py_set_inheritable@Base @SVER@ + _Py_set_inheritable_async_safe@Base @SVER@ + _Py_stat@Base @SVER@ + _Py_strhex@Base @SVER@ + _Py_strhex_bytes_with_sep@Base @SVER@ + (arch=amd64 arm64)_Py_trampoline_func_end@Base @SVER@ + (arch=amd64 arm64)_Py_trampoline_func_start@Base @SVER@ + _Py_union_type_or@Base @SVER@ + _Py_write@Base @SVER@ + _Py_write_noraise@Base @SVER@ + + (optional|regex)"^_ctypes_.*@Base$" @SVER@ + + (optional|regex)"^PyInit_.*@Base$" @SVER@ diff --git a/debian/mincheck.py b/debian/mincheck.py new file mode 100644 index 000000000000000..5d29586838540d2 --- /dev/null +++ b/debian/mincheck.py @@ -0,0 +1,41 @@ + +import sys + +def get_listed(fn): + modules = set() + for line in open(fn).readlines(): + modules.add(line.split()[1]) + return modules + +def get_dependencies(fn): + t = eval(open(fn).read()) + modules = set() + depgraph = t['depgraph'] + for mod, deps in list(depgraph.items()): + if mod != '__main__': + modules.add(mod) + modules.update(list(deps.keys())) + return depgraph, modules + +def main(): + mods = get_listed(sys.argv[1]) + depgraph, deps = get_dependencies(sys.argv[2]) + print(("Listed modules:", sorted(mods))) + print("") + print(("Dependent modules:", sorted(deps))) + print("") + + missing = deps.difference(mods) + if missing: + print("Missing modules in python-minimal:") + print(missing) + for m in missing: + users = [] + for caller, callees in list(depgraph.items()): + if m in callees: + users.append(caller) + print((m, "used in: ", users)) + sys.exit(len(missing)) + +main() + diff --git a/debian/mkbinfmt.py b/debian/mkbinfmt.py new file mode 100644 index 000000000000000..0cf45e73ab0af67 --- /dev/null +++ b/debian/mkbinfmt.py @@ -0,0 +1,18 @@ +# mkbinfmt.py +import imp, sys, os.path + +magic = "".join(["\\x%.2x" % c for c in imp.get_magic()]) + +name = sys.argv[1] + +binfmt = '''\ +package %s +interpreter /usr/bin/%s +magic %s\ +''' % (name, name, magic) + +#filename = '/usr/share/binfmts/' + name +#open(filename,'w+').write(binfmt) + +sys.stdout.write(binfmt) +sys.stdout.write('\n') diff --git a/debian/mkbinfmtconf.py b/debian/mkbinfmtconf.py new file mode 100644 index 000000000000000..faf4e3c3b0a2d68 --- /dev/null +++ b/debian/mkbinfmtconf.py @@ -0,0 +1,9 @@ +# mkbinfmtconf.py +import importlib.util, sys, string, os.path + +magic = "".join(["\\x%.2x" % c for c in importlib.util.MAGIC_NUMBER]) + +name = sys.argv[1] + +sys.stdout.write(f":{name}:M::{magic}::/usr/bin/{name}:") +sys.stdout.write('\n') diff --git a/debian/multiarch.h.in b/debian/multiarch.h.in new file mode 100644 index 000000000000000..bb37cec9d84bf5f --- /dev/null +++ b/debian/multiarch.h.in @@ -0,0 +1,127 @@ +#if defined(__linux__) +# if defined(__x86_64__) && defined(__LP64__) +# include +# elif defined(__x86_64__) && defined(__ILP32__) +# include +# elif defined(__i386__) +# include +# elif defined(__aarch64__) && defined(__AARCH64EL__) +# include +# elif defined(__arc__) +# include +# elif defined(__alpha__) +# include +# elif defined(__ARM_EABI__) && defined(__ARM_PCS_VFP) +# include +# elif defined(__ARM_EABI__) && !defined(__ARM_PCS_VFP) +# include +# elif defined(__hppa__) +# include +# elif defined(__ia64__) +# include +# elif defined(__loongarch__) +# if defined(__loongarch_lp64) +# if defined(__loongarch_soft_float) +# include +# elif defined(__loongarch_single_float) +# include +# elif defined(__loongarch_double_float) +# include +# else +# error unknown multiarch location for @header@ +# endif +# else +# error unknown multiarch location for @header@ +# endif +# elif defined(__m68k__) && !defined(__mcoldfire__) +# include +# elif defined(__mips_hard_float) && defined(__mips_isa_rev) && (__mips_isa_rev >=6) && defined(_MIPSEL) +# if _MIPS_SIM == _ABIO32 +# include +# elif _MIPS_SIM == _ABIN32 +# include +# elif _MIPS_SIM == _ABI64 +# include +# else +# error unknown multiarch location for @header@ +# endif +# elif defined(__mips_hard_float) && defined(__mips_isa_rev) && (__mips_isa_rev >=6) +# if _MIPS_SIM == _ABIO32 +# include +# elif _MIPS_SIM == _ABIN32 +# include +# elif _MIPS_SIM == _ABI64 +# include +# else +# error unknown multiarch location for @header@ +# endif +# elif defined(__mips_hard_float) && defined(_MIPSEL) +# if _MIPS_SIM == _ABIO32 +# include +# elif _MIPS_SIM == _ABIN32 +# include +# elif _MIPS_SIM == _ABI64 +# include +# else +# error unknown multiarch location for @header@ +# endif +# elif defined(__mips_hard_float) +# if _MIPS_SIM == _ABIO32 +# include +# elif _MIPS_SIM == _ABIN32 +# include +# elif _MIPS_SIM == _ABI64 +# include +# else +# error unknown multiarch location for @header@ +# endif +# elif defined(__or1k__) +# include +# elif defined(__powerpc__) && defined(__SPE__) +# include +# elif defined(__powerpc64__) +# if defined(__LITTLE_ENDIAN__) +# include +# else +# include +# endif +# elif defined(__powerpc__) +# include +# elif defined(__s390x__) +# include +# elif defined(__s390__) +# include +# elif defined(__sh__) && defined(__LITTLE_ENDIAN__) +# include +# elif defined(__sparc__) && defined(__arch64__) +# include +# elif defined(__sparc__) +# include +# elif defined(__riscv) +# if __riscv_xlen == 64 +# include +# else +# include +# endif +# else +# error unknown multiarch location for @header@ +# endif +#elif defined(__FreeBSD_kernel__) +# if defined(__LP64__) +# include +# elif defined(__i386__) +# include +# else +# error unknown multiarch location for @header@ +# endif +#elif defined(__gnu_hurd__) +# if defined(__LP64__) +# include +# elif defined(__i386__) +# include +# else +# error unknown multiarch location for @header@ +# endif +#else +# error unknown multiarch location for @header@ +#endif diff --git a/debian/openssl.cnf b/debian/openssl.cnf new file mode 100644 index 000000000000000..a4d99236429e04f --- /dev/null +++ b/debian/openssl.cnf @@ -0,0 +1,7 @@ +openssl_conf = default_conf +[default_conf] +ssl_conf = ssl_sect +[ssl_sect] +system_default = system_default_sect +[system_default_sect] +CipherString = DEFAULT@SECLEVEL=1 diff --git a/debian/patches/deb-locations.diff b/debian/patches/deb-locations.diff new file mode 100644 index 000000000000000..80252ee9aae1b01 --- /dev/null +++ b/debian/patches/deb-locations.diff @@ -0,0 +1,27 @@ +Description: Debian: Adjust locations of directories to debian policy +Forwarded: not-needed + +--- a/Lib/pydoc.py ++++ b/Lib/pydoc.py +@@ -31,6 +31,10 @@ + + Module docs for core modules are assumed to be in + ++ /usr/share/doc/pythonX.Y/html/library ++ ++if the pythonX.Y-doc package is installed or in ++ + https://docs.python.org/X.Y/library/ + + This can be overridden by setting the PYTHONDOCS environment variable +--- a/Misc/python.man ++++ b/Misc/python.man +@@ -426,7 +426,7 @@ + These are subject to difference depending on local installation + conventions; ${prefix} and ${exec_prefix} are installation-dependent + and should be interpreted as for GNU software; they may be the same. +-The default for both is \fI/usr/local\fP. ++On Debian GNU/{Hurd,Linux} the default for both is \fI/usr\fP. + .IP \fI${exec_prefix}/bin/python\fP + Recommended location of the interpreter. + .PP diff --git a/debian/patches/destshared-location.diff b/debian/patches/destshared-location.diff new file mode 100644 index 000000000000000..0ec944ae0feac5f --- /dev/null +++ b/debian/patches/destshared-location.diff @@ -0,0 +1,17 @@ +Description: Keep the lib-dynload dir in the same place when configuring with + --libdir=/usr/lib/$(DEB_HOST_MULTIARCH) + The C extensions already have multiarch paths in their filenames. + +Forwarded: no + +--- a/Makefile.pre.in ++++ b/Makefile.pre.in +@@ -169,7 +169,7 @@ + LDSHARED= @LDSHARED@ $(PY_LDFLAGS) + BLDSHARED= @BLDSHARED@ $(PY_CORE_LDFLAGS) + LDCXXSHARED= @LDCXXSHARED@ $(PY_LDFLAGS) +-DESTSHARED= $(BINLIBDEST)/lib-dynload ++DESTSHARED= $(LIBDEST)/lib-dynload + + # List of exported symbols for AIX + EXPORTSYMS= @EXPORTSYMS@ diff --git a/debian/patches/disable-sem-check.diff b/debian/patches/disable-sem-check.diff new file mode 100644 index 000000000000000..3e44e4d0821a622 --- /dev/null +++ b/debian/patches/disable-sem-check.diff @@ -0,0 +1,30 @@ +Description: Debian: Don't autodetect whether semephores are present + Assume working semaphores, don't rely on running kernel for the check. + + This is not something that's approriate for us to detect at build time. + Potentially forwadable, if redesigned. + +Forwarded: not-needed + +--- a/configure.ac ++++ b/configure.ac +@@ -5995,10 +5995,15 @@ + [ac_cv_posix_semaphores_enabled=yes]) + ) + AS_VAR_IF([ac_cv_posix_semaphores_enabled], [no], [ +- AC_DEFINE( +- [POSIX_SEMAPHORES_NOT_ENABLED], [1], +- [Define if POSIX semaphores aren't enabled on your system] +- ) ++ case $ac_sys_system in ++ Linux*) # assume yes, see https://launchpad.net/bugs/630511 ++ ;; ++ *) ++ AC_DEFINE( ++ [POSIX_SEMAPHORES_NOT_ENABLED], [1], ++ [Define if POSIX semaphores aren't enabled on your system] ++ ) ++ esac + ]) + + dnl Multiprocessing check for broken sem_getvalue diff --git a/debian/patches/distutils-install-layout.diff b/debian/patches/distutils-install-layout.diff new file mode 100644 index 000000000000000..d1aba7573aa065f --- /dev/null +++ b/debian/patches/distutils-install-layout.diff @@ -0,0 +1,269 @@ +Description: Debian: Add a distutils option --install-layout=deb + This option: + - installs into $prefix/dist-packages instead of $prefix/site-packages. + - doesn't encode the python version into the egg name. + . + We install modules into dist-packages so that a local admin can build their + own cpython from source, and they won't see each others' installed modules. + This keeps Debian packaged applications working correctly, isolated from the + local cpython. + . + Customize site.py to import from Debian's dist-packages layout. + +Forwarded: not-needed + +--- a/Lib/site.py ++++ b/Lib/site.py +@@ -7,12 +7,18 @@ + This will append site-specific paths to the module search path. On + Unix (including Mac OSX), it starts with sys.prefix and + sys.exec_prefix (if different) and appends +-lib/python/site-packages. ++lib/python3/dist-packages. + On other platforms (such as Windows), it tries each of the + prefixes directly, as well as with lib/site-packages appended. The + resulting directories, if they exist, are appended to sys.path, and + also inspected for path configuration files. + ++For Debian and derivatives, this sys.path is augmented with directories ++for packages distributed within the distribution. Local addons go ++into /usr/local/lib/python/dist-packages, Debian addons ++install into /usr/lib/python3/dist-packages. ++/usr/lib/python/site-packages is not used. ++ + If a file named "pyvenv.cfg" exists one directory above sys.executable, + sys.prefix and sys.exec_prefix are set to that directory and + it is also checked for site-packages (sys.base_prefix and +@@ -387,6 +393,8 @@ + if prefixes is None: + prefixes = PREFIXES + ++ is_virtual_environment = sys.base_prefix != sys.prefix or hasattr(sys, "real_prefix") ++ + for prefix in prefixes: + if not prefix or prefix in seen: + continue +@@ -403,10 +411,21 @@ + if sys.platlibdir != "lib": + libdirs.append("lib") + ++ if is_virtual_environment: ++ sitepackages.append(os.path.join(prefix, "lib", ++ "python%d.%d" % sys.version_info[:2], ++ "site-packages")) ++ sitepackages.append(os.path.join(prefix, "local/lib", ++ "python%d.%d" % sys.version_info[:2], ++ "dist-packages")) ++ sitepackages.append(os.path.join(prefix, "lib", ++ "python3", ++ "dist-packages")) ++ # this one is deprecated for Debian + for libdir in libdirs: + path = os.path.join(prefix, libdir, + f"{implementation}{ver[0]}.{ver[1]}{abi_thread}", +- "site-packages") ++ "dist-packages") + sitepackages.append(path) + else: + sitepackages.append(prefix) +--- a/Lib/test/test_site.py ++++ b/Lib/test/test_site.py +@@ -326,16 +326,16 @@ + if os.sep == '/': + # OS X, Linux, FreeBSD, etc + if sys.platlibdir != "lib": +- self.assertEqual(len(dirs), 2) +- wanted = os.path.join('xoxo', sys.platlibdir, ++ self.assertEqual(len(dirs), 3) ++ wanted = os.path.join('xoxo', 'local', 'lib', + f'python{sysconfig._get_python_version_abi()}', +- 'site-packages') ++ 'dist-packages') + self.assertEqual(dirs[0], wanted) + else: +- self.assertEqual(len(dirs), 1) ++ self.assertEqual(len(dirs), 3) + wanted = os.path.join('xoxo', 'lib', + f'python{sysconfig._get_python_version_abi()}', +- 'site-packages') ++ 'dist-packages') + self.assertEqual(dirs[-1], wanted) + else: + # other platforms +--- a/Lib/pydoc.py ++++ b/Lib/pydoc.py +@@ -567,6 +567,7 @@ + 'marshal', 'posix', 'signal', 'sys', + '_thread', 'zipimport') or + (file.startswith(basedir) and ++ not file.startswith(os.path.join(basedir, 'dist-packages')) and + not file.startswith(os.path.join(basedir, 'site-packages')))) and + object.__name__ not in ('xml.etree', 'test.test_pydoc.pydoc_mod')): + if docloc.startswith(("http://", "https://")): +--- /dev/null ++++ b/Lib/_distutils_system_mod.py +@@ -0,0 +1,164 @@ ++""" ++Apply Debian-specific patches to distutils commands. ++ ++Extracts the customized behavior from patches as reported ++in pypa/distutils#2 and applies those customizations (except ++for scheme definitions) to those commands. ++ ++Place this module somewhere in sys.path to take effect. ++""" ++ ++import os ++import sys ++ ++import distutils.sysconfig ++import distutils.command.install as orig_install ++import distutils.command.install_egg_info as orig_install_egg_info ++from distutils.command.install_egg_info import ( ++ to_filename, ++ safe_name, ++ safe_version, ++ ) ++from distutils.errors import DistutilsOptionError ++ ++ ++class install(orig_install.install): ++ user_options = list(orig_install.install.user_options) + [ ++ ('install-layout=', None, ++ "installation layout to choose (known values: deb, unix)"), ++ ] ++ ++ def initialize_options(self): ++ super().initialize_options() ++ self.prefix_option = None ++ self.install_layout = None ++ ++ def select_scheme(self, name): ++ if name == "posix_prefix": ++ if self.install_layout: ++ if self.install_layout.lower() in ['deb']: ++ name = "deb_system" ++ elif self.install_layout.lower() in ['unix']: ++ name = "posix_prefix" ++ else: ++ raise DistutilsOptionError( ++ "unknown value for --install-layout") ++ elif ((self.prefix_option and ++ os.path.normpath(self.prefix) != '/usr/local') ++ or is_virtual_environment()): ++ name = "posix_prefix" ++ else: ++ if os.path.normpath(self.prefix) == '/usr/local': ++ self.prefix = self.exec_prefix = '/usr' ++ self.install_base = self.install_platbase = '/usr' ++ name = "posix_local" ++ super().select_scheme(name) ++ ++ def finalize_unix(self): ++ self.prefix_option = self.prefix ++ super().finalize_unix() ++ ++ ++class install_egg_info(orig_install_egg_info.install_egg_info): ++ user_options = list(orig_install_egg_info.install_egg_info.user_options) + [ ++ ('install-layout', None, "custom installation layout"), ++ ] ++ ++ def initialize_options(self): ++ super().initialize_options() ++ self.prefix_option = None ++ self.install_layout = None ++ ++ def finalize_options(self): ++ self.set_undefined_options('install',('install_layout','install_layout')) ++ self.set_undefined_options('install',('prefix_option','prefix_option')) ++ super().finalize_options() ++ ++ @property ++ def basename(self): ++ if self.install_layout: ++ if not self.install_layout.lower() in ['deb', 'unix']: ++ raise DistutilsOptionError( ++ "unknown value for --install-layout") ++ no_pyver = (self.install_layout.lower() == 'deb') ++ elif self.prefix_option: ++ no_pyver = False ++ else: ++ no_pyver = True ++ if no_pyver: ++ basename = "%s-%s.egg-info" % ( ++ to_filename(safe_name(self.distribution.get_name())), ++ to_filename(safe_version(self.distribution.get_version())) ++ ) ++ else: ++ basename = "%s-%s-py%d.%d.egg-info" % ( ++ to_filename(safe_name(self.distribution.get_name())), ++ to_filename(safe_version(self.distribution.get_version())), ++ *sys.version_info[:2] ++ ) ++ return basename ++ ++ ++def is_virtual_environment(): ++ return sys.base_prefix != sys.prefix or hasattr(sys, "real_prefix") ++ ++ ++def _posix_lib(standard_lib, libpython, early_prefix, prefix): ++ is_default_prefix = not early_prefix or os.path.normpath(early_prefix) in ('/usr', '/usr/local') ++ if standard_lib: ++ return libpython ++ elif is_default_prefix and not is_virtual_environment(): ++ return os.path.join(prefix, "lib", "python3", "dist-packages") ++ else: ++ return os.path.join(libpython, "site-packages") ++ ++ ++def _inject_headers(name, scheme): ++ """ ++ Given a scheme name and the resolved scheme, ++ if the scheme does not include headers, resolve ++ the fallback scheme for the name and use headers ++ from it. pypa/distutils#88 ++ ++ headers: module headers install location (posix_local is /local/ prefixed) ++ include: cpython headers (Python.h) ++ See also: bpo-44445 ++ """ ++ if 'headers' not in scheme: ++ if name == 'posix_prefix': ++ headers = scheme['include'] ++ else: ++ headers = orig_install.INSTALL_SCHEMES['posix_prefix']['headers'] ++ if name == 'posix_local' and '/local/' not in headers: ++ headers = headers.replace('/include/', '/local/include/') ++ scheme['headers'] = headers ++ return scheme ++ ++ ++def load_schemes_wrapper(_load_schemes): ++ """ ++ Implement the _inject_headers modification, above, but before ++ _inject_headers() was introduced, upstream. So, slower and messier. ++ """ ++ def wrapped_load_schemes(): ++ schemes = _load_schemes() ++ for name, scheme in schemes.items(): ++ _inject_headers(name, scheme) ++ return schemes ++ return wrapped_load_schemes ++ ++ ++def apply_customizations(): ++ orig_install.install = install ++ orig_install_egg_info.install_egg_info = install_egg_info ++ distutils.sysconfig._posix_lib = _posix_lib ++ ++ if hasattr(orig_install, '_inject_headers'): ++ # setuptools-bundled distutils >= 60.0.5 ++ orig_install._inject_headers = _inject_headers ++ elif hasattr(orig_install, '_load_schemes'): ++ # setuptools-bundled distutils >= 59.2.0 ++ orig_install._load_schemes = load_schemes_wrapper(orig_install._load_schemes) ++ ++ ++apply_customizations() diff --git a/debian/patches/ensurepip-disabled.diff b/debian/patches/ensurepip-disabled.diff new file mode 100644 index 000000000000000..f02e12580dc2782 --- /dev/null +++ b/debian/patches/ensurepip-disabled.diff @@ -0,0 +1,86 @@ +Description: Disable ensurepip for the system installation + We have a python3-pip package, for users who want pip. + We just need ensurepip to seed pip in virtual environments. + +Forwarded: not-needed + +--- a/Lib/ensurepip/__init__.py ++++ b/Lib/ensurepip/__init__.py +@@ -8,6 +8,34 @@ + from pathlib import Path + from shutil import copy2 + ++def _ensurepip_is_disabled_in_debian_for_system(): ++ # Detect if ensurepip is being executed inside of a python-virtualenv ++ # environment and return early if so. ++ if hasattr(sys, 'real_prefix'): ++ return ++ ++ # Detect if ensurepip is being executed inside of a stdlib venv ++ # environment and return early if so. ++ if sys.prefix != getattr(sys, "base_prefix", sys.prefix): ++ return ++ ++ # If we've gotten here, then we are running inside of the system Python ++ # and we don't want to use ensurepip to install into the system Python ++ # so instead we'll redirect the user to using dpkg and apt-get. ++ print('''\ ++ensurepip is disabled in Debian/Ubuntu for the system python. ++ ++Python modules for the system python are usually handled by dpkg and apt-get. ++ ++ apt install python3- ++ ++Install the python3-pip package to use pip itself. Using pip together ++with the system python might have unexpected results for any system installed ++module, so use it on your own risk, or make sure to only use it in virtual ++environments. ++''') ++ sys.exit(1) ++ + + __all__ = ["version", "bootstrap"] + _PIP_VERSION = "24.2" +@@ -130,6 +158,11 @@ + + Note that calling this function will alter both sys.path and os.environ. + """ ++ ++ # Ensure that we are only running this inside of a virtual environment ++ # of some kind. ++ _ensurepip_is_disabled_in_debian_for_system() ++ + if altinstall and default_pip: + raise ValueError("Cannot use altinstall and default_pip together") + +--- a/Lib/venv/__init__.py ++++ b/Lib/venv/__init__.py +@@ -442,8 +442,26 @@ + + def _setup_pip(self, context): + """Installs or upgrades pip in a virtual environment""" +- self._call_new_python(context, '-m', 'ensurepip', '--upgrade', +- '--default-pip', stderr=subprocess.STDOUT) ++ try: ++ self._call_new_python(context, '-m', 'ensurepip', '--upgrade', ++ '--default-pip', stderr=subprocess.STDOUT) ++ except subprocess.CalledProcessError as err: ++ stdlib = sysconfig.get_path('stdlib') ++ if not os.path.exists(f'{stdlib}/ensurepip/__main__.py'): ++ print("""\ ++The virtual environment was not created successfully because ensurepip is not ++available. On Debian/Ubuntu systems, you need to install the python3-venv ++package using the following command. ++ ++ apt install python{}-venv ++ ++You may need to use sudo with that command. After installing the python3-venv ++package, recreate your virtual environment. ++ ++Failing command: {} ++""".format(sysconfig.get_python_version(), context.env_exec_cmd)) ++ sys.exit(1) ++ raise + + def setup_scripts(self, context): + """ diff --git a/debian/patches/gdbm-import.diff b/debian/patches/gdbm-import.diff new file mode 100644 index 000000000000000..14121bed67a19f0 --- /dev/null +++ b/debian/patches/gdbm-import.diff @@ -0,0 +1,26 @@ +Description: Debian: Suggest installation of python3-gdbm package + We split gdbm out into a separate binary package. Help users who try to import + it, without it installed. + +Forwarded: not-needed + +--- a/Lib/dbm/gnu.py ++++ b/Lib/dbm/gnu.py +@@ -1,3 +1,6 @@ + """Provide the _gdbm module as a dbm submodule.""" + +-from _gdbm import * ++try: ++ from _gdbm import * ++except ImportError as msg: ++ raise ImportError(str(msg) + ', please install the python3-gdbm package') +--- a/Lib/dbm/ndbm.py ++++ b/Lib/dbm/ndbm.py +@@ -1,3 +1,6 @@ + """Provide the _dbm module as a dbm submodule.""" + +-from _dbm import * ++try: ++ from _dbm import * ++except ImportError as msg: ++ raise ImportError(str(msg) + ', please install the python3-gdbm package') diff --git a/debian/patches/git-updates.diff b/debian/patches/git-updates.diff new file mode 100644 index 000000000000000..e419475f32ba780 --- /dev/null +++ b/debian/patches/git-updates.diff @@ -0,0 +1,44034 @@ +Description: Updates from the 3.13 branch (until 2024-11-12). + We pick the latest updates from the maintainance branch, and carry them in a + patch, rather than creating and uploading uploading a new .orig tarball. + +# git diff --no-renames 60403a5409ff2c3f3b07dd2ca91a7a3e096839c7 e5e70c5f094c92f72789dd85ab4d74516a5b4932 | filterdiff -x ?/.hgignore -x ?/.hgeol -x ?/.hgtags -x ?/.hgtouch -x ?/.gitignore -x ?/.gitattributes -x '?/.github/*' -x '?/.git*' -x ?/.codecov.yml -x ?/.travis.yml -x ?/configure --remove-timestamps + +diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile +index a4ada1b66bf..ada5fb0fe64 100644 +--- a/.devcontainer/Dockerfile ++++ b/.devcontainer/Dockerfile +@@ -2,7 +2,7 @@ FROM docker.io/library/fedora:40 + + ENV CC=clang + +-ENV WASI_SDK_VERSION=22 ++ENV WASI_SDK_VERSION=24 + ENV WASI_SDK_PATH=/opt/wasi-sdk + + ENV WASMTIME_HOME=/opt/wasmtime +@@ -14,7 +14,7 @@ RUN dnf -y --nodocs --setopt=install_weak_deps=False install /usr/bin/{blurb,cla + dnf -y clean all + + RUN mkdir ${WASI_SDK_PATH} && \ +- curl --location https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_SDK_VERSION}/wasi-sdk-${WASI_SDK_VERSION}.0-linux.tar.gz | \ ++ curl --location https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_SDK_VERSION}/wasi-sdk-${WASI_SDK_VERSION}.0-x86_64-linux.tar.gz | \ + tar --strip-components 1 --directory ${WASI_SDK_PATH} --extract --gunzip + + RUN mkdir --parents ${WASMTIME_HOME} && \ +diff --git a/Android/android-env.sh b/Android/android-env.sh +index 93372e3fe1c..b93e7f21ed5 100644 +--- a/Android/android-env.sh ++++ b/Android/android-env.sh +@@ -24,7 +24,7 @@ fail() { + # * https://android.googlesource.com/platform/ndk/+/ndk-rXX-release/docs/BuildSystemMaintainers.md + # where XX is the NDK version. Do a diff against the version you're upgrading from, e.g.: + # https://android.googlesource.com/platform/ndk/+/ndk-r25-release..ndk-r26-release/docs/BuildSystemMaintainers.md +-ndk_version=26.2.11394342 ++ndk_version=27.1.12297006 + + ndk=$ANDROID_HOME/ndk/$ndk_version + if ! [ -e $ndk ]; then +@@ -58,8 +58,8 @@ for path in "$AR" "$AS" "$CC" "$CXX" "$LD" "$NM" "$RANLIB" "$READELF" "$STRIP"; + fi + done + +-export CFLAGS="" +-export LDFLAGS="-Wl,--build-id=sha1 -Wl,--no-rosegment" ++export CFLAGS="-D__BIONIC_NO_PAGE_SIZE_MACRO" ++export LDFLAGS="-Wl,--build-id=sha1 -Wl,--no-rosegment -Wl,-z,max-page-size=16384" + + # Unlike Linux, Android does not implicitly use a dlopened library to resolve + # relocations in subsequently-loaded libraries, even if RTLD_GLOBAL is used +@@ -85,6 +85,10 @@ if [ -n "${PREFIX:-}" ]; then + export PKG_CONFIG_LIBDIR="$abs_prefix/lib/pkgconfig" + fi + ++# When compiling C++, some build systems will combine CFLAGS and CXXFLAGS, and some will ++# use CXXFLAGS alone. ++export CXXFLAGS=$CFLAGS ++ + # Use the same variable name as conda-build + if [ $(uname) = "Darwin" ]; then + export CPU_COUNT=$(sysctl -n hw.ncpu) +diff --git a/Android/android.py b/Android/android.py +index 8696d9eaeca..ae630aa8f44 100755 +--- a/Android/android.py ++++ b/Android/android.py +@@ -138,8 +138,8 @@ def make_build_python(context): + + def unpack_deps(host): + deps_url = "https://github.com/beeware/cpython-android-source-deps/releases/download" +- for name_ver in ["bzip2-1.0.8-1", "libffi-3.4.4-2", "openssl-3.0.15-0", +- "sqlite-3.45.1-0", "xz-5.4.6-0"]: ++ for name_ver in ["bzip2-1.0.8-2", "libffi-3.4.4-3", "openssl-3.0.15-4", ++ "sqlite-3.45.3-3", "xz-5.4.6-1"]: + filename = f"{name_ver}-{host}.tar.gz" + download(f"{deps_url}/{name_ver}/{filename}") + run(["tar", "-xf", filename]) +@@ -189,12 +189,13 @@ def configure_host_python(context): + + def make_host_python(context): + # The CFLAGS and LDFLAGS set in android-env include the prefix dir, so +- # delete any previously-installed Python libs and include files to prevent +- # them being used during the build. ++ # delete any previous Python installation to prevent it being used during ++ # the build. + host_dir = subdir(context.host) + prefix_dir = host_dir / "prefix" + delete_glob(f"{prefix_dir}/include/python*") + delete_glob(f"{prefix_dir}/lib/libpython*") ++ delete_glob(f"{prefix_dir}/lib/python*") + + os.chdir(host_dir / "build") + run(["make", "-j", str(os.cpu_count())], host=context.host) +diff --git a/Android/testbed/app/build.gradle.kts b/Android/testbed/app/build.gradle.kts +index 7e0bef58ed8..6c17406c872 100644 +--- a/Android/testbed/app/build.gradle.kts ++++ b/Android/testbed/app/build.gradle.kts +@@ -30,16 +30,6 @@ val PYTHON_VERSION = file("$PYTHON_DIR/Include/patchlevel.h").useLines { + throw GradleException("Failed to find Python version") + } + +-android.ndkVersion = file("../../android-env.sh").useLines { +- for (line in it) { +- val match = """ndk_version=(\S+)""".toRegex().find(line) +- if (match != null) { +- return@useLines match.groupValues[1] +- } +- } +- throw GradleException("Failed to find NDK version") +-} +- + + android { + namespace = "org.python.testbed" +@@ -55,11 +45,22 @@ android { + ndk.abiFilters.addAll(ABIS.keys) + externalNativeBuild.cmake.arguments( + "-DPYTHON_CROSS_DIR=$PYTHON_CROSS_DIR", +- "-DPYTHON_VERSION=$PYTHON_VERSION") ++ "-DPYTHON_VERSION=$PYTHON_VERSION", ++ "-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON", ++ ) + + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + } + ++ val androidEnvFile = file("../../android-env.sh").absoluteFile ++ ndkVersion = androidEnvFile.useLines { ++ for (line in it) { ++ """ndk_version=(\S+)""".toRegex().find(line)?.let { ++ return@useLines it.groupValues[1] ++ } ++ } ++ throw GradleException("Failed to find NDK version in $androidEnvFile") ++ } + externalNativeBuild.cmake { + path("src/main/c/CMakeLists.txt") + } +diff --git a/Android/testbed/app/src/main/c/main_activity.c b/Android/testbed/app/src/main/c/main_activity.c +index 53470904899..69251332d48 100644 +--- a/Android/testbed/app/src/main/c/main_activity.c ++++ b/Android/testbed/app/src/main/c/main_activity.c +@@ -100,7 +100,7 @@ JNIEXPORT void JNICALL Java_org_python_testbed_PythonTestRunner_redirectStdioToL + } + + +-// --- Python intialization ---------------------------------------------------- ++// --- Python initialization --------------------------------------------------- + + static PyStatus set_config_string( + JNIEnv *env, PyConfig *config, wchar_t **config_str, jstring value +diff --git a/Android/testbed/build.gradle.kts b/Android/testbed/build.gradle.kts +index 2dad1501c24..4d1d6f87594 100644 +--- a/Android/testbed/build.gradle.kts ++++ b/Android/testbed/build.gradle.kts +@@ -1,5 +1,5 @@ + // Top-level build file where you can add configuration options common to all sub-projects/modules. + plugins { +- id("com.android.application") version "8.4.2" apply false ++ id("com.android.application") version "8.6.1" apply false + id("org.jetbrains.kotlin.android") version "1.9.22" apply false + } +diff --git a/Android/testbed/gradle/wrapper/gradle-wrapper.properties b/Android/testbed/gradle/wrapper/gradle-wrapper.properties +index 57b2f57cc86..36529c89642 100644 +--- a/Android/testbed/gradle/wrapper/gradle-wrapper.properties ++++ b/Android/testbed/gradle/wrapper/gradle-wrapper.properties +@@ -1,6 +1,6 @@ + #Mon Feb 19 20:29:06 GMT 2024 + distributionBase=GRADLE_USER_HOME + distributionPath=wrapper/dists +-distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip ++distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip + zipStoreBase=GRADLE_USER_HOME + zipStorePath=wrapper/dists +diff --git a/Doc/README.rst b/Doc/README.rst +index efcee0db428..2d1148753e0 100644 +--- a/Doc/README.rst ++++ b/Doc/README.rst +@@ -133,8 +133,5 @@ Bugs in the content should be reported to the + + Bugs in the toolset should be reported to the tools themselves. + +-You can also send a mail to the Python Documentation Team at docs@python.org, +-and we will process your request as soon as possible. +- +-If you want to help the Documentation Team, you are always welcome. Just send +-a mail to docs@python.org. ++To help with the documentation, or report any problems, please leave a message ++on `discuss.python.org `_. +diff --git a/Doc/c-api/allocation.rst b/Doc/c-api/allocation.rst +index b3609c23315..e6ff40ab46e 100644 +--- a/Doc/c-api/allocation.rst ++++ b/Doc/c-api/allocation.rst +@@ -15,10 +15,8 @@ Allocating Objects on the Heap + .. c:function:: PyObject* PyObject_Init(PyObject *op, PyTypeObject *type) + + Initialize a newly allocated object *op* with its type and initial +- reference. Returns the initialized object. If *type* indicates that the +- object participates in the cyclic garbage detector, it is added to the +- detector's set of observed objects. Other fields of the object are not +- affected. ++ reference. Returns the initialized object. Other fields of the object are ++ not affected. + + + .. c:function:: PyVarObject* PyObject_InitVar(PyVarObject *op, PyTypeObject *type, Py_ssize_t size) +diff --git a/Doc/c-api/code.rst b/Doc/c-api/code.rst +index 6ae6bfe4aa6..6eae24b38fa 100644 +--- a/Doc/c-api/code.rst ++++ b/Doc/c-api/code.rst +@@ -32,11 +32,13 @@ bound into a function. + + .. c:function:: Py_ssize_t PyCode_GetNumFree(PyCodeObject *co) + +- Return the number of free variables in a code object. ++ Return the number of :term:`free (closure) variables ` ++ in a code object. + + .. c:function:: int PyUnstable_Code_GetFirstFree(PyCodeObject *co) + +- Return the position of the first free variable in a code object. ++ Return the position of the first :term:`free (closure) variable ` ++ in a code object. + + .. versionchanged:: 3.13 + +@@ -144,7 +146,8 @@ bound into a function. + + Equivalent to the Python code ``getattr(co, 'co_freevars')``. + Returns a new reference to a :c:type:`PyTupleObject` containing the names of +- the free variables. On error, ``NULL`` is returned and an exception is raised. ++ the :term:`free (closure) variables `. On error, ``NULL`` is returned ++ and an exception is raised. + + .. versionadded:: 3.11 + +diff --git a/Doc/c-api/import.rst b/Doc/c-api/import.rst +index 8108a5015be..6e48644c8fe 100644 +--- a/Doc/c-api/import.rst ++++ b/Doc/c-api/import.rst +@@ -136,14 +136,14 @@ Importing Modules + such modules have no way to know that the module object is an unknown (and + probably damaged with respect to the module author's intents) state. + +- The module's :attr:`__spec__` and :attr:`__loader__` will be set, if +- not set already, with the appropriate values. The spec's loader will +- be set to the module's ``__loader__`` (if set) and to an instance of +- :class:`~importlib.machinery.SourceFileLoader` otherwise. ++ The module's :attr:`~module.__spec__` and :attr:`~module.__loader__` will be ++ set, if not set already, with the appropriate values. The spec's loader ++ will be set to the module's :attr:`!__loader__` (if set) and to an instance ++ of :class:`~importlib.machinery.SourceFileLoader` otherwise. + +- The module's :attr:`__file__` attribute will be set to the code object's +- :attr:`~codeobject.co_filename`. If applicable, :attr:`__cached__` will also +- be set. ++ The module's :attr:`~module.__file__` attribute will be set to the code ++ object's :attr:`~codeobject.co_filename`. If applicable, ++ :attr:`~module.__cached__` will also be set. + + This function will reload the module if it was already imported. See + :c:func:`PyImport_ReloadModule` for the intended way to reload a module. +@@ -155,29 +155,29 @@ Importing Modules + :c:func:`PyImport_ExecCodeModuleWithPathnames`. + + .. versionchanged:: 3.12 +- The setting of :attr:`__cached__` and :attr:`__loader__` is +- deprecated. See :class:`~importlib.machinery.ModuleSpec` for ++ The setting of :attr:`~module.__cached__` and :attr:`~module.__loader__` ++ is deprecated. See :class:`~importlib.machinery.ModuleSpec` for + alternatives. + + + .. c:function:: PyObject* PyImport_ExecCodeModuleEx(const char *name, PyObject *co, const char *pathname) + +- Like :c:func:`PyImport_ExecCodeModule`, but the :attr:`__file__` attribute of +- the module object is set to *pathname* if it is non-``NULL``. ++ Like :c:func:`PyImport_ExecCodeModule`, but the :attr:`~module.__file__` ++ attribute of the module object is set to *pathname* if it is non-``NULL``. + + See also :c:func:`PyImport_ExecCodeModuleWithPathnames`. + + + .. c:function:: PyObject* PyImport_ExecCodeModuleObject(PyObject *name, PyObject *co, PyObject *pathname, PyObject *cpathname) + +- Like :c:func:`PyImport_ExecCodeModuleEx`, but the :attr:`__cached__` ++ Like :c:func:`PyImport_ExecCodeModuleEx`, but the :attr:`~module.__cached__` + attribute of the module object is set to *cpathname* if it is + non-``NULL``. Of the three functions, this is the preferred one to use. + + .. versionadded:: 3.3 + + .. versionchanged:: 3.12 +- Setting :attr:`__cached__` is deprecated. See ++ Setting :attr:`~module.__cached__` is deprecated. See + :class:`~importlib.machinery.ModuleSpec` for alternatives. + + +diff --git a/Doc/c-api/init.rst b/Doc/c-api/init.rst +index fd97d1d6ec3..39eb7fe4394 100644 +--- a/Doc/c-api/init.rst ++++ b/Doc/c-api/init.rst +@@ -7,7 +7,8 @@ + Initialization, Finalization, and Threads + ***************************************** + +-See also :ref:`Python Initialization Configuration `. ++See :ref:`Python Initialization Configuration ` for details ++on how to configure the interpreter prior to initialization. + + .. _pre-init-safe: + +@@ -21,6 +22,15 @@ a few functions and the :ref:`global configuration variables + + The following functions can be safely called before Python is initialized: + ++* Functions that initialize the interpreter: ++ ++ * :c:func:`Py_Initialize` ++ * :c:func:`Py_InitializeEx` ++ * :c:func:`Py_InitializeFromConfig` ++ * :c:func:`Py_BytesMain` ++ * :c:func:`Py_Main` ++ * the runtime pre-initialization functions covered in :ref:`init-config` ++ + * Configuration functions: + + * :c:func:`PyImport_AppendInittab` +@@ -32,6 +42,7 @@ The following functions can be safely called before Python is initialized: + * :c:func:`Py_SetProgramName` + * :c:func:`Py_SetPythonHome` + * :c:func:`PySys_ResetWarnOptions` ++ * the configuration functions covered in :ref:`init-config` + + * Informative functions: + +@@ -43,10 +54,12 @@ The following functions can be safely called before Python is initialized: + * :c:func:`Py_GetCopyright` + * :c:func:`Py_GetPlatform` + * :c:func:`Py_GetVersion` ++ * :c:func:`Py_IsInitialized` + + * Utilities: + + * :c:func:`Py_DecodeLocale` ++ * the status reporting and utility functions covered in :ref:`init-config` + + * Memory allocators: + +@@ -62,11 +75,13 @@ The following functions can be safely called before Python is initialized: + + .. note:: + +- The following functions **should not be called** before +- :c:func:`Py_Initialize`: :c:func:`Py_EncodeLocale`, :c:func:`Py_GetPath`, ++ Despite their apparent similarity to some of the functions listed above, ++ the following functions **should not be called** before the interpreter has ++ been initialized: :c:func:`Py_EncodeLocale`, :c:func:`Py_GetPath`, + :c:func:`Py_GetPrefix`, :c:func:`Py_GetExecPrefix`, + :c:func:`Py_GetProgramFullPath`, :c:func:`Py_GetPythonHome`, +- :c:func:`Py_GetProgramName` and :c:func:`PyEval_InitThreads`. ++ :c:func:`Py_GetProgramName`, :c:func:`PyEval_InitThreads`, and ++ :c:func:`Py_RunMain`. + + + .. _global-conf-vars: +@@ -346,34 +361,42 @@ Initializing and finalizing the interpreter + this should be called before using any other Python/C API functions; see + :ref:`Before Python Initialization ` for the few exceptions. + +- This initializes +- the table of loaded modules (``sys.modules``), and creates the fundamental +- modules :mod:`builtins`, :mod:`__main__` and :mod:`sys`. It also initializes +- the module search path (``sys.path``). It does not set ``sys.argv``; use +- the new :c:type:`PyConfig` API of the :ref:`Python Initialization +- Configuration ` for that. This is a no-op when called for a +- second time +- (without calling :c:func:`Py_FinalizeEx` first). There is no return value; it is a +- fatal error if the initialization fails. +- +- Use the :c:func:`Py_InitializeFromConfig` function to customize the ++ This initializes the table of loaded modules (``sys.modules``), and creates ++ the fundamental modules :mod:`builtins`, :mod:`__main__` and :mod:`sys`. ++ It also initializes the module search path (``sys.path``). It does not set ++ ``sys.argv``; use the :ref:`Python Initialization Configuration ` ++ API for that. This is a no-op when called for a second time (without calling ++ :c:func:`Py_FinalizeEx` first). There is no return value; it is a fatal ++ error if the initialization fails. ++ ++ Use :c:func:`Py_InitializeFromConfig` to customize the + :ref:`Python Initialization Configuration `. + + .. note:: +- On Windows, changes the console mode from ``O_TEXT`` to ``O_BINARY``, which will +- also affect non-Python uses of the console using the C Runtime. ++ On Windows, changes the console mode from ``O_TEXT`` to ``O_BINARY``, ++ which will also affect non-Python uses of the console using the C Runtime. + + + .. c:function:: void Py_InitializeEx(int initsigs) + + This function works like :c:func:`Py_Initialize` if *initsigs* is ``1``. If +- *initsigs* is ``0``, it skips initialization registration of signal handlers, which +- might be useful when Python is embedded. ++ *initsigs* is ``0``, it skips initialization registration of signal handlers, ++ which may be useful when CPython is embedded as part of a larger application. + +- Use the :c:func:`Py_InitializeFromConfig` function to customize the ++ Use :c:func:`Py_InitializeFromConfig` to customize the + :ref:`Python Initialization Configuration `. + + ++.. c:function:: PyStatus Py_InitializeFromConfig(const PyConfig *config) ++ ++ Initialize Python from *config* configuration, as described in ++ :ref:`init-from-config`. ++ ++ See the :ref:`init-config` section for details on pre-initializing the ++ interpreter, populating the runtime configuration structure, and querying ++ the returned status structure. ++ ++ + .. c:function:: int Py_IsInitialized() + + Return true (nonzero) when the Python interpreter has been initialized, false +@@ -430,12 +453,111 @@ Initializing and finalizing the interpreter + + .. versionadded:: 3.6 + ++ + .. c:function:: void Py_Finalize() + + This is a backwards-compatible version of :c:func:`Py_FinalizeEx` that + disregards the return value. + + ++.. c:function:: int Py_BytesMain(int argc, char **argv) ++ ++ Similar to :c:func:`Py_Main` but *argv* is an array of bytes strings, ++ allowing the calling application to delegate the text decoding step to ++ the CPython runtime. ++ ++ .. versionadded:: 3.8 ++ ++ ++.. c:function:: int Py_Main(int argc, wchar_t **argv) ++ ++ The main program for the standard interpreter, encapsulating a full ++ initialization/finalization cycle, as well as additional ++ behaviour to implement reading configurations settings from the environment ++ and command line, and then executing ``__main__`` in accordance with ++ :ref:`using-on-cmdline`. ++ ++ This is made available for programs which wish to support the full CPython ++ command line interface, rather than just embedding a Python runtime in a ++ larger application. ++ ++ The *argc* and *argv* parameters are similar to those which are passed to a ++ C program's :c:func:`main` function, except that the *argv* entries are first ++ converted to ``wchar_t`` using :c:func:`Py_DecodeLocale`. It is also ++ important to note that the argument list entries may be modified to point to ++ strings other than those passed in (however, the contents of the strings ++ pointed to by the argument list are not modified). ++ ++ The return value will be ``0`` if the interpreter exits normally (i.e., ++ without an exception), ``1`` if the interpreter exits due to an exception, ++ or ``2`` if the argument list does not represent a valid Python command ++ line. ++ ++ Note that if an otherwise unhandled :exc:`SystemExit` is raised, this ++ function will not return ``1``, but exit the process, as long as ++ ``Py_InspectFlag`` is not set. If ``Py_InspectFlag`` is set, execution will ++ drop into the interactive Python prompt, at which point a second otherwise ++ unhandled :exc:`SystemExit` will still exit the process, while any other ++ means of exiting will set the return value as described above. ++ ++ In terms of the CPython runtime configuration APIs documented in the ++ :ref:`runtime configuration ` section (and without accounting ++ for error handling), ``Py_Main`` is approximately equivalent to:: ++ ++ PyConfig config; ++ PyConfig_InitPythonConfig(&config); ++ PyConfig_SetArgv(&config, argc, argv); ++ Py_InitializeFromConfig(&config); ++ PyConfig_Clear(&config); ++ ++ Py_RunMain(); ++ ++ In normal usage, an embedding application will call this function ++ *instead* of calling :c:func:`Py_Initialize`, :c:func:`Py_InitializeEx` or ++ :c:func:`Py_InitializeFromConfig` directly, and all settings will be applied ++ as described elsewhere in this documentation. If this function is instead ++ called *after* a preceding runtime initialization API call, then exactly ++ which environmental and command line configuration settings will be updated ++ is version dependent (as it depends on which settings correctly support ++ being modified after they have already been set once when the runtime was ++ first initialized). ++ ++ ++.. c:function:: int Py_RunMain(void) ++ ++ Executes the main module in a fully configured CPython runtime. ++ ++ Executes the command (:c:member:`PyConfig.run_command`), the script ++ (:c:member:`PyConfig.run_filename`) or the module ++ (:c:member:`PyConfig.run_module`) specified on the command line or in the ++ configuration. If none of these values are set, runs the interactive Python ++ prompt (REPL) using the ``__main__`` module's global namespace. ++ ++ If :c:member:`PyConfig.inspect` is not set (the default), the return value ++ will be ``0`` if the interpreter exits normally (that is, without raising ++ an exception), or ``1`` if the interpreter exits due to an exception. If an ++ otherwise unhandled :exc:`SystemExit` is raised, the function will immediately ++ exit the process instead of returning ``1``. ++ ++ If :c:member:`PyConfig.inspect` is set (such as when the :option:`-i` option ++ is used), rather than returning when the interpreter exits, execution will ++ instead resume in an interactive Python prompt (REPL) using the ``__main__`` ++ module's global namespace. If the interpreter exited with an exception, it ++ is immediately raised in the REPL session. The function return value is ++ then determined by the way the *REPL session* terminates: returning ``0`` ++ if the session terminates without raising an unhandled exception, exiting ++ immediately for an unhandled :exc:`SystemExit`, and returning ``1`` for ++ any other unhandled exception. ++ ++ This function always finalizes the Python interpreter regardless of whether ++ it returns a value or immediately exits the process due to an unhandled ++ :exc:`SystemExit` exception. ++ ++ See :ref:`Python Configuration ` for an example of a ++ customized Python that always runs in isolated mode using ++ :c:func:`Py_RunMain`. ++ ++ + Process-wide parameters + ======================= + +@@ -493,7 +615,7 @@ Process-wide parameters + returned string points into static storage; the caller should not modify its + value. This corresponds to the :makevar:`prefix` variable in the top-level + :file:`Makefile` and the :option:`--prefix` argument to the :program:`configure` +- script at build time. The value is available to Python code as ``sys.prefix``. ++ script at build time. The value is available to Python code as ``sys.base_prefix``. + It is only useful on Unix. See also the next function. + + This function should not be called before :c:func:`Py_Initialize`, otherwise +@@ -503,7 +625,8 @@ Process-wide parameters + It now returns ``NULL`` if called before :c:func:`Py_Initialize`. + + .. deprecated-removed:: 3.13 3.15 +- Get :data:`sys.prefix` instead. ++ Get :data:`sys.base_prefix` instead, or :data:`sys.prefix` if ++ :ref:`virtual environments ` need to be handled. + + + .. c:function:: wchar_t* Py_GetExecPrefix() +@@ -516,7 +639,8 @@ Process-wide parameters + should not modify its value. This corresponds to the :makevar:`exec_prefix` + variable in the top-level :file:`Makefile` and the ``--exec-prefix`` + argument to the :program:`configure` script at build time. The value is +- available to Python code as ``sys.exec_prefix``. It is only useful on Unix. ++ available to Python code as ``sys.base_exec_prefix``. It is only useful on ++ Unix. + + Background: The exec-prefix differs from the prefix when platform dependent + files (such as executables and shared libraries) are installed in a different +@@ -547,7 +671,8 @@ Process-wide parameters + It now returns ``NULL`` if called before :c:func:`Py_Initialize`. + + .. deprecated-removed:: 3.13 3.15 +- Get :data:`sys.exec_prefix` instead. ++ Get :data:`sys.base_exec_prefix` instead, or :data:`sys.exec_prefix` if ++ :ref:`virtual environments ` need to be handled. + + + .. c:function:: wchar_t* Py_GetProgramFullPath() +@@ -2246,7 +2371,7 @@ Example usage:: + + In the above example, :c:macro:`Py_SETREF` calls :c:macro:`Py_DECREF`, which + can call arbitrary code through an object's deallocation function. The critical +-section API avoids potentital deadlocks due to reentrancy and lock ordering ++section API avoids potential deadlocks due to reentrancy and lock ordering + by allowing the runtime to temporarily suspend the critical section if the + code triggered by the finalizer blocks and calls :c:func:`PyEval_SaveThread`. + +diff --git a/Doc/c-api/init_config.rst b/Doc/c-api/init_config.rst +index 918c8669e8f..612aa2aa711 100644 +--- a/Doc/c-api/init_config.rst ++++ b/Doc/c-api/init_config.rst +@@ -1348,14 +1348,13 @@ the :option:`-X` command line option. + The ``show_alloc_count`` field has been removed. + + ++.. _init-from-config: ++ + Initialization with PyConfig + ============================ + +-Function to initialize Python: +- +-.. c:function:: PyStatus Py_InitializeFromConfig(const PyConfig *config) +- +- Initialize Python from *config* configuration. ++Initializing the interpreter from a populated configuration struct is handled ++by calling :c:func:`Py_InitializeFromConfig`. + + The caller is responsible to handle exceptions (error or exit) using + :c:func:`PyStatus_Exception` and :c:func:`Py_ExitStatusException`. +@@ -1585,26 +1584,6 @@ The ``__PYVENV_LAUNCHER__`` environment variable is used to set + :c:member:`PyConfig.base_executable`. + + +-Py_RunMain() +-============ +- +-.. c:function:: int Py_RunMain(void) +- +- Execute the command (:c:member:`PyConfig.run_command`), the script +- (:c:member:`PyConfig.run_filename`) or the module +- (:c:member:`PyConfig.run_module`) specified on the command line or in the +- configuration. +- +- By default and when if :option:`-i` option is used, run the REPL. +- +- Finally, finalizes Python and returns an exit status that can be passed to +- the ``exit()`` function. +- +-See :ref:`Python Configuration ` for an example of +-customized Python always running in isolated mode using +-:c:func:`Py_RunMain`. +- +- + Py_GetArgcArgv() + ================ + +diff --git a/Doc/c-api/long.rst b/Doc/c-api/long.rst +index c9e277680ab..1f899b1df19 100644 +--- a/Doc/c-api/long.rst ++++ b/Doc/c-api/long.rst +@@ -454,7 +454,7 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate. + free(bignum); + + *flags* is either ``-1`` (``Py_ASNATIVEBYTES_DEFAULTS``) to select defaults +- that behave most like a C cast, or a combintation of the other flags in ++ that behave most like a C cast, or a combination of the other flags in + the table below. + Note that ``-1`` cannot be combined with other flags. + +@@ -538,6 +538,9 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate. + Exactly what values are considered compact is an implementation detail + and is subject to change. + ++ .. versionadded:: 3.12 ++ ++ + .. c:function:: Py_ssize_t PyUnstable_Long_CompactValue(const PyLongObject* op) + + If *op* is compact, as determined by :c:func:`PyUnstable_Long_IsCompact`, +@@ -545,3 +548,5 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate. + + Otherwise, the return value is undefined. + ++ .. versionadded:: 3.12 ++ +diff --git a/Doc/c-api/module.rst b/Doc/c-api/module.rst +index ec61be284ca..f82a050ab75 100644 +--- a/Doc/c-api/module.rst ++++ b/Doc/c-api/module.rst +@@ -37,18 +37,19 @@ Module Objects + single: __package__ (module attribute) + single: __loader__ (module attribute) + +- Return a new module object with the :attr:`__name__` attribute set to *name*. +- The module's :attr:`__name__`, :attr:`__doc__`, :attr:`__package__`, and +- :attr:`__loader__` attributes are filled in (all but :attr:`__name__` are set +- to ``None``); the caller is responsible for providing a :attr:`__file__` +- attribute. ++ Return a new module object with :attr:`module.__name__` set to *name*. ++ The module's :attr:`!__name__`, :attr:`~module.__doc__`, ++ :attr:`~module.__package__` and :attr:`~module.__loader__` attributes are ++ filled in (all but :attr:`!__name__` are set to ``None``). The caller is ++ responsible for setting a :attr:`~module.__file__` attribute. + + Return ``NULL`` with an exception set on error. + + .. versionadded:: 3.3 + + .. versionchanged:: 3.4 +- :attr:`__package__` and :attr:`__loader__` are set to ``None``. ++ :attr:`~module.__package__` and :attr:`~module.__loader__` are now set to ++ ``None``. + + + .. c:function:: PyObject* PyModule_New(const char *name) +@@ -77,8 +78,9 @@ Module Objects + single: __name__ (module attribute) + single: SystemError (built-in exception) + +- Return *module*'s :attr:`__name__` value. If the module does not provide one, +- or if it is not a string, :exc:`SystemError` is raised and ``NULL`` is returned. ++ Return *module*'s :attr:`~module.__name__` value. If the module does not ++ provide one, or if it is not a string, :exc:`SystemError` is raised and ++ ``NULL`` is returned. + + .. versionadded:: 3.3 + +@@ -108,8 +110,8 @@ Module Objects + single: SystemError (built-in exception) + + Return the name of the file from which *module* was loaded using *module*'s +- :attr:`__file__` attribute. If this is not defined, or if it is not a +- unicode string, raise :exc:`SystemError` and return ``NULL``; otherwise return ++ :attr:`~module.__file__` attribute. If this is not defined, or if it is not a ++ string, raise :exc:`SystemError` and return ``NULL``; otherwise return + a reference to a Unicode object. + + .. versionadded:: 3.2 +diff --git a/Doc/c-api/monitoring.rst b/Doc/c-api/monitoring.rst +index 285ddb2889a..51d866cfd47 100644 +--- a/Doc/c-api/monitoring.rst ++++ b/Doc/c-api/monitoring.rst +@@ -147,7 +147,7 @@ would typically correspond to a python function. + + The ``version`` argument is a pointer to a value which should be allocated + by the user together with ``state_array`` and initialized to 0, +- and then set only by :c:func:`!PyMonitoring_EnterScope` itelf. It allows this ++ and then set only by :c:func:`!PyMonitoring_EnterScope` itself. It allows this + function to determine whether event states have changed since the previous call, + and to return quickly if they have not. + +diff --git a/Doc/c-api/tuple.rst b/Doc/c-api/tuple.rst +index a2c3a75daa6..2944b8d342c 100644 +--- a/Doc/c-api/tuple.rst ++++ b/Doc/c-api/tuple.rst +@@ -161,7 +161,8 @@ type. + + .. c:member:: const char *name + +- Name of the struct sequence type. ++ Fully qualified name of the type; null-terminated UTF-8 encoded. ++ The name must contain the module name. + + .. c:member:: const char *doc + +diff --git a/Doc/c-api/typeobj.rst b/Doc/c-api/typeobj.rst +index be3effb0efe..e5a718912e3 100644 +--- a/Doc/c-api/typeobj.rst ++++ b/Doc/c-api/typeobj.rst +@@ -682,6 +682,19 @@ and :c:data:`PyType_Type` effectively act as defaults.) + Py_DECREF(tp); + } + ++ .. warning:: ++ ++ In a garbage collected Python, :c:member:`!tp_dealloc` may be called from ++ any Python thread, not just the thread which created the object (if the ++ object becomes part of a refcount cycle, that cycle might be collected by ++ a garbage collection on any thread). This is not a problem for Python ++ API calls, since the thread on which :c:member:`!tp_dealloc` is called ++ will own the Global Interpreter Lock (GIL). However, if the object being ++ destroyed in turn destroys objects from some other C or C++ library, care ++ should be taken to ensure that destroying those objects on the thread ++ which called :c:member:`!tp_dealloc` will not violate any assumptions of ++ the library. ++ + + **Inheritance:** + +@@ -2109,17 +2122,6 @@ and :c:data:`PyType_Type` effectively act as defaults.) + PyErr_Restore(error_type, error_value, error_traceback); + } + +- Also, note that, in a garbage collected Python, +- :c:member:`~PyTypeObject.tp_dealloc` may be called from +- any Python thread, not just the thread which created the object (if the object +- becomes part of a refcount cycle, that cycle might be collected by a garbage +- collection on any thread). This is not a problem for Python API calls, since +- the thread on which tp_dealloc is called will own the Global Interpreter Lock +- (GIL). However, if the object being destroyed in turn destroys objects from some +- other C or C++ library, care should be taken to ensure that destroying those +- objects on the thread which called tp_dealloc will not violate any assumptions +- of the library. +- + **Inheritance:** + + This field is inherited by subtypes. +@@ -2199,7 +2201,7 @@ This is done by filling a :c:type:`PyType_Spec` structure and calling + .. _number-structs: + + Number Object Structures +-======================== ++------------------------ + + .. sectionauthor:: Amaury Forgeot d'Arc + +@@ -2313,7 +2315,7 @@ Number Object Structures + .. _mapping-structs: + + Mapping Object Structures +-========================= ++------------------------- + + .. sectionauthor:: Amaury Forgeot d'Arc + +@@ -2350,7 +2352,7 @@ Mapping Object Structures + .. _sequence-structs: + + Sequence Object Structures +-========================== ++-------------------------- + + .. sectionauthor:: Amaury Forgeot d'Arc + +@@ -2430,7 +2432,7 @@ Sequence Object Structures + .. _buffer-structs: + + Buffer Object Structures +-======================== ++------------------------ + + .. sectionauthor:: Greg J. Stein + .. sectionauthor:: Benjamin Peterson +@@ -2525,7 +2527,7 @@ Buffer Object Structures + + + Async Object Structures +-======================= ++----------------------- + + .. sectionauthor:: Yury Selivanov + +@@ -2593,7 +2595,7 @@ Async Object Structures + .. _slot-typedefs: + + Slot Type typedefs +-================== ++------------------ + + .. c:type:: PyObject *(*allocfunc)(PyTypeObject *cls, Py_ssize_t nitems) + +@@ -2702,7 +2704,7 @@ Slot Type typedefs + .. _typedef-examples: + + Examples +-======== ++-------- + + The following are simple examples of Python type definitions. They + include common usage you may encounter. Some demonstrate tricky corner +diff --git a/Doc/c-api/veryhigh.rst b/Doc/c-api/veryhigh.rst +index 67167444d0a..9f02bdb5896 100644 +--- a/Doc/c-api/veryhigh.rst ++++ b/Doc/c-api/veryhigh.rst +@@ -25,30 +25,6 @@ are only passed to these functions if it is certain that they were created by + the same library that the Python runtime is using. + + +-.. c:function:: int Py_Main(int argc, wchar_t **argv) +- +- The main program for the standard interpreter. This is made available for +- programs which embed Python. The *argc* and *argv* parameters should be +- prepared exactly as those which are passed to a C program's :c:func:`main` +- function (converted to wchar_t according to the user's locale). It is +- important to note that the argument list may be modified (but the contents of +- the strings pointed to by the argument list are not). The return value will +- be ``0`` if the interpreter exits normally (i.e., without an exception), +- ``1`` if the interpreter exits due to an exception, or ``2`` if the parameter +- list does not represent a valid Python command line. +- +- Note that if an otherwise unhandled :exc:`SystemExit` is raised, this +- function will not return ``1``, but exit the process, as long as +- :c:member:`PyConfig.inspect` is zero. +- +- +-.. c:function:: int Py_BytesMain(int argc, char **argv) +- +- Similar to :c:func:`Py_Main` but *argv* is an array of bytes strings. +- +- .. versionadded:: 3.8 +- +- + .. c:function:: int PyRun_AnyFile(FILE *fp, const char *filename) + + This is a simplified interface to :c:func:`PyRun_AnyFileExFlags` below, leaving +diff --git a/Doc/conf.py b/Doc/conf.py +index 5f22340ac43..73d7d5db26f 100644 +--- a/Doc/conf.py ++++ b/Doc/conf.py +@@ -11,16 +11,22 @@ + import sys + import time + ++import sphinx ++ ++# Make our custom extensions available to Sphinx + sys.path.append(os.path.abspath('tools/extensions')) + sys.path.append(os.path.abspath('includes')) + ++# Python specific content from Doc/Tools/extensions/pyspecific.py + from pyspecific import SOURCE_URI + + # General configuration + # --------------------- + ++# Our custom Sphinx extensions are found in Doc/Tools/extensions/ + extensions = [ + 'audit_events', ++ 'availability', + 'c_annotations', + 'glossary_search', + 'lexers', +@@ -51,7 +57,7 @@ + except ImportError: + _tkinter = None + # Treat warnings as errors, done here to prevent warnings in Sphinx code from +-# causing spurious test failures. ++# causing spurious CPython test failures. + import warnings + warnings.simplefilter('error') + del warnings +@@ -61,7 +67,10 @@ + + # General substitutions. + project = 'Python' +-copyright = f"2001-{time.strftime('%Y')}, Python Software Foundation" ++if sphinx.version_info[:2] >= (8, 1): ++ copyright = "2001-%Y, Python Software Foundation" ++else: ++ copyright = f"2001-{time.strftime('%Y')}, Python Software Foundation" + + # We look for the Include/patchlevel.h file in the current Python source tree + # and replace the values accordingly. +@@ -74,24 +83,26 @@ + .. |usr_local_bin_python_x_dot_y_literal| replace:: ``/usr/local/bin/python{version}`` + """ + +-# There are two options for replacing |today|: either, you set today to some +-# non-false value, then it is used: ++# There are two options for replacing |today|. Either, you set today to some ++# non-false value and use it. + today = '' +-# Else, today_fmt is used as the format for a strftime call. ++# Or else, today_fmt is used as the format for a strftime call. + today_fmt = '%B %d, %Y' + + # By default, highlight as Python 3. + highlight_language = 'python3' + + # Minimum version of sphinx required +-needs_sphinx = '6.2.1' ++needs_sphinx = '7.2.6' + + # Create table of contents entries for domain objects (e.g. functions, classes, + # attributes, etc.). Default is True. +-toc_object_entries = False ++toc_object_entries = True ++# Hide parents to tidy up long entries in sidebar ++toc_object_entries_show_parents = 'hide' + + # Ignore any .rst files in the includes/ directory; +-# they're embedded in pages but not rendered individually. ++# they're embedded in pages but not rendered as individual pages. + # Ignore any .rst files in the venv/ directory. + exclude_patterns = ['includes/*.rst', 'venv/*', 'README.rst'] + venvdir = os.getenv('VENVDIR') +@@ -188,6 +199,7 @@ + ('envvar', 'LC_TIME'), + ('envvar', 'LINES'), + ('envvar', 'LOGNAME'), ++ ('envvar', 'MANPAGER'), + ('envvar', 'PAGER'), + ('envvar', 'PATH'), + ('envvar', 'PATHEXT'), +@@ -322,8 +334,9 @@ + # Options for HTML output + # ----------------------- + +-# Use our custom theme. ++# Use our custom theme: https://github.com/python/python-docs-theme + html_theme = 'python_docs_theme' ++# Location of overrides for theme templates and static files + html_theme_path = ['tools'] + html_theme_options = { + 'collapsiblesidebar': True, +@@ -360,12 +373,16 @@ + } + + # This 'Last updated on:' timestamp is inserted at the bottom of every page. +-html_time = int(os.environ.get('SOURCE_DATE_EPOCH', time.time())) +-html_last_updated_fmt = time.strftime( +- '%b %d, %Y (%H:%M UTC)', time.gmtime(html_time) +-) ++html_last_updated_fmt = '%b %d, %Y (%H:%M UTC)' ++if sphinx.version_info[:2] >= (8, 1): ++ html_last_updated_use_utc = True ++else: ++ html_time = int(os.environ.get('SOURCE_DATE_EPOCH', time.time())) ++ html_last_updated_fmt = time.strftime( ++ html_last_updated_fmt, time.gmtime(html_time) ++ ) + +-# Path to find HTML templates. ++# Path to find HTML templates to override theme + templates_path = ['tools/templates'] + + # Custom sidebar templates, filenames relative to this file. +@@ -595,15 +612,23 @@ + # mapping unique short aliases to a base URL and a prefix. + # https://www.sphinx-doc.org/en/master/usage/extensions/extlinks.html + extlinks = { +- "cve": ("https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-%s", "CVE-%s"), +- "cwe": ("https://cwe.mitre.org/data/definitions/%s.html", "CWE-%s"), + "pypi": ("https://pypi.org/project/%s/", "%s"), + "source": (SOURCE_URI, "%s"), + } + extlinks_detect_hardcoded_links = True + +-# Options for c_annotations +-# ------------------------- ++if sphinx.version_info[:2] < (8, 1): ++ # Sphinx 8.1 has in-built CVE and CWE roles. ++ extlinks |= { ++ "cve": ( ++ "https://www.cve.org/CVERecord?id=CVE-%s", ++ "CVE-%s", ++ ), ++ "cwe": ("https://cwe.mitre.org/data/definitions/%s.html", "CWE-%s"), ++ } ++ ++# Options for c_annotations extension ++# ----------------------------------- + + # Relative filename of the data files + refcount_file = 'data/refcounts.dat' +diff --git a/Doc/data/python3.13.abi b/Doc/data/python3.13.abi +index 55112e1e43c..11f12038503 100644 +--- a/Doc/data/python3.13.abi ++++ b/Doc/data/python3.13.abi +@@ -1661,7 +1661,7 @@ + + + +- ++ + + + +@@ -1679,7 +1679,7 @@ + + + +- ++ + + + +@@ -1694,7 +1694,7 @@ + + + +- ++ + + + +@@ -1728,10 +1728,10 @@ + + + +- ++ + + +- ++ + + + +@@ -1819,11 +1819,11 @@ + + + +- ++ + + + +- ++ + + + +@@ -1835,14 +1835,14 @@ + + + +- ++ + + + + + + +- ++ + + + +@@ -1861,7 +1861,7 @@ + + + +- ++ + + + +@@ -1889,7 +1889,7 @@ + + + +- ++ + + + +@@ -1931,7 +1931,7 @@ + + + +- ++ + + + +@@ -1948,7 +1948,11 @@ + + + +- ++ ++ ++ ++ ++ + + + +@@ -1957,11 +1961,11 @@ + + + +- ++ + + + +- ++ + + + +@@ -1994,23 +1998,23 @@ + + + +- ++ + + + + + +- ++ + +- +- +- ++ ++ ++ + + + +- +- +- ++ ++ ++ + + + +@@ -2031,38 +2035,38 @@ + + + +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ + + +- ++ + + + + +- ++ + + + +@@ -2070,12 +2074,12 @@ + + + +- ++ + + + +- +- ++ ++ + + + +@@ -2084,8 +2088,8 @@ + + + +- +- ++ ++ + + + +@@ -2093,15 +2097,15 @@ + + + +- +- ++ ++ + + +- ++ + +- +- +- ++ ++ ++ + + + +@@ -2118,37 +2122,37 @@ + + + +- ++ + + + +- ++ + + + + +- +- ++ ++ + + + +- ++ + + + + + +- ++ + + +- ++ + + + + + +- +- ++ ++ + + + +@@ -2157,50 +2161,50 @@ + + + +- +- +- ++ ++ ++ + +- +- ++ ++ + +- +- ++ ++ + +- +- ++ ++ + +- +- +- +- ++ ++ ++ ++ + +- +- ++ ++ + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + + + + +- ++ + + +- +- ++ ++ + + + +@@ -2208,24 +2212,24 @@ + + + +- ++ + + +- ++ + + +- +- +- +- ++ ++ ++ ++ + +- ++ + + +- +- ++ ++ + +- ++ + + + +@@ -2234,13 +2238,13 @@ + + + +- ++ + + +- ++ + + +- ++ + + + +@@ -2254,13 +2258,13 @@ + + + +- +- ++ ++ + + + + +- ++ + + + +@@ -2268,22 +2272,22 @@ + + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + + +@@ -2295,166 +2299,166 @@ + + + +- ++ + + +- ++ + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- +- +- +- +- +- +- +- ++ ++ ++ ++ ++ ++ ++ ++ + +- ++ + + + + + +- ++ + +- ++ + + +- ++ + + +- ++ + + + + +- +- +- ++ ++ ++ + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- +- +- +- +- +- ++ ++ ++ ++ ++ ++ + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- +- ++ ++ + + + + +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ + +- +- ++ ++ + + +- ++ + + + +@@ -2474,10 +2478,10 @@ + + + +- ++ + + +- ++ + + + +@@ -2487,140 +2491,140 @@ + + + +- ++ + + + +- ++ + + + +- ++ + + + +- ++ + + + + +- ++ + + + +- +- ++ ++ + + + + + +- +- ++ ++ + + +- + + ++ + + + +- + ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- +- ++ ++ + + +- +- +- ++ ++ ++ + + +- +- +- ++ ++ ++ + + + + +- ++ + + + +- ++ + + +- ++ + + + +- ++ + + + + +- ++ + + + + +- +- +- ++ ++ ++ + + + + +- ++ + + + +- +- ++ ++ + +- +- ++ ++ + + + +- ++ + +- +- ++ ++ + + + +- +- ++ ++ + + + +- +- ++ ++ + + + +- ++ + +- ++ + + + +- ++ + + + +@@ -2632,117 +2636,117 @@ + + + +- +- ++ ++ + + + +- ++ + +- ++ + + + +- ++ + +- ++ + + + +- ++ + + + + +- ++ + + + + ++ ++ ++ ++ ++ ++ ++ ++ ++ + +- ++ + + + + + + +- +- +- +- +- +- +- +- +- + +- ++ + + + +- ++ + + + +- +- ++ ++ + + + +- +- ++ ++ + + + +- +- ++ ++ + + + +- +- ++ ++ + + + +- ++ + + + + +- +- ++ ++ + + + +- ++ + + + +- ++ + + + +- ++ + +- ++ + +- ++ + + + +- ++ + + + + +- ++ + + + + + +- ++ + + + +@@ -2775,10 +2779,10 @@ + + + +- ++ + + +- ++ + + + +@@ -2793,6 +2797,10 @@ + + + ++ ++ ++ ++ + + + +@@ -2800,14 +2808,14 @@ + + + +- ++ + + + + +- +- + ++ ++ + + + +@@ -2823,37 +2831,37 @@ + + + +- ++ + + + +- ++ + + + + + +- +- ++ ++ + + + + +- +- ++ ++ + + + + +- +- ++ ++ + + + + + +- +- ++ ++ + + + +@@ -2878,19 +2886,19 @@ + + + +- +- ++ ++ + + + + +- +- ++ ++ + + + + +- ++ + + + +@@ -2900,104 +2908,104 @@ + + + +- ++ + + + + +- ++ + + +- ++ + + +- +- ++ ++ + + +- +- ++ ++ + + + + + + +- ++ + + +- +- ++ ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + + +- ++ + + + +- ++ + + + +- +- ++ ++ + + + +- ++ + + + +- ++ + + + +- +- ++ ++ + + + +- ++ + + + +- +- +- ++ ++ ++ + + + +- +- +- ++ ++ ++ + + + +- +- +- ++ ++ ++ + + + +- +- +- ++ ++ ++ + + + +- ++ + + + +@@ -3031,10 +3039,10 @@ + + + +- +- ++ ++ + +- ++ + + + +@@ -3052,11 +3060,11 @@ + + + +- ++ + + + +- ++ + + + +@@ -3075,12 +3083,12 @@ + + + +- ++ + +- ++ + +- +- ++ ++ + + + +@@ -3092,29 +3100,29 @@ + + + +- ++ + + + + +- ++ + + +- ++ + + + + +- ++ + +- ++ + +- +- ++ ++ + + + +- ++ + + + +@@ -3127,183 +3135,183 @@ + + + +- ++ + + + + + +- ++ + + + + +- ++ + + + +- +- ++ ++ + + + +- +- ++ ++ + + + + + +- ++ + + + + +- ++ + + + + + +- ++ + + + + +- +- ++ ++ + + + +- ++ + + + + + +- ++ + + + + +- +- ++ ++ + + + + + +- +- ++ ++ + + + + +- ++ + + + + + +- ++ + + + + + +- ++ + + + + + +- ++ + + + +- +- ++ ++ + + +- +- ++ ++ + + +- +- +- ++ ++ ++ + + +- ++ + + + + + + +- +- ++ ++ + + + + +- ++ + + + +- +- ++ ++ + + + +- ++ + +- ++ + + + +- ++ + +- ++ + + +- ++ + + + +- +- ++ ++ + + +- +- ++ ++ + +- ++ + + +- +- +- ++ ++ ++ + + + + +- ++ + +- +- ++ ++ + + +- +- ++ ++ + +- +- ++ ++ + + + + +- ++ + + + +@@ -3311,7 +3319,7 @@ + + + +- ++ + + + +@@ -3319,7 +3327,7 @@ + + + +- ++ + + + +@@ -3327,41 +3335,41 @@ + + + +- ++ + +- ++ + + + + +- ++ + +- ++ + + + + +- ++ + +- ++ + + + + + +- ++ + + + + + +- ++ + + + + + +- ++ + + + +@@ -3378,14 +3386,14 @@ + + + +- +- +- ++ ++ ++ + + + +- +- ++ ++ + + + +@@ -3393,10 +3401,10 @@ + + + +- ++ + + +- ++ + + + +@@ -3408,10 +3416,10 @@ + + + +- +- +- +- ++ ++ ++ ++ + + + +@@ -3419,58 +3427,58 @@ + + + +- ++ + + +- +- +- ++ ++ ++ + +- ++ + + + +- +- +- ++ ++ ++ + +- ++ + + + +- +- +- ++ ++ ++ + + + + +- ++ + +- ++ + + +- ++ + + +- +- +- +- +- +- +- +- ++ ++ ++ ++ ++ ++ ++ ++ + + + + +- ++ + + + + +- ++ + + + +@@ -3494,28 +3502,28 @@ + + + +- ++ + + + + +- ++ + + + +- +- ++ ++ + + + +- +- ++ ++ + + + +- +- ++ + ++ + + + +@@ -3529,153 +3537,153 @@ + + + +- +- ++ ++ + + + + + +- ++ + + + + +- +- ++ ++ + + + +- +- +- ++ ++ ++ + + + +- ++ + + + + +- +- ++ ++ + + +- +- ++ ++ + +- ++ + + +- ++ + + +- +- +- +- +- +- +- +- ++ ++ ++ ++ ++ ++ ++ ++ + +- +- ++ ++ + + + +- +- ++ ++ + + + +- +- ++ ++ + + + ++ ++ + +- +- + + + +- +- +- ++ ++ ++ + + +- +- ++ ++ + + +- +- ++ ++ + + + +- ++ + + +- +- ++ ++ + + +- +- ++ ++ + + + + + +- +- ++ ++ + + + +- ++ + +- +- ++ ++ + + + + + + +- ++ + + + +- +- +- ++ ++ ++ + +- +- ++ ++ + +- ++ + + + +- ++ + + +- +- +- ++ ++ ++ + + + + + +- ++ + + + + +- +- ++ ++ + + + +@@ -3684,14 +3692,14 @@ + + + +- +- ++ ++ + +- ++ + + + +- ++ + + + +@@ -3726,7 +3734,7 @@ + + + +- ++ + + + +@@ -3738,43 +3746,43 @@ + + + +- ++ + + + +- ++ + + + + +- ++ + + + + + + +- ++ + + + +- ++ + + + + + + +- + ++ + + + +- ++ + + + +- ++ + + + +@@ -3804,8 +3812,8 @@ + + + +- +- ++ ++ + + + +@@ -3816,8 +3824,8 @@ + + + +- +- ++ ++ + + + +@@ -3858,13 +3866,13 @@ + + + +- ++ + + + + + +- ++ + + + +@@ -3878,10 +3886,10 @@ + + + +- ++ + + +- ++ + + + +@@ -3958,46 +3966,46 @@ + + + +- +- +- ++ ++ ++ + + + + +- ++ + +- ++ + +- ++ + + + +- ++ + + + +- ++ + + + +- ++ + + + +- ++ + + + + +- ++ + + + + +- +- +- ++ ++ ++ + + + +@@ -4005,39 +4013,39 @@ + + + ++ + +- +- ++ + + +- ++ + + + + + +- ++ + + + +- ++ + + +- ++ + + + +- ++ + + +- ++ + + + + + + +- ++ + + + +@@ -4046,22 +4054,22 @@ + + + +- ++ + + + + +- ++ + + + +- +- +- +- +- +- +- ++ ++ ++ ++ ++ ++ ++ + + + +@@ -4069,7 +4077,7 @@ + + + +- ++ + + + +@@ -4080,7 +4088,7 @@ + + + +- ++ + + + +@@ -4094,13 +4102,13 @@ + + + +- ++ + + + + + +- ++ + + + +@@ -4118,7 +4126,7 @@ + + + +- ++ + + + +@@ -4131,28 +4139,28 @@ + + + +- ++ + + + + +- +- +- ++ ++ ++ + + + +- +- +- ++ ++ ++ + + + +- ++ + + + +- ++ + + + +@@ -4177,22 +4185,22 @@ + + + +- ++ + + + + +- ++ + + + +- ++ + + + + + +- ++ + + + +@@ -4224,7 +4232,7 @@ + + + +- ++ + + + +@@ -4240,7 +4248,7 @@ + + + +- ++ + + + +@@ -4299,7 +4307,7 @@ + + + +- ++ + + + +@@ -4328,47 +4336,47 @@ + + + +- ++ + + + + + +- ++ + + + + + +- ++ + + + + + +- ++ + + + + +- +- ++ ++ + + + +- +- +- ++ ++ ++ + + + + + + +- +- ++ ++ + +- ++ + + + +@@ -4381,30 +4389,30 @@ + + + +- ++ + + + +- ++ + +- ++ + + + + + + +- ++ + + + +- +- ++ ++ + + + +- +- ++ ++ + + + +@@ -4719,7 +4727,7 @@ + + + +- ++ + + + +@@ -4793,18 +4801,18 @@ + + + +- +- ++ ++ + +- +- +- ++ ++ ++ + + + +- +- +- ++ ++ ++ + + + +@@ -4834,22 +4842,22 @@ + + + +- ++ + +- ++ + + + +- +- +- ++ ++ ++ + +- +- +- +- +- +- ++ ++ ++ ++ ++ ++ + + + +@@ -4988,8 +4996,8 @@ + + + +- +- ++ ++ + + + +@@ -5023,29 +5031,29 @@ + + + +- ++ + + + +- ++ + + + +- +- ++ ++ + + + + + + +- ++ + + + +- ++ + +- ++ + + + +@@ -5063,8 +5071,8 @@ + + + +- +- ++ ++ + + + +@@ -5091,7 +5099,7 @@ + + + +- ++ + + + +@@ -5103,14 +5111,14 @@ + + + +- ++ + + + +- +- ++ ++ + +- ++ + + + +@@ -5152,16 +5160,16 @@ + + + +- +- ++ ++ + +- ++ + + +- ++ + + +- ++ + + + +@@ -5191,69 +5199,69 @@ + + + +- +- +- ++ ++ ++ + +- +- ++ ++ + +- +- ++ ++ + +- +- ++ ++ + +- +- ++ ++ + +- +- ++ ++ + +- +- ++ ++ + +- +- ++ ++ + +- +- ++ ++ + +- +- ++ ++ + +- +- ++ ++ + +- +- ++ ++ + +- +- +- +- +- +- +- +- +- +- +- +- +- +- ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ + +- ++ + + +- ++ + + +- +- +- ++ ++ ++ + +- ++ + + + +@@ -5273,13 +5281,13 @@ + + + +- ++ + + +- +- +- +- ++ ++ ++ ++ + + + +@@ -5290,10 +5298,10 @@ + + + +- ++ + + +- ++ + + + +@@ -5301,9 +5309,9 @@ + + + +- ++ + +- ++ + + + +@@ -5318,27 +5326,27 @@ + + + +- ++ + + + + +- ++ + + +- ++ + +- ++ + + + + + +- +- ++ ++ + + +- ++ + + + +@@ -5348,7 +5356,7 @@ + + + +- ++ + + + +@@ -5399,55 +5407,55 @@ + + + +- ++ + + + + +- ++ + + + + +- ++ + + + +- ++ + + + +- +- ++ ++ + +- ++ + + +- +- ++ ++ + +- ++ + + +- ++ + +- ++ + + +- +- ++ ++ + + + +- +- +- ++ ++ ++ + +- ++ + + +- +- ++ ++ + + + +@@ -5455,61 +5463,61 @@ + + + +- ++ + + +- ++ + +- ++ + + +- +- ++ ++ + + +- ++ + + + +- ++ + + + + + +- +- ++ ++ + + + +- +- ++ ++ + +- ++ + + + + + +- ++ + +- ++ + + + + + +- ++ + + +- ++ + +- ++ + + + + +- ++ + + + +@@ -5519,18 +5527,18 @@ + + + +- ++ + + + +- ++ + + + + + + +- ++ + + + +@@ -5549,14 +5557,14 @@ + + + +- ++ + + + + + + +- ++ + + + +@@ -5622,7 +5630,7 @@ + + + +- ++ + + + +@@ -5641,7 +5649,7 @@ + + + +- ++ + + + +@@ -5650,21 +5658,21 @@ + + + +- +- ++ ++ + + + + + +- ++ + + +- ++ + +- ++ + +- ++ + + + +@@ -5675,7 +5683,7 @@ + + + +- ++ + + + +@@ -5683,15 +5691,15 @@ + + + +- ++ + + + +- ++ + + + +- ++ + + + +@@ -5701,32 +5709,32 @@ + + + +- ++ + + + + +- ++ + + + + +- +- ++ ++ + + + + + +- ++ + +- ++ + + + + +- +- ++ ++ + + + +@@ -5747,9 +5755,9 @@ + + + +- +- +- ++ ++ ++ + + + +@@ -5757,7 +5765,7 @@ + + + +- ++ + + + +@@ -5775,7 +5783,7 @@ + + + +- ++ + + + +@@ -5803,19 +5811,19 @@ + + + +- +- ++ ++ + + + + +- ++ + + +- ++ + + +- ++ + + + +@@ -5826,34 +5834,34 @@ + + + +- ++ + + +- +- +- +- +- +- +- ++ ++ ++ ++ ++ ++ ++ + + +- ++ + + +- ++ + + + + +- ++ + + + + + +- +- ++ ++ + + + +@@ -5861,18 +5869,18 @@ + + + +- +- ++ ++ + + + +- ++ + + + + + +- ++ + + + +@@ -5888,12 +5896,12 @@ + + + +- +- +- ++ ++ ++ + + +- ++ + + + +@@ -5901,7 +5909,7 @@ + + + +- ++ + + + +@@ -5923,7 +5931,7 @@ + + + +- ++ + + + +@@ -5943,59 +5951,59 @@ + + + +- ++ + + + + + +- ++ + + +- ++ + + + + + +- ++ + + + +- ++ + +- +- +- +- ++ ++ ++ ++ + + + + + +- ++ + + + + + +- ++ + + + +- ++ + + + +- ++ + + + +- ++ + + + +- ++ + + + +@@ -6003,16 +6011,16 @@ + + + +- +- +- ++ ++ ++ + + +- +- ++ ++ + + +- ++ + + + +@@ -6024,8 +6032,8 @@ + + + +- +- ++ ++ + + + +@@ -6033,127 +6041,127 @@ + + + +- +- +- ++ ++ ++ + + +- +- ++ ++ + + +- +- ++ ++ + + +- +- ++ ++ + + +- +- ++ ++ + + +- +- +- ++ ++ ++ + + +- +- +- ++ ++ ++ + + +- +- ++ ++ + + +- +- +- ++ ++ ++ + + +- +- +- ++ ++ ++ + + +- +- ++ ++ + + +- +- +- ++ ++ ++ + + +- +- +- ++ ++ ++ + + +- +- +- ++ ++ ++ + + +- +- ++ ++ + + +- +- ++ ++ + + + + +- ++ + + + +- ++ + +- ++ + + +- ++ + + + +- +- ++ ++ + + + + + +- ++ + + + + +- ++ + + + +- +- +- +- +- +- +- +- +- +- ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ + + +- ++ + + + + +- ++ + + + +@@ -6167,9 +6175,9 @@ + + + +- ++ + +- ++ + + + +@@ -6197,7 +6205,7 @@ + + + +- ++ + + + +@@ -6214,7 +6222,7 @@ + + + +- ++ + + + +@@ -6224,28 +6232,28 @@ + + + +- ++ + + + + +- ++ + + + + +- ++ + + + + +- ++ + + + + +- +- ++ ++ + + + +@@ -6262,7 +6270,7 @@ + + + +- ++ + + + +@@ -6276,16 +6284,16 @@ + + + +- +- +- +- +- +- +- +- +- +- ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ + + + +@@ -6293,14 +6301,10 @@ + + + +- +- +- +- +- ++ + + +- ++ + + + +@@ -6313,7 +6317,7 @@ + + + +- ++ + + + +@@ -6322,14 +6326,14 @@ + + + +- ++ + + + +- ++ + +- +- ++ ++ + + + +@@ -6338,63 +6342,52 @@ + + + +- +- ++ ++ + + + + +- ++ + + + + + +- ++ + + +- ++ + + + + + + +- +- +- +- +- +- ++ + + + + + +- ++ + + + + + +- +- ++ ++ + + + + + + +- +- +- +- +- +- + + + +- ++ + + + +@@ -6425,7 +6418,7 @@ + + + +- ++ + + + +@@ -6435,7 +6428,7 @@ + + + +- ++ + + + +@@ -6451,7 +6444,7 @@ + + + +- ++ + + + +@@ -6461,8 +6454,8 @@ + + + +- +- ++ ++ + + + +@@ -6485,31 +6478,31 @@ + + + +- ++ + + + + + + +- ++ + +- ++ + + + +- +- +- ++ ++ ++ + + + + + + +- +- +- ++ ++ ++ + + + +@@ -6537,22 +6530,22 @@ + + + +- ++ + + + +- ++ + + + +- ++ + +- ++ + + + + +- ++ + + + +@@ -6571,7 +6564,7 @@ + + + +- ++ + + + +@@ -6586,7 +6579,7 @@ + + + +- ++ + + + +@@ -6684,7 +6677,7 @@ + + + +- ++ + + + +@@ -6838,21 +6831,21 @@ + + + +- +- +- +- +- +- +- ++ ++ ++ ++ ++ ++ ++ + + + +- +- ++ ++ + + +- ++ + + + +@@ -6865,15 +6858,15 @@ + + + +- ++ + + + +- ++ + + + +- ++ + + + +@@ -6909,13 +6902,13 @@ + + + +- ++ + + + + + +- ++ + + + +@@ -6924,8 +6917,8 @@ + + + +- +- ++ ++ + + + +@@ -6937,8 +6930,8 @@ + + + +- +- ++ ++ + + + +@@ -6946,8 +6939,8 @@ + + + +- +- ++ ++ + + + +@@ -6955,17 +6948,17 @@ + + + +- ++ + + + + + +- +- +- +- +- ++ ++ ++ ++ ++ + + + +@@ -6974,19 +6967,19 @@ + + + +- ++ + + +- +- ++ ++ + + +- ++ + + +- +- +- ++ ++ ++ + + + +@@ -6994,7 +6987,7 @@ + + + +- ++ + + + +@@ -7003,8 +6996,8 @@ + + + +- +- ++ ++ + + + +@@ -7012,7 +7005,7 @@ + + + +- ++ + + + +@@ -7026,14 +7019,14 @@ + + + +- ++ + +- ++ + + + + +- ++ + + + +@@ -7043,7 +7036,7 @@ + + + +- ++ + + + +@@ -7061,44 +7054,44 @@ + + + +- +- ++ ++ + +- ++ + + +- +- +- ++ ++ ++ + + +- ++ + +- ++ + + +- +- +- ++ ++ ++ + + +- +- ++ ++ + + +- +- +- ++ ++ ++ + + +- +- ++ ++ + + +- ++ + + +- ++ + + + +@@ -7108,19 +7101,19 @@ + + + +- ++ + + + + + +- ++ + + + + + +- ++ + + + +@@ -7128,21 +7121,21 @@ + + + +- ++ + + + + +- ++ + + + + +- ++ + + +- +- ++ ++ + + + +@@ -7168,20 +7161,31 @@ + + + +- +- ++ ++ + + + + + +- +- ++ ++ ++ ++ ++ ++ ++ ++ + + + + + ++ ++ ++ ++ ++ + + + +@@ -7192,35 +7196,39 @@ + + + +- + ++ + + + +- ++ + + + +- ++ + + + +- +- ++ ++ + + + +- ++ + + + +- +- ++ ++ + + + + + ++ ++ ++ ++ + + + +@@ -7234,92 +7242,92 @@ + + + +- +- ++ ++ + + +- +- +- +- +- +- ++ ++ ++ ++ ++ ++ + +- +- +- ++ ++ ++ + + +- +- +- ++ ++ ++ + + +- +- ++ ++ + + +- +- ++ ++ + + +- +- +- ++ ++ ++ + + +- +- ++ ++ + + +- +- +- ++ ++ ++ + +- +- +- ++ ++ ++ + +- +- ++ ++ + + +- +- ++ ++ + + +- +- ++ ++ + + +- +- ++ ++ + + +- +- ++ ++ + + +- ++ + +- +- +- +- ++ ++ ++ ++ + +- ++ + + + + + +- ++ + + + + + +- ++ + + + +@@ -7333,8 +7341,8 @@ + + + +- +- ++ ++ + + + +@@ -7364,8 +7372,8 @@ + + + +- +- ++ ++ + + + +@@ -7404,14 +7412,14 @@ + + + +- ++ + +- ++ + + + + +- ++ + + + +@@ -7434,14 +7442,14 @@ + + + +- ++ + + + +- +- ++ ++ + +- ++ + + + +@@ -7453,31 +7461,31 @@ + + + +- ++ + + + + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- +- ++ ++ + +- ++ + + + +@@ -7489,74 +7497,74 @@ + + + +- ++ + + + + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- +- +- +- +- ++ ++ ++ ++ ++ + +- +- ++ ++ + + + +- +- +- +- ++ ++ ++ ++ + + + + + +- ++ + + + +- ++ + + +- +- ++ ++ + + +- ++ + + + +- ++ + + + +- +- +- ++ ++ ++ + + +- +- +- ++ ++ ++ + + + +@@ -7565,23 +7573,23 @@ + + + +- ++ + + + + + + +- ++ + + + + + + +- +- +- ++ ++ ++ + + + +@@ -7589,11 +7597,11 @@ + + + +- +- ++ ++ + + +- ++ + + + +@@ -7601,17 +7609,17 @@ + + + +- ++ + + + +- ++ + + + + + +- ++ + + + +@@ -7619,63 +7627,63 @@ + + + +- ++ + + + + + +- ++ + + + + + +- ++ + + + + +- +- ++ ++ + + + + + + +- ++ + + + + + + +- +- ++ ++ + + + + + +- +- +- ++ ++ ++ + + + + + +- +- ++ ++ + + +- +- +- ++ ++ ++ + + +- ++ + + + +@@ -7699,7 +7707,7 @@ + + + +- ++ + + + +@@ -7723,62 +7731,62 @@ + + + +- ++ + + + + +- +- +- ++ ++ ++ + +- +- +- +- +- +- ++ ++ ++ ++ ++ ++ + +- ++ + +- ++ + + +- ++ + +- ++ + + + + + + +- ++ + + + + + + +- ++ + + + + +- +- ++ ++ + + + + + + +- ++ + + + + +- ++ + + + +@@ -7793,15 +7801,15 @@ + + + +- ++ + + + + + + +- +- ++ ++ + + + +@@ -7810,91 +7818,91 @@ + + + +- ++ + + + + + +- ++ + + + + + +- ++ + + + + + + +- ++ + + +- ++ + + + + +- ++ + + + +- ++ + + + +- ++ + + + +- +- ++ ++ + + + +- ++ + + + + +- ++ + + + + +- ++ + + + + +- ++ + + + + +- ++ + + + +- ++ + +- ++ + + +- +- ++ ++ + + + +- +- ++ ++ + + + +- +- ++ ++ + + + +@@ -7916,59 +7924,59 @@ + + + +- ++ + + + +- ++ + + + +- +- +- ++ ++ ++ + + + + +- +- +- +- ++ ++ ++ ++ + + +- +- ++ ++ + + +- +- ++ ++ + + +- +- +- +- ++ ++ ++ ++ + + + +- +- +- ++ ++ ++ + +- ++ + + + + +- ++ + + + + + + +- ++ + + + +@@ -7979,13 +7987,13 @@ + + + +- +- ++ ++ + +- ++ + + +- ++ + + + +@@ -7994,18 +8002,18 @@ + + + +- +- ++ ++ + + + + +- ++ + + +- ++ + +- ++ + + + +@@ -8017,27 +8025,27 @@ + + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- +- +- +- +- +- ++ ++ ++ ++ ++ ++ + + + +@@ -8046,12 +8054,12 @@ + + + +- ++ + +- ++ + + +- ++ + + + +@@ -8062,7 +8070,7 @@ + + + +- ++ + + + +@@ -8076,8 +8084,8 @@ + + + +- +- ++ ++ + + + +@@ -8095,7 +8103,7 @@ + + + +- ++ + + + +@@ -8106,11 +8114,11 @@ + + + +- +- ++ ++ + + +- ++ + + + +@@ -8122,24 +8130,24 @@ + + + +- ++ + + + + +- ++ + + + + + + +- ++ + + + + +- ++ + + + +@@ -8161,23 +8169,23 @@ + + + +- ++ + + + +- ++ + +- ++ + + + +- ++ + + + + + +- ++ + + + +@@ -8188,25 +8196,25 @@ + + + +- +- +- ++ ++ ++ + +- +- ++ ++ + +- ++ + +- ++ + + + + + +- ++ + + +- ++ + + + +@@ -8215,92 +8223,92 @@ + + + +- +- +- ++ ++ ++ + + + +- +- +- +- +- ++ ++ ++ ++ ++ + + + + +- ++ + + + + + +- ++ + + + + + + +- ++ + + +- ++ + + + +- ++ + + + + +- ++ + + + + +- ++ + + + + +- ++ + + + + +- ++ + + + + +- ++ + + + + +- ++ + + + + +- ++ + + + + +- ++ + + + +- ++ + + + + + +- ++ + + + +@@ -8322,25 +8330,25 @@ + + + +- +- ++ ++ + +- +- +- ++ ++ ++ + +- ++ + + + +- ++ + +- ++ + + + + +- ++ + + + +@@ -8355,7 +8363,7 @@ + + + +- ++ + + + +@@ -8368,16 +8376,16 @@ + + + +- +- ++ ++ + + + + +- ++ + + +- ++ + + + +@@ -8387,25 +8395,25 @@ + + + +- +- ++ ++ + + + + +- ++ + + +- ++ + + + +- ++ + + + + +- ++ + + + +@@ -8430,10 +8438,10 @@ + + + +- ++ + + +- ++ + + + +@@ -8441,7 +8449,7 @@ + + + +- ++ + + + +@@ -8474,7 +8482,7 @@ + + + +- ++ + + + +@@ -8489,7 +8497,7 @@ + + + +- ++ + + + +@@ -8502,273 +8510,273 @@ + + + +- +- ++ ++ + + +- +- +- ++ ++ ++ + +- +- ++ ++ + + +- +- ++ ++ + + +- +- +- ++ ++ ++ + + +- +- ++ ++ + + +- +- ++ ++ + + +- +- ++ ++ + + +- +- +- ++ ++ ++ + + +- +- +- ++ ++ ++ + + +- +- +- ++ ++ ++ + +- +- ++ ++ + + +- +- ++ ++ + + +- ++ + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + +- ++ + + + + + +- +- ++ ++ + + +- +- +- ++ ++ ++ + +- +- ++ ++ + +- +- ++ ++ + +- +- ++ ++ + +- +- ++ ++ + +- +- ++ ++ + +- +- ++ ++ + + + + +- +- +- +- +- +- ++ ++ ++ ++ ++ ++ + +- ++ + + +- +- ++ ++ + +- ++ + + +- ++ + + +- ++ + +- ++ + + +- ++ + + +- +- ++ ++ + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- +- +- +- +- +- ++ ++ ++ ++ ++ ++ + +- ++ + + +- ++ + + + + + +- +- ++ ++ + +- ++ + + +- ++ + + + + + +- ++ + + +- +- ++ ++ + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + + +@@ -8780,147 +8788,147 @@ + + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- +- ++ ++ + +- ++ + + +- ++ + + +- +- ++ ++ + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- +- ++ ++ + +- ++ + + +- ++ + + + + + +- +- ++ ++ + + + + +- ++ + + +- +- ++ ++ + +- ++ + + + +@@ -8935,261 +8943,261 @@ + + + +- ++ + + +- ++ + + +- ++ + + +- +- ++ ++ + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- +- ++ ++ + + + + +- +- +- +- ++ ++ ++ ++ + + + + +- +- +- ++ ++ ++ + + + + +- +- +- +- +- +- ++ ++ ++ ++ ++ ++ + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + +- ++ + + +- ++ + + +- ++ + +- ++ + + +- ++ + + +- ++ + +- ++ + + +- ++ + + +- ++ + +- ++ + + +- ++ + + +- ++ + +- ++ + + +- ++ + + +- ++ + +- ++ + + +- ++ + + +- ++ + +- ++ + + +- ++ + + +- ++ + +- ++ + + +- ++ + + +- ++ + +- ++ + + +- ++ + + +- ++ + +- ++ + + +- ++ + + +- ++ + +- ++ + + +- ++ + + +- ++ + +- ++ + + +- ++ + + +- ++ + +- ++ + + +- ++ + + +- ++ + +- ++ + + +- ++ + + +- ++ + +- ++ + + +- ++ + + +- ++ + +- ++ + + +- ++ + + +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ + + + +@@ -9198,50 +9206,50 @@ + + + +- ++ + + +- +- +- +- +- +- +- +- +- ++ ++ ++ ++ ++ ++ ++ ++ ++ + +- ++ + + + + +- +- +- +- ++ ++ ++ ++ + + +- ++ + + + +- ++ + + + + +- +- ++ ++ + + +- ++ + + + + +- +- ++ ++ + + + +@@ -9255,42 +9263,42 @@ + + + +- ++ + + + + +- ++ + + + +- +- ++ ++ + + + + +- ++ + + + + +- ++ + + +- ++ + +- ++ + + +- ++ + + + + + + +- ++ + + + +@@ -9298,8 +9306,8 @@ + + + +- +- ++ ++ + + + +@@ -9308,46 +9316,46 @@ + + + +- +- ++ ++ + + + + +- ++ + + +- ++ + +- ++ + + + + + + +- ++ + + + + +- ++ + + + + + +- ++ + + + + + +- +- ++ ++ + + +- ++ + + + +@@ -9355,51 +9363,51 @@ + + + +- +- ++ ++ + + + +- +- ++ ++ + + + +- ++ + + + +- ++ + + + + +- ++ + + + + +- ++ + + + + + + +- ++ + + + +- ++ + + + +- +- +- +- +- +- ++ ++ ++ ++ ++ ++ + + + +@@ -9416,17 +9424,17 @@ + + + +- ++ + +- +- ++ ++ + + + +- ++ + +- +- ++ ++ + + + +@@ -9443,23 +9451,23 @@ + + + +- ++ + + + + + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + + +@@ -9468,45 +9476,45 @@ + + + +- ++ + + + +- +- ++ ++ + + + + + + +- ++ + + + + + + +- ++ + + + + + + +- +- +- ++ ++ ++ + + + +- +- +- ++ ++ ++ + + + +- ++ + + + +@@ -9515,13 +9523,13 @@ + + + +- ++ + + + + + +- ++ + + + +@@ -9536,7 +9544,7 @@ + + + +- ++ + + + +@@ -9554,7 +9562,7 @@ + + + +- ++ + + + +@@ -9563,9 +9571,9 @@ + + + +- +- +- ++ ++ ++ + + + +@@ -9589,10 +9597,10 @@ + + + +- +- +- +- ++ ++ ++ ++ + + + +@@ -9617,13 +9625,13 @@ + + + +- ++ + + + + + +- ++ + + + +@@ -9638,7 +9646,7 @@ + + + +- ++ + + + +@@ -9664,32 +9672,32 @@ + + + +- ++ + + + + +- ++ + + + +- ++ + + + + +- ++ + + + +- ++ + +- ++ + +- ++ + +- +- ++ ++ + + + +@@ -9697,12 +9705,12 @@ + + + +- ++ + + + + +- ++ + + + +@@ -9720,7 +9728,7 @@ + + + +- ++ + + + +@@ -9728,7 +9736,7 @@ + + + +- ++ + + + +@@ -9739,43 +9747,43 @@ + + + +- ++ + + +- ++ + + + +- ++ + + + +- ++ + + + + + +- ++ + +- +- ++ ++ + + + +- ++ + +- ++ + + + +- ++ + + + + + +- ++ + + + +@@ -9816,18 +9824,18 @@ + + + +- ++ + + + +- ++ + + + + +- +- +- ++ ++ ++ + + + +@@ -9847,7 +9855,7 @@ + + + +- ++ + + + +@@ -9875,146 +9883,146 @@ + + + +- +- ++ ++ + + +- +- ++ ++ + + +- +- ++ ++ + + +- +- +- +- +- ++ ++ ++ ++ ++ + + +- +- +- +- ++ ++ ++ ++ + + +- +- ++ ++ + + +- +- ++ ++ + + +- +- ++ ++ + + +- +- +- +- ++ ++ ++ ++ + +- +- ++ ++ + + +- +- +- ++ ++ ++ + +- +- +- ++ ++ ++ + + +- +- +- +- ++ ++ ++ ++ + + +- +- +- +- ++ ++ ++ ++ + +- +- ++ ++ + + +- +- +- ++ ++ ++ + +- +- +- ++ ++ ++ + + +- +- +- ++ ++ ++ + + +- +- +- +- +- ++ ++ ++ ++ ++ + + + +- ++ + +- ++ + + + +- ++ + + + + +- +- ++ ++ + +- +- +- ++ ++ ++ + +- ++ + +- +- ++ ++ + + +- ++ + + + +- +- ++ ++ + + +- +- ++ ++ + + +- +- ++ ++ + + +- +- ++ ++ + + +- +- ++ ++ + +- ++ + + + +@@ -10028,9 +10036,9 @@ + + + +- ++ + +- ++ + + + +@@ -10054,15 +10062,15 @@ + + + +- ++ + + + +- ++ + + + +- ++ + + + +@@ -10074,29 +10082,29 @@ + + + +- ++ + + + +- ++ + + + +- ++ + + + +- ++ + + + +- ++ + + + + +- +- ++ ++ + + + +@@ -10116,18 +10124,18 @@ + + + +- +- +- ++ ++ ++ + + + + + + +- +- +- ++ ++ ++ + + + +@@ -10150,25 +10158,25 @@ + + + +- +- ++ ++ + + + + +- +- ++ ++ + + +- ++ + + + +- +- ++ ++ + + +- ++ + + + +@@ -10188,69 +10196,69 @@ + + + +- ++ + + + +- ++ + + + +- ++ + + + +- ++ + + + +- ++ + + + + +- ++ + + + + +- ++ + + + + +- ++ + + + + +- ++ + + + +- ++ + + + +- ++ + + + + + + +- ++ + + + + +- +- ++ ++ + + +- ++ + +- ++ + + + +@@ -10258,411 +10266,411 @@ + + + +- +- ++ ++ + + +- +- +- +- +- +- ++ ++ ++ ++ ++ ++ + + +- +- +- ++ ++ ++ + + +- +- +- ++ ++ ++ + + +- +- +- +- ++ ++ ++ ++ + + +- +- +- +- +- ++ ++ ++ ++ ++ + + +- +- ++ ++ + + +- +- +- +- ++ ++ ++ ++ + +- +- ++ ++ + + +- +- ++ ++ + + +- +- +- +- ++ ++ ++ ++ + + +- +- +- +- ++ ++ ++ ++ + + +- +- +- +- ++ ++ ++ ++ + + +- +- +- ++ ++ ++ + + +- +- ++ ++ + + +- +- +- +- ++ ++ ++ ++ + + +- +- +- +- ++ ++ ++ ++ + + +- +- +- ++ ++ ++ + + +- +- +- ++ ++ ++ + + +- +- +- ++ ++ ++ + + +- +- +- ++ ++ ++ + + +- +- ++ ++ + + +- +- ++ ++ + + +- +- ++ ++ + + +- +- +- +- ++ ++ ++ ++ + + +- +- +- +- ++ ++ ++ ++ + + +- +- +- +- +- ++ ++ ++ ++ ++ + + +- +- +- +- +- ++ ++ ++ ++ ++ + + +- +- +- +- +- +- ++ ++ ++ ++ ++ ++ + + +- +- +- +- ++ ++ ++ ++ + + +- +- ++ ++ + + +- +- +- +- +- ++ ++ ++ ++ ++ + + +- +- +- +- +- +- ++ ++ ++ ++ ++ ++ + + +- +- +- +- ++ ++ ++ ++ + + +- +- ++ ++ + + +- +- +- +- ++ ++ ++ ++ + + +- +- ++ ++ + + +- +- +- +- ++ ++ ++ ++ + + +- +- ++ ++ + + +- +- ++ ++ + + +- +- +- +- +- ++ ++ ++ ++ ++ + + +- +- ++ ++ + + +- +- +- ++ ++ ++ + + +- +- +- +- ++ ++ ++ ++ + + +- +- +- +- +- ++ ++ ++ ++ ++ + + +- +- +- +- +- +- ++ ++ ++ ++ ++ ++ + + +- +- +- +- +- +- ++ ++ ++ ++ ++ ++ + + +- +- +- +- +- +- ++ ++ ++ ++ ++ ++ + + +- +- +- +- ++ ++ ++ ++ + + +- +- +- +- +- ++ ++ ++ ++ ++ + + +- +- +- ++ ++ ++ + + +- +- +- ++ ++ ++ + + +- +- +- +- ++ ++ ++ ++ + + +- +- +- +- ++ ++ ++ ++ + + +- +- +- ++ ++ ++ + + +- +- +- ++ ++ ++ + + +- +- +- ++ ++ ++ + + +- +- +- ++ ++ ++ + + +- +- +- +- +- ++ ++ ++ ++ ++ + + +- +- +- +- ++ ++ ++ ++ + + +- +- +- ++ ++ ++ + + +- +- +- ++ ++ ++ + + +- +- +- +- ++ ++ ++ ++ + + +- +- +- ++ ++ ++ + + +- +- +- +- +- ++ ++ ++ ++ ++ + + +- +- +- +- ++ ++ ++ ++ + + +- +- +- ++ ++ ++ + + +- +- ++ ++ + + +- +- +- ++ ++ ++ + + +- +- ++ ++ + + +- +- ++ ++ + + +- ++ + + + +- ++ + + + + + +- +- ++ ++ + + + +@@ -10675,10 +10683,10 @@ + + + +- ++ + + +- ++ + + + +@@ -10687,7 +10695,7 @@ + + + +- ++ + + + +@@ -10696,14 +10704,14 @@ + + + +- ++ + + + + +- +- +- ++ ++ ++ + + + +@@ -10715,7 +10723,7 @@ + + + +- ++ + + + +@@ -10731,46 +10739,46 @@ + + + +- ++ + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + +- +- ++ ++ + + +- ++ + + + + + + +- ++ + + + + + +- ++ + + + +@@ -10782,13 +10790,13 @@ + + + +- ++ + + +- ++ + + +- ++ + + + +@@ -10797,7 +10805,7 @@ + + + +- ++ + + + +@@ -10809,10 +10817,10 @@ + + + +- ++ + + +- ++ + + + +@@ -10830,7 +10838,7 @@ + + + +- ++ + + + +@@ -10842,7 +10850,7 @@ + + + +- ++ + + + +@@ -10854,7 +10862,7 @@ + + + +- ++ + + + +@@ -10866,7 +10874,7 @@ + + + +- ++ + + + +@@ -10878,7 +10886,7 @@ + + + +- ++ + + + +@@ -10890,7 +10898,7 @@ + + + +- ++ + + + +@@ -10902,7 +10910,7 @@ + + + +- ++ + + + +@@ -10914,7 +10922,7 @@ + + + +- ++ + + + +@@ -10922,7 +10930,7 @@ + + + +- ++ + + + +@@ -10977,7 +10985,7 @@ + + + +- ++ + + + +@@ -11298,7 +11306,7 @@ + + + +- ++ + + + +@@ -11377,7 +11385,7 @@ + + + +- ++ + + + +@@ -11482,7 +11490,7 @@ + + + +- ++ + + + +@@ -11507,7 +11515,7 @@ + + + +- ++ + + + +@@ -11562,7 +11570,7 @@ + + + +- ++ + + + +@@ -11611,7 +11619,7 @@ + + + +- ++ + + + +@@ -11733,25 +11741,25 @@ + + + +- ++ + + + + +- ++ + + + +- ++ + + + + +- ++ + + + +- ++ + + + +@@ -12023,7 +12031,7 @@ + + + +- ++ + + + +@@ -12032,7 +12040,7 @@ + + + +- ++ + + + +@@ -12073,14 +12081,14 @@ + + + +- ++ + + + + + + +- ++ + + + +@@ -12098,16 +12106,16 @@ + + + +- +- ++ ++ + + + + +- ++ + + +- ++ + + + +@@ -12158,71 +12166,71 @@ + + + +- +- +- ++ ++ ++ + +- ++ + + +- ++ + + +- ++ + + + +- ++ + + + +- ++ + + + + +- ++ + + + + + + +- ++ + +- ++ + + +- ++ + + + + +- ++ + + + +- ++ + +- ++ + + + +- ++ + + + +- ++ + + + + + + +- ++ + +- +- ++ ++ + + + +@@ -12230,18 +12238,18 @@ + + + +- ++ + + + + + +- ++ + + + + +- ++ + + + +@@ -12319,7 +12327,7 @@ + + + +- ++ + + + +@@ -12328,7 +12336,7 @@ + + + +- ++ + + + +@@ -12336,7 +12344,7 @@ + + + +- ++ + + + +@@ -12956,20 +12964,20 @@ + + + +- ++ + + + + + + +- ++ + + + + + +- ++ + + + +@@ -13032,7 +13040,7 @@ + + + +- ++ + + + +@@ -13050,15 +13058,15 @@ + + + +- ++ + + + +- ++ + + + +- ++ + + + +@@ -13073,19 +13081,19 @@ + + + +- ++ + + + + +- ++ + + + + + + +- ++ + + + +@@ -13237,7 +13245,7 @@ + + + +- ++ + + + +@@ -13338,7 +13346,7 @@ + + + +- ++ + + + +@@ -13348,7 +13356,7 @@ + + + +- ++ + + + +@@ -13377,10 +13385,10 @@ + + + +- ++ + + +- ++ + + + +@@ -13390,7 +13398,7 @@ + + + +- ++ + + + +@@ -13398,15 +13406,15 @@ + + + +- ++ + + + + + +- +- +- ++ ++ ++ + + + +@@ -13414,41 +13422,41 @@ + + + +- ++ + + + + +- ++ + + + + +- ++ + +- ++ + + +- +- ++ ++ + +- +- ++ ++ + +- ++ + + +- ++ + + +- +- ++ ++ + +- ++ + + +- +- ++ ++ + + + +@@ -13467,31 +13475,31 @@ + + + +- ++ + + +- ++ + + +- ++ + + +- ++ + +- ++ + + +- ++ + + + + + + +- ++ + + +- ++ + + + +@@ -13509,37 +13517,37 @@ + + + +- ++ + + +- ++ + + +- ++ + +- +- +- ++ ++ ++ + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- +- ++ ++ + +- ++ + + + +@@ -13549,16 +13557,16 @@ + + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + + +@@ -13567,16 +13575,16 @@ + + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + + +@@ -13585,41 +13593,41 @@ + + + +- ++ + + + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + + + +- ++ + +- +- ++ ++ + +- +- ++ ++ + + + +- ++ + +- ++ + + + +@@ -13632,7 +13640,7 @@ + + + +- ++ + + + +@@ -13644,15 +13652,15 @@ + + + +- ++ + +- +- +- +- ++ ++ ++ ++ + + +- ++ + + + +@@ -13661,127 +13669,127 @@ + + + +- ++ + + + + + +- ++ + + + + +- +- ++ ++ + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- +- ++ ++ + +- ++ + + +- ++ + + +- ++ + + +- +- ++ ++ + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- +- ++ ++ + +- ++ + + +- +- ++ ++ + +- ++ + + +- +- ++ ++ + +- ++ + + +- +- ++ ++ + +- ++ + + +- ++ + + +- ++ + + +- +- +- +- +- ++ ++ ++ ++ ++ + + +- ++ + + + + + +- ++ + + +- ++ + + + +@@ -13817,10 +13825,10 @@ + + + +- ++ + + +- ++ + + + +@@ -13862,7 +13870,7 @@ + + + +- ++ + + + +@@ -13907,7 +13915,7 @@ + + + +- ++ + + + +@@ -13937,7 +13945,7 @@ + + + +- ++ + + + +@@ -13946,31 +13954,31 @@ + + + +- ++ + + + + + + +- ++ + + + + +- +- ++ ++ + +- ++ + + +- ++ + + +- ++ + + +- ++ + + + +@@ -13978,7 +13986,7 @@ + + + +- ++ + + + +@@ -13997,16 +14005,16 @@ + + + +- ++ + + + + + +- ++ + + +- ++ + + + +@@ -14014,7 +14022,7 @@ + + + +- ++ + + + +@@ -14023,20 +14031,20 @@ + + + +- +- ++ ++ + + +- ++ + + +- ++ + + + + + +- ++ + + + +@@ -14081,15 +14089,15 @@ + + + +- ++ + + +- ++ + + + + +- ++ + + + +@@ -14097,13 +14105,13 @@ + + + +- ++ + + + + + +- ++ + + + +@@ -14111,7 +14119,7 @@ + + + +- ++ + + + +@@ -14192,19 +14200,19 @@ + + + +- ++ + + + + + +- ++ + + +- ++ + + +- ++ + + + +@@ -14261,13 +14269,13 @@ + + + +- ++ + + +- ++ + + +- ++ + + + +@@ -14285,16 +14293,16 @@ + + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + + +@@ -14303,40 +14311,40 @@ + + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + + + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + + +@@ -14348,13 +14356,13 @@ + + + +- ++ + + +- ++ + + +- ++ + + + +@@ -14363,14 +14371,14 @@ + + + +- ++ + + + +- ++ + + +- ++ + + + +@@ -14379,7 +14387,7 @@ + + + +- ++ + + + +@@ -14387,7 +14395,7 @@ + + + +- ++ + + + +@@ -14423,7 +14431,7 @@ + + + +- ++ + + + +@@ -14455,7 +14463,7 @@ + + + +- ++ + + + +@@ -14479,7 +14487,7 @@ + + + +- ++ + + + +@@ -14551,13 +14559,13 @@ + + + +- ++ + + + + + +- ++ + + + +@@ -14609,7 +14617,7 @@ + + + +- ++ + + + +@@ -14672,10 +14680,10 @@ + + + +- ++ + + +- ++ + + + +@@ -14690,13 +14698,13 @@ + + + +- ++ + + +- ++ + + +- ++ + + + +@@ -14723,10 +14731,10 @@ + + + +- ++ + + +- ++ + + + +@@ -14738,7 +14746,7 @@ + + + +- ++ + + + +@@ -14747,32 +14755,32 @@ + + + +- ++ + + + + + +- ++ + + +- ++ + + +- ++ + + + + +- ++ + + + + +- +- ++ ++ + +- ++ + + + +@@ -14781,10 +14789,10 @@ + + + +- ++ + + +- ++ + + + +@@ -14805,14 +14813,14 @@ + + + +- ++ + + + +- +- ++ ++ + +- ++ + + + +@@ -14827,7 +14835,7 @@ + + + +- ++ + + + +@@ -14837,7 +14845,7 @@ + + + +- ++ + + + +@@ -14849,22 +14857,22 @@ + + + +- ++ + + + + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + + +@@ -14894,7 +14902,7 @@ + + + +- ++ + + + +@@ -14912,7 +14920,7 @@ + + + +- ++ + + + +@@ -14933,7 +14941,7 @@ + + + +- ++ + + + +@@ -14948,28 +14956,28 @@ + + + +- ++ + + +- ++ + + + + + +- ++ + + +- ++ + + +- ++ + + + + + +- ++ + + + +@@ -14980,31 +14988,31 @@ + + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + + +@@ -15013,29 +15021,29 @@ + + + +- ++ + + +- +- ++ ++ + + +- ++ + + +- ++ + + + + + +- ++ + + + + + +- ++ + + + +@@ -15043,19 +15051,19 @@ + + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + + +@@ -15087,7 +15095,7 @@ + + + +- ++ + + + +@@ -15115,7 +15123,7 @@ + + + +- ++ + + + +@@ -15124,20 +15132,20 @@ + + + +- ++ + + + + + + +- ++ + + + + + +- ++ + + + +@@ -15154,7 +15162,7 @@ + + + +- ++ + + + +@@ -15170,7 +15178,7 @@ + + + +- ++ + + + +@@ -15182,7 +15190,7 @@ + + + +- ++ + + + +@@ -15194,7 +15202,7 @@ + + + +- ++ + + + +@@ -15206,7 +15214,7 @@ + + + +- ++ + + + +@@ -15214,7 +15222,7 @@ + + + +- ++ + + + +@@ -16357,7 +16365,7 @@ + + + +- ++ + + + +@@ -16371,10 +16379,10 @@ + + + +- ++ + + +- ++ + + + +@@ -16420,25 +16428,25 @@ + + + +- ++ + + + + +- ++ + + +- ++ + + + +- ++ + + + + + +- ++ + + + +@@ -16446,7 +16454,7 @@ + + + +- ++ + + + +@@ -16471,7 +16479,7 @@ + + + +- ++ + + + +@@ -16485,10 +16493,10 @@ + + + +- ++ + + +- ++ + + + +@@ -16522,7 +16530,7 @@ + + + +- ++ + + + +@@ -16530,7 +16538,7 @@ + + + +- ++ + + + +@@ -16547,7 +16555,7 @@ + + + +- ++ + + + +@@ -16558,10 +16566,10 @@ + + + +- ++ + + +- ++ + + + +@@ -16603,13 +16611,13 @@ + + + +- ++ + + + + + +- ++ + + + +@@ -16629,13 +16637,13 @@ + + + +- ++ + + + + + +- ++ + + + +@@ -16694,16 +16702,16 @@ + + + +- ++ + + +- ++ + + + + + +- ++ + + + +@@ -16735,7 +16743,7 @@ + + + +- ++ + + + +@@ -16773,7 +16781,7 @@ + + + +- ++ + + + +@@ -16787,10 +16795,10 @@ + + + +- ++ + + +- ++ + + + +@@ -16807,7 +16815,7 @@ + + + +- ++ + + + +@@ -16818,13 +16826,13 @@ + + + +- ++ + + + + + +- ++ + + + +@@ -16848,7 +16856,7 @@ + + + +- ++ + + + +@@ -16861,7 +16869,7 @@ + + + +- ++ + + + +@@ -16876,13 +16884,13 @@ + + + +- ++ + + +- ++ + + +- ++ + + + +@@ -16891,10 +16899,10 @@ + + + +- ++ + + +- ++ + + + +@@ -16903,15 +16911,15 @@ + + + +- ++ + + +- ++ + + + + +- ++ + + + +@@ -16926,7 +16934,7 @@ + + + +- ++ + + + +@@ -16935,16 +16943,16 @@ + + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + + +@@ -16952,7 +16960,7 @@ + + + +- ++ + + + +@@ -16960,7 +16968,7 @@ + + + +- ++ + + + +@@ -16968,7 +16976,7 @@ + + + +- ++ + + + +@@ -16976,20 +16984,20 @@ + + + +- ++ + +- ++ + + + + + +- ++ + + + + +- ++ + + + +@@ -16997,7 +17005,7 @@ + + + +- ++ + + + +@@ -17005,7 +17013,7 @@ + + + +- ++ + + + +@@ -17013,7 +17021,7 @@ + + + +- ++ + + + +@@ -17021,41 +17029,41 @@ + + + +- ++ + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + + + +- ++ + + + +@@ -17063,7 +17071,7 @@ + + + +- ++ + + + +@@ -17071,10 +17079,10 @@ + + + +- ++ + + +- ++ + + + +@@ -17146,7 +17154,7 @@ + + + +- ++ + + + +@@ -17172,12 +17180,12 @@ + + + +- ++ + + + + +- ++ + + + +@@ -17190,19 +17198,19 @@ + + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + + +@@ -17211,7 +17219,7 @@ + + + +- ++ + + + +@@ -17219,7 +17227,7 @@ + + + +- ++ + + + +@@ -17254,7 +17262,7 @@ + + + +- ++ + + + +@@ -17268,21 +17276,21 @@ + + + +- ++ + +- ++ + +- +- ++ ++ + +- +- ++ ++ + +- +- ++ ++ + + +- ++ + + + +@@ -17341,10 +17349,13 @@ + + + +- ++ + +- +- ++ ++ ++ ++ ++ + + + +@@ -17427,2331 +17438,2331 @@ + + + +- ++ + +- ++ + + +- ++ + + +- ++ + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + +- ++ + + +- ++ + + +- ++ + +- ++ + + +- ++ + + +- ++ + +- ++ + + +- ++ + + +- ++ + +- ++ + + +- ++ + + +- ++ + +- ++ + + +- ++ + + +- ++ + +- ++ + + +- ++ + + +- ++ + +- ++ + + +- ++ + + +- ++ + +- ++ + + +- ++ + + +- ++ + +- ++ + + +- ++ + + +- ++ + +- ++ + + +- ++ + + +- ++ + +- ++ + + +- ++ + + +- ++ + +- ++ + + +- ++ + + +- ++ + +- ++ + + +- ++ + + +- ++ + +- ++ + + +- ++ + + +- ++ + +- ++ + + +- ++ + + +- ++ + +- ++ + + +- ++ + + +- ++ + +- ++ + + +- ++ + + +- ++ + +- ++ + + +- ++ + + +- ++ + +- ++ + + +- ++ + + + + +- ++ + + + + + +- ++ + + + +@@ -19766,13 +19777,13 @@ + + + +- ++ + + +- ++ + + +- ++ + + + +@@ -19796,16 +19807,16 @@ + + + +- ++ + + +- ++ + + + + + +- ++ + + + +@@ -19897,12 +19908,12 @@ + + + +- ++ + + + + +- ++ + + + +@@ -19918,13 +19929,13 @@ + + + +- ++ + + +- ++ + + +- ++ + + + +@@ -19933,24 +19944,24 @@ + + + +- ++ + + + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + + +@@ -19959,13 +19970,13 @@ + + + +- ++ + + +- ++ + + +- ++ + + + +@@ -19974,7 +19985,7 @@ + + + +- ++ + + + +@@ -19986,7 +19997,7 @@ + + + +- ++ + + + +@@ -19995,7 +20006,7 @@ + + + +- ++ + + + +@@ -20019,7 +20030,7 @@ + + + +- ++ + + + +@@ -20040,7 +20051,7 @@ + + + +- ++ + + + +@@ -20085,7 +20096,7 @@ + + + +- ++ + + + +@@ -20133,16 +20144,16 @@ + + + +- ++ + + + + + +- ++ + + +- ++ + + + +@@ -20171,13 +20182,13 @@ + + + +- ++ + + +- ++ + + +- ++ + + + +@@ -20196,7 +20207,7 @@ + + + +- ++ + + + +@@ -20205,7 +20216,7 @@ + + + +- ++ + + + +@@ -20214,7 +20225,7 @@ + + + +- ++ + + + +@@ -20236,14 +20247,14 @@ + + + +- ++ + + + + + +- +- ++ ++ + + + +@@ -20281,7 +20292,7 @@ + + + +- ++ + + + +@@ -20408,16 +20419,16 @@ + + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + + +@@ -20429,30 +20440,30 @@ + + + +- ++ + + + + + +- ++ + + +- ++ + + +- ++ + + + + + +- ++ + + + + +- ++ + + + +@@ -20463,21 +20474,21 @@ + + + +- ++ + + + + +- ++ + + +- ++ + + + + + +- ++ + + + +@@ -20489,7 +20500,7 @@ + + + +- ++ + + + +@@ -20498,19 +20509,19 @@ + + + +- ++ + + +- ++ + + + + + +- ++ + + +- ++ + + + +@@ -20521,7 +20532,7 @@ + + + +- ++ + + + +@@ -20554,10 +20565,10 @@ + + + +- ++ + + +- ++ + + + +@@ -20575,18 +20586,18 @@ + + + +- ++ + + + + +- ++ + + +- ++ + + +- ++ + + + +@@ -20632,19 +20643,19 @@ + + + +- ++ + + + + + +- ++ + + + + + +- ++ + + + +@@ -20660,10 +20671,10 @@ + + + +- ++ + + +- ++ + + + +@@ -20680,7 +20691,7 @@ + + + +- ++ + + + +@@ -20688,7 +20699,7 @@ + + + +- ++ + + + +@@ -20696,10 +20707,10 @@ + + + +- ++ + + +- ++ + + + +@@ -20708,10 +20719,10 @@ + + + +- ++ + + +- ++ + + + +@@ -20761,254 +20772,254 @@ + + + +- ++ + + +- ++ + + +- ++ + + + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + + + +- ++ + + +- ++ + + + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + + + +- ++ + + +- ++ + + +- ++ + + + + +- ++ + + +- ++ + + +- ++ + + + + +- ++ + + +- ++ + + +- ++ + + + + +- ++ + + +- ++ + + + + +- ++ + + +- ++ + + +- ++ + + + + +- ++ + + +- ++ + + +- ++ + + + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + + + +- ++ + + +- ++ + + + + + +- ++ + + +- ++ + + +- ++ + + + +@@ -21028,7 +21039,7 @@ + + + +- ++ + + + +@@ -21040,7 +21051,7 @@ + + + +- ++ + + + +@@ -21109,10 +21120,10 @@ + + + +- ++ + + +- ++ + + + +@@ -21135,7 +21146,7 @@ + + + +- ++ + + + +@@ -21144,13 +21155,13 @@ + + + +- ++ + + +- ++ + + +- ++ + + + +@@ -21209,7 +21220,7 @@ + + + +- ++ + + + +@@ -21219,7 +21230,7 @@ + + + +- ++ + + + +@@ -21227,10 +21238,10 @@ + + + +- ++ + + +- ++ + + + +@@ -21276,13 +21287,13 @@ + + + +- ++ + + +- ++ + + +- ++ + + + +@@ -21302,7 +21313,7 @@ + + + +- ++ + + + +@@ -21318,12 +21329,12 @@ + + + +- ++ + + + + +- ++ + + + +@@ -21337,7 +21348,7 @@ + + + +- ++ + + + +@@ -21360,10 +21371,10 @@ + + + +- ++ + + +- ++ + + + +@@ -21378,7 +21389,7 @@ + + + +- ++ + + + +@@ -21386,7 +21397,7 @@ + + + +- ++ + + + +@@ -21397,7 +21408,7 @@ + + + +- ++ + + + +@@ -21439,7 +21450,7 @@ + + + +- ++ + + + +@@ -21467,16 +21478,16 @@ + + + +- ++ + + +- ++ + + + + + +- ++ + + + +@@ -21501,28 +21512,28 @@ + + + +- ++ + +- ++ + + + + + +- ++ + + + +- ++ + + + + + +- +- +- +- ++ ++ ++ ++ + + + +@@ -21537,17 +21548,17 @@ + + + +- +- +- ++ ++ ++ + + + + +- +- ++ ++ + +- ++ + + + +@@ -21577,30 +21588,30 @@ + + + +- ++ + + +- ++ + + +- +- ++ ++ + +- ++ + + + + +- +- +- ++ ++ ++ + + + + + + +- ++ + + + +@@ -21613,12 +21624,12 @@ + + + +- ++ + +- ++ + + +- ++ + + + +@@ -21626,10 +21637,10 @@ + + + +- ++ + + +- ++ + + + +@@ -21642,7 +21653,7 @@ + + + +- ++ + + + +@@ -21651,7 +21662,7 @@ + + + +- ++ + + + +@@ -21663,7 +21674,7 @@ + + + +- ++ + + + +@@ -21672,13 +21683,13 @@ + + + +- ++ + + + + + +- ++ + + + +@@ -21689,34 +21700,34 @@ + + + +- ++ + +- +- +- +- +- ++ ++ ++ ++ ++ + + + + + +- ++ + + + + + +- ++ + + + + + +- ++ + + +- ++ + + + +@@ -21745,44 +21756,44 @@ + + + +- ++ + + +- ++ + + + + + + +- ++ + + +- +- ++ ++ + +- +- +- +- +- +- +- +- ++ ++ ++ ++ ++ ++ ++ ++ + + +- ++ + + + + +- ++ + + + + + +- ++ + + + +@@ -21832,10 +21843,10 @@ + + + +- ++ + + +- ++ + + + +@@ -21851,10 +21862,10 @@ + + + +- ++ + + +- ++ + + + +@@ -21862,27 +21873,27 @@ + + + +- ++ + + +- ++ + + + + + +- ++ + + +- ++ + + + + +- ++ + + +- ++ + + + +@@ -21898,15 +21909,15 @@ + + + +- ++ + + +- ++ + + + + +- ++ + + + +@@ -21914,19 +21925,19 @@ + + + +- ++ + + + + + +- ++ + + + +- ++ + +- ++ + + + +@@ -21935,7 +21946,7 @@ + + + +- ++ + + + +@@ -22014,7 +22025,7 @@ + + + +- ++ + + + +@@ -22026,18 +22037,18 @@ + + + +- +- +- +- ++ ++ ++ ++ + +- ++ + + + + + +- ++ + + + +@@ -22068,7 +22079,7 @@ + + + +- ++ + + + +@@ -22083,7 +22094,7 @@ + + + +- ++ + + + +@@ -22152,7 +22163,7 @@ + + + +- ++ + + + +@@ -22274,7 +22285,7 @@ + + + +- ++ + + + +@@ -22366,7 +22377,7 @@ + + + +- ++ + + + +@@ -22375,7 +22386,7 @@ + + + +- ++ + + + +@@ -22416,7 +22427,7 @@ + + + +- ++ + + + +@@ -22426,26 +22437,26 @@ + + + +- ++ + +- +- ++ ++ + + +- +- ++ ++ + +- ++ + + +- +- ++ ++ + +- +- ++ ++ + +- +- ++ ++ + + + +@@ -22460,15 +22471,15 @@ + + + +- +- ++ ++ + + +- ++ + +- +- +- ++ ++ ++ + + + +@@ -22477,17 +22488,17 @@ + + + +- ++ + + + + + +- ++ + + + +- ++ + + + +@@ -22502,7 +22513,7 @@ + + + +- ++ + + + +@@ -22529,14 +22540,14 @@ + + + +- ++ + + + + + + +- ++ + + + +@@ -22548,7 +22559,7 @@ + + + +- ++ + + + +@@ -22559,16 +22570,16 @@ + + + +- +- +- ++ ++ ++ + + + + +- ++ + +- ++ + + + +@@ -22576,9 +22587,9 @@ + + + +- +- +- ++ ++ ++ + + + +@@ -22586,16 +22597,16 @@ + + + +- ++ + + + + + +- ++ + +- +- ++ ++ + + + +@@ -22605,7 +22616,7 @@ + + + +- ++ + + + +@@ -22621,12 +22632,12 @@ + + + +- ++ + + + + +- ++ + + + +@@ -22638,7 +22649,7 @@ + + + +- ++ + + + +@@ -22669,7 +22680,7 @@ + + + +- ++ + + + +@@ -22677,31 +22688,31 @@ + + + +- +- ++ ++ + + + +- ++ + + + + +- ++ + + + + + +- ++ + + + + + +- ++ + +- ++ + + + +@@ -22736,27 +22747,27 @@ + + + +- ++ + + + + +- ++ + + +- ++ + +- ++ + + +- ++ + + + + +- ++ + +- ++ + + + +@@ -22778,7 +22789,7 @@ + + + +- ++ + + + +@@ -22836,7 +22847,7 @@ + + + +- ++ + + + +@@ -22846,8 +22857,8 @@ + + + +- +- ++ ++ + + + +@@ -22856,7 +22867,7 @@ + + + +- ++ + + + +@@ -22871,7 +22882,7 @@ + + + +- ++ + + + +@@ -22883,7 +22894,7 @@ + + + +- ++ + + + +@@ -22908,7 +22919,7 @@ + + + +- ++ + + + +@@ -22923,12 +22934,12 @@ + + + +- ++ + + + +- +- ++ ++ + + + +@@ -22949,7 +22960,7 @@ + + + +- ++ + + + +@@ -22958,7 +22969,7 @@ + + + +- ++ + + + +@@ -22977,12 +22988,12 @@ + + + +- ++ + + + + +- ++ + + + +@@ -22995,7 +23006,7 @@ + + + +- ++ + + + +@@ -23006,12 +23017,12 @@ + + + +- +- ++ ++ + + + +- ++ + + + +@@ -23022,7 +23033,7 @@ + + + +- ++ + + + +@@ -23031,7 +23042,7 @@ + + + +- ++ + + + +@@ -23047,7 +23058,7 @@ + + + +- ++ + + + +@@ -23059,12 +23070,12 @@ + + + +- ++ + + + + +- ++ + + + +@@ -23073,24 +23084,24 @@ + + + +- +- ++ ++ + + + +- ++ + + + + + + +- ++ + + + + +- ++ + + + +@@ -23099,54 +23110,54 @@ + + + +- +- ++ ++ + + + +- +- ++ ++ + + + +- +- ++ ++ + + + + +- +- +- +- ++ ++ ++ ++ + + + +- ++ + + + +- ++ + + +- ++ + +- ++ + + +- ++ + + +- ++ + + +- +- ++ ++ + +- ++ + + +- ++ + + + +@@ -23172,9 +23183,9 @@ + + + +- +- +- ++ ++ ++ + + + +@@ -23195,7 +23206,7 @@ + + + +- ++ + + + +@@ -23208,8 +23219,8 @@ + + + +- +- ++ ++ + + + +@@ -23223,7 +23234,7 @@ + + + +- ++ + + + +@@ -23231,7 +23242,7 @@ + + + +- ++ + + + +@@ -23253,12 +23264,12 @@ + + + +- ++ + + + + +- ++ + + + +@@ -23278,9 +23289,9 @@ + + + +- ++ + +- ++ + + + +@@ -23293,22 +23304,22 @@ + + + +- +- ++ ++ + + + + +- ++ + + + + + + +- ++ + +- ++ + + + +@@ -23320,9 +23331,9 @@ + + + +- +- + ++ ++ + + + +@@ -23346,36 +23357,36 @@ + + + +- ++ + + + + + +- ++ + + +- ++ + + + + +- ++ + + + +- +- ++ ++ + + +- ++ + + + +- +- ++ ++ + +- ++ + + + +@@ -23397,7 +23408,7 @@ + + + +- ++ + + + +@@ -23455,14 +23466,14 @@ + + + +- ++ + + + + + + +- ++ + + + +@@ -23471,27 +23482,27 @@ + + + +- +- ++ ++ + + + + + +- ++ + + + + + +- ++ + + +- ++ + + + +- ++ + + + +@@ -23525,22 +23536,22 @@ + + + +- ++ + +- ++ + + + +- ++ + + + + +- ++ + + + +- ++ + + + +@@ -23549,8 +23560,8 @@ + + + +- +- ++ ++ + + + +@@ -23560,8 +23571,8 @@ + + + +- +- ++ ++ + + + +@@ -23593,7 +23604,7 @@ + + + +- ++ + + + +@@ -23679,7 +23690,7 @@ + + + +- ++ + + + +@@ -23694,7 +23705,7 @@ + + + +- ++ + + + +@@ -23728,11 +23739,11 @@ + + + +- ++ + + + +- ++ + + + +@@ -23742,23 +23753,23 @@ + + + +- ++ + + + + + +- ++ + + + + + +- ++ + +- +- +- ++ ++ ++ + + + +@@ -23769,11 +23780,11 @@ + + + +- ++ + +- ++ + +- ++ + + + +@@ -23783,7 +23794,7 @@ + + + +- ++ + + + +@@ -23791,14 +23802,14 @@ + + + +- ++ + + + + + + +- ++ + + + +@@ -23831,15 +23842,15 @@ + + + +- ++ + + +- ++ + + + + +- ++ + + + +@@ -23849,15 +23860,15 @@ + + + +- ++ + + + + +- ++ + + +- ++ + + + +@@ -23877,8 +23888,8 @@ + + + +- +- ++ ++ + + + +@@ -23887,10 +23898,10 @@ + + + +- ++ + + +- ++ + + + +@@ -23905,7 +23916,7 @@ + + + +- ++ + + + +@@ -23915,45 +23926,45 @@ + + + +- ++ + +- ++ + + +- ++ + +- +- ++ ++ + + +- ++ + + + + +- ++ + + + + +- ++ + + +- ++ + + +- ++ + + + + + +- +- ++ ++ + + +- +- ++ ++ + + + +@@ -23966,32 +23977,32 @@ + + + +- +- ++ ++ + + +- +- ++ ++ + + +- ++ + + + + +- ++ + + + + + +- ++ + + + + + +- ++ + + + +@@ -24045,7 +24056,7 @@ + + + +- ++ + + + +@@ -24083,86 +24094,86 @@ + + + +- +- ++ ++ + + + + + +- ++ + + + + + +- ++ + + + +- ++ + +- ++ + + +- +- ++ ++ + + + +- ++ + + + + +- ++ + +- ++ + + + + +- +- ++ ++ + + + + + +- +- ++ ++ + + + + +- ++ + +- ++ + + + + + +- ++ + +- ++ + + + + + +- ++ + +- ++ + + + + + + +- ++ + +- ++ + + + +@@ -24177,8 +24188,8 @@ + + + +- +- ++ ++ + + + +@@ -24188,7 +24199,7 @@ + + + +- ++ + + + +@@ -24209,7 +24220,7 @@ + + + +- ++ + + + +@@ -24220,7 +24231,7 @@ + + + +- ++ + + + +@@ -24231,13 +24242,13 @@ + + + +- ++ + + + + + +- ++ + + + +@@ -24245,55 +24256,55 @@ + + + +- ++ + + + +- ++ + + + + +- +- ++ ++ + + + +- +- ++ ++ + +- ++ + + +- ++ + + + + +- +- ++ ++ + + + +- ++ + + + +- ++ + + + +- +- ++ ++ + + + + +- ++ + + + +- ++ + + + +@@ -24317,7 +24328,7 @@ + + + +- ++ + + + +@@ -24340,42 +24351,42 @@ + + + +- ++ + + + + +- ++ + + + + +- ++ + + + + + +- ++ + + + + + + +- +- ++ ++ + + + + +- ++ + + + + + +- ++ + + + +@@ -24386,7 +24397,7 @@ + + + +- ++ + + + +@@ -24398,44 +24409,44 @@ + + + +- +- +- ++ ++ ++ + + + + + +- ++ + + + +- ++ + + + + +- ++ + + + +- ++ + + + +- ++ + + + +- ++ + + + +- ++ + + + +- ++ + + + +@@ -24480,7 +24491,7 @@ + + + +- ++ + + + +@@ -24496,20 +24507,20 @@ + + + +- ++ + + + +- ++ + + + + +- ++ + + + +- ++ + + + +@@ -24520,22 +24531,22 @@ + + + +- +- ++ ++ + + + +- ++ + + +- ++ + + + +- ++ + + +- ++ + + + +@@ -24614,7 +24625,7 @@ + + + +- ++ + + + +@@ -24623,7 +24634,7 @@ + + + +- ++ + + + +@@ -24631,8 +24642,8 @@ + + + +- +- ++ ++ + + + +@@ -24681,10 +24692,10 @@ + + + +- ++ + + +- ++ + + + +@@ -24703,10 +24714,10 @@ + + + +- ++ + + +- ++ + + + +@@ -24715,7 +24726,7 @@ + + + +- ++ + + + +@@ -24726,7 +24737,7 @@ + + + +- ++ + + + +@@ -24780,7 +24791,7 @@ + + + +- ++ + + + +@@ -24813,43 +24824,43 @@ + + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + + + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + + +@@ -24873,12 +24884,12 @@ + + + +- ++ + + + + +- ++ + + + +@@ -24889,7 +24900,7 @@ + + + +- ++ + + + +@@ -24901,7 +24912,7 @@ + + + +- ++ + + + +@@ -24952,8 +24963,8 @@ + + + +- +- ++ ++ + + + +@@ -24966,7 +24977,7 @@ + + + +- ++ + + + +@@ -25013,7 +25024,7 @@ + + + +- ++ + + + +@@ -25028,15 +25039,15 @@ + + + +- ++ + + +- +- ++ ++ + + + +- ++ + + + +@@ -25089,47 +25100,47 @@ + + + +- +- ++ ++ + + +- +- +- +- +- +- ++ ++ ++ ++ ++ ++ + + +- +- +- +- ++ ++ ++ ++ + + +- ++ + + + +- +- +- +- +- ++ ++ ++ ++ ++ + +- +- +- +- +- ++ ++ ++ ++ ++ + + + +- +- +- +- +- ++ ++ ++ ++ ++ + + + +@@ -25147,7 +25158,7 @@ + + + +- ++ + + + +@@ -25200,7 +25211,7 @@ + + + +- ++ + + + +@@ -25214,7 +25225,7 @@ + + + +- ++ + + + +@@ -25225,22 +25236,22 @@ + + + +- ++ + + + + +- +- ++ ++ + + + + +- ++ + + + +- ++ + + + +@@ -25263,7 +25274,7 @@ + + + +- ++ + + + +@@ -25316,7 +25327,7 @@ + + + +- ++ + + + +@@ -25329,7 +25340,7 @@ + + + +- ++ + + + +@@ -25343,10 +25354,10 @@ + + + +- ++ + + +- ++ + + + +@@ -25388,7 +25399,7 @@ + + + +- ++ + + + +@@ -25398,90 +25409,90 @@ + + + +- ++ + +- ++ + + + + + +- ++ + + +- ++ + + + +- ++ + +- ++ + + + + + + +- ++ + + + +- +- ++ ++ + + +- ++ + + + +- +- ++ ++ + + + +- ++ + + + +- ++ + + + +- ++ + + + +- ++ + +- ++ + + +- ++ + + + +- ++ + + + +- +- ++ ++ + + +- ++ + + + +- ++ + + + +- +- ++ ++ + + +- +- ++ ++ + + + +@@ -25496,22 +25507,22 @@ + + + +- +- ++ ++ + + + + + + +- ++ + + + + + + +- ++ + + + +@@ -25587,7 +25598,7 @@ + + + +- ++ + + + +@@ -25597,14 +25608,14 @@ + + + +- ++ + + +- ++ + + +- +- ++ ++ + + + +@@ -25622,11 +25633,11 @@ + + + +- ++ + + + +- ++ + + + +@@ -25635,7 +25646,7 @@ + + + +- ++ + + + +@@ -25651,9 +25662,9 @@ + + + +- +- +- ++ ++ ++ + + + +@@ -25692,7 +25703,7 @@ + + + +- ++ + + + +@@ -25726,8 +25737,13 @@ + + + ++ ++ ++ ++ ++ + +- ++ + + + +@@ -25738,7 +25754,7 @@ + + + +- ++ + + + +@@ -25748,33 +25764,33 @@ + + + +- ++ + + + +- +- +- ++ ++ ++ + + + + + +- +- +- ++ ++ ++ + + + + + + +- ++ + + + + +- ++ + + + +@@ -25785,9 +25801,9 @@ + + + +- ++ + +- ++ + + + +@@ -25795,20 +25811,20 @@ + + + +- +- ++ ++ + +- ++ + + +- +- ++ ++ + + + + + +- ++ + + + +@@ -25821,30 +25837,30 @@ + + + +- ++ + + + + +- ++ + + + + + +- ++ + + + + + +- ++ + + + +- ++ + +- ++ + + + +@@ -25852,17 +25868,17 @@ + + + +- ++ + + +- +- ++ ++ + + + + + +- ++ + + + +@@ -25895,60 +25911,60 @@ + + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + + + + +- +- ++ ++ + + + + + + +- ++ + + + +@@ -25963,10 +25979,10 @@ + + + +- ++ + + +- ++ + + + +@@ -25981,34 +25997,34 @@ + + + +- ++ + +- ++ + +- ++ + + + + +- +- ++ ++ + + +- ++ + + + +- ++ + + + +- ++ + + + + + +- ++ + + + +@@ -26035,35 +26051,35 @@ + + + +- +- ++ ++ + +- ++ + + + +- ++ + + + +- ++ + +- +- ++ ++ + + +- +- ++ ++ + + +- ++ + + + +- ++ + + +- ++ + + + +@@ -26071,7 +26087,7 @@ + + + +- ++ + + + +@@ -26088,19 +26104,19 @@ + + + +- ++ + + + +- +- +- ++ ++ ++ + +- +- ++ ++ + + +- ++ + + + +@@ -26108,7 +26124,7 @@ + + + +- ++ + + + +@@ -26142,21 +26158,21 @@ + + + +- ++ + + + +- ++ + +- ++ + + + + +- ++ + +- +- ++ ++ + + + +@@ -26177,7 +26193,7 @@ + + + +- ++ + + + +@@ -26186,13 +26202,13 @@ + + + +- ++ + + + + + +- ++ + + + +@@ -26208,7 +26224,7 @@ + + + +- ++ + + + +@@ -26216,50 +26232,50 @@ + + + +- ++ + + + + + +- ++ + + + + +- ++ + + + + +- ++ + + + + +- ++ + + + +- +- +- +- +- +- +- +- ++ ++ ++ ++ ++ ++ ++ ++ + +- ++ + + + +- ++ + + + +- +- ++ ++ + + + +@@ -26268,13 +26284,13 @@ + + + +- +- ++ ++ + + + + +- ++ + + + +@@ -26288,15 +26304,15 @@ + + + +- +- +- ++ ++ ++ + + + +- ++ + +- ++ + + + +@@ -26304,7 +26320,7 @@ + + + +- ++ + + + +@@ -26338,7 +26354,7 @@ + + + +- ++ + + + +@@ -26362,7 +26378,7 @@ + + + +- ++ + + + +@@ -26371,16 +26387,16 @@ + + + +- +- +- ++ ++ ++ + + + + + + +- ++ + + + +@@ -26411,7 +26427,7 @@ + + + +- ++ + + + +@@ -26433,26 +26449,26 @@ + + + +- +- ++ ++ + +- ++ + + +- +- ++ ++ + + + +- ++ + + + + + +- +- +- ++ ++ ++ + + + +@@ -26486,22 +26502,22 @@ + + + +- ++ + + + +- ++ + +- ++ + + + + +- ++ + + + +- ++ + + + +@@ -26515,11 +26531,11 @@ + + + +- ++ + + + +- ++ + + + +@@ -26582,8 +26598,8 @@ + + + +- +- ++ ++ + + + +@@ -26591,13 +26607,13 @@ + + + +- ++ + + + + + +- ++ + + + +@@ -26623,19 +26639,19 @@ + + + +- ++ + +- ++ + + + + + +- ++ + +- +- +- ++ ++ ++ + + + +@@ -26654,14 +26670,14 @@ + + + +- +- ++ ++ + + + + + +- ++ + + + +@@ -26669,7 +26685,7 @@ + + + +- ++ + + + +@@ -26678,21 +26694,21 @@ + + + +- ++ + + + + + +- ++ + + + +- ++ + + + +- ++ + + + +@@ -26703,7 +26719,7 @@ + + + +- ++ + + + +@@ -26713,32 +26729,32 @@ + + + +- +- ++ ++ + + + +- +- ++ ++ + + + +- +- ++ ++ + + +- ++ + + + + +- ++ + + + +- ++ + +- ++ + + + +@@ -26746,16 +26762,16 @@ + + + +- ++ + + +- +- ++ ++ + + +- ++ + +- ++ + + + +@@ -26767,8 +26783,8 @@ + + + +- +- ++ ++ + + + +@@ -26787,135 +26803,135 @@ + + + +- +- ++ ++ + + + + + +- +- ++ ++ + + + + + +- ++ + + + + + +- ++ + + + +- ++ + + +- ++ + + + +- ++ + + + + + + +- ++ + + + + +- ++ + + +- ++ + + + + +- ++ + + + +- ++ + + + +- +- ++ ++ + +- ++ + + +- +- ++ ++ + +- ++ + + +- ++ + + + +- ++ + + + + +- ++ + + +- ++ + + +- ++ + + +- +- ++ ++ + + +- +- ++ ++ + + + + + +- +- ++ ++ + +- ++ + + +- ++ + + +- ++ + + + + +- +- +- ++ ++ ++ + +- ++ + + + +- ++ + + + + + +- ++ + + + +@@ -27028,7 +27044,7 @@ + + + +- ++ + + + +@@ -27045,22 +27061,22 @@ + + + +- ++ + + + +- ++ + + + + +- ++ + + +- ++ + + +- ++ + + + +@@ -27087,13 +27103,13 @@ + + + +- ++ + + + + + +- ++ + + + +@@ -27111,27 +27127,27 @@ + + + +- ++ + + + + +- ++ + + + + +- ++ + + + + +- ++ + + + + +- ++ + + + +@@ -27145,19 +27161,19 @@ + + + +- ++ + + + + +- ++ + + + + + +- +- ++ ++ + + + +@@ -27171,35 +27187,35 @@ + + + +- ++ + + + + + +- ++ + + + + + +- ++ + + + + +- +- +- ++ ++ ++ + + + +- ++ + + + + +- ++ + + + +@@ -27211,7 +27227,7 @@ + + + +- ++ + + + +@@ -27221,26 +27237,26 @@ + + + +- ++ + + + +- +- ++ ++ + +- +- ++ ++ + + + + +- ++ + +- ++ + + + +- ++ + + + +@@ -27248,7 +27264,7 @@ + + + +- ++ + + + +@@ -27265,13 +27281,13 @@ + + + +- +- +- ++ ++ ++ + + +- +- ++ ++ + + + +@@ -27290,7 +27306,7 @@ + + + +- ++ + + + +@@ -27324,11 +27340,11 @@ + + + +- ++ + + + +- ++ + + + +@@ -27336,19 +27352,19 @@ + + + +- +- ++ ++ + + + + +- +- ++ ++ + + + + +- ++ + + + +@@ -27357,19 +27373,19 @@ + + + +- ++ + + +- ++ + + +- ++ + + + + + +- ++ + + + +@@ -27381,63 +27397,63 @@ + + + +- ++ + + +- ++ + + +- ++ + + + + + +- ++ + +- ++ + +- +- +- ++ ++ ++ + + +- ++ + + + +- ++ + + +- ++ + + + +- +- ++ ++ + + + + + +- ++ + + + + +- ++ + + + +- +- ++ ++ + + +- ++ + + + +- ++ + + + +@@ -27449,10 +27465,10 @@ + + + +- ++ + + +- ++ + + + +@@ -27462,12 +27478,12 @@ + + + +- ++ + + + + +- ++ + + + +@@ -27483,19 +27499,19 @@ + + + +- ++ + + + + +- ++ + + + +- ++ + + +- ++ + + + +@@ -27511,14 +27527,14 @@ + + + +- +- ++ ++ + + + + + +- ++ + + + +@@ -27531,41 +27547,41 @@ + + + +- +- ++ ++ + + + + + + +- ++ + + + +- ++ + + +- ++ + + + + + +- ++ + +- ++ + + + + +- ++ + + + + + +- ++ + + + +@@ -27583,40 +27599,40 @@ + + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- ++ + + +- +- ++ ++ + + + +- ++ + + + +- ++ + + +- ++ + + +- ++ + + + +@@ -27624,9 +27640,9 @@ + + + +- ++ + +- ++ + + + +@@ -27649,13 +27665,13 @@ + + + +- ++ + + + + +- +- ++ ++ + + + +@@ -27697,23 +27713,23 @@ + + + +- +- +- ++ ++ ++ + + +- ++ + +- ++ + + + + +- +- +- ++ ++ ++ + +- ++ + + + +@@ -27724,10 +27740,10 @@ + + + +- ++ + + +- ++ + + + +@@ -27750,18 +27766,18 @@ + + + +- ++ + + +- ++ + + + + +- ++ + + +- ++ + + + +@@ -27769,7 +27785,7 @@ + + + +- ++ + + + +@@ -27777,7 +27793,7 @@ + + + +- ++ + + + +@@ -27789,12 +27805,12 @@ + + + +- ++ + +- ++ + + +- ++ + + + +@@ -27803,30 +27819,30 @@ + + + +- ++ + + + + + +- +- +- ++ ++ ++ + + + + + +- ++ + +- ++ + + + + + + +- ++ + + + +@@ -27840,73 +27856,73 @@ + + + +- ++ + + + + +- ++ + + + +- +- ++ ++ + + +- ++ + + + +- +- ++ ++ + + +- +- ++ ++ + + +- ++ + + + +- +- ++ ++ + + +- ++ + + + +- +- ++ ++ + + +- ++ + + + +- +- ++ ++ + + +- +- ++ ++ + + +- ++ + + + +- ++ + + + +- ++ + + + + +- ++ + + + +@@ -27918,117 +27934,117 @@ + + + +- ++ + + + +- +- ++ ++ + + +- ++ + + + +- ++ + + + +- ++ + + + + + + +- ++ + + + +- ++ + + + +- ++ + + + +- ++ + + + + +- ++ + + + + + +- ++ + + +- ++ + + +- +- ++ ++ + + +- ++ + + + +- ++ + + + + +- ++ + + + + + +- ++ + + +- +- ++ ++ + + +- +- +- ++ ++ ++ + + +- +- ++ ++ + + +- ++ + +- ++ + + +- ++ + +- ++ + + +- ++ + + + +- ++ + +- ++ + + +- +- ++ ++ + + +- ++ + + + +@@ -28047,50 +28063,50 @@ + + + +- ++ + + + +- +- ++ ++ + + +- +- ++ ++ + + +- ++ + + + + + + +- +- ++ ++ + + + + + + +- ++ + + +- ++ + + + +- +- +- ++ ++ ++ + + +- ++ + + + +- ++ + + + +@@ -28098,16 +28114,16 @@ + + + +- +- ++ ++ + + +- +- ++ ++ + + +- +- ++ ++ + + + +@@ -28129,135 +28145,135 @@ + + + +- ++ + + + + + + +- ++ + + + +- +- ++ ++ + + +- ++ + + + +- ++ + + + +- ++ + + + +- ++ + + + +- ++ + + + +- ++ + +- ++ + + +- ++ + + +- ++ + + +- +- ++ ++ + +- ++ + + +- +- ++ ++ + + + +- ++ + +- ++ + + +- ++ + + +- ++ + + +- +- ++ ++ + + + +- +- ++ ++ + +- ++ + + +- ++ + +- ++ + + +- +- ++ ++ + + + + +- ++ + + + +- ++ + +- ++ + + +- ++ + + + +- +- ++ ++ + + +- ++ + + + +- ++ + + + +- +- ++ ++ + +- ++ + +- +- ++ ++ + + +- ++ + + + +- ++ + + + +@@ -28267,8 +28283,8 @@ + + + ++ + +- + + + +@@ -28283,7 +28299,7 @@ + + + +- ++ + + + +@@ -28292,58 +28308,58 @@ + + + +- +- ++ ++ + + +- ++ + + + +- ++ + + + +- ++ + + + +- ++ + + + +- ++ + + + +- +- ++ ++ + + +- +- ++ ++ + + +- ++ + + + +- ++ + + + +- ++ + + + +- ++ + + + +- ++ + + +- ++ + + + +@@ -28365,7 +28381,7 @@ + + + +- ++ + + + +@@ -28375,9 +28391,9 @@ + + + +- +- +- ++ ++ ++ + + + +@@ -28390,24 +28406,24 @@ + + + +- ++ + + + +- ++ + +- +- ++ ++ + + +- ++ + +- +- ++ ++ + + +- +- ++ ++ + + + +@@ -28417,13 +28433,13 @@ + + + +- ++ + + + + + +- ++ + + + +@@ -28435,7 +28451,7 @@ + + + +- ++ + + + +@@ -28443,7 +28459,7 @@ + + + +- ++ + + + +@@ -28457,27 +28473,27 @@ + + + +- ++ + + + + + +- ++ + + + +- ++ + + + ++ + +- + + + + +- ++ + + + +@@ -28485,59 +28501,59 @@ + + + +- ++ + + + +- ++ + + + +- +- ++ ++ + + +- ++ + + + + +- ++ + + +- ++ + + + + +- ++ + + + +- +- ++ ++ + + +- ++ + + + +- ++ + + + +- ++ + + + +- ++ + + + +- ++ + + +- ++ + + + +@@ -28547,7 +28563,7 @@ + + + +- ++ + + + +@@ -28586,83 +28602,83 @@ + + + +- ++ + + + + +- ++ + + +- ++ + + +- ++ + + + +- ++ + + + +- +- ++ ++ + + +- ++ + + + + +- ++ + + +- ++ + + + +- ++ + + + +- ++ + + + +- ++ + + + +- ++ + + + +- ++ + + + + + +- ++ + + +- +- ++ ++ + + +- ++ + + + + + + +- ++ + + + +- +- ++ ++ + + + +@@ -28670,52 +28686,52 @@ + + + +- ++ + + +- ++ + + + + + +- ++ + + + +- ++ + + + + +- ++ + + + +- ++ + + + + + + +- ++ + + +- ++ + + + + +- ++ + +- ++ + + + +- ++ + +- ++ + + + +@@ -28723,37 +28739,37 @@ + + + +- ++ + + + + +- ++ + + + + + +- +- ++ ++ + + + + +- ++ + + + + + +- +- +- ++ ++ ++ + + + + +- ++ + + + +@@ -28764,37 +28780,37 @@ + + + +- ++ + + + +- ++ + +- ++ + + + +- ++ + +- ++ + + + +- ++ + +- ++ + + + +- ++ + + +- ++ + + + + +- ++ + + + +@@ -28804,42 +28820,42 @@ + + + +- ++ + + + + + +- ++ + + + + + + +- ++ + + + + +- ++ + + + + +- ++ + + + + + +- ++ + +- ++ + + + +- ++ + + + +@@ -28847,7 +28863,7 @@ + + + +- ++ + + + +@@ -28856,21 +28872,21 @@ + + + +- ++ + + + + +- ++ + + + +- ++ + + + + +- ++ + + + +@@ -28896,21 +28912,21 @@ + + + +- ++ + + + +- ++ + + + + +- ++ + + + + +- ++ + + + +@@ -28922,11 +28938,11 @@ + + + +- ++ + + + +- ++ + + + +@@ -28955,173 +28971,173 @@ + + + +- ++ + + + + + +- +- +- ++ ++ ++ + + +- +- +- +- ++ ++ ++ ++ + + + +- ++ + + + + +- ++ + + +- +- ++ ++ + + + + +- ++ + + +- ++ + + + + +- +- ++ ++ + + + + +- +- +- ++ ++ ++ + + + + +- +- +- ++ ++ ++ + + + + +- ++ + + +- ++ + + + + +- ++ + +- ++ + + + +- ++ + +- ++ + + + +- ++ + + + +- +- +- ++ ++ ++ + + +- +- +- ++ ++ ++ + + + +- +- +- ++ ++ ++ + + + +- +- +- +- ++ ++ ++ ++ + + + +- +- ++ ++ + + + +- ++ + + + +- ++ + + + +- ++ + + + +- +- ++ ++ + + + +- ++ + + + +- +- ++ ++ + + + +- +- ++ ++ + + + +- +- ++ ++ + + +- ++ + +- +- +- ++ ++ ++ + + +- ++ + + + + +- ++ + + + + +- +- ++ ++ + + + +@@ -29134,7 +29150,7 @@ + + + +- ++ + + + +@@ -29142,66 +29158,66 @@ + + + +- +- ++ ++ + +- +- ++ ++ + + + +- +- ++ ++ + + + + + +- ++ + + + + + +- ++ + + + + + + +- ++ + +- ++ + + + + +- +- ++ ++ + + + + + +- ++ + + + +- ++ + + + +- +- ++ ++ + + + +- ++ + + + +- ++ + + + +@@ -29232,16 +29248,16 @@ + + + +- ++ + + + +- ++ + + + +- +- ++ ++ + + + +@@ -29259,7 +29275,7 @@ + + + +- ++ + + + +@@ -29276,8 +29292,8 @@ + + + +- +- ++ ++ + + + +@@ -29288,14 +29304,14 @@ + + + +- ++ + + + + + + +- ++ + + + +@@ -29308,9 +29324,9 @@ + + + +- ++ + +- ++ + + + +@@ -29325,38 +29341,33 @@ + + + +- ++ + + + + +- ++ + + + + + +- +- ++ ++ + + +- ++ + +- ++ + + + + + + +- +- +- +- +- +- +- ++ + ++ + + + +@@ -29364,21 +29375,21 @@ + + + +- ++ + +- +- ++ ++ + + + + +- +- ++ ++ + + + +- +- ++ ++ + + + +diff --git a/Doc/deprecations/c-api-pending-removal-in-3.15.rst b/Doc/deprecations/c-api-pending-removal-in-3.15.rst +index e3974415e0c..fcb703e66fe 100644 +--- a/Doc/deprecations/c-api-pending-removal-in-3.15.rst ++++ b/Doc/deprecations/c-api-pending-removal-in-3.15.rst +@@ -13,11 +13,11 @@ Pending Removal in Python 3.15 + * :c:func:`PySys_ResetWarnOptions`: + Clear :data:`sys.warnoptions` and :data:`!warnings.filters` instead. + * :c:func:`Py_GetExecPrefix`: +- Get :data:`sys.exec_prefix` instead. ++ Get :data:`sys.base_exec_prefix` and :data:`sys.exec_prefix` instead. + * :c:func:`Py_GetPath`: + Get :data:`sys.path` instead. + * :c:func:`Py_GetPrefix`: +- Get :data:`sys.prefix` instead. ++ Get :data:`sys.base_prefix` and :data:`sys.prefix` instead. + * :c:func:`Py_GetProgramFullPath`: + Get :data:`sys.executable` instead. + * :c:func:`Py_GetProgramName`: +diff --git a/Doc/deprecations/pending-removal-in-3.14.rst b/Doc/deprecations/pending-removal-in-3.14.rst +index 330b426deac..15606f61cf8 100644 +--- a/Doc/deprecations/pending-removal-in-3.14.rst ++++ b/Doc/deprecations/pending-removal-in-3.14.rst +@@ -96,16 +96,6 @@ Pending Removal in Python 3.14 + if :ref:`named placeholders ` are used and + *parameters* is a sequence instead of a :class:`dict`. + +- * date and datetime adapter, date and timestamp converter: +- see the :mod:`sqlite3` documentation for suggested replacement recipes. +- +-* :class:`types.CodeType`: Accessing :attr:`~codeobject.co_lnotab` was +- deprecated in :pep:`626` +- since 3.10 and was planned to be removed in 3.12, +- but it only got a proper :exc:`DeprecationWarning` in 3.12. +- May be removed in 3.14. +- (Contributed by Nikita Sobolev in :gh:`101866`.) +- + * :mod:`typing`: :class:`~typing.ByteString`, deprecated since Python 3.9, + now causes a :exc:`DeprecationWarning` to be emitted when it is used. + +diff --git a/Doc/deprecations/pending-removal-in-3.15.rst b/Doc/deprecations/pending-removal-in-3.15.rst +index b921b4f97d5..f0b184b6c80 100644 +--- a/Doc/deprecations/pending-removal-in-3.15.rst ++++ b/Doc/deprecations/pending-removal-in-3.15.rst +@@ -1,6 +1,18 @@ + Pending Removal in Python 3.15 + ------------------------------ + ++* The import system: ++ ++ * Setting :attr:`~module.__cached__` on a module while ++ failing to set :attr:`__spec__.cached ` ++ is deprecated. In Python 3.15, :attr:`!__cached__` will cease to be set or ++ take into consideration by the import system or standard library. (:gh:`97879`) ++ ++ * Setting :attr:`~module.__package__` on a module while ++ failing to set :attr:`__spec__.parent ` ++ is deprecated. In Python 3.15, :attr:`!__package__` will cease to be set or ++ take into consideration by the import system or standard library. (:gh:`97879`) ++ + * :mod:`ctypes`: + + * The undocumented :func:`!ctypes.SetPointerType` function +@@ -17,9 +29,6 @@ Pending Removal in Python 3.15 + * The :option:`!--cgi` flag to the :program:`python -m http.server` + command-line interface has been deprecated since Python 3.13. + +-* :mod:`importlib`: ``__package__`` and ``__cached__`` will cease to be set or +- taken into consideration by the import system (:gh:`97879`). +- + * :class:`locale`: + + * The :func:`~locale.getdefaultlocale` function +@@ -50,6 +59,15 @@ Pending Removal in Python 3.15 + but the C version allows any number of positional or keyword arguments, + ignoring every argument. + ++* :mod:`types`: ++ ++ * :class:`types.CodeType`: Accessing :attr:`~codeobject.co_lnotab` was ++ deprecated in :pep:`626` ++ since 3.10 and was planned to be removed in 3.12, ++ but it only got a proper :exc:`DeprecationWarning` in 3.12. ++ May be removed in 3.15. ++ (Contributed by Nikita Sobolev in :gh:`101866`.) ++ + * :mod:`typing`: + + * The undocumented keyword argument syntax for creating +diff --git a/Doc/deprecations/pending-removal-in-3.16.rst b/Doc/deprecations/pending-removal-in-3.16.rst +index 446cc63cb34..6f6954b783a 100644 +--- a/Doc/deprecations/pending-removal-in-3.16.rst ++++ b/Doc/deprecations/pending-removal-in-3.16.rst +@@ -1,14 +1,12 @@ +-Pending Removal in Python 3.16 ++Pending removal in Python 3.16 + ------------------------------ + +-* :mod:`builtins`: ++* The import system: + +- * Bitwise inversion on boolean types, ``~True`` or ``~False`` +- has been deprecated since Python 3.12, +- as it produces surprising and unintuitive results (``-2`` and ``-1``). +- Use ``not x`` instead for the logical negation of a Boolean. +- In the rare case that you need the bitwise inversion of +- the underlying integer, convert to ``int`` explicitly (``~int(x)``). ++ * Setting :attr:`~module.__loader__` on a module while ++ failing to set :attr:`__spec__.loader ` ++ is deprecated. In Python 3.16, :attr:`!__loader__` will cease to be set or ++ taken into consideration by the import system or the standard library. + + * :mod:`array`: + +@@ -18,6 +16,22 @@ Pending Removal in Python 3.16 + Use the ``'w'`` format code (:c:type:`Py_UCS4`) + for Unicode characters instead. + ++* :mod:`asyncio`: ++ ++ * :func:`!asyncio.iscoroutinefunction` is deprecated ++ and will be removed in Python 3.16, ++ use :func:`inspect.iscoroutinefunction` instead. ++ (Contributed by Jiahao Li and Kumar Aditya in :gh:`122875`.) ++ ++* :mod:`builtins`: ++ ++ * Bitwise inversion on boolean types, ``~True`` or ``~False`` ++ has been deprecated since Python 3.12, ++ as it produces surprising and unintuitive results (``-2`` and ``-1``). ++ Use ``not x`` instead for the logical negation of a Boolean. ++ In the rare case that you need the bitwise inversion of ++ the underlying integer, convert to ``int`` explicitly (``~int(x)``). ++ + * :mod:`shutil`: + + * The :class:`!ExecError` exception +diff --git a/Doc/glossary.rst b/Doc/glossary.rst +index 17461e23e71..5c56c419514 100644 +--- a/Doc/glossary.rst ++++ b/Doc/glossary.rst +@@ -226,6 +226,28 @@ Glossary + A variable defined in a class and intended to be modified only at + class level (i.e., not in an instance of the class). + ++ closure variable ++ A :term:`free variable` referenced from a :term:`nested scope` that is defined in an outer ++ scope rather than being resolved at runtime from the globals or builtin namespaces. ++ May be explicitly defined with the :keyword:`nonlocal` keyword to allow write access, ++ or implicitly defined if the variable is only being read. ++ ++ For example, in the ``inner`` function in the following code, both ``x`` and ``print`` are ++ :term:`free variables `, but only ``x`` is a *closure variable*:: ++ ++ def outer(): ++ x = 0 ++ def inner(): ++ nonlocal x ++ x += 1 ++ print(x) ++ return inner ++ ++ Due to the :attr:`codeobject.co_freevars` attribute (which, despite its name, only ++ includes the names of closure variables rather than listing all referenced free ++ variables), the more general :term:`free variable` term is sometimes used even ++ when the intended meaning is to refer specifically to closure variables. ++ + complex number + An extension of the familiar real number system in which all numbers are + expressed as a sum of a real part and an imaginary part. Imaginary +@@ -238,19 +260,33 @@ Glossary + advanced mathematical feature. If you're not aware of a need for them, + it's almost certain you can safely ignore them. + ++ context ++ This term has different meanings depending on where and how it is used. ++ Some common meanings: ++ ++ * The temporary state or environment established by a :term:`context ++ manager` via a :keyword:`with` statement. ++ * The collection of key­value bindings associated with a particular ++ :class:`contextvars.Context` object and accessed via ++ :class:`~contextvars.ContextVar` objects. Also see :term:`context ++ variable`. ++ * A :class:`contextvars.Context` object. Also see :term:`current ++ context`. ++ ++ context management protocol ++ The :meth:`~object.__enter__` and :meth:`~object.__exit__` methods called ++ by the :keyword:`with` statement. See :pep:`343`. ++ + context manager +- An object which controls the environment seen in a :keyword:`with` +- statement by defining :meth:`~object.__enter__` and :meth:`~object.__exit__` methods. +- See :pep:`343`. ++ An object which implements the :term:`context management protocol` and ++ controls the environment seen in a :keyword:`with` statement. See ++ :pep:`343`. + + context variable +- A variable which can have different values depending on its context. +- This is similar to Thread-Local Storage in which each execution +- thread may have a different value for a variable. However, with context +- variables, there may be several contexts in one execution thread and the +- main usage for context variables is to keep track of variables in ++ A variable whose value depends on which context is the :term:`current ++ context`. Values are accessed via :class:`contextvars.ContextVar` ++ objects. Context variables are primarily used to isolate state between + concurrent asynchronous tasks. +- See :mod:`contextvars`. + + contiguous + .. index:: C-contiguous, Fortran contiguous +@@ -284,6 +320,14 @@ Glossary + is used when necessary to distinguish this implementation from others + such as Jython or IronPython. + ++ current context ++ The :term:`context` (:class:`contextvars.Context` object) that is ++ currently used by :class:`~contextvars.ContextVar` objects to access (get ++ or set) the values of :term:`context variables `. Each ++ thread has its own current context. Frameworks for executing asynchronous ++ tasks (see :mod:`asyncio`) associate each task with a context which ++ becomes the current context whenever the task starts or resumes execution. ++ + decorator + A function returning another function, usually applied as a function + transformation using the ``@wrapper`` syntax. Common examples for +@@ -429,7 +473,7 @@ Glossary + ` for use with :data:`sys.meta_path`, and :term:`path + entry finders ` for use with :data:`sys.path_hooks`. + +- See :ref:`importsystem` and :mod:`importlib` for much more detail. ++ See :ref:`finders-and-loaders` and :mod:`importlib` for much more detail. + + floor division + Mathematical division that rounds down to nearest integer. The floor +@@ -444,6 +488,13 @@ Glossary + the :term:`global interpreter lock` which allows only one thread to + execute Python bytecode at a time. See :pep:`703`. + ++ free variable ++ Formally, as defined in the :ref:`language execution model `, a free ++ variable is any variable used in a namespace which is not a local variable in that ++ namespace. See :term:`closure variable` for an example. ++ Pragmatically, due to the name of the :attr:`codeobject.co_freevars` attribute, ++ the term is also sometimes used as a synonym for :term:`closure variable`. ++ + function + A series of statements which returns some value to a caller. It can also + be passed zero or more :term:`arguments ` which may be used in +@@ -556,7 +607,7 @@ Glossary + + As of Python 3.13, the GIL can be disabled using the :option:`--disable-gil` + build configuration. After building Python with this option, code must be +- run with :option:`-X gil 0 <-X>` or after setting the :envvar:`PYTHON_GIL=0 ` ++ run with :option:`-X gil=0 <-X>` or after setting the :envvar:`PYTHON_GIL=0 ` + environment variable. This feature enables improved performance for + multi-threaded applications and makes it easier to use multi-core CPUs + efficiently. For more details, see :pep:`703`. +@@ -752,8 +803,11 @@ Glossary + loader + An object that loads a module. It must define a method named + :meth:`load_module`. A loader is typically returned by a +- :term:`finder`. See :pep:`302` for details and +- :class:`importlib.abc.Loader` for an :term:`abstract base class`. ++ :term:`finder`. See also: ++ ++ * :ref:`finders-and-loaders` ++ * :class:`importlib.abc.Loader` ++ * :pep:`302` + + locale encoding + On Unix, it is the encoding of the LC_CTYPE locale. It can be set with +@@ -823,6 +877,8 @@ Glossary + A namespace containing the import-related information used to load a + module. An instance of :class:`importlib.machinery.ModuleSpec`. + ++ See also :ref:`module-specs`. ++ + MRO + See :term:`method resolution order`. + +diff --git a/Doc/howto/argparse-optparse.rst b/Doc/howto/argparse-optparse.rst +new file mode 100644 +index 00000000000..cef2d893b28 +--- /dev/null ++++ b/Doc/howto/argparse-optparse.rst +@@ -0,0 +1,55 @@ ++.. currentmodule:: argparse ++ ++.. _upgrading-optparse-code: ++ ++========================== ++Upgrading optparse code ++========================== ++ ++Originally, the :mod:`argparse` module had attempted to maintain compatibility ++with :mod:`optparse`. However, :mod:`optparse` was difficult to extend ++transparently, particularly with the changes required to support ++``nargs=`` specifiers and better usage messages. When most everything in ++:mod:`optparse` had either been copy-pasted over or monkey-patched, it no ++longer seemed practical to try to maintain the backwards compatibility. ++ ++The :mod:`argparse` module improves on the :mod:`optparse` ++module in a number of ways including: ++ ++* Handling positional arguments. ++* Supporting subcommands. ++* Allowing alternative option prefixes like ``+`` and ``/``. ++* Handling zero-or-more and one-or-more style arguments. ++* Producing more informative usage messages. ++* Providing a much simpler interface for custom ``type`` and ``action``. ++ ++A partial upgrade path from :mod:`optparse` to :mod:`argparse`: ++ ++* Replace all :meth:`optparse.OptionParser.add_option` calls with ++ :meth:`ArgumentParser.add_argument` calls. ++ ++* Replace ``(options, args) = parser.parse_args()`` with ``args = ++ parser.parse_args()`` and add additional :meth:`ArgumentParser.add_argument` ++ calls for the positional arguments. Keep in mind that what was previously ++ called ``options``, now in the :mod:`argparse` context is called ``args``. ++ ++* Replace :meth:`optparse.OptionParser.disable_interspersed_args` ++ by using :meth:`~ArgumentParser.parse_intermixed_args` instead of ++ :meth:`~ArgumentParser.parse_args`. ++ ++* Replace callback actions and the ``callback_*`` keyword arguments with ++ ``type`` or ``action`` arguments. ++ ++* Replace string names for ``type`` keyword arguments with the corresponding ++ type objects (e.g. int, float, complex, etc). ++ ++* Replace :class:`optparse.Values` with :class:`Namespace` and ++ :exc:`optparse.OptionError` and :exc:`optparse.OptionValueError` with ++ :exc:`ArgumentError`. ++ ++* Replace strings with implicit arguments such as ``%default`` or ``%prog`` with ++ the standard Python syntax to use dictionaries to format strings, that is, ++ ``%(default)s`` and ``%(prog)s``. ++ ++* Replace the OptionParser constructor ``version`` argument with a call to ++ ``parser.add_argument('--version', action='version', version='')``. +diff --git a/Doc/howto/argparse.rst b/Doc/howto/argparse.rst +index 30d9ac70037..1efbee64d60 100644 +--- a/Doc/howto/argparse.rst ++++ b/Doc/howto/argparse.rst +@@ -841,6 +841,53 @@ translated messages. + + To translate your own strings in the :mod:`argparse` output, use :mod:`gettext`. + ++Custom type converters ++====================== ++ ++The :mod:`argparse` module allows you to specify custom type converters for ++your command-line arguments. This allows you to modify user input before it's ++stored in the :class:`argparse.Namespace`. This can be useful when you need to ++pre-process the input before it is used in your program. ++ ++When using a custom type converter, you can use any callable that takes a ++single string argument (the argument value) and returns the converted value. ++However, if you need to handle more complex scenarios, you can use a custom ++action class with the **action** parameter instead. ++ ++For example, let's say you want to handle arguments with different prefixes and ++process them accordingly:: ++ ++ import argparse ++ ++ parser = argparse.ArgumentParser(prefix_chars='-+') ++ ++ parser.add_argument('-a', metavar='', action='append', ++ type=lambda x: ('-', x)) ++ parser.add_argument('+a', metavar='', action='append', ++ type=lambda x: ('+', x)) ++ ++ args = parser.parse_args() ++ print(args) ++ ++Output: ++ ++.. code-block:: shell-session ++ ++ $ python prog.py -a value1 +a value2 ++ Namespace(a=[('-', 'value1'), ('+', 'value2')]) ++ ++In this example, we: ++ ++* Created a parser with custom prefix characters using the ``prefix_chars`` ++ parameter. ++ ++* Defined two arguments, ``-a`` and ``+a``, which used the ``type`` parameter to ++ create custom type converters to store the value in a tuple with the prefix. ++ ++Without the custom type converters, the arguments would have treated the ``-a`` ++and ``+a`` as the same argument, which would have been undesirable. By using custom ++type converters, we were able to differentiate between the two arguments. ++ + Conclusion + ========== + +diff --git a/Doc/howto/logging-cookbook.rst b/Doc/howto/logging-cookbook.rst +index 96768ec4ae3..849a7526d40 100644 +--- a/Doc/howto/logging-cookbook.rst ++++ b/Doc/howto/logging-cookbook.rst +@@ -1267,11 +1267,8 @@ to adapt in your own applications. + + You could also write your own handler which uses the :class:`~multiprocessing.Lock` + class from the :mod:`multiprocessing` module to serialize access to the +-file from your processes. The existing :class:`FileHandler` and subclasses do +-not make use of :mod:`multiprocessing` at present, though they may do so in the +-future. Note that at present, the :mod:`multiprocessing` module does not provide +-working lock functionality on all platforms (see +-https://bugs.python.org/issue3770). ++file from your processes. The stdlib :class:`FileHandler` and subclasses do ++not make use of :mod:`multiprocessing`. + + .. currentmodule:: logging.handlers + +diff --git a/Doc/library/_thread.rst b/Doc/library/_thread.rst +index 5fd604c0538..6a66fc4c64b 100644 +--- a/Doc/library/_thread.rst ++++ b/Doc/library/_thread.rst +@@ -219,9 +219,11 @@ In addition to these methods, lock objects can also be used via the + * Calling :func:`sys.exit` or raising the :exc:`SystemExit` exception is + equivalent to calling :func:`_thread.exit`. + +-* It is not possible to interrupt the :meth:`~threading.Lock.acquire` method on +- a lock --- the :exc:`KeyboardInterrupt` exception will happen after the lock +- has been acquired. ++* It is platform-dependent whether the :meth:`~threading.Lock.acquire` method ++ on a lock can be interrupted (so that the :exc:`KeyboardInterrupt` exception ++ will happen immediately, rather than only after the lock has been acquired or ++ the operation has timed out). It can be interrupted on POSIX, but not on ++ Windows. + + * When the main thread exits, it is system defined whether the other threads + survive. On most systems, they are killed without executing +diff --git a/Doc/library/argparse.rst b/Doc/library/argparse.rst +index 53ecc97d565..00fd661fd3c 100644 +--- a/Doc/library/argparse.rst ++++ b/Doc/library/argparse.rst +@@ -1,4 +1,4 @@ +-:mod:`!argparse` --- Parser for command-line options, arguments and sub-commands ++:mod:`!argparse` --- Parser for command-line options, arguments and subcommands + ================================================================================ + + .. module:: argparse +@@ -19,17 +19,13 @@ + introduction to Python command-line parsing, have a look at the + :ref:`argparse tutorial `. + +-The :mod:`argparse` module makes it easy to write user-friendly command-line +-interfaces. The program defines what arguments it requires, and :mod:`argparse` +-will figure out how to parse those out of :data:`sys.argv`. The :mod:`argparse` ++The :mod:`!argparse` module makes it easy to write user-friendly command-line ++interfaces. The program defines what arguments it requires, and :mod:`!argparse` ++will figure out how to parse those out of :data:`sys.argv`. The :mod:`!argparse` + module also automatically generates help and usage messages. The module + will also issue errors when users give the program invalid arguments. + +- +-Core Functionality +------------------- +- +-The :mod:`argparse` module's support for command-line interfaces is built ++The :mod:`!argparse` module's support for command-line interfaces is built + around an instance of :class:`argparse.ArgumentParser`. It is a container for + argument specifications and has options that apply to the parser as whole:: + +@@ -53,133 +49,9 @@ the extracted data in a :class:`argparse.Namespace` object:: + args = parser.parse_args() + print(args.filename, args.count, args.verbose) + +- +-Quick Links for add_argument() +------------------------------- +- +-============================ =========================================================== ========================================================================================================================== +-Name Description Values +-============================ =========================================================== ========================================================================================================================== +-action_ Specify how an argument should be handled ``'store'``, ``'store_const'``, ``'store_true'``, ``'append'``, ``'append_const'``, ``'count'``, ``'help'``, ``'version'`` +-choices_ Limit values to a specific set of choices ``['foo', 'bar']``, ``range(1, 10)``, or :class:`~collections.abc.Container` instance +-const_ Store a constant value +-default_ Default value used when an argument is not provided Defaults to ``None`` +-dest_ Specify the attribute name used in the result namespace +-help_ Help message for an argument +-metavar_ Alternate display name for the argument as shown in help +-nargs_ Number of times the argument can be used :class:`int`, ``'?'``, ``'*'``, or ``'+'`` +-required_ Indicate whether an argument is required or optional ``True`` or ``False`` +-:ref:`type ` Automatically convert an argument to the given type :class:`int`, :class:`float`, ``argparse.FileType('w')``, or callable function +-============================ =========================================================== ========================================================================================================================== +- +- +-Example +-------- +- +-The following code is a Python program that takes a list of integers and +-produces either the sum or the max:: +- +- import argparse +- +- parser = argparse.ArgumentParser(description='Process some integers.') +- parser.add_argument('integers', metavar='N', type=int, nargs='+', +- help='an integer for the accumulator') +- parser.add_argument('--sum', dest='accumulate', action='store_const', +- const=sum, default=max, +- help='sum the integers (default: find the max)') +- +- args = parser.parse_args() +- print(args.accumulate(args.integers)) +- +-Assuming the above Python code is saved into a file called ``prog.py``, it can +-be run at the command line and it provides useful help messages: +- +-.. code-block:: shell-session +- +- $ python prog.py -h +- usage: prog.py [-h] [--sum] N [N ...] +- +- Process some integers. +- +- positional arguments: +- N an integer for the accumulator +- +- options: +- -h, --help show this help message and exit +- --sum sum the integers (default: find the max) +- +-When run with the appropriate arguments, it prints either the sum or the max of +-the command-line integers: +- +-.. code-block:: shell-session +- +- $ python prog.py 1 2 3 4 +- 4 +- +- $ python prog.py 1 2 3 4 --sum +- 10 +- +-If invalid arguments are passed in, an error will be displayed: +- +-.. code-block:: shell-session +- +- $ python prog.py a b c +- usage: prog.py [-h] [--sum] N [N ...] +- prog.py: error: argument N: invalid int value: 'a' +- +-The following sections walk you through this example. +- +- +-Creating a parser +-^^^^^^^^^^^^^^^^^ +- +-The first step in using the :mod:`argparse` is creating an +-:class:`ArgumentParser` object:: +- +- >>> parser = argparse.ArgumentParser(description='Process some integers.') +- +-The :class:`ArgumentParser` object will hold all the information necessary to +-parse the command line into Python data types. +- +- +-Adding arguments +-^^^^^^^^^^^^^^^^ +- +-Filling an :class:`ArgumentParser` with information about program arguments is +-done by making calls to the :meth:`~ArgumentParser.add_argument` method. +-Generally, these calls tell the :class:`ArgumentParser` how to take the strings +-on the command line and turn them into objects. This information is stored and +-used when :meth:`~ArgumentParser.parse_args` is called. For example:: +- +- >>> parser.add_argument('integers', metavar='N', type=int, nargs='+', +- ... help='an integer for the accumulator') +- >>> parser.add_argument('--sum', dest='accumulate', action='store_const', +- ... const=sum, default=max, +- ... help='sum the integers (default: find the max)') +- +-Later, calling :meth:`~ArgumentParser.parse_args` will return an object with +-two attributes, ``integers`` and ``accumulate``. The ``integers`` attribute +-will be a list of one or more integers, and the ``accumulate`` attribute will be +-either the :func:`sum` function, if ``--sum`` was specified at the command line, +-or the :func:`max` function if it was not. +- +- +-Parsing arguments +-^^^^^^^^^^^^^^^^^ +- +-:class:`ArgumentParser` parses arguments through the +-:meth:`~ArgumentParser.parse_args` method. This will inspect the command line, +-convert each argument to the appropriate type and then invoke the appropriate action. +-In most cases, this means a simple :class:`Namespace` object will be built up from +-attributes parsed out of the command line:: +- +- >>> parser.parse_args(['--sum', '7', '-1', '42']) +- Namespace(accumulate=, integers=[7, -1, 42]) +- +-In a script, :meth:`~ArgumentParser.parse_args` will typically be called with no +-arguments, and the :class:`ArgumentParser` will automatically determine the +-command-line arguments from :data:`sys.argv`. +- ++.. note:: ++ If you're looking for a guide about how to upgrade :mod:`optparse` code ++ to :mod:`!argparse`, see :ref:`Upgrading Optparse Code `. + + ArgumentParser objects + ---------------------- +@@ -228,7 +100,7 @@ ArgumentParser objects + * allow_abbrev_ - Allows long options to be abbreviated if the + abbreviation is unambiguous. (default: ``True``) + +- * exit_on_error_ - Determines whether or not ArgumentParser exits with ++ * exit_on_error_ - Determines whether or not :class:`!ArgumentParser` exits with + error info when an error occurs. (default: ``True``) + + .. versionchanged:: 3.5 +@@ -249,39 +121,21 @@ The following sections describe how each of these are used. + prog + ^^^^ + +-By default, :class:`ArgumentParser` objects use the base name +-(see :func:`os.path.basename`) of ``sys.argv[0]`` to determine +-how to display the name of the program in help messages. This default is almost +-always desirable because it will make the help messages match the name that was +-used to invoke the program on the command line. For example, consider a file +-named ``myprogram.py`` with the following code:: +- +- import argparse +- parser = argparse.ArgumentParser() +- parser.add_argument('--foo', help='foo help') +- args = parser.parse_args() +- +-The help for this program will display ``myprogram.py`` as the program name +-(regardless of where the program was invoked from): +- +-.. code-block:: shell-session + +- $ python myprogram.py --help +- usage: myprogram.py [-h] [--foo FOO] ++By default, :class:`ArgumentParser` calculates the name of the program ++to display in help messages depending on the way the Python interpreter was run: + +- options: +- -h, --help show this help message and exit +- --foo FOO foo help +- $ cd .. +- $ python subdir/myprogram.py --help +- usage: myprogram.py [-h] [--foo FOO] +- +- options: +- -h, --help show this help message and exit +- --foo FOO foo help ++* The :func:`base name ` of ``sys.argv[0]`` if a file was ++ passed as argument. ++* The Python interpreter name followed by ``sys.argv[0]`` if a directory or ++ a zipfile was passed as argument. ++* The Python interpreter name followed by ``-m`` followed by the ++ module or package name if the :option:`-m` option was used. + +-To change this default behavior, another value can be supplied using the +-``prog=`` argument to :class:`ArgumentParser`:: ++This default is almost always desirable because it will make the help messages ++match the string that was used to invoke the program on the command line. ++However, to change this default behavior, another value can be supplied using ++the ``prog=`` argument to :class:`ArgumentParser`:: + + >>> parser = argparse.ArgumentParser(prog='myprogram') + >>> parser.print_help() +@@ -310,22 +164,8 @@ usage + ^^^^^ + + By default, :class:`ArgumentParser` calculates the usage message from the +-arguments it contains:: +- +- >>> parser = argparse.ArgumentParser(prog='PROG') +- >>> parser.add_argument('--foo', nargs='?', help='foo help') +- >>> parser.add_argument('bar', nargs='+', help='bar help') +- >>> parser.print_help() +- usage: PROG [-h] [--foo [FOO]] bar [bar ...] +- +- positional arguments: +- bar bar help +- +- options: +- -h, --help show this help message and exit +- --foo [FOO] foo help +- +-The default message can be overridden with the ``usage=`` keyword argument:: ++arguments it contains. The default message can be overridden with the ++``usage=`` keyword argument:: + + >>> parser = argparse.ArgumentParser(prog='PROG', usage='%(prog)s [options]') + >>> parser.add_argument('--foo', nargs='?', help='foo help') +@@ -353,16 +193,7 @@ Most calls to the :class:`ArgumentParser` constructor will use the + ``description=`` keyword argument. This argument gives a brief description of + what the program does and how it works. In help messages, the description is + displayed between the command-line usage string and the help messages for the +-various arguments:: +- +- >>> parser = argparse.ArgumentParser(description='A foo that bars') +- >>> parser.print_help() +- usage: argparse.py [-h] +- +- A foo that bars +- +- options: +- -h, --help show this help message and exit ++various arguments. + + By default, the description will be line-wrapped so that it fits within the + given space. To change this behavior, see the formatter_class_ argument. +@@ -492,7 +323,7 @@ should not be line-wrapped:: + -h, --help show this help message and exit + + :class:`RawTextHelpFormatter` maintains whitespace for all sorts of help text, +-including argument descriptions. However, multiple new lines are replaced with ++including argument descriptions. However, multiple newlines are replaced with + one. If you wish to preserve multiple blank lines, add spaces between the + newlines. + +@@ -541,7 +372,7 @@ Most command-line options will use ``-`` as the prefix, e.g. ``-f/--foo``. + Parsers that need to support different or additional prefix + characters, e.g. for options + like ``+f`` or ``/foo``, may specify them using the ``prefix_chars=`` argument +-to the ArgumentParser constructor:: ++to the :class:`ArgumentParser` constructor:: + + >>> parser = argparse.ArgumentParser(prog='PROG', prefix_chars='-+') + >>> parser.add_argument('+f') +@@ -586,8 +417,8 @@ arguments will never be treated as file references. + + .. versionchanged:: 3.12 + :class:`ArgumentParser` changed encoding and errors to read arguments files +- from default (e.g. :func:`locale.getpreferredencoding(False) ` and +- ``"strict"``) to :term:`filesystem encoding and error handler`. ++ from default (e.g. :func:`locale.getpreferredencoding(False) ` ++ and ``"strict"``) to the :term:`filesystem encoding and error handler`. + Arguments file should be encoded in UTF-8 instead of ANSI Codepage on Windows. + + +@@ -672,26 +503,9 @@ string was overridden. + add_help + ^^^^^^^^ + +-By default, ArgumentParser objects add an option which simply displays +-the parser's help message. For example, consider a file named +-``myprogram.py`` containing the following code:: +- +- import argparse +- parser = argparse.ArgumentParser() +- parser.add_argument('--foo', help='foo help') +- args = parser.parse_args() +- +-If ``-h`` or ``--help`` is supplied at the command line, the ArgumentParser +-help will be printed: +- +-.. code-block:: shell-session +- +- $ python myprogram.py --help +- usage: myprogram.py [-h] [--foo FOO] +- +- options: +- -h, --help show this help message and exit +- --foo FOO foo help ++By default, :class:`ArgumentParser` objects add an option which simply displays ++the parser's help message. If ``-h`` or ``--help`` is supplied at the command ++line, the :class:`!ArgumentParser` help will be printed. + + Occasionally, it may be useful to disable the addition of this help option. + This can be achieved by passing ``False`` as the ``add_help=`` argument to +@@ -723,7 +537,8 @@ exit_on_error + ^^^^^^^^^^^^^ + + Normally, when you pass an invalid argument list to the :meth:`~ArgumentParser.parse_args` +-method of an :class:`ArgumentParser`, it will exit with error info. ++method of an :class:`ArgumentParser`, it will print a *message* to :data:`sys.stderr` and exit with a status ++code of 2. + + If the user would like to catch errors manually, the feature can be enabled by setting + ``exit_on_error`` to ``False``:: +@@ -744,15 +559,15 @@ If the user would like to catch errors manually, the feature can be enabled by s + The add_argument() method + ------------------------- + +-.. method:: ArgumentParser.add_argument(name or flags..., [action], [nargs], \ ++.. method:: ArgumentParser.add_argument(name or flags..., *, [action], [nargs], \ + [const], [default], [type], [choices], [required], \ + [help], [metavar], [dest], [deprecated]) + + Define how a single command-line argument should be parsed. Each parameter + has its own more detailed description below, but in short they are: + +- * `name or flags`_ - Either a name or a list of option strings, e.g. ``foo`` +- or ``-f, --foo``. ++ * `name or flags`_ - Either a name or a list of option strings, e.g. ``'foo'`` ++ or ``'-f', '--foo'``. + + * action_ - The basic type of action to be taken when this argument is + encountered at the command line. +@@ -783,7 +598,7 @@ The add_argument() method + The following sections describe how each of these are used. + + +-.. _name_or_flags: ++.. _`name or flags`: + + name or flags + ^^^^^^^^^^^^^ +@@ -830,12 +645,7 @@ them, though most actions simply add an attribute to the object returned by + how the command-line arguments should be handled. The supplied actions are: + + * ``'store'`` - This just stores the argument's value. This is the default +- action. For example:: +- +- >>> parser = argparse.ArgumentParser() +- >>> parser.add_argument('--foo') +- >>> parser.parse_args('--foo 1'.split()) +- Namespace(foo='1') ++ action. + + * ``'store_const'`` - This stores the value specified by the const_ keyword + argument; note that the const_ keyword argument defaults to ``None``. The +@@ -850,7 +660,7 @@ how the command-line arguments should be handled. The supplied actions are: + * ``'store_true'`` and ``'store_false'`` - These are special cases of + ``'store_const'`` used for storing the values ``True`` and ``False`` + respectively. In addition, they create default values of ``False`` and +- ``True`` respectively. For example:: ++ ``True`` respectively:: + + >>> parser = argparse.ArgumentParser() + >>> parser.add_argument('--foo', action='store_true') +@@ -882,6 +692,21 @@ how the command-line arguments should be handled. The supplied actions are: + >>> parser.parse_args('--str --int'.split()) + Namespace(types=[, ]) + ++* ``'extend'`` - This stores a list and appends each item from the multi-value ++ argument list to it. ++ The ``'extend'`` action is typically used with the nargs_ keyword argument ++ value ``'+'`` or ``'*'``. ++ Note that when nargs_ is ``None`` (the default) or ``'?'``, each ++ character of the argument string will be appended to the list. ++ Example usage:: ++ ++ >>> parser = argparse.ArgumentParser() ++ >>> parser.add_argument("--foo", action="extend", nargs="+", type=str) ++ >>> parser.parse_args(["--foo", "f1", "--foo", "f2", "f3", "f4"]) ++ Namespace(foo=['f1', 'f2', 'f3', 'f4']) ++ ++ .. versionadded:: 3.8 ++ + * ``'count'`` - This counts the number of times a keyword argument occurs. For + example, this is useful for increasing verbosity levels:: + +@@ -907,33 +732,27 @@ how the command-line arguments should be handled. The supplied actions are: + >>> parser.parse_args(['--version']) + PROG 2.0 + +-* ``'extend'`` - This stores a list, and extends each argument value to the +- list. +- Example usage:: +- +- >>> parser = argparse.ArgumentParser() +- >>> parser.add_argument("--foo", action="extend", nargs="+", type=str) +- >>> parser.parse_args(["--foo", "f1", "--foo", "f2", "f3", "f4"]) +- Namespace(foo=['f1', 'f2', 'f3', 'f4']) ++Only actions that consume command-line arguments (e.g. ``'store'``, ++``'append'`` or ``'extend'``) can be used with positional arguments. + +- .. versionadded:: 3.8 ++.. class:: BooleanOptionalAction + +-You may also specify an arbitrary action by passing an Action subclass or +-other object that implements the same interface. The ``BooleanOptionalAction`` +-is available in ``argparse`` and adds support for boolean actions such as +-``--foo`` and ``--no-foo``:: ++ You may also specify an arbitrary action by passing an :class:`Action` subclass or ++ other object that implements the same interface. The :class:`!BooleanOptionalAction` ++ is available in :mod:`!argparse` and adds support for boolean actions such as ++ ``--foo`` and ``--no-foo``:: + +- >>> import argparse +- >>> parser = argparse.ArgumentParser() +- >>> parser.add_argument('--foo', action=argparse.BooleanOptionalAction) +- >>> parser.parse_args(['--no-foo']) +- Namespace(foo=False) ++ >>> import argparse ++ >>> parser = argparse.ArgumentParser() ++ >>> parser.add_argument('--foo', action=argparse.BooleanOptionalAction) ++ >>> parser.parse_args(['--no-foo']) ++ Namespace(foo=False) + +-.. versionadded:: 3.9 ++ .. versionadded:: 3.9 + + The recommended way to create a custom action is to extend :class:`Action`, +-overriding the ``__call__`` method and optionally the ``__init__`` and +-``format_usage`` methods. ++overriding the :meth:`!__call__` method and optionally the :meth:`!__init__` and ++:meth:`!format_usage` methods. + + An example of a custom action:: + +@@ -963,7 +782,7 @@ For more details, see :class:`Action`. + nargs + ^^^^^ + +-ArgumentParser objects usually associate a single command-line argument with a ++:class:`ArgumentParser` objects usually associate a single command-line argument with a + single action to be taken. The ``nargs`` keyword argument associates a + different number of command-line arguments with a single action. + See also :ref:`specifying-ambiguous-arguments`. The supported values are: +@@ -1045,6 +864,8 @@ See also :ref:`specifying-ambiguous-arguments`. The supported values are: + If the ``nargs`` keyword argument is not provided, the number of arguments consumed + is determined by the action_. Generally this means a single command-line argument + will be consumed and a single item (not a list) will be produced. ++Actions that do not consume command-line arguments (e.g. ++``'store_const'``) set ``nargs=0``. + + + .. _const: +@@ -1095,7 +916,7 @@ was not present at the command line:: + Namespace(foo=42) + + If the target namespace already has an attribute set, the action *default* +-will not over write it:: ++will not overwrite it:: + + >>> parser = argparse.ArgumentParser() + >>> parser.add_argument('--foo', default=42) +@@ -1169,7 +990,6 @@ Common built-in types and functions can be used as type converters: + parser.add_argument('distance', type=float) + parser.add_argument('street', type=ascii) + parser.add_argument('code_point', type=ord) +- parser.add_argument('source_file', type=open) + parser.add_argument('dest_file', type=argparse.FileType('w', encoding='latin-1')) + parser.add_argument('datapath', type=pathlib.Path) + +@@ -1200,10 +1020,11 @@ better reporting than can be given by the ``type`` keyword. A + :exc:`FileNotFoundError` exception would not be handled at all. + + Even :class:`~argparse.FileType` has its limitations for use with the ``type`` +-keyword. If one argument uses *FileType* and then a subsequent argument fails, +-an error is reported but the file is not automatically closed. In this case, it +-would be better to wait until after the parser has run and then use the +-:keyword:`with`-statement to manage the files. ++keyword. If one argument uses :class:`~argparse.FileType` and then a ++subsequent argument fails, an error is reported but the file is not ++automatically closed. In this case, it would be better to wait until after ++the parser has run and then use the :keyword:`with`-statement to manage the ++files. + + For type checkers that simply check against a fixed set of values, consider + using the choices_ keyword instead. +@@ -1231,15 +1052,7 @@ if the argument was not one of the acceptable values:: + + Note that inclusion in the *choices* sequence is checked after any type_ + conversions have been performed, so the type of the objects in the *choices* +-sequence should match the type_ specified:: +- +- >>> parser = argparse.ArgumentParser(prog='doors.py') +- >>> parser.add_argument('door', type=int, choices=range(1, 4)) +- >>> print(parser.parse_args(['3'])) +- Namespace(door=3) +- >>> parser.parse_args(['4']) +- usage: doors.py [-h] {1,2,3} +- doors.py: error: argument door: invalid choice: 4 (choose from 1, 2, 3) ++sequence should match the type_ specified. + + Any sequence can be passed as the *choices* value, so :class:`list` objects, + :class:`tuple` objects, and custom sequences are all supported. +@@ -1258,7 +1071,7 @@ many choices), just specify an explicit metavar_. + required + ^^^^^^^^ + +-In general, the :mod:`argparse` module assumes that flags like ``-f`` and ``--bar`` ++In general, the :mod:`!argparse` module assumes that flags like ``-f`` and ``--bar`` + indicate *optional* arguments, which can always be omitted at the command line. + To make an option *required*, ``True`` can be specified for the ``required=`` + keyword argument to :meth:`~ArgumentParser.add_argument`:: +@@ -1289,22 +1102,7 @@ help + The ``help`` value is a string containing a brief description of the argument. + When a user requests help (usually by using ``-h`` or ``--help`` at the + command line), these ``help`` descriptions will be displayed with each +-argument:: +- +- >>> parser = argparse.ArgumentParser(prog='frobble') +- >>> parser.add_argument('--foo', action='store_true', +- ... help='foo the bars before frobbling') +- >>> parser.add_argument('bar', nargs='+', +- ... help='one of the bars to be frobbled') +- >>> parser.parse_args(['-h']) +- usage: frobble [-h] [--foo] bar [bar ...] +- +- positional arguments: +- bar one of the bars to be frobbled +- +- options: +- -h, --help show this help message and exit +- --foo foo the bars before frobbling ++argument. + + The ``help`` strings can include various format specifiers to avoid repetition + of things like the program name or the argument default_. The available +@@ -1326,7 +1124,7 @@ specifiers include the program name, ``%(prog)s`` and most keyword arguments to + As the help string supports %-formatting, if you want a literal ``%`` to appear + in the help string, you must escape it as ``%%``. + +-:mod:`argparse` supports silencing the help entry for certain options, by ++:mod:`!argparse` supports silencing the help entry for certain options, by + setting the ``help`` value to ``argparse.SUPPRESS``:: + + >>> parser = argparse.ArgumentParser(prog='frobble') +@@ -1344,7 +1142,7 @@ metavar + ^^^^^^^ + + When :class:`ArgumentParser` generates help messages, it needs some way to refer +-to each expected argument. By default, ArgumentParser objects use the dest_ ++to each expected argument. By default, :class:`!ArgumentParser` objects use the dest_ + value as the "name" of each object. By default, for positional argument + actions, the dest_ value is used directly, and for optional argument actions, + the dest_ value is uppercased. So, a single positional argument with +@@ -1476,7 +1274,7 @@ printed to :data:`sys.stderr` when the argument is used:: + Action classes + ^^^^^^^^^^^^^^ + +-Action classes implement the Action API, a callable which returns a callable ++:class:`!Action` classes implement the Action API, a callable which returns a callable + which processes arguments from the command-line. Any object which follows + this API may be passed as the ``action`` parameter to + :meth:`~ArgumentParser.add_argument`. +@@ -1485,40 +1283,46 @@ this API may be passed as the ``action`` parameter to + type=None, choices=None, required=False, help=None, \ + metavar=None) + +-Action objects are used by an ArgumentParser to represent the information +-needed to parse a single argument from one or more strings from the +-command line. The Action class must accept the two positional arguments +-plus any keyword arguments passed to :meth:`ArgumentParser.add_argument` +-except for the ``action`` itself. ++ :class:`!Action` objects are used by an :class:`ArgumentParser` to represent the information ++ needed to parse a single argument from one or more strings from the ++ command line. The :class:`!Action` class must accept the two positional arguments ++ plus any keyword arguments passed to :meth:`ArgumentParser.add_argument` ++ except for the ``action`` itself. ++ ++ Instances of :class:`!Action` (or return value of any callable to the ++ ``action`` parameter) should have attributes :attr:`!dest`, ++ :attr:`!option_strings`, :attr:`!default`, :attr:`!type`, :attr:`!required`, ++ :attr:`!help`, etc. defined. The easiest way to ensure these attributes ++ are defined is to call :meth:`!Action.__init__`. ++ ++ .. method:: __call__(parser, namespace, values, option_string=None) + +-Instances of Action (or return value of any callable to the ``action`` +-parameter) should have attributes "dest", "option_strings", "default", "type", +-"required", "help", etc. defined. The easiest way to ensure these attributes +-are defined is to call ``Action.__init__``. ++ :class:`!Action` instances should be callable, so subclasses must override the ++ :meth:`!__call__` method, which should accept four parameters: + +-Action instances should be callable, so subclasses must override the +-``__call__`` method, which should accept four parameters: ++ * *parser* - The :class:`ArgumentParser` object which contains this action. + +-* ``parser`` - The ArgumentParser object which contains this action. ++ * *namespace* - The :class:`Namespace` object that will be returned by ++ :meth:`~ArgumentParser.parse_args`. Most actions add an attribute to this ++ object using :func:`setattr`. + +-* ``namespace`` - The :class:`Namespace` object that will be returned by +- :meth:`~ArgumentParser.parse_args`. Most actions add an attribute to this +- object using :func:`setattr`. ++ * *values* - The associated command-line arguments, with any type conversions ++ applied. Type conversions are specified with the type_ keyword argument to ++ :meth:`~ArgumentParser.add_argument`. + +-* ``values`` - The associated command-line arguments, with any type conversions +- applied. Type conversions are specified with the type_ keyword argument to +- :meth:`~ArgumentParser.add_argument`. ++ * *option_string* - The option string that was used to invoke this action. ++ The ``option_string`` argument is optional, and will be absent if the action ++ is associated with a positional argument. + +-* ``option_string`` - The option string that was used to invoke this action. +- The ``option_string`` argument is optional, and will be absent if the action +- is associated with a positional argument. ++ The :meth:`!__call__` method may perform arbitrary actions, but will typically set ++ attributes on the ``namespace`` based on ``dest`` and ``values``. + +-The ``__call__`` method may perform arbitrary actions, but will typically set +-attributes on the ``namespace`` based on ``dest`` and ``values``. ++ .. method:: format_usage() ++ ++ :class:`!Action` subclasses can define a :meth:`!format_usage` method that takes no argument ++ and return a string which will be used when printing the usage of the program. ++ If such method is not provided, a sensible default will be used. + +-Action subclasses can define a ``format_usage`` method that takes no argument +-and return a string which will be used when printing the usage of the program. +-If such method is not provided, a sensible default will be used. + + The parse_args() method + ----------------------- +@@ -1530,7 +1334,7 @@ The parse_args() method + + Previous calls to :meth:`add_argument` determine exactly what objects are + created and how they are assigned. See the documentation for +- :meth:`add_argument` for details. ++ :meth:`!add_argument` for details. + + * args_ - List of strings to parse. The default is taken from + :data:`sys.argv`. +@@ -1686,7 +1490,7 @@ This feature can be disabled by setting :ref:`allow_abbrev` to ``False``. + Beyond ``sys.argv`` + ^^^^^^^^^^^^^^^^^^^ + +-Sometimes it may be useful to have an ArgumentParser parse arguments other than those ++Sometimes it may be useful to have an :class:`ArgumentParser` parse arguments other than those + of :data:`sys.argv`. This can be accomplished by passing a list of strings to + :meth:`~ArgumentParser.parse_args`. This is useful for testing at the + interactive prompt:: +@@ -1713,29 +1517,29 @@ The Namespace object + Simple class used by default by :meth:`~ArgumentParser.parse_args` to create + an object holding attributes and return it. + +-This class is deliberately simple, just an :class:`object` subclass with a +-readable string representation. If you prefer to have dict-like view of the +-attributes, you can use the standard Python idiom, :func:`vars`:: +- +- >>> parser = argparse.ArgumentParser() +- >>> parser.add_argument('--foo') +- >>> args = parser.parse_args(['--foo', 'BAR']) +- >>> vars(args) +- {'foo': 'BAR'} +- +-It may also be useful to have an :class:`ArgumentParser` assign attributes to an +-already existing object, rather than a new :class:`Namespace` object. This can +-be achieved by specifying the ``namespace=`` keyword argument:: ++ This class is deliberately simple, just an :class:`object` subclass with a ++ readable string representation. If you prefer to have dict-like view of the ++ attributes, you can use the standard Python idiom, :func:`vars`:: + +- >>> class C: +- ... pass +- ... +- >>> c = C() +- >>> parser = argparse.ArgumentParser() +- >>> parser.add_argument('--foo') +- >>> parser.parse_args(args=['--foo', 'BAR'], namespace=c) +- >>> c.foo +- 'BAR' ++ >>> parser = argparse.ArgumentParser() ++ >>> parser.add_argument('--foo') ++ >>> args = parser.parse_args(['--foo', 'BAR']) ++ >>> vars(args) ++ {'foo': 'BAR'} ++ ++ It may also be useful to have an :class:`ArgumentParser` assign attributes to an ++ already existing object, rather than a new :class:`Namespace` object. This can ++ be achieved by specifying the ``namespace=`` keyword argument:: ++ ++ >>> class C: ++ ... pass ++ ... ++ >>> c = C() ++ >>> parser = argparse.ArgumentParser() ++ >>> parser.add_argument('--foo') ++ >>> parser.parse_args(args=['--foo', 'BAR'], namespace=c) ++ >>> c.foo ++ 'BAR' + + + Other utilities +@@ -1744,38 +1548,38 @@ Other utilities + Sub-commands + ^^^^^^^^^^^^ + +-.. method:: ArgumentParser.add_subparsers([title], [description], [prog], \ ++.. method:: ArgumentParser.add_subparsers(*, [title], [description], [prog], \ + [parser_class], [action], \ +- [option_strings], [dest], [required], \ ++ [dest], [required], \ + [help], [metavar]) + +- Many programs split up their functionality into a number of sub-commands, +- for example, the ``svn`` program can invoke sub-commands like ``svn ++ Many programs split up their functionality into a number of subcommands, ++ for example, the ``svn`` program can invoke subcommands like ``svn + checkout``, ``svn update``, and ``svn commit``. Splitting up functionality + this way can be a particularly good idea when a program performs several + different functions which require different kinds of command-line arguments. +- :class:`ArgumentParser` supports the creation of such sub-commands with the +- :meth:`add_subparsers` method. The :meth:`add_subparsers` method is normally ++ :class:`ArgumentParser` supports the creation of such subcommands with the ++ :meth:`!add_subparsers` method. The :meth:`!add_subparsers` method is normally + called with no arguments and returns a special action object. This object + has a single method, :meth:`~_SubParsersAction.add_parser`, which takes a +- command name and any :class:`ArgumentParser` constructor arguments, and +- returns an :class:`ArgumentParser` object that can be modified as usual. ++ command name and any :class:`!ArgumentParser` constructor arguments, and ++ returns an :class:`!ArgumentParser` object that can be modified as usual. + + Description of parameters: + +- * title - title for the sub-parser group in help output; by default ++ * *title* - title for the sub-parser group in help output; by default + "subcommands" if description is provided, otherwise uses title for + positional arguments + +- * description - description for the sub-parser group in help output, by ++ * *description* - description for the sub-parser group in help output, by + default ``None`` + +- * prog - usage information that will be displayed with sub-command help, ++ * *prog* - usage information that will be displayed with sub-command help, + by default the name of the program and any positional arguments before the + subparser argument + +- * parser_class - class which will be used to create sub-parser instances, by +- default the class of the current parser (e.g. ArgumentParser) ++ * *parser_class* - class which will be used to create sub-parser instances, by ++ default the class of the current parser (e.g. :class:`ArgumentParser`) + + * action_ - the basic type of action to be taken when this argument is + encountered at the command line +@@ -1788,15 +1592,15 @@ Sub-commands + + * help_ - help for sub-parser group in help output, by default ``None`` + +- * metavar_ - string presenting available sub-commands in help; by default it +- is ``None`` and presents sub-commands in form {cmd1, cmd2, ..} ++ * metavar_ - string presenting available subcommands in help; by default it ++ is ``None`` and presents subcommands in form {cmd1, cmd2, ..} + + Some example usage:: + + >>> # create the top-level parser + >>> parser = argparse.ArgumentParser(prog='PROG') + >>> parser.add_argument('--foo', action='store_true', help='foo help') +- >>> subparsers = parser.add_subparsers(help='sub-command help') ++ >>> subparsers = parser.add_subparsers(help='subcommand help') + >>> + >>> # create the parser for the "a" command + >>> parser_a = subparsers.add_parser('a', help='a help') +@@ -1804,7 +1608,7 @@ Sub-commands + >>> + >>> # create the parser for the "b" command + >>> parser_b = subparsers.add_parser('b', help='b help') +- >>> parser_b.add_argument('--baz', choices='XYZ', help='baz help') ++ >>> parser_b.add_argument('--baz', choices=('X', 'Y', 'Z'), help='baz help') + >>> + >>> # parse some argument lists + >>> parser.parse_args(['a', '12']) +@@ -1831,7 +1635,7 @@ Sub-commands + usage: PROG [-h] [--foo] {a,b} ... + + positional arguments: +- {a,b} sub-command help ++ {a,b} subcommand help + a a help + b b help + +@@ -1902,12 +1706,12 @@ Sub-commands + + .. versionadded:: 3.13 + +- One particularly effective way of handling sub-commands is to combine the use ++ One particularly effective way of handling subcommands is to combine the use + of the :meth:`add_subparsers` method with calls to :meth:`set_defaults` so + that each subparser knows which Python function it should execute. For + example:: + +- >>> # sub-command functions ++ >>> # subcommand functions + >>> def foo(args): + ... print(args.x * args.y) + ... +@@ -1956,7 +1760,7 @@ Sub-commands + Namespace(subparser_name='2', y='frobble') + + .. versionchanged:: 3.7 +- New *required* keyword argument. ++ New *required* keyword-only parameter. + + + FileType objects +@@ -1992,13 +1796,14 @@ FileType objects + Argument groups + ^^^^^^^^^^^^^^^ + +-.. method:: ArgumentParser.add_argument_group(title=None, description=None) ++.. method:: ArgumentParser.add_argument_group(title=None, description=None, *, \ ++ [argument_default], [conflict_handler]) + + By default, :class:`ArgumentParser` groups command-line arguments into + "positional arguments" and "options" when displaying help + messages. When there is a better conceptual grouping of arguments than this + default one, appropriate groups can be created using the +- :meth:`add_argument_group` method:: ++ :meth:`!add_argument_group` method:: + + >>> parser = argparse.ArgumentParser(prog='PROG', add_help=False) + >>> group = parser.add_argument_group('group') +@@ -2015,7 +1820,7 @@ Argument groups + has an :meth:`~ArgumentParser.add_argument` method just like a regular + :class:`ArgumentParser`. When an argument is added to the group, the parser + treats it just like a normal argument, but displays the argument in a +- separate group for help messages. The :meth:`add_argument_group` method ++ separate group for help messages. The :meth:`!add_argument_group` method + accepts *title* and *description* arguments which can be used to + customize this display:: + +@@ -2037,6 +1842,11 @@ Argument groups + + --bar BAR bar help + ++ The optional, keyword-only parameters argument_default_ and conflict_handler_ ++ allow for finer-grained control of the behavior of the argument group. These ++ parameters have the same meaning as in the :class:`ArgumentParser` constructor, ++ but apply specifically to the argument group rather than the entire parser. ++ + Note that any arguments not in your user-defined groups will end up back + in the usual "positional arguments" and "optional arguments" sections. + +@@ -2052,7 +1862,7 @@ Mutual exclusion + + .. method:: ArgumentParser.add_mutually_exclusive_group(required=False) + +- Create a mutually exclusive group. :mod:`argparse` will make sure that only ++ Create a mutually exclusive group. :mod:`!argparse` will make sure that only + one of the arguments in the mutually exclusive group was present on the + command line:: + +@@ -2189,20 +1999,20 @@ Partial parsing + + .. method:: ArgumentParser.parse_known_args(args=None, namespace=None) + +-Sometimes a script may only parse a few of the command-line arguments, passing +-the remaining arguments on to another script or program. In these cases, the +-:meth:`~ArgumentParser.parse_known_args` method can be useful. It works much like +-:meth:`~ArgumentParser.parse_args` except that it does not produce an error when +-extra arguments are present. Instead, it returns a two item tuple containing +-the populated namespace and the list of remaining argument strings. ++ Sometimes a script may only parse a few of the command-line arguments, passing ++ the remaining arguments on to another script or program. In these cases, the ++ :meth:`~ArgumentParser.parse_known_args` method can be useful. It works much like ++ :meth:`~ArgumentParser.parse_args` except that it does not produce an error when ++ extra arguments are present. Instead, it returns a two item tuple containing ++ the populated namespace and the list of remaining argument strings. + +-:: ++ :: + +- >>> parser = argparse.ArgumentParser() +- >>> parser.add_argument('--foo', action='store_true') +- >>> parser.add_argument('bar') +- >>> parser.parse_known_args(['--foo', '--badger', 'BAR', 'spam']) +- (Namespace(bar='BAR', foo=True), ['--badger', 'spam']) ++ >>> parser = argparse.ArgumentParser() ++ >>> parser.add_argument('--foo', action='store_true') ++ >>> parser.add_argument('bar') ++ >>> parser.parse_known_args(['--foo', '--badger', 'BAR', 'spam']) ++ (Namespace(bar='BAR', foo=True), ['--badger', 'spam']) + + .. warning:: + :ref:`Prefix matching ` rules apply to +@@ -2260,90 +2070,38 @@ Intermixed parsing + .. method:: ArgumentParser.parse_intermixed_args(args=None, namespace=None) + .. method:: ArgumentParser.parse_known_intermixed_args(args=None, namespace=None) + +-A number of Unix commands allow the user to intermix optional arguments with +-positional arguments. The :meth:`~ArgumentParser.parse_intermixed_args` +-and :meth:`~ArgumentParser.parse_known_intermixed_args` methods +-support this parsing style. +- +-These parsers do not support all the argparse features, and will raise +-exceptions if unsupported features are used. In particular, subparsers, +-and mutually exclusive groups that include both +-optionals and positionals are not supported. ++ A number of Unix commands allow the user to intermix optional arguments with ++ positional arguments. The :meth:`~ArgumentParser.parse_intermixed_args` ++ and :meth:`~ArgumentParser.parse_known_intermixed_args` methods ++ support this parsing style. + +-The following example shows the difference between +-:meth:`~ArgumentParser.parse_known_args` and +-:meth:`~ArgumentParser.parse_intermixed_args`: the former returns ``['2', +-'3']`` as unparsed arguments, while the latter collects all the positionals +-into ``rest``. :: ++ These parsers do not support all the :mod:`!argparse` features, and will raise ++ exceptions if unsupported features are used. In particular, subparsers, ++ and mutually exclusive groups that include both ++ optionals and positionals are not supported. + +- >>> parser = argparse.ArgumentParser() +- >>> parser.add_argument('--foo') +- >>> parser.add_argument('cmd') +- >>> parser.add_argument('rest', nargs='*', type=int) +- >>> parser.parse_known_args('doit 1 --foo bar 2 3'.split()) +- (Namespace(cmd='doit', foo='bar', rest=[1]), ['2', '3']) +- >>> parser.parse_intermixed_args('doit 1 --foo bar 2 3'.split()) +- Namespace(cmd='doit', foo='bar', rest=[1, 2, 3]) +- +-:meth:`~ArgumentParser.parse_known_intermixed_args` returns a two item tuple +-containing the populated namespace and the list of remaining argument strings. +-:meth:`~ArgumentParser.parse_intermixed_args` raises an error if there are any +-remaining unparsed argument strings. +- +-.. versionadded:: 3.7 +- +-.. _upgrading-optparse-code: +- +-Upgrading optparse code +------------------------ +- +-Originally, the :mod:`argparse` module had attempted to maintain compatibility +-with :mod:`optparse`. However, :mod:`optparse` was difficult to extend +-transparently, particularly with the changes required to support the new +-``nargs=`` specifiers and better usage messages. When most everything in +-:mod:`optparse` had either been copy-pasted over or monkey-patched, it no +-longer seemed practical to try to maintain the backwards compatibility. +- +-The :mod:`argparse` module improves on the standard library :mod:`optparse` +-module in a number of ways including: +- +-* Handling positional arguments. +-* Supporting sub-commands. +-* Allowing alternative option prefixes like ``+`` and ``/``. +-* Handling zero-or-more and one-or-more style arguments. +-* Producing more informative usage messages. +-* Providing a much simpler interface for custom ``type`` and ``action``. ++ The following example shows the difference between ++ :meth:`~ArgumentParser.parse_known_args` and ++ :meth:`~ArgumentParser.parse_intermixed_args`: the former returns ``['2', ++ '3']`` as unparsed arguments, while the latter collects all the positionals ++ into ``rest``. :: + +-A partial upgrade path from :mod:`optparse` to :mod:`argparse`: +- +-* Replace all :meth:`optparse.OptionParser.add_option` calls with +- :meth:`ArgumentParser.add_argument` calls. +- +-* Replace ``(options, args) = parser.parse_args()`` with ``args = +- parser.parse_args()`` and add additional :meth:`ArgumentParser.add_argument` +- calls for the positional arguments. Keep in mind that what was previously +- called ``options``, now in the :mod:`argparse` context is called ``args``. +- +-* Replace :meth:`optparse.OptionParser.disable_interspersed_args` +- by using :meth:`~ArgumentParser.parse_intermixed_args` instead of +- :meth:`~ArgumentParser.parse_args`. +- +-* Replace callback actions and the ``callback_*`` keyword arguments with +- ``type`` or ``action`` arguments. +- +-* Replace string names for ``type`` keyword arguments with the corresponding +- type objects (e.g. int, float, complex, etc). ++ >>> parser = argparse.ArgumentParser() ++ >>> parser.add_argument('--foo') ++ >>> parser.add_argument('cmd') ++ >>> parser.add_argument('rest', nargs='*', type=int) ++ >>> parser.parse_known_args('doit 1 --foo bar 2 3'.split()) ++ (Namespace(cmd='doit', foo='bar', rest=[1]), ['2', '3']) ++ >>> parser.parse_intermixed_args('doit 1 --foo bar 2 3'.split()) ++ Namespace(cmd='doit', foo='bar', rest=[1, 2, 3]) + +-* Replace :class:`optparse.Values` with :class:`Namespace` and +- :exc:`optparse.OptionError` and :exc:`optparse.OptionValueError` with +- :exc:`ArgumentError`. ++ :meth:`~ArgumentParser.parse_known_intermixed_args` returns a two item tuple ++ containing the populated namespace and the list of remaining argument strings. ++ :meth:`~ArgumentParser.parse_intermixed_args` raises an error if there are any ++ remaining unparsed argument strings. + +-* Replace strings with implicit arguments such as ``%default`` or ``%prog`` with +- the standard Python syntax to use dictionaries to format strings, that is, +- ``%(default)s`` and ``%(prog)s``. ++ .. versionadded:: 3.7 + +-* Replace the OptionParser constructor ``version`` argument with a call to +- ``parser.add_argument('--version', action='version', version='')``. + + Exceptions + ---------- +@@ -2358,3 +2116,12 @@ Exceptions + .. exception:: ArgumentTypeError + + Raised when something goes wrong converting a command line string to a type. ++ ++ ++.. rubric:: Guides and Tutorials ++ ++.. toctree:: ++ :maxdepth: 1 ++ ++ ../howto/argparse.rst ++ ../howto/argparse-optparse.rst +diff --git a/Doc/library/ast.rst b/Doc/library/ast.rst +index 0b7d56286b2..bb126b79027 100644 +--- a/Doc/library/ast.rst ++++ b/Doc/library/ast.rst +@@ -897,7 +897,7 @@ Statements + (indicating a "simple" target). A "simple" target consists solely of a + :class:`Name` node that does not appear between parentheses; all other + targets are considered complex. Only simple targets appear in +- the :attr:`__annotations__` dictionary of modules and classes. ++ the :attr:`~object.__annotations__` dictionary of modules and classes. + + .. doctest:: + +diff --git a/Doc/library/asyncio-eventloop.rst b/Doc/library/asyncio-eventloop.rst +index 943683f6b8a..8d7d0377c13 100644 +--- a/Doc/library/asyncio-eventloop.rst ++++ b/Doc/library/asyncio-eventloop.rst +@@ -1791,7 +1791,7 @@ By default asyncio is configured to use :class:`EventLoop`. + .. seealso:: + + `MSDN documentation on I/O Completion Ports +- `_. ++ `_. + + .. class:: EventLoop + +diff --git a/Doc/library/asyncio-task.rst b/Doc/library/asyncio-task.rst +index 4716a3f9c8a..f27e858cf42 100644 +--- a/Doc/library/asyncio-task.rst ++++ b/Doc/library/asyncio-task.rst +@@ -158,7 +158,7 @@ other coroutines:: + # Nothing happens if we just call "nested()". + # A coroutine object is created but not awaited, + # so it *won't run at all*. +- nested() ++ nested() # will raise a "RuntimeWarning". + + # Let's do it differently now and await it: + print(await nested()) # will print "42". +diff --git a/Doc/library/builtins.rst b/Doc/library/builtins.rst +index 644344e7fef..c4979db52d2 100644 +--- a/Doc/library/builtins.rst ++++ b/Doc/library/builtins.rst +@@ -7,10 +7,7 @@ + -------------- + + This module provides direct access to all 'built-in' identifiers of Python; for +-example, ``builtins.open`` is the full name for the built-in function +-:func:`open`. See :ref:`built-in-funcs` and :ref:`built-in-consts` for +-documentation. +- ++example, ``builtins.open`` is the full name for the built-in function :func:`open`. + + This module is not normally accessed explicitly by most applications, but can be + useful in modules that provide objects with the same name as a built-in value, +@@ -40,3 +37,10 @@ available as part of their globals. The value of ``__builtins__`` is normally + either this module or the value of this module's :attr:`~object.__dict__` attribute. + Since this is an implementation detail, it may not be used by alternate + implementations of Python. ++ ++.. seealso:: ++ ++ * :ref:`built-in-consts` ++ * :ref:`bltin-exceptions` ++ * :ref:`built-in-funcs` ++ * :ref:`bltin-types` +diff --git a/Doc/library/cmath.rst b/Doc/library/cmath.rst +index 381a8332f4b..f122e3644ec 100644 +--- a/Doc/library/cmath.rst ++++ b/Doc/library/cmath.rst +@@ -221,19 +221,21 @@ Classification functions + ``False`` otherwise. + + Whether or not two values are considered close is determined according to +- given absolute and relative tolerances. ++ given absolute and relative tolerances. If no errors occur, the result will ++ be: ``abs(a-b) <= max(rel_tol * max(abs(a), abs(b)), abs_tol)``. + + *rel_tol* is the relative tolerance -- it is the maximum allowed difference + between *a* and *b*, relative to the larger absolute value of *a* or *b*. + For example, to set a tolerance of 5%, pass ``rel_tol=0.05``. The default + tolerance is ``1e-09``, which assures that the two values are the same +- within about 9 decimal digits. *rel_tol* must be greater than zero. +- +- *abs_tol* is the minimum absolute tolerance -- useful for comparisons near +- zero. *abs_tol* must be at least zero. +- +- If no errors occur, the result will be: +- ``abs(a-b) <= max(rel_tol * max(abs(a), abs(b)), abs_tol)``. ++ within about 9 decimal digits. *rel_tol* must be nonnegative and less ++ than ``1.0``. ++ ++ *abs_tol* is the absolute tolerance; it defaults to ``0.0`` and it must be ++ nonnegative. When comparing ``x`` to ``0.0``, ``isclose(x, 0)`` is computed ++ as ``abs(x) <= rel_tol * abs(x)``, which is ``False`` for any ``x`` and ++ rel_tol less than ``1.0``. So add an appropriate positive abs_tol argument ++ to the call. + + The IEEE 754 special values of ``NaN``, ``inf``, and ``-inf`` will be + handled according to IEEE rules. Specifically, ``NaN`` is not considered +diff --git a/Doc/library/concurrent.futures.rst b/Doc/library/concurrent.futures.rst +index e3b24451188..4e7db8fc854 100644 +--- a/Doc/library/concurrent.futures.rst ++++ b/Doc/library/concurrent.futures.rst +@@ -206,7 +206,7 @@ ThreadPoolExecutor Example + 'http://www.cnn.com/', + 'http://europe.wsj.com/', + 'http://www.bbc.co.uk/', +- 'http://nonexistant-subdomain.python.org/'] ++ 'http://nonexistent-subdomain.python.org/'] + + # Retrieve a single page and report the URL and contents + def load_url(url, timeout): +diff --git a/Doc/library/configparser.rst b/Doc/library/configparser.rst +index cf13de4116f..47477bc06bd 100644 +--- a/Doc/library/configparser.rst ++++ b/Doc/library/configparser.rst +@@ -54,6 +54,7 @@ can be customized by end users easily. + + import os + os.remove("example.ini") ++ os.remove("override.ini") + + + Quick Start +@@ -941,7 +942,13 @@ interpolation if an option used is not defined elsewhere. :: + ConfigParser Objects + -------------------- + +-.. class:: ConfigParser(defaults=None, dict_type=dict, allow_no_value=False, delimiters=('=', ':'), comment_prefixes=('#', ';'), inline_comment_prefixes=None, strict=True, empty_lines_in_values=True, default_section=configparser.DEFAULTSECT, interpolation=BasicInterpolation(), converters={}) ++.. class:: ConfigParser(defaults=None, dict_type=dict, allow_no_value=False, *, \ ++ delimiters=('=', ':'), comment_prefixes=('#', ';'), \ ++ inline_comment_prefixes=None, strict=True, \ ++ empty_lines_in_values=True, \ ++ default_section=configparser.DEFAULTSECT, \ ++ interpolation=BasicInterpolation(), converters={}, \ ++ allow_unnamed_section=False) + + The main configuration parser. When *defaults* is given, it is initialized + into the dictionary of intrinsic defaults. When *dict_type* is given, it +@@ -989,6 +996,10 @@ ConfigParser Objects + converter gets its own corresponding :meth:`!get*` method on the parser + object and section proxies. + ++ When *allow_unnamed_section* is ``True`` (default: ``False``), ++ the first section name can be omitted. See the ++ `"Unnamed Sections" section <#unnamed-sections>`_. ++ + It is possible to read several configurations into a single + :class:`ConfigParser`, where the most recently added configuration has the + highest priority. Any conflicting keys are taken from the more recent +@@ -1038,6 +1049,9 @@ ConfigParser Objects + Raise a :exc:`MultilineContinuationError` when *allow_no_value* is + ``True``, and a key without a value is continued with an indented line. + ++ .. versionchanged:: 3.13 ++ The *allow_unnamed_section* argument was added. ++ + .. method:: defaults() + + Return a dictionary containing the instance-wide defaults. +@@ -1294,18 +1308,30 @@ RawConfigParser Objects + comment_prefixes=('#', ';'), \ + inline_comment_prefixes=None, strict=True, \ + empty_lines_in_values=True, \ +- default_section=configparser.DEFAULTSECT[, \ +- interpolation]) ++ default_section=configparser.DEFAULTSECT, \ ++ interpolation=BasicInterpolation(), converters={}, \ ++ allow_unnamed_section=False) + + Legacy variant of the :class:`ConfigParser`. It has interpolation + disabled by default and allows for non-string section names, option + names, and values via its unsafe ``add_section`` and ``set`` methods, + as well as the legacy ``defaults=`` keyword argument handling. + ++ .. versionchanged:: 3.2 ++ *allow_no_value*, *delimiters*, *comment_prefixes*, *strict*, ++ *empty_lines_in_values*, *default_section* and *interpolation* were ++ added. ++ ++ .. versionchanged:: 3.5 ++ The *converters* argument was added. ++ + .. versionchanged:: 3.8 + The default *dict_type* is :class:`dict`, since it now preserves + insertion order. + ++ .. versionchanged:: 3.13 ++ The *allow_unnamed_section* argument was added. ++ + .. note:: + Consider using :class:`ConfigParser` instead which checks types of + the values to be stored internally. If you don't want interpolation, you +diff --git a/Doc/library/contextvars.rst b/Doc/library/contextvars.rst +index 2a79dfe8f81..2b1fb9fdd29 100644 +--- a/Doc/library/contextvars.rst ++++ b/Doc/library/contextvars.rst +@@ -144,51 +144,89 @@ Manual Context Management + To get a copy of the current context use the + :func:`~contextvars.copy_context` function. + +- Every thread will have a different top-level :class:`~contextvars.Context` +- object. This means that a :class:`ContextVar` object behaves in a similar +- fashion to :func:`threading.local` when values are assigned in different +- threads. ++ Each thread has its own effective stack of :class:`!Context` objects. The ++ :term:`current context` is the :class:`!Context` object at the top of the ++ current thread's stack. All :class:`!Context` objects in the stacks are ++ considered to be *entered*. ++ ++ *Entering* a context, which can be done by calling its :meth:`~Context.run` ++ method, makes the context the current context by pushing it onto the top of ++ the current thread's context stack. ++ ++ *Exiting* from the current context, which can be done by returning from the ++ callback passed to the :meth:`~Context.run` method, restores the current ++ context to what it was before the context was entered by popping the context ++ off the top of the context stack. ++ ++ Since each thread has its own context stack, :class:`ContextVar` objects ++ behave in a similar fashion to :func:`threading.local` when values are ++ assigned in different threads. ++ ++ Attempting to enter an already entered context, including contexts entered in ++ other threads, raises a :exc:`RuntimeError`. ++ ++ After exiting a context, it can later be re-entered (from any thread). ++ ++ Any changes to :class:`ContextVar` values via the :meth:`ContextVar.set` ++ method are recorded in the current context. The :meth:`ContextVar.get` ++ method returns the value associated with the current context. Exiting a ++ context effectively reverts any changes made to context variables while the ++ context was entered (if needed, the values can be restored by re-entering the ++ context). + + Context implements the :class:`collections.abc.Mapping` interface. + + .. method:: run(callable, *args, **kwargs) + +- Execute ``callable(*args, **kwargs)`` code in the context object +- the *run* method is called on. Return the result of the execution +- or propagate an exception if one occurred. ++ Enters the Context, executes ``callable(*args, **kwargs)``, then exits the ++ Context. Returns *callable*'s return value, or propagates an exception if ++ one occurred. ++ ++ Example: ++ ++ .. testcode:: ++ ++ import contextvars + +- Any changes to any context variables that *callable* makes will +- be contained in the context object:: ++ var = contextvars.ContextVar('var') ++ var.set('spam') ++ print(var.get()) # 'spam' + +- var = ContextVar('var') +- var.set('spam') ++ ctx = contextvars.copy_context() + +- def main(): +- # 'var' was set to 'spam' before +- # calling 'copy_context()' and 'ctx.run(main)', so: +- # var.get() == ctx[var] == 'spam' ++ def main(): ++ # 'var' was set to 'spam' before ++ # calling 'copy_context()' and 'ctx.run(main)', so: ++ print(var.get()) # 'spam' ++ print(ctx[var]) # 'spam' + +- var.set('ham') ++ var.set('ham') + +- # Now, after setting 'var' to 'ham': +- # var.get() == ctx[var] == 'ham' ++ # Now, after setting 'var' to 'ham': ++ print(var.get()) # 'ham' ++ print(ctx[var]) # 'ham' + +- ctx = copy_context() ++ # Any changes that the 'main' function makes to 'var' ++ # will be contained in 'ctx'. ++ ctx.run(main) + +- # Any changes that the 'main' function makes to 'var' +- # will be contained in 'ctx'. +- ctx.run(main) ++ # The 'main()' function was run in the 'ctx' context, ++ # so changes to 'var' are contained in it: ++ print(ctx[var]) # 'ham' + +- # The 'main()' function was run in the 'ctx' context, +- # so changes to 'var' are contained in it: +- # ctx[var] == 'ham' ++ # However, outside of 'ctx', 'var' is still set to 'spam': ++ print(var.get()) # 'spam' + +- # However, outside of 'ctx', 'var' is still set to 'spam': +- # var.get() == 'spam' ++ .. testoutput:: ++ :hide: + +- The method raises a :exc:`RuntimeError` when called on the same +- context object from more than one OS thread, or when called +- recursively. ++ spam ++ spam ++ spam ++ ham ++ ham ++ ham ++ spam + + .. method:: copy() + +diff --git a/Doc/library/ctypes.rst b/Doc/library/ctypes.rst +index 12b44569271..83d43b209f7 100644 +--- a/Doc/library/ctypes.rst ++++ b/Doc/library/ctypes.rst +@@ -383,7 +383,7 @@ as calling functions with a fixed number of parameters. On some platforms, and i + particular ARM64 for Apple Platforms, the calling convention for variadic functions + is different than that for regular functions. + +-On those platforms it is required to specify the :attr:`~_FuncPtr.argtypes` ++On those platforms it is required to specify the :attr:`~_CFuncPtr.argtypes` + attribute for the regular, non-variadic, function arguments: + + .. code-block:: python3 +@@ -391,7 +391,7 @@ attribute for the regular, non-variadic, function arguments: + libc.printf.argtypes = [ctypes.c_char_p] + + Because specifying the attribute does not inhibit portability it is advised to always +-specify :attr:`~_FuncPtr.argtypes` for all variadic functions. ++specify :attr:`~_CFuncPtr.argtypes` for all variadic functions. + + + .. _ctypes-calling-functions-with-own-custom-data-types: +@@ -426,9 +426,9 @@ Specifying the required argument types (function prototypes) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + It is possible to specify the required argument types of functions exported from +-DLLs by setting the :attr:`~_FuncPtr.argtypes` attribute. ++DLLs by setting the :attr:`~_CFuncPtr.argtypes` attribute. + +-:attr:`~_FuncPtr.argtypes` must be a sequence of C data types (the :func:`!printf` function is ++:attr:`~_CFuncPtr.argtypes` must be a sequence of C data types (the :func:`!printf` function is + probably not a good example here, because it takes a variable number and + different types of parameters depending on the format string, on the other hand + this is quite handy to experiment with this feature):: +@@ -453,7 +453,7 @@ prototype for a C function), and tries to convert the arguments to valid types:: + + If you have defined your own classes which you pass to function calls, you have + to implement a :meth:`~_CData.from_param` class method for them to be able to use them +-in the :attr:`~_FuncPtr.argtypes` sequence. The :meth:`~_CData.from_param` class method receives ++in the :attr:`~_CFuncPtr.argtypes` sequence. The :meth:`~_CData.from_param` class method receives + the Python object passed to the function call, it should do a typecheck or + whatever is needed to make sure this object is acceptable, and then return the + object itself, its :attr:`!_as_parameter_` attribute, or whatever you want to +@@ -476,7 +476,7 @@ Return types + + + By default functions are assumed to return the C :c:expr:`int` type. Other +-return types can be specified by setting the :attr:`~_FuncPtr.restype` attribute of the ++return types can be specified by setting the :attr:`~_CFuncPtr.restype` attribute of the + function object. + + The C prototype of :c:func:`time` is ``time_t time(time_t *)``. Because :c:type:`time_t` +@@ -485,7 +485,7 @@ specify the :attr:`!restype` attribute:: + + >>> libc.time.restype = c_time_t + +-The argument types can be specified using :attr:`~_FuncPtr.argtypes`:: ++The argument types can be specified using :attr:`~_CFuncPtr.argtypes`:: + + >>> libc.time.argtypes = (POINTER(c_time_t),) + +@@ -508,7 +508,7 @@ a string pointer and a char, and returns a pointer to a string:: + >>> + + If you want to avoid the :func:`ord("x") ` calls above, you can set the +-:attr:`~_FuncPtr.argtypes` attribute, and the second argument will be converted from a ++:attr:`~_CFuncPtr.argtypes` attribute, and the second argument will be converted from a + single character Python bytes object into a C char: + + .. doctest:: +@@ -527,7 +527,7 @@ single character Python bytes object into a C char: + >>> + + You can also use a callable Python object (a function or a class for example) as +-the :attr:`~_FuncPtr.restype` attribute, if the foreign function returns an integer. The ++the :attr:`~_CFuncPtr.restype` attribute, if the foreign function returns an integer. The + callable will be called with the *integer* the C function returns, and the + result of this call will be used as the result of your function call. This is + useful to check for error return values and automatically raise an exception:: +@@ -555,7 +555,7 @@ get the string representation of an error code, and *returns* an exception. + :func:`GetLastError` to retrieve it. + + Please note that a much more powerful error checking mechanism is available +-through the :attr:`~_FuncPtr.errcheck` attribute; ++through the :attr:`~_CFuncPtr.errcheck` attribute; + see the reference manual for details. + + +@@ -859,7 +859,7 @@ Type conversions + ^^^^^^^^^^^^^^^^ + + Usually, ctypes does strict type checking. This means, if you have +-``POINTER(c_int)`` in the :attr:`~_FuncPtr.argtypes` list of a function or as the type of ++``POINTER(c_int)`` in the :attr:`~_CFuncPtr.argtypes` list of a function or as the type of + a member field in a structure definition, only instances of exactly the same + type are accepted. There are some exceptions to this rule, where ctypes accepts + other objects. For example, you can pass compatible array instances instead of +@@ -880,7 +880,7 @@ pointer types. So, for ``POINTER(c_int)``, ctypes accepts an array of c_int:: + >>> + + In addition, if a function argument is explicitly declared to be a pointer type +-(such as ``POINTER(c_int)``) in :attr:`~_FuncPtr.argtypes`, an object of the pointed ++(such as ``POINTER(c_int)``) in :attr:`~_CFuncPtr.argtypes`, an object of the pointed + type (``c_int`` in this case) can be passed to the function. ctypes will apply + the required :func:`byref` conversion in this case automatically. + +@@ -1609,10 +1609,20 @@ As explained in the previous section, foreign functions can be accessed as + attributes of loaded shared libraries. The function objects created in this way + by default accept any number of arguments, accept any ctypes data instances as + arguments, and return the default result type specified by the library loader. +-They are instances of a private class: + ++They are instances of a private local class :class:`!_FuncPtr` (not exposed ++in :mod:`!ctypes`) which inherits from the private :class:`_CFuncPtr` class: + +-.. class:: _FuncPtr ++.. doctest:: ++ ++ >>> import ctypes ++ >>> lib = ctypes.CDLL(None) ++ >>> issubclass(lib._FuncPtr, ctypes._CFuncPtr) ++ True ++ >>> lib._FuncPtr is ctypes._CFuncPtr ++ False ++ ++.. class:: _CFuncPtr + + Base class for C callable foreign functions. + +@@ -1778,7 +1788,7 @@ different ways, depending on the type and number of the parameters in the call: + The optional *paramflags* parameter creates foreign function wrappers with much + more functionality than the features described above. + +-*paramflags* must be a tuple of the same length as :attr:`~_FuncPtr.argtypes`. ++*paramflags* must be a tuple of the same length as :attr:`~_CFuncPtr.argtypes`. + + Each item in this tuple contains further information about a parameter, it must + be a tuple containing one, two, or three items. +@@ -1849,7 +1859,7 @@ value if there is a single one, or a tuple containing the output parameter + values when there are more than one, so the GetWindowRect function now returns a + RECT instance, when called. + +-Output parameters can be combined with the :attr:`~_FuncPtr.errcheck` protocol to do ++Output parameters can be combined with the :attr:`~_CFuncPtr.errcheck` protocol to do + further output processing and error checking. The win32 ``GetWindowRect`` api + function returns a ``BOOL`` to signal success or failure, so this function could + do the error checking, and raises an exception when the api call failed:: +@@ -1862,7 +1872,7 @@ do the error checking, and raises an exception when the api call failed:: + >>> GetWindowRect.errcheck = errcheck + >>> + +-If the :attr:`~_FuncPtr.errcheck` function returns the argument tuple it receives ++If the :attr:`~_CFuncPtr.errcheck` function returns the argument tuple it receives + unchanged, :mod:`ctypes` continues the normal processing it does on the output + parameters. If you want to return a tuple of window coordinates instead of a + ``RECT`` instance, you can retrieve the fields in the function and return them +@@ -2162,7 +2172,7 @@ Data types + + This method adapts *obj* to a ctypes type. It is called with the actual + object used in a foreign function call when the type is present in the +- foreign function's :attr:`~_FuncPtr.argtypes` tuple; ++ foreign function's :attr:`~_CFuncPtr.argtypes` tuple; + it must return an object that can be used as a function call parameter. + + All ctypes data types have a default implementation of this classmethod +@@ -2228,7 +2238,7 @@ Fundamental data types + Fundamental data types, when returned as foreign function call results, or, for + example, by retrieving structure field members or array items, are transparently + converted to native Python types. In other words, if a foreign function has a +-:attr:`~_FuncPtr.restype` of :class:`c_char_p`, you will always receive a Python bytes ++:attr:`~_CFuncPtr.restype` of :class:`c_char_p`, you will always receive a Python bytes + object, *not* a :class:`c_char_p` instance. + + .. XXX above is false, it actually returns a Unicode string +@@ -2540,6 +2550,8 @@ fields, or any other data types containing pointer type fields. + the structure when being packed or unpacked to/from memory. + Setting this attribute to 0 is the same as not setting it at all. + ++ .. versionadded:: 3.13 ++ + .. attribute:: _anonymous_ + + An optional sequence that lists the names of unnamed (anonymous) fields. +diff --git a/Doc/library/datetime.rst b/Doc/library/datetime.rst +index 9246aff12a6..211e625c430 100644 +--- a/Doc/library/datetime.rst ++++ b/Doc/library/datetime.rst +@@ -180,19 +180,19 @@ Objects of the :class:`date` type are always naive. + + An object of type :class:`.time` or :class:`.datetime` may be aware or naive. + +-A :class:`.datetime` object *d* is aware if both of the following hold: ++A :class:`.datetime` object ``d`` is aware if both of the following hold: + + 1. ``d.tzinfo`` is not ``None`` + 2. ``d.tzinfo.utcoffset(d)`` does not return ``None`` + +-Otherwise, *d* is naive. ++Otherwise, ``d`` is naive. + +-A :class:`.time` object *t* is aware if both of the following hold: ++A :class:`.time` object ``t`` is aware if both of the following hold: + + 1. ``t.tzinfo`` is not ``None`` + 2. ``t.tzinfo.utcoffset(None)`` does not return ``None``. + +-Otherwise, *t* is naive. ++Otherwise, ``t`` is naive. + + The distinction between aware and naive doesn't apply to :class:`timedelta` + objects. +@@ -358,8 +358,8 @@ Supported operations: + +--------------------------------+-----------------------------------------------+ + | ``q, r = divmod(t1, t2)`` | Computes the quotient and the remainder: | + | | ``q = t1 // t2`` (3) and ``r = t1 % t2``. | +-| | q is an integer and r is a :class:`timedelta` | +-| | object. | ++| | ``q`` is an integer and ``r`` is a | ++| | :class:`timedelta` object. | + +--------------------------------+-----------------------------------------------+ + | ``+t1`` | Returns a :class:`timedelta` object with the | + | | same value. (2) | +@@ -526,7 +526,7 @@ Other constructors, all class methods: + January 1 of year 1 has ordinal 1. + + :exc:`ValueError` is raised unless ``1 <= ordinal <= +- date.max.toordinal()``. For any date *d*, ++ date.max.toordinal()``. For any date ``d``, + ``date.fromordinal(d.toordinal()) == d``. + + +@@ -697,7 +697,7 @@ Instance methods: + .. method:: date.toordinal() + + Return the proleptic Gregorian ordinal of the date, where January 1 of year 1 +- has ordinal 1. For any :class:`date` object *d*, ++ has ordinal 1. For any :class:`date` object ``d``, + ``date.fromordinal(d.toordinal()) == d``. + + +@@ -749,7 +749,7 @@ Instance methods: + + .. method:: date.__str__() + +- For a date *d*, ``str(d)`` is equivalent to ``d.isoformat()``. ++ For a date ``d``, ``str(d)`` is equivalent to ``d.isoformat()``. + + + .. method:: date.ctime() +@@ -915,6 +915,10 @@ Other constructors, all class methods: + + This function is preferred over :meth:`today` and :meth:`utcnow`. + ++ .. note:: ++ ++ Subsequent calls to :meth:`!datetime.now` may return the same ++ instant depending on the precision of the underlying clock. + + .. classmethod:: datetime.utcnow() + +@@ -1026,7 +1030,7 @@ Other constructors, all class methods: + is used. If the *date* argument is a :class:`.datetime` object, its time components + and :attr:`.tzinfo` attributes are ignored. + +- For any :class:`.datetime` object *d*, ++ For any :class:`.datetime` object ``d``, + ``d == datetime.combine(d.date(), d.time(), d.tzinfo)``. + + .. versionchanged:: 3.6 +@@ -1233,11 +1237,11 @@ Supported operations: + + If both are naive, or both are aware and have the same :attr:`~.datetime.tzinfo` attribute, + the :attr:`~.datetime.tzinfo` attributes are ignored, and the result is a :class:`timedelta` +- object *t* such that ``datetime2 + t == datetime1``. No time zone adjustments ++ object ``t`` such that ``datetime2 + t == datetime1``. No time zone adjustments + are done in this case. + + If both are aware and have different :attr:`~.datetime.tzinfo` attributes, ``a-b`` acts +- as if *a* and *b* were first converted to naive UTC datetimes. The ++ as if ``a`` and ``b`` were first converted to naive UTC datetimes. The + result is ``(a.replace(tzinfo=None) - a.utcoffset()) - (b.replace(tzinfo=None) + - b.utcoffset())`` except that the implementation never overflows. + +@@ -1417,11 +1421,11 @@ Instance methods: + + .. method:: datetime.utctimetuple() + +- If :class:`.datetime` instance *d* is naive, this is the same as ++ If :class:`.datetime` instance ``d`` is naive, this is the same as + ``d.timetuple()`` except that :attr:`~.time.struct_time.tm_isdst` is forced to 0 regardless of what + ``d.dst()`` returns. DST is never in effect for a UTC time. + +- If *d* is aware, *d* is normalized to UTC time, by subtracting ++ If ``d`` is aware, ``d`` is normalized to UTC time, by subtracting + ``d.utcoffset()``, and a :class:`time.struct_time` for the + normalized time is returned. :attr:`!tm_isdst` is forced to 0. Note + that an :exc:`OverflowError` may be raised if ``d.year`` was +@@ -1569,7 +1573,7 @@ Instance methods: + + .. method:: datetime.__str__() + +- For a :class:`.datetime` instance *d*, ``str(d)`` is equivalent to ++ For a :class:`.datetime` instance ``d``, ``str(d)`` is equivalent to + ``d.isoformat(' ')``. + + +@@ -1816,7 +1820,7 @@ Instance attributes (read-only): + .. versionadded:: 3.6 + + :class:`.time` objects support equality and order comparisons, +-where *a* is considered less than *b* when *a* precedes *b* in time. ++where ``a`` is considered less than ``b`` when ``a`` precedes ``b`` in time. + + Naive and aware :class:`!time` objects are never equal. + Order comparison between naive and aware :class:`!time` objects raises +@@ -1947,7 +1951,7 @@ Instance methods: + + .. method:: time.__str__() + +- For a time *t*, ``str(t)`` is equivalent to ``t.isoformat()``. ++ For a time ``t``, ``str(t)`` is equivalent to ``t.isoformat()``. + + + .. method:: time.strftime(format) +diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst +index c5507e89a52..c37059cb090 100644 +--- a/Doc/library/dis.rst ++++ b/Doc/library/dis.rst +@@ -957,7 +957,8 @@ iterations of the loop. + + .. opcode:: GET_LEN + +- Perform ``STACK.append(len(STACK[-1]))``. ++ Perform ``STACK.append(len(STACK[-1]))``. Used in :keyword:`match` statements where ++ comparison with structure of pattern is needed. + + .. versionadded:: 3.10 + +@@ -1431,7 +1432,7 @@ iterations of the loop. + slot ``i`` of the "fast locals" storage in this mapping. + If the name is not found there, loads it from the cell contained in + slot ``i``, similar to :opcode:`LOAD_DEREF`. This is used for loading +- free variables in class bodies (which previously used ++ :term:`closure variables ` in class bodies (which previously used + :opcode:`!LOAD_CLASSDEREF`) and in + :ref:`annotation scopes ` within class bodies. + +@@ -1460,8 +1461,8 @@ iterations of the loop. + + .. opcode:: COPY_FREE_VARS (n) + +- Copies the ``n`` free variables from the closure into the frame. +- Removes the need for special code on the caller's side when calling ++ Copies the ``n`` :term:`free (closure) variables ` from the closure ++ into the frame. Removes the need for special code on the caller's side when calling + closures. + + .. versionadded:: 3.11 +@@ -1549,7 +1550,7 @@ iterations of the loop. + + .. opcode:: MAKE_FUNCTION + +- Pushes a new function object on the stack built from the code object at ``STACK[1]``. ++ Pushes a new function object on the stack built from the code object at ``STACK[-1]``. + + .. versionchanged:: 3.10 + Flag value ``0x04`` is a tuple of strings instead of dictionary +@@ -1634,7 +1635,7 @@ iterations of the loop. + + .. versionadded:: 3.13 + +-.. opcode:: FORMAT_SPEC ++.. opcode:: FORMAT_WITH_SPEC + + Formats the given value with the given format spec:: + +@@ -1917,10 +1918,10 @@ instructions: + + .. data:: hasfree + +- Sequence of bytecodes that access a free variable. 'free' in this +- context refers to names in the current scope that are referenced by inner +- scopes or names in outer scopes that are referenced from this scope. It does +- *not* include references to global or builtin scopes. ++ Sequence of bytecodes that access a :term:`free (closure) variable `. ++ 'free' in this context refers to names in the current scope that are ++ referenced by inner scopes or names in outer scopes that are referenced ++ from this scope. It does *not* include references to global or builtin scopes. + + + .. data:: hasname +diff --git a/Doc/library/enum.rst b/Doc/library/enum.rst +index a724fe4bcdc..2df9096c452 100644 +--- a/Doc/library/enum.rst ++++ b/Doc/library/enum.rst +@@ -44,7 +44,7 @@ using function-call syntax:: + ... BLUE = 3 + + >>> # functional syntax +- >>> Color = Enum('Color', ['RED', 'GREEN', 'BLUE']) ++ >>> Color = Enum('Color', [('RED', 1), ('GREEN', 2), ('BLUE', 3)]) + + Even though we can use :keyword:`class` syntax to create Enums, Enums + are not normal Python classes. See +diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst +index 8d023ebf48a..7247bb93795 100644 +--- a/Doc/library/functions.rst ++++ b/Doc/library/functions.rst +@@ -588,6 +588,11 @@ are always available. They are listed here in alphabetical order. + :returns: The result of the evaluated expression. + :raises: Syntax errors are reported as exceptions. + ++ .. warning:: ++ ++ This function executes arbitrary code. Calling it with ++ user-supplied input may lead to security vulnerabilities. ++ + The *expression* argument is parsed and evaluated as a Python expression + (technically speaking, a condition list) using the *globals* and *locals* + mappings as global and local namespace. If the *globals* dictionary is +@@ -644,6 +649,11 @@ are always available. They are listed here in alphabetical order. + + .. function:: exec(source, /, globals=None, locals=None, *, closure=None) + ++ .. warning:: ++ ++ This function executes arbitrary code. Calling it with ++ user-supplied input may lead to security vulnerabilities. ++ + This function supports dynamic execution of Python code. *source* must be + either a string or a code object. If it is a string, the string is parsed as + a suite of Python statements which is then executed (unless a syntax error +@@ -678,9 +688,10 @@ are always available. They are listed here in alphabetical order. + ``__builtins__`` dictionary into *globals* before passing it to :func:`exec`. + + The *closure* argument specifies a closure--a tuple of cellvars. +- It's only valid when the *object* is a code object containing free variables. +- The length of the tuple must exactly match the number of free variables +- referenced by the code object. ++ It's only valid when the *object* is a code object containing ++ :term:`free (closure) variables `. ++ The length of the tuple must exactly match the length of the code object's ++ :attr:`~codeobject.co_freevars` attribute. + + .. audit-event:: exec code_object exec + +@@ -1275,9 +1286,10 @@ are always available. They are listed here in alphabetical order. + + .. class:: object() + +- Return a new featureless object. :class:`object` is a base for all classes. +- It has methods that are common to all instances of Python classes. This +- function does not accept any arguments. ++ This is the ultimate base class of all other classes. It has methods ++ that are common to all instances of Python classes. When the constructor ++ is called, it returns a new featureless object. The constructor does not ++ accept any arguments. + + .. note:: + +diff --git a/Doc/library/getopt.rst b/Doc/library/getopt.rst +index d43d3250732..3ab44b9fc56 100644 +--- a/Doc/library/getopt.rst ++++ b/Doc/library/getopt.rst +@@ -97,6 +97,8 @@ exception: + + An example using only Unix style options: + ++.. doctest:: ++ + >>> import getopt + >>> args = '-a -b -cfoo -d bar a1 a2'.split() + >>> args +@@ -109,6 +111,8 @@ An example using only Unix style options: + + Using long option names is equally easy: + ++.. doctest:: ++ + >>> s = '--condition=foo --testing --output-file abc.def -x a1 a2' + >>> args = s.split() + >>> args +@@ -120,7 +124,9 @@ Using long option names is equally easy: + >>> args + ['a1', 'a2'] + +-In a script, typical usage is something like this:: ++In a script, typical usage is something like this: ++ ++.. testcode:: + + import getopt, sys + +@@ -150,7 +156,9 @@ In a script, typical usage is something like this:: + main() + + Note that an equivalent command line interface could be produced with less code +-and more informative help and error messages by using the :mod:`argparse` module:: ++and more informative help and error messages by using the :mod:`argparse` module: ++ ++.. testcode:: + + import argparse + +diff --git a/Doc/library/importlib.metadata.rst b/Doc/library/importlib.metadata.rst +index 9c0879f5ca8..b712a559bb3 100644 +--- a/Doc/library/importlib.metadata.rst ++++ b/Doc/library/importlib.metadata.rst +@@ -100,6 +100,13 @@ You can also get a :ref:`distribution's version number `, list its + :ref:`requirements`. + + ++.. exception:: PackageNotFoundError ++ ++ Subclass of :class:`ModuleNotFoundError` raised by several functions in this ++ module when queried for a distribution package which is not installed in the ++ current Python environment. ++ ++ + Functional API + ============== + +@@ -111,31 +118,53 @@ This package provides the following functionality via its public API. + Entry points + ------------ + +-The ``entry_points()`` function returns a collection of entry points. +-Entry points are represented by ``EntryPoint`` instances; +-each ``EntryPoint`` has a ``.name``, ``.group``, and ``.value`` attributes and +-a ``.load()`` method to resolve the value. There are also ``.module``, +-``.attr``, and ``.extras`` attributes for getting the components of the +-``.value`` attribute. ++.. function:: entry_points(**select_params) ++ ++ Returns a :class:`EntryPoints` instance describing entry points for the ++ current environment. Any given keyword parameters are passed to the ++ :meth:`!select` method for comparison to the attributes of ++ the individual entry point definitions. ++ ++ Note: it is not currently possible to query for entry points based on ++ their :attr:`!EntryPoint.dist` attribute (as different :class:`!Distribution` ++ instances do not currently compare equal, even if they have the same attributes) ++ ++.. class:: EntryPoints ++ ++ Details of a collection of installed entry points. ++ ++ Also provides a ``.groups`` attribute that reports all identifed entry ++ point groups, and a ``.names`` attribute that reports all identified entry ++ point names. ++ ++.. class:: EntryPoint ++ ++ Details of an installed entry point. ++ ++ Each :class:`!EntryPoint` instance has ``.name``, ``.group``, and ``.value`` ++ attributes and a ``.load()`` method to resolve the value. There are also ++ ``.module``, ``.attr``, and ``.extras`` attributes for getting the ++ components of the ``.value`` attribute, and ``.dist`` for obtaining ++ information regarding the distribution package that provides the entry point. + + Query all entry points:: + + >>> eps = entry_points() # doctest: +SKIP + +-The ``entry_points()`` function returns an ``EntryPoints`` object, +-a collection of all ``EntryPoint`` objects with ``names`` and ``groups`` ++The :func:`!entry_points` function returns a :class:`!EntryPoints` object, ++a collection of all :class:`!EntryPoint` objects with ``names`` and ``groups`` + attributes for convenience:: + + >>> sorted(eps.groups) # doctest: +SKIP + ['console_scripts', 'distutils.commands', 'distutils.setup_keywords', 'egg_info.writers', 'setuptools.installation'] + +-``EntryPoints`` has a ``select`` method to select entry points ++:class:`!EntryPoints` has a :meth:`!select` method to select entry points + matching specific properties. Select entry points in the + ``console_scripts`` group:: + + >>> scripts = eps.select(group='console_scripts') # doctest: +SKIP + +-Equivalently, since ``entry_points`` passes keyword arguments ++Equivalently, since :func:`!entry_points` passes keyword arguments + through to select:: + + >>> scripts = entry_points(group='console_scripts') # doctest: +SKIP +@@ -189,31 +218,41 @@ for more information on entry points, their definition, and usage. + Distribution metadata + --------------------- + +-Every `Distribution Package `_ includes some metadata, +-which you can extract using the +-``metadata()`` function:: ++.. function:: metadata(distribution_name) ++ ++ Return the distribution metadata corresponding to the named ++ distribution package as a :class:`PackageMetadata` instance. ++ ++ Raises :exc:`PackageNotFoundError` if the named distribution ++ package is not installed in the current Python environment. ++ ++.. class:: PackageMetadata ++ ++ A concrete implementation of the ++ `PackageMetadata protocol `_. ++ ++ In addition to providing the defined protocol methods and attributes, subscripting ++ the instance is equivalent to calling the :meth:`!get` method. ++ ++Every `Distribution Package `_ ++includes some metadata, which you can extract using the :func:`!metadata` function:: + + >>> wheel_metadata = metadata('wheel') # doctest: +SKIP + +-The keys of the returned data structure, a ``PackageMetadata``, +-name the metadata keywords, and ++The keys of the returned data structure name the metadata keywords, and + the values are returned unparsed from the distribution metadata:: + + >>> wheel_metadata['Requires-Python'] # doctest: +SKIP + '>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*' + +-``PackageMetadata`` also presents a ``json`` attribute that returns ++:class:`PackageMetadata` also presents a :attr:`!json` attribute that returns + all the metadata in a JSON-compatible form per :PEP:`566`:: + + >>> wheel_metadata.json['requires_python'] + '>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*' + +-.. note:: +- +- The actual type of the object returned by ``metadata()`` is an +- implementation detail and should be accessed only through the interface +- described by the +- `PackageMetadata protocol `_. ++The full set of available metadata is not described here. ++See the PyPA `Core metadata specification `_ for additional details. + + .. versionchanged:: 3.10 + The ``Description`` is now included in the metadata when presented +@@ -227,7 +266,15 @@ all the metadata in a JSON-compatible form per :PEP:`566`:: + Distribution versions + --------------------- + +-The ``version()`` function is the quickest way to get a ++.. function:: version(distribution_name) ++ ++ Return the installed distribution package version for the named ++ distribution package. ++ ++ Raises :exc:`PackageNotFoundError` if the named distribution ++ package is not installed in the current Python environment. ++ ++The :func:`!version` function is the quickest way to get a + `Distribution Package `_'s version + number, as a string:: + +@@ -240,12 +287,28 @@ number, as a string:: + Distribution files + ------------------ + +-You can also get the full set of files contained within a distribution. The +-``files()`` function takes a `Distribution Package `_ name +-and returns all of the +-files installed by this distribution. Each file object returned is a +-``PackagePath``, a :class:`pathlib.PurePath` derived object with additional ``dist``, +-``size``, and ``hash`` properties as indicated by the metadata. For example:: ++.. function:: files(distribution_name) ++ ++ Return the full set of files contained within the named ++ distribution package. ++ ++ Raises :exc:`PackageNotFoundError` if the named distribution ++ package is not installed in the current Python environment. ++ ++ Returns :const:`None` if the distribution is found but the installation ++ database records reporting the files associated with the distribuion package ++ are missing. ++ ++.. class:: PackagePath ++ ++ A :class:`pathlib.PurePath` derived object with additional ``dist``, ++ ``size``, and ``hash`` properties corresponding to the distribution ++ package's installation metadata for that file. ++ ++The :func:`!files` function takes a ++`Distribution Package `_ ++name and returns all of the files installed by this distribution. Each file is reported ++as a :class:`PackagePath` instance. For example:: + + >>> util = [p for p in files('wheel') if 'util.py' in str(p)][0] # doctest: +SKIP + >>> util # doctest: +SKIP +@@ -268,16 +331,16 @@ Once you have the file, you can also read its contents:: + return s.encode('utf-8') + return s + +-You can also use the ``locate`` method to get a the absolute path to the +-file:: ++You can also use the :meth:`!locate` method to get the absolute ++path to the file:: + + >>> util.locate() # doctest: +SKIP + PosixPath('/home/gustav/example/lib/site-packages/wheel/util.py') + + In the case where the metadata file listing files +-(RECORD or SOURCES.txt) is missing, ``files()`` will +-return ``None``. The caller may wish to wrap calls to +-``files()`` in `always_iterable ++(``RECORD`` or ``SOURCES.txt``) is missing, :func:`!files` will ++return :const:`None`. The caller may wish to wrap calls to ++:func:`!files` in `always_iterable + `_ + or otherwise guard against this condition if the target + distribution is not known to have the metadata present. +@@ -287,8 +350,16 @@ distribution is not known to have the metadata present. + Distribution requirements + ------------------------- + ++.. function:: requires(distribution_name) ++ ++ Return the declared dependency specifiers for the named ++ distribution package. ++ ++ Raises :exc:`PackageNotFoundError` if the named distribution ++ package is not installed in the current Python environment. ++ + To get the full set of requirements for a `Distribution Package `_, +-use the ``requires()`` ++use the :func:`!requires` + function:: + + >>> requires('wheel') # doctest: +SKIP +@@ -301,6 +372,16 @@ function:: + Mapping import to distribution packages + --------------------------------------- + ++.. function:: packages_distributions() ++ ++ Return a mapping from the top level module and import package ++ names found via :attr:`sys.meta_path` to the names of the distribution ++ packages (if any) that provide the corresponding files. ++ ++ To allow for namespace packages (which may have members provided by ++ multiple distribution packages), each top level import name maps to a ++ list of distribution names rather than mapping directly to a single name. ++ + A convenience method to resolve the `Distribution Package `_ + name (or names, in the case of a namespace package) + that provide each importable top-level +@@ -320,23 +401,42 @@ function is not reliable with such installs. + Distributions + ============= + +-While the above API is the most common and convenient usage, you can get all +-of that information from the ``Distribution`` class. A ``Distribution`` is an +-abstract object that represents the metadata for +-a Python `Distribution Package `_. You can +-get the ``Distribution`` instance:: ++.. function:: distribution(distribution_name) ++ ++ Return a :class:`Distribution` instance describing the named ++ distribution package. ++ ++ Raises :exc:`PackageNotFoundError` if the named distribution ++ package is not installed in the current Python environment. ++ ++.. class:: Distribution ++ ++ Details of an installed distribution package. ++ ++ Note: different :class:`!Distribution` instances do not currently compare ++ equal, even if they relate to the same installed distribution and ++ accordingly have the same attributes. ++ ++While the module level API described above is the most common and convenient usage, ++you can get all of that information from the :class:`!Distribution` class. ++:class:`!Distribution` is an abstract object that represents the metadata for ++a Python `Distribution Package `_. ++You can get the concreate :class:`!Distribution` subclass instance for an installed ++distribution package by calling the :func:`distribution` function:: + + >>> from importlib.metadata import distribution # doctest: +SKIP + >>> dist = distribution('wheel') # doctest: +SKIP ++ >>> type(dist) # doctest: +SKIP ++ + + Thus, an alternative way to get the version number is through the +-``Distribution`` instance:: ++:class:`!Distribution` instance:: + + >>> dist.version # doctest: +SKIP + '0.32.3' + +-There are all kinds of additional metadata available on the ``Distribution`` +-instance:: ++There are all kinds of additional metadata available on :class:`!Distribution` ++instances:: + + >>> dist.metadata['Requires-Python'] # doctest: +SKIP + '>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*' +@@ -350,7 +450,7 @@ metadata:: + 'file:///path/to/wheel-0.32.3.editable-py3-none-any.whl' + + The full set of available metadata is not described here. +-See the `Core metadata specifications `_ for additional details. ++See the PyPA `Core metadata specification `_ for additional details. + + .. versionadded:: 3.13 + The ``.origin`` property was added. +@@ -455,7 +555,7 @@ path. + + ``DatabaseDistribution``, then, would look something like:: + +- class DatabaseDistribution(importlib.metadata.Distributon): ++ class DatabaseDistribution(importlib.metadata.Distribution): + def __init__(self, record): + self.record = record + +diff --git a/Doc/library/importlib.rst b/Doc/library/importlib.rst +index 1b798568646..de41104216d 100644 +--- a/Doc/library/importlib.rst ++++ b/Doc/library/importlib.rst +@@ -249,7 +249,7 @@ ABC hierarchy:: + An abstract method for finding a :term:`spec ` for + the specified module. If this is a top-level import, *path* will + be ``None``. Otherwise, this is a search for a subpackage or +- module and *path* will be the value of :attr:`__path__` from the ++ module and *path* will be the value of :attr:`~module.__path__` from the + parent package. If a spec cannot be found, ``None`` is returned. + When passed in, ``target`` is a module object that the finder may + use to make a more educated guess about what spec to return. +@@ -355,34 +355,12 @@ ABC hierarchy:: + (note that some of these attributes can change when a module is + reloaded): + +- - :attr:`__name__` +- The module's fully qualified name. +- It is ``'__main__'`` for an executed module. +- +- - :attr:`__file__` +- The location the :term:`loader` used to load the module. +- For example, for modules loaded from a .py file this is the filename. +- It is not set on all modules (e.g. built-in modules). +- +- - :attr:`__cached__` +- The filename of a compiled version of the module's code. +- It is not set on all modules (e.g. built-in modules). +- +- - :attr:`__path__` +- The list of locations where the package's submodules will be found. +- Most of the time this is a single directory. +- The import system passes this attribute to ``__import__()`` and to finders +- in the same way as :data:`sys.path` but just for the package. +- It is not set on non-package modules so it can be used +- as an indicator that the module is a package. +- +- - :attr:`__package__` +- The fully qualified name of the package the module is in (or the +- empty string for a top-level module). +- If the module is a package then this is the same as :attr:`__name__`. +- +- - :attr:`__loader__` +- The :term:`loader` used to load the module. ++ - :attr:`module.__name__` ++ - :attr:`module.__file__` ++ - :attr:`module.__cached__` *(deprecated)* ++ - :attr:`module.__path__` ++ - :attr:`module.__package__` *(deprecated)* ++ - :attr:`module.__loader__` *(deprecated)* + + When :meth:`exec_module` is available then backwards-compatible + functionality is provided. +@@ -418,7 +396,8 @@ ABC hierarchy:: + can implement this abstract method to give direct access + to the data stored. :exc:`OSError` is to be raised if the *path* cannot + be found. The *path* is expected to be constructed using a module's +- :attr:`__file__` attribute or an item from a package's :attr:`__path__`. ++ :attr:`~module.__file__` attribute or an item from a package's ++ :attr:`~module.__path__`. + + .. versionchanged:: 3.4 + Raises :exc:`OSError` instead of :exc:`NotImplementedError`. +@@ -505,9 +484,9 @@ ABC hierarchy:: + + .. abstractmethod:: get_filename(fullname) + +- An abstract method that is to return the value of :attr:`__file__` for +- the specified module. If no path is available, :exc:`ImportError` is +- raised. ++ An abstract method that is to return the value of ++ :attr:`~module.__file__` for the specified module. If no path is ++ available, :exc:`ImportError` is raised. + + If source code is available, then the method should return the path to + the source file, regardless of whether a bytecode was used to load the +@@ -1166,43 +1145,45 @@ find and load modules. + .. class:: ModuleSpec(name, loader, *, origin=None, loader_state=None, is_package=None) + + A specification for a module's import-system-related state. This is +- typically exposed as the module's :attr:`__spec__` attribute. Many ++ typically exposed as the module's :attr:`~module.__spec__` attribute. Many + of these attributes are also available directly on a module: for example, + ``module.__spec__.origin == module.__file__``. Note, however, that + while the *values* are usually equivalent, they can differ since there is +- no synchronization between the two objects. For example, it is possible to update +- the module's :attr:`__file__` at runtime and this will not be automatically +- reflected in the module's :attr:`__spec__.origin`, and vice versa. ++ no synchronization between the two objects. For example, it is possible to ++ update the module's :attr:`~module.__file__` at runtime and this will not be ++ automatically reflected in the module's ++ :attr:`__spec__.origin `, and vice versa. + + .. versionadded:: 3.4 + + .. attribute:: name + +- The module's fully qualified name +- (see :attr:`__name__` attributes on modules). ++ The module's fully qualified name (see :attr:`module.__name__`). + The :term:`finder` should always set this attribute to a non-empty string. + + .. attribute:: loader + +- The :term:`loader` used to load the module +- (see :attr:`__loader__` attributes on modules). ++ The :term:`loader` used to load the module (see :attr:`module.__loader__`). + The :term:`finder` should always set this attribute. + + .. attribute:: origin + + The location the :term:`loader` should use to load the module +- (see :attr:`__file__` attributes on modules). +- For example, for modules loaded from a .py file this is the filename. ++ (see :attr:`module.__file__`). ++ For example, for modules loaded from a ``.py`` file this is the filename. + The :term:`finder` should always set this attribute to a meaningful value + for the :term:`loader` to use. In the uncommon case that there is not one + (like for namespace packages), it should be set to ``None``. + + .. attribute:: submodule_search_locations + +- The list of locations where the package's submodules will be found +- (see :attr:`__path__` attributes on modules). +- Most of the time this is a single directory. +- The :term:`finder` should set this attribute to a list, even an empty one, to indicate ++ A (possibly empty) :term:`sequence` of strings enumerating the locations ++ in which a package's submodules will be found ++ (see :attr:`module.__path__`). Most of the time there will only be a ++ single directory in this list. ++ ++ The :term:`finder` should set this attribute to a sequence, even an empty ++ one, to indicate + to the import system that the module is a package. It should be set to ``None`` for + non-package modules. It is set automatically later to a special object for + namespace packages. +@@ -1216,7 +1197,7 @@ find and load modules. + .. attribute:: cached + + The filename of a compiled version of the module's code +- (see :attr:`__cached__` attributes on modules). ++ (see :attr:`module.__cached__`). + The :term:`finder` should always set this attribute but it may be ``None`` + for modules that do not need compiled code stored. + +@@ -1224,14 +1205,14 @@ find and load modules. + + (Read-only) The fully qualified name of the package the module is in (or the + empty string for a top-level module). +- See :attr:`__package__` attributes on modules. ++ See :attr:`module.__package__`. + If the module is a package then this is the same as :attr:`name`. + + .. attribute:: has_location + + ``True`` if the spec's :attr:`origin` refers to a loadable location, +- ``False`` otherwise. This value impacts how :attr:`origin` is interpreted +- and how the module's :attr:`__file__` is populated. ++ ``False`` otherwise. This value impacts how :attr:`!origin` is interpreted ++ and how the module's :attr:`~module.__file__` is populated. + + + .. class:: AppleFrameworkLoader(name, path) +@@ -1416,8 +1397,8 @@ an :term:`importer`. + + .. versionchanged:: 3.7 + Raises :exc:`ModuleNotFoundError` instead of :exc:`AttributeError` if +- **package** is in fact not a package (i.e. lacks a :attr:`__path__` +- attribute). ++ **package** is in fact not a package (i.e. lacks a ++ :attr:`~module.__path__` attribute). + + .. function:: module_from_spec(spec) + +diff --git a/Doc/library/itertools.rst b/Doc/library/itertools.rst +index 43e665c3f0d..79b729e36f9 100644 +--- a/Doc/library/itertools.rst ++++ b/Doc/library/itertools.rst +@@ -58,7 +58,7 @@ Iterator Arguments Results + :func:`compress` data, selectors (d[0] if s[0]), (d[1] if s[1]), ... ``compress('ABCDEF', [1,0,1,0,1,1]) → A C E F`` + :func:`dropwhile` predicate, seq seq[n], seq[n+1], starting when predicate fails ``dropwhile(lambda x: x<5, [1,4,6,3,8]) → 6 3 8`` + :func:`filterfalse` predicate, seq elements of seq where predicate(elem) fails ``filterfalse(lambda x: x<5, [1,4,6,3,8]) → 6 8`` +-:func:`groupby` iterable[, key] sub-iterators grouped by value of key(v) ++:func:`groupby` iterable[, key] sub-iterators grouped by value of key(v) ``groupby(['A','B','DEF'], len) → (1, A B) (3, DEF)`` + :func:`islice` seq, [start,] stop [, step] elements from seq[start:stop:step] ``islice('ABCDEFG', 2, None) → C D E F G`` + :func:`pairwise` iterable (p[0], p[1]), (p[1], p[2]) ``pairwise('ABCDEFG') → AB BC CD DE EF FG`` + :func:`starmap` func, seq func(\*seq[0]), func(\*seq[1]), ... ``starmap(pow, [(2,5), (3,2), (10,3)]) → 32 9 1000`` +@@ -93,7 +93,7 @@ Examples Results + Itertool Functions + ------------------ + +-The following module functions all construct and return iterators. Some provide ++The following functions all construct and return iterators. Some provide + streams of infinite length, so they should only be accessed by functions or + loops that truncate the stream. + +@@ -131,11 +131,12 @@ loops that truncate the stream. + total = function(total, element) + yield total + +- The *function* argument can be set to :func:`min` for a running +- minimum, :func:`max` for a running maximum, or :func:`operator.mul` +- for a running product. `Amortization tables +- `_ +- can be built by accumulating interest and applying payments: ++ To compute a running minimum, set *function* to :func:`min`. ++ For a running maximum, set *function* to :func:`max`. ++ Or for a running product, set *function* to :func:`operator.mul`. ++ To build an `amortization table ++ `_, ++ accumulate the interest and apply payments: + + .. doctest:: + +@@ -202,10 +203,10 @@ loops that truncate the stream. + + .. function:: chain(*iterables) + +- Make an iterator that returns elements from the first iterable until it is +- exhausted, then proceeds to the next iterable, until all of the iterables are +- exhausted. Used for treating consecutive sequences as a single sequence. +- Roughly equivalent to:: ++ Make an iterator that returns elements from the first iterable until ++ it is exhausted, then proceeds to the next iterable, until all of the ++ iterables are exhausted. This combines multiple data sources into a ++ single iterator. Roughly equivalent to:: + + def chain(*iterables): + # chain('ABC', 'DEF') → A B C D E F +@@ -353,10 +354,12 @@ loops that truncate the stream. + + def cycle(iterable): + # cycle('ABCD') → A B C D A B C D A B C D ... ++ + saved = [] + for element in iterable: + yield element + saved.append(element) ++ + while saved: + for element in saved: + yield element +@@ -396,8 +399,10 @@ loops that truncate the stream. + + def filterfalse(predicate, iterable): + # filterfalse(lambda x: x<5, [1,4,6,3,8]) → 6 8 ++ + if predicate is None: + predicate = bool ++ + for x in iterable: + if not predicate(x): + yield x +@@ -474,7 +479,7 @@ loops that truncate the stream. + If *start* is zero or ``None``, iteration starts at zero. Otherwise, + elements from the iterable are skipped until *start* is reached. + +- If *stop* is ``None``, iteration continues until the iterator is ++ If *stop* is ``None``, iteration continues until the input is + exhausted, if at all. Otherwise, it stops at the specified position. + + If *step* is ``None``, the step defaults to one. Elements are returned +@@ -503,6 +508,10 @@ loops that truncate the stream. + yield element + next_i += step + ++ If the input is an iterator, then fully consuming the *islice* ++ advances the input iterator by ``max(start, stop)`` steps regardless ++ of the *step* value. ++ + + .. function:: pairwise(iterable) + +@@ -516,8 +525,10 @@ loops that truncate the stream. + + def pairwise(iterable): + # pairwise('ABCDEFG') → AB BC CD DE EF FG ++ + iterator = iter(iterable) + a = next(iterator, None) ++ + for b in iterator: + yield a, b + a = b +@@ -580,7 +591,8 @@ loops that truncate the stream. + + .. function:: product(*iterables, repeat=1) + +- Cartesian product of input iterables. ++ `Cartesian product `_ ++ of the input iterables. + + Roughly equivalent to nested for-loops in a generator expression. For example, + ``product(A, B)`` returns the same as ``((x,y) for x in A for y in B)``. +@@ -601,6 +613,8 @@ loops that truncate the stream. + # product('ABCD', 'xy') → Ax Ay Bx By Cx Cy Dx Dy + # product(range(2), repeat=3) → 000 001 010 011 100 101 110 111 + ++ if repeat < 0: ++ raise ValueError('repeat argument cannot be negative') + pools = [tuple(pool) for pool in iterables] * repeat + + result = [[]] +@@ -684,24 +698,63 @@ loops that truncate the stream. + Roughly equivalent to:: + + def tee(iterable, n=2): +- iterator = iter(iterable) +- shared_link = [None, None] +- return tuple(_tee(iterator, shared_link) for _ in range(n)) +- +- def _tee(iterator, link): +- try: +- while True: +- if link[1] is None: +- link[0] = next(iterator) +- link[1] = [None, None] +- value, link = link +- yield value +- except StopIteration: +- return ++ if n < 0: ++ raise ValueError ++ if n == 0: ++ return () ++ iterator = _tee(iterable) ++ result = [iterator] ++ for _ in range(n - 1): ++ result.append(_tee(iterator)) ++ return tuple(result) ++ ++ class _tee: ++ ++ def __init__(self, iterable): ++ it = iter(iterable) ++ if isinstance(it, _tee): ++ self.iterator = it.iterator ++ self.link = it.link ++ else: ++ self.iterator = it ++ self.link = [None, None] ++ ++ def __iter__(self): ++ return self ++ ++ def __next__(self): ++ link = self.link ++ if link[1] is None: ++ link[0] = next(self.iterator) ++ link[1] = [None, None] ++ value, self.link = link ++ return value ++ ++ When the input *iterable* is already a tee iterator object, all ++ members of the return tuple are constructed as if they had been ++ produced by the upstream :func:`tee` call. This "flattening step" ++ allows nested :func:`tee` calls to share the same underlying data ++ chain and to have a single update step rather than a chain of calls. ++ ++ The flattening property makes tee iterators efficiently peekable: ++ ++ .. testcode:: + +- Once a :func:`tee` has been created, the original *iterable* should not be +- used anywhere else; otherwise, the *iterable* could get advanced without +- the tee objects being informed. ++ def lookahead(tee_iterator): ++ "Return the next value without moving the input forward" ++ [forked_iterator] = tee(tee_iterator, 1) ++ return next(forked_iterator) ++ ++ .. doctest:: ++ ++ >>> iterator = iter('abcdef') ++ >>> [iterator] = tee(iterator, 1) # Make the input peekable ++ >>> next(iterator) # Move the iterator forward ++ 'a' ++ >>> lookahead(iterator) # Check next value ++ 'b' ++ >>> next(iterator) # Continue moving forward ++ 'b' + + ``tee`` iterators are not threadsafe. A :exc:`RuntimeError` may be + raised when simultaneously using iterators returned by the same :func:`tee` +@@ -919,15 +972,6 @@ and :term:`generators ` which incur interpreter overhead. + iterators = cycle(islice(iterators, num_active)) + yield from map(next, iterators) + +- def partition(predicate, iterable): +- """Partition entries into false entries and true entries. +- +- If *predicate* is slow, consider wrapping it with functools.lru_cache(). +- """ +- # partition(is_odd, range(10)) → 0 2 4 6 8 and 1 3 5 7 9 +- t1, t2 = tee(iterable) +- return filterfalse(predicate, t1), filter(predicate, t2) +- + def subslices(seq): + "Return all contiguous non-empty subslices of a sequence." + # subslices('ABCD') → A AB ABC ABCD B BC BCD C CD D +@@ -1145,15 +1189,19 @@ The following recipes have a more mathematical flavor: + >>> list(it) + ['d', 'e', 'f'] + ++ + >>> list(prepend(1, [2, 3, 4])) + [1, 2, 3, 4] + ++ + >>> list(enumerate('abc')) + [(0, 'a'), (1, 'b'), (2, 'c')] + ++ + >>> list(islice(tabulate(lambda x: 2*x), 4)) + [0, 2, 4, 6] + ++ + >>> list(tail(3, 'ABCDEFG')) + ['E', 'F', 'G'] + >>> # Verify the input is consumed greedily +@@ -1162,6 +1210,7 @@ The following recipes have a more mathematical flavor: + >>> list(input_iterator) + [] + ++ + >>> it = iter(range(10)) + >>> consume(it, 3) + >>> # Verify the input is consumed lazily +@@ -1172,6 +1221,7 @@ The following recipes have a more mathematical flavor: + >>> next(it, 'Done') + 'Done' + ++ + >>> nth('abcde', 3) + 'd' + >>> nth('abcde', 9) is None +@@ -1183,6 +1233,7 @@ The following recipes have a more mathematical flavor: + >>> list(it) + ['d', 'e'] + ++ + >>> [all_equal(s) for s in ('', 'A', 'AAAA', 'AAAB', 'AAABA')] + [True, True, True, False, False] + >>> [all_equal(s, key=str.casefold) for s in ('', 'A', 'AaAa', 'AAAB', 'AAABA')] +@@ -1196,24 +1247,19 @@ The following recipes have a more mathematical flavor: + >>> ''.join(it) + 'bbccc' + ++ + >>> quantify(range(99), lambda x: x%2==0) + 50 +- + >>> quantify([True, False, False, True, True]) + 3 +- + >>> quantify(range(12), predicate=lambda x: x%2==1) + 6 + ++ + >>> a = [[1, 2, 3], [4, 5, 6]] + >>> list(flatten(a)) + [1, 2, 3, 4, 5, 6] + +- >>> list(repeatfunc(pow, 5, 2, 3)) +- [8, 8, 8, 8, 8] +- +- >>> take(5, map(int, repeatfunc(random.random))) +- [0, 0, 0, 0, 0] + + >>> list(ncycles('abc', 3)) + ['a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c'] +@@ -1223,9 +1269,11 @@ The following recipes have a more mathematical flavor: + >>> list(input_iterator) + [] + ++ + >>> sum_of_squares([10, 20, 30]) + 1400 + ++ + >>> list(reshape([(0, 1), (2, 3), (4, 5)], 3)) + [(0, 1, 2), (3, 4, 5)] + >>> M = [(0, 1, 2, 3), (4, 5, 6, 7), (8, 9, 10, 11)] +@@ -1246,6 +1294,7 @@ The following recipes have a more mathematical flavor: + >>> list(reshape(M, 12)) + [(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11)] + ++ + >>> list(transpose([(1, 2, 3), (11, 22, 33)])) + [(1, 11), (2, 22), (3, 33)] + >>> # Verify that the inputs are consumed lazily +@@ -1257,11 +1306,13 @@ The following recipes have a more mathematical flavor: + >>> list(zip(input1, input2)) + [(2, 22), (3, 33)] + ++ + >>> list(matmul([(7, 5), (3, 5)], [[2, 5], [7, 9]])) + [(49, 80), (41, 60)] + >>> list(matmul([[2, 5], [7, 9], [3, 4]], [[7, 11, 5, 4, 9], [3, 5, 2, 6, 3]])) + [(29, 47, 20, 38, 33), (76, 122, 53, 82, 90), (33, 53, 23, 36, 39)] + ++ + >>> list(convolve([1, -1, -20], [1, -3])) == [1, -4, -17, 60] + True + >>> data = [20, 40, 24, 32, 20, 28, 16] +@@ -1284,6 +1335,7 @@ The following recipes have a more mathematical flavor: + >>> list(signal_iterator) + [30, 40, 50] + ++ + >>> from fractions import Fraction + >>> from decimal import Decimal + >>> polynomial_eval([1, -4, -17, 60], x=5) +@@ -1315,6 +1367,7 @@ The following recipes have a more mathematical flavor: + >>> polynomial_eval([11, 2], 7) == 11 * 7 + 2 + True + ++ + >>> polynomial_from_roots([5, -4, 3]) + [1, -4, -17, 60] + >>> factored = lambda x: (x - 5) * (x + 4) * (x - 3) +@@ -1322,9 +1375,11 @@ The following recipes have a more mathematical flavor: + >>> all(factored(x) == expanded(x) for x in range(-10, 11)) + True + ++ + >>> polynomial_derivative([1, -4, -17, 60]) + [3, -8, -17] + ++ + >>> list(iter_index('AABCADEAF', 'A')) + [0, 1, 4, 7] + >>> list(iter_index('AABCADEAF', 'B')) +@@ -1382,12 +1437,14 @@ The following recipes have a more mathematical flavor: + >>> ''.join(input_iterator) + 'DEAF' + ++ + >>> # Verify that the target value can be a sequence. + >>> seq = [[10, 20], [30, 40], 30, 40, [30, 40], 50] + >>> target = [30, 40] + >>> list(iter_index(seq, target)) + [1, 4] + ++ + >>> # Verify faithfulness to type specific index() method behaviors. + >>> # For example, bytes and str perform continuous-subsequence searches + >>> # that do not match the general behavior specified +@@ -1417,6 +1474,7 @@ The following recipes have a more mathematical flavor: + >>> set(sieve(10_000)).isdisjoint(carmichael) + True + ++ + >>> list(factor(99)) # Code example 1 + [3, 3, 11] + >>> list(factor(1_000_000_000_000_007)) # Code example 2 +@@ -1462,6 +1520,7 @@ The following recipes have a more mathematical flavor: + >>> all(list(factor(n)) == sorted(factor(n)) for n in range(2_000)) + True + ++ + >>> totient(0) # https://www.wolframalpha.com/input?i=totient+0 + 0 + >>> first_totients = [1, 1, 2, 2, 4, 2, 6, 4, 6, 4, 10, 4, 12, 6, 8, 8, 16, 6, +@@ -1481,9 +1540,15 @@ The following recipes have a more mathematical flavor: + >>> totient(6 ** 20) == 1 * 2**19 * 2 * 3**19 # repeated primes + True + ++ + >>> list(flatten([('a', 'b'), (), ('c', 'd', 'e'), ('f',), ('g', 'h', 'i')])) + ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i'] + ++ ++ >>> list(repeatfunc(pow, 5, 2, 3)) ++ [8, 8, 8, 8, 8] ++ >>> take(5, map(int, repeatfunc(random.random))) ++ [0, 0, 0, 0, 0] + >>> random.seed(85753098575309) + >>> list(repeatfunc(random.random, 3)) + [0.16370491282496968, 0.45889608687313455, 0.3747076837820118] +@@ -1492,9 +1557,11 @@ The following recipes have a more mathematical flavor: + >>> list(repeatfunc(pow, 3, 2, 5)) + [32, 32, 32] + ++ + >>> list(grouper('abcdefg', 3, fillvalue='x')) + [('a', 'b', 'c'), ('d', 'e', 'f'), ('g', 'x', 'x')] + ++ + >>> it = grouper('abcdefg', 3, incomplete='strict') + >>> next(it) + ('a', 'b', 'c') +@@ -1508,6 +1575,7 @@ The following recipes have a more mathematical flavor: + >>> list(grouper('abcdefg', n=3, incomplete='ignore')) + [('a', 'b', 'c'), ('d', 'e', 'f')] + ++ + >>> list(sliding_window('ABCDEFG', 1)) + [('A',), ('B',), ('C',), ('D',), ('E',), ('F',), ('G',)] + >>> list(sliding_window('ABCDEFG', 2)) +@@ -1537,6 +1605,7 @@ The following recipes have a more mathematical flavor: + ... + 'zero or negative n not supported' + ++ + >>> list(roundrobin('abc', 'd', 'ef')) + ['a', 'd', 'e', 'b', 'f', 'c'] + >>> ranges = [range(5, 1000), range(4, 3000), range(0), range(3, 2000), range(2, 5000), range(1, 3500)] +@@ -1550,38 +1619,19 @@ The following recipes have a more mathematical flavor: + >>> ''.join(chain(*input_iterators)) + 'dijkopqr' + +- >>> def is_odd(x): +- ... return x % 2 == 1 +- +- >>> evens, odds = partition(is_odd, range(10)) +- >>> list(evens) +- [0, 2, 4, 6, 8] +- >>> list(odds) +- [1, 3, 5, 7, 9] +- >>> # Verify that the input is consumed lazily +- >>> input_iterator = iter(range(10)) +- >>> evens, odds = partition(is_odd, input_iterator) +- >>> next(odds) +- 1 +- >>> next(odds) +- 3 +- >>> next(evens) +- 0 +- >>> list(input_iterator) +- [4, 5, 6, 7, 8, 9] + + >>> list(subslices('ABCD')) + ['A', 'AB', 'ABC', 'ABCD', 'B', 'BC', 'BCD', 'C', 'CD', 'D'] + ++ + >>> list(powerset([1,2,3])) + [(), (1,), (2,), (3,), (1, 2), (1, 3), (2, 3), (1, 2, 3)] +- + >>> all(len(list(powerset(range(n)))) == 2**n for n in range(18)) + True +- + >>> list(powerset('abcde')) == sorted(sorted(set(powerset('abcde'))), key=len) + True + ++ + >>> list(unique_everseen('AAAABBBCCDAABBB')) + ['A', 'B', 'C', 'D'] + >>> list(unique_everseen('ABBCcAD', str.casefold)) +@@ -1596,6 +1646,7 @@ The following recipes have a more mathematical flavor: + >>> ''.join(input_iterator) + 'AAABBBCCDAABBB' + ++ + >>> list(unique_justseen('AAAABBBCCDAABBB')) + ['A', 'B', 'C', 'D', 'A', 'B'] + >>> list(unique_justseen('ABBCcAD', str.casefold)) +@@ -1610,6 +1661,7 @@ The following recipes have a more mathematical flavor: + >>> ''.join(input_iterator) + 'AAABBBCCDAABBB' + ++ + >>> list(unique([[1, 2], [3, 4], [1, 2]])) + [[1, 2], [3, 4]] + >>> list(unique('ABBcCAD', str.casefold)) +@@ -1617,6 +1669,7 @@ The following recipes have a more mathematical flavor: + >>> list(unique('ABBcCAD', str.casefold, reverse=True)) + ['D', 'c', 'B', 'A'] + ++ + >>> d = dict(a=1, b=2, c=3) + >>> it = iter_except(d.popitem, KeyError) + >>> d['d'] = 4 +@@ -1634,6 +1687,7 @@ The following recipes have a more mathematical flavor: + >>> next(it, 'empty') + 'empty' + ++ + >>> first_true('ABC0DEF1', '9', str.isdigit) + '0' + >>> # Verify that inputs are consumed lazily +@@ -1714,21 +1768,36 @@ The following recipes have a more mathematical flavor: + + return true_iterator(), chain(transition, it) + ++ def partition(predicate, iterable): ++ """Partition entries into false entries and true entries. ++ ++ If *predicate* is slow, consider wrapping it with functools.lru_cache(). ++ """ ++ # partition(is_odd, range(10)) → 0 2 4 6 8 and 1 3 5 7 9 ++ t1, t2 = tee(iterable) ++ return filterfalse(predicate, t1), filter(predicate, t2) ++ ++ ++ + .. doctest:: + :hide: + + >>> dotproduct([1,2,3], [4,5,6]) + 32 + ++ + >>> sumprod([1,2,3], [4,5,6]) + 32 + ++ + >>> list(islice(pad_none('abc'), 0, 6)) + ['a', 'b', 'c', None, None, None] + ++ + >>> list(triplewise('ABCDEFG')) + [('A', 'B', 'C'), ('B', 'C', 'D'), ('C', 'D', 'E'), ('D', 'E', 'F'), ('E', 'F', 'G')] + ++ + >>> population = 'ABCDEFGH' + >>> for r in range(len(population) + 1): + ... seq = list(combinations(population, r)) +@@ -1736,16 +1805,38 @@ The following recipes have a more mathematical flavor: + ... assert nth_combination(population, r, i) == seq[i] + ... for i in range(-len(seq), 0): + ... assert nth_combination(population, r, i) == seq[i] +- ++ ... + >>> iterable = 'abcde' + >>> r = 3 + >>> combos = list(combinations(iterable, r)) + >>> all(nth_combination(iterable, r, i) == comb for i, comb in enumerate(combos)) + True + ++ + >>> it = iter('ABCdEfGhI') + >>> all_upper, remainder = before_and_after(str.isupper, it) + >>> ''.join(all_upper) + 'ABC' + >>> ''.join(remainder) + 'dEfGhI' ++ ++ ++ >>> def is_odd(x): ++ ... return x % 2 == 1 ++ ... ++ >>> evens, odds = partition(is_odd, range(10)) ++ >>> list(evens) ++ [0, 2, 4, 6, 8] ++ >>> list(odds) ++ [1, 3, 5, 7, 9] ++ >>> # Verify that the input is consumed lazily ++ >>> input_iterator = iter(range(10)) ++ >>> evens, odds = partition(is_odd, input_iterator) ++ >>> next(odds) ++ 1 ++ >>> next(odds) ++ 3 ++ >>> next(evens) ++ 0 ++ >>> list(input_iterator) ++ [4, 5, 6, 7, 8, 9] +diff --git a/Doc/library/locale.rst b/Doc/library/locale.rst +index 0246f991570..1bbe664954c 100644 +--- a/Doc/library/locale.rst ++++ b/Doc/library/locale.rst +@@ -311,8 +311,9 @@ The :mod:`locale` module defines the following exception and functions: + + .. data:: ALT_DIGITS + +- Get a representation of up to 100 values used to represent the values +- 0 to 99. ++ Get a string consisting of up to 100 semicolon-separated symbols used ++ to represent the values 0 to 99 in a locale-specific way. ++ In most locales this is an empty string. + + + .. function:: getdefaultlocale([envvars]) +diff --git a/Doc/library/logging.config.rst b/Doc/library/logging.config.rst +index 317ca872824..0e9dc33ae21 100644 +--- a/Doc/library/logging.config.rst ++++ b/Doc/library/logging.config.rst +@@ -753,16 +753,17 @@ The ``queue`` and ``listener`` keys are optional. + + If the ``queue`` key is present, the corresponding value can be one of the following: + +-* An object implementing the :class:`queue.Queue` public API. For instance, +- this may be an actual instance of :class:`queue.Queue` or a subclass thereof, +- or a proxy obtained by :meth:`multiprocessing.managers.SyncManager.Queue`. ++* An object implementing the :meth:`Queue.put_nowait ` ++ and :meth:`Queue.get ` public API. For instance, this may be ++ an actual instance of :class:`queue.Queue` or a subclass thereof, or a proxy ++ obtained by :meth:`multiprocessing.managers.SyncManager.Queue`. + + This is of course only possible if you are constructing or modifying + the configuration dictionary in code. + + * A string that resolves to a callable which, when called with no arguments, returns +- the :class:`queue.Queue` instance to use. That callable could be a +- :class:`queue.Queue` subclass or a function which returns a suitable queue instance, ++ the queue instance to use. That callable could be a :class:`queue.Queue` subclass ++ or a function which returns a suitable queue instance, + such as ``my.module.queue_factory()``. + + * A dict with a ``'()'`` key which is constructed in the usual way as discussed in +diff --git a/Doc/library/math.rst b/Doc/library/math.rst +index dd2ba419b5b..2ecee89a7db 100644 +--- a/Doc/library/math.rst ++++ b/Doc/library/math.rst +@@ -26,6 +26,92 @@ The following functions are provided by this module. Except when explicitly + noted otherwise, all return values are floats. + + ++==================================================== ============================================ ++**Number-theoretic and representation functions** ++-------------------------------------------------------------------------------------------------- ++:func:`ceil(x) ` Ceiling of *x*, the smallest integer greater than or equal to *x* ++:func:`comb(n, k) ` Number of ways to choose *k* items from *n* items without repetition and without order ++:func:`copysign(x, y) ` Magnitude (absolute value) of *x* with the sign of *y* ++:func:`fabs(x) ` Absolute value of *x* ++:func:`factorial(n) ` *n* factorial ++:func:`floor (x) ` Floor of *x*, the largest integer less than or equal to *x* ++:func:`fma(x, y, z) ` Fused multiply-add operation: ``(x * y) + z`` ++:func:`fmod(x, y) ` Remainder of division ``x / y`` ++:func:`frexp(x) ` Mantissa and exponent of *x* ++:func:`fsum(iterable) ` Sum of values in the input *iterable* ++:func:`gcd(*integers) ` Greatest common divisor of the integer arguments ++:func:`isclose(a, b, rel_tol, abs_tol) ` Check if the values *a* and *b* are close to each other ++:func:`isfinite(x) ` Check if *x* is neither an infinity nor a NaN ++:func:`isinf(x) ` Check if *x* is a positive or negative infinity ++:func:`isnan(x) ` Check if *x* is a NaN (not a number) ++:func:`isqrt(n) ` Integer square root of a nonnegative integer *n* ++:func:`lcm(*integers) ` Least common multiple of the integer arguments ++:func:`ldexp(x, i) ` ``x * (2**i)``, inverse of function :func:`frexp` ++:func:`modf(x) ` Fractional and integer parts of *x* ++:func:`nextafter(x, y, steps) ` Floating-point value *steps* steps after *x* towards *y* ++:func:`perm(n, k) ` Number of ways to choose *k* items from *n* items without repetition and with order ++:func:`prod(iterable, start) ` Product of elements in the input *iterable* with a *start* value ++:func:`remainder(x, y) ` Remainder of *x* with respect to *y* ++:func:`sumprod(p, q) ` Sum of products from two iterables *p* and *q* ++:func:`trunc(x) ` Integer part of *x* ++:func:`ulp(x) ` Value of the least significant bit of *x* ++ ++**Power and logarithmic functions** ++-------------------------------------------------------------------------------------------------- ++:func:`cbrt(x) ` Cube root of *x* ++:func:`exp(x) ` *e* raised to the power *x* ++:func:`exp2(x) ` *2* raised to the power *x* ++:func:`expm1(x) ` *e* raised to the power *x*, minus 1 ++:func:`log(x, base) ` Logarithm of *x* to the given base (*e* by default) ++:func:`log1p(x) ` Natural logarithm of *1+x* (base *e*) ++:func:`log2(x) ` Base-2 logarithm of *x* ++:func:`log10(x) ` Base-10 logarithm of *x* ++:func:`pow(x, y) ` *x* raised to the power *y* ++:func:`sqrt(x) ` Square root of *x* ++ ++**Trigonometric functions** ++-------------------------------------------------------------------------------------------------- ++:func:`acos(x) ` Arc cosine of *x* ++:func:`asin(x) ` Arc sine of *x* ++:func:`atan(x) ` Arc tangent of *x* ++:func:`atan2(y, x) ` ``atan(y / x)`` ++:func:`cos(x) ` Cosine of *x* ++:func:`dist(p, q) ` Euclidean distance between two points *p* and *q* given as an iterable of coordinates ++:func:`hypot(*coordinates) ` Euclidean norm of an iterable of coordinates ++:func:`sin(x) ` Sine of *x* ++:func:`tan(x) ` Tangent of *x* ++ ++**Angular conversion** ++-------------------------------------------------------------------------------------------------- ++:func:`degrees(x) ` Convert angle *x* from radians to degrees ++:func:`radians(x) ` Convert angle *x* from degrees to radians ++ ++**Hyperbolic functions** ++-------------------------------------------------------------------------------------------------- ++:func:`acosh(x) ` Inverse hyperbolic cosine of *x* ++:func:`asinh(x) ` Inverse hyperbolic sine of *x* ++:func:`atanh(x) ` Inverse hyperbolic tangent of *x* ++:func:`cosh(x) ` Hyperbolic cosine of *x* ++:func:`sinh(x) ` Hyperbolic sine of *x* ++:func:`tanh(x) ` Hyperbolic tangent of *x* ++ ++**Special functions** ++-------------------------------------------------------------------------------------------------- ++:func:`erf(x) ` `Error function `_ at *x* ++:func:`erfc(x) ` `Complementary error function `_ at *x* ++:func:`gamma(x) ` `Gamma function `_ at *x* ++:func:`lgamma(x) ` Natural logarithm of the absolute value of the `Gamma function `_ at *x* ++ ++**Constants** ++-------------------------------------------------------------------------------------------------- ++:data:`pi` *π* = 3.141592... ++:data:`e` *e* = 2.718281... ++:data:`tau` *τ* = 2\ *π* = 6.283185... ++:data:`inf` Positive infinity ++:data:`nan` "Not a number" (NaN) ++==================================================== ============================================ ++ ++ + Number-theoretic and representation functions + --------------------------------------------- + +@@ -158,19 +244,21 @@ Number-theoretic and representation functions + ``False`` otherwise. + + Whether or not two values are considered close is determined according to +- given absolute and relative tolerances. ++ given absolute and relative tolerances. If no errors occur, the result will ++ be: ``abs(a-b) <= max(rel_tol * max(abs(a), abs(b)), abs_tol)``. + + *rel_tol* is the relative tolerance -- it is the maximum allowed difference + between *a* and *b*, relative to the larger absolute value of *a* or *b*. + For example, to set a tolerance of 5%, pass ``rel_tol=0.05``. The default + tolerance is ``1e-09``, which assures that the two values are the same +- within about 9 decimal digits. *rel_tol* must be greater than zero. +- +- *abs_tol* is the minimum absolute tolerance -- useful for comparisons near +- zero. *abs_tol* must be at least zero. ++ within about 9 decimal digits. *rel_tol* must be nonnegative and less ++ than ``1.0``. + +- If no errors occur, the result will be: +- ``abs(a-b) <= max(rel_tol * max(abs(a), abs(b)), abs_tol)``. ++ *abs_tol* is the absolute tolerance; it defaults to ``0.0`` and it must be ++ nonnegative. When comparing ``x`` to ``0.0``, ``isclose(x, 0)`` is computed ++ as ``abs(x) <= rel_tol * abs(x)``, which is ``False`` for any ``x`` and ++ rel_tol less than ``1.0``. So add an appropriate positive abs_tol argument ++ to the call. + + The IEEE 754 special values of ``NaN``, ``inf``, and ``-inf`` will be + handled according to IEEE rules. Specifically, ``NaN`` is not considered +@@ -447,11 +535,11 @@ Power and logarithmic functions + + .. function:: pow(x, y) + +- Return ``x`` raised to the power ``y``. Exceptional cases follow ++ Return *x* raised to the power *y*. Exceptional cases follow + the IEEE 754 standard as far as possible. In particular, + ``pow(1.0, x)`` and ``pow(x, 0.0)`` always return ``1.0``, even +- when ``x`` is a zero or a NaN. If both ``x`` and ``y`` are finite, +- ``x`` is negative, and ``y`` is not an integer then ``pow(x, y)`` ++ when *x* is a zero or a NaN. If both *x* and *y* are finite, ++ *x* is negative, and *y* is not an integer then ``pow(x, y)`` + is undefined, and raises :exc:`ValueError`. + + Unlike the built-in ``**`` operator, :func:`math.pow` converts both +diff --git a/Doc/library/os.rst b/Doc/library/os.rst +index b93e01e9986..454e6d769fa 100644 +--- a/Doc/library/os.rst ++++ b/Doc/library/os.rst +@@ -3645,6 +3645,7 @@ features: + os.remove(os.path.join(root, name)) + for name in dirs: + os.rmdir(os.path.join(root, name)) ++ os.rmdir(top) + + .. audit-event:: os.walk top,topdown,onerror,followlinks os.walk + +@@ -4531,8 +4532,7 @@ written in Python, such as a mail server's external command delivery program. + only be sent to console processes which share a common console window, + e.g., some subprocesses. Any other value for *sig* will cause the process + to be unconditionally killed by the TerminateProcess API, and the exit code +- will be set to *sig*. The Windows version of :func:`kill` additionally takes +- process handles to be killed. ++ will be set to *sig*. + + See also :func:`signal.pthread_kill`. + +@@ -5541,7 +5541,7 @@ Miscellaneous System Information + If :option:`-X cpu_count <-X>` is given or :envvar:`PYTHON_CPU_COUNT` is set, + :func:`process_cpu_count` returns the overridden value *n*. + +- See also the :func:`sched_getaffinity` functions. ++ See also the :func:`sched_getaffinity` function. + + .. versionadded:: 3.13 + +diff --git a/Doc/library/pkgutil.rst b/Doc/library/pkgutil.rst +index f095cc84173..4a39d53a5f1 100644 +--- a/Doc/library/pkgutil.rst ++++ b/Doc/library/pkgutil.rst +@@ -26,7 +26,8 @@ support. + __path__ = extend_path(__path__, __name__) + + For each directory on :data:`sys.path` that has a subdirectory that matches the +- package name, add the subdirectory to the package's :attr:`__path__`. This is useful ++ package name, add the subdirectory to the package's ++ :attr:`~module.__path__`. This is useful + if one wants to distribute different parts of a single logical package as multiple + directories. + +diff --git a/Doc/library/pydoc.rst b/Doc/library/pydoc.rst +index 70e9c604eba..e8f153ee1b3 100644 +--- a/Doc/library/pydoc.rst ++++ b/Doc/library/pydoc.rst +@@ -52,8 +52,9 @@ produced for that file. + only execute code when a file is invoked as a script and not just imported. + + When printing output to the console, :program:`pydoc` attempts to paginate the +-output for easier reading. If the :envvar:`PAGER` environment variable is set, +-:program:`pydoc` will use its value as a pagination program. ++output for easier reading. If either the :envvar:`MANPAGER` or the ++:envvar:`PAGER` environment variable is set, :program:`pydoc` will use its ++value as a pagination program. When both are set, :envvar:`MANPAGER` is used. + + Specifying a ``-w`` flag before the argument will cause HTML documentation + to be written out to a file in the current directory, instead of displaying text +diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst +index 91250c45410..0d200449788 100644 +--- a/Doc/library/sqlite3.rst ++++ b/Doc/library/sqlite3.rst +@@ -2460,6 +2460,7 @@ Some useful URI tricks include: + >>> con.execute("CREATE TABLE readonly(data)") + Traceback (most recent call last): + OperationalError: attempt to write a readonly database ++ >>> con.close() + + * Do not implicitly create a new database file if it does not already exist; + will raise :exc:`~sqlite3.OperationalError` if unable to create a new file: +diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst +index 8b9d29545e3..b5ba8060cb4 100644 +--- a/Doc/library/stdtypes.rst ++++ b/Doc/library/stdtypes.rst +@@ -4469,14 +4469,14 @@ can be used interchangeably to index the same dictionary entry. + ``dict([('foo', 100), ('bar', 200)])``, ``dict(foo=100, bar=200)`` + + If no positional argument is given, an empty dictionary is created. +- If a positional argument is given and it is a mapping object, a dictionary +- is created with the same key-value pairs as the mapping object. Otherwise, +- the positional argument must be an :term:`iterable` object. Each item in +- the iterable must itself be an iterable with exactly two objects. The +- first object of each item becomes a key in the new dictionary, and the +- second object the corresponding value. If a key occurs more than once, the +- last value for that key becomes the corresponding value in the new +- dictionary. ++ If a positional argument is given and it defines a ``keys()`` method, a ++ dictionary is created by calling :meth:`~object.__getitem__` on the argument with ++ each returned key from the method. Otherwise, the positional argument must be an ++ :term:`iterable` object. Each item in the iterable must itself be an iterable ++ with exactly two elements. The first element of each item becomes a key in the ++ new dictionary, and the second element the corresponding value. If a key occurs ++ more than once, the last value for that key becomes the corresponding value in ++ the new dictionary. + + If keyword arguments are given, the keyword arguments and their values are + added to the dictionary created from the positional argument. If a key +@@ -4633,10 +4633,11 @@ can be used interchangeably to index the same dictionary entry. + Update the dictionary with the key/value pairs from *other*, overwriting + existing keys. Return ``None``. + +- :meth:`update` accepts either another dictionary object or an iterable of +- key/value pairs (as tuples or other iterables of length two). If keyword +- arguments are specified, the dictionary is then updated with those +- key/value pairs: ``d.update(red=1, blue=2)``. ++ :meth:`update` accepts either another object with a ``keys()`` method (in ++ which case :meth:`~object.__getitem__` is called with every key returned from ++ the method) or an iterable of key/value pairs (as tuples or other iterables ++ of length two). If keyword arguments are specified, the dictionary is then ++ updated with those key/value pairs: ``d.update(red=1, blue=2)``. + + .. method:: values() + +diff --git a/Doc/library/string.rst b/Doc/library/string.rst +index 57a1f920523..9e8e44a8abe 100644 +--- a/Doc/library/string.rst ++++ b/Doc/library/string.rst +@@ -350,8 +350,9 @@ The meaning of the various alignment options is as follows: + | ``'='`` | Forces the padding to be placed after the sign (if any) | + | | but before the digits. This is used for printing fields | + | | in the form '+000000120'. This alignment option is only | +-| | valid for numeric types. It becomes the default for | +-| | numbers when '0' immediately precedes the field width. | ++| | valid for numeric types, excluding :class:`complex`. | ++| | It becomes the default for numbers when '0' immediately | ++| | precedes the field width. | + +---------+----------------------------------------------------------+ + | ``'^'`` | Forces the field to be centered within the available | + | | space. | +@@ -432,9 +433,9 @@ including any prefixes, separators, and other formatting characters. + If not specified, then the field width will be determined by the content. + + When no explicit alignment is given, preceding the *width* field by a zero +-(``'0'``) character enables +-sign-aware zero-padding for numeric types. This is equivalent to a *fill* +-character of ``'0'`` with an *alignment* type of ``'='``. ++(``'0'``) character enables sign-aware zero-padding for numeric types, ++excluding :class:`complex`. This is equivalent to a *fill* character of ++``'0'`` with an *alignment* type of ``'='``. + + .. versionchanged:: 3.10 + Preceding the *width* field by ``'0'`` no longer affects the default +@@ -509,9 +510,8 @@ The available presentation types for :class:`float` and + | | significant digits. With no precision given, uses a | + | | precision of ``6`` digits after the decimal point for | + | | :class:`float`, and shows all coefficient digits | +- | | for :class:`~decimal.Decimal`. If no digits follow the | +- | | decimal point, the decimal point is also removed unless | +- | | the ``#`` option is used. | ++ | | for :class:`~decimal.Decimal`. If ``p=0``, the decimal | ++ | | point is omitted unless the ``#`` option is used. | + +---------+----------------------------------------------------------+ + | ``'E'`` | Scientific notation. Same as ``'e'`` except it uses | + | | an upper case 'E' as the separator character. | +@@ -522,9 +522,8 @@ The available presentation types for :class:`float` and + | | precision given, uses a precision of ``6`` digits after | + | | the decimal point for :class:`float`, and uses a | + | | precision large enough to show all coefficient digits | +- | | for :class:`~decimal.Decimal`. If no digits follow the | +- | | decimal point, the decimal point is also removed unless | +- | | the ``#`` option is used. | ++ | | for :class:`~decimal.Decimal`. If ``p=0``, the decimal | ++ | | point is omitted unless the ``#`` option is used. | + +---------+----------------------------------------------------------+ + | ``'F'`` | Fixed-point notation. Same as ``'f'``, but converts | + | | ``nan`` to ``NAN`` and ``inf`` to ``INF``. | +@@ -590,6 +589,15 @@ The available presentation types for :class:`float` and + | | as altered by the other format modifiers. | + +---------+----------------------------------------------------------+ + ++The available presentation types for :class:`complex` are the same as those for ++:class:`float` (``'%'`` is not allowed). Both the real and imaginary components ++of a complex number are formatted as floating-point numbers, according to the ++specified presentation type. They are separated by the mandatory sign of the ++imaginary part, the latter being terminated by a ``j`` suffix. If the presentation ++type is missing, the result will match the output of :func:`str` (complex numbers with ++a non-zero real part are also surrounded by parentheses), possibly altered by ++other format modifiers. ++ + + .. _formatexamples: + +diff --git a/Doc/library/symtable.rst b/Doc/library/symtable.rst +index ca7eaef45f6..56c62d8e610 100644 +--- a/Doc/library/symtable.rst ++++ b/Doc/library/symtable.rst +@@ -167,11 +167,12 @@ Examining Symbol Tables + + .. method:: get_nonlocals() + +- Return a tuple containing names of nonlocals in this function. ++ Return a tuple containing names of explicitly declared nonlocals in this function. + + .. method:: get_frees() + +- Return a tuple containing names of free variables in this function. ++ Return a tuple containing names of :term:`free (closure) variables ` ++ in this function. + + + .. class:: Class +diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst +index 1e1f65851fd..98ba4e5a4e2 100644 +--- a/Doc/library/sys.rst ++++ b/Doc/library/sys.rst +@@ -1274,7 +1274,8 @@ always available. + that implement Python's default import semantics. The + :meth:`~importlib.abc.MetaPathFinder.find_spec` method is called with at + least the absolute name of the module being imported. If the module to be +- imported is contained in a package, then the parent package's :attr:`__path__` ++ imported is contained in a package, then the parent package's ++ :attr:`~module.__path__` + attribute is passed in as a second argument. The method returns a + :term:`module spec`, or ``None`` if the module cannot be found. + +diff --git a/Doc/library/time.rst b/Doc/library/time.rst +index a0bf13fc0a3..6265c2214ea 100644 +--- a/Doc/library/time.rst ++++ b/Doc/library/time.rst +@@ -327,7 +327,7 @@ Functions + + .. impl-detail:: + +- On CPython, use the same clock than :func:`time.monotonic` and is a ++ On CPython, use the same clock as :func:`time.monotonic` and is a + monotonic clock, i.e. a clock that cannot go backwards. + + Use :func:`perf_counter_ns` to avoid the precision loss caused by the +@@ -339,7 +339,7 @@ Functions + On Windows, the function is now system-wide. + + .. versionchanged:: 3.13 +- Use the same clock than :func:`time.monotonic`. ++ Use the same clock as :func:`time.monotonic`. + + + .. function:: perf_counter_ns() -> int +@@ -390,7 +390,7 @@ Functions + threads ready to run, the function returns immediately, and the thread + continues execution. On Windows 8.1 and newer the implementation uses + a `high-resolution timer +- `_ ++ `_ + which provides resolution of 100 nanoseconds. If *secs* is zero, ``Sleep(0)`` is used. + + Unix implementation: +@@ -483,6 +483,9 @@ Functions + | | | | + | | | | + +-----------+------------------------------------------------+-------+ ++ | ``%u`` | Day of the week (Monday is 1; Sunday is 7) | | ++ | | as a decimal number [1, 7]. | | ++ +-----------+------------------------------------------------+-------+ + | ``%w`` | Weekday as a decimal number [0(Sunday),6]. | | + | | | | + +-----------+------------------------------------------------+-------+ +@@ -515,6 +518,16 @@ Functions + | ``%Z`` | Time zone name (no characters if no time zone | | + | | exists). Deprecated. [1]_ | | + +-----------+------------------------------------------------+-------+ ++ | ``%G`` | ISO 8601 year (similar to ``%Y`` but follows | | ++ | | the rules for the ISO 8601 calendar year). | | ++ | | The year starts with the week that contains | | ++ | | the first Thursday of the calendar year. | | ++ +-----------+------------------------------------------------+-------+ ++ | ``%V`` | ISO 8601 week number (as a decimal number | | ++ | | [01,53]). The first week of the year is the | | ++ | | one that contains the first Thursday of the | | ++ | | year. Weeks start on Monday. | | ++ +-----------+------------------------------------------------+-------+ + | ``%%`` | A literal ``'%'`` character. | | + +-----------+------------------------------------------------+-------+ + +diff --git a/Doc/library/traceback.rst b/Doc/library/traceback.rst +index 401e12be45f..100a92b73d5 100644 +--- a/Doc/library/traceback.rst ++++ b/Doc/library/traceback.rst +@@ -8,11 +8,15 @@ + + -------------- + +-This module provides a standard interface to extract, format and print stack +-traces of Python programs. It exactly mimics the behavior of the Python +-interpreter when it prints a stack trace. This is useful when you want to print +-stack traces under program control, such as in a "wrapper" around the +-interpreter. ++This module provides a standard interface to extract, format and print ++stack traces of Python programs. It is more flexible than the ++interpreter's default traceback display, and therefore makes it ++possible to configure certain aspects of the output. Finally, ++it contains a utility for capturing enough information about an ++exception to print it later, without the need to save a reference ++to the actual exception. Since exceptions can be the roots of large ++objects graph, this utility can significantly improve ++memory management. + + .. index:: pair: object; traceback + +@@ -29,7 +33,20 @@ which are assigned to the :attr:`~BaseException.__traceback__` field of + Module :mod:`pdb` + Interactive source code debugger for Python programs. + +-The module defines the following functions: ++The module's API can be divided into two parts: ++ ++* Module-level functions offering basic functionality, which are useful for interactive ++ inspection of exceptions and tracebacks. ++ ++* :class:`TracebackException` class and its helper classes ++ :class:`StackSummary` and :class:`FrameSummary`. These offer both more ++ flexibility in the output generated and the ability to store the information ++ necessary for later formatting without holding references to actual exception ++ and traceback objects. ++ ++ ++Module-Level Functions ++---------------------- + + .. function:: print_tb(tb, limit=None, file=None) + +@@ -237,7 +254,6 @@ The module defines the following functions: + + .. versionadded:: 3.5 + +-The module also defines the following classes: + + :class:`!TracebackException` Objects + ------------------------------------ +@@ -245,12 +261,17 @@ The module also defines the following classes: + .. versionadded:: 3.5 + + :class:`!TracebackException` objects are created from actual exceptions to +-capture data for later printing in a lightweight fashion. ++capture data for later printing. They offer a more lightweight method of ++storing this information by avoiding holding references to ++:ref:`traceback` and :ref:`frame` objects ++In addition, they expose more options to configure the output compared to ++the module-level functions described above. + + .. class:: TracebackException(exc_type, exc_value, exc_traceback, *, limit=None, lookup_lines=True, capture_locals=False, compact=False, max_group_width=15, max_group_depth=10) + +- Capture an exception for later rendering. *limit*, *lookup_lines* and +- *capture_locals* are as for the :class:`StackSummary` class. ++ Capture an exception for later rendering. The meaning of *limit*, ++ *lookup_lines* and *capture_locals* are as for the :class:`StackSummary` ++ class. + + If *compact* is true, only data that is required by + :class:`!TracebackException`'s :meth:`format` method +@@ -509,8 +530,8 @@ in a :ref:`traceback `. + + .. _traceback-example: + +-Traceback Examples +------------------- ++Examples of Using the Module-Level Functions ++-------------------------------------------- + + This simple example implements a basic read-eval-print loop, similar to (but + less useful than) the standard Python interactive interpreter loop. For a more +@@ -549,8 +570,7 @@ exception and traceback: + + try: + lumberjack() +- except IndexError: +- exc = sys.exception() ++ except IndexError as exc: + print("*** print_tb:") + traceback.print_tb(exc.__traceback__, limit=1, file=sys.stdout) + print("*** print_exception:") +@@ -653,5 +673,88 @@ This last example demonstrates the final few formatting functions: + [' File "spam.py", line 3, in \n spam.eggs()\n', + ' File "eggs.py", line 42, in eggs\n return "bacon"\n'] + >>> an_error = IndexError('tuple index out of range') +- >>> traceback.format_exception_only(type(an_error), an_error) ++ >>> traceback.format_exception_only(an_error) + ['IndexError: tuple index out of range\n'] ++ ++ ++Examples of Using :class:`TracebackException` ++--------------------------------------------- ++ ++With the helper class, we have more options:: ++ ++ >>> import sys ++ >>> from traceback import TracebackException ++ >>> ++ >>> def lumberjack(): ++ ... bright_side_of_life() ++ ... ++ >>> def bright_side_of_life(): ++ ... t = "bright", "side", "of", "life" ++ ... return t[5] ++ ... ++ >>> try: ++ ... lumberjack() ++ ... except IndexError as e: ++ ... exc = e ++ ... ++ >>> try: ++ ... try: ++ ... lumberjack() ++ ... except: ++ ... 1/0 ++ ... except Exception as e: ++ ... chained_exc = e ++ ... ++ >>> # limit works as with the module-level functions ++ >>> TracebackException.from_exception(exc, limit=-2).print() ++ Traceback (most recent call last): ++ File "", line 6, in lumberjack ++ bright_side_of_life() ++ ~~~~~~~~~~~~~~~~~~~^^ ++ File "", line 10, in bright_side_of_life ++ return t[5] ++ ~^^^ ++ IndexError: tuple index out of range ++ ++ >>> # capture_locals adds local variables in frames ++ >>> TracebackException.from_exception(exc, limit=-2, capture_locals=True).print() ++ Traceback (most recent call last): ++ File "", line 6, in lumberjack ++ bright_side_of_life() ++ ~~~~~~~~~~~~~~~~~~~^^ ++ File "", line 10, in bright_side_of_life ++ return t[5] ++ ~^^^ ++ t = ("bright", "side", "of", "life") ++ IndexError: tuple index out of range ++ ++ >>> # The *chain* kwarg to print() controls whether chained ++ >>> # exceptions are displayed ++ >>> TracebackException.from_exception(chained_exc).print() ++ Traceback (most recent call last): ++ File "", line 4, in ++ lumberjack() ++ ~~~~~~~~~~^^ ++ File "", line 7, in lumberjack ++ bright_side_of_life() ++ ~~~~~~~~~~~~~~~~~~~^^ ++ File "", line 11, in bright_side_of_life ++ return t[5] ++ ~^^^ ++ IndexError: tuple index out of range ++ ++ During handling of the above exception, another exception occurred: ++ ++ Traceback (most recent call last): ++ File "", line 6, in ++ 1/0 ++ ~^~ ++ ZeroDivisionError: division by zero ++ ++ >>> TracebackException.from_exception(chained_exc).print(chain=False) ++ Traceback (most recent call last): ++ File "", line 6, in ++ 1/0 ++ ~^~ ++ ZeroDivisionError: division by zero ++ +diff --git a/Doc/library/types.rst b/Doc/library/types.rst +index 3c3c760c206..439e119461f 100644 +--- a/Doc/library/types.rst ++++ b/Doc/library/types.rst +@@ -199,7 +199,7 @@ Standard names are defined for the following types: + .. data:: CellType + + The type for cell objects: such objects are used as containers for +- a function's free variables. ++ a function's :term:`closure variables `. + + .. versionadded:: 3.8 + +@@ -260,63 +260,18 @@ Standard names are defined for the following types: + The type of :term:`modules `. The constructor takes the name of the + module to be created and optionally its :term:`docstring`. + +- .. note:: +- Use :func:`importlib.util.module_from_spec` to create a new module if you +- wish to set the various import-controlled attributes. +- +- .. attribute:: __doc__ +- +- The :term:`docstring` of the module. Defaults to ``None``. +- +- .. attribute:: __loader__ +- +- The :term:`loader` which loaded the module. Defaults to ``None``. +- +- This attribute is to match :attr:`importlib.machinery.ModuleSpec.loader` +- as stored in the :attr:`__spec__` object. +- +- .. note:: +- A future version of Python may stop setting this attribute by default. +- To guard against this potential change, preferably read from the +- :attr:`__spec__` attribute instead or use +- ``getattr(module, "__loader__", None)`` if you explicitly need to use +- this attribute. +- +- .. versionchanged:: 3.4 +- Defaults to ``None``. Previously the attribute was optional. +- +- .. attribute:: __name__ +- +- The name of the module. Expected to match +- :attr:`importlib.machinery.ModuleSpec.name`. +- +- .. attribute:: __package__ +- +- Which :term:`package` a module belongs to. If the module is top-level +- (i.e. not a part of any specific package) then the attribute should be set +- to ``''``, else it should be set to the name of the package (which can be +- :attr:`__name__` if the module is a package itself). Defaults to ``None``. +- +- This attribute is to match :attr:`importlib.machinery.ModuleSpec.parent` +- as stored in the :attr:`__spec__` object. +- +- .. note:: +- A future version of Python may stop setting this attribute by default. +- To guard against this potential change, preferably read from the +- :attr:`__spec__` attribute instead or use +- ``getattr(module, "__package__", None)`` if you explicitly need to use +- this attribute. +- +- .. versionchanged:: 3.4 +- Defaults to ``None``. Previously the attribute was optional. +- +- .. attribute:: __spec__ +- +- A record of the module's import-system-related state. Expected to be an +- instance of :class:`importlib.machinery.ModuleSpec`. ++ .. seealso:: + +- .. versionadded:: 3.4 ++ :ref:`Documentation on module objects ` ++ Provides details on the special attributes that can be found on ++ instances of :class:`!ModuleType`. + ++ :func:`importlib.util.module_from_spec` ++ Modules created using the :class:`!ModuleType` constructor are ++ created with many of their special attributes unset or set to default ++ values. :func:`!module_from_spec` provides a more robust way of ++ creating :class:`!ModuleType` instances which ensures the various ++ attributes are set appropriately. + + .. data:: EllipsisType + +diff --git a/Doc/library/typing.rst b/Doc/library/typing.rst +index 40df38c5503..0c45c21841a 100644 +--- a/Doc/library/typing.rst ++++ b/Doc/library/typing.rst +@@ -1726,11 +1726,11 @@ without the dedicated syntax, as documented below. + class Sequence[T]: # T is a TypeVar + ... + +- This syntax can also be used to create bound and constrained type ++ This syntax can also be used to create bounded and constrained type + variables:: + +- class StrSequence[S: str]: # S is a TypeVar bound to str +- ... ++ class StrSequence[S: str]: # S is a TypeVar with a `str` upper bound; ++ ... # we can say that S is "bounded by `str`" + + + class StrOrBytesSequence[A: (str, bytes)]: # A is a TypeVar constrained to str or bytes +@@ -1763,8 +1763,8 @@ without the dedicated syntax, as documented below. + """Add two strings or bytes objects together.""" + return x + y + +- Note that type variables can be *bound*, *constrained*, or neither, but +- cannot be both bound *and* constrained. ++ Note that type variables can be *bounded*, *constrained*, or neither, but ++ cannot be both bounded *and* constrained. + + The variance of type variables is inferred by type checkers when they are created + through the :ref:`type parameter syntax ` or when +@@ -1774,8 +1774,8 @@ without the dedicated syntax, as documented below. + By default, manually created type variables are invariant. + See :pep:`484` and :pep:`695` for more details. + +- Bound type variables and constrained type variables have different +- semantics in several important ways. Using a *bound* type variable means ++ Bounded type variables and constrained type variables have different ++ semantics in several important ways. Using a *bounded* type variable means + that the ``TypeVar`` will be solved using the most specific type possible:: + + x = print_capitalized('a string') +@@ -1789,8 +1789,8 @@ without the dedicated syntax, as documented below. + + z = print_capitalized(45) # error: int is not a subtype of str + +- Type variables can be bound to concrete types, abstract types (ABCs or +- protocols), and even unions of types:: ++ The upper bound of a type variable can be a concrete type, abstract type ++ (ABC or Protocol), or even a union of types:: + + # Can be anything with an __abs__ method + def print_abs[T: SupportsAbs](arg: T) -> None: +@@ -1834,7 +1834,7 @@ without the dedicated syntax, as documented below. + + .. attribute:: __bound__ + +- The bound of the type variable, if any. ++ The upper bound of the type variable, if any. + + .. versionchanged:: 3.12 + +@@ -2060,7 +2060,7 @@ without the dedicated syntax, as documented below. + return x + y + + Without ``ParamSpec``, the simplest way to annotate this previously was to +- use a :class:`TypeVar` with bound ``Callable[..., Any]``. However this ++ use a :class:`TypeVar` with upper bound ``Callable[..., Any]``. However this + causes two problems: + + 1. The type checker can't type check the ``inner`` function because +diff --git a/Doc/library/unittest.mock.rst b/Doc/library/unittest.mock.rst +index 55ebf1acdb7..514c6b7e615 100644 +--- a/Doc/library/unittest.mock.rst ++++ b/Doc/library/unittest.mock.rst +@@ -68,7 +68,7 @@ available, and then make assertions about how they have been used: + 3 + >>> thing.method.assert_called_with(3, 4, 5, key='value') + +-:attr:`side_effect` allows you to perform side effects, including raising an ++:attr:`~Mock.side_effect` allows you to perform side effects, including raising an + exception when a mock is called: + + >>> from unittest.mock import Mock +@@ -737,8 +737,8 @@ the *new_callable* argument to :func:`patch`. + + .. attribute:: __class__ + +- Normally the :attr:`__class__` attribute of an object will return its type. +- For a mock object with a :attr:`spec`, ``__class__`` returns the spec class ++ Normally the :attr:`!__class__` attribute of an object will return its type. ++ For a mock object with a :attr:`!spec`, :attr:`!__class__` returns the spec class + instead. This allows mock objects to pass :func:`isinstance` tests for the + object they are replacing / masquerading as: + +@@ -746,7 +746,7 @@ the *new_callable* argument to :func:`patch`. + >>> isinstance(mock, int) + True + +- :attr:`__class__` is assignable to, this allows a mock to pass an ++ :attr:`!__class__` is assignable to, this allows a mock to pass an + :func:`isinstance` check without forcing you to use a spec: + + >>> mock = Mock() +@@ -760,8 +760,8 @@ the *new_callable* argument to :func:`patch`. + meaning of :class:`Mock`, with the exception of *return_value* and *side_effect* + which have no meaning on a non-callable mock. + +-Mock objects that use a class or an instance as a :attr:`spec` or +-:attr:`spec_set` are able to pass :func:`isinstance` tests: ++Mock objects that use a class or an instance as a :attr:`!spec` or ++:attr:`!spec_set` are able to pass :func:`isinstance` tests: + + >>> mock = Mock(spec=SomeClass) + >>> isinstance(mock, SomeClass) +@@ -1175,7 +1175,7 @@ Calls made to the object will be recorded in the attributes + like :attr:`~Mock.call_args` and :attr:`~Mock.call_args_list`. + + If :attr:`~Mock.side_effect` is set then it will be called after the call has +-been recorded, so if :attr:`side_effect` raises an exception the call is still ++been recorded, so if :attr:`!side_effect` raises an exception the call is still + recorded. + + The simplest way to make a mock raise an exception when called is to make +@@ -1196,8 +1196,8 @@ The simplest way to make a mock raise an exception when called is to make + >>> m.mock_calls + [call(1, 2, 3), call('two', 'three', 'four')] + +-If :attr:`side_effect` is a function then whatever that function returns is what +-calls to the mock return. The :attr:`side_effect` function is called with the ++If :attr:`~Mock.side_effect` is a function then whatever that function returns is what ++calls to the mock return. The :attr:`!side_effect` function is called with the + same arguments as the mock. This allows you to vary the return value of the + call dynamically, based on the input: + +@@ -1214,7 +1214,7 @@ call dynamically, based on the input: + + If you want the mock to still return the default return value (a new mock), or + any set return value, then there are two ways of doing this. Either return +-:attr:`mock.return_value` from inside :attr:`side_effect`, or return :data:`DEFAULT`: ++:attr:`~Mock.return_value` from inside :attr:`~Mock.side_effect`, or return :data:`DEFAULT`: + + >>> m = MagicMock() + >>> def side_effect(*args, **kwargs): +@@ -1231,8 +1231,8 @@ any set return value, then there are two ways of doing this. Either return + >>> m() + 3 + +-To remove a :attr:`side_effect`, and return to the default behaviour, set the +-:attr:`side_effect` to ``None``: ++To remove a :attr:`~Mock.side_effect`, and return to the default behaviour, set the ++:attr:`!side_effect` to ``None``: + + >>> m = MagicMock(return_value=6) + >>> def side_effect(*args, **kwargs): +@@ -1245,7 +1245,7 @@ To remove a :attr:`side_effect`, and return to the default behaviour, set the + >>> m() + 6 + +-The :attr:`side_effect` can also be any iterable object. Repeated calls to the mock ++The :attr:`~Mock.side_effect` can also be any iterable object. Repeated calls to the mock + will return values from the iterable (until the iterable is exhausted and + a :exc:`StopIteration` is raised): + +@@ -1286,7 +1286,7 @@ objects of any type. + + You may want a mock object to return ``False`` to a :func:`hasattr` call, or raise an + :exc:`AttributeError` when an attribute is fetched. You can do this by providing +-an object as a :attr:`spec` for a mock, but that isn't always convenient. ++an object as a :attr:`!spec` for a mock, but that isn't always convenient. + + You "block" attributes by deleting them. Once deleted, accessing an attribute + will raise an :exc:`AttributeError`. +@@ -1455,7 +1455,7 @@ patch + If you are patching builtins in a module then you don't + need to pass ``create=True``, it will be added by default. + +- Patch can be used as a :class:`TestCase` class decorator. It works by ++ Patch can be used as a :class:`~unittest.TestCase` class decorator. It works by + decorating each test method in the class. This reduces the boilerplate + code when your test methods share a common patchings set. :func:`patch` finds + tests by looking for method names that start with ``patch.TEST_PREFIX``. +@@ -1493,7 +1493,7 @@ If the class is instantiated multiple times you could use + can set the *return_value* to be anything you want. + + To configure return values on methods of *instances* on the patched class +-you must do this on the :attr:`return_value`. For example:: ++you must do this on the :attr:`~Mock.return_value`. For example:: + + >>> class Class: + ... def method(self): +@@ -1814,13 +1814,13 @@ context manager is a dictionary where created mocks are keyed by name:: + patch methods: start and stop + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +-All the patchers have :meth:`start` and :meth:`stop` methods. These make it simpler to do ++All the patchers have :meth:`!start` and :meth:`!stop` methods. These make it simpler to do + patching in ``setUp`` methods or where you want to do multiple patches without + nesting decorators or with statements. + + To use them call :func:`patch`, :func:`patch.object` or :func:`patch.dict` as + normal and keep a reference to the returned ``patcher`` object. You can then +-call :meth:`start` to put the patch in place and :meth:`stop` to undo it. ++call :meth:`!start` to put the patch in place and :meth:`!stop` to undo it. + + If you are using :func:`patch` to create a mock for you then it will be returned by + the call to ``patcher.start``. :: +@@ -1837,7 +1837,7 @@ the call to ``patcher.start``. :: + + + A typical use case for this might be for doing multiple patches in the ``setUp`` +-method of a :class:`TestCase`:: ++method of a :class:`~unittest.TestCase`:: + + >>> class MyTest(unittest.TestCase): + ... def setUp(self): +@@ -2510,7 +2510,7 @@ behaviour you can switch it off by setting the module level switch + + Alternatively you can just use ``vars(my_mock)`` (instance members) and + ``dir(type(my_mock))`` (type members) to bypass the filtering irrespective of +-:const:`mock.FILTER_DIR`. ++:const:`FILTER_DIR`. + + + mock_open +@@ -2525,7 +2525,7 @@ mock_open + default) then a :class:`MagicMock` will be created for you, with the API limited + to methods or attributes available on standard file handles. + +- *read_data* is a string for the :meth:`~io.IOBase.read`, ++ *read_data* is a string for the :meth:`~io.RawIOBase.read`, + :meth:`~io.IOBase.readline`, and :meth:`~io.IOBase.readlines` methods + of the file handle to return. Calls to those methods will take data from + *read_data* until it is depleted. The mock of these methods is pretty +@@ -2537,7 +2537,7 @@ mock_open + + .. versionchanged:: 3.4 + Added :meth:`~io.IOBase.readline` and :meth:`~io.IOBase.readlines` support. +- The mock of :meth:`~io.IOBase.read` changed to consume *read_data* rather ++ The mock of :meth:`~io.RawIOBase.read` changed to consume *read_data* rather + than returning it on each call. + + .. versionchanged:: 3.5 +@@ -2589,7 +2589,7 @@ And for reading files:: + Autospeccing + ~~~~~~~~~~~~ + +-Autospeccing is based on the existing :attr:`spec` feature of mock. It limits the ++Autospeccing is based on the existing :attr:`!spec` feature of mock. It limits the + api of mocks to the api of an original object (the spec), but it is recursive + (implemented lazily) so that attributes of mocks only have the same api as + the attributes of the spec. In addition mocked functions / methods have the +@@ -2614,8 +2614,8 @@ unit tests. Testing everything in isolation is all fine and dandy, but if you + don't test how your units are "wired together" there is still lots of room + for bugs that tests might have caught. + +-:mod:`mock` already provides a feature to help with this, called speccing. If you +-use a class or instance as the :attr:`spec` for a mock then you can only access ++:mod:`unittest.mock` already provides a feature to help with this, called speccing. If you ++use a class or instance as the :attr:`!spec` for a mock then you can only access + attributes on the mock that exist on the real class: + + >>> from urllib import request +@@ -2653,7 +2653,7 @@ Here's an example of it in use:: + >>> mock_request.Request + + +-You can see that :class:`request.Request` has a spec. :class:`request.Request` takes two ++You can see that :class:`!request.Request` has a spec. :class:`!request.Request` takes two + arguments in the constructor (one of which is *self*). Here's what happens if + we try to call it incorrectly:: + +@@ -2669,8 +2669,8 @@ specced mocks):: + >>> req + + +-:class:`Request` objects are not callable, so the return value of instantiating our +-mocked out :class:`request.Request` is a non-callable mock. With the spec in place ++:class:`!Request` objects are not callable, so the return value of instantiating our ++mocked out :class:`!request.Request` is a non-callable mock. With the spec in place + any typos in our asserts will raise the correct error:: + + >>> req.add_header('spam', 'eggs') +@@ -2822,8 +2822,8 @@ Sealing mocks + .. versionadded:: 3.7 + + +-Order of precedence of :attr:`side_effect`, :attr:`return_value` and *wraps* +----------------------------------------------------------------------------- ++Order of precedence of :attr:`!side_effect`, :attr:`!return_value` and *wraps* ++------------------------------------------------------------------------------ + + The order of their precedence is: + +diff --git a/Doc/library/venv.rst b/Doc/library/venv.rst +index e2c77963ff3..5205c6c211d 100644 +--- a/Doc/library/venv.rst ++++ b/Doc/library/venv.rst +@@ -215,7 +215,7 @@ containing the virtual environment): + | +------------+--------------------------------------------------+ + | | csh/tcsh | :samp:`$ source {}/bin/activate.csh` | + | +------------+--------------------------------------------------+ +-| | PowerShell | :samp:`$ {}/bin/Activate.ps1` | ++| | pwsh | :samp:`$ {}/bin/Activate.ps1` | + +-------------+------------+--------------------------------------------------+ + | Windows | cmd.exe | :samp:`C:\\> {}\\Scripts\\activate.bat` | + | +------------+--------------------------------------------------+ +diff --git a/Doc/library/warnings.rst b/Doc/library/warnings.rst +index 83163cc6882..40b96080a3c 100644 +--- a/Doc/library/warnings.rst ++++ b/Doc/library/warnings.rst +@@ -178,6 +178,19 @@ If a warning is reported and doesn't match any registered filter then the + "default" action is applied (hence its name). + + ++ ++.. _repeated-warning-suppression-criteria: ++ ++Repeated Warning Suppression Criteria ++~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ++ ++The filters that suppress repeated warnings apply the following criteria to determine if a warning is considered a repeat: ++ ++- ``"default"``: A warning is considered a repeat only if the (*message*, *category*, *module*, *lineno*) are all the same. ++- ``"module"``: A warning is considered a repeat if the (*message*, *category*, *module*) are the same, ignoring the line number. ++- ``"once"``: A warning is considered a repeat if the (*message*, *category*) are the same, ignoring the module and line number. ++ ++ + .. _describing-warning-filters: + + Describing Warning Filters +@@ -396,7 +409,7 @@ Available Functions + ------------------- + + +-.. function:: warn(message, category=None, stacklevel=1, source=None, *, skip_file_prefixes=None) ++.. function:: warn(message, category=None, stacklevel=1, source=None, *, skip_file_prefixes=()) + + Issue a warning, or maybe ignore it or raise an exception. The *category* + argument, if given, must be a :ref:`warning category class `; it +diff --git a/Doc/reference/compound_stmts.rst b/Doc/reference/compound_stmts.rst +index c7e43ef7739..69c47686dd6 100644 +--- a/Doc/reference/compound_stmts.rst ++++ b/Doc/reference/compound_stmts.rst +@@ -534,18 +534,15 @@ is semantically equivalent to:: + enter = type(manager).__enter__ + exit = type(manager).__exit__ + value = enter(manager) +- hit_except = False + + try: + TARGET = value + SUITE + except: +- hit_except = True + if not exit(manager, *sys.exc_info()): + raise +- finally: +- if not hit_except: +- exit(manager, None, None, None) ++ else: ++ exit(manager, None, None, None) + + With more than one item, the context managers are processed as if multiple + :keyword:`with` statements were nested:: +diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst +index 57d9b286c6c..819126dab70 100644 +--- a/Doc/reference/datamodel.rst ++++ b/Doc/reference/datamodel.rst +@@ -561,8 +561,9 @@ Special read-only attributes + in which the function was defined. + + * - .. attribute:: function.__closure__ +- - ``None`` or a :class:`tuple` of cells that contain bindings for the +- function's free variables. ++ - ``None`` or a :class:`tuple` of cells that contain bindings for the names specified ++ in the :attr:`~codeobject.co_freevars` attribute of the function's ++ :attr:`code object `. + + A cell object has the attribute ``cell_contents``. + This can be used to get the value of the cell, as well as set the value. +@@ -850,6 +851,8 @@ Instances of arbitrary classes can be made callable by defining a + :meth:`~object.__call__` method in their class. + + ++.. _module-objects: ++ + Modules + ------- + +@@ -875,46 +878,232 @@ Attribute assignment updates the module's namespace dictionary, e.g., + + .. index:: + single: __name__ (module attribute) +- single: __doc__ (module attribute) ++ single: __spec__ (module attribute) ++ single: __package__ (module attribute) ++ single: __loader__ (module attribute) ++ single: __path__ (module attribute) + single: __file__ (module attribute) ++ single: __cached__ (module attribute) ++ single: __doc__ (module attribute) + single: __annotations__ (module attribute) + pair: module; namespace + +-Predefined (writable) attributes: ++.. _import-mod-attrs: ++ ++Import-related attributes on module objects ++^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ++ ++Module objects have the following attributes that relate to the ++:ref:`import system `. When a module is created using the machinery associated ++with the import system, these attributes are filled in based on the module's ++:term:`spec `, before the :term:`loader` executes and loads the ++module. ++ ++To create a module dynamically rather than using the import system, ++it's recommended to use :func:`importlib.util.module_from_spec`, ++which will set the various import-controlled attributes to appropriate values. ++It's also possible to use the :class:`types.ModuleType` constructor to create ++modules directly, but this technique is more error-prone, as most attributes ++must be manually set on the module object after it has been created when using ++this approach. ++ ++.. caution:: ++ ++ With the exception of :attr:`~module.__name__`, it is **strongly** ++ recommended that you rely on :attr:`~module.__spec__` and its attributes ++ instead of any of the other individual attributes listed in this subsection. ++ Note that updating an attribute on :attr:`!__spec__` will not update the ++ corresponding attribute on the module itself: ++ ++ .. doctest:: ++ ++ >>> import typing ++ >>> typing.__name__, typing.__spec__.name ++ ('typing', 'typing') ++ >>> typing.__spec__.name = 'spelling' ++ >>> typing.__name__, typing.__spec__.name ++ ('typing', 'spelling') ++ >>> typing.__name__ = 'keyboard_smashing' ++ >>> typing.__name__, typing.__spec__.name ++ ('keyboard_smashing', 'spelling') ++ ++.. attribute:: module.__name__ ++ ++ The name used to uniquely identify the module in the import system. ++ For a directly executed module, this will be set to ``"__main__"``. ++ ++ This attribute must be set to the fully qualified name of the module. ++ It is expected to match the value of ++ :attr:`module.__spec__.name `. ++ ++.. attribute:: module.__spec__ ++ ++ A record of the module's import-system-related state. ++ ++ Set to the :class:`module spec ` that was ++ used when importing the module. See :ref:`module-specs` for more details. ++ ++ .. versionadded:: 3.4 ++ ++.. attribute:: module.__package__ ++ ++ The :term:`package` a module belongs to. ++ ++ If the module is top-level (that is, not a part of any specific package) ++ then the attribute should be set to ``''`` (the empty string). Otherwise, ++ it should be set to the name of the module's package (which can be equal to ++ :attr:`module.__name__` if the module itself is a package). See :pep:`366` ++ for further details. ++ ++ This attribute is used instead of :attr:`~module.__name__` to calculate ++ explicit relative imports for main modules. It defaults to ``None`` for ++ modules created dynamically using the :class:`types.ModuleType` constructor; ++ use :func:`importlib.util.module_from_spec` instead to ensure the attribute ++ is set to a :class:`str`. ++ ++ It is **strongly** recommended that you use ++ :attr:`module.__spec__.parent ` ++ instead of :attr:`!module.__package__`. :attr:`__package__` is now only used ++ as a fallback if :attr:`!__spec__.parent` is not set, and this fallback ++ path is deprecated. ++ ++ .. versionchanged:: 3.4 ++ This attribute now defaults to ``None`` for modules created dynamically ++ using the :class:`types.ModuleType` constructor. ++ Previously the attribute was optional. ++ ++ .. versionchanged:: 3.6 ++ The value of :attr:`!__package__` is expected to be the same as ++ :attr:`__spec__.parent `. ++ :attr:`__package__` is now only used as a fallback during import ++ resolution if :attr:`!__spec__.parent` is not defined. ++ ++ .. versionchanged:: 3.10 ++ :exc:`ImportWarning` is raised if an import resolution falls back to ++ :attr:`!__package__` instead of ++ :attr:`__spec__.parent `. + +- :attr:`__name__` +- The module's name. ++ .. versionchanged:: 3.12 ++ Raise :exc:`DeprecationWarning` instead of :exc:`ImportWarning` when ++ falling back to :attr:`!__package__` during import resolution. ++ ++ .. deprecated-removed:: 3.13 3.15 ++ :attr:`!__package__` will cease to be set or taken into consideration ++ by the import system or standard library. ++ ++.. attribute:: module.__loader__ ++ ++ The :term:`loader` object that the import machinery used to load the module. ++ ++ This attribute is mostly useful for introspection, but can be used for ++ additional loader-specific functionality, for example getting data ++ associated with a loader. ++ ++ :attr:`!__loader__` defaults to ``None`` for modules created dynamically ++ using the :class:`types.ModuleType` constructor; ++ use :func:`importlib.util.module_from_spec` instead to ensure the attribute ++ is set to a :term:`loader` object. ++ ++ It is **strongly** recommended that you use ++ :attr:`module.__spec__.loader ` ++ instead of :attr:`!module.__loader__`. ++ ++ .. versionchanged:: 3.4 ++ This attribute now defaults to ``None`` for modules created dynamically ++ using the :class:`types.ModuleType` constructor. ++ Previously the attribute was optional. ++ ++ .. deprecated-removed:: 3.12 3.16 ++ Setting :attr:`!__loader__` on a module while failing to set ++ :attr:`!__spec__.loader` is deprecated. In Python 3.16, ++ :attr:`!__loader__` will cease to be set or taken into consideration by ++ the import system or the standard library. ++ ++.. attribute:: module.__path__ ++ ++ A (possibly empty) :term:`sequence` of strings enumerating the locations ++ where the package's submodules will be found. Non-package modules should ++ not have a :attr:`!__path__` attribute. See :ref:`package-path-rules` for ++ more details. ++ ++ It is **strongly** recommended that you use ++ :attr:`module.__spec__.submodule_search_locations ` ++ instead of :attr:`!module.__path__`. ++ ++.. attribute:: module.__file__ ++.. attribute:: module.__cached__ ++ ++ :attr:`!__file__` and :attr:`!__cached__` are both optional attributes that ++ may or may not be set. Both attributes should be a :class:`str` when they ++ are available. ++ ++ :attr:`!__file__` indicates the pathname of the file from which the module ++ was loaded (if loaded from a file), or the pathname of the shared library ++ file for extension modules loaded dynamically from a shared library. ++ It might be missing for certain types of modules, such as C modules that are ++ statically linked into the interpreter, and the ++ :ref:`import system ` may opt to leave it unset if it ++ has no semantic meaning (for example, a module loaded from a database). ++ ++ If :attr:`!__file__` is set then the :attr:`!__cached__` attribute might ++ also be set, which is the path to any compiled version of ++ the code (for example, a byte-compiled file). The file does not need to exist ++ to set this attribute; the path can simply point to where the ++ compiled file *would* exist (see :pep:`3147`). ++ ++ Note that :attr:`!__cached__` may be set even if :attr:`!__file__` is not ++ set. However, that scenario is quite atypical. Ultimately, the ++ :term:`loader` is what makes use of the module spec provided by the ++ :term:`finder` (from which :attr:`!__file__` and :attr:`!__cached__` are ++ derived). So if a loader can load from a cached module but otherwise does ++ not load from a file, that atypical scenario may be appropriate. ++ ++ It is **strongly** recommended that you use ++ :attr:`module.__spec__.cached ` ++ instead of :attr:`!module.__cached__`. ++ ++ .. deprecated-removed:: 3.13 3.15 ++ Setting :attr:`!__cached__` on a module while failing to set ++ :attr:`!__spec__.cached` is deprecated. In Python 3.15, ++ :attr:`!__cached__` will cease to be set or taken into consideration by ++ the import system or standard library. ++ ++Other writable attributes on module objects ++^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +- :attr:`__doc__` +- The module's documentation string, or ``None`` if +- unavailable. ++As well as the import-related attributes listed above, module objects also have ++the following writable attributes: + +- :attr:`__file__` +- The pathname of the file from which the +- module was loaded, if it was loaded from a file. +- The :attr:`__file__` +- attribute may be missing for certain types of modules, such as C modules +- that are statically linked into the interpreter. For extension modules +- loaded dynamically from a shared library, it's the pathname of the shared +- library file. ++.. attribute:: module.__doc__ + +- :attr:`__annotations__` +- A dictionary containing +- :term:`variable annotations ` collected during +- module body execution. For best practices on working +- with :attr:`__annotations__`, please see :ref:`annotations-howto`. ++ The module's documentation string, or ``None`` if unavailable. ++ See also: :attr:`__doc__ attributes `. ++ ++.. attribute:: module.__annotations__ ++ ++ A dictionary containing ++ :term:`variable annotations ` collected during module ++ body execution. For best practices on working with :attr:`__annotations__`, ++ please see :ref:`annotations-howto`. ++ ++Module dictionaries ++^^^^^^^^^^^^^^^^^^^ ++ ++Module objects also have the following special read-only attribute: + + .. index:: single: __dict__ (module attribute) ++.. attribute:: module.__dict__ + +-Special read-only attribute: :attr:`~object.__dict__` is the module's +-namespace as a dictionary object. ++ The module's namespace as a dictionary object. Uniquely among the attributes ++ listed here, :attr:`!__dict__` cannot be accessed as a global variable from ++ within a module; it can only be accessed as an attribute on module objects. + +-.. impl-detail:: ++ .. impl-detail:: + +- Because of the way CPython clears module dictionaries, the module +- dictionary will be cleared when the module falls out of scope even if the +- dictionary still has live references. To avoid this, copy the dictionary +- or keep the module around while using its dictionary directly. ++ Because of the way CPython clears module dictionaries, the module ++ dictionary will be cleared when the module falls out of scope even if the ++ dictionary still has live references. To avoid this, copy the dictionary ++ or keep the module around while using its dictionary directly. + + + .. _class-attrs-and-methods: +@@ -1238,10 +1427,14 @@ Special read-only attributes + + * - .. attribute:: codeobject.co_cellvars + - A :class:`tuple` containing the names of :ref:`local variables ` +- that are referenced by nested functions inside the function ++ that are referenced from at least one :term:`nested scope` inside the function + + * - .. attribute:: codeobject.co_freevars +- - A :class:`tuple` containing the names of free variables in the function ++ - A :class:`tuple` containing the names of ++ :term:`free (closure) variables ` that a :term:`nested scope` ++ references in an outer scope. See also :attr:`function.__closure__`. ++ ++ Note: references to global and builtin names are *not* included. + + * - .. attribute:: codeobject.co_code + - A string representing the sequence of :term:`bytecode` instructions in +@@ -1267,7 +1460,7 @@ Special read-only attributes + + .. deprecated:: 3.12 + This attribute of code objects is deprecated, and may be removed in +- Python 3.14. ++ Python 3.15. + + * - .. attribute:: codeobject.co_stacksize + - The required stack size of the code object +@@ -1793,7 +1986,8 @@ Basic customization + "informal" string representation of instances of that class is required. + + This is typically used for debugging, so it is important that the representation +- is information-rich and unambiguous. ++ is information-rich and unambiguous. A default implementation is provided by the ++ :class:`object` class itself. + + .. index:: + single: string; __str__() (object method) +@@ -1803,10 +1997,10 @@ Basic customization + + .. method:: object.__str__(self) + +- Called by :func:`str(object) ` and the built-in functions +- :func:`format` and :func:`print` to compute the "informal" or nicely ++ Called by :func:`str(object) `, the default :meth:`__format__` implementation, ++ and the built-in function :func:`print`, to compute the "informal" or nicely + printable string representation of an object. The return value must be a +- :ref:`string ` object. ++ :ref:`str ` object. + + This method differs from :meth:`object.__repr__` in that there is no + expectation that :meth:`__str__` return a valid Python expression: a more +@@ -1823,7 +2017,8 @@ Basic customization + .. index:: pair: built-in function; bytes + + Called by :ref:`bytes ` to compute a byte-string representation +- of an object. This should return a :class:`bytes` object. ++ of an object. This should return a :class:`bytes` object. The :class:`object` ++ class itself does not provide this method. + + .. index:: + single: string; __format__() (object method) +@@ -1847,6 +2042,9 @@ Basic customization + + The return value must be a string object. + ++ The default implementation by the :class:`object` class should be given ++ an empty *format_spec* string. It delegates to :meth:`__str__`. ++ + .. versionchanged:: 3.4 + The __format__ method of ``object`` itself raises a :exc:`TypeError` + if passed any non-empty string. +@@ -1889,6 +2087,12 @@ Basic customization + ``(x` (such as :class:`lists ` or ++The following methods can be defined to implement container objects. None of them ++are provided by the :class:`object` class itself. Containers usually are ++:term:`sequences ` (such as :class:`lists ` or + :class:`tuples `) or :term:`mappings ` (like +-:class:`dictionaries `), ++:term:`dictionaries `), + but can represent other containers as well. The first set of methods is used + either to emulate a sequence or to emulate a mapping; the difference is that for + a sequence, the allowable keys should be the integers *k* for which ``0 <= k < +@@ -3223,6 +3430,7 @@ Typical uses of context managers include saving and restoring various kinds of + global state, locking and unlocking resources, closing opened files, etc. + + For more information on context managers, see :ref:`typecontextmanager`. ++The :class:`object` class itself does not provide the context manager methods. + + + .. method:: object.__enter__(self) +@@ -3427,6 +3635,8 @@ are awaitable. + Must return an :term:`iterator`. Should be used to implement + :term:`awaitable` objects. For instance, :class:`asyncio.Future` implements + this method to be compatible with the :keyword:`await` expression. ++ The :class:`object` class itself is not awaitable and does not provide ++ this method. + + .. note:: + +@@ -3512,6 +3722,9 @@ its ``__anext__`` method. + + Asynchronous iterators can be used in an :keyword:`async for` statement. + ++The :class:`object` class itself does not provide these methods. ++ ++ + .. method:: object.__aiter__(self) + + Must return an *asynchronous iterator* object. +@@ -3558,6 +3771,8 @@ suspend execution in its ``__aenter__`` and ``__aexit__`` methods. + + Asynchronous context managers can be used in an :keyword:`async with` statement. + ++The :class:`object` class itself does not provide these methods. ++ + .. method:: object.__aenter__(self) + + Semantically similar to :meth:`~object.__enter__`, the only +diff --git a/Doc/reference/executionmodel.rst b/Doc/reference/executionmodel.rst +index c6d98fc2e70..1cf543a4432 100644 +--- a/Doc/reference/executionmodel.rst ++++ b/Doc/reference/executionmodel.rst +@@ -90,7 +90,7 @@ If a name is bound in a block, it is a local variable of that block, unless + declared as :keyword:`nonlocal` or :keyword:`global`. If a name is bound at + the module level, it is a global variable. (The variables of the module code + block are local and global.) If a variable is used in a code block but not +-defined there, it is a :dfn:`free variable`. ++defined there, it is a :term:`free variable`. + + Each occurrence of a name in the program text refers to the :dfn:`binding` of + that name established by the following name resolution rules. +@@ -330,6 +330,9 @@ enclosing namespace, but in the global namespace. [#]_ The :func:`exec` and + :func:`eval` functions have optional arguments to override the global and local + namespace. If only one namespace is specified, it is used for both. + ++.. XXX(ncoghlan) above is only accurate for string execution. When executing code objects, ++ closure cells may now be passed explicitly to resolve co_freevars references. ++ Docs issue: https://github.com/python/cpython/issues/122826 + + .. _exceptions: + +diff --git a/Doc/reference/expressions.rst b/Doc/reference/expressions.rst +index ab72ad49d04..decde0d297c 100644 +--- a/Doc/reference/expressions.rst ++++ b/Doc/reference/expressions.rst +@@ -1809,6 +1809,8 @@ returns a boolean value regardless of the type of its argument + single: named expression + pair: assignment; expression + ++.. _assignment-expressions: ++ + Assignment expressions + ====================== + +diff --git a/Doc/reference/import.rst b/Doc/reference/import.rst +index 19b8aa05072..ac363e8cfa0 100644 +--- a/Doc/reference/import.rst ++++ b/Doc/reference/import.rst +@@ -513,8 +513,10 @@ holding is that if you have ``sys.modules['spam']`` and + ``sys.modules['spam.foo']`` (as you would after the above import), the latter + must appear as the ``foo`` attribute of the former. + +-Module spec +------------ ++.. _module-specs: ++ ++Module specs ++------------ + + The import machinery uses a variety of information about each module + during import, especially before loading. Most of the information is +@@ -527,163 +529,44 @@ and the loader that executes it. Most importantly, it allows the + import machinery to perform the boilerplate operations of loading, + whereas without a module spec the loader had that responsibility. + +-The module's spec is exposed as the ``__spec__`` attribute on a module object. ++The module's spec is exposed as :attr:`module.__spec__`. Setting ++:attr:`!__spec__` appropriately applies equally to ++:ref:`modules initialized during interpreter startup `. ++The one exception is ``__main__``, where :attr:`!__spec__` is ++:ref:`set to None in some cases `. ++ + See :class:`~importlib.machinery.ModuleSpec` for details on the contents of + the module spec. + + .. versionadded:: 3.4 + +-.. _import-mod-attrs: +- +-Import-related module attributes +--------------------------------- +- +-The import machinery fills in these attributes on each module object +-during loading, based on the module's spec, before the loader executes +-the module. +- +-It is **strongly** recommended that you rely on :attr:`__spec__` and +-its attributes instead of any of the other individual attributes +-listed below. +- +-.. attribute:: __name__ +- +- The ``__name__`` attribute must be set to the fully qualified name of +- the module. This name is used to uniquely identify the module in +- the import system. +- +-.. attribute:: __loader__ +- +- The ``__loader__`` attribute must be set to the loader object that +- the import machinery used when loading the module. This is mostly +- for introspection, but can be used for additional loader-specific +- functionality, for example getting data associated with a loader. +- +- It is **strongly** recommended that you rely on :attr:`__spec__` +- instead of this attribute. +- +- .. versionchanged:: 3.12 +- The value of ``__loader__`` is expected to be the same as +- ``__spec__.loader``. The use of ``__loader__`` is deprecated and slated +- for removal in Python 3.14. +- +-.. attribute:: __package__ +- +- The module's ``__package__`` attribute may be set. Its value must +- be a string, but it can be the same value as its ``__name__``. When +- the module is a package, its ``__package__`` value should be set to +- its ``__name__``. When the module is not a package, ``__package__`` +- should be set to the empty string for top-level modules, or for +- submodules, to the parent package's name. See :pep:`366` for further +- details. +- +- This attribute is used instead of ``__name__`` to calculate explicit +- relative imports for main modules, as defined in :pep:`366`. +- +- It is **strongly** recommended that you rely on :attr:`__spec__` +- instead of this attribute. +- +- .. versionchanged:: 3.6 +- The value of ``__package__`` is expected to be the same as +- ``__spec__.parent``. +- +- .. versionchanged:: 3.10 +- :exc:`ImportWarning` is raised if import falls back to +- ``__package__`` instead of +- :attr:`~importlib.machinery.ModuleSpec.parent`. +- +- .. versionchanged:: 3.12 +- Raise :exc:`DeprecationWarning` instead of :exc:`ImportWarning` +- when falling back to ``__package__``. +- +- .. deprecated-removed:: 3.13 3.15 +- ``__package__`` will cease to be set or taken into consideration +- by the import system or standard library. +- +- +-.. attribute:: __spec__ +- +- The ``__spec__`` attribute must be set to the module spec that was +- used when importing the module. Setting ``__spec__`` +- appropriately applies equally to :ref:`modules initialized during +- interpreter startup `. The one exception is ``__main__``, +- where ``__spec__`` is :ref:`set to None in some cases `. +- +- When ``__spec__.parent`` is not set, ``__package__`` is used as +- a fallback. +- +- .. versionadded:: 3.4 +- +- .. versionchanged:: 3.6 +- ``__spec__.parent`` is used as a fallback when ``__package__`` is +- not defined. +- +-.. attribute:: __path__ +- +- If the module is a package (either regular or namespace), the module +- object's ``__path__`` attribute must be set. The value must be +- iterable, but may be empty if ``__path__`` has no further significance. +- If ``__path__`` is not empty, it must produce strings when iterated +- over. More details on the semantics of ``__path__`` are given +- :ref:`below `. +- +- Non-package modules should not have a ``__path__`` attribute. +- +-.. attribute:: __file__ +-.. attribute:: __cached__ +- +- ``__file__`` is optional (if set, value must be a string). It indicates +- the pathname of the file from which the module was loaded (if +- loaded from a file), or the pathname of the shared library file +- for extension modules loaded dynamically from a shared library. +- It might be missing for certain types of modules, such as C +- modules that are statically linked into the interpreter, and the +- import system may opt to leave it unset if it has no semantic +- meaning (e.g. a module loaded from a database). +- +- If ``__file__`` is set then the ``__cached__`` attribute might also +- be set, which is the path to any compiled version of +- the code (e.g. byte-compiled file). The file does not need to exist +- to set this attribute; the path can simply point to where the +- compiled file would exist (see :pep:`3147`). +- +- Note that ``__cached__`` may be set even if ``__file__`` is not +- set. However, that scenario is quite atypical. Ultimately, the +- loader is what makes use of the module spec provided by the finder +- (from which ``__file__`` and ``__cached__`` are derived). So +- if a loader can load from a cached module but otherwise does not load +- from a file, that atypical scenario may be appropriate. +- +- It is **strongly** recommended that you rely on :attr:`__spec__` +- instead of ``__cached__``. +- +- .. deprecated-removed:: 3.13 3.15 +- ``__cached__`` will cease to be set or taken into consideration +- by the import system or standard library. +- + .. _package-path-rules: + +-module.__path__ +---------------- ++__path__ attributes on modules ++------------------------------ + +-By definition, if a module has a ``__path__`` attribute, it is a package. ++The :attr:`~module.__path__` attribute should be a (possibly empty) ++:term:`sequence` of strings enumerating the locations where the package's ++submodules will be found. By definition, if a module has a :attr:`!__path__` ++attribute, it is a :term:`package`. + +-A package's ``__path__`` attribute is used during imports of its subpackages. ++A package's :attr:`~module.__path__` attribute is used during imports of its ++subpackages. + Within the import machinery, it functions much the same as :data:`sys.path`, + i.e. providing a list of locations to search for modules during import. +-However, ``__path__`` is typically much more constrained than +-:data:`sys.path`. ++However, :attr:`!__path__` is typically much more constrained than ++:data:`!sys.path`. + +-``__path__`` must be an iterable of strings, but it may be empty. + The same rules used for :data:`sys.path` also apply to a package's +-``__path__``, and :data:`sys.path_hooks` (described below) are +-consulted when traversing a package's ``__path__``. ++:attr:`!__path__`. :data:`sys.path_hooks` (described below) are ++consulted when traversing a package's :attr:`!__path__`. + +-A package's ``__init__.py`` file may set or alter the package's ``__path__`` ++A package's ``__init__.py`` file may set or alter the package's ++:attr:`~module.__path__` + attribute, and this was typically the way namespace packages were implemented + prior to :pep:`420`. With the adoption of :pep:`420`, namespace packages no +-longer need to supply ``__init__.py`` files containing only ``__path__`` +-manipulation code; the import machinery automatically sets ``__path__`` ++longer need to supply ``__init__.py`` files containing only :attr:`!__path__` ++manipulation code; the import machinery automatically sets :attr:`!__path__` + correctly for the namespace package. + + Module reprs +diff --git a/Doc/reference/lexical_analysis.rst b/Doc/reference/lexical_analysis.rst +index c2f5f145bb2..bffef9db8fb 100644 +--- a/Doc/reference/lexical_analysis.rst ++++ b/Doc/reference/lexical_analysis.rst +@@ -284,11 +284,10 @@ UAX-31, with elaboration and changes as defined below; see also :pep:`3131` for + further details. + + Within the ASCII range (U+0001..U+007F), the valid characters for identifiers +-are the same as in Python 2.x: the uppercase and lowercase letters ``A`` through ++include the uppercase and lowercase letters ``A`` through + ``Z``, the underscore ``_`` and, except for the first character, the digits + ``0`` through ``9``. +- +-Python 3.0 introduces additional characters from outside the ASCII range (see ++Python 3.0 introduced additional characters from outside the ASCII range (see + :pep:`3131`). For these characters, the classification uses the version of the + Unicode Character Database as included in the :mod:`unicodedata` module. + +diff --git a/Doc/requirements-oldest-sphinx.txt b/Doc/requirements-oldest-sphinx.txt +index 068fe0cb426..3483faea6b5 100644 +--- a/Doc/requirements-oldest-sphinx.txt ++++ b/Doc/requirements-oldest-sphinx.txt +@@ -7,29 +7,29 @@ blurb + python-docs-theme>=2022.1 + + # Generated from: +-# pip install "Sphinx~=6.2.1" ++# pip install "Sphinx~=7.2.6" + # pip freeze + # +-# Sphinx 6.2.1 comes from ``needs_sphinx = '6.2.1'`` in ``Doc/conf.py``. ++# Sphinx 7.2.6 comes from ``needs_sphinx = '7.2.6'`` in ``Doc/conf.py``. + + alabaster==0.7.16 +-Babel==2.15.0 +-certifi==2024.7.4 +-charset-normalizer==3.3.2 +-docutils==0.19 +-idna==3.7 ++Babel==2.16.0 ++certifi==2024.8.30 ++charset-normalizer==3.4.0 ++docutils==0.20.1 ++idna==3.10 + imagesize==1.4.1 + Jinja2==3.1.4 +-MarkupSafe==2.1.5 ++MarkupSafe==3.0.1 + packaging==24.1 + Pygments==2.18.0 + requests==2.32.3 + snowballstemmer==2.2.0 +-Sphinx==6.2.1 +-sphinxcontrib-applehelp==1.0.8 +-sphinxcontrib-devhelp==1.0.6 +-sphinxcontrib-htmlhelp==2.0.5 ++Sphinx==7.2.6 ++sphinxcontrib-applehelp==2.0.0 ++sphinxcontrib-devhelp==2.0.0 ++sphinxcontrib-htmlhelp==2.1.0 + sphinxcontrib-jsmath==1.0.1 +-sphinxcontrib-qthelp==1.0.7 +-sphinxcontrib-serializinghtml==1.1.10 +-urllib3==2.2.2 ++sphinxcontrib-qthelp==2.0.0 ++sphinxcontrib-serializinghtml==2.0.0 ++urllib3==2.2.3 +diff --git a/Doc/requirements.txt b/Doc/requirements.txt +index bf1028020b7..5105786ccf2 100644 +--- a/Doc/requirements.txt ++++ b/Doc/requirements.txt +@@ -6,7 +6,7 @@ + # Sphinx version is pinned so that new versions that introduce new warnings + # won't suddenly cause build failures. Updating the version is fine as long + # as no warnings are raised by doing so. +-sphinx~=8.0.0 ++sphinx~=8.1.0 + + blurb + +diff --git a/Doc/tools/extensions/availability.py b/Doc/tools/extensions/availability.py +new file mode 100644 +index 00000000000..47833fdcb87 +--- /dev/null ++++ b/Doc/tools/extensions/availability.py +@@ -0,0 +1,125 @@ ++"""Support for documenting platform availability""" ++ ++from __future__ import annotations ++ ++from typing import TYPE_CHECKING ++ ++from docutils import nodes ++from sphinx import addnodes ++from sphinx.util import logging ++from sphinx.util.docutils import SphinxDirective ++ ++if TYPE_CHECKING: ++ from sphinx.application import Sphinx ++ from sphinx.util.typing import ExtensionMetadata ++ ++logger = logging.getLogger("availability") ++ ++# known platform, libc, and threading implementations ++_PLATFORMS = frozenset({ ++ "AIX", ++ "Android", ++ "BSD", ++ "DragonFlyBSD", ++ "Emscripten", ++ "FreeBSD", ++ "GNU/kFreeBSD", ++ "iOS", ++ "Linux", ++ "macOS", ++ "NetBSD", ++ "OpenBSD", ++ "POSIX", ++ "Solaris", ++ "Unix", ++ "VxWorks", ++ "WASI", ++ "Windows", ++}) ++_LIBC = frozenset({ ++ "BSD libc", ++ "glibc", ++ "musl", ++}) ++_THREADING = frozenset({ ++ # POSIX platforms with pthreads ++ "pthreads", ++}) ++KNOWN_PLATFORMS = _PLATFORMS | _LIBC | _THREADING ++ ++ ++class Availability(SphinxDirective): ++ has_content = True ++ required_arguments = 1 ++ optional_arguments = 0 ++ final_argument_whitespace = True ++ ++ def run(self) -> list[nodes.container]: ++ title = "Availability" ++ refnode = addnodes.pending_xref( ++ title, ++ nodes.inline(title, title, classes=["xref", "std", "std-ref"]), ++ refdoc=self.env.docname, ++ refdomain="std", ++ refexplicit=True, ++ reftarget="availability", ++ reftype="ref", ++ refwarn=True, ++ ) ++ sep = nodes.Text(": ") ++ parsed, msgs = self.state.inline_text(self.arguments[0], self.lineno) ++ pnode = nodes.paragraph(title, "", refnode, sep, *parsed, *msgs) ++ self.set_source_info(pnode) ++ cnode = nodes.container("", pnode, classes=["availability"]) ++ self.set_source_info(cnode) ++ if self.content: ++ self.state.nested_parse(self.content, self.content_offset, cnode) ++ self.parse_platforms() ++ ++ return [cnode] ++ ++ def parse_platforms(self) -> dict[str, str | bool]: ++ """Parse platform information from arguments ++ ++ Arguments is a comma-separated string of platforms. A platform may ++ be prefixed with "not " to indicate that a feature is not available. ++ ++ Example:: ++ ++ .. availability:: Windows, Linux >= 4.2, not WASI ++ ++ Arguments like "Linux >= 3.17 with glibc >= 2.27" are currently not ++ parsed into separate tokens. ++ """ ++ platforms = {} ++ for arg in self.arguments[0].rstrip(".").split(","): ++ arg = arg.strip() ++ platform, _, version = arg.partition(" >= ") ++ if platform.startswith("not "): ++ version = False ++ platform = platform.removeprefix("not ") ++ elif not version: ++ version = True ++ platforms[platform] = version ++ ++ if unknown := set(platforms).difference(KNOWN_PLATFORMS): ++ logger.warning( ++ "Unknown platform%s or syntax '%s' in '.. availability:: %s', " ++ "see %s:KNOWN_PLATFORMS for a set of known platforms.", ++ "s" if len(platforms) != 1 else "", ++ " ".join(sorted(unknown)), ++ self.arguments[0], ++ __file__, ++ ) ++ ++ return platforms ++ ++ ++def setup(app: Sphinx) -> ExtensionMetadata: ++ app.add_directive("availability", Availability) ++ ++ return { ++ "version": "1.0", ++ "parallel_read_safe": True, ++ "parallel_write_safe": True, ++ } +diff --git a/Doc/tools/extensions/pyspecific.py b/Doc/tools/extensions/pyspecific.py +index 6138246ccb4..1ad10d4bef6 100644 +--- a/Doc/tools/extensions/pyspecific.py ++++ b/Doc/tools/extensions/pyspecific.py +@@ -24,7 +24,6 @@ + from sphinx.domains.changeset import VersionChange, versionlabels, versionlabel_classes + from sphinx.domains.python import PyFunction, PyMethod, PyModule + from sphinx.locale import _ as sphinx_gettext +-from sphinx.util import logging + from sphinx.util.docutils import SphinxDirective + from sphinx.writers.text import TextWriter, TextTranslator + from sphinx.util.display import status_iterator +@@ -108,80 +107,6 @@ def run(self): + return [pnode] + + +-# Support for documenting platform availability +- +-class Availability(SphinxDirective): +- +- has_content = True +- required_arguments = 1 +- optional_arguments = 0 +- final_argument_whitespace = True +- +- # known platform, libc, and threading implementations +- known_platforms = frozenset({ +- "AIX", "Android", "BSD", "DragonFlyBSD", "Emscripten", "FreeBSD", +- "GNU/kFreeBSD", "Linux", "NetBSD", "OpenBSD", "POSIX", "Solaris", +- "Unix", "VxWorks", "WASI", "Windows", "macOS", "iOS", +- # libc +- "BSD libc", "glibc", "musl", +- # POSIX platforms with pthreads +- "pthreads", +- }) +- +- def run(self): +- availability_ref = ':ref:`Availability `: ' +- avail_nodes, avail_msgs = self.state.inline_text( +- availability_ref + self.arguments[0], +- self.lineno) +- pnode = nodes.paragraph(availability_ref + self.arguments[0], +- '', *avail_nodes, *avail_msgs) +- self.set_source_info(pnode) +- cnode = nodes.container("", pnode, classes=["availability"]) +- self.set_source_info(cnode) +- if self.content: +- self.state.nested_parse(self.content, self.content_offset, cnode) +- self.parse_platforms() +- +- return [cnode] +- +- def parse_platforms(self): +- """Parse platform information from arguments +- +- Arguments is a comma-separated string of platforms. A platform may +- be prefixed with "not " to indicate that a feature is not available. +- +- Example:: +- +- .. availability:: Windows, Linux >= 4.2, not WASI +- +- Arguments like "Linux >= 3.17 with glibc >= 2.27" are currently not +- parsed into separate tokens. +- """ +- platforms = {} +- for arg in self.arguments[0].rstrip(".").split(","): +- arg = arg.strip() +- platform, _, version = arg.partition(" >= ") +- if platform.startswith("not "): +- version = False +- platform = platform[4:] +- elif not version: +- version = True +- platforms[platform] = version +- +- unknown = set(platforms).difference(self.known_platforms) +- if unknown: +- cls = type(self) +- logger = logging.getLogger(cls.__qualname__) +- logger.warning( +- f"Unknown platform(s) or syntax '{' '.join(sorted(unknown))}' " +- f"in '.. availability:: {self.arguments[0]}', see " +- f"{__file__}:{cls.__qualname__}.known_platforms for a set " +- "known platforms." +- ) +- +- return platforms +- +- + # Support for documenting decorators + + class PyDecoratorMixin(object): +@@ -259,7 +184,22 @@ def run(self): + return PyMethod.run(self) + + +-# Support for documenting version of removal in deprecations ++# Support for documenting version of changes, additions, deprecations ++ ++def expand_version_arg(argument, release): ++ """Expand "next" to the current version""" ++ if argument == 'next': ++ return sphinx_gettext('{} (unreleased)').format(release) ++ return argument ++ ++ ++class PyVersionChange(VersionChange): ++ def run(self): ++ # Replace the 'next' special token with the current development version ++ self.arguments[0] = expand_version_arg(self.arguments[0], ++ self.config.release) ++ return super().run() ++ + + class DeprecatedRemoved(VersionChange): + required_arguments = 2 +@@ -270,8 +210,12 @@ class DeprecatedRemoved(VersionChange): + def run(self): + # Replace the first two arguments (deprecated version and removed version) + # with a single tuple of both versions. +- version_deprecated = self.arguments[0] ++ version_deprecated = expand_version_arg(self.arguments[0], ++ self.config.release) + version_removed = self.arguments.pop(1) ++ if version_removed == 'next': ++ raise ValueError( ++ 'deprecated-removed:: second argument cannot be `next`') + self.arguments[0] = version_deprecated, version_removed + + # Set the label based on if we have reached the removal version +@@ -334,8 +278,8 @@ def run(self): + # Support for building "topic help" for pydoc + + pydoc_topic_labels = [ +- 'assert', 'assignment', 'async', 'atom-identifiers', 'atom-literals', +- 'attribute-access', 'attribute-references', 'augassign', 'await', ++ 'assert', 'assignment', 'assignment-expressions', 'async', 'atom-identifiers', ++ 'atom-literals', 'attribute-access', 'attribute-references', 'augassign', 'await', + 'binary', 'bitwise', 'bltin-code-objects', 'bltin-ellipsis-object', + 'bltin-null-object', 'bltin-type-objects', 'booleans', + 'break', 'callable-types', 'calls', 'class', 'comparisons', 'compound', +@@ -473,7 +417,10 @@ def setup(app): + app.add_role('issue', issue_role) + app.add_role('gh', gh_issue_role) + app.add_directive('impl-detail', ImplementationDetail) +- app.add_directive('availability', Availability) ++ app.add_directive('versionadded', PyVersionChange, override=True) ++ app.add_directive('versionchanged', PyVersionChange, override=True) ++ app.add_directive('versionremoved', PyVersionChange, override=True) ++ app.add_directive('deprecated', PyVersionChange, override=True) + app.add_directive('deprecated-removed', DeprecatedRemoved) + app.add_builder(PydocTopicsBuilder) + app.add_object_type('opcode', 'opcode', '%s (opcode)', parse_opcode_signature) +@@ -487,5 +434,6 @@ def setup(app): + app.add_directive_to_domain('py', 'awaitablemethod', PyAwaitableMethod) + app.add_directive_to_domain('py', 'abstractmethod', PyAbstractMethod) + app.add_directive('miscnews', MiscNews) ++ app.add_css_file('sidebar-wrap.css') + app.connect('env-check-consistency', patch_pairindextypes) + return {'version': '1.0', 'parallel_read_safe': True} +diff --git a/Doc/tools/static/rtd_switcher.js b/Doc/tools/static/rtd_switcher.js +index f5dc7045a0d..2bf01a002db 100644 +--- a/Doc/tools/static/rtd_switcher.js ++++ b/Doc/tools/static/rtd_switcher.js +@@ -7,7 +7,7 @@ + document.addEventListener("readthedocs-addons-data-ready", function(event) { + const config = event.detail.data() + const versionSelect = ` +- + ${ config.versions.active.map( + (version) => ` +