gh-146615: Fix error message in method_get for invalid type argument#146634
gh-146615: Fix error message in method_get for invalid type argument#146634serhiy-storchaka merged 5 commits intopython:mainfrom
Conversation
serhiy-storchaka
left a comment
There was a problem hiding this comment.
Please add a test and a NEWS entry.
Lib/test/test_descr.py
Outdated
| # METH_METHOD|METH_FASTCALL|METH_KEYWORDS is the only flag combination | ||
| # that enters the affected branch in method_get(). | ||
|
|
||
| import xxlimited |
There was a problem hiding this comment.
It could be tested without the use of the optional xxlimited module. For example:
array.array.extend.__get__(array.array('I'), 'not_a_type')
Of course, using METH_METHOD|METH_FASTCALL|METH_KEYWORDS in the implementation of array.array.extend is CPython specific, so you can try several other classes and methods in hope that they are implemented in such way. If none of them raises a TypeError, then skip the test (skipTest()). Or maybe mark the test CPython-only?
There was a problem hiding this comment.
mark the test CPython-only?
I think this is reasonable. This problem only occurs in C modules. It cannot trigger in pure Python code.
I checked
array.array.extend.__get__(array.array('I'), 'not_a_type')will not raise error in Pypy.
|
LGTM. 👍 |
|
Thanks @sunmy2019 for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14. |
|
GH-146647 is a backport of this pull request to the 3.14 branch. |
…ith invalid type argument (pythonGH-146634) (cherry picked from commit 72d29ea) Co-authored-by: sunmy2019 <59365878+sunmy2019@users.noreply.github.com>
…ith invalid type argument (pythonGH-146634) (cherry picked from commit 72d29ea363f1515115753653aeca735a1a817a7f) Co-authored-by: sunmy2019 <59365878+sunmy2019@users.noreply.github.com>
|
GH-146648 is a backport of this pull request to the 3.13 branch. |
* main: pythongh-145458: use `self.skip_idle` consistently in the tachyon profiler (python#145459) pythongh-146615: Fix format specifiers in Objects/ directory (pythonGH-146620) pythongh-146615: Fix format specifiers in Python/ directory (pythonGH-146619) pythongh-146615: Fix format specifiers in test cextensions (pythonGH-146618) pythongh-146615: Fix format specifiers in extension modules (pythonGH-146617) pythongh-146615: Fix crash in __get__() for METH_METHOD descriptors with invalid type argument (pythonGH-146634) pythongh-146376: Reduce timeout in Emscripten GHA workflow (python#146378) pythongh-146442: Fix various bugs in compiler pipeline (python#146443) pythongh-146238: Support half-floats in the array module (python#146242) pythongh-145056: Add support for merging collections.UserDict and frozendict (pythonGH-146465) pythongh-145056: Fix merging of collections.OrderedDict and frozendict (pythonGH-146466) pythongh-139633: Run netrc file permission check only once per parse (pythonGH-139634)
Uh oh!
There was an error while loading. Please reload this page.