The Wayback Machine - https://web.archive.org/web/20250522204342/https://github.com/RustPython/RustPython/pull/3781
Skip to content

[WIP] refactor number protocol store in pytype #3781

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
wants to merge 1 commit into from

Conversation

qingshi163
Copy link
Contributor

No description provided.

@qingshi163
Copy link
Contributor Author

qingshi163 commented Jun 11, 2022

I am having the problem with this appoarch, the pyobject has a pytyperef witch is protected via rw lock but pytype's fields also need a lock to support interior mutability, that will make me difficult to return the borrowed reference for methods stored in pytype.

I am thinking maybe we could have a lock for whole pytype and cancel the lock in the pyobject as I don't see any chance pyobject could change it's type and pytype itself is rarely changed.
@youknowone

@youknowone
Copy link
Member

I met the same conclusion when I tried the same thing. I think we don't need to lock it. PyObjectRef is already Arc. Locking the type every time only to prevent the type-changing is too much. Instead of it, we can keep the rule to use only single access to PyObject::class() for consecutive operations.

@qingshi163 qingshi163 closed this Aug 6, 2022
@qingshi163 qingshi163 deleted the number-protocol-func branch August 6, 2022 20:30
@youknowone
Copy link
Member

replaced by #3819

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.

2 participants