Package: pendulum / 3.0.0-3

Metadata

Package Version Patches format
pendulum 3.0.0-3 3.0 (quilt)

Patch series

view the series file
Patch File delta Description
0001 relax rust crate dependency versions.patch | (download)

rust/Cargo.toml | 4 2 + 2 - 0 !
1 file changed, 2 insertions(+), 2 deletions(-)

 relax rust crate dependency versions
0002 pyo3 v0.22 compatibility.patch | (download)

rust/Cargo.toml | 2 1 + 1 - 0 !
1 file changed, 1 insertion(+), 1 deletion(-)

 pyo3 v0.22 compatibility


0003 remove python tzdata dependency.patch | (download)

pyproject.toml | 2 0 + 2 - 0 !
src/pendulum/tz/__init__.py | 8 2 + 6 - 0 !
2 files changed, 2 insertions(+), 8 deletions(-)

 remove python tzdata dependency

0004 remove pytz dependency.patch | (download)

pyproject.toml | 2 0 + 2 - 0 !
tests/datetime/test_comparison.py | 18 9 + 9 - 0 !
tests/test_helpers.py | 13 6 + 7 - 0 !
tests/test_main.py | 8 4 + 4 - 0 !
tests/time/test_sub.py | 4 2 + 2 - 0 !
5 files changed, 21 insertions(+), 24 deletions(-)

 remove pytz dependency


rust Use i64 for internal unix timestamps.patch | (download)

rust/src/helpers.rs | 38 19 + 19 - 0 !
1 file changed, 19 insertions(+), 19 deletions(-)

 rust: use i64 for internal unix timestamps

pendulum 3.0.0 fails to build on 32-bit armhf:

```
error: this arithmetic operation will overflow
  --> src/helpers.rs:59:20
   |
59 | seconds += ((146_097 - 10957) * SECS_PER_DAY as usize) as isize;
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempt to compute `135140_usize * 86400_usize`, which would overflow
   |
   = note: `#[deny(arithmetic_overflow)]` on by default
```

`(146_097 - 10957) * SECS_PER_DAY` equals 11,676,096,000 which does not
fit into 32 bit integers.

Use i64 for the seconds variable while handling with the timestamp. Only
convert in to `usize` once the timestamp is split into its components.

Fixes https://github.com/sdispater/pendulum/issues/784
Ubuntu-Bug: https://bugs.launchpad.net/ubuntu/+source/pendulum/+bug/2079029
pure python empty durations error.patch | (download)

src/pendulum/parsing/iso8601.py | 2 1 + 1 - 0 !
tests/parsing/test_parse_iso8601.py | 10 8 + 2 - 0 !
2 files changed, 9 insertions(+), 3 deletions(-)

 make empty durations an error in pure-python parser

Some of Debian's test runners noticed that the pydantic-extra-types
tests are failing on 32-bit architectures:

  ______________________ test_invalid_zero_duration_string _______________________

      def test_invalid_zero_duration_string():
          """'P' is not a valid ISO 8601 duration and should raise a validation error."""
  >       with pytest.raises(ValidationError):
  E       Failed: DID NOT RAISE <class 'pydantic_core._pydantic_core.ValidationError'>

  tests/test_pendulum_dt.py:447: Failed

Debian currently has pendulum 3.0.0, which disabled the Rust extensions
if `struct.calcsize("P") == 4`, and the Rust and Python parsers disagree
about how to handle an empty duration: the Rust parser reports an error,
while the Python parser returns `Duration()`.  3.1.0 removes that
particular limitation on using Rust extensions on 32-bit architectures,
but the parser discrepancy still seems to be present.

I don't have access to the full text of the standard, but Wikipedia's
summary says 'However, at least one element must be present, thus "P" is
not a valid representation for a duration of 0 seconds', so I think the
Rust parser is correct.  Adjust the Python parser to match.