Commit Graph

2129 Commits

Author SHA1 Message Date
Ralf W. Grosse-Kunstleve
32d2967b0c classh.h: renaming of class_ to classh + namespace; forking test_classh_wip from test_type_caster_bare_interface_demo. 2021-01-29 14:11:54 -08:00
Ralf W. Grosse-Kunstleve
5248494ba0 Pure copy of class class_ implementation in pybind11.h (master commit 98f1bbb800). 2021-01-29 14:11:54 -08:00
Ralf W. Grosse-Kunstleve
38e949880a Adding unique_ptr<mpty>, unique_ptr<mpty const> casters. 2021-01-29 14:11:54 -08:00
Ralf W. Grosse-Kunstleve
724a83e1d2 Adding shared_ptr<mpty>, shared_ptr<mpty const> casters. 2021-01-29 14:11:54 -08:00
Ralf W. Grosse-Kunstleve
2f53e85d6a Adding type_caster_bare_interface_demo. 2021-01-29 14:11:54 -08:00
Ralf W. Grosse-Kunstleve
abc5e2e9ff Removing stray file. 2021-01-29 14:11:54 -08:00
Ralf W. Grosse-Kunstleve
998c8c93d7 Removing obsolete and very incomplete test (replaced by Catch2-based test). 2021-01-29 14:11:53 -08:00
Ralf W. Grosse-Kunstleve
b63f4db0bc Converting from methods to factory functions (no functional change). 2021-01-29 14:11:53 -08:00
Ralf W. Grosse-Kunstleve
57429594c4 Adding top-level comment. 2021-01-29 14:11:53 -08:00
Ralf W. Grosse-Kunstleve
c919af3ade Testing of exceptions not covered by the from-as matrix. 2021-01-29 14:11:53 -08:00
Ralf W. Grosse-Kunstleve
94b14b87bc Implementing all [E]xception tests. 2021-01-29 14:11:53 -08:00
Ralf W. Grosse-Kunstleve
71d96afbdc Implementing all [S]uccess tests. 2021-01-29 14:11:53 -08:00
Ralf W. Grosse-Kunstleve
b0b55f2644 Shuffling existing TEST_CASEs into systematic matrix. 2021-01-29 14:11:53 -08:00
Ralf W. Grosse-Kunstleve
7d43a75226 Improved labeling of TEST_CASEs. 2021-01-29 14:11:53 -08:00
Ralf W. Grosse-Kunstleve
4144651c2c Adding in vptr_deleter_guard_flag. 2021-01-29 14:11:53 -08:00
Ralf W. Grosse-Kunstleve
80fe0d0d2f New tests/core/smart_holder_poc_test.cpp, using Catch2. 2021-01-29 14:11:53 -08:00
Ralf W. Grosse-Kunstleve
ebd334bf91 Adding from_shared_ptr. Some polishing. 2021-01-29 14:11:53 -08:00
Ralf W. Grosse-Kunstleve
f37a014005 Adding from/as unique_ptr<T> and unique_ptr<T, D>. 2021-01-29 14:11:53 -08:00
Ralf W. Grosse-Kunstleve
57132c49e2 Adding vptr_deleter. 2021-01-29 14:11:53 -08:00
Ralf W. Grosse-Kunstleve
3f7e522173 Snapshot of WIP, TODO: shared_ptr deleter with on/off switch 2021-01-29 14:11:53 -08:00
Ralf W. Grosse-Kunstleve
91543772fe pybind11 equivalent of Boost.Python test similar to reproducer under #1333 2021-01-29 14:11:53 -08:00
Ralf W. Grosse-Kunstleve
04a61f5121 minor test_private_first_base.cpp simplification (after discovering that this can be wrapped with Boost.Python, using boost::noncopyable) 2021-01-29 14:11:53 -08:00
Ralf W. Grosse-Kunstleve
cbf66e8881 Demonstration of Undefined Behavior in handling of polymorphic pointers.
(This demo does NOT involve smart pointers at all, unlike the otherwise similar test_smart_ptr_private_first_base.)
2021-01-29 14:11:53 -08:00
Ralf W. Grosse-Kunstleve
c29d8ca00d fixing up-down mixup in comment 2021-01-29 14:11:53 -08:00
Ralf W. Grosse-Kunstleve
02e0903522 Additional demonstration of Undefined Behavior in handling of shared_ptr holder. 2021-01-29 14:11:53 -08:00
Ralf W. Grosse-Kunstleve
d8796bb191 Demonstration of Undefined Behavior in handling of shared_ptr holder.
Based on https://godbolt.org/z/4fdjaW by jorgbrown@ (thanks Jorg!).
2021-01-29 14:11:53 -08:00
Ralf W. Grosse-Kunstleve
a61b8d5c0d Copying tests as-is from xxx_value_ptr_xxx_holder branch.
https://github.com/rwgk/pybind11/tree/xxx_value_ptr_xxx_holder

Systematically exercising casting between shared_ptr<base>, shared_ptr<derived>.
2021-01-29 14:11:53 -08:00
Ralf W. Grosse-Kunstleve
47c606ded7 Copying tests as-is from xxx_value_ptr_xxx_holder branch.
https://github.com/rwgk/pybind11/tree/xxx_value_ptr_xxx_holder

Systematically exercising returning and passing unique_ptr<T>, shared_ptr<T>
with unique_ptr, shared_ptr holder.

Observations:

test_holder_unique_ptr:
  make_unique_pointee  OK
  pass_unique_pointee  BUILD_FAIL (as documented)
  make_shared_pointee  Abort free(): double free detected
  pass_shared_pointee  RuntimeError: Unable to load a custom holder type from a default-holder instance

