Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-131798: JIT: Assign type to sliced string/list/tuple#134671

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
fluhus wants to merge5 commits intopython:main
base:main
Choose a base branch
Loading
fromfluhus:amit

Conversation

fluhus
Copy link
Contributor

Slicing a string/list/tuple always returns the same type.
Make the optimizer assign a string/list/tuple type to the result of slicing a string/list/tuple.

@brandtbucher

// Slicing a string/list/tuple always returns the same type.
PyTypeObject *type = sym_get_type(container);
if (type == &PyUnicode_Type ||
type == &PyList_Type ||
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Suggested change
type==&PyList_Type||
type==&PyBytes_Type||
type==&PyList_Type||

I do not know whether slicing a bytes object occurs often enough to addPyBytes_Type here (and whether the jit slows down if we add more cases here), but if I understand correctly slicingbytes (orbytearray) results in abytes (orbytearray) so we could add them.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@eendebakpteendebakpteendebakpt left review comments

@Fidget-SpinnerFidget-SpinnerAwaiting requested review from Fidget-SpinnerFidget-Spinner is a code owner

Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@fluhus@eendebakpt

[8]ページ先頭

©2009-2025 Movatter.jp