Commit Graph

1547 Commits

Author SHA1 Message Date
Alexander Niederbühl 4586702fb7 Fix example in guide
The example was failing with:
`error[E0117]: only traits defined in the current crate can be implemented for arbitrary types`
2019-08-03 22:09:12 +02:00
Alexander Niederbühl 618b9090ed Add test for exception with custom error
Also simplify the old test.
2019-08-03 22:08:51 +02:00
Yuji Kanagawa c6de61f7e1
Merge pull request #561 from Alexander-N/exceptions
Use to_string() instead of description() for exception messages
2019-08-01 12:35:58 +09:00
Alexander Niederbühl 1e01f4f8cc Use to_string() instead of description() for exception messages
`description()` is soft-deprecated and can differ from `to_string()`.

For example for NotFound error:
* `description()`: "entity not found"
* `to_string()`: "No such file or directory (os error 2)"

Since io errors provide their error code through the Display trait there
is no need to get it through `raw_os_error()`.
2019-08-01 00:48:56 +02:00
Yuji Kanagawa 382c79ec31
Merge pull request #556 from athre0z/patch-1
Remove mention of Python 2
2019-07-27 19:07:02 +09:00
Joel Höner eb34ce588b
Remove mention of Python 2 2019-07-27 04:45:53 +02:00
konstin 20534ec22a
Merge pull request #551 from PyO3/remove-an-unsafe
Remove an unsafe
2019-07-21 21:43:17 +02:00
konstin a4ed4543d1 Remove an unsafe 2019-07-21 14:08:49 +02:00
konstin 58e17be1a6
Merge pull request #545 from PyO3/replace-PyByteArray-data
Replace unsound PyByteArray::data with PyByteArray::to_vec
2019-07-20 13:14:14 +02:00
konstin cd2eefb65a fixup 2019-07-20 12:22:10 +02:00
Yuji Kanagawa 63fd354fe2
Merge pull request #546 from thedrow/patch-2
Add empty() to PySet and PyFrozenSet
2019-07-20 10:51:23 +09:00
konstin 1736568d28 Rename also in the tests 2019-07-19 18:17:11 +02:00
Omer Katz 182b2fc615 Add empty() to PySet and PyFrozenSet. 2019-07-19 17:35:47 +03:00
konstin bd86b6750e Replace unsound PyByteArray::data with PyByteArray::to_vec 2019-07-18 22:57:33 +02:00
Yuji Kanagawa cf8f63cacf
Merge pull request #542 from PyO3/index_bytes
Implement Index for PyBytes
2019-07-17 21:22:07 +09:00
konstin d90ac76400 Implement Index for PyBytes 2019-07-17 12:29:14 +02:00
konstin 86cc84e692
Merge pull request #541 from PyO3/upgrade_version_check
Upgrade version check
2019-07-16 20:10:10 +02:00
konstin 1332174e00 Upgrade version check 2019-07-15 13:05:56 +02:00
konstin 6e807f852b
Merge pull request #535 from Alexander-N/datetime
Fix flaky test on Appveyor
2019-07-15 12:37:59 +02:00
konstin 5ae014fe52
Merge pull request #532 from Alexander-N/gc-default
Remove default implementation for PyGCProtocol
2019-07-15 12:02:52 +02:00
konstin 7e4b7168a6
Merge pull request #534 from Alexander-N/clippy
Make CI fail on clippy warnings
2019-07-15 11:48:22 +02:00
konstin 3d77cb3442
Merge branch 'master' into datetime 2019-07-15 11:45:15 +02:00
konstin afb9605165
Merge pull request #537 from kngwyu/arraylist-opt
Use [Option<T>; N] in ArrayList
2019-07-15 11:42:58 +02:00
Alexander Niederbühl f22708f140 datetime tests: Remove Python 2 compatibility 2019-07-15 08:13:03 +02:00
Alexander Niederbühl ad0a068a38 Add minimal datetime as testcase which should pass on all platforms 2019-07-15 08:08:51 +02:00
Alexander Niederbühl f642f19167 Increase MIN_DATETIME_FROM_TIMESTAMP for windows
Otherwise test_datetime_from_timestamp will give an OSError. This seems
to be a similar problem as https://bugs.python.org/issue29097
2019-07-15 08:07:14 +02:00
Yuji Kanagawa 9c961b4248
Merge branch 'master' into gc-default 2019-07-15 14:25:27 +09:00
kngwyu 370849e075 Use [Option<T>; N] in ArrayList 2019-07-15 13:32:18 +09:00
Yuji Kanagawa 67a7a6de67
Merge branch 'master' into clippy 2019-07-15 12:44:56 +09:00
Yuji Kanagawa 29b0a02fda
Merge pull request #531 from pganssle/enforce_gc_protocol
Enforce GC contract at compile time
2019-07-15 12:44:15 +09:00
Alexander Niederbühl 86cc424b23 Fail CI if there are clippy warnings 2019-07-14 22:42:37 +02:00
Alexander Niederbühl cc31c7dbf2 Ignore remaining clippy lints 2019-07-14 22:42:37 +02:00
Alexander Niederbühl faa21f48c7 Fix some clippy lints 2019-07-14 22:42:37 +02:00
Alexander Niederbühl ceefa7cc27 Add __clear__ for test class 2019-07-14 20:45:05 +02:00
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