Skip to content

Make a 2.2.2 release #1250

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 26 commits into from
Feb 7, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
8b1e4ee
Fix `char &` arguments being non-bindable
jagerman Oct 6, 2017
a1cda5b
Fix 2D Nx1/1xN inputs to eigen dense vector args
jagerman Sep 21, 2017
f40e51d
Build /permissive- under VS2017
jagerman Oct 22, 2017
3aca745
Miscellaneous travis-ci updates/fixes
jagerman Oct 22, 2017
2540524
added citation reference (fixes #767) (#1189)
wjakob Nov 17, 2017
075334e
Fix new flake8 E741 error from using `l` variable
jagerman Oct 24, 2017
355f279
Trivial typos
Nov 2, 2017
040f008
__qualname__ and nested class naming fixes (#1171)
jagerman Nov 7, 2017
b533e3a
Moved section on licensing of contributions (fixes #1109) (#1188)
wjakob Nov 17, 2017
494db08
Remove spurious quote in error message. (#1202)
anntzer Dec 4, 2017
4e35b7e
Silence new MSVC C++17 deprecation warnings
jagerman Dec 15, 2017
3e3343f
Update PyPI URLs.
QuLogic Dec 14, 2017
5b3f88e
Fix premature destruction of args/kwargs arguments
jagerman Dec 23, 2017
1836232
Fix leak in var arg handling
zdevito Dec 15, 2017
8a04fc7
Simplify arg copying
jagerman Dec 15, 2017
4ef1bac
Added py::args ref counting tests
jagerman Dec 15, 2017
e119195
Fixes for numpy 1.14.0 compatibility
jagerman Jan 11, 2018
a6e89bb
Use a named rather than anon struct in instance
jagerman Jan 11, 2018
d3cee7c
misc. typos
luzpaz Jan 9, 2018
9cc4e43
fix return from std::map bindings to __delitem__ (#1229)
vanossj Jan 11, 2018
54d31db
Fix segfault when reloading interpreter with external modules (#1092)
jagerman Jan 11, 2018
89cb495
Don't add duplicate patients
jagerman Jan 13, 2018
064ea99
Use stricter brace initialization
jagerman Jan 11, 2018
c575483
MSVC workaround for broken `using detail::_` warning
jagerman Jan 12, 2018
db9acf3
Fix pybind11 interoperability with Clang trunk
wjakob Feb 5, 2018
cb1525d
Updated version/changelog for 2.2.2
jagerman Jan 12, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ install:
if ($env:APPVEYOR_JOB_NAME -like "*Visual Studio 2017*") {
$env:CMAKE_GENERATOR = "Visual Studio 15 2017"
$env:CMAKE_INCLUDE_PATH = "C:\Libraries\boost_1_64_0"
$env:CXXFLAGS = "-permissive-"
} else {
$env:CMAKE_GENERATOR = "Visual Studio 14 2015"
}
Expand Down
18 changes: 9 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,22 +100,22 @@ before_install:
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
if [ -n "$CLANG" ]; then
export CXX=clang++-$CLANG CC=clang-$CLANG
COMPILER_PACKAGES="clang-$CLANG llvm-$CLANG-dev"
EXTRA_PACKAGES+=" clang-$CLANG llvm-$CLANG-dev"
else
if [ -z "$GCC" ]; then GCC=4.8
else COMPILER_PACKAGES=g++-$GCC
else EXTRA_PACKAGES+=" g++-$GCC"
fi
export CXX=g++-$GCC CC=gcc-$GCC
fi
if [ "$GCC" = "6" ]; then DOCKER=${ARCH:+$ARCH/}debian:stretch
elif [ "$GCC" = "7" ]; then DOCKER=debian:buster
elif [ "$GCC" = "7" ]; then DOCKER=debian:buster EXTRA_PACKAGES+=" catch" DOWNLOAD_CATCH=OFF
fi
elif [ "$TRAVIS_OS_NAME" = "osx" ]; then
export CXX=clang++ CC=clang;
fi
if [ -n "$CPP" ]; then CPP=-std=c++$CPP; fi
if [ "${PYTHON:0:1}" = "3" ]; then PY=3; fi
if [ -n "$DEBUG" ]; then CMAKE_EXTRA_ARGS="${CMAKE_EXTRA_ARGS} -DCMAKE_BUILD_TYPE=Debug"; fi
if [ -n "$DEBUG" ]; then CMAKE_EXTRA_ARGS+=" -DCMAKE_BUILD_TYPE=Debug"; fi
- |
# Initialize environment
set -e
Expand All @@ -133,7 +133,7 @@ before_install:
if [ "$PYPY" = "5.8" ]; then
curl -fSL https://bitbucket.org/pypy/pypy/downloads/pypy2-v5.8.0-linux64.tar.bz2 | tar xj
PY_CMD=$(echo `pwd`/pypy2-v5.8.0-linux64/bin/pypy)
CMAKE_EXTRA_ARGS="${CMAKE_EXTRA_ARGS} -DPYTHON_EXECUTABLE:FILEPATH=$PY_CMD"
CMAKE_EXTRA_ARGS+=" -DPYTHON_EXECUTABLE:FILEPATH=$PY_CMD"
else
PY_CMD=python$PYTHON
if [ "$TRAVIS_OS_NAME" = "osx" ]; then
Expand All @@ -157,12 +157,12 @@ install:
if [ -n "$DOCKER" ]; then
if [ -n "$DEBUG" ]; then
PY_DEBUG="python$PYTHON-dbg python$PY-scipy-dbg"
CMAKE_EXTRA_ARGS="${CMAKE_EXTRA_ARGS} -DPYTHON_EXECUTABLE=/usr/bin/python${PYTHON}dm"
CMAKE_EXTRA_ARGS+=" -DPYTHON_EXECUTABLE=/usr/bin/python${PYTHON}dm"
fi
$SCRIPT_RUN_PREFIX sh -c "for s in 0 15; do sleep \$s; \
apt-get -qy --no-install-recommends install \
$PY_DEBUG python$PYTHON-dev python$PY-pytest python$PY-scipy \
libeigen3-dev libboost-dev cmake make ${COMPILER_PACKAGES} && break; done"
libeigen3-dev libboost-dev cmake make ${EXTRA_PACKAGES} && break; done"
else

if [ "$CLANG" = "5.0" ]; then
Expand Down Expand Up @@ -195,15 +195,15 @@ install:

wget -q -O eigen.tar.gz https://bitbucket.org/eigen/eigen/get/3.3.3.tar.gz
tar xzf eigen.tar.gz
export CMAKE_INCLUDE_PATH="${CMAKE_INCLUDE_PATH:+:}$PWD/eigen-eigen-67e894c6cd8f"
export CMAKE_INCLUDE_PATH="${CMAKE_INCLUDE_PATH:+$CMAKE_INCLUDE_PATH:}$PWD/eigen-eigen-67e894c6cd8f"
fi
set +e
script:
- $SCRIPT_RUN_PREFIX cmake ${CMAKE_EXTRA_ARGS}
-DPYBIND11_PYTHON_VERSION=$PYTHON
-DPYBIND11_CPP_STANDARD=$CPP
-DPYBIND11_WERROR=${WERROR:-ON}
-DDOWNLOAD_CATCH=ON
-DDOWNLOAD_CATCH=${DOWNLOAD_CATCH:-ON}
- $SCRIPT_RUN_PREFIX make pytest -j 2
- $SCRIPT_RUN_PREFIX make cpptest -j 2
- if [ -n "$CMAKE" ]; then $SCRIPT_RUN_PREFIX make test_cmake_build; fi
Expand Down
12 changes: 11 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,18 @@ adhere to the following rules to make the process as smooth as possible:
* This project has a strong focus on providing general solutions using a
minimal amount of code, thus small pull requests are greatly preferred.

### License
### Licensing of contributions

pybind11 is provided under a BSD-style license that can be found in the
``LICENSE`` file. By using, distributing, or contributing to this project, you
agree to the terms and conditions of this license.

You are under no obligation whatsoever to provide any bug fixes, patches, or
upgrades to the features, functionality or performance of the source code
("Enhancements") to anyone; however, if you choose to make your Enhancements
available either publicly, or directly to the author of this software, without
imposing a separate written license agreement for such Enhancements, then you
hereby grant the following license: a non-exclusive, royalty-free perpetual
license to install, use, modify, prepare derivative works, incorporate into
other computer software, distribute, and sublicense such enhancements or
derivative works thereof, in binary and source code form.
11 changes: 2 additions & 9 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,5 @@ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

You are under no obligation whatsoever to provide any bug fixes, patches, or
upgrades to the features, functionality or performance of the source code
("Enhancements") to anyone; however, if you choose to make your Enhancements
available either publicly, or directly to the author of this software, without
imposing a separate written license agreement for such Enhancements, then you
hereby grant the following license: a non-exclusive, royalty-free perpetual
license to install, use, modify, prepare derivative works, incorporate into
other computer software, distribute, and sublicense such enhancements or
derivative works thereof, in binary and source code form.
Please also refer to the file CONTRIBUTING.md, which clarifies licensing of
external contributions to this project including patches, pull requests, etc.
6 changes: 3 additions & 3 deletions docs/advanced/cast/eigen.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ consideration: by default, numpy matrices and eigen matrices are *not* storage
compatible.

If the numpy matrix cannot be used as is (either because its types differ, e.g.
passing an array of integers to an Eigen paramater requiring doubles, or
passing an array of integers to an Eigen parameter requiring doubles, or
because the storage is incompatible), pybind11 makes a temporary copy and
passes the copy instead.

Expand Down Expand Up @@ -89,7 +89,7 @@ as dictated by the binding function's return value policy (see the
documentation on :ref:`return_value_policies` for full details). That means,
without an explicit return value policy, lvalue references will be copied and
pointers will be managed by pybind11. In order to avoid copying, you should
explictly specify an appropriate return value policy, as in the following
explicitly specify an appropriate return value policy, as in the following
example:

.. code-block:: cpp
Expand Down Expand Up @@ -287,7 +287,7 @@ On the other hand, pybind11 allows you to pass 1-dimensional arrays of length N
as Eigen parameters. If the Eigen type can hold a column vector of length N it
will be passed as such a column vector. If not, but the Eigen type constraints
will accept a row vector, it will be passed as a row vector. (The column
vector takes precendence when both are supported, for example, when passing a
vector takes precedence when both are supported, for example, when passing a
1D numpy array to a MatrixXd argument). Note that the type need not be
expicitly a vector: it is permitted to pass a 1D numpy array of size 5 to an
Eigen ``Matrix<double, Dynamic, 5>``: you would end up with a 1x5 Eigen matrix.
Expand Down
2 changes: 1 addition & 1 deletion docs/advanced/exceptions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -138,5 +138,5 @@ section.
error return without exception set``.

Exceptions that you do not plan to handle should simply not be caught, or
may be explicity (re-)thrown to delegate it to the other,
may be explicitly (re-)thrown to delegate it to the other,
previously-declared existing exception translators.
4 changes: 2 additions & 2 deletions docs/advanced/functions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ targeted arguments can be passed through the :class:`cpp_function` constructor:

.. warning::

Code with invalid return value policies might access unitialized memory or
Code with invalid return value policies might access uninitialized memory or
free data structures multiple times, which can lead to hard-to-debug
non-determinism and segmentation faults, hence it is worth spending the
time to understand all the different options in the table above.
Expand Down Expand Up @@ -473,7 +473,7 @@ Overload resolution order
When a function or method with multiple overloads is called from Python,
pybind11 determines which overload to call in two passes. The first pass
attempts to call each overload without allowing argument conversion (as if
every argument had been specified as ``py::arg().noconvert()`` as decribed
every argument had been specified as ``py::arg().noconvert()`` as described
above).

If no overload succeeds in the no-conversion first pass, a second pass is
Expand Down
64 changes: 62 additions & 2 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,70 @@ Changelog
Starting with version 1.8.0, pybind11 releases use a `semantic versioning
<http://semver.org>`_ policy.

v2.3.0 (Not yet released)
v2.2.2 (Not yet released)
-----------------------------------------------------

* TBD
* Fixed a segfault when combining embedded interpreter
shutdown/reinitialization with external loaded pybind11 modules.
`#1092 <https://github.com/pybind/pybind11/pull/1092>`_.

* Eigen support: fixed a bug where Nx1/1xN numpy inputs couldn't be passed as
arguments to Eigen vectors (which for Eigen are simply compile-time fixed
Nx1/1xN matrices).
`#1106 <https://github.com/pybind/pybind11/pull/1106>`_.

* Clarified to license by moving the licensing of contributions from
``LICENSE`` into ``CONTRIBUTING.md``: the licensing of contributions is not
actually part of the software license as distributed. This isn't meant to be
a substantial change in the licensing of the project, but addresses concerns
that the clause made the license non-standard.
`#1109 <https://github.com/pybind/pybind11/issues/1109>`_.

* Fixed a regression introduced in 2.1 that broke binding functions with lvalue
character literal arguments.
`#1128 <https://github.com/pybind/pybind11/pull/1128>`_.

* MSVC: fix for compilation failures under /permissive-, and added the flag to
the appveyor test suite.
`#1155 <https://github.com/pybind/pybind11/pull/1155>`_.

* Fixed ``__qualname__`` generation, and in turn, fixes how class names
(especially nested class names) are shown in generated docstrings.
`#1171 <https://github.com/pybind/pybind11/pull/1171>`_.

* Updated the FAQ with a suggested project citation reference.
`#1189 <https://github.com/pybind/pybind11/pull/1189>`_.

* Added fixes for deprecation warnings when compiled under C++17 with
``-Wdeprecated`` turned on, and add ``-Wdeprecated`` to the test suite
compilation flags.
`#1191 <https://github.com/pybind/pybind11/pull/1191>`_.

* Fixed outdated PyPI URLs in ``setup.py``.
`#1213 <https://github.com/pybind/pybind11/pull/1213>`_.

* Fixed a refcount leak for arguments that end up in a ``py::args`` argument
for functions with both fixed positional and ``py::args`` arguments.
`#1216 <https://github.com/pybind/pybind11/pull/1216>`_.

* Fixed a potential segfault resulting from possible premature destruction of
``py::args``/``py::kwargs`` arguments with overloaded functions.
`#1223 <https://github.com/pybind/pybind11/pull/1223>`_.

* Fixed ``del map[item]`` for a ``stl_bind.h`` bound stl map.
`#1229 <https://github.com/pybind/pybind11/pull/1229>`_.

* Fixed a regression from v2.1.x where the aggregate initialization could
unintentionally end up at a constructor taking a templated
``std::initializer_list<T>`` argument.
`#1249 <https://github.com/pybind/pybind11/pull/1249>`_.

* Fixed an issue where calling a function with a keep_alive policy on the same
nurse/patient pair would cause the internal patient storage to needlessly
grow (unboundedly, if the nurse is long-lived).
`#1251 <https://github.com/pybind/pybind11/issues/1251>`_.

* Various other minor fixes.

v2.2.1 (September 14, 2017)
-----------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
# The short X.Y version.
version = '2.2'
# The full version, including alpha/beta/rc tags.
release = '2.2.1'
release = '2.2.2'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
16 changes: 16 additions & 0 deletions docs/faq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -271,3 +271,19 @@ Common gotchas to watch out for involve not ``free()``-ing memory region
that that were ``malloc()``-ed in another shared library, using data
structures with incompatible ABIs, and so on. pybind11 is very careful not
to make these types of mistakes.

How to cite this project?
=========================

We suggest the following BibTeX template to cite pybind11 in scientific
discourse:

.. code-block:: bash

@misc{pybind11,
author = {Wenzel Jakob and Jason Rhinelander and Dean Moldovan},
year = {2017},
note = {https://github.com/pybind/pybind11},
title = {pybind11 -- Seamless operability between C++11 and Python}
}

26 changes: 18 additions & 8 deletions include/pybind11/cast.h
Original file line number Diff line number Diff line change
Expand Up @@ -1216,6 +1216,7 @@ template <typename CharT> struct type_caster<CharT, enable_if_t<is_std_char_type
using StringCaster = type_caster<StringType>;
StringCaster str_caster;
bool none = false;
CharT one_char = 0;
public:
bool load(handle src, bool convert) {
if (!src) return false;
Expand Down Expand Up @@ -1243,7 +1244,7 @@ template <typename CharT> struct type_caster<CharT, enable_if_t<is_std_char_type
}

operator CharT*() { return none ? nullptr : const_cast<CharT *>(static_cast<StringType &>(str_caster).c_str()); }
operator CharT() {
operator CharT&() {
if (none)
throw value_error("Cannot convert None to a character");

Expand All @@ -1267,7 +1268,8 @@ template <typename CharT> struct type_caster<CharT, enable_if_t<is_std_char_type
if (char0_bytes == str_len) {
// If we have a 128-255 value, we can decode it into a single char:
if (char0_bytes == 2 && (v0 & 0xFC) == 0xC0) { // 0x110000xx 0x10xxxxxx
return static_cast<CharT>(((v0 & 3) << 6) + (static_cast<unsigned char>(value[1]) & 0x3F));
one_char = static_cast<CharT>(((v0 & 3) << 6) + (static_cast<unsigned char>(value[1]) & 0x3F));
return one_char;
}
// Otherwise we have a single character, but it's > U+00FF
throw value_error("Character code point not in range(0x100)");
Expand All @@ -1278,19 +1280,20 @@ template <typename CharT> struct type_caster<CharT, enable_if_t<is_std_char_type
// surrogate pair with total length 2 instantly indicates a range error (but not a "your
// string was too long" error).
else if (StringCaster::UTF_N == 16 && str_len == 2) {
char16_t v0 = static_cast<char16_t>(value[0]);
if (v0 >= 0xD800 && v0 < 0xE000)
one_char = static_cast<CharT>(value[0]);
if (one_char >= 0xD800 && one_char < 0xE000)
throw value_error("Character code point not in range(0x10000)");
}

if (str_len != 1)
throw value_error("Expected a character, but multi-character string found");

return value[0];
one_char = value[0];
return one_char;
}

static PYBIND11_DESCR name() { return type_descr(_(PYBIND11_STRING_NAME)); }
template <typename _T> using cast_op_type = remove_reference_t<pybind11::detail::cast_op_type<_T>>;
template <typename _T> using cast_op_type = pybind11::detail::cast_op_type<_T>;
};

// Base implementation for std::tuple and std::pair
Expand Down Expand Up @@ -1414,7 +1417,7 @@ struct copyable_holder_caster : public type_caster_base<type> {
bool load_value(value_and_holder &&v_h) {
if (v_h.holder_constructed()) {
value = v_h.value_ptr();
holder = v_h.holder<holder_type>();
holder = v_h.template holder<holder_type>();
return true;
} else {
throw cast_error("Unable to cast from non-held to held instance (T& to Holder<T>) "
Expand Down Expand Up @@ -1574,7 +1577,7 @@ template <typename T, typename SFINAE> type_caster<T, SFINAE> &load_type(type_ca
throw cast_error("Unable to cast Python instance to C++ type (compile in debug mode for details)");
#else
throw cast_error("Unable to cast Python instance of type " +
(std::string) str(handle.get_type()) + " to C++ type '" + type_id<T>() + "''");
(std::string) str(handle.get_type()) + " to C++ type '" + type_id<T>() + "'");
#endif
}
return conv;
Expand Down Expand Up @@ -1683,6 +1686,9 @@ template <> inline void cast_safe<void>(object &&) {}

NAMESPACE_END(detail)

template <return_value_policy policy = return_value_policy::automatic_reference>
tuple make_tuple() { return tuple(0); }

template <return_value_policy policy = return_value_policy::automatic_reference,
typename... Args> tuple make_tuple(Args&&... args_) {
constexpr size_t size = sizeof...(Args);
Expand Down Expand Up @@ -1799,6 +1805,10 @@ struct function_call {
/// The `convert` value the arguments should be loaded with
std::vector<bool> args_convert;

/// Extra references for the optional `py::args` and/or `py::kwargs` arguments (which, if
/// present, are also in `args` but without a reference).
object args_ref, kwargs_ref;

/// The parent, if any
handle parent;

Expand Down
Loading