Skip to content

bpo-30184: Add tests for invalid use of PyArg_ParseTupleAndKeywords.#1316

Merged
serhiy-storchaka merged 1 commit into
python:masterfrom
serhiy-storchaka:test-PyArg_ParseTupleAndKeywords-bad-use
May 3, 2017
Merged

bpo-30184: Add tests for invalid use of PyArg_ParseTupleAndKeywords.#1316
serhiy-storchaka merged 1 commit into
python:masterfrom
serhiy-storchaka:test-PyArg_ParseTupleAndKeywords-bad-use

Conversation

@serhiy-storchaka

Copy link
Copy Markdown
Member

No description provided.

@mention-bot

Copy link
Copy Markdown

@serhiy-storchaka, thanks for your PR! By analyzing the history of the files in this pull request, we identified @benjaminp, @tim-one and @larryhastings to be potential reviewers.

@louisom louisom left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

May add some test case

Comment thread Lib/test/test_capi.py
self.assertRaises(SystemError, _testcapi.parse_tuple_and_keywords,
(), {}, '|$O', [''])
self.assertRaises(SystemError, _testcapi.parse_tuple_and_keywords,
(), {}, '|OO', ['a', ''])

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

May add test case for misuse of ; and :

        self.assertRaises(SystemError, _testcapi.parse_tuple_and_keywords,
                          (1,), {}, ':O', ['a'])
        self.assertRaises(SystemError, _testcapi.parse_tuple_and_keywords,
                          (1,), {}, ';O', ['a'])

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.

These tests don't trigger any error that is not tested.

Comment thread Lib/test/test_capi.py

def test_bad_use(self):
# Test handling invalid format and keywords in
# PyArg_ParseTupleAndKeywords()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can this use the method below parser = _testcapi.parse_tuple_and_keywords to reduce the length?

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.

This doesn't matter, in any case the line is wrapped.

@serhiy-storchaka
serhiy-storchaka merged commit 5f161fd into python:master May 3, 2017
@serhiy-storchaka
serhiy-storchaka deleted the test-PyArg_ParseTupleAndKeywords-bad-use branch May 3, 2017 21:03
serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this pull request May 3, 2017
serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this pull request May 3, 2017
serhiy-storchaka added a commit that referenced this pull request May 4, 2017
serhiy-storchaka added a commit that referenced this pull request May 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tests Tests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants