Commit Graph

429 Commits

Author SHA1 Message Date
Kota Yamaguchi
e248869893
Fix undefined memoryview format (#2223)
* Fix undefined memoryview format

* Add missing <algorithm> header

* Add workaround for py27 array compatibility

* Workaround py27 memoryview behavior

* Fix memoryview constructor from buffer_info

* Workaround PyMemoryView_FromMemory availability in py27

* Fix up memoryview tests

* Update memoryview test from buffer to check signedness

* Use static factory method to create memoryview

* Remove ndim arg from memoryview::frombuffer and add tests

* Allow ndim=0 memoryview and documentation fixup

* Use void* to align to frombuffer method signature

* Add const variants of frombuffer and frommemory

* Add memory view section in doc

* Fix docs

* Add test for null buffer

* Workaround py27 nullptr behavior in test

* Rename frombuffer to from_buffer
2020-07-15 08:50:43 -07:00
Yannick Jadoul
964ab956e0
Fix DeprecationWarning about 'invalid escape sequence' in tools/docs Python scripts (#2281) 2020-07-10 16:30:44 +02:00
Dustin Spicuzza
1b0bf352fa
Throw TypeError when subclasses forget to call __init__ (#2152)
- Fixes #2103
2020-07-07 12:04:06 +02:00
Wenzel Jakob
fc3a4490b8 Minor clarification (@AntoinePrv, #2083) 2020-07-01 00:29:55 +02:00
Guilherme Dantas
8908552dfc typo 2020-07-01 00:12:33 +02:00
Lin Hsu
d031efe788 Typo 2020-07-01 00:08:05 +02:00
Matthijs van der Burgh
b524008967
Deepcopy documentation (#2242)
* (docs) convert note to real note

* (docs) Add information about (deep)copy
2020-06-10 13:30:41 +02:00
Wenzel Jakob
a54eab92d2 Revert "Change __init__(self) to __new__(cls)"
This reverts commit 9ed8b44033.
2020-04-26 22:53:50 +02:00
Dustin Spicuzza
2c4cd8419d Add AutoWIG to list of binding generators (#1990)
* Add AutoWIG to list of binding generators
2020-04-26 18:40:54 +02:00
Sebastian Koslowski
a86ac538f5 rename args_kw_only to kwonly 2020-04-26 18:07:51 +02:00
Jason Rhinelander
be0d804523 Support keyword-only arguments
This adds support for a `py::args_kw_only()` annotation that can be
specified between `py::arg` annotations to indicate that any following
arguments are keyword-only.  This allows you to write:

    m.def("f", [](int a, int b) { /* ... */ },
          py::arg("a"), py::args_kw_only(), py::arg("b"));

and have it work like Python 3's:

    def f(a, *, b):
        # ...

with respect to how `a` and `b` arguments are accepted (that is, `a` can
be positional or by keyword; `b` can only be specified by keyword).
2020-04-26 18:07:51 +02:00
Dustin Spicuzza
0dfffcf257 Add is_final to disallow inheritance from Python
- Not currently supported on PyPy
2020-04-26 09:46:44 +02:00
Orell Garten
9ed8b44033 Change __init__(self) to __new__(cls)
__init__(self) cannot return values. According to https://stackoverflow.com/questions/2491819/how-to-return-a-value-from-init-in-python __new__(cls) should be used, which works.
2020-04-26 09:21:42 +02:00
Axel Huebl
6ebfc4b2b0 Document CMAKE_CXX_STANDARD
This variable is a CMake community standard to set the C++
standard of a build. Document it in favor of the previous variable,
which stays as a legacy flag for existing projects.

https://cmake.org/cmake/help/v3.17/variable/CMAKE_CXX_STANDARD.html
2020-04-26 09:17:10 +02:00
Wenzel Jakob
0234871649 begin working on next version 2020-03-31 13:09:41 +02:00
Wenzel Jakob
3b1dbebabc v2.5.0 release 2020-03-31 13:00:39 +02:00
Eric Cousineau
baf69345f6 Minor modifications to interrupt handling FAQ (#2007) 2019-11-25 22:14:06 +08:00
Charles Brossollet
0f1d3bfee2 Add FAQ entry for dealing with long functions interruption (#2000)
* Add FAQ entry, with code example, for dealing with long functions interruption
2019-11-25 17:59:53 +08:00
Francesco Biscani
deb3cb238a Add exception translation for std::overflow_error. (#1977) 2019-11-14 08:56:58 +01:00
Erick Matsen
b32b762c60 Fixing minor typo in basics.rst (#1984) 2019-11-14 08:54:46 +01:00
Wenzel Jakob
dfde1554ea begin working on next version 2019-10-15 01:58:43 +02:00
Wenzel Jakob
80d452484c v2.4.3 release 2019-10-15 01:57:24 +02:00
Wenzel Jakob
34c2281e31 begin working on next version 2019-09-21 20:23:01 +02:00
Wenzel Jakob
2abd7e1eb4 updated release.rst to remove parts that are now automated 2019-09-21 20:22:33 +02:00
Wenzel Jakob
7ec2ddfc95 v2.4.2 release 2019-09-21 20:20:26 +02:00
Wenzel Jakob
82cf793588 begin working on next version 2019-09-20 11:12:22 +02:00
Wenzel Jakob
e44fcc3c15 v2.4.1 release 2019-09-20 11:10:49 +02:00
Wenzel Jakob
5fd187ebe9 minor changelog cleanup
[ci skip]
2019-09-20 10:49:54 +02:00
Wenzel Jakob
e825205ac6 begin working on v2.4.1 2019-09-19 23:18:04 +02:00
Wenzel Jakob
00a0aa9929 v2.4.0 release 2019-09-19 23:06:22 +02:00
Andre Schmeißer
19189b4c2c Make overload_cast_impl available in C++11 mode. (#1581)
* Make `overload_cast_impl` available in C++11 mode.

Narrow the scope of the `#if defined(PYBIND11_CPP14)` block around overload_cast to only
cover the parts where C++14 is stricly required. Thus, the implementation in
`pybind11::details::overload_cast_impl` is still available in C++11 mode.

* PR #1581: Modify test to use overload_cast_impl, update docs and change log
2019-08-19 12:54:33 +02:00
phil-zxx
c6b699d9c2 Added ability to convert from datetime.date to system_clock::time_point (#1848)
* Added ability to convert from Python datetime.date and datetime.time to C++ system_clock::time_point
2019-07-19 11:28:48 +02:00
Ian Bell
502ffe50a9 Add docs and tests for unary op on class (#1814) 2019-06-22 12:07:41 +02:00
Wenzel Jakob
64f2a5f8e6 begin work on v2.3.1 2019-06-12 21:03:40 +02:00
Wenzel Jakob
cf36e3d9ba updated changelog 2019-06-11 23:28:58 +02:00
Wenzel Jakob
51ca6b0832 Update docs on std::out_of_range exception mapping (#1254) 2019-06-11 23:28:58 +02:00
Chris Rusby
22859bb8fc Support more natural syntax for vector extend 2019-06-11 23:28:58 +02:00
Roland Dreier
7a24bcf1f6 Fix malformed reST (#1802)
Commit 2b045757b5 ("Improve documentation related to inheritance. (#1676)") left off
a ':' from a hyperlink, which breaks the Travis CI build.
2019-06-11 10:57:49 +02:00
Ivor Wanders
2b045757b5 Improve documentation related to inheritance. (#1676)
* Adds section to the reference.
* Adds section to advanced classes page describing how to use `get_overload`.
2019-06-10 22:12:28 +02:00
Manuel Schneider
492da592c2 another typo (#1675) 2019-06-10 22:05:12 +02:00
Darius Arnold
09330b94ea Fix typos in documentation (#1635)
* Always capitalize Eigen

* Fix spelling
2019-06-10 21:57:00 +02:00
Omar Awile
ac6cb91a34 Fixed small typo (#1633)
I think this particular method binding should not be done with `PYBIND11_OVERLOAD_PURE` but instead `PYBIND11_OVERLOAD`.
2019-06-10 21:56:17 +02:00
Sergei Izmailov
979d75de23 doc: Add note about casting from None to T* (#1760)
* doc: Add note about casting from `None` to `T*`

* doc: reword 'none-to-pointer' note message

* doc: mention opaque types in 'none-to-pointer' note message
2019-06-10 21:03:17 +02:00
nstelzen
c251434011 Added note in documentation regarding make install (#1801)
* Added note regarding make install
2019-06-10 16:35:36 +02:00
Wenzel Jakob
64205140bd added std::deque to overview.rst
[ci skip]
2018-11-16 06:46:48 +01:00
voxmea
17983e7425 Adds type_caster support for std::deque. (#1609)
* Adds std::deque to the types supported by list_caster in stl.h.
* Adds a new test_deque test in test_stl.{py,cpp}.
* Updates the documentation to include std::deque as a default
  supported type.
2018-11-16 06:45:19 +01:00
Ahuva Kroizer
8f5b7fce84 FAQ addition (#1606)
* Add possible solution to ImportError issue
2018-11-13 13:25:57 +01:00
Allan Leal
e76dff7751 Fix for Issue #1258 (#1298)
* Fix for Issue #1258

list_caster::load method will now check for a Python string and prevent its automatic conversion to a list.
This should fix the issue "pybind11/stl.h converts string to vector<string> #1258" (https://github.com/pybind/pybind11/issues/1258)

* Added tests for fix of issue #1258

* Changelog: stl string auto-conversion
2018-10-11 10:28:12 +02:00
Semen Yesylevskyy
ef13fb2e1c Info about inconsistent detection of Python version between pybind11 … (#1093)
* Info about inconsistent detection of Python version between pybind11 and CMake in FAQ
2018-09-12 00:20:56 +02:00
Wenzel Jakob
f4245181ae enum_: move most functionality to a non-template implementation
This commit addresses an inefficiency in how enums are created in
pybind11. Most of the enum_<> implementation is completely generic --
however, being a template class, it ended up instantiating vast amounts
of essentially identical code in larger projects with many enums.

This commit introduces a generic non-templated helper class that is
compatible with any kind of enumeration. enum_ then becomes a thin
wrapper around this new class.

The new enum_<> API is designed to be 100% compatible with the old one.
2018-09-11 22:08:26 +02:00