Skip to content

[WIP] refactor number protocol store in pytype - #3781

Closed
qingshi163 wants to merge 1 commit into
RustPython:mainfrom
qingshi163:number-protocol-func
Closed

qingshi163 wants to merge 1 commit into
RustPython:mainfrom
qingshi163:number-protocol-func

Conversation

@qingshi163

Copy link
Copy Markdown
Contributor

No description provided.

@qingshi163

qingshi163 commented Jun 11, 2022 •

Copy link
Copy Markdown
Contributor Author

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
Copy Markdown
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
Copy Markdown
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