Skip to content

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

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

Merged
merged 2 commits into from
Mar 24, 2022

Conversation

TeamTamoad
Copy link
Contributor

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

@TeamTamoad
Copy link
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
Member

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

@fanninpm
Copy link
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
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

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

@TeamTamoad
Copy link
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
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