numba/numba
GitHub で見るThe is operator in the jitted code does not work for structref instance.
Open
#9,936 opened on 2025年2月24日
bug - miscompilegood first issue
Repository metrics
- Stars
- (9,177 stars)
- PR merge metrics
- (平均マージ 14d 16h) (30d で 30 merged PRs)
説明
Reporting a bug
- I have tried using the latest released version of Numba (most recent is visible in the release notes (https://numba.readthedocs.io/en/stable/release-notes-overview.html).
- I have included a self contained code sample to reproduce the problem. i.e. it's possible to run as 'python bug.py'.
Running the code below:
import platform, sys
import numba as nb
from numba import types, extending
from numba.experimental import structref
print(platform.platform(terse=True))
print(sys.version)
print(nb.__version__)
@structref.register
class NodeType(types.StructRef):
pass
node_type = NodeType([])
class Node(structref.StructRefProxy):
pass
@extending.overload(Node)
def ol_Node():
def impl():
self = structref.new(node_type)
return self
return impl
@nb.njit
def main():
node = Node()
print(node is node)
List = [0]
print(List is List)
Tuple = (0,)
print(Tuple is Tuple)
main()
resulted in:
Linux-6.1.85+-x86_64-with-glibc2.35
3.11.11 (main, Dec 4 2024, 08:55:07) [GCC 11.4.0]
0.61.0
False
True
True
As above in the title. I believe True will be printed, and the is operator is a good way to treat all instances as distinct and different. This is the first issue I've opened, so please let me know if there is anything I have not done or am unclear on.