When the user defines _GLIBCXX_USE_CXX11_ABI=0 to force the pre-c++11 ABI, numpy.h assumes that is_trivially_copyable is available.
It is not necessarily the case. This patch uses clang's feature detection instead.
The workaround is for certain libstdc++ versions, so the test should target these particular versions.
* Adding PyGILState_Check() in object_api<>::operator().
* Enabling PyGILState_Check() for Python >= 3.6 only.
Possibly, this explains why PyGILState_Check() cannot safely be used with Python 3.4 and 3.5:
https://github.com/python/cpython/pull/10267#issuecomment-434881587
* Adding simple micro benchmark.
* Reducing test time to minimum (purely for coverage, not for accurate results).
* Fixing silly oversight.
* Minor code organization improvement in test.
* Adding example runtimes.
* Removing capsys (just run with `-k test_callback_num_times -s` and using `.format()`.
* Use correct duration representation when casting from datetime.timdelta to std::chrono::duration
* When asserting datetime/timedelta/date/time we can equality-compare whole objects
* [dtype]: add type() method to access type attribute of PyArray_Descr (eq. to dtype.char in Python)
* [dtype] change type() name method to char_() to be compliant with Python numpy interface
* [dtype] fix by pre-commit
* [dtype] Change comments and solutions format for test
* Clarify documentation and move note about dtype.char vs PyArray_Descr::type to a plain, non-doxygen comment
* Fix and extend tests
* Fix the supposedly fixed tests
* Fix the fixed tests again
Co-authored-by: Bertrand MICHEL <bertrand.michel@onera.fr>
Co-authored-by: Yannick Jadoul <yannick.jadoul@belgacom.net>
On Windows, clang-cl does not understand /MP.
```
clang-cl: warning: argument unused during compilation: '/MP' [-Wunused-command-line-argument]
```
with Clang 10.0.0
* Make sure all warnings in pytest get turned into errors
* Suppress DeprecationWarnings in test_int_convert and test_numpy_int_convert
* PyLong_AsLong only shouts "Deprecated!" on Python>=3.8
* Fix remaining warnings on PyPy and CPython 3.10-dev
* Demonstrate issue with weakref constructor overloads
* Fix weakref constructor to convert on being passed a non-weakref object
* Improve on nonlocal-scoped variable in test_weakref
* Keep backwards-compatibility by introducing PYBIND11_OBJECT_CVT_DEFAULT macro
* Simplify test_weakref
* Adding move_only_holder_caster `typename SFINAE = void` to enable external specializations.
* Adding SFINAE hook also to copyable_holder_caster, for uniformity, with comment to explain the purpose.
* When determining if a shared_ptr already exists, use a test on the weak_ptr instead of a try/catch block.
* When determining if a shared_ptr already exists, use a test on the weak_ptr instead of a try/catch block.
* weak_from_this is only available in C++17 and later
* Switch to use feature flag instead of C++ version flag.
* Add Microsoft-specific check.
* Avoid undefined preprocessor macro warning treated as error.
* Simplify shared_from_this in init_holder
* Include <version> in detail/common.h (~stolen~ borrowed from @bstaletic's #2816)
* Move class_::get_shared_from_this to detail::try_get_shared_from_this
* Simplify try_get_shared_from_this by using weak_ptr::lock()
Co-authored-by: Yannick Jadoul <yannick.jadoul@belgacom.net>
* Always call PyNumber_Index when casting from Python to a C++ integral type, also pre-3.8
* Fixed on PyPy
* Simplify use of PyNumber_Index, following @rwgk's idea, and ignore warnings in >=3.8
* Reproduce mismatch between pre-3.8 and post-3.8 behavior on __index__ throwing TypeError
* Fix tests on 3.6 <= Python < 3.8
* No, I don't have an uninitialized variable
* Fix use of __index__ on Python 2
* Make types in test_int_convert more ~boring~ descriptive
* Force the builtin module key to be the correct type.
Previously it was always going to be a std::string which converted into
unicode. Python 2 appears to want module keys to be normal str types, so
this was breaking code that expected plain string types in the
builtins.keys() data structure
* Add a simple unit test to ensure all built-in keys are str
* Update the unit test so it will also run on pypy
* Run pre-commit.
Co-authored-by: Jesse Clemens <jesse.clemens@sony.com>