Commit Graph

47 Commits

Author SHA1 Message Date
David Hewitt 64adab1a76 add as_ptr and into_ptr inherent methods 2023-08-11 10:49:42 +01:00
David Hewitt a15614844d add PyErr::display 2023-07-24 22:14:55 +01:00
David Hewitt 248230b8e4 refactor PyAny::is_instance_of for performance 2023-05-18 22:25:27 +01:00
Solomon Ucko 7e2f732d7a fix typo DateType -> DateTimeType, fixes #3069 2023-03-28 18:45:39 +02:00
mejrs 984fdf57c7 Use Python:;with_gil in tests 2022-07-19 19:34:23 +02:00
David Hewitt 7babd13830 datetime: support timezone bindings 2022-07-13 22:05:17 +01:00
mejrs 6f1cf1b662 Add more lints 2022-03-23 08:07:28 +01:00
DSPOM 6a9a9ba38a
move ffi module to separate crate 2022-01-31 13:27:16 +01:00
David Hewitt 6433d884fc dev: remove self dev dependency 2021-12-08 07:48:58 +00:00
David Hewitt ee9a1678d5 rust: updates for rust & clippy 1.54 2021-07-31 08:19:38 +01:00
David Hewitt ac0bd0c0f1 clippy: tidy up allow lints 2021-04-12 01:20:04 +01:00
David Hewitt b10cefdca2 pymodule: remove call_function etc. 2021-03-14 11:19:55 +00:00
Georg Brandl fa8d7518ca Restore compatibility with Rust 1.41.
This version is currently supported by Debian stable and Alpine Linux.

Fixes #1420
2021-02-11 10:14:25 +01:00
kngwyu dc2dbd6c19 Use #[cfg(not(Py_LIMITED_API))] for datetime API 2020-12-20 12:20:35 +00:00
David Hewitt 9617edfca9 msrv: bump to 1.45 2020-11-12 11:33:08 +00:00
David Hewitt afd9b823d2 Drop support for Python 3.5 2020-10-18 19:02:27 +01:00
kngwyu 0f709d6edc Use paste instead of nightly concat_idents in datetime tests 2020-06-18 18:15:36 +09:00
konstin 3180e5cc06 POC stable rust (2 tests failing) 2020-06-18 17:21:09 +09:00
David Hewitt dfbe22bb56 Thread-safe release pools 2020-05-02 13:16:22 +01:00
kngwyu 2cd466dc46 Bound 'py lifetime by GILPool when it's possible 2020-04-12 23:55:23 +09:00
Yuji Kanagawa 5e285fda78
Fix synchronization of datetime tests (#867)
* Fix synchronization of datetime tests

* Use Mutex instead of RawMutex
2020-04-11 19:10:16 +09:00
kngwyu 9dc3f9dc1a Lock other threads before import datetime to avoid test failure 2020-04-09 22:11:03 +09:00
kngwyu c234476693 chmod -x for test files 2020-03-27 00:41:01 +09:00
kngwyu 02ee7a5afc Expose PyAny to lib.rs and prelude 2020-03-18 13:38:18 +09:00
Alexander Niederbühl cffefa4fa8 Add debug output for flaky test 2020-01-12 15:44:42 +01:00
Samuele Maci f7ac0a2887 Address clippy::into_iter_on_ref issues 2019-08-17 15:27:05 +02:00
Samuele Maci 6b4a221d61 Address clippy::float_cmp issues 2019-08-17 14:10:36 +02:00
Samuele Maci f008c569a6 Address clippy::trivially_copy_pass_by_ref issues 2019-08-17 14:10:36 +02:00
Samuele Maci 8f57d9fb82 Address clippy::dead_code issues 2019-08-17 14:10:36 +02:00
Samuele Maci 5e0168b2e9 Address clippy::redundant_static_lifetimes issues 2019-08-17 14:10:36 +02:00
ijl 2bb0d05a30 Drop support for python2 2019-03-29 12:37:26 +00:00
konstin 97189a16b9 Try fixing cargo fmt on travis ci 2019-03-24 17:19:15 +01:00
Miles Granger 711155d7ad Update tests & docs with IntoPyDict::into_py_dict(py) 2019-03-20 20:04:00 +01:00
kngwyu 874d8a0835 Rename PyObjectRef with PyAny 2019-03-04 13:50:43 +09:00
kngwyu 86d239e445 Rename ToPyPointer with AsPyPointer 2019-02-24 16:20:04 +09:00
konstin d3743fec64 Python 2 2019-02-23 18:42:40 +01:00
konstin 6cd07c369c Simpler new and clippy fixes 2019-02-23 18:38:00 +01:00
konstin 936f0153e8 Migrate to rust 2018 2019-02-01 14:23:29 +01:00
konstin 302c099a76 Big refactoring to shrink the prelude 2018-09-21 23:34:28 +02:00
Paul Ganssle a05a78f7e0
Use smallest types for Py{Date}{Time} constructors
Because it's unlikely that anything other than the `year` parameter will
change in the C Python API, the rest can be restricted to their logical
ranges, which improves the compile-time error checking.
2018-08-21 18:33:33 -04:00
Paul Ganssle 5d5689f95b
Switch Py{Date}{Time} constructor parameters to i32
While the valid ranges for the constructor parameters is the same when
expressed as either u32 or i32, since the Python API uses i32 in their
public interface, we won't have to make any changes to the signatures if
the Python behavior changes (e.g. supporting negative years) without
their API changing.
2018-08-21 18:33:33 -04:00
Paul Ganssle 003351ba61
Get rid of unwrap_py! macro 2018-08-21 18:33:32 -04:00
Paul Ganssle bcc27bd522
Change datetime constructors to use Rust Option
This makes it cleaner to call PyTime::new and PyDateTime::new from Rust
without needing to retrieve a Python None.
2018-08-21 18:33:32 -04:00
Paul Ganssle 09ee50d4ca
Add tests for datetime overflow behavior
It *should* be safe to cast u32 to i32 in the case of the Py{Date}{Time}
constructors, because any unsigned values that would overflow would
raise an error anyway.

This adds tests to ensure that this is the case - they currently fail on
Python <3.6 because of a known issue with the Python C API.
2018-08-21 18:33:31 -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 996c2baec8
Add preliminary Python 2 support to datetime bindings
The bounds checking tests are xfail because the datetime "fast path"
constructor didn't do bounds checking until bpo-29100 was resolved in
CPython commit b67f0967386a9c90411, which was merged for Python 3.6.

This functionality should be simple to backport to earlier versions in a
future commit.

BPO issue:
https://bugs.python.org/issue29100

CPython commit:
b67f096738
2018-08-21 14:29:36 -04:00
Paul Ganssle cd6f7295a1
Add type checking FFI bindings 2018-08-21 14:29:36 -04:00