Commit Graph

2976 Commits

Author SHA1 Message Date
Ralf W. Grosse-Kunstleve 05852fb6bc
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 21:49:10 -04:00
Ralf W. Grosse-Kunstleve ed5fb66bd7
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-28 21:49:10 -04:00
Aaron Gokaslan 0ac4c8afd6
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-28 21:49:09 -04:00
Henry Schreiner 5c6bdb7215
fix: the CMake config in Python package had a hard coded path (#3144) 2021-07-28 21:49:09 -04:00
David Hewitt fd71bd486d
Allow python builtins to be used as callbacks (#1413)
* Allow python builtins to be used as callbacks

* Try to fix pypy segfault

* Add expected fail for PyPy

* Fix typo

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

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

* Add more info to xfail

* Add env

* Try returning false

* Try removing the move for pypy

* Fix bugs

* Try removing move

* Just keep ignoring for PyPy

* Add back xfail

* Fix ctors

* Revert change of std::move

* Change to skip

* Fix bug and edit comments

* Remove clang-tidy bugprone fix skip bug

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>
2021-07-28 21:49:09 -04:00
Ralf W. Grosse-Kunstleve e93d94594b
Removing MSVC C4800 from pragma block at the top of pybind11.h (#3141)
* Adding PYBIND11_COMPAT_BOOL_CAST to appease MSVC 2015 warning C4800.

* Replacing PYBIND11_COMPAT_BOOL_CAST with simpler != 0

* Extra parentheses (almost all compilers failed without these).
2021-07-28 21:49:09 -04:00
pre-commit-ci[bot] c973660d6c
[pre-commit.ci] pre-commit autoupdate (#3143)
updates:
- [github.com/asottile/pyupgrade: v2.21.2 → v2.23.0](https://github.com/asottile/pyupgrade/compare/v2.21.2...v2.23.0)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2021-07-28 21:49:09 -04:00
Ralf W. Grosse-Kunstleve 85b38c69de
Adding pragma warning(disable: 4522) for MSVC <= 2017. (#3142) 2021-07-28 21:49:09 -04:00
Ralf W. Grosse-Kunstleve b193d42c32
Removing MSVC C4996 from pragma block at the top of pybind11.h (#3129)
* Removing MSVC C4996 from pragma block at the top of pybind11.h

* localtime_thread_safe, PYBIND11_COMPAT_STRDUP

* Adding #include <ctime> (attempt to fix MSVC 2015, 2017 errors).
2021-07-28 21:49:06 -04:00
ka-bo ee3ecb8ae2
Specified encoding in setup.py calls of open() (#3137)
* Specified encoding in setup.py calls of open()

* Fix for Python2

Co-authored-by: Karsten Bock <karsten.bock@dlr.de>
2021-07-28 21:48:08 -04:00
Henry Schreiner c14b193308
chore: increase CMake upper limit (#3124) 2021-07-28 18:04:14 -07:00
Ralf W. Grosse-Kunstleve 3754d6436b Merge branch 'master' into smart_holder 2021-07-28 17:03:25 -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 dcdadd73f5 Merge branch 'master' into smart_holder
[actions skip]
2021-07-28 10:24:02 -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 119db695ca Follow-on to PR #3148 (cang-tidy). 2021-07-27 16:18:30 -07:00
Ralf W. Grosse-Kunstleve 45ef484366 Merge branch 'master' into smart_holder 2021-07-27 15:38:09 -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
Ralf W. Grosse-Kunstleve 1cd7179f1f Merge branch 'master' into smart_holder 2021-07-27 11:30:23 -07:00
David Hewitt a0b975965f
Allow python builtins to be used as callbacks (#1413)
* Allow python builtins to be used as callbacks

* Try to fix pypy segfault

* Add expected fail for PyPy

* Fix typo

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

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

* Add more info to xfail

* Add env

* Try returning false

* Try removing the move for pypy

* Fix bugs

* Try removing move

* Just keep ignoring for PyPy

* Add back xfail

* Fix ctors

* Revert change of std::move

* Change to skip

* Fix bug and edit comments

* Remove clang-tidy bugprone fix skip bug

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>
2021-07-27 14:16:28 -04:00
Ralf W. Grosse-Kunstleve 8ed9e93d57 Merge branch 'master' into smart_holder 2021-07-26 13:43:29 -07:00
Ralf W. Grosse-Kunstleve a0f862d428
Removing MSVC C4800 from pragma block at the top of pybind11.h (#3141)
* Adding PYBIND11_COMPAT_BOOL_CAST to appease MSVC 2015 warning C4800.

* Replacing PYBIND11_COMPAT_BOOL_CAST with simpler != 0

* Extra parentheses (almost all compilers failed without these).
2021-07-26 13:26:36 -07:00
pre-commit-ci[bot] 7f76d79508
[pre-commit.ci] pre-commit autoupdate (#3143)
updates:
- [github.com/asottile/pyupgrade: v2.21.2 → v2.23.0](https://github.com/asottile/pyupgrade/compare/v2.21.2...v2.23.0)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2021-07-26 15:05:58 -04:00
Ralf W. Grosse-Kunstleve 7904ba1a5c
Adding pragma warning(disable: 4522) for MSVC <= 2017. (#3142) 2021-07-26 12:02:50 -07:00
Ralf W. Grosse-Kunstleve ff97f101d9
Removing MSVC C4996 from pragma block at the top of pybind11.h (#3129)
* Removing MSVC C4996 from pragma block at the top of pybind11.h

* localtime_thread_safe, PYBIND11_COMPAT_STRDUP

* Adding #include <ctime> (attempt to fix MSVC 2015, 2017 errors).
2021-07-26 11:28:36 -07:00
Ralf W. Grosse-Kunstleve 07087b898a Merge branch 'master' into smart_holder 2021-07-21 17:07:31 -07:00
ka-bo e58c6897cc
Specified encoding in setup.py calls of open() (#3137)
* Specified encoding in setup.py calls of open()

* Fix for Python2

Co-authored-by: Karsten Bock <karsten.bock@dlr.de>
2021-07-21 12:00:57 -04:00
Ralf W. Grosse-Kunstleve 7cc433ca7f Merge branch 'master' into smart_holder 2021-07-21 06:56:03 -07:00
jesse-sony d65edfb024
Feature/local exception translator (#2650)
* Create a module_internals struct

Since we now have two things that are going to be module local, it felt
correct to add a struct to manage them.

* Add local exception translators

These are added via the  register_local_exception_translator function
and are then applied before the global translators

* Add unit tests to show the local exception translator works

* Fix a bug in the unit test with the string value of KeyError

* Fix a formatting issue

* Rename registered_local_types_cpp()

Rename it to get_registered_local_types_cpp() to disambiguate from the
new member of module_internals

* Add additional comments to new local exception code path

* Add a register_local_exception function

* Add additional unit tests for register_local_exception

* Use get_local_internals like get_internals

* Update documentation for new local exception feature

* Add back a missing space

* Clean-up some issues in the docs

* Remove the code duplication when translating exceptions

Separated out the exception processing into a standalone function in the
details namespace.

Clean-up some comments as per PR notes as well

* Remove the code duplication in register_exception

* Cleanup some formatting things caught by clang-format

* Remove the templates from exception translators

But I added a using declaration to alias the type.

* Remove the extra local from local_internals variable names

* Add an extra explanatory comment to local_internals

* Fix a typo in the code
2021-07-21 05:22:18 -07:00
blacktea 6d5d4e738c
Move object in pop method of List. (#3116)
* Move item instead of copy.

* Make Clang 3.6 happy.

Co-authored-by: c99 <email@dummy.com>
2021-07-20 11:48:09 -04:00
pre-commit-ci[bot] 9626483cdf
[pre-commit.ci] pre-commit autoupdate (#3134)
updates:
- [github.com/asottile/pyupgrade: v2.21.0 → v2.21.2](https://github.com/asottile/pyupgrade/compare/v2.21.0...v2.21.2)
- [github.com/psf/black: 21.6b0 → 21.7b0](https://github.com/psf/black/compare/21.6b0...21.7b0)
- https://gitlab.com/pycqa/flake8https://github.com/PyCQA/flake8
2021-07-20 11:29:42 -04:00
Ralf W. Grosse-Kunstleve a1918dd6d9 Merge branch 'master' into smart_holder 2021-07-17 10:32:03 -07:00
Ralf W. Grosse-Kunstleve 34f587dd23
Removing all warning pragmas that have not effect. (#3127) 2021-07-17 08:54:31 -07:00
Henry Schreiner 74935f8d67
chore: post-release (#3128) 2021-07-17 11:50:42 -04:00
Ralf W. Grosse-Kunstleve 02dc01b536 Merge branch 'master' into smart_holder 2021-07-16 08:14:43 -07:00
Henry Schreiner 65e95ea867
chore: bump to 2.7.0 (#3123) 2021-07-16 09:27:47 -04:00
Ralf W. Grosse-Kunstleve 5548f24b37 Merge branch 'master' into smart_holder 2021-07-15 20:43:55 -07:00
Henry Schreiner 6642f389dc
docs: update changelog (#3122) 2021-07-15 20:00:07 -04:00
Ralf W. Grosse-Kunstleve 1f04229733 Merge branch 'master' into smart_holder 2021-07-15 15:05:40 -07:00
Ralf W. Grosse-Kunstleve 4359e00b97
Introducing PYBIND11_VERSION_HEX (#3120)
* Introducing PYBIND11_VERSION_HEX (better late than never!)

* PYBIND11_VERSION_HEX consistency check in setup.py
2021-07-15 15:00:57 -07:00
Henry Schreiner 1b10292c05
chore: support PDF from nox (#3121) 2021-07-15 16:54:40 -04:00
Axel Huebl 55f6f6e9bf
Fix: RTD Docutils Build (#3119)
The docutils 0.17+ release uses more semantic HTML5 tags, which
the RTD theme does not (yet) know.

This breaks side bar, lists and other elements.
2021-07-15 15:41:36 -04:00
Henry Schreiner 2415c09459
feat(package): support pipx run (#3117) 2021-07-15 15:01:29 -04:00
Henry Schreiner 31843d455d
docs: reduce visibility of 3.9.0 warning (#3105) 2021-07-15 15:01:13 -04:00
Ralf W. Grosse-Kunstleve 6d1026763a Merge branch 'master' into smart_holder 2021-07-15 10:13:07 -07:00
Boris Staletic 5cd3750757
Enable -Wstrict-aliasing warning (#2816)
* Enable -Wstrict-aliasing warning

* Narrow down the scope of -Wstrict-aliasing

* Go home, MSVC, you're drunk

* Make sure "pragma GCC" is not executed on ICC

Co-authored-by: Yannick Jadoul <yannick.jadoul@belgacom.net>
2021-07-15 12:38:52 -04:00
Ralf W. Grosse-Kunstleve 88546fff7d Fixing merge conflict. 2021-07-15 06:23:06 -07:00
Aaron Gokaslan c4b0dc7cdd
Add shellcheck style checking (#3114) 2021-07-14 16:52:13 -04:00