Commit Graph

592 Commits

Author SHA1 Message Date
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
Georg Brandl 527da127f3 Make Py(Frozen)Set::new return PyResult<&Py(Frozen)Set>
fixes #437
2019-04-17 12:17:58 +02:00
Martin Larralde e6ca87d5dc Update `CHANGELOG.md` with latest bugfixes 2019-04-14 01:56:11 +02:00
Owez 303dc22831
Update CHANGELOG.md 2019-04-09 11:02:19 +01:00
Martin Larralde 72003ec37a Add entry to `CHANGELOG.md` 2019-04-04 09:47:21 +02:00
Martin Larralde 2c82a03170 Add entry to `CHANGELOG.md` and fix typo 2019-03-31 05:29:20 +02:00
konstin 9a9b519bcb Mark PyTypeObject as unsafe 2019-03-30 20:25:47 +01:00
konstin 3f27647b1b Bump to 0.6.0 2019-03-28 12:49:59 +01:00
konstin 421b26bcef
Merge pull request #406 from Alexander-N/changelog
Fix markdown links in CHANGELOG.md
2019-03-19 21:03:10 +01:00
Alexander Niederbühl 484ceb43e1 Fix markdown links in CHANGELOG.md 2019-03-19 18:42:17 +01:00
konstin 59a9d4fd9f
Merge branch 'master' into pyany 2019-03-18 01:00:26 +01:00
Alexander Niederbühl dd8e6211d5 Update CHANGELOG.md 2019-03-17 20:39:51 +01:00
kngwyu 2db0612b6e Add a note about PyAny in CHANGELOG 2019-03-05 13:15:34 +09:00
konstin ad590bd158 Some api improvements 2019-02-23 18:01:22 +01:00
konstin 61e449b10e Update Changelog 2019-02-19 22:30:22 +01:00
konstin d02f7c3aa5 Big proc macro refactoring
* Removed a lot of clutter, unified some code
 * Started using syn::parse::Parse for pyfunction attributes 
 * No more newlines between imports
 * Renamed `#[prop(get, set)]` to `#[pyo3(get, set)]`
 * `#[pyfunction]` now supports the same arguments as `#[pyfn()]`
 * Some macros now emit proper spanned errors instead of panics.
2019-02-18 20:07:56 +01:00
konstin 6cb098ee12 Replace py.init_[ref|mut] with Py[Ref|Mut]::new 2019-02-13 21:52:21 +01:00
konstin 1a489d2829 Make the init methods use a value instead of a function 2019-02-13 13:59:47 +01:00
konstin c13f0708a4 Replace IntoPyTuple with IntoPy<Py<PyTuple>> 2019-02-12 22:58:23 +01:00
konstin 936f0153e8 Migrate to rust 2018 2019-02-01 14:23:29 +01:00
konstin 0deaee01ad Bump to 0.6.0-alpha.1 and update changelog from 0.5.3 2019-01-04 11:53:46 +01:00
konstin 9102f2e364 Refactor the exception macros
* Renamed `py_exception` to `create_exception`
  * The split up of the macros makes it possible to create exception structs with bodies to mimic python exceptions' members
  * Used `Once` to fix a (theoretical) race condition with the is_null check
2018-11-27 23:07:15 +01:00
konstin de2108d719 Update changelog 2018-11-26 00:16:47 +01:00
konstin ece59c92f0 Update changelog 2018-11-24 13:17:42 +01:00
konstin 9c8c5a6063 Rename #[pymodinit] to #[pymodule] 2018-11-15 19:43:29 +01:00
konstin 863ffb161f Add wrap_module macro 2018-11-15 19:43:29 +01:00
konstin 6cec1c39cc Update changelog 2018-11-12 15:11:03 +01:00
konstin d2ba436d6d Remove the unnecessary type parameter PyObjectAlloc 2018-11-12 14:37:06 +01:00
konstin c77049541a Fix CI
black requires 3.6+ to be installed
2018-11-11 18:13:33 +01:00
konstin cadd0fb50e Release 0.5.0 2018-11-11 12:26:43 +01:00
konstin 234e2c6998 Release 0.5.0-alpha.3 to fix #256 2018-11-02 16:34:40 +01:00
konstin 3b63cc9178 v0.5.0-alpha.2 2018-10-29 17:36:06 +01:00
konstin 5100676497 Splitted PyTypeCreate of PyTypeObject to remove specialization 2018-10-03 22:12:22 +02:00
konstin 71c584a110 De-specialize ToBorrowedObject 2018-10-03 21:04:49 +02:00
ijl 851d2207c0 Simplify PyString, PyBytes, PyUnicode
PyStringData comments mention wanting to receive interpreter-
specific unicode types. I tried implementing this, but it's
more complex and slower to call libpython to fill a buffer
of u32 or such and convert that in Rust using widestring.

This implementation receives UTF-8 from PyUnicode_AsUTF8AndSize()
in python3 and PyUnicode_AsUTF8String() in python2. PyStringData
is removed as unnecessary.

The data() method on PyString, PyBytes, and PyUnicode is
replaced with as_bytes().

The python2 API changes improve the performance of
extracting unicode strings.
2018-09-28 21:47:44 +00:00
Paul Ganssle 106ba340f7
Add datetime to changelog
Document that datetime bindings have been added, plus one minor typo
fix.
2018-09-27 09:20:11 -04:00
ijl 28bc3cf1e6 PyDict::from_sequence() 2018-09-25 14:19:23 +00:00
ijl 868e28d5ad Fix segfault on calling unknown method 2018-09-24 02:49:52 +00:00
konstin 302c099a76 Big refactoring to shrink the prelude 2018-09-21 23:34:28 +02:00
konstin ddc6313e74 `#[pyclass]` objects can now be returned from rust functions 2018-09-06 18:04:13 +02:00
konstin 0101dc8136 Two default fn less 2018-08-31 21:11:08 +02:00
konstin 7c0379b13a Remove many specialization uses
From over a hundret "default fn" uses down to 17
2018-08-25 20:48:17 +02:00
konstin 771d59b913 Fix another bunch of clippy lints 2018-08-21 23:51:13 +02:00
konstin 82129c70b4 Added an explenation that the GIL can temporarily be released even while holding a GILGuard 2018-08-20 22:56:24 +02:00
konstin db4a2d9017 Get rid of the pyobject_extract macro 2018-08-20 22:53:43 +02:00
konstin 9cadbd11de v0.4.1 2018-08-20 14:34:34 +02:00
konstin b12b65cfae Cleanup 2018-08-19 20:06:47 +02:00
konstin b7dc0ad695 v0.4.0 2018-07-30 23:10:50 +02:00
konstin fe8a719ee1 Rustfmt all the things ✔️ 2018-07-30 23:05:10 +02:00
konstin 83db765889 Refactoring 2018-07-30 22:56:25 +02:00
konstin 2627fa8a08 0.3.2 2018-07-22 21:36:18 +02:00
konstin 7d4381fc5d Fixed scoping bug in pyobject_native_type that would break rust-numpy 2018-07-18 14:06:17 +02:00
konstin d59bebcc38 Upgrade from proc_macro to use_extern_macros 2018-07-18 13:08:05 +02:00
konstin dbd74401eb Rename the `base` option in the `pyclass` macro to `extends`
"extends" is intuitive for people with java or ES6 experience, and it also aligns pyo3 with
wasm-bindgen (see https://github.com/rustwasm/rfcs/pull/2)
2018-07-15 12:08:20 +02:00
konstin fe931a594f #[pymodinit] now uses the function name as default module name 2018-07-10 00:13:02 +02:00
konstin f6224ca0bc Prepare for 0.3.0 release 2018-07-08 23:41:18 +02:00
konstin 60d1565a8f Always clone on in getters
Since copy implies clone, this doesn't  code.
2018-06-12 17:47:24 +02:00
konstin c9db4f0da2 Some cleanup and housekeeping 2018-05-30 15:03:31 +02:00
Nikolay Kim 45361c3fc8 cleanup 2017-05-12 22:25:40 -07:00
Daniel Grunwald a6e1133ac4 Update CHANGELOG.md 2017-01-27 22:38:33 +01:00
Daniel Grunwald 3b0ec638b0 Create CHANGELOG.md 2017-01-21 17:39:58 +01:00