1. 10 Sep, 2016 1 commit
  2. 08 Sep, 2016 1 commit
    • Jason Rhinelander's avatar
      Fix type alias initialization · 9c6859ee
      Jason Rhinelander authored
      Type alias for alias classes with members didn't work properly: space
      was only allocated for sizeof(type), but if we want to be able to put a
      type_alias instance there, we need sizeof(type_alias), but
      sizeof(type_alias) > sizeof(type) whenever type_alias has members.
      9c6859ee
  3. 07 Sep, 2016 2 commits
    • Jason Rhinelander's avatar
      Fail static_assert when trying to reference non-referencable types · c03db9ba
      Jason Rhinelander authored
      The previous commit to address #392 triggers a compiler warning about
      returning a reference to a local variable, which is *not* a false alarm:
      the following:
      
          py::cast<int &>(o)
      
      (which happens internally in an overload declaration) really is
      returning a reference to a local, because the cast operators for the
      type_caster for numeric types returns a reference to its own member.
      
      This commit adds a static_assert to make that a compilation failure
      rather than returning a reference into about-to-be-freed memory.
      
      Incidentally, this is also a fix for #219, which is exactly the same
      issue: we can't reference numeric primitives that are cast from
      wrappers around python numeric types.
      c03db9ba
    • Jason Rhinelander's avatar
      Fix type caster for heap reference types · 56f71775
      Jason Rhinelander authored
      Need to use the intrinsic type, not the raw type.
      
      Fixes #392.
      56f71775
  4. 06 Sep, 2016 1 commit
  5. 19 Aug, 2016 3 commits
    • Dean Moldovan's avatar
      99dbdc16
    • Dean Moldovan's avatar
      Simplify tests by replacing output capture with asserts where possible · 665e8804
      Dean Moldovan authored
      The C++ part of the test code is modified to achieve this. As a result,
      this kind of test:
      
      ```python
      with capture:
          kw_func1(5, y=10)
      assert capture == "kw_func(x=5, y=10)"
      ```
      
      can be replaced with a simple:
      
      `assert kw_func1(5, y=10) == "x=5, y=10"`
      665e8804
    • Dean Moldovan's avatar
      Port tests to pytest · a0c1ccf0
      Dean Moldovan authored
      Use simple asserts and pytest's powerful introspection to make testing
      simpler. This merges the old .py/.ref file pairs into simple .py files
      where the expected values are right next to the code being tested.
      
      This commit does not touch the C++ part of the code and replicates the
      Python tests exactly like the old .ref-file-based approach.
      a0c1ccf0