Skip to content
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

static mut should not be used #699

Closed
programmerjake opened this issue Dec 23, 2019 · 3 comments · Fixed by #751
Closed

static mut should not be used #699

programmerjake opened this issue Dec 23, 2019 · 3 comments · Fixed by #751
Labels

Comments

@programmerjake
Copy link
Contributor

See #683 (comment)

@programmerjake
Copy link
Contributor Author

Yeah, but this is not a new part that this PR introduced.
It is copy-pasted from type_object.rs.

Though I completely agree that it is problematic, maybe what I need is a mechanism that inhibits access to uninitialized TYPE_OBJECT.
Let's do it in another PR.

what about using once_cell::Lazy (or similar)?

@kngwyu
Copy link
Member

kngwyu commented Dec 23, 2019

what about using once_cell::Lazy (or similar)?

It is a possible candidate, but the first choice we have to do is probably we should make this thread_local or not.

@programmerjake
Copy link
Contributor Author

what about using once_cell::Lazy (or similar)?

It is a possible candidate, but the first choice we have to do is probably we should make this thread_local or not.

I'm pretty sure that the returned pointer is used directly by CPython and is relied on to be unique program-wide, therefore thread_local can't be used due to it having a different address in each thread.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants