[issue28129] assertion failures in ctypes

2017-09-28 Thread STINNER Victor

STINNER Victor  added the comment:

Ok, now the issue can be closed :-) I backported Oren Milman's fix to Python 
2.7 and 3.6 as well.

Oren Milman: thank you very much for your fix!

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28129] assertion failures in ctypes

2017-09-28 Thread STINNER Victor

STINNER Victor  added the comment:


New changeset 8b83687bdf66d2d10afb78e46bcede399deaefde by Victor Stinner in 
branch '2.7':
bpo-28129: fix ctypes crashes (#386) (#3800)
https://github.com/python/cpython/commit/8b83687bdf66d2d10afb78e46bcede399deaefde


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28129] assertion failures in ctypes

2017-09-28 Thread STINNER Victor

STINNER Victor  added the comment:


New changeset 7d6ddb96b34b94c1cbdf95baa94492c48426404e by Victor Stinner in 
branch '3.6':
bpo-28129: fix ctypes crashes (#386) (#3799)
https://github.com/python/cpython/commit/7d6ddb96b34b94c1cbdf95baa94492c48426404e


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28129] assertion failures in ctypes

2017-09-28 Thread STINNER Victor

STINNER Victor  added the comment:

> Shouldn't we close this issue?

Oh, I forgot this issue.

Python 2.7 and 3.6 are also impacted and still accept bug fixes. I proposed 
backports.

--
versions: +Python 2.7, Python 3.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28129] assertion failures in ctypes

2017-09-28 Thread STINNER Victor

Change by STINNER Victor :


--
pull_requests: +3786

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28129] assertion failures in ctypes

2017-09-28 Thread STINNER Victor

Change by STINNER Victor :


--
pull_requests: +3785
stage:  -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28129] assertion failures in ctypes

2017-09-28 Thread Oren Milman

Oren Milman  added the comment:

Shouldn't we close this issue?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28129] assertion failures in ctypes

2017-03-24 Thread STINNER Victor

STINNER Victor added the comment:


New changeset 1bea762d9ec823544c530d567330a47f64d93d4f by Victor Stinner 
(orenmn) in branch 'master':
bpo-28129: fix ctypes crashes (#386)
https://github.com/python/cpython/commit/1bea762d9ec823544c530d567330a47f64d93d4f


--
nosy: +haypo

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28129] assertion failures in ctypes

2017-03-02 Thread Christian Heimes

Changes by Christian Heimes :


--
pull_requests: +335

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28129] assertion failures in ctypes

2017-03-01 Thread Oren Milman

Oren Milman added the comment:

The fix for issue #25659 already replaced the assertions in
CDataType_from_buffer and CDataType_from_buffer_copy with if statements (my
bad for missing that issue when I opened this one).
In addition, that fix added some tests, so I also added some, and created a
pull request.

I run the test module again, and on my Windows 10, the same tests failed with
and without my patches. However, on my Ubuntu 16.04 VM, none of the tests
failed.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28129] assertion failures in ctypes

2017-03-01 Thread Roundup Robot

Changes by Roundup Robot :


--
pull_requests: +322

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28129] assertion failures in ctypes

2017-02-22 Thread Vinay Sajip

Changes by Vinay Sajip :


--
nosy: +vinay.sajip

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28129] assertion failures in ctypes

2016-09-13 Thread Oren Milman

Changes by Oren Milman :


Added file: http://bugs.python.org/file44639/patchedCPythonTestOutput_ver1.txt

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28129] assertion failures in ctypes

2016-09-13 Thread Oren Milman

Changes by Oren Milman :


Added file: http://bugs.python.org/file44638/CPythonTestOutput.txt

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28129] assertion failures in ctypes

2016-09-13 Thread Oren Milman

Changes by Oren Milman :


--
keywords: +patch
Added file: http://bugs.python.org/file44637/issue28129_ver1.diff

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28129] assertion failures in ctypes

2016-09-13 Thread Oren Milman

New submission from Oren Milman:

 current state 
In Modules\_ctypes\_ctypes.c, there are six functions with assertions that 
might fail:
1. CDataType_from_buffer
2. CDataType_from_buffer_copy
3. PyCPointerType_set_type
4. PyCPointerType_from_param
5. PyCSimpleType_from_param
6. _validate_paramflags
The following is true for each of these functions:
- It assumes its first argument is a subclass (or an instance of a 
subclass) of some abstract ctype, which means it (the first argument) has a 
storage dict.
- Thus, it asserts its first argument has a storage dict.
- However, its first argument might be some abstract ctype (and not a 
subclass (or an instance of a subclass) of that abstract ctype), in which case 
the assertion fails.

In Modules\_ctypes\cfield.c, there are two functions with assertions that might 
fail:
1. PyCField_set
2. PyCField_get
These functions are the C implementations of the __set__ and __get__ functions 
(respectively) of the CFeild type. Each of them asserts its instance argument 
is a CDataObject, which might not be true.


 proposed changes 
Replace each of these assertions with an if statement that raises an exception 
in case of an invalid argument.


 diff 
The proposed patches diff file is attached.


 tests 
I wrote an ugly script to verify the assertion failures on CPython without my 
patches, and to test the patches on CPython with my patches. The script is 
attached, but it would probably fail on a non-Windows machine.

I built the patched CPython for x86, and played with it a little. Everything 
seemed to work as usual.

In addition, I ran 'python_d.exe -m test -j3' (on my 64-bit Windows 10) with 
and without the patches, and got quite the same output.
The outputs of both runs are attached.

--
components: ctypes
files: testBugsOrPatches.py
messages: 276288
nosy: Oren Milman
priority: normal
severity: normal
status: open
title: assertion failures in ctypes
type: crash
versions: Python 3.7
Added file: http://bugs.python.org/file44636/testBugsOrPatches.py

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com