Uh oh!
There was an error while loading. Please reload this page.
gh-46376: add (failing) tests for ctypes/pointer/cast/set_contents - #108519
gh-46376: add (failing) tests for ctypes/pointer/cast/set_contents#108519code-of-kpp wants to merge 1 commit into
Conversation
ambv
commented
Aug 26, 2023
The previous fix was only reverted for 3.11 so we could release 3.11.5. The rest isn't in such a hurry so I hope we can fix it forward instead. |
2a2cf53 to
9a6b23aCompareI'm planning to fix it yes, but I'd like the tests to be merged first, if you agree that it's reasonable |
5cf867d to
a84b664Comparecode-of-kpp
commented
Aug 27, 2023
There are too many moving parts:
The biggest bug right now seems to be that Another shortcut, would be to take my original idea, look into |
3e346a8 to
5dbb4aeCompared44a269 to
b6e92baComparePrevious attempt to fixpythongh-46376 was incomplete and overall it didn't succeed, and was reverted in 3.11. However, we have discovered some dangerous issues with ctypes, that aren't fixed or documented anywhere. This commit adds tests (@expectedfailure) so at least developers are aware of situations where memory might be corrupted, leaked or when changing a pointer value might have no effect. Hopefully, we should be able to remove @expectedfailure in the future, with new shiny ctypes implementation or at least a bugfix.
b6e92ba to
0116633Compareencukou
commented
Jul 18, 2024
Hi, Would you mind adding only the tests that succeed? There's quite a few of those here. |
| @@ -1,8 +1,10 @@ | |||
| import gc | |||
There was a problem hiding this comment.
Move this one after ctypes (for sorting imports).
| class Struct(Structure): | ||
| _fields_ = [("a", POINTER(c_int))] | ||
| x = Struct(a=pointer(w.setdefault(23,c_int(23)))) |
There was a problem hiding this comment.
| x=Struct(a=pointer(w.setdefault(23,c_int(23)))) | |
| x=Struct(a=pointer(w.setdefault(23,c_int(23)))) |
| self.assertEqual(x._objects, {'1': i}) | ||
| @unittest.expectedFailure # gh-46376, gh-107131, gh-107940, gh-108222 | ||
| def test_pp_ownership(self): |
There was a problem hiding this comment.
Is it possible to instead have a huge expectedFailure, to correctly detect where it is failing instead? Because among the assert* calls, I don't know which of these is the one that should actually fail (same question for all the other expected failures).
This PR is stale because it has been open for 30 days with no activity. |
Previous attempt to fixgh-46376 was incomplete and overall it didn't succeed, and was reverted. However, we have discovered some dangerous issues with ctypes, that aren't fixed or documented anywhere.
This commit adds tests (@expectedfailure) so at least developers are aware of situations where memory might be corrupted, leaked or when changing a pointer value might have no effect.
Hopefully, we should be able to remove @expectedfailure in the future, with new shiny ctypes implementation or at least a bugfix.
/cc @ambv