fix: only allow integer type_caster to call __int__ method when conversion is allowed; always call __index__ (#2698) * Only allow integer type_caster to call __int__ or __index__ method when conversion is allowed * Remove tests for __index__ as this seems to only be used to convert to int in 3.8+ * Take both `int` and `long` types into account for Python 2 * Add test_numpy_int_convert to assert tests currently fail, even though np.intc has an __index__ method * Also consider __index__ as noconvert to a C++ integer * New-style classes for Python 2.7; sigh * Add some tests on types with custom __index__ method * Ignore some tests in Python <3.8 * Update comment about conversion from np.float32 to C++ int * Workaround difference between CPython and PyPy's different PyIndex_Check (unnoticed because we currently don't have PyPy >= 3.8) * Avoid ICC segfault with py::arg()
| Name |
Last commit
|
Last Update |
|---|---|---|
| .github | Loading commit data... | |
| docs | Loading commit data... | |
| include/pybind11 | Loading commit data... | |
| pybind11 | Loading commit data... | |
| tests | Loading commit data... | |
| tools | Loading commit data... | |
| .appveyor.yml | Loading commit data... | |
| .clang-tidy | Loading commit data... | |
| .cmake-format.yaml | Loading commit data... | |
| .gitignore | Loading commit data... | |
| .pre-commit-config.yaml | Loading commit data... | |
| .readthedocs.yml | Loading commit data... | |
| CMakeLists.txt | Loading commit data... | |
| LICENSE | Loading commit data... | |
| MANIFEST.in | Loading commit data... | |
| README.rst | Loading commit data... | |
| pyproject.toml | Loading commit data... | |
| setup.cfg | Loading commit data... | |
| setup.py | Loading commit data... |