Thanks to visit codestin.com
Credit goes to github.com

Skip to content

gh-131798: JIT: Narrow the return type of _BINARY_SLICE to original container type #133527

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

Zheaoli
Copy link
Contributor

@Zheaoli Zheaoli commented May 6, 2025

I'm not sure this patch will take some effect.

In my original thought, I think if we can setup the return type to the original container type(tuple, list etc.), the optimizer will specialize some code in the test.

but the test is not work on my thought. I guess I miss something important here. cc @brandtbucher @Fidget-Spinner

@brandtbucher
Copy link
Member

@Zheaoli, I appreciate you taking the time to do this, but somebody else is already working on _BINARY_SLICE. Part of the reason I created an issue for this was so we could coordinate the work, rather than having multiple people racing on the same tasks.

Is it okay if we close this? FYI, one issue I see here is that there is no guarantee that slicing an arbitrary object will give you the same class (we need to check for some common classes instead):

>>> import mmap
>>> mm = mmap.mmap(-1, 42)
>>> type(mm)
<class 'mmap.mmap'>
>>> type(mm[:])
<class 'bytes'>

@Zheaoli
Copy link
Contributor Author

Zheaoli commented May 7, 2025

I appreciate you taking the time to do this, but somebody else is already working on _BINARY_SLICE. Part of the reason I created an issue for this was so we could coordinate the work, rather than having multiple people racing on the same tasks.

Sorry about this! I have not noticed this has been assigned.

@Zheaoli
Copy link
Contributor Author

Zheaoli commented May 7, 2025

Is it okay if we close this?

Sure!

@Zheaoli Zheaoli closed this May 7, 2025
@Zheaoli Zheaoli deleted the manjusaka/binary-slice branch May 7, 2025 02:42
@Zheaoli
Copy link
Contributor Author

Zheaoli commented May 7, 2025

one issue I see here is that there is no guarantee that slicing an arbitrary object will give you the same class (we need to check for some common classes instead):

Thanks about the explain. You prove one of my guess.

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