Skip to content

bpo-33767: Fix improper use of SystemError by mmap.mmap objects #7381

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

Merged
merged 3 commits into from
Jun 5, 2018

Conversation

ZackerySpytz
Copy link
Contributor

@ZackerySpytz ZackerySpytz commented Jun 4, 2018

An alternative would be to remove mmap_concat() and mmap_repeat() to rely on the default TypeError.

https://bugs.python.org/issue33767

@@ -734,6 +734,14 @@ def test_resize_past_pos(self):
self.assertRaises(ValueError, m.write_byte, 42)
self.assertRaises(ValueError, m.write, b'abc')

def test_concat_repeat_exception(self):
# A SystemError was raised on two unsupported sequence operations.
Copy link
Member

Choose a reason for hiding this comment

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

Just a nitpick, but I think we can drop this comment. If future readers want to know more about the test, they will find it via git blame.

@@ -0,0 +1,2 @@
Fix improper use of :exc:`SystemError` by :class:`mmap.mmap` objects. Patch
Copy link
Member

Choose a reason for hiding this comment

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

Could you also mention that the + and * operations will now raise TypeErrors?

Copy link
Member

Choose a reason for hiding this comment

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

I suggest to reword this entry something like: "Conatenating (``+``) and repeating (``*``) of :class:`mmap.mmap` objects now raises :exc:`TypeError` instead of :exc:`SystemError`."

@serhiy-storchaka serhiy-storchaka merged commit e9e3976 into python:master Jun 5, 2018
@miss-islington
Copy link
Contributor

Thanks @ZackerySpytz for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 2.7, 3.6, 3.7.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jun 5, 2018
…onGH-7381)

Raise TypeError instead of SystemError for unsupported operations.
(cherry picked from commit e9e3976)

Co-authored-by: Zackery Spytz <[email protected]>
@bedevere-bot
Copy link

GH-7426 is a backport of this pull request to the 3.7 branch.

@miss-islington
Copy link
Contributor

Sorry, @ZackerySpytz and @serhiy-storchaka, I could not cleanly backport this to 2.7 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker e9e397605789b2a67b67558fbbe756b7b88934f5 2.7

@bedevere-bot
Copy link

GH-7427 is a backport of this pull request to the 3.6 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jun 5, 2018
…onGH-7381)

Raise TypeError instead of SystemError for unsupported operations.
(cherry picked from commit e9e3976)

Co-authored-by: Zackery Spytz <[email protected]>
miss-islington added a commit that referenced this pull request Jun 5, 2018
)

Raise TypeError instead of SystemError for unsupported operations.
(cherry picked from commit e9e3976)

Co-authored-by: Zackery Spytz <[email protected]>
serhiy-storchaka pushed a commit to serhiy-storchaka/cpython that referenced this pull request Jun 5, 2018
…pythonGH-7381)

Raise TypeError instead of SystemError for unsupported operations..
(cherry picked from commit e9e3976)

Co-authored-by: Zackery Spytz <[email protected]>
@bedevere-bot
Copy link

GH-7432 is a backport of this pull request to the 2.7 branch.

miss-islington added a commit that referenced this pull request Jun 5, 2018
)

Raise TypeError instead of SystemError for unsupported operations.
(cherry picked from commit e9e3976)

Co-authored-by: Zackery Spytz <[email protected]>
serhiy-storchaka added a commit that referenced this pull request Jun 5, 2018
…GH-7381) (GH-7432)

Raise TypeError instead of SystemError for unsupported operations.
(cherry picked from commit e9e3976)

Co-authored-by: Zackery Spytz <[email protected]>
@ZackerySpytz ZackerySpytz deleted the mmap_systemerror branch June 11, 2018 06:13
@serhiy-storchaka serhiy-storchaka removed their assignment Oct 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants