From: Eli Zaretskii <eliz@gnu.org>
To: Imran Khan <contact@imrankhan.live>, acorallo@gnu.org
Cc: 67239@debbugs.gnu.org
Subject: bug#67239: 30.0.50; 30.0.50: Error in nativecomp
Date: Fri, 17 Nov 2023 17:02:22 +0200 [thread overview]
Message-ID: <83o7fso22p.fsf@gnu.org> (raw)
In-Reply-To: <97c5ca682b6b8a181ce84e1f56990dff@imrankhan.live> (message from Imran Khan on Fri, 17 Nov 2023 19:13:46 +0600)
> From: Imran Khan <contact@imrankhan.live>
> Date: Fri, 17 Nov 2023 19:13:46 +0600
>
>
> Hello, I have come across a function that gives error when native
> compiled, but works fine when byte compiled. The issue arose when using
> a third-party library (ts-format function in ts.el):
>
> https://github.com/alphapapa/ts.el/blob/master/ts.el
>
> But I have curved out the code so that you hopefully don't need to
> install that.
>
> Reproduction under `emacs -Q`:
>
> 1. First library "my-time.el" looks like:
>
> ```
> ;;; -*- lexical-binding: t; -*-
>
> (require 'cl-lib)
>
> (cl-defstruct time
> unix)
>
> (defvar time-default-format "%Y-%m-%d %H:%M:%S %z"
> "Default format for `time-format'.")
>
> (defsubst time-format (&optional time-or-format-string time)
> "Format timestamp with `format-time-string'.
> If TS-OR-FORMAT-STRING is a timestamp or nil, use the value of
> `time-default-format'. If both TS-OR-FORMAT-STRING and TS are nil,
> use the current time."
> (cl-etypecase time-or-format-string
> (time (format-time-string time-default-format (time-unix time-or-format-string)))
> (string (cl-etypecase time
> (time (format-time-string time-or-format-string (time-unix time)))
> (null (format-time-string time-or-format-string))))
> (null (cl-etypecase time
> (time (format-time-string time-default-format (time-unix time)))
> (null (format-time-string time-default-format))))))
>
> (provide 'my-time)
> ```
>
> 2. Then there is my code "my-bug.el":
>
> ```
> ;;; -*- lexical-binding: t -*-
>
> (require 'my-time)
>
> (defun my-bug ()
> (let ((time (make-time :unix (time-convert (current-time) 'integer))))
> ;; (message (time-format time)) ;; one argument works fine
> (message (time-format "%F" time)) ;; but this says: (wrong-type-argument stringp time)
> ))
>
> (provide 'my-bug)
> ```
>
> 3. When both of these are native compiled, doing `M-: (my-bug)` gives:
> ```
> Debugger entered--Lisp error: (wrong-type-argument stringp time)
> my-bug()
> eval-expression((my-bug) nil nil 127)
> funcall-interactively(eval-expression (my-bug) nil nil 127)
> command-execute(eval-expression)
> ```
>
> 4. But if I C-M-x on `my-bug` manually, it works fine.
>
> As far as I can tell, under 29.1 it worked fine under nativecomp too.
Adding Andrea to the discussion.
next prev parent reply other threads:[~2023-11-17 15:02 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-17 13:13 bug#67239: 30.0.50; 30.0.50: Error in nativecomp Imran Khan
2023-11-17 15:02 ` Eli Zaretskii [this message]
2023-11-17 20:50 ` Andrea Corallo
2023-12-02 9:44 ` Andrea Corallo
2023-12-04 20:00 ` Andrea Corallo
2023-12-04 21:30 ` Imran Khan
2023-12-05 3:25 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=83o7fso22p.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=67239@debbugs.gnu.org \
--cc=acorallo@gnu.org \
--cc=contact@imrankhan.live \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.