Commit graph

1189 commits

Author SHA1 Message Date
David Hewitt b1a37afa8c Fix definition of _PyLong_AsByteArray 2020-07-09 16:38:01 +01:00
Noam Shalom Kleinburd 8502759bd3 Test conversion of objects implementing __index__ to Rust BigInts. 2020-07-09 08:42:34 +01:00
Noam Shalom Kleinburd 33c328b201 Use the result of __index__ when converting Python objects to Rust BigInts. 2020-07-09 08:42:34 +01:00
Yuji Kanagawa c00080e27f
Merge pull request #1020 from PyO3/to-str
Remove PyString::as_bytes since it cannot return raw bytes
2020-07-08 15:05:58 +09:00
kngwyu 581e6e0924 Remove register_gil 2020-07-08 13:36:00 +09:00
kngwyu 7849b74dbf Remove PyString::as_bytes since it cannot return raw bytes 2020-07-06 21:38:31 +09:00
David Hewitt a5c1c9ade9 Update FFI definitions for pylifecycle.h 2020-07-04 15:03:42 +01:00
kngwyu 6cbe9ff30d Bump version to 0.11.1 2020-06-30 14:53:55 +09:00
kngwyu d76fe7835a Introduce #[pyclass(unsendable)] 2020-06-30 12:30:17 +09:00
kngwyu fd94a0d55c Bump version to 0.11.0 2020-06-27 23:59:44 +09:00
kngwyu 016800ba4d Use travis's pypy binary instead of anaconda 2020-06-27 19:45:31 +09:00
kngwyu 7ce0c36b2f Ensure GILPool don't panic even after thread_locals are destructed 2020-06-27 15:18:10 +09:00
kngwyu a78a832431 Refactor around the nightly feature 2020-06-26 19:29:37 +09:00
Yuji Kanagawa e35622b941
Merge pull request #997 from davidhewitt/pyproto-next-return
Add __next__ return
2020-06-24 23:16:35 +09:00
scalexm f49478619f Re-enable recursive class attributes
Use some kind of two-stage initialization as described in #975, by
being very cautious about when to allow the GIL to be released.
2020-06-23 22:40:29 +02:00
David Hewitt 9f9137c6e4 Add ability to return from __next__ / __anext__ 2020-06-23 15:26:28 +01:00
David Hewitt 0c59b05e1f
Merge pull request #996 from davidhewitt/pyproto-simplifications
Refactor `#[pyproto]` Result types
2020-06-23 11:49:39 +01:00
David Hewitt c7a4b4770f Refactor #[pyproto] Result types 2020-06-23 11:08:36 +01:00
Yuji Kanagawa f757c99dac
Merge pull request #994 from scalexm/ptr
`LazyStaticType::get_or_init` returns an `*mut` instead of a `&` ref
2020-06-23 10:07:43 +09:00
Yuji Kanagawa 1012bd1269
Merge pull request #992 from kngwyu/expose-apis
Expose some APIs for rust-numpy
2020-06-23 09:43:51 +09:00
scalexm 863c0001e1 LazyStaticType::get_or_init returns an *mut instead of a & ref 2020-06-22 22:37:11 +02:00
David Hewitt cc190c9ccd Remove IntoPyResult 2020-06-22 17:19:00 +01:00
kngwyu 2caf5b1c10 Expose some APIs for rust-numpy 2020-06-23 01:11:43 +09:00
kngwyu f053bc3881 Fix dealloc implementation to collectly use subtype's tp_free 2020-06-22 10:58:00 +09:00
kngwyu b70ee9a5ad Use subclass correctly in tp_new 2020-06-22 01:38:13 +09:00
kngwyu 767bf8901c Do not use PyObject_RichCompareBool to detect invalid comparison 2020-06-21 16:58:34 +09:00
Yuji Kanagawa 7075827a03
Merge pull request #969 from PyO3/poc-stable-rust
Stable Rust
2020-06-21 16:54:59 +09:00
Yohei Tamura b84496a4d9 fix api comment 2020-06-20 12:07:29 +09:00
David Hewitt a1dbfa8c8c Add pyo3::once_cell::GILOnceCell 2020-06-18 18:53:32 +01:00
kngwyu 654ab4c819 Enable tests for --features nighly on travis 2020-06-18 18:16:01 +09:00
konstin 3180e5cc06 POC stable rust (2 tests failing) 2020-06-18 17:21:09 +09:00
Yuji Kanagawa a044f3c322
Merge branch 'master' into slot-provider 2020-06-18 15:49:56 +09:00
Yuji Kanagawa 6ea834526b
Merge pull request #976 from davidhewitt/prefer-py
Add PyClass borrow methods to Py
2020-06-18 15:48:36 +09:00
David Hewitt 925986c706 Add PyCell::borrow shortcuts to Py 2020-06-17 08:58:32 +01:00
kngwyu fc3fa708b0 Add more comments for #[pyproto] related parts 2020-06-17 13:20:50 +09:00
kngwyu 2a69367888 Mark protocols setters as doc(hidden) 2020-06-17 02:19:02 +09:00
kngwyu f7fa008159 Use Relaxed ordering since setters are called by a single thread 2020-06-17 02:17:59 +09:00
kngwyu 0440b8df81 Fix AsPyRef example 2020-06-15 18:07:21 +09:00
Nateckert 4f8c2e767b
Doc trait exposition (#964)
Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2020-06-15 09:58:37 +01:00
kngwyu 2e1ed2c3c8 Descr get/set now take receiver 2020-06-15 13:43:46 +09:00
David Hewitt a85d157111 Cleanups to ensure GIL-safety of Py<T> and PyObject methods 2020-06-14 16:37:34 +01:00
kngwyu 8c4162dfeb Async methods now takes Receiver 2020-06-14 22:43:07 +09:00
Yuji Kanagawa f2f0ccd9e1
Merge pull request #974 from kngwyu/doc-comment-for-py
Revert soft-duplicated for Py::new
2020-06-13 19:38:55 +09:00
Yuji Kanagawa bbdca6b0bd
Merge pull request #967 from davidhewitt/bytearray-as-bytes
Add accessor methods to `PyByteArray`
2020-06-13 16:53:22 +09:00
kngwyu 1dc77d5a29 Revert soft-duplicated for Py::new 2020-06-13 16:49:25 +09:00
kngwyu f32277163a Move nb_bool under PyObjectProtocol again 2020-06-13 15:25:04 +09:00
kngwyu ac2c51c774 Fix typo and revert unintended changes 2020-06-13 15:25:04 +09:00
kngwyu 05effe26f1 Avoid function definition in setters for readability 2020-06-13 15:25:04 +09:00
kngwyu d678093509 Remove specialization from async/sequence methods 2020-06-13 15:25:04 +09:00
kngwyu 0d082961aa Remove specialization from gc/mapping/number protocols 2020-06-13 15:25:03 +09:00
kngwyu 7967874177 Remove specialization from basic/buffer/descr/iter protocols 2020-06-13 15:24:56 +09:00
David Hewitt 8a85feca97 Change return type of PyTuple::slice to &[&PyAny] 2020-06-12 05:21:27 +01:00
David Hewitt 21d365f7d4 Add accessor methods to PyByteArray 2020-06-12 05:01:09 +01:00
Yuji Kanagawa 7a7271319c
Merge pull request #966 from davidhewitt/pyclass-send
Require Send for #[pyclass] (no compilefail test)
2020-06-09 19:25:54 +09:00
David Hewitt bd7869002f
Tidy up docs for from_borrowed_ptr methods
The release pool doesn't exist for borrowed objects any more, so just tidied these docs up.
2020-06-09 08:45:58 +01:00
David 33617bfffc Require Send for #[pyclass] 2020-06-08 02:06:15 +01:00
Alexander Niederbühl 75d44ca296 Remove getting started chapter from user guide
Since it's exactly the same content as in the README.
2020-06-07 00:26:17 +02:00
Yuji Kanagawa d674b5ff34
Merge pull request #952 from kngwyu/typed-pybuffer
Typed PyBuffer
2020-06-05 23:08:07 +09:00
Alexander Niederbühl bcf48c0bd2 Fix clippy lints 2020-06-05 13:53:01 +02:00
kngwyu 688021315e Typed PyBuffer 2020-06-04 22:03:53 +09:00
kngwyu 69efb0980f Rename PyMethodsImpl -> PyMethods 2020-06-03 13:01:37 +09:00
Mara Bos febccbf6e7 Call Py_Finalize at exit using libc::atexit.
This makes sure buffers are flushed, threads are joined, etc. when
exiting the process.
2020-05-24 14:56:54 +02:00
David Hewitt 29c93c87c7 Remove GetPropertyValue 2020-05-21 18:06:24 +01:00
Yuji Kanagawa 89fe62eb80
Merge pull request #942 from davidhewitt/iterator-comment
Improve comment in iterator.rs
2020-05-21 16:21:01 +09:00
David Hewitt 01a74b2546 Improve comment in iterator.rs 2020-05-20 20:08:23 +01:00
Omer Katz 6f9048cd8f
Add FFI definition for PyObject_AsFileDescriptor (#938)
Add FFI definition for PyObject_AsFileDescriptor

Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2020-05-19 22:14:53 +01:00
Yuji Kanagawa 8e6398029d
Merge pull request #930 from davidhewitt/remove-managed-py-ref
Remove ManagedPyRef
2020-05-16 13:31:46 +09:00
David Hewitt 91d0dbceab Remove ManagedPyRef 2020-05-15 21:38:40 +01:00
kngwyu 837261c860 Bump version to 0.10.1 2020-05-14 20:57:51 +09:00
kngwyu 2954342f6c A tiny optimization in ReferencePool::update_counts 2020-05-14 20:03:14 +09:00
David Hewitt 509db11777 Use parking_lot::Mutex instead of spinlock 2020-05-14 09:14:30 +01:00
David Hewitt 3b1f720eb0 Fix deadlock in update_counts 2020-05-13 18:36:40 +01:00
Yuji Kanagawa 7e4d1c41e3
Bump version to 0.10.0 (#919)
* Bump version to 0.10.0

* Apply suggestions from code review

Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>

* Improve CHANGELOG completeness and messaging

* ObjectProtocol was in prelude

Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2020-05-13 13:24:36 +09:00
kngwyu 9f8b7cd9bf Revert #889 2020-05-12 00:10:49 +09:00
kngwyu 69dba08b01 Use PyMethodsImpl instead of *ProtocolImpl::methods 2020-05-11 20:08:21 +09:00
Yuji Kanagawa da22eecb5f
Merge pull request #897 from fusion-engineering-forks/macros-feature
Move macros into separate feature.
2020-05-11 11:01:46 +09:00
David Hewitt 86af474a95 Add Clone for PyObject / Py<T> 2020-05-10 12:01:18 +01:00
David Hewitt 8ffe8c58b3 Close soundness hole with acquire_gil 2020-05-09 10:41:41 +01:00
Mara Bos dab8c2e4e7 Move macros into separate feature.
It's enabled by default to avoid breakage, but this allows compiling
pyo3 with a lot less dependencies in case the macros are not needed.
2020-05-09 11:27:30 +02:00
Yuji Kanagawa d5eb8f0544
Merge pull request #911 from davidhewitt/remove-objectprotocol
Remove ObjectProtocol
2020-05-08 18:56:52 +09:00
David Hewitt a5ebef4b2e Remove ObjectProtocol; Add methods to PyAny and use Deref 2020-05-08 10:05:19 +01:00
Yuji Kanagawa 027c90c223
Merge pull request #913 from davidhewitt/gil_state_list
Fix issue with PyObject drop and allow_threads
2020-05-08 12:59:36 +09:00
Yuji Kanagawa 8aeae6c8ac
Merge pull request #905 from scalexm/master
Add `#[classattr]` methods to define Python class attributes
2020-05-08 11:24:42 +09:00
scalexm 7b5a076680 Add #[classattr] methods to define Python class attributes 2020-05-07 21:23:47 +02:00
David Hewitt bb571930f1 Temporarily set GIL_COUNT to 0 during allow_threads 2020-05-07 16:34:38 +01:00
David Hewitt b083e0babf Make allow_threads safe with panics 2020-05-07 15:29:47 +01:00
kngwyu 11c1c5e6a1 Use -Cpanic=abort for correct coverage 2020-05-06 21:20:00 +09:00
Yuji Kanagawa 626268d28a
Merge pull request #899 from fusion-engineering-forks/mutex
Simplify ReleasePool, remove parking_lot dependency.
2020-05-05 18:09:20 +09:00
David Hewitt 9380bfde6f Add catch_unwind! macro to prevent panics crossing ffi boundaries 2020-05-05 08:17:06 +01:00
Mara Bos 0407288758 Simplify ReleasePool, remove parking_lot dependency.
Replaces the parking_lot Mutex by a simple AtomicBool spinlock,
and simplifies the ReleasePool to contain one Vec instead of pointers to
two Vecs.
2020-05-05 08:08:07 +02:00
Yuji Kanagawa c4f36535d8
Merge pull request #895 from fusion-engineering-forks/tryfrom
Replace num-traits dependency by std's TryFrom.
2020-05-05 12:26:35 +09:00
David Hewitt 9a2d908342 Simplify callback code using callback_body! macro 2020-05-05 00:27:50 +01:00
Mara Bos 39b41b3dc7 Replace num-traits dependency by std's TryFrom. 2020-05-04 15:50:07 +02:00
Yuji Kanagawa 0f07cf8db9
Merge pull request #886 from fusion-engineering-forks/dir
Add dir() to ObjectProtocol.
2020-05-04 18:07:27 +09:00
Mara Bos d32c3c0b37 Add test for dir(). 2020-05-04 09:57:46 +02:00
Yuji Kanagawa 879b0b58ac
Merge pull request #890 from davidhewitt/no-borrowed-objects
Remove unsound return of borrowed objects
2020-05-04 12:18:52 +09:00
David Hewitt 6f74fe6b38 Allow borrowed object for PyTuple::get_item.
As per feedback on #890
2020-05-03 18:48:01 +01:00
Mara Bos 49d31a0134 Add dir() to ObjectProtocol. 2020-05-03 14:32:43 +02:00
Yuji Kanagawa e9bec070e1
Merge pull request #887 from kngwyu/new-nativetypes
New Native Types and Lighter GILPool
2020-05-03 12:10:43 +09:00
David Hewitt b7ecec7812 Remove unsound return of borrowed objects 2020-05-02 23:35:26 +01:00