Skip to content

Commit 75c4fe5

Browse files
Madhudigikar99
Madhu
authored andcommitted
[int] src/lispifiers.lisp: don't lispify the null pointer in lispify
1 parent 16e0c44 commit 75c4fe5

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/lispifiers.lisp

+4
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,10 @@
169169
(optimize speed)
170170
(inline gethash pyobject-typename/simple djb2-foreign-string-hash))
171171
(assert (eq :lisp *pyobject-translation-mode*))
172+
;; The performance impact of this check is less than 2%
173+
;; -- so it's worth it for a slightly more robust system.
174+
(if (null-pointer-p pyobject)
175+
(return-from lispify nil))
172176
(let* ((pytype-name-foreign (pyobject-typename/simple pyobject))
173177
(pytype-name-hash (djb2-foreign-string-hash pytype-name-foreign))
174178
;; FIXME: What about names in modules?

0 commit comments

Comments
 (0)