• Dean Moldovan's avatar
    Add default and converting constructors for all concrete Python types · e18bc02f
    Dean Moldovan authored
    * Deprecate the `py::object::str()` member function since `py::str(obj)`
      is now equivalent and preferred
    
    * Make `py::repr()` a free function
    
    * Make sure obj.cast<T>() works as expected when T is a Python type
    
    `obj.cast<T>()` should be the same as `T(obj)`, i.e. it should convert
    the given object to a different Python type. However, `obj.cast<T>()`
    usually calls `type_caster::load()` which only checks the type without
    doing any actual conversion. That causes a very unexpected `cast_error`.
    This commit makes it so that `obj.cast<T>()` and `T(obj)` are the same
    when T is a Python type.
    
    * Simplify pytypes converting constructor implementation
    
    It's not necessary to maintain a full set of converting constructors
    and assignment operators + const& and &&. A single converting const&
    constructor will work and there is no impact on binary size. On the
    other hand, the conversion functions can be significantly simplified.
    e18bc02f
To find the state of this project's repository at the time of any of these versions, check out the tags..
changelog.rst 12.1 KB