Skip to content

Conversation

@yingmanwumen
Copy link
Contributor

I found a bug:

>>> import ulist as ul
>>> foo = ul.arange(2)
>>> iterater = iter(foo)
>>> next(iterater)
0
>>> next(iterater)
1
>>> next(iterater)
thread '<unnamed>' panicked at 'Index '2' out of range '2'!', src/base.rs:133:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/yingmanwumen/Documents/Codes/Rust/ulist/ulist/python/ulist/core.py", line 80, in __getitem__
    return self._values.get(index)
pyo3_runtime.PanicException: Index '2' out of range '2'!

This causes the following code to fail

...
foo = ul.arange(n)
for x in foo:
    # ....do something
...

I found that the use of panic instead of exception in the rust code result in it.

Copy link
Collaborator

@tushushu tushushu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing this PR. I am actually thinking of using PyErr instead of Panic and created an issue.

@tushushu tushushu added this to the ulist 0.11.0 milestone May 24, 2022
@tushushu tushushu added the code quality To improve or check code quality. label May 24, 2022
@tushushu tushushu merged commit 91ad6fd into Rust-Data-Science:main May 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

code quality To improve or check code quality.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants