Commit Graph

507 Commits

Author SHA1 Message Date
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
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 7967874177 Remove specialization from basic/buffer/descr/iter protocols 2020-06-13 15:24:56 +09: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 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
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
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
David Hewitt a5ebef4b2e Remove ObjectProtocol; Add methods to PyAny and use Deref 2020-05-08 10:05:19 +01:00
David Hewitt 9380bfde6f Add catch_unwind! macro to prevent panics crossing ffi boundaries 2020-05-05 08:17:06 +01:00
David Hewitt 9a2d908342 Simplify callback code using callback_body! macro 2020-05-05 00:27:50 +01:00
kngwyu 2cd466dc46 Bound 'py lifetime by GILPool when it's possible 2020-04-12 23:55:23 +09:00
Yuji Kanagawa 5add8d1dee
Merge branch 'master' into merge-0.9.2 2020-04-09 17:17:52 +09:00
kngwyu c83d88ba8d Bump version to 0.9.2 2020-04-09 13:00:13 +09:00
David Hewitt d8effb24e8 Refactor CallbackConverter code
Now shorter and allows use of the ? operator inside callback code
2020-04-08 21:55:11 +01:00
kngwyu 4759358acb Bump version to 0.9.1 2020-03-23 18:55:24 +09:00
kngwyu 89e5a654ad Bump version to 0.9.0 2020-03-19 13:48:00 +09:00
kngwyu 02ee7a5afc Expose PyAny to lib.rs and prelude 2020-03-18 13:38:18 +09:00
Georg Brandl 77b1ae3137 lib: overhaul docstrings 2020-03-17 15:16:30 +01:00
Georg Brandl a7a2ccb5ff
Apply suggestions from code review 2020-03-17 10:54:51 +01:00
Georg Brandl 4da5dbcd01
Apply suggestions from code review
Co-Authored-By: Yuji Kanagawa <yuji.kngw.80s.revive@gmail.com>
2020-03-17 10:54:05 +01:00
Georg Brandl e649e58674 docstrings: fixes, also point to the new guide chapter 2020-03-17 10:04:29 +01:00
kngwyu ded83027fa Write migration guide for 0.9 2020-03-09 14:11:14 +09:00
kngwyu 2fd2185052 Merge branch 'master' into pycell 2020-02-17 00:07:15 +09:00
kngwyu 8f8b42591a Fix PySelf and AsPyRef 2020-02-16 23:54:55 +09:00
kngwyu da4ed398bb Fix PyCell to share BorrowFlag with parents 2020-02-15 18:13:39 +09:00
kngwyu c43fb9fcdf Prototype Implementation of RefCell-like PyCell 2020-02-10 16:13:15 +09:00
kngwyu 5d4e7374e9 Introduce PyDownCastImpl and Change PyTryFrom and FromPyPointer 2020-02-09 16:35:52 +09:00
David Hewitt 20c6c2d463 Fix clippy warnings 2020-02-08 19:25:52 +00:00
kngwyu a2408cacbb Rename PyClassShell with PyCell 2020-02-08 15:05:13 +09:00
David Hewitt fdf407e045 FromPyObject for #[pyclass] with T: Clone 2020-01-24 08:57:28 +00:00
kngwyu 56f68a55cd Bump version to 0.9.0-alpha.1 2020-01-16 20:05:44 +09:00
kngwyu c57177a169 Refine tests and documents around pyclass.rs 2020-01-08 22:44:50 +09:00
kngwyu 451de182cb Merge branch 'master' into pyclass-new-layout 2020-01-08 17:16:33 +09:00
kngwyu f26e07cfd6 Replace IntoInitializer<T> with Into<PyClassInitializer<T>> 2020-01-07 13:08:41 +09:00
kngwyu d22b03edde Bump version to 0.8.5 2020-01-05 16:39:18 +09:00
kngwyu 18e565fab5 New PyClassInitializer 2020-01-05 16:01:05 +09:00
kngwyu 8f8785d7c2 Merge branch 'master' into pyclass-new-layout 2019-12-29 23:51:51 +09:00
Alexander Niederbühl 3fae391a3c Ignore missing `# Safety` section in ffi module 2019-12-28 03:54:41 +01:00
kngwyu 58590393c5 Fix accidently changed file permission 2019-12-24 12:27:22 +09:00
kngwyu 6b84401126 Make it enable to safely inherit native types 2019-12-21 23:28:55 +09:00
kngwyu 8175d6f36a Merge branch 'master' into pyclass-new-layout 2019-12-19 16:12:45 +09:00
kngwyu b86de9376d Introduce PyClassInitializer 2019-12-15 21:04:36 +09:00
kngwyu d8a4ecb476 Bump version to 0.8.4 2019-12-14 15:20:55 +09:00
kngwyu bdb66afe0a Make PyClassShell have dict&weakref 2019-12-08 17:18:25 +09:00
kngwyu 4b5fa7e977 Introduce PyClass trait and PyClassShell 2019-12-07 17:56:49 +09:00
kngwyu 935adaa5d5 Bump version to 0.8.3 2019-11-23 17:09:10 +09:00
kngwyu 7977fe68e2 Use Unsendable alias instead of Phantomdata<Rc<()>> 2019-10-27 23:12:59 +09:00
kngwyu 14d2196ba0 Bump version to 0.8.2 2019-10-26 22:47:19 +09:00
kngwyu d019fe814c Bump version to 0.8.1 2019-10-08 01:52:06 +09:00
kngwyu a344999526 [DOC] Add Python from Rust section in the guide 2019-09-23 21:44:42 +09:00
Yuji Kanagawa aaa28a3bd0
Merge pull request #594 from PyO3/pyo3-pack-to-maturin
Replace pyo3-pack with maturin
2019-09-07 11:49:09 +09:00
Alexander Niederbühl 68c3208d35 Move files from ffi3 into ffi
Since Python 2 is no longer supported, one folder should be enough.
2019-09-07 00:50:47 +02:00
konstin a3cde076f4 Replace pyo3-pack with maturin 2019-09-06 01:12:37 +02:00
konstin a3e41cc819 Release 0.8.0 2019-09-05 13:18:50 +02:00
konstin 30e82a3018 Replace IntoPyObject with IntoPy<PyObject> 2019-08-24 19:23:28 +02:00
kngwyu 41f31e85fd Replace mashup with paste 2019-08-04 23:50:10 +09:00
kngwyu 503ec1a061 Use unindent crate instead of _indoc_runtime 2019-06-15 01:10:18 +09:00
kngwyu f642dbccb2 Refactor py_run! 2019-06-14 18:58:00 +09:00
kngwyu 0f9a3b1194 Expose py_run macro 2019-06-13 18:18:06 +09:00
konstin 0279b3d69f Release 0.7.0 2019-05-26 17:27:14 +09:00
konstin c6a5c054e1
Merge pull request #469 from PyO3/remove_doc_comment
Remove doc-comment
2019-04-28 18:26:51 +02:00
konstin cd15719765 Remove doc-comment 2019-04-28 10:36:32 +02:00
Maarten de Vries 35168883b2 Add safe marshal module wrapping unsafe ffi::PyMarhshal_*. 2019-04-26 10:10:50 +02:00
Alexander Niederbühl 1d92c24db8 Add pypy.md to doctests
At the moment there are no code snippets, but all files in the guide
should be included.
2019-04-24 22:44:47 +02: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
Alexander Niederbühl faa3feda3f Merge branch 'master' into doctest 2019-04-23 21:58:09 +02:00
konstin 7149a1fecb
Bump to 0.7.0-alpha.1 (#457) 2019-04-23 18:55:35 +02:00
kngwyu b2e01066f0 Introduce FromPyPointer for slf: PyRef/PyRefMut 2019-04-23 23:16:09 +09:00
Alexander Niederbühl 5858823e83 Test readme and user guide with doc-comment
Also rename some files for consistency.
2019-04-19 22:38:11 +02:00
konstin 6d80ee0679 Properly scope libc to fix #442
Apparently we can't add a test for that because the test crates have libc
in scope
2019-04-17 19:08:55 +02:00
ijl 2bb0d05a30 Drop support for python2 2019-03-29 12:37:26 +00:00
Miles Granger 711155d7ad Update tests & docs with IntoPyDict::into_py_dict(py) 2019-03-20 20:04:00 +01:00
konstin 09883574e5 Remove cstr macro 2019-03-18 11:01:55 +01:00
kngwyu 86d239e445 Rename ToPyPointer with AsPyPointer 2019-02-24 16:20:04 +09:00
konstin ad590bd158 Some api improvements 2019-02-23 18:01:22 +01:00
konstin 0cd72ac213 Bump to 0.6.0-alpha.4 2019-02-20 11:30:09 +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 c13f0708a4 Replace IntoPyTuple with IntoPy<Py<PyTuple>> 2019-02-12 22:58:23 +01:00
kngwyu 22687c3712 Modify PyIterProtocol to take PyRefMut 2019-02-05 17:27:34 +09:00
konstin 56f2257e90 rust 2018 fixes 2019-02-01 16:23:34 +01:00
konstin 829f35af5b Migrate to rust 2018 2019-02-01 16:23:34 +01:00
konstin 0495ee52d3 ffi2 to rust 2018 2019-02-01 15:25:58 +01:00
konstin 936f0153e8 Migrate to rust 2018 2019-02-01 14:23:29 +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 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 aed0466915 s/PyObjectWithToken/PyObjectWithGIL/g 2018-11-12 15:10:53 +01:00
konstin 57afb51604 Remove PyToken completely; Fixes #94 2018-11-12 14:42:21 +01:00
konstin 569db5fb02 Add test with generator to PyIterator 2018-11-02 22:59:30 +01:00
konstin 8b27f1e412 Get ready for rust 2018 2018-10-31 11:43:21 +01:00
konstin 38651a1827 Add tox config for pyo3 itself 2018-10-09 18:49:54 +02:00
konstin 302c099a76 Big refactoring to shrink the prelude 2018-09-21 23:34:28 +02:00
kngwyu 7ea875fc49 Implement Add/Sub/Mul/Div for &PyComplex 2018-09-21 12:48:42 +09:00
konstin 2904291b9e Better code generation 2018-09-17 19:48:22 +02:00
konstin 10ef6cd111 Fix cfg on PyEval_InitThread to fix #219 2018-09-11 22:38:31 +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
Paul Ganssle a271ba9ed9
Use unified implementation for ffi::datetime
In the future we can make ffi::object, ffi::pycapsule, etc as
crate-public, but importing the specific symbols is a light touch way to
do this.
2018-08-21 18:33:32 -04:00
Paul Ganssle ee658de1fb
Run rustfmt after datetime changes
Most of the datetime related changes were made before pyo3 switched to
using rustfmt, so I ran rustfmt only on the final commit to make it
easier to rewrite history as necessary (for fixups and whatnot).
2018-08-21 14:29:36 -04:00
Paul Ganssle 496b879525
Add objects/datetime.rs 2018-08-21 14:29:33 -04:00
konstin 991a8b94d2 More nightly fixes 2018-08-19 20:42:17 +02:00
konstin b12b65cfae Cleanup 2018-08-19 20:06:47 +02:00
konstin fe8a719ee1 Rustfmt all the things ✔️ 2018-07-30 23:05:10 +02:00
konstin ff70f45071 (Hopefully) get travis to build the guide for tags 2018-07-18 23:28:14 +02:00
konstin 3adcac6e61 Replace concat_idents with mashup 2018-07-18 23:17:05 +02:00
konstin d59bebcc38 Upgrade from proc_macro to use_extern_macros 2018-07-18 13:08:05 +02:00
konstin fe931a594f #[pymodinit] now uses the function name as default module name 2018-07-10 00:13:02 +02:00
konstin 4013d40897 Add `py` prefix to the proc macros and move them into the root module
This is important because `proc_macro_path_invoc` isn't going to be stabilized soon.
2018-07-08 23:33:48 +02:00
konstin 68c14a5707 Merge branch 'master' of https://github.com/PyO3/pyo3 2018-07-03 21:55:43 +02:00
konstin 43eb5fa490 Rename prepare_pyo3_library to init_once 2018-07-03 21:12:57 +02:00
konstin 6645708e4f Get rid of #[py*] methods 2018-07-03 20:42:02 +02:00
kngwyu 70e1879d59 Make python pub 2018-07-02 00:06:01 +09:00
konstin 858a124374 Merge master 2018-05-05 15:50:04 +02:00
konstin 15204bab56 Better way to add functions to modules 2018-05-02 19:26:54 +02:00
konstin 0880ac166c Merge master 2018-05-01 20:41:35 +02:00
konstin d0c42dfcc1 Fix compilation on nightly 2018-05-01 15:44:38 +02:00
konstin 6113428746 Allow defining functions outside of the module declarations
This commit consists of
 * a proc macro to convert rust functions into python functions (`#[function]`),
 * a macro to register a function in a module (`add_function_to_module!`)
 * Documenting both the old and the new way in the book
2018-04-30 23:17:09 +02:00
konstin 45bb09b3e8 Relax return type requirements
Allows returning essentially arbitrary types by wrapping them into a PyResult. This is done with a conversion trait that specializes for PyResult.
2018-04-06 17:22:09 +02:00
Nikolay Kim b7a8d25338 const fns that we use are stable now 2018-02-21 09:23:58 -08:00
Nikolay Kim b738c1a04b clippy warnings 2018-01-19 10:02:36 -08:00
Nikolay Kim 324a6b2697 drop RefFromPyObject; allow mut refs #106 2018-01-19 09:04:42 -08:00
dkao1978 eb9050ab90 Add documentation for compiling on MacOS (#89)
* Update README.md

* Update overview.md

* Update lib.rs

* Update README.md

* Add links
2017-10-22 11:17:35 +08:00
messense 703883687a
Add features to tests 2017-09-19 20:03:03 +08:00
messense 9da1247484
Fix build on rustc nightly-2017-09-16
Use forked version of spin-rs for now.

Closes #79
2017-09-19 19:51:25 +08:00
Nikolay Kim ed8599cfd3 refactor __new__ method implementation 2017-08-08 00:27:33 -07:00
Nikolay Kim 130c33ec09 export IntoPyDictPointer 2017-08-03 15:55:23 -07:00
Nikolay Kim cd6558a19b Introduce IntoPyDictPointer similar to IntoPyTuple #69 2017-08-03 15:01:52 -07:00
Nikolay Kim c44e23f4b9 add prelude mod 2017-07-31 10:42:55 -07:00
Nikolay Kim 325070f6c9 refactor downcast process 2017-07-28 23:19:00 -07:00
Nikolay Kim a4fd878cb7 pyerr cleanups 2017-07-26 14:28:04 -07:00
Nikolay Kim e45eb6e878 rename ToPyErr to PyErrArguments 2017-07-26 10:47:17 -07:00
Nikolay Kim a120bbf15e Refactor implementation. Drop parameter from constructor 2017-07-26 01:11:00 -07:00
Nikolay Kim 2ee6419464 do not catch rust panics 2017-07-20 14:21:57 -07:00
Nikolay Kim fc1df289bd drop PyClone trait; doc cleanups 2017-07-18 10:13:50 -07:00
Nikolay Kim 4daac50781 remove associated_consts feature 2017-07-14 03:17:57 -07:00
Nikolay Kim 8eb5dc0667 use associated consts 2017-07-13 16:45:50 -07:00
Nikolay Kim ed31492d36 rename pointer mod to object 2017-07-13 13:05:50 -07:00
Nikolay Kim c1c4648add delay decref until gil available 2017-07-09 12:08:57 +06:00
Nikolay Kim 503e4221cc support &str as fn param 2017-06-24 15:28:53 -07:00
messense 4e836cb229
Don't reexport Py_hash_t and Py_ssize_t 2017-06-24 22:36:45 +08:00
messense 378fae9659
Hide argparse module in API docs 2017-06-24 22:30:46 +08:00
messense a5e3429d60
Remove unnecessary `ObjectProtocol` import 2017-06-24 22:29:35 +08:00
messense 0ba541e762
Add missing module level docs 2017-06-24 16:47:36 +08:00
Nikolay Kim cc56ded6bf fix python2 extension module initialization 2017-06-23 11:51:15 -07:00
Nikolay Kim 61f85c730e fix doc tests; fix unsued import warning 2017-06-23 10:38:04 -07:00
Nikolay Kim a58aa7b5e6 rename PyObject 2017-06-22 20:56:09 -07:00
Nikolay Kim cb969161c6 fix unchecked downcast; added objects pool 2017-06-22 10:26:07 -07:00
Nikolay Kim b9377849c8 rename modules 2017-06-22 01:16:22 -07:00
Nikolay Kim c48386affa stopping point 2017-06-22 01:04:37 -07:00
Nikolay Kim 7cf8e1ab80 modify PyDict 2017-06-21 14:08:16 -07:00
Nikolay Kim 96788bf192 more types 2017-06-21 13:10:40 -07:00
Nikolay Kim 08ddb3f14f other types 2017-06-21 12:33:21 -07:00
Nikolay Kim c4ba2b0f2e rename InstancePtr to AsPyRef 2017-06-20 14:22:49 -07:00
Nikolay Kim 40efa5c955 rename Ptr to Py 2017-06-19 23:57:34 -07:00
Nikolay Kim 7b5521fdb3 simplify instance ptr, droped #[py::ptr] annotation attr 2017-06-19 20:55:07 -07:00
Nikolay Kim b4deb673c7 refactor #[args()] attribute #40 2017-06-19 14:05:14 -07:00
Nikolay Kim 005c36548b add specialization to docs 2017-06-18 09:28:21 -07:00
messense 75d6684d25
Clarify Python module doc string 2017-06-18 23:15:10 +08:00
Nikolay Kim 60a965edc3 update link to example py extension 2017-06-15 14:30:11 -07:00
Nikolay Kim e85db971f9 fix module export functions 2017-06-15 14:20:30 -07:00
Nikolay Kim 0679fec859 update docs 2017-06-15 11:13:58 -07:00
Nikolay Kim ac0594a5b2 do not use pub pointers mod 2017-06-15 10:36:41 -07:00
Nikolay Kim 3bed79fe0b add clippy and doc to travis 2017-06-15 09:11:19 -07:00
Nikolay Kim 5bf6ce3864 added __unicode__ method to PyObjectProtocol 2017-06-15 07:48:57 -07:00
Nikolay Kim bd7a0feb8c merge master 2017-06-15 07:16:40 -07:00
messense b8b9daf67a
Enable doc test for src/lib.rs examples 2017-06-15 16:06:04 +08:00
Nikolay Kim d9bd485072 macro_use is not requires 2017-06-14 14:42:05 -07:00
Nikolay Kim 293569b6af remove import 2017-06-14 14:23:51 -07:00
Nikolay Kim 706477f139 replace py_fn! macro with pyfn attribute 2017-06-14 14:08:30 -07:00
Nikolay Kim 6204a06cbc update docstring 2017-06-11 23:54:24 -07:00
Nikolay Kim fdd9ac7ae9 various improvements 2017-06-11 18:30:56 -07:00
Nikolay Kim 805429e0f4 remove unneeded macro 2017-06-11 16:49:25 -07:00
Nikolay Kim 05d4a0a9a4 rename ffi to ffi3 2017-06-11 16:47:27 -07:00
Nikolay Kim 3b4d147219 initial impl for py2 2017-06-11 16:35:24 -07:00
messense cb68cd23a2 Fix some clippy warnings (#26) 2017-06-11 23:46:23 +08:00
Nikolay Kim c28a619efd add free list support 2017-06-09 14:27:37 -07:00
messense e12e98a7c1 Convert some std error types to PyErr (#22)
* Convert some std error types to PyErr

* Add ToPyErr trait
2017-06-08 09:40:30 +08:00
Nikolay Kim a584ce12e5 release py objects aftre use 2017-06-06 19:26:59 -07:00
Nikolay Kim 84f5578997 varios cleanups 2017-06-05 20:25:00 -07:00
Nikolay Kim a448aa54cc clone_ref return Self 2017-06-03 17:42:12 -07:00
Nikolay Kim 57cc139c81 drop Py pointer 2017-06-03 17:27:26 -07:00
Nikolay Kim b75160daf3 remove pyobject lifetime 2017-06-02 18:58:16 -07:00
Nikolay Kim 27bd365f5c cleanups 2017-06-02 09:23:48 -07:00
Nikolay Kim cbfdfa2d07 better naming 2017-06-01 15:06:48 -07:00
Nikolay Kim fc762288fe use From instead of as_object; fix type object 2017-06-01 13:34:46 -07:00
Nikolay Kim 9176dc4df1 consistent naming for pointers 2017-06-01 10:35:02 -07:00
Nikolay Kim 6834a18a5b add ptr support to class 2017-05-31 20:50:40 -07:00
Nikolay Kim 2f3ea202b3 add mirror ptr types for native py classes 2017-05-31 15:52:13 -07:00
Nikolay Kim 92bf7b9c05 rename pptr to PyObjectPtr 2017-05-31 01:08:39 -07:00
Nikolay Kim 5d25c7deea simplify Py and PyPtr objects 2017-05-30 18:57:36 -07:00
Nikolay Kim 3040ac12b9 refactor ToPyObject 2017-05-30 17:23:23 -07:00
Nikolay Kim b8913a3705 refactor IntoPyObject trait; rename pptr into pyptr, introduce pptr pointers 2017-05-30 16:29:13 -07:00
Nikolay Kim 61b8bd0695 fix ptr borrowing PyTuple::get_item 2017-05-29 18:36:44 -07:00
Nikolay Kim 51ac8c9c78 better gil token scope 2017-05-29 13:30:38 -07:00
Nikolay Kim ea8ccf190a special treatment for native python objects 2017-05-29 02:47:27 -07:00
Nikolay Kim 55d0d58734 added pptr pointer 2017-05-28 21:19:29 -07:00
Nikolay Kim 969cba2c16 remove Token 2017-05-28 08:57:34 -07:00
Nikolay Kim 6c87c9b77b introduce python token system 2017-05-27 22:45:48 -07:00
Nikolay Kim 6205be98b8 introduce PythonToken; cleanup number protocol 2017-05-27 10:49:38 -07:00
Nikolay Kim d165dbe4d4 fixed gil lifetime; pass py object into protocol methods 2017-05-26 14:43:28 -07:00
Nikolay Kim 0979653b98 various cleanups 2017-05-25 08:06:10 -07:00
Nikolay Kim f3176dacfc use pyptr for everything 2017-05-25 08:06:06 -07:00
Nikolay Kim d6fb90bdc2 stopping point 2017-05-25 07:58:25 -07:00
Nikolay Kim 56d93249ab pyptr 2017-05-25 07:58:25 -07:00
Nikolay Kim 1f2c927bd5 update buffer proto tests 2017-05-19 23:18:54 -07:00
Nikolay Kim 0c7293125c simplify class generation 2017-05-18 23:29:09 -07:00
Nikolay Kim 8b3c280450 fix optional arg generation 2017-05-18 11:15:06 -07:00
Nikolay Kim 04168ab86e added fn spec for args parsing 2017-05-18 00:05:49 -07:00
Nikolay Kim c9aefd7e5f drop py_class 2017-05-16 23:43:39 -07:00
Nikolay Kim 34e4d956f1 basic object customization interface 2017-05-16 16:54:27 -07:00
Nikolay Kim 521a91fbc2 remove unused imports 2017-05-16 14:18:31 -07:00
Nikolay Kim 5427a33c75 stopping point 2017-05-15 22:24:06 -07:00
Nikolay Kim f4feade487 add PyAsyncProtocol 2017-05-14 18:55:04 -07:00
Nikolay Kim 088d44f8d1 simplify ToPyObject trait 2017-05-14 14:42:56 -07:00
Nikolay Kim 3e20979f3f implement buffer protocol with proc macro 2017-05-14 12:52:30 -07:00
Nikolay Kim 03a3817878 update readme and travis 2017-05-12 23:01:54 -07:00
Nikolay Kim a95de027c1 update tests 2017-05-12 22:43:17 -07:00
Nikolay Kim 8a295793a0 include py3 ffi info into crate 2017-05-12 22:05:00 -07:00
Luthaf d615c319f6 Implement optional parameters for reference types 2017-01-26 21:35:16 +01:00
Daniel Grunwald 3152ef22f0 Expand on the buffer protocol.
When compiling with --feature nightly, we now use specialization to optimize extract::<Vec<PrimititeType>>() from an object implementing the buffer protocol.
2017-01-20 23:14:29 +01:00
Daniel Grunwald af8131f858 Initial attempt at the buffer protocol.
Does not yet provide a safe way of accessing the buffer contents.
2017-01-20 01:08:51 +01:00
Daniel Grunwald e2d7781433 Add "extension-module" feature to suppress linking pythonX.Y.so.
The symbols are instead kept unresolved, so that they can be used with
any compatible python interpreter, even if the target system uses a
statically linked python and lacks pythonX.Y.so altogether.
2016-12-17 21:17:11 +01:00
Daniel Grunwald 4cb29c14fa Remove hacks for compatibility with old rust versions. The new minimum required version is Rust 1.13.0.
This significantly reduces our #[cfg(feature="nightly")] usage.
2016-12-17 16:05:21 +01:00
Daniel Grunwald f6ed2bbae9 Fix #10: Windows support.
We keep the #[link] attributes in #[cfg_attr(windows)] so that we don't require a nightly Rust build on non-Windows platforms.
This can be simplified once RFC 1717 is available in a stable rust version.

This commit also increases the minimum Rust version to 1.13.
2016-12-17 15:46:52 +01:00
Daniel Grunwald 278c1aece8 Fix #56: PyModuleDef changed "m_slots" to "m_reload" in Python 3.5. 2016-12-10 13:03:51 +01:00
Samuel Cormier-Iijima d2b9533406 Use uppercase names for static variables to fix warnings 2016-11-11 21:50:18 -05:00
Daniel Grunwald 1129131501 Remove #[feature(unsafe_no_drop_flag)]: it's no longer necessary with the latest nightlies.
Warning: to use rust-cpython with --feature nightly, you now must use 'rustc 1.13.0-nightly (e9bc1bac8 2016-08-24)' or newer; or you'll get segfaults due to the drop flags.
Use of rust-cpython with stable rust is not affected.
2016-08-25 21:22:18 +02:00
Samuel Cormier-Iijima 305bc4324d Add support for overloading comparison operators with __richcompare__ 2016-06-06 16:08:48 -04:00
Daniel Grunwald 0222176836 #40: split ExtractPyObject into two traits:
* FromPyObject for all conversions that don't need to borrow temporaries
* RefFromPyObject for extracting references out of temporaries
  (currently only used for extracting `&str`)
2016-05-08 21:25:09 +02:00
Daniel Grunwald be0c1573aa py_class!: add support for __str__, __repr__, __unicode__ and __format__ 2016-05-05 07:31:14 +02:00
Daniel Grunwald 9aec3f33f1 We only need num-traits, not the full num crate. 2016-04-17 23:35:17 +02:00
Daniel Grunwald fffcf57834 Add support for __len__ special method. 2016-04-17 23:26:33 +02:00
Daniel Grunwald a14e3d2b77 Share macro code between tp_new and other class methods. 2016-04-17 18:04:58 +02:00
Daniel Grunwald 2e977a9c21 gc integration: __traverse__ method 2016-04-14 18:41:29 +02:00
Daniel Grunwald 271a44475d panic::recover -> panic::catch_unwind 2016-04-14 18:41:29 +02:00
Daniel Grunwald 337a90c2fb Reserve special method names
Some of these might work via the normal "instance method" functionality,
but we'll need testcases to be sure.
2016-03-12 19:08:51 +01:00
Daniel Grunwald cc81a01077 py_class!: add support for instance methods 2016-03-12 17:58:50 +01:00
Daniel Grunwald ab83b4f4a1 #14; Convert Rust panic to Python SystemError 2016-03-12 01:31:06 +01:00
Daniel Grunwald 309182cfe8 py_class!: Add support for "def __new__(cls)". 2016-03-12 00:06:39 +01:00
Daniel Grunwald 547879ef0f Remove rustobject (PyRustObject, TypeBuilder).
Add new py_class!() macro that generates a static type.
2016-03-09 01:07:50 +01:00
Daniel Grunwald 3af6e17841 WIP: big macro refactoring
* Introduce py_argparse_parse_plist!() to allow a more flexible
  param list syntax.
* py_fn!() syntax changed
* Remove py_method!() / py_class_method!() macros.
  These are of limited use when building dynamic types,
  and not useful for py_class!() static types.
2016-03-07 23:22:44 +01:00
Daniel Grunwald be682d848f WIP: generalize py_argparse!() macro 2016-03-06 13:33:57 +01:00
Daniel Grunwald acc5712536 Don't flatten the rustobject module + started implementing the py_class!() macro. 2016-03-06 06:29:43 +01:00
Daniel Grunwald d705620502 Add support for Rust stable.
All functions that depend on PyObject having the same memory layout
as *mut ffi::PyObject should now be hidden behind #[cfg(feature="nightly")].
2016-03-06 01:08:40 +01:00
Daniel Grunwald ad7f43efc7 Remove #![feature(optin_builtin_traits)] usage 2016-03-06 00:22:16 +01:00
Daniel Grunwald 7c90651157 Make use of nightly const_fn + shared features optional. 2016-03-06 00:03:17 +01:00