test_holder_shared_ptr:
  make_unique_pointee  Segmentation fault (#1138)
  pass_unique_pointee  BUILD_FAIL (as documented)
  make_shared_pointee  OK
  pass_shared_pointee  OK
2021-01-29 14:11:53 -08:00
Ralf W. Grosse-Kunstleve
93162081ff adding test_promotion_of_disowned_to_shared 2021-01-29 14:11:53 -08:00
Ralf W. Grosse-Kunstleve
9ffa2067e2 TRIGGER_SEGSEV macro, annotations for GET_STACK (vptr::get), GET_INT_STACK (pointee) 2021-01-29 14:11:53 -08:00
Ralf W. Grosse-Kunstleve
041a387c9f disabling AppVeyor (for this PR) 2021-01-29 14:11:52 -08:00
Ralf W. Grosse-Kunstleve
787aaba545 disabling GitHub Actions on pull_request (for this PR) 2021-01-29 14:11:52 -08:00
Ralf W. Grosse-Kunstleve
dc3cfbf936 moving prototype code to pybind11/vptr_holder.h, adding type_caster specialization to make the bindings involving unique_ptr passing compile, but load and cast implementations are missing 2021-01-29 14:11:52 -08:00
Ralf W. Grosse-Kunstleve
1f5864467f new test_variant_unique_shared with vptr_holder prototype 2021-01-29 14:11:52 -08:00
Ralf W. Grosse-Kunstleve
ca35e7a84b unique_ptr or shared_ptr return 2021-01-29 14:11:52 -08:00
Ralf W. Grosse-Kunstleve
63e6a702f2 Adding test_unique_ptr_member (for desired PyCLIF behavior).
See also: https://github.com/pybind/pybind11/issues/2583

Does not build with upstream master or
https://github.com/pybind/pybind11/pull/2047, but builds with
https://github.com/RobotLocomotion/pybind11 and almost runs:

```
Running tests in directory "/usr/local/google/home/rwgk/forked/EricCousineau-TRI/pybind11/tests":
================================================================================= test session starts =================================================================================
platform linux -- Python 3.8.5, pytest-5.4.3, py-1.9.0, pluggy-0.13.1
rootdir: /usr/local/google/home/rwgk/forked/EricCousineau-TRI/pybind11/tests, inifile: pytest.ini
collected 2 items

test_unique_ptr_member.py .F                                                                                                                                                    [100%]

====================================================================================== FAILURES =======================================================================================
_____________________________________________________________________________ test_pointee_and_ptr_owner ______________________________________________________________________________

    def test_pointee_and_ptr_owner():
        obj = m.pointee()
        assert obj.get_int() == 213
        m.ptr_owner(obj)
        with pytest.raises(ValueError) as exc_info:
>           obj.get_int()
E           Failed: DID NOT RAISE <class 'ValueError'>

test_unique_ptr_member.py:17: Failed
============================================================================= 1 failed, 1 passed in 0.06s =============================================================================
```
2021-01-29 14:11:52 -08:00
Ralf W. Grosse-Kunstleve
0432ae7c52
Changing pybind11::str to exclusively hold PyUnicodeObject (#2409)
* Changing pybind11::str to exclusively hold PyUnicodeObject
2021-01-29 09:41:42 -08:00
Yannick Jadoul
587d5f840a
Update breathe to 4.26.1, add make_tuple, make_iterator, and make_key_iterator (#2828) 2021-01-28 12:28:16 +01:00
Ralf W. Grosse-Kunstleve
9b7bfef833
Factoring out find_registered_python_instance() from type_caster_generic::cast. (#2822)
Factoring out find_registered_python_instance() from type_caster_generic::cast.
2021-01-26 21:08:46 -08:00
Henry Fredrick Schreiner
87954e7a54 fix: corrected dev versioning 2021-01-26 22:42:14 -05:00
Henry Fredrick Schreiner
4a5b81b1b7 chore: get back to work 2021-01-26 22:28:09 -05:00
Henry Schreiner
8de7772cc7
chore: prepare for the 2.6.2 release (#2821) 2021-01-26 21:26:45 -05:00
Henry Fredrick Schreiner
732bf88d19 fix: avoid changing class outside of GIL 2021-01-26 20:59:27 -05:00
Henry Fredrick Schreiner
dff9b3b432 chore: add pytest-timeout, mypy 2021-01-26 20:59:27 -05:00
Henry Schreiner
8e5d3d234e
docs: prepare for 2.6.2 (#2820)
* docs: prepare for 2.6.2

* chore: pre-commit autoupdate
2021-01-25 16:09:36 -05:00
dependabot[bot]
42e7380705
chore(deps): bump jwlawson/actions-setup-cmake from v1.6 to v1.7 (#2818)
Bumps [jwlawson/actions-setup-cmake](https://github.com/jwlawson/actions-setup-cmake) from v1.6 to v1.7.
- [Release notes](https://github.com/jwlawson/actions-setup-cmake/releases)
- [Commits](https://github.com/jwlawson/actions-setup-cmake/compare/v1.6...821902fd0e0da89b13fd3161d358e96bf7550883)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-01-25 15:11:18 -05:00
Yannick Jadoul
0bb8ca2639
Always call PyNumber_Index when casting from Python to a C++ integral type, also pre-3.8 (#2801)
* 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
2021-01-25 21:05:17 +01:00
crimsoncor
9ea39dc356
Force the builtin module key to be the correct type. (#2814)
* 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>
2021-01-24 09:17:28 -08:00
Henry Schreiner
08bca374fd
docs: update changelog, nicer output for script (#2811) 2021-01-21 11:34:39 -05:00
Henry Schreiner
44105ca1f2 docs: mention that the changelog block in PR is special 2021-01-19 22:47:40 -05:00