Skip to content

Conversation

@serhiy-storchaka
Copy link
Member

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


def read(self, n):
data = self.data[self.pos: self.pos + n]
self.pos += n
Copy link
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
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
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

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 <[email protected]>
@serhiy-storchaka serhiy-storchaka deleted the test-pickletools branch August 31, 2024 09:30
@bedevere-app
Copy link

bedevere-app bot commented Aug 31, 2024

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 <[email protected]>
@bedevere-app
Copy link

bedevere-app bot commented Aug 31, 2024

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 <[email protected]>
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 <[email protected]>
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