docs: reduce visibility of 3.9.0 warning (#3105)

This commit is contained in:
Henry Schreiner 2021-07-15 15:01:13 -04:00 committed by GitHub
parent 5cd3750757
commit 31843d455d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 24 deletions

View File

@ -13,19 +13,6 @@
.. start .. start
.. warning::
Combining older versions of pybind11 (< 2.6.0) with Python 3.9.0 will
trigger undefined behavior that typically manifests as crashes during
interpreter shutdown (but could also destroy your data. **You have been
warned.**)
We recommend that you update to the latest patch release of Python (3.9.1),
which includes a `fix <https://github.com/python/cpython/pull/22670>`_
that resolves this problem. If you do use Python 3.9.0, please update to
the latest version of pybind11 (2.6.0 or newer), which includes a temporary
workaround specifically when Python 3.9.0 is detected at runtime.
**pybind11** is a lightweight header-only library that exposes C++ types **pybind11** is a lightweight header-only library that exposes C++ types
in Python and vice versa, mainly to create Python bindings of existing in Python and vice versa, mainly to create Python bindings of existing
@ -110,7 +97,7 @@ goodies:
transparently applied to all entries of one or more NumPy array transparently applied to all entries of one or more NumPy array
arguments. arguments.
- Pythons slice-based access and assignment operations can be - Python's slice-based access and assignment operations can be
supported with just a few lines of code. supported with just a few lines of code.
- Everything is contained in just a few header files; there is no need - Everything is contained in just a few header files; there is no need

View File

@ -57,16 +57,16 @@ clean, well written patch would likely be accepted to solve them.
Python 3.9.0 warning Python 3.9.0 warning
^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^
Combining older versions of pybind11 (< 2.6.0) with Python on 3.9.0 will Combining older versions of pybind11 (< 2.6.0) with Python on exactly 3.9.0
trigger undefined behavior that typically manifests as crashes during will trigger undefined behavior that typically manifests as crashes during
interpreter shutdown (but could also destroy your data. **You have been interpreter shutdown (but could also destroy your data. **You have been
warned**). warned**).
This issue has been This issue was `fixed in Python <https://github.com/python/cpython/pull/22670>`_.
`fixed in Python <https://github.com/python/cpython/pull/22670>`_. As a As a mitigation for this bug, pybind11 2.6.0 or newer includes a workaround
mitigation until 3.9.1 is released and commonly used, pybind11 (2.6.0 or newer) specifically when Python 3.9.0 is detected at runtime, leaking about 50 bytes
includes a temporary workaround specifically when Python 3.9.0 is detected at of memory when a callback function is garbage collected. For reference, the
runtime, leaking about 50 bytes of memory when a callback function is garbage pybind11 test suite has about 2,000 such callbacks, but only 49 are garbage
collected. For reference; the pybind11 test suite has about 2,000 such collected before the end-of-process. Wheels (even if built with Python 3.9.0)
callbacks, but only 49 are garbage collected before the end-of-process. Wheels will correctly avoid the leak when run in Python 3.9.1, and this does not
built with Python 3.9.0 will correctly avoid the leak when run in Python 3.9.1. affect other 3.X versions.