Skip to content

Commit

Permalink
Merge branch '3.10' into CVE-2020-10735-3.10backport
Browse files Browse the repository at this point in the history
  • Loading branch information
gpshead authored Sep 2, 2022
2 parents 059f402 + bbcb03e commit 4d1f053
Show file tree
Hide file tree
Showing 62 changed files with 930 additions and 606 deletions.
4 changes: 2 additions & 2 deletions .azure-pipelines/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
variables:
testRunTitle: '$(build.sourceBranchName)-linux'
testRunPlatform: linux
openssl_version: 1.1.1n
openssl_version: 1.1.1q

steps:
- template: ./posix-steps.yml
Expand All @@ -83,7 +83,7 @@ jobs:
variables:
testRunTitle: '$(Build.SourceBranchName)-linux-coverage'
testRunPlatform: linux-coverage
openssl_version: 1.1.1n
openssl_version: 1.1.1q

steps:
- template: ./posix-steps.yml
Expand Down
4 changes: 2 additions & 2 deletions .azure-pipelines/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
variables:
testRunTitle: '$(system.pullRequest.TargetBranch)-linux'
testRunPlatform: linux
openssl_version: 1.1.1n
openssl_version: 1.1.1q

steps:
- template: ./posix-steps.yml
Expand All @@ -83,7 +83,7 @@ jobs:
variables:
testRunTitle: '$(Build.SourceBranchName)-linux-coverage'
testRunPlatform: linux-coverage
openssl_version: 1.1.1n
openssl_version: 1.1.1q

steps:
- template: ./posix-steps.yml
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ jobs:
needs: check_source
if: needs.check_source.outputs.run_tests == 'true'
env:
OPENSSL_VER: 1.1.1n
OPENSSL_VER: 1.1.1q
PYTHONSTRICTEXTENSIONBUILD: 1
steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -234,7 +234,7 @@ jobs:
strategy:
fail-fast: false
matrix:
openssl_ver: [1.1.1n, 3.0.2]
openssl_ver: [1.1.1q, 3.0.5]
env:
OPENSSL_VER: ${{ matrix.openssl_ver }}
MULTISSL_DIR: ${{ github.workspace }}/multissl
Expand Down
15 changes: 9 additions & 6 deletions Doc/c-api/typeobj.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1990,9 +1990,6 @@ and :c:type:`PyType_Type` effectively act as defaults.)
PyErr_Restore(error_type, error_value, error_traceback);
}

For this field to be taken into account (even through inheritance),
you must also set the :const:`Py_TPFLAGS_HAVE_FINALIZE` flags bit.

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
Expand All @@ -2010,6 +2007,12 @@ and :c:type:`PyType_Type` effectively act as defaults.)

.. versionadded:: 3.4

.. versionchanged:: 3.8

Before version 3.8 it was necessary to set the
:const:`Py_TPFLAGS_HAVE_FINALIZE` flags bit in order for this field to be
used. This is no longer required.

.. seealso:: "Safe object finalization" (:pep:`442`)


Expand Down Expand Up @@ -2047,9 +2050,9 @@ This results in types that are limited relative to types defined in Python:
:ref:`sub-interpreters <sub-interpreter-support>`, so they should not
include any subinterpreter-specific state.

Also, since :c:type:`PyTypeObject` is not part of the :ref:`stable ABI <stable>`,
any extension modules using static types must be compiled for a specific
Python minor version.
Also, since :c:type:`PyTypeObject` is only part of the :ref:`Limited API
<stable>` as an opaque struct, any extension modules using static types must be
compiled for a specific Python minor version.


.. _heap-types:
Expand Down
82 changes: 82 additions & 0 deletions Doc/howto/logging-cookbook.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2678,6 +2678,88 @@ You can of course use the conventional means of decoration::
...


.. _buffered-smtp:

Sending logging messages to email, with buffering
-------------------------------------------------

To illustrate how you can send log messages via email, so that a set number of
messages are sent per email, you can subclass
:class:`~logging.handlers.BufferingHandler`. In the following example, which you can
adapt to suit your specific needs, a simple test harness is provided which allows you
to run the script with command line arguments specifying what you typically need to
send things via SMTP. (Run the downloaded script with the ``-h`` argument to see the
required and optional arguments.)

.. code-block:: python
import logging
import logging.handlers
import smtplib
class BufferingSMTPHandler(logging.handlers.BufferingHandler):
def __init__(self, mailhost, port, username, password, fromaddr, toaddrs,
subject, capacity):
logging.handlers.BufferingHandler.__init__(self, capacity)
self.mailhost = mailhost
self.mailport = port
self.username = username
self.password = password
self.fromaddr = fromaddr
if isinstance(toaddrs, str):
toaddrs = [toaddrs]
self.toaddrs = toaddrs
self.subject = subject
self.setFormatter(logging.Formatter("%(asctime)s %(levelname)-5s %(message)s"))
def flush(self):
if len(self.buffer) > 0:
try:
smtp = smtplib.SMTP(self.mailhost, self.mailport)
smtp.starttls()
smtp.login(self.username, self.password)
msg = "From: %s\r\nTo: %s\r\nSubject: %s\r\n\r\n" % (self.fromaddr, ','.join(self.toaddrs), self.subject)
for record in self.buffer:
s = self.format(record)
msg = msg + s + "\r\n"
smtp.sendmail(self.fromaddr, self.toaddrs, msg)
smtp.quit()
except Exception:
if logging.raiseExceptions:
raise
self.buffer = []
if __name__ == '__main__':
import argparse
ap = argparse.ArgumentParser()
aa = ap.add_argument
aa('host', metavar='HOST', help='SMTP server')
aa('--port', '-p', type=int, default=587, help='SMTP port')
aa('user', metavar='USER', help='SMTP username')
aa('password', metavar='PASSWORD', help='SMTP password')
aa('to', metavar='TO', help='Addressee for emails')
aa('sender', metavar='SENDER', help='Sender email address')
aa('--subject', '-s',
default='Test Logging email from Python logging module (buffering)',
help='Subject of email')
options = ap.parse_args()
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
h = BufferingSMTPHandler(options.host, options.port, options.user,
options.password, options.sender,
options.to, options.subject, 10)
logger.addHandler(h)
for i in range(102):
logger.info("Info index = %d", i)
h.flush()
h.close()
If you run this script and your SMTP server is correctly set up, you should find that
it sends eleven emails to the addressee you specify. The first ten emails will each
have ten log messages, and the eleventh will have two messages. That makes up 102
messages as specified in the script.

.. _utc-formatting:

Formatting times using UTC (GMT) via configuration
Expand Down
18 changes: 0 additions & 18 deletions Doc/includes/sqlite3/adapter_point_1.py

This file was deleted.

19 changes: 0 additions & 19 deletions Doc/includes/sqlite3/adapter_point_2.py

This file was deleted.

20 changes: 0 additions & 20 deletions Doc/includes/sqlite3/collation_reverse.py

This file was deleted.

40 changes: 0 additions & 40 deletions Doc/includes/sqlite3/converter_point.py

This file was deleted.

20 changes: 0 additions & 20 deletions Doc/includes/sqlite3/ctx_manager.py

This file was deleted.

22 changes: 0 additions & 22 deletions Doc/includes/sqlite3/execute_1.py

This file was deleted.

28 changes: 0 additions & 28 deletions Doc/includes/sqlite3/load_extension.py

This file was deleted.

13 changes: 0 additions & 13 deletions Doc/includes/sqlite3/md5func.py

This file was deleted.

22 changes: 0 additions & 22 deletions Doc/includes/sqlite3/mysumaggr.py

This file was deleted.

Loading

0 comments on commit 4d1f053

Please sign in to comment.