pybind11/include/pybind11
Ralf W. Grosse-Kunstleve 3c061f2168 Fixing pybind11::bytes() ambiguous conversion issue.
Adding missing `bytes` type to `test_constructors()`, to exercise the code change.

The changes in the PR were cherry-picked from PR #2409 (with a very minor
modification in test_pytypes.py related to flake8). Via PR #2409, these
changes were extensively tested in the Google environment, as summarized here:
https://docs.google.com/document/d/1TPL-J__mph_yHa1quDvsO12E_F5OZnvBaZlW9IIrz8M/
The changes in this PR did not cause an issues at all.

Note that `test_constructors()` before this PR passes for Python 2 only
because `pybind11::str` can hold `PyUnicodeObject` or `PyBytesObject`. As a
side-effect of this PR, `test_constructors()` no longer relies on this
permissive `pybind11::str` behavior. However, the permissive behavior is still
exercised/exposed via the existing `test_pybind11_str_raw_str()`.

The test code change is designed to enable easy removal later, when Python 2
support is dropped.

For completeness: confusingly, the non-test code changes travelled through PR

Example `ambiguous conversion` error fixed by this PR:
```
pybind11/tests/test_pytypes.cpp:214:23: error: ambiguous conversion for functional-style cast from 'pybind11::detail::item_accessor' (aka 'accessor<accessor_policies::generic_item>') to 'py::bytes'
            "bytes"_a=py::bytes(d["bytes"]),
                      ^~~~~~~~~~~~~~~~~~~~
pybind11/include/pybind11/detail/../pytypes.h:957:21: note: candidate constructor
    PYBIND11_OBJECT(bytes, object, PYBIND11_BYTES_CHECK)
                    ^
pybind11/include/pybind11/detail/../pytypes.h:957:21: note: candidate constructor
pybind11/include/pybind11/detail/../pytypes.h:987:15: note: candidate constructor
inline bytes::bytes(const pybind11::str &s) {
              ^
1 error generated.
```
2020-08-28 11:52:51 -07:00
..
detail Throw exception on returning a unique_ptr or shared_ptr nullptr (or any other holder type) from py::init, rather than crashing (#2430) 2020-08-25 18:51:06 +02:00
attr.h Change NAMESPACE_* macros into PYBIND11_NAMESPACE_* (#2283) 2020-07-08 18:14:41 -04:00
buffer_info.h Fix undefined memoryview format (#2223) 2020-07-15 08:50:43 -07:00
cast.h fix: a couple more places where pybind11 is missing 11 (#2421) 2020-08-21 15:27:21 -04:00
chrono.h Fix bug roundtripping datetime.time objects after midnight in eastern hemisphere timezones (#2417) (#2438) 2020-08-28 15:21:43 +02:00
common.h Add a dummy common.h header with a deprecation warning 2017-09-06 15:22:26 +02:00
complex.h Change NAMESPACE_* macros into PYBIND11_NAMESPACE_* (#2283) 2020-07-08 18:14:41 -04:00
eigen.h Change NAMESPACE_* macros into PYBIND11_NAMESPACE_* (#2283) 2020-07-08 18:14:41 -04:00
embed.h Rename embedded_module object's name (#2282) 2020-07-10 16:31:03 +02:00
eval.h Change NAMESPACE_* macros into PYBIND11_NAMESPACE_* (#2283) 2020-07-08 18:14:41 -04:00
functional.h Change NAMESPACE_* macros into PYBIND11_NAMESPACE_* (#2283) 2020-07-08 18:14:41 -04:00
iostream.h Change NAMESPACE_* macros into PYBIND11_NAMESPACE_* (#2283) 2020-07-08 18:14:41 -04:00
numpy.h fix: add missing signature (#2363) 2020-08-13 20:13:16 -04:00
operators.h Change NAMESPACE_* macros into PYBIND11_NAMESPACE_* (#2283) 2020-07-08 18:14:41 -04:00
options.h Change NAMESPACE_* macros into PYBIND11_NAMESPACE_* (#2283) 2020-07-08 18:14:41 -04:00
pybind11.h fix: throwing repr caused a segfault (#2389) 2020-08-18 07:14:34 -04:00
pytypes.h Fixing pybind11::bytes() ambiguous conversion issue. 2020-08-28 11:52:51 -07:00
stl_bind.h Modified Vector STL bind initialization from a buffer type with optimization for simple arrays (#2298) 2020-08-13 22:47:23 +02:00
stl.h Change NAMESPACE_* macros into PYBIND11_NAMESPACE_* (#2283) 2020-07-08 18:14:41 -04:00