You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
EDIT: this is an invalid REPRO, it still does seg fault, but I'm not sure if it's related to the above repro
This seg faults because the object instance argument isn't in the next function's parameters. Changing it to next(self):... results in a separate error:
pythonmonkey.SpiderMonkeyError: Error in file evaluate, on line 3, column 23:
TypeError: pyiterable is not iterable
Stack Trace:
iterateAndPrint@evaluate:3:23
AddressSanitizer:DEADLYSIGNAL
=================================================================
==1522488==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000030 (pc 0x7dd33033feaf bp 0x7ffe9e4b68d0 sp 0x7ffe9e4b6500 T0)
==1522488==The signal is caused by a READ memory access.
==1522488==Hint: address points to the zero page.
#0 0x7dd33033feaf in getKey /home/will/git/pythonmonkey/src/JSObjectProxy.cc:87
#1 0x7dd330340ef1 in JSObjectProxyMethodDefinitions::JSObjectProxy_get(JSObjectProxy*, _object*) /home/will/git/pythonmonkey/src/JSObjectProxy.cc:151
#2 0x7dd330343ae0 in JSObjectProxyMethodDefinitions::JSObjectProxy_iter_next(JSObjectProxy*) /home/will/git/pythonmonkey/src/JSObjectProxy.cc:326
#3 0x5b64d0546a71 (/usr/bin/python3.10+0x201a71)
#4 0x5b64d04a0908 (/usr/bin/python3.10+0x15b908)
#5 0x5b64d0488934 in _PyEval_EvalFrameDefault (/usr/bin/python3.10+0x143934)
#6 0x5b64d0485095 (/usr/bin/python3.10+0x140095)
#7 0x5b64d057af65 in PyEval_EvalCode (/usr/bin/python3.10+0x235f65)
#8 0x5b64d05a5e97 (/usr/bin/python3.10+0x260e97)
#9 0x5b64d059f79a (/usr/bin/python3.10+0x25a79a)
#10 0x5b64d05a5be4 (/usr/bin/python3.10+0x260be4)
#11 0x5b64d05a50c7 in _PyRun_SimpleFileObject (/usr/bin/python3.10+0x2600c7)
#12 0x5b64d05a4d12 in _PyRun_AnyFileObject (/usr/bin/python3.10+0x25fd12)
#13 0x5b64d059770d in Py_RunMain (/usr/bin/python3.10+0x25270d)
#14 0x5b64d056ddfc in Py_BytesMain (/usr/bin/python3.10+0x228dfc)
#15 0x7dd334029d8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
#16 0x7dd334029e3f in __libc_start_main_impl ../csu/libc-start.c:392
#17 0x5b64d056dcf4 in _start (/usr/bin/python3.10+0x228cf4)
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV /home/will/git/pythonmonkey/src/JSObjectProxy.cc:87 in getKey
==1522488==ABORTING
@wiwichips
Note that the range object is not an iterator, so the yield expression produces an exception when trying to call next on it.
indeed:
python 3.12.3 (main, Jul 31 2024, 17:43:48) [GCC 13.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
a = range(0,5)
next(a)
Traceback (most recent call last):
File "", line 1, in
TypeError: 'range' object is not an iterator
So the proper behavior is to exit once this exception is noticed
Now get:
pythonmonkey.SpiderMonkeyError: Error in file , on line 1, column 1:
Error: Python TypeError: 'range' object is not an iterator
Traceback (most recent call last):
File "", line 1, in
Activity
wiwichips commentedon Sep 10, 2024
normal generators made in js seem to work, but this one caused a seg fault probably because of the Python code I'm executing inside it?
wiwichips commentedon Sep 10, 2024
EDIT: this is an invalid REPRO, it still does seg fault, but I'm not sure if it's related to the above repro
This seg faults because the object instance argument isn't in the
nextfunction's parameters. Changing it tonext(self):...results in a separate error:I made a ticket for it here: #436
Anyways, I'll keep the original comment pasted below the horizontal line below in this comment for context.
repro # 2wesgarland commentedon Sep 11, 2024
@wiwichips please follow up with a C++ stack trace from a debug build
wiwichips commentedon Sep 11, 2024
@wesgarland - I tried building it with a debug build and didn't see anything, here's the output with
BUILD_TYPE=Sanitizephilippedistributive commentedon Sep 11, 2024
@wiwichips
Note that the range object is not an iterator, so the yield expression produces an exception when trying to call next on it.
indeed:
python 3.12.3 (main, Jul 31 2024, 17:43:48) [GCC 13.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
a = range(0,5)
next(a)
Traceback (most recent call last):
File "", line 1, in
TypeError: 'range' object is not an iterator
So the proper behavior is to exit once this exception is noticed
Now get:
pythonmonkey.SpiderMonkeyError: Error in file , on line 1, column 1:
Error: Python TypeError: 'range' object is not an iterator
Traceback (most recent call last):
File "", line 1, in
JS Stack Trace:
sliceGenerator@evaluate:4:43