Commit Graph

2302 Commits

Author SHA1 Message Date
Ralf W. Grosse-Kunstleve
49173e472f
Minor follow-on to PR #1334 (Fix enum value's __int__ returning non-int when underlying type is bool or of char type) (#3232)
* Minor tweaks.

* Restoring tests/pybind11_tests.h version from master, removing just the comment and empty line that was added in PR #3087; those were made obsolete by the pragma cleanup that concluded with PR #3186.

* More-to-the-point test for Python 3.
2021-08-31 08:52:04 -07:00
Ralf W. Grosse-Kunstleve
a46f623782
Minor tweaks. (#3230)
* Minor tweaks.

* Restoring tests/pybind11_tests.h version from master, removing just the comment and empty line that was added in PR #3087; those were made obsolete by the pragma cleanup that concluded with PR #3186.

* [ci skip] Restoring tests/test_enum.py from master.
2021-08-31 06:44:14 -07:00
Tailing Yuan
d6474ed7d2
fix: memory leak in cpp_function (#3228) (#3229)
* fix: memory leak in cpp_function (#3228)

* add a test case to check objects are deconstructed in cpp_function

* update the test case about cpp_function

* fix the test case about cpp_function: remove "noexcept"

* Actually calling func. CHECK(stat.alive() == 2); Manually verified that the new tests fails without the change in pybind11.h

* Moving new test to test_callbacks.cpp,py, with small enhancements.

* Removing new test from test_interpreter.cpp (after it was moved to test_callbacks.cpp,py). This restores test_interpreter.cpp to the current state on master.

* Using py::detail::silence_unused_warnings(py_func); to make the intent clear.

Co-authored-by: Ralf W. Grosse-Kunstleve <rwgk@google.com>
2021-08-30 21:48:33 -04:00
pre-commit-ci[bot]
76d939de53
[pre-commit.ci] pre-commit autoupdate (#3231)
updates:
- [github.com/asottile/pyupgrade: v2.24.0 → v2.25.0](https://github.com/asottile/pyupgrade/compare/v2.24.0...v2.25.0)
- [github.com/psf/black: 21.7b0 → 21.8b0](https://github.com/psf/black/compare/21.7b0...21.8b0)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2021-08-30 16:00:33 -04:00
Ralf W. Grosse-Kunstleve
777352fcd1
Adding ssize_t_cast to support passing size_t or ssize_t values where ssize_t is needed. (#3219)
* Trivial change to avoid (ssize_t) cast.

* Demo for safe_ssize_t idea.

* Removing safe_ssize_t.cpp (proof-of-concept code) to not upset the GHA Format workflow.

* Completing changes in pytypes.h

* New ssize_t_cast (better replacement for safe_ssize_t).

* clang-format-diff (no manual changes).

* bytes_ssize_t -Wnarrowing reproducer (see PR #2692).

* Backing out tuple(), list() ssize_t support, for compatibility with older compilers (to resolve link failures).

* Bug fix: missing `py::` for `py::ssize_t`

* Restoring tuple(), list() ssize_t support, but passing `size` by value, for compatibility with older compilers (to resolve link failures).

* Full test coverage of all functions with modified signatures.
2021-08-28 16:40:46 -07:00
Ye Zhihao
cb60ed49e4
Fix enum value's __int__ returning non-int when underlying type is bool or of char type (#1334)
* Use equivalent_integer for enum's Scalar decision

* Add test for char underlying enum

* Support translating bool type in enum's Scalar

* Add test for bool underlying enum

* Fix comment in test

* Switch from `PYBIND11_CPP20` macro to `PYBIND11_HAS_U8STRING`

* Refine tests

Co-authored-by: Aaron Gokaslan <skylion.aaron@gmail.com>
2021-08-26 14:34:24 -07:00
Dan
930bb16c79
Call PySys_SetArgv when initializing interpreter. (#2341)
* Call PySys_SetArgv when initializing interpreter.

* Document argc/argv parameters in initialize_interpreter.

* Remove manual memory management from set_interpreter_argv in favor of smart pointers.

* Use size_t for indexers in set_interpreter_argv.

* Minimize macros for flow control in set_interpreter_argv.

* Fix 'unused variable' warning on Py2

* whitespace

* Define wide_char_arg_deleter outside set_interpreter_argv.

* Do sys.path workaround in C++ rather than eval.

* Factor out wchar conversion to a separate function.

* Restore widened_argv variable declaration.

* Fix undeclared widened_arg variable on some paths.

* Use delete[] to match new wchar_t[].

* Fix compiler errors

* Use PY_VERSION_HEX for a cleaner CVE-2008-5983 mode check.

* Fix typo

* Use explicit type for deleter so delete[] works cross-compiler.

* Always use PySys_SetArgvEx because pybind11 doesn't support pythons that don't include it.

* Remove pointless ternary operator.

* Use unique_ptr.reset instead of a second initialization.

* Rename add_program_dir_to_path parameter to clarify intent.

* Add defined() check before evaluating HAVE_BROKEN_MBSTOWCS.

* Apply clang-tidy fixes

* Pre-commit

* refactor: use const for set_interpreter_argv

* Try to fix const issue and allocate vector properly

* fix: copy strings on Python 2

* Applying clang-format-diff relative to master.

The only manual change is an added empty line between pybind11 and system `#include`s.

```
git diff -U0 --no-color master | python3 $HOME/clone/llvm-project/clang/tools/clang-format/clang-format-diff.py -p1 -style=file -i
```

Co-authored-by: Boris Staletic <boris.staletic@gmail.com>
Co-authored-by: Aaron Gokaslan <skylion.aaron@gmail.com>
Co-authored-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: Ralf W. Grosse-Kunstleve <rwgk@google.com>
2021-08-26 14:12:54 -07:00
Nick Cullen
503ff2a6fb
view for numpy arrays (#987)
* reshape

* more tests

* Update numpy.h

* Update test_numpy_array.py

* array view

* test

* Update test_numpy_array.cpp

* Update numpy.h

* Update numpy.h

* Update test_numpy_array.cpp

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix merge bug

* Make clang-tidy happy

* Add xfail for PyPy

* Fix casting issue

* Fix formatting

* Apply clang-tidy

* Address reviews on additional tests

* Fix ordering

* Do a little more reordering

* Fix typo

* Try improving tests

* Fix error in reshape

* Add one more reshape test

* Fix bugs and add test

* Relax test

* streamlining new tests; removing a few stray msg

* Fix style revert

* Fix clang-tidy

* Misc tweaks:
* Comment: matching style in file (///), responsibility sentence, consistent punctuation.
* Replacing `unsigned char` with `uint8_t` for max consistency.
* Removing `1` from `array_view1` because there is only one.

* Partial clang-format-diff.

Co-authored-by: ncullen93 <ncullen.th@dartmouth.edu>
Co-authored-by: NC Cullen <nicholas.c.cullen.th@dartmouth.edu>
Co-authored-by: Aaron Gokaslan <skylion.aaron@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Ralf Grosse-Kunstleve <rwgk@google.com>
2021-08-26 14:11:01 -07:00
Henry Schreiner
db44afa33b
tests: fix pytest usage on Python 3.10 (#3221) 2021-08-26 10:52:13 -07:00
Nick Cullen
59ad1e7d05
reshape for numpy arrays (#984)
* reshape

* more tests

* Update numpy.h

* Update test_numpy_array.py

* Update numpy.h

* Update numpy.h

* Update test_numpy_array.cpp

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix merge bug

* Make clang-tidy happy

* Add xfail for PyPy

* Fix casting issue

* Address reviews on additional tests

* Fix ordering

* Do a little more reordering

* Fix typo

* Try improving tests

* Fix error in reshape

* Add one more reshape test

* streamlining new tests; removing a few stray msg

Co-authored-by: ncullen93 <ncullen.th@dartmouth.edu>
Co-authored-by: NC Cullen <nicholas.c.cullen.th@dartmouth.edu>
Co-authored-by: Aaron Gokaslan <skylion.aaron@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Ralf Grosse-Kunstleve <rwgk@google.com>
2021-08-26 08:12:35 -07:00
Jouke Witteveen
031a700dfd
Add make_simple_namespace function and tests (#2840)
Co-authored-by: Jouke Witteveen <j.witteveen@cosine.nl>
2021-08-26 08:04:22 -07:00
Ralf W. Grosse-Kunstleve
c8ce4b8df8
Clone of @virtuald's PR #2112 with minor enhancements. (#3215)
* Add py::raise_from to enable chaining exceptions on Python 3.3+

* Use 'raise from' in initialization

* Documenting the exact base version of _PyErr_FormatVFromCause, adding back `assert`s.

Co-authored-by: Dustin Spicuzza <dustin@virtualroadside.com>
2021-08-23 17:30:01 -07:00
Aaron Gokaslan
6cbabc4b8c
maint(clang-tidy): Enable cpp-coreguideline slicing checks (#3210)
* maint(clang-tidy): add a clang-tidy slicing check

* Add self + touch up readme

* Fix typo
2021-08-23 18:42:19 -04:00
Henry Schreiner
fdac5fbf7c
chore: support targeting different Python versions with nox (#3214) 2021-08-23 18:05:54 -04:00
pre-commit-ci[bot]
b3d18f382f
[pre-commit.ci] pre-commit autoupdate (#3213)
updates:
- [github.com/asottile/pyupgrade: v2.23.3 → v2.24.0](https://github.com/asottile/pyupgrade/compare/v2.23.3...v2.24.0)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2021-08-23 15:22:12 -04:00
Liam Keegan
4f29b8a45b
ci: extend msys2 mingw CI (#3207)
* extend msys2 CI

- add 32-bit job
- add c++11/17 c++/interface tests copied from standard ci
- add numpy/scipy

* account for padding of PartialStruct in numpy dtypes test with mingw32

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* msys2 ci: add c++14 tests

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2021-08-19 14:42:55 -04:00
Ralf W. Grosse-Kunstleve
998d45e431
Cleanup of file-scoped and globally-scoped warning suppression pragmas across pybind11 header files. (#3201)
* Removing all MSVC C4127 warning suppression pragmas.

* Removing MSVC /WX (WERROR). To get a full list of all warnings.

* Inserting PYBIND11_SILENCE_MSVC_C4127. Changing one runtime if to #if.

* Changing PYBIND11_SILENCE_MSVC_C4127 macro to use absolute namespace (for use outside pybind11 include directory).

* Restoring MSVC /WX (WERROR).

* Removing globally-scoped suppression for clang -Wunsequenced. Based on an experiment under PR #3202 it is obsolete and can simply be removed.
2021-08-19 11:37:04 -07:00
Ralf W. Grosse-Kunstleve
774b5ff90b
Removing obsolete eigen.h warning suppression pragmas. (#3198)
* Removing all pragma from eigen.h

* Removing -Werror or equivalent from tests/CMakeLists.txt

* Restoring tests/CMakeLists.txt from master.

* Adding 4 PYBIND11_SILENCE_MSVC_C4127.

* Compatibility with -Wconversion, -Wdeprecated

* Introducing PYBIND11_COMPATIBILITY_WDEPRECATED_COPY

* Systematically using --verbose for compilations where possible (cmake 3.14 or newer).

Also changing all `cmake -t` to `--target`, `-v` to `--verbose`, `check` to `pytest`, for consistency (to make it easier to pin-point all commands of a certain type).

Also removing one `-j 2` for `pytest` in hopes of reducing flakes due to races in test_iostream and in prints from destructors.

* Commenting out pragmas as an experiment to reproduce previous observation.

* Removing all (newly added, but already commented-out) pragma code, adding HINT use -isystem (as cmake does).

* Restoring ci.yml from master. Those changes are better handled separately. BTW: in the last CI run there was still a test_iostream flake, even without the -j 2 for running the tests (verfied by inspecting the log).
2021-08-17 16:49:39 -07:00
Aaron Gokaslan
617cb653ec
[Bugfix] Fix errant const methods (#3194)
* Fix errant const methods

* Remove NOLINT since clang-tidy is pretty conservative

* Missed one

* Fix a few more errors

* Add reviewer suggested comments

* Run clang-format
2021-08-14 12:25:54 -04:00
Ralf W. Grosse-Kunstleve
1bcd94c481
Removing last remnants of pragma block at the top of pybind11.h (#3186)
* Removing last remnants of pragma block at the top of pybind11.h, defaulting CUDA, GCC7, GCC8 to PYBIND11_NOINLINE_DISABLED, with the option to define PYBIND11_NOINLINE_FORCED.

* Unique SOSIZE prefix to make it easier to extract the sosizes from the GitHub logs.

* Commenting out PYBIND11_WERROR block, for noinline testing.

* Undoing accidental change.

* `#define PYBIND11_NOINLINE_FORCED`

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* `#define PYBIND11_NOINLINE_DISABLED`

* Going back to default (removing `#define PYBIND11_NOINLINE_DISABLED`).

* `#define PYBIND11_NOINLINE_FORCED`

* Undoing all changes releated to measuring sosizes.

* Rollback of PR #3030 (Working around Centos 8 failure).

* Disabling -Werror for GNU (experiment).

* Commenting out the entire `if(PYBIND11_WERROR)` again (although that is not expected to make a difference, but who knows what I am overlooking).

* Adding `-DCMAKE_BUILD_TYPE=Release`

* Undoing change to tests/CMakeLists.txt (uncommenting `if(PYBIND11_WERROR)` block).

* post `git rebase master -X theirs` fixups.

* Adding measurements to comment for `PYBIND11_NOINLINE_FORCED`.

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2021-08-14 07:41:27 -07:00
Aaron Gokaslan
9df2f1ff13
maint(precommit): Apply isort (#3195)
* Apply isort

* Tweak isort config

* Add env.py as a known_first_party

* Add one missing known first party

* Make config compat with older isort versions

* Add another comment

* Revert pyproject setting
2021-08-13 12:37:05 -04:00
dependabot[bot]
d6841f60cc
chore(deps): bump jwlawson/actions-setup-cmake from 1.9 to 1.10 (#3196)
Bumps [jwlawson/actions-setup-cmake](https://github.com/jwlawson/actions-setup-cmake) from 1.9 to 1.10.
- [Release notes](https://github.com/jwlawson/actions-setup-cmake/releases)
- [Commits](https://github.com/jwlawson/actions-setup-cmake/compare/v1.9...v1.10)

---
updated-dependencies:
- dependency-name: jwlawson/actions-setup-cmake
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-08-13 12:27:54 -04:00
Ralf W. Grosse-Kunstleve
7d3b05715b
Improved workaround for Centos 8 failure (follow-on to PR #3030). (#3193)
* Rollback of PR #3030 (Working around Centos 8 failure).

* Adding `-DCMAKE_BUILD_TYPE=Release`

* Improving existing workaround (undoing the originally intended rollback).

* Fixing minor documentation bug.
2021-08-12 13:21:49 -07:00
pre-commit-ci[bot]
0be2ea065e
[pre-commit.ci] pre-commit autoupdate (#3185)
updates:
- [github.com/asottile/pyupgrade: v2.23.1 → v2.23.3](https://github.com/asottile/pyupgrade/compare/v2.23.1...v2.23.3)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2021-08-09 15:08:19 -04:00
Ralf W. Grosse-Kunstleve
4c7e509fa4
PYBIND11_NOINLINE-related cleanup. (#3179)
* Removing pragma for GCC -Wattributes, fixing forward declarations.

* Introducing PYBIND11_NOINLINE_FWD to deal with CUDA, GCC7, GCC8.

* Updating PYBIND11_NOINLINE_DCL in Doxyfile.

* Trying noinline, noinline for {CUDA, GCC7, GCC8}

* Trying noinline, inline for {CUDA, GCC7, GCC8}

* Adding GCC -Wattributes `pragma` in 3 header files.

* Introducing PYBIND11_NOINLINE_GCC_PRAGMA_ATTRIBUTES_NEEDED, used in 9 header files.

* Removing ICC pragma 2196, to see if it is still needed.

* Trying noinline, noinline for ICC

* Trying noinline, inline for ICC

* Restoring ICC pragma 2196, introducing PYBIND11_NOINLINE_FORCED, defined for testing.

* Removing code accidentally left in (was for experimentation only).

* Removing one-time-test define.

* Removing PYBIND11_NOINLINE_FWD macro (after learning that it makes no sense).

* Testing with PYBIND11_NOINLINE_DISABLED. Minor non-functional enhancements.

* Removing #define PYBIND11_NOINLINE_DISABLED (test was successful).

* Removing PYBIND11_NOINLINE_FORCED and enhancing comments for PYBIND11_NOINLINE.

* WIP stripping back

* Making -Wattributes pragma in pybind11 specific to GCC7, GCC8, CUDA.
2021-08-09 10:10:38 -07:00
Aaron Gokaslan
ff590c1258
maint(perf): Optimize Numpy constructor to remove copies by value. (#3183)
* maint(perf): Optimize Numpy Constructor with additional std::move

* Add more moves
2021-08-09 12:48:27 -04:00
Ralf W. Grosse-Kunstleve
61ee923bb1
Consistent step name "Python tests". (#3180) 2021-08-07 11:51:28 -07:00
Eric Cousineau
6ac8efe52d
test_eval: Show example of working closure (#2743)
* test_eval: Show example of working closure

* Extend test_eval_closure with weirder examples of closures for py::eval

Co-authored-by: Yannick Jadoul <yannick.jadoul@belgacom.net>
Co-authored-by: Aaron Gokaslan <skylion.aaron@gmail.com>
2021-08-06 15:51:53 -04:00
Ralf W. Grosse-Kunstleve
af7007331a
Removing GCC -Wunused-but-set-parameter from pragma block at the top of pybind11.h (#3164)
* Cleanup triggered by work on pragma for GCC -Wunused-but-set-parameter.

* Backing out changes to eigen.h (to be worked on later).

* Adding PYBIND11_WORKAROUND_INCORRECT_GCC_UNUSED_BUT_SET_PARAMETER in type_caster_base.h (apparently needed only for older GCCs).

* Apparently older compilers need a simpler overload for silence_unused_warnings().

* clang C++11 compatibility: removing constexpr

* Special case for MSVC 2017: `constexpr void` return

* Trying again without the silence_unused_warnings(const int *) overload.

* Separate macros for ALL_GCC, OLD_GCC_UNUSED_BUT_SET_PARAMETER

* Changing to __GNUC__ <= 2 (turning off)

* Refined condition for PYBIND11_WORKAROUND_INCORRECT_OLD_GCC_UNUSED_BUT_SET_PARAMETER.

* Quick experiment trying out suggestion by @henryiii

* Introducing macro: PYBIND11_INT_ARRAY_WORKING_AROUND_MSVC_CLANG_ISSUES

* Trying henryiii@ (void) expander idea.

* fix: apply simpler expression with fewer workarounds

* Purging new-but-already-obsoleted  macro, made possible by @henryiii's commit.

* Renaming `ALL_GCC` macro back to just `GCC` (because there is no `OLD` anymore, luckily).

* [actions skip] Adding "All GCC versions" to comment, to be clear about it.

Co-authored-by: Henry Schreiner <henryschreineriii@gmail.com>
2021-08-06 12:27:11 -07:00
Aaron Gokaslan
3893f37bce
maint(clang-tidy): Bugprone enable checks (#3166)
* Enable bugprone checks

* Reset delta and massage config

* Start to apply bugprone fixes

* try to fix minor bug

* Fix later

* Fix perfect forwarding bugprone

* Remove nolint

* undo constructor delete

* Fix bugprone-perfect-forwarding again

* Remove TODO

* Add another nolint for bugprone-exception-escape in scoped interpreter

* Fix remaining bugprone errors

* Properly apply bugprone-macro-parantheses

* Redo formatting and remove bugprone nolint

* Add coment and revert more whitespace changes

* Fix typo

* Fix parsing bug

* Add back comma

* Fix clang-tidy issue

* Apply remaining clang-tidy fixes
2021-08-06 14:30:28 -04:00
Henry Schreiner
089328f779 Revert "fix: apply simpler expression with fewer workarounds"
This reverts commit 1fafd1b447.
2021-08-06 13:09:48 -04:00
Henry Schreiner
1fafd1b447
fix: apply simpler expression with fewer workarounds 2021-08-06 13:03:26 -04:00
Henry Schreiner
5f4d725918
fix: version number hex 2021-08-03 17:03:11 -04:00
Henry Schreiner
c30f57d2ed
chore: start development for 2.8.0 2021-08-03 16:11:07 -04:00
Henry Schreiner
82adacb31d
fix: include hex version in bump 2021-08-03 15:20:23 -04:00
Henry Schreiner
5f34c42d70 chore: bump to version 2.7.1 2021-08-03 15:06:57 -04:00
Henry Schreiner
a2b78a8c27
chore: changelog update (#3163)
* chore: changelog update

* Update docs/changelog.rst
2021-08-03 13:16:14 -04:00
Aaron Gokaslan
c0756ccd93
fix: func_handle for rule of two (#3169)
* Fix func_handle for rule of two

* Apply reviewer suggestion
2021-08-03 13:15:48 -04:00
pre-commit-ci[bot]
f4f4632e28
[pre-commit.ci] pre-commit autoupdate (#3167)
updates:
- [github.com/asottile/pyupgrade: v2.23.0 → v2.23.1](https://github.com/asottile/pyupgrade/compare/v2.23.0...v2.23.1)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2021-08-03 10:56:57 -04:00
Ralf W. Grosse-Kunstleve
dcbda8d7ff
Removing MSVC C4127 from pragma block at the top of pybind11.h (#3152)
* Removing pragma for 4127 (to see what is still broken with the latest code).

* Using new constexpr_bool() to suppress warning C4127.

* One missed case, Python 2 only.

* PYBIND11_SILENCE_MSVC_C4127 (more similar to the approach for C4100).
2021-07-30 11:25:29 -07:00
Ralf W. Grosse-Kunstleve
e2573dc961
Moving pragma for MSVC warning C4505 from pybind11.h to existing list in detail/common.h (#3160)
* Moving pragma for C4505 from pybind11.h to existing list in detail/common.h.

* Removing 4 existing suppressions to 1. see what is still needed and 2. capture the MSVC messages.

* It turns out none of the 4 pragmas are needed anymore.
2021-07-30 10:51:50 -07:00
Jerome Robert
9e8a741baa
fix: Mingw64 corrected and add a CI job to test it (#3132)
* mingw64 platform string is like mingw_xxx not "mingw"

See https://github.com/msys2/MINGW-packages/blob/master/mingw-w64-python/0099-Change-the-get_platform-method-in-sysconfig-and-dist.patch

* Mingw: Do not dllexport exceptions

This is a fix for errors like:

D:/a/pybind11/pybind11/include/pybind11/detail/common.h:735:23: error: 'dllexport' implies default visibility, but 'class pybind11::builtin_exception' has already been declared with a different visibility
  735 | class PYBIND11_EXPORT builtin_exception : public std::runtime_error {
      |                       ^~~~~~~~~~~~~~~~~

* GHA: Test Mingw64 build

* fix: avoid thin binaries on mingw

* fix: drop lto on MinGW

* Mingw64: disable PYBIND11_DEPRECATED

It trigger many warnings for unknown reasons

Co-authored-by: Henry Schreiner <henryschreineriii@gmail.com>
2021-07-30 13:48:41 -04:00
Ralf W. Grosse-Kunstleve
b42597291f
Limiting pragma for ignoring GCC 7 -Wnoexcept-type to the scope of pybind11.h. (#3161)
* Moving pragma for ignoring -Wnoexcept-type to the one location where it is needed.

* Trying a second location.

* The previous commit worked (GitHub Actions green), but see the added comment about the dicy nature of -Wnoexcept-type ("if and only if").

* Applying reviewer suggestion.
2021-07-30 07:09:55 -07:00
Henry Schreiner
b1fdbe6954
chore: add discussions link (#3159) 2021-07-29 16:10:18 -07:00
Henry Schreiner
c14b193308
chore: increase CMake upper limit (#3124) 2021-07-28 18:04:14 -07:00
Ralf W. Grosse-Kunstleve
b72ca7d1bd
Removing MSVC C4100 from pragma block at the top of pybind11.h (#3150)
* Removing pragma for 4100 (to see what is still broken with the latest code).

* Adding --keep-going

* Revert "Adding --keep-going"

This reverts commit 1c844c6ffd07a6111b644811e7e3b0a50b9d44bb.

* Introducing PYBIND11_WORKAROUND_INCORRECT_MSVC_C4100.

* _MSC_VER <= 1916

* Replacing simple variadic function with variadic template (attempt to resolve MSVC 2017 failures).

* Preserving existing comment (moved from pybind11.h to detail/common.h).

* Adding blank lines for readability.
2021-07-28 17:01:21 -07:00
Ralf W. Grosse-Kunstleve
f4721a7b44
Accommodating environments that define __STDC_WANT_LIB_EXT1__ even if __STDC_LIB_EXT1__ is not defined by the implementation. (#3151)
Follow-on to PR #3129.
2021-07-28 08:58:36 -07:00
Ralf W. Grosse-Kunstleve
2164c2e0e7
Removing __INTEL_COMPILER section from pragma block at the top of pybind11.h (#3135)
* Fixing `pragma warning pop` for `__INTEL_COMPILER`.

* Adding push/pop to 3 tests. Removing #878 from top of pybind11.h (it was/is only needed for 1 test).

* Trying again after CI failure, moving the push to the top of 2 tests.

* Trying more after CI failure, adding push/pop to pybind11_tests.h, constructor_stats.h.

* Moving ICC #2196 suppression to CMakeLists.txt

* Fixing condition for `pragma GCC diagnostic push` in pybind11.h

* Moving `pragma warning disable 2196` to common.h

* Revising #ifdef to be more conservative.

* Undoing insertion of notes that will hopefully soon be completely obsolete anyway.
2021-07-27 15:33:31 -07:00
Aaron Gokaslan
9beaa925db
maint(clang-tidy): Improve code readability with explicit boolean casts (#3148)
* maint(clang-tidy) Improve code readability

* Fix minor typos

* Revert optimization that removed test case

* Fix comment formatting

* Revert another optimization to repro an issue

* Remove make_unique since it C++14 and newer only

* eformat comments

* Fix unsignedness of comparison

* Update comment
2021-07-27 15:32:26 -07:00
Henry Schreiner
7cc0ebb475
fix: the CMake config in Python package had a hard coded path (#3144) 2021-07-27 17:23:52 -04:00