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

[stdlib] List.extend uses origin on its UnsafePointer logic. #4043

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rd4com
Copy link
Contributor

@rd4com rd4com commented Mar 1, 2025

Hello,
this small commit is to integrate the origin parameter into the existing implementation.

(during logic on UnsafePointer to the other arg)

For example, if other^.__del__() is added before the loop, an error comes on move_pointee_into:
"uninitialized value other"

(preventing moving of values out of an maybe freed pointer)

The origin parameter makes sure that other is not __del__ while

we use the UnsafePointer to it.

Not sure if needed here, but it feels like a nice thing ! 👍

Hello,
this small commit is to integrate the `origin` parameter into
the existing implementation.

(during logic on `UnsafePointer` to the `other` arg)

For example, if `other^.__del__()` is added before the loop,
an error comes on `move_pointee_into`:
"uninitialized value other"

(preventing moving of values out of an maybe freed pointer)

The `origin` parameter makes sure that `other` is not `__del__` while

we use the `UnsafePointer` to it.

Not sure if needed here, but it feels like a nice thing ! 👍

Signed-off-by: rd4com <[email protected]>
@JoeLoser JoeLoser requested a review from lsh March 7, 2025 18:34
@lsh
Copy link
Contributor

lsh commented Mar 8, 2025

This should be safe either way because variables in arguments live through the duration of the function, but it never hurts to be more careful

@lsh
Copy link
Contributor

lsh commented Mar 8, 2025

!sync

@modularbot modularbot added the imported-internally Signals that a given pull request has been imported internally. label Mar 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
imported-internally Signals that a given pull request has been imported internally.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants