Skip to content

gh-123309: Add more tests for the pickletools module - #123355

Merged
serhiy-storchaka merged 1 commit into
python:mainfrom
serhiy-storchaka:test-pickletools
Aug 31, 2024
Merged

gh-123309: Add more tests for the pickletools module#123355
serhiy-storchaka merged 1 commit into
python:mainfrom
serhiy-storchaka:test-pickletools

Conversation

@serhiy-storchaka

@serhiy-storchaka serhiy-storchaka commented Aug 26, 2024

Copy link
Copy Markdown
Member


def read(self, n):
data = self.data[self.pos: self.pos + n]
self.pos += n

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Probably not applicable, but what if self.pos+n < len(self.data)?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

You perhaps mean self.pos+n > len(self.data)? We will get truncated data, and the following reads will return an empty bytes object. Like in real files or BytesIO.

SimpleReader is not currently used in such tests, because it does not make difference, but I am sure that tests for truncated data would pass with it.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Perfect then.

@miss-islington-app

Copy link
Copy Markdown

Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12, 3.13.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Aug 31, 2024
…123355)

Add tests for genops() and dis().
(cherry picked from commit e5a567b)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
@serhiy-storchaka
serhiy-storchaka deleted the test-pickletools branch August 31, 2024 09:30
@bedevere-app

bedevere-app Bot commented Aug 31, 2024

Copy link
Copy Markdown

GH-123533 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.13 bugs and security fixes label Aug 31, 2024
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Aug 31, 2024
…123355)

Add tests for genops() and dis().
(cherry picked from commit e5a567b)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
@bedevere-app

bedevere-app Bot commented Aug 31, 2024

Copy link
Copy Markdown

GH-123534 is a backport of this pull request to the 3.12 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.12 only security fixes label Aug 31, 2024
Yhg1s pushed a commit that referenced this pull request Sep 2, 2024
… (#123533)

gh-123309: Add more tests for the pickletools module (GH-123355)

Add tests for genops() and dis().
(cherry picked from commit e5a567b)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
ambv pushed a commit that referenced this pull request Sep 6, 2024
… (#123534)

Add tests for genops() and dis().
(cherry picked from commit e5a567b)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip news tests Tests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants