Commit Graph

110 Commits

Author SHA1 Message Date
Alexander Niederbühl 1f675dcaa7 Clear error indicator when the exception is handled on the Rust side
Leaving Python's global exception state is misleading, e.g. subsequent
calls of `py.eval` will fail.
2020-01-11 00:44:11 +01:00
David Hewitt ec79285fe4 Implement IntoIterator for PySet and PyFrozenSet 2020-01-08 00:07:11 +00:00
David Hewitt 72e9abd4c7 Remove specialization from IntoPy implementation 2020-01-07 09:32:34 +00:00
David Hewitt bf507da154 Remove specialization from FromPyObject blanket impls 2020-01-07 09:01:35 +00:00
kngwyu d22b03edde Bump version to 0.8.5 2020-01-05 16:39:18 +09:00
Guillaume Desmottes 6f202efa59 dict: implement FromPyObject for BTreeMap 2019-12-24 18:53:19 +05:30
Guillaume Desmottes ea7a384999 dict: implement FromPyObject for HashMap
Based on code from Ben Avrahami on https://github.com/PyO3/pyo3/issues/516
2019-12-24 18:53:00 +05:30
David Hewitt 4b18830f1e Add `#[name]` attribute support for `#[pyfunction]` 2019-12-17 22:14:28 +00:00
David Hewitt 7702395b3d Add #[name = "foo"] attribute to #[pymethods] 2019-12-17 17:45:53 +00:00
kngwyu d8a4ecb476 Bump version to 0.8.4 2019-12-14 15:20:55 +09:00
Jacob Lifshay 9ac66ac1eb add text_signature to changelog 2019-11-29 13:31:21 -08:00
kngwyu a85ed6ba80 Update git tags for CHANGELOG 2019-11-23 18:39:59 +09:00
kngwyu 935adaa5d5 Bump version to 0.8.3 2019-11-23 17:09:10 +09:00
kngwyu 14d2196ba0 Bump version to 0.8.2 2019-10-26 22:47:19 +09:00
Yuji Kanagawa 6868d7f734
Merge branch 'master' into fix-mapping-protocol 2019-10-26 02:55:54 +09:00
Sebastian Puetz 3b707c8511 Remove contains and iter from PyMappingProtocol.
The methods are not expected by CPython and are only explicitly
callable. To get iteration support, PyIterProtocol should be
implemented and to get support for `x in mapping`,
PySequenceProtocol's __contains__ should be implemented.

https://github.com/PyO3/pyo3/issues/611
2019-10-25 17:20:44 +02:00
Sebastian Puetz 4864c584f3 Fix derive for PyObjectSetAttrProtocol.
PyObjectSetAttrProtocol doesn't define associated type Success.
2019-10-25 16:10:00 +02:00
Alexander Niederbühl defa43015a Fix handling of invalid utf-8 sequences in PyString::to_string_lossy 2019-10-24 22:45:32 +02:00
ijl caf4713b3a FFI for PEP 590 Vectorcall
https://www.python.org/dev/peps/pep-0590/

This was tested on 3.7 using _PyCFunctionFast and 3.8
using PyObject_Vectorcall. Extending pyo3-derive-backend
to generate code using vectorcall is not done here.

This exposes PyObject_Vectorcall with a link_name to the
underscored name on 3.8 because it is expected to be stabilized
on 3.9.

This fixes the "fast" objects being new in 3.7, not 3.6.
2019-10-23 21:40:38 +00:00
kngwyu d019fe814c Bump version to 0.8.1 2019-10-08 01:52:06 +09:00
Martin Larralde 33bf37d3d8 Run `cargo fmt` on source code and update `CHANGELOG.md` 2019-10-07 17:12:32 +02:00
Martin Larralde b1ff620e48 Add entry to `CHANGELOG.md` 2019-09-15 14:46:06 +02:00
konstin a3e41cc819 Release 0.8.0 2019-09-05 13:18:50 +02:00
konstin 3228b4cd6c
Merge pull request #585 from andersk/drain-gil
Require the GIL to be held in ReleasePool::drain
2019-09-05 12:46:35 +02:00
kngwyu 96b71bfb76 Merge branch 'master' into parse_args_msg 2019-08-31 17:03:15 +09:00
Anders Kaseorg e70e9ab5e6 Require the GIL to be held to drain the ReleasePool
This adds a `Python` marker to `GILPool`, to prevent the caller from
misusing it to drain the `ReleasePool` and release Python objects
without the GIL held.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2019-08-29 23:55:59 -07:00
konstin 30e82a3018 Replace IntoPyObject with IntoPy<PyObject> 2019-08-24 19:23:28 +02:00
kngwyu e055fdb338 Add a missing entry to CHANGELOG 2019-08-12 22:46:15 +09:00
Yuji Kanagawa 1f85593d0a
Merge pull request #564 from kngwyu/paste
Replace mashup with paste
2019-08-11 18:42:21 +09:00
konstin 5096f936dc Disable segfaulty subclassing by default
See https://github.com/PyO3/pyo3/issues/220 and https://github.com/PyO3/pyo3/issues/407 for details on those segfaults
2019-08-05 11:52:47 +02:00
kngwyu 41f31e85fd Replace mashup with paste 2019-08-04 23:50:10 +09:00
konstin bd86b6750e Replace unsound PyByteArray::data with PyByteArray::to_vec 2019-07-18 22:57:33 +02:00
konstin d90ac76400 Implement Index for PyBytes 2019-07-17 12:29:14 +02:00
Paul Ganssle e633ae25eb
Add changelog error for PR #532 2019-07-14 18:00:16 +02:00
konstin 7a83cb6afa Use existing fields and methods before calling custom __getattr__
Previously, defining `__getattr__` would override all existing fields and methods. This changes it to behave like a `__getattr__` method defined in python, i.e. the custom method is only called if there isn't a field or method of that name
2019-07-13 22:54:43 +09:00
Georg Brandl cba1657460 Adjust the varargs/kwds objects to remove arguments consumed by parameters
Also fix some other validation issues and add more tests.

fixes #420
2019-06-16 22:13:50 +09:00
kngwyu 9073956da6 Edit CHANGELOG 2019-06-15 23:12:22 +09:00
Martin Larralde 99fdafbb88 Allow setting the module name for a pyclass (#499)
* Add `MODULE` const value to `PyTypeInfo` trait

* Allow setting module name in `pyclass` macro arguments

* Add `$module` argument to `pyobject_native_type` macro in `pyo3::types`

* Set the right module for builtin types in `pyo3::types`

* Add `module` argument to example `word_count.WordCounter` class

* Add `module` argument of `pyclass` macro to guide

* Reformat code using `rustfmt`

* Add tests and entry in CHANGELOG.md for `module` argument in `pyclass`

* Make `$module` parameter in `pyobject_native_type` optional

* Make `pyobject_native_type` declare module as `Some("builtins")` by default
2019-06-03 12:18:44 +09:00
konstin 0279b3d69f Release 0.7.0 2019-05-26 17:27:14 +09:00
kngwyu 4bf448ecaa Complete the PR 2019-05-25 23:19:07 +09:00
Azat Ibrakov 134c129edc Fix installing in 'venv' and datetime tests on Windows (#472)
* Add failing test

* Complete formatting

* Fix commands execution

* Fix commands execution for Linux

* Extract virtual environment creation/removing into separate functions

* Complete error messages

* Complete examples building

* Use 'venv' independent path

* Call script by dotted path instead of 'source' call

* Add Travis CI script

* Rename variable: 'exec_prefix' -> 'base_prefix'

* Add AppVeyor script

* Remove Rust test

* Complete shell script mode

* Complete path to powershell script

* Use 'pushd'/'popd' instead of 'cd'

* Complete powershell script

* Complete shell script

* Fix setup

* Use 'tox-venv' plugin for 'venv' stdlib module support

* Remove additional 'venv' testing

* Use global environment instead of calling 'set'

* Use 'tox' for AppVeyor, extract commands into 'setup' & 'test' scripts

* Add updating of 'pip' & 'setuptools'

* Add moving in/back from examples directories

* Complete 'pip'/'setuptools' updating

* Complete requirements

* Complete 'word-count' example configuration

* Simplify 'setup' script

* Complete 'rustapi_module' example tests

* Revert formatting

* Complete examples configuration

* Remove redundant annotations

* Add entry in changelog
2019-05-12 22:20:17 +09:00
kngwyu 803f18e61d Change Python::run to return PyResult<()> 2019-05-08 15:49:24 +09:00
konstin 5a63bdd964
Merge branch 'master' into pymethod-with-lifetime 2019-04-28 11:08:36 +02:00
Maarten de Vries 556e7ba029 Add marshal module to CHANGELOG.md 2019-04-26 13:13:51 +02:00
kngwyu cf689840ef Allow lifetime in pymethods 2019-04-26 14:28:29 +09:00
Yuji Kanagawa 60cd0d09c4
Merge pull request #419 from kngwyu/pyclass-regression
Allow slf: PyRef<Self>/PyRefMut<Self> in pymethods
2019-04-24 14:10:28 +09:00
konstin 7149a1fecb
Bump to 0.7.0-alpha.1 (#457) 2019-04-23 18:55:35 +02:00
kngwyu c7d6c48e68 Add changelog entry about `slf: PyRef` 2019-04-23 23:16:09 +09:00
Yuji Kanagawa fb8d3605d1
Merge pull request #449 from birkenfeld/unwrapped_prop_types
Allow omitting PyResult wrapping in property get/set methods
2019-04-22 12:00:42 +09:00
Georg Brandl 117f6eb47d Allow omitting PyResult wrapping in property get/set methods
fixes #443
2019-04-17 22:29:12 +02:00