Skip to content

refactor: add a repr helper function for the collections#3471

Merged
youknowone merged 2 commits into
RustPython:mainfrom
TeamTamoad:collection-repr
Mar 24, 2022
Merged

refactor: add a repr helper function for the collections#3471
youknowone merged 2 commits into
RustPython:mainfrom
TeamTamoad:collection-repr

Conversation

@TeamTamoad
Copy link
Copy Markdown
Contributor

Implement an helper functions to for repr function of the collections including list, tuple, set and deque.

Comment thread vm/src/utils.rs Outdated
Comment thread vm/src/utils.rs Outdated
@TeamTamoad
Copy link
Copy Markdown
Contributor Author

Those changes are really good ideas. I'll do that.
Btw, do you have any idea why my last changes don't pass the test in time ?

@TeamTamoad TeamTamoad changed the title refactor: implement repr_helper for collections refactor: add a repr helper function for the collections Nov 29, 2021
@youknowone
Copy link
Copy Markdown
Member

I have no idea yet. But becasue it failed again exceeding the time limit, it seems this changes made something.

@fanninpm
Copy link
Copy Markdown
Contributor

Btw, do you have any idea why my last changes don't pass the test in time ?

Try running the following command:

cargo run --release --features ssl,jit -- -m test -v

@TeamTamoad TeamTamoad marked this pull request as draft January 18, 2022 17:57
@fanninpm
Copy link
Copy Markdown
Contributor

It was hanging in the snippets. To diagnose,

  1. Build RustPython in release mode (with the features normally used for testing): cargo build --release --features ssl,jit
  2. Navigate to the extra_tests directory and install pytest into a virtual environment. (e.g., cd extra_tests && pipenv install --python 3.9)
  3. Run pytest on the extra_tests directory. (e.g., pipenv run pytest -v)

@pwnorbitals
Copy link
Copy Markdown

how far are we from completion here @TeamTamoad ? :)

@TeamTamoad
Copy link
Copy Markdown
Contributor Author

Sorry for an late update. I'm super busy with life and college right now.
The hanging problem is cause by this snippet in file extra_tests/snippets/stdlib_collections.py

# Test that calling an evil __repr__ can't hang deque
class BadRepr:
    def __repr__(self):
        self.d.pop()
        return ''

b = BadRepr()
d = deque([1, b, 2])
b.d = d
repr(d)

It should be fixed now

@TeamTamoad TeamTamoad marked this pull request as ready for review March 20, 2022 18:22
@TeamTamoad TeamTamoad requested a review from youknowone March 24, 2022 18:14
Copy link
Copy Markdown
Member

@youknowone youknowone left a comment

Choose a reason for hiding this comment

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

great! thank you for the long time effort!

@youknowone youknowone merged commit 7466d17 into RustPython:main Mar 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants