guix_mirror_bot pushed a commit to branch python-team
in repository guix.

commit fc981176762602daef6bb657ba608ef0fa1d3bd3
Author: Dariqq <[email protected]>
AuthorDate: Sat Dec 27 08:45:24 2025 +0000

    build: toml: Allow lowercase z as time zone offset.
    
    ABNF is case insensitive.
    
    * guix/build/toml.scm: (time-offset): Add "z" as valid offset.
    (eval-date): Adjust.
    
    Relatest-to: guix/guix!5156
    Change-Id: Ia7676c5201195ed44f629a678eb3f2966cf79860
    Reviewed-by: Ludovic Courtès <[email protected]>
    Signed-off-by: Sharlatan Hellseher <[email protected]>
---
 guix/build/toml.scm | 4 ++--
 tests/toml.scm      | 6 ++++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/guix/build/toml.scm b/guix/build/toml.scm
index b43fe4bb8b..43b5bdde2d 100644
--- a/guix/build/toml.scm
+++ b/guix/build/toml.scm
@@ -239,7 +239,7 @@
                                              time-hour
                                              (ignore ":")
                                              time-minute))
-(define-peg-pattern time-offset all (or "Z" time-numoffset))
+(define-peg-pattern time-offset all (or "Z" "z" time-numoffset))
 
 (define-peg-pattern partial-time body (and time-hour
                                            (ignore ":")
@@ -354,7 +354,7 @@ the list KEY. For instance a KEY (a b) would retrieve 
alist[a][b]."
        (assoc-ref->number args 'date-month)
        (assoc-ref->number args 'date-fullyear)
        (match (assq-ref args 'time-offset)
-         (("Z") 0)
+         ((or ("Z") ("z")) 0)
          ((sign ('time-hour hour) ('time-minute minute))
           (* (+
                (* (string->number (string-append sign hour)) 60)
diff --git a/tests/toml.scm b/tests/toml.scm
index a86c50eb1b..b261856fcd 100644
--- a/tests/toml.scm
+++ b/tests/toml.scm
@@ -261,11 +261,13 @@ bool2 = false"))
  `(("odt1" . ,(make-date #f 0 32 7 27 5 1979 0))
    ("odt2" . ,(make-date #f 0 32 0 27 5 1979 (* -7 60 60)))
    ("odt3" . ,(make-date 999999 0 32 0 27 5 1979 (* 7 60 60)))
-   ("odt4" . ,(make-date #f 0 32 7 27 5 1979 0)))
+   ("odt4" . ,(make-date #f 0 32 7 27 5 1979 0))
+   ("odt5" . ,(make-date #f 0 32 7 27 5 1979 0)))
  (parse-toml "odt1 = 1979-05-27T07:32:00Z
 odt2 = 1979-05-27T00:32:00-07:00
 odt3 = 1979-05-27T00:32:00.999999+07:00
-odt4 = 1979-05-27 07:32:00Z"))
+odt4 = 1979-05-27 07:32:00Z
+odt5 = 1979-05-27 07:32:00z"))
 
 (test-equal "parse-toml: Local date-time"
  `(("ldt1" . ,(make-date #f 0 32 7 27 5 1979 #f))

Reply via email to