Skip to content

list += operator generates Error #1351

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
HyeockJinKim opened this issue Sep 7, 2019 · 2 comments · Fixed by #1352
Closed

list += operator generates Error #1351

HyeockJinKim opened this issue Sep 7, 2019 · 2 comments · Fixed by #1352
Labels
C-compat A discrepancy between RustPython and CPython

Comments

@HyeockJinKim
Copy link
Contributor

HyeockJinKim commented Sep 7, 2019

Feature

a = [3]
a += a
print(a)

The code above generates the following error:
(list += operator)

actual

Hyeockz:RustPython hyeockjinkim$ cargo run b.py 
    Finished dev [unoptimized + debuginfo] target(s) in 0.11s
     Running `target/debug/rustpython b.py`
thread 'main' panicked at 'already mutably borrowed: BorrowError', src/libcore/result.rs:999:5
note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.

expected

[3, 3]
@HyeockJinKim HyeockJinKim added the C-compat A discrepancy between RustPython and CPython label Sep 7, 2019
@HyeockJinKim
Copy link
Contributor Author

HyeockJinKim commented Sep 7, 2019

If this issue is valid, can I take it?

@HyeockJinKim HyeockJinKim changed the title += operator generates Error list += operator generates Error Sep 7, 2019
@coolreader18
Copy link
Member

Sure thing!

HyeockJinKim added a commit to HyeockJinKim/RustPython that referenced this issue Sep 7, 2019
Clone other to prevent borrow error
when self iadd to itself from list

Fixes RustPython#1351
HyeockJinKim added a commit to HyeockJinKim/RustPython that referenced this issue Sep 7, 2019
Clone other to prevent borrow error
when self iadd to itself from list

Fixes RustPython#1351
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-compat A discrepancy between RustPython and CPython
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants