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

Warn when slicing twice #1775

Merged
merged 1 commit into from
Apr 15, 2024
Merged

Warn when slicing twice #1775

merged 1 commit into from
Apr 15, 2024

Conversation

pquentin
Copy link
Member

This is an alternative to merging #1771 directly.

Given the following file:

from elasticsearch_dsl import Search

s = Search()
s[10:20][2:]

Running it gives:

testwarn.py:4: DeprecationWarning: Slicing multiple times currently has no effect but will be supported in a future release. See https://github.com/elastic/elasticsearch-dsl-py/pull/1771 for more details
  s[10:20][2:]

Note that this is only displayed because the warning comes from the executed module. Users will only see it if they use pytest or use -Wall.

@pquentin pquentin merged commit b9c8343 into elastic:main Apr 15, 2024
15 checks passed
@pquentin pquentin deleted the warn-slicing-twice branch April 15, 2024 10:30
miguelgrinberg added a commit to miguelgrinberg/elasticsearch-dsl-py that referenced this pull request Apr 29, 2024
miguelgrinberg added a commit to miguelgrinberg/elasticsearch-dsl-py that referenced this pull request Apr 30, 2024
miguelgrinberg added a commit that referenced this pull request Apr 30, 2024
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.

None yet

2 participants