Commit graph

1922 commits

Author SHA1 Message Date
Alexander Niederbühl cc469afc38 Merge branch 'master' into gc-default 2019-07-14 20:42:57 +02:00
Alexander Niederbühl ec71dc63a0 Remove #[allow(unused_variables)] 2019-07-14 18:09:12 +02:00
Paul Ganssle e633ae25eb
Add changelog error for PR #532 2019-07-14 18:00:16 +02:00
Paul Ganssle ca07c48931
Add documentation for new PyGCProtocol behavior 2019-07-14 17:56:36 +02:00
Paul Ganssle 59ed277879
Enforce GC contract at compile time
PyGCProtocol must be implemented for anything registered as tracked by
the garbage collector. This modifies the `pyclass` macro to enforce this
at compile time.
2019-07-14 17:55:47 +02:00
Yuji Kanagawa 670b41c898
Merge pull request #530 from Alexander-N/gc-test
Implement PyGCProtocol in test class
2019-07-15 00:47:21 +09:00
Yuji Kanagawa 2d879bc853
Merge pull request #529 from kngwyu/getter-py
Allow py: Python as an argument of getter
2019-07-15 00:44:33 +09:00
Alexander Niederbühl 7c687a8d38 Remove default implementation for PyGCProtocol
Implementations for these methods should always be provided. See #531
2019-07-14 17:26:04 +02:00
Alexander Niederbühl 72339e5bf9 Implement PyGCProtocol in test class
For the garbage collection to work the PyGCProtocol has to be
implemented. Ideally it should not even get compiled if it doesn't since
a missing tp_traverse can produce a segfault.
2019-07-14 15:54:45 +02:00
kngwyu a6438ebb10 Handle a corner case in which a getter takes multiple Python 2019-07-14 14:35:50 +09:00
konstin 96a56fa9b8
Merge pull request #505 from PyO3/fix_getattr
Use existing fields and methods before calling custom __getattr__
2019-07-13 20:39:14 +02:00
kngwyu 60cbe2f47d Add a test that confirms __getattr__ doesn't override 2019-07-13 23:46:25 +09: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
kngwyu 383d0d3bac Do not execute test_compule_error in kcov 2019-07-13 15:00:19 +09:00
kngwyu 721e746585 Allow py: Python as an argument of getter 2019-07-12 23:41:13 +09:00
kngwyu fc5cdc1031 [derive-backend] Add utils::if_type_is_python 2019-07-12 22:22:56 +09:00
Yuji Kanagawa 5d85ea7fdc
Merge pull request #513 from kngwyu/pinbox
Refactoring around Box usages
2019-07-10 11:43:10 +09:00
Yuji Kanagawa 83d0ac4e70
Merge pull request #523 from ijl/fix-deprecation
Fix deprecation warnings on sync and mem
2019-07-09 20:03:12 +09:00
kngwyu 9f827f024c Update MIN_DATE/VERSION in build.rs 2019-07-09 19:06:50 +09:00
kngwyu 27f6abddba Do not use tox-venv in travis 2019-07-09 18:48:45 +09:00
ijl c27d9947a8 Fix deprecation warnings on sync and mem 2019-07-07 09:52:25 +00:00
konstin 9669edbfe3
Merge pull request #515 from kngwyu/guide-str-arg
Add arg=string example in the method arguments section in the guide
2019-06-21 20:54:26 +02:00
kngwyu c12836edcf Add arg=string example in the method arguments section in the guide 2019-06-21 17:07:51 +09:00
kngwyu f611716553 Merge remote-tracking branch 'birkenfeld/parse_args_msg' into parse_args_msg 2019-06-16 22:14:08 +09:00
kngwyu a4cf09f16a Refactor derive_utils 2019-06-16 22:13:50 +09:00
Georg Brandl ab802cd829 Document and test argument parsing annotations for pyfunctions 2019-06-16 22:13:50 +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
Georg Brandl 241a8956c9 Fix the argument parsing TypeError message
- parens are already added by the _LOCATION at call site
- fix plural-"s" logic
2019-06-16 22:13:50 +09:00
kngwyu 2fa017a508 Refactor type_object::initialize_type 2019-06-16 21:54:06 +09:00
kngwyu 02d93346c2 Use Pin<Box> for PyBuffer 2019-06-16 21:53:02 +09:00
Yuji Kanagawa 3e69389e68
Merge pull request #512 from kngwyu/expose-py-run
Expose py_run! macro
2019-06-15 23:50:14 +09:00
kngwyu 9073956da6 Edit CHANGELOG 2019-06-15 23:12:22 +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
Yuji Kanagawa 05b0cb66f8
Merge pull request #506 from PyO3/more_error_information
Print error before on class init panic
2019-06-14 14:16:47 +09:00
kngwyu 8dbb388372 Change add_wrapped to take &impl Fn 2019-06-14 12:42:32 +09:00
kngwyu 0f9a3b1194 Expose py_run macro 2019-06-13 18:18:06 +09:00
Yuji Kanagawa 787f5d305e
Merge pull request #509 from Alexander-N/coverage
Ignore return code of coverage script
2019-06-09 12:55:16 +09:00
Yuji Kanagawa 1d05de8546
Merge pull request #508 from Alexander-N/patch-1
Add python-ext-wasm as example
2019-06-09 12:54:24 +09:00
Alexander Niederbühl c416e0ef8e Ignore return code of coverage script
A failure in the coverage script should not cause the whole build to
fail.
2019-06-08 17:08:37 +02:00
Alexander-N c66a95d355
Add python-ext-wasm as example 2019-06-08 16:35:24 +02:00
Yuji Kanagawa f2a7c64365
Merge pull request #503 from kngwyu/reject-generics
Reject generics explicitly for #[pyclass]
2019-06-06 19:02:26 +09:00
konstin 45f23c08de
Merge pull request #507 from thedrow/patch-2
Added fastuuid as an example
2019-06-05 21:06:23 +02:00
Omer Katz 9c3b4b7d37
Added fastuuid as an example. 2019-06-05 20:54:26 +03:00
konstin dfd5a2abb8 Print error before on class init panic
Inspired by https://github.com/rust-numpy/rust-numpy/issues/97, also fixes some warnings from the latest nightly
2019-06-05 12:01:09 +02:00
kngwyu 35f5301675 Reject generics explicitly for #[pyclass] 2019-06-05 18:46:17 +09:00
konstin c76399e73d
Merge pull request #491 from PyO3/less_horrible_build_rs
build.rs configuration as struct instead of strings
2019-06-05 11:26:33 +02:00
konstin ed2ec48a58
Merge pull request #504 from kngwyu/upd-readme
Add Rogue-Gym to example
2019-06-05 11:22:11 +02:00
kngwyu e58ad71734 Add Rogue-Gym to example 2019-06-05 15:51:25 +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