This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2017年08月21日 08:33 by Oren Milman, last changed 2022年04月11日 14:58 by admin. This issue is now closed.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 3171 | merged | Oren Milman, 2017年08月21日 19:00 | |
| PR 3233 | merged | Oren Milman, 2017年08月29日 10:54 | |
| PR 3235 | merged | Oren Milman, 2017年08月29日 15:05 | |
| Messages (7) | |||
|---|---|---|---|
| msg300613 - (view) | Author: Oren Milman (Oren Milman) * | Date: 2017年08月21日 08:33 | |
according to the docs (https://docs.python.org/3.7/c-api/arg.html?highlight=pyarg_parsetuple#c.PyArg_ParseTuple), PyArg_ParseTuple returns true for success or false for failure. I also looked at the implementation in Python/getargs.c, and it seems that indeed PyArg_ParseTuple can return only 0 or 1. however, in some places in the codebase, there are checks whether PyArg_ParseTuple returned a negative int. I found a bunch in Modules/_testcapimodule.c, and one in Modules/_io/textio.c in textiowrapper_read_chunk. (hopefully i haven't missed other places.) this code crashes because of the check in textiowrapper_read_chunk: import codecs import _io class MyDec(): def getstate(self): return 420 class MyDecWrapper(): def __call__(self, blabla): return MyDec() quopri = codecs.lookup("quopri") quopri._is_text_encoding = True quopri.incrementaldecoder = MyDecWrapper() t = _io.TextIOWrapper(_io.BytesIO(b'aaaaaa'), newline='\n', encoding="quopri") t.read(42) I guess all of these checks should be changed to check whether PyArg_ParseTuple returned 0. also, before this specific call to PyArg_ParseTuple in textiowrapper_read_chunk, we should check whether 'state' is a tuple. Moreover, this call shouldn't produce a wrong error message, as explained in #28261. |
|||
| msg300616 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2017年08月21日 09:13 | |
Do you want to provide a PR Oren? |
|||
| msg300618 - (view) | Author: Oren Milman (Oren Milman) * | Date: 2017年08月21日 10:12 | |
yes, soon. (just wanted to hear your opinion before doing that.) |
|||
| msg300977 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2017年08月29日 08:58 | |
New changeset ba7d7365215d791025d1efd25393c91404f2cfc8 by Serhiy Storchaka (Oren Milman) in branch 'master': bpo-31243: Fixed PyArg_ParseTuple failure checks. (#3171) https://github.com/python/cpython/commit/ba7d7365215d791025d1efd25393c91404f2cfc8 |
|||
| msg300982 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2017年08月29日 12:43 | |
New changeset c7750c2a3af014a5b742d0159d8957ea95b6c221 by Serhiy Storchaka (Oren Milman) in branch '3.6': [3.6] bpo-31243: Fixed PyArg_ParseTuple failure checks. (GH-3171) (#3233) https://github.com/python/cpython/commit/c7750c2a3af014a5b742d0159d8957ea95b6c221 |
|||
| msg300993 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2017年08月29日 16:16 | |
New changeset 20958e6d91d11a80d6c664ce6346791259b1d193 by Serhiy Storchaka (Oren Milman) in branch '2.7': [2.7] bpo-31243: Fixed PyArg_ParseTuple failure checks. (GH-3171) (#3235) https://github.com/python/cpython/commit/20958e6d91d11a80d6c664ce6346791259b1d193 |
|||
| msg300994 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2017年08月29日 16:18 | |
Thank you for your contribution Oren! |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:58:50 | admin | set | github: 75426 |
| 2017年08月29日 16:18:10 | serhiy.storchaka | set | status: open -> closed resolution: fixed messages: + msg300994 stage: backport needed -> resolved |
| 2017年08月29日 16:16:17 | serhiy.storchaka | set | messages: + msg300993 |
| 2017年08月29日 15:05:36 | Oren Milman | set | pull_requests: + pull_request3276 |
| 2017年08月29日 12:43:34 | serhiy.storchaka | set | messages: + msg300982 |
| 2017年08月29日 10:54:58 | Oren Milman | set | pull_requests: + pull_request3275 |
| 2017年08月29日 08:59:37 | serhiy.storchaka | set | stage: needs patch -> backport needed |
| 2017年08月29日 08:58:33 | serhiy.storchaka | set | messages: + msg300977 |
| 2017年08月23日 08:10:16 | serhiy.storchaka | set | nosy:
+ benjamin.peterson, stutzbach components: + IO |
| 2017年08月21日 19:00:57 | Oren Milman | set | pull_requests: + pull_request3208 |
| 2017年08月21日 10:12:45 | Oren Milman | set | messages: + msg300618 |
| 2017年08月21日 09:13:56 | serhiy.storchaka | set | keywords:
+ easy (C) assignee: serhiy.storchaka |
| 2017年08月21日 09:13:26 | serhiy.storchaka | set | versions:
+ Python 2.7, Python 3.6 nosy: + serhiy.storchaka messages: + msg300616 components: + Extension Modules, - Interpreter Core stage: needs patch |
| 2017年08月21日 08:33:08 | Oren Milman | create | |