Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge 'upstream/master' (37f845a1d) #46

Conversation

EricCousineau-TRI
Copy link
Collaborator

@EricCousineau-TRI EricCousineau-TRI commented Sep 8, 2020

Following format for #43


This change is Reviewable

YannickJadoul and others added 30 commits August 4, 2020 14:45
* Enable py::ellipsis on Python 2

* Enable py::ellipsis tests on Python 2 and mention `Ellipsis` in the docs
…#2366)

These tests will also alert us to any behavior changes across Python and PyPy versions.

Hardening tests in preparation for changing `pybind11::str` to only hold `PyUnicodeObject` (NOT also `bytes`). Note that this test exposes that `pybind11::str` can also hold `bytes`.
…ization for simple arrays (pybind#2298)

* Modified Vector STL bind initialization from a buffer type with optimization for simple arrays

* Add subtests to demonstrate processing Python buffer protocol objects with step > 1

* Fixed memoryview step test to only run on Python 3+

* Modified Vector constructor from buffer to return by value for readability
* fix: add missing signature

* fix: add to array_t too
…))` (pybind#2382)

* Fix warning C26817: Potentially expensive copy of variable 'vh' in range-for loop. Consider making it a const reference (es.71).

* Replace another instance of `for (auto vh : values_and_holders(...))` with `auto vh &` (found by @bstaletic)

Co-authored-by: Michael Goulding <Michael.Goulding@microsoft.com>
Co-authored-by: Yannick Jadoul <yannick.jadoul@belgacom.net>
…checks (pybind#2376)

Fix logic in test_bytes_to_string

Co-authored-by: Henry Schreiner <henryschreineriii@gmail.com>
…2396)

Important gain: uniformity & therefore easier cleanup when we drop PY2 support.
Very slight loss: it was nice to have `str is bytes` as a reminder in this specific context.
To deal with exceptions that hit destructors or other noexcept functions.

Includes fixes to support Python 2.7 and extends documentation on
error handling.

@virtuald and @YannickJadoul both contributed to this PR.
* tests: refactor and cleanup

* refactor: more consistent

* tests: vendor six

* tests: more xfails, nicer system

* tests: simplify to info

* tests: suggestions from @YannickJadoul and @bstaletic

* tests: restore some pypy tests that now pass

* tests: rename info to env

* tests: strict False/True

* tests: drop explicit strict=True again

* tests: reduce minimum PyTest to 3.1
* docs: move helpers to .github where allowed

* docs: more guidelines in CONTRIBUTING

* chore: update issue templates

* fix: review from @bstaletic

* refactor: a few points from @rwgk

* docs: more touchup, review changes
* fix: throwing repr caused a segfault

* fixup! ci: include Python 3.9 RC1 (pybind#2387)
* feat: FindPython support

* refactor: rename to PYBIND11_FINDPYTHON

* docs: Caps fixes

* feat: NOPYTHON mode

* test: check simple call

* docs: add changelog/upgrade guide

* feat: Support Python3 and Python2

* refactor: Use targets in tests

* fix: support CMake 3.4+

* feat: classic search also finds virtual environments

* docs: some updates from @wjakob's review

* fix: wrong name for QUIET mode variable, reported by @skoslowski

* refactor: cleaner output messaging

* fix: support debug Python's in FindPython mode too

* fixup! refactor: cleaner output messaging

* fix: missing pybind11_FOUND and pybind11_INCLUDE_DIR restored to subdir mode

* fix: nicer reporting of Python / PyPy

* fix: out-of-order variable fix

* docs: minor last-minute cleanup
* tests: keep source dir clean

* ci: make first build inplace

* ci: drop dev setting (wasn't doing anything)

* tests: warn if source directory is dirty
henryiii and others added 27 commits August 20, 2020 15:42
* docs: move CONTRIBUTING

* docs: clarify PyPy promise
CPython configured with `--with-pydebug` could not use `pybind11_add_module`
* fix: reduce target collision in add_submodule mode

Closes pybind#2420

* fix: update CMakeLists.txt
The main change is to treat error_already_set as a separate category
of exception that arises in different circumstances and needs to be
handled differently. The asymmetry between Python and C++ exceptions
is further emphasized.
…bind#2431)

* Add note that VS2017 requires /permissive- to build in C++17 mode

* ci: test C++17 on MSVC 2017

* ci: args1/2, use args to override max cxx

Co-authored-by: Henry Schreiner <henryschreineriii@gmail.com>
…ny other holder type) from py::init, rather than crashing (pybind#2430)
…about std::count_if in tests/test_sequences_and_iterators.cpp (pybind#2435)
* fix: respect PYTHON_VERSION if set in classic mode

* fix: add warning when using PYTHON_VERSION
… hemisphere timezones (pybind#2417) (pybind#2438)

* Fix bug roundtripping datetime.time objects after midnight in eastern hemisphere timezones (pybind#2417)

* tests: check more timezones

* Fix review remarks: remove useless comment and skip setting TZ environment variable on Windows
Adding missing `bytes` type to `test_constructors()`, to exercise the code change.

The changes in the PR were cherry-picked from PR pybind#2409 (with a very minor
modification in test_pytypes.py related to flake8). Via PR pybind#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.
```
* ci: harden chrono test, mark another macos 4.9 dev failure

This should help with a little of the flakiness seen with the timing test

* Update tests/test_chrono.py

* Can also fail
* doc: avoid C++ types in docstrings

* A bit of rewording

* Another bit of rewording

* Third rewording
* feat: py::pos_only

* fix: review points from @YannickJadoul

* fix: review points from @bstaletic

* refactor: kwonly -> kw_only
…d#2462)

* fix: use classic extension handling unless otherwise requested

* fix: variable must be cached to be used externally
)

* Add note about specifying custom base.

* Update exception docs based on PR feedback.

* Fix trailing whitespace.

Co-authored-by: Michal Sustr <michal.sustr@aic.fel.cvut.cz>
* ci: only annotate linux for now

* style: block some common mistakes
…merge

# Conflicts:
#	.github/workflows/ci.yml
@EricCousineau-TRI
Copy link
Collaborator Author

going to do a newer merge. closing this pr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.