[issue25498] Python 3.4.3 core dump with simple sample code

2015-11-13 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Great! The patch LGTM. I left only two minor suggestions on Rietveld. -- stage: patch review -> commit review ___ Python tracker

[issue25498] Python 3.4.3 core dump with simple sample code

2015-11-12 Thread Martin Panter
Martin Panter added the comment: New patch with Fortran array test, and read-only and reversed memoryview() tests. -- Added file: http://bugs.python.org/file41025/ctypes_from_buffer_4.patch ___ Python tracker

[issue25498] Python 3.4.3 core dump with simple sample code

2015-11-10 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Added new comments on Rietveld. Would be nice to add tests for read-only and non-contiguous buffers. eryksun, what is your real name? What we have to add in the Misc/ACKS file? -- ___ Python tracker

[issue25498] Python 3.4.3 core dump with simple sample code

2015-11-10 Thread Martin Panter
Martin Panter added the comment: I propose this patch, based on Eryksun’s patch (thanks Eryksun). New changes: * Added test case * Applied Serhiy’s review suggestion * Changed the new BufferError exceptions back to TypeError to match previous behaviour and test cases -- nosy: +eryksun

[issue25498] Python 3.4.3 core dump with simple sample code

2015-11-04 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- assignee: serhiy.storchaka -> ___ Python tracker ___

[issue25498] Python 3.4.3 core dump with simple sample code

2015-11-02 Thread Martin Panter
Martin Panter added the comment: I tend to agree with Serhiy about Eryksun’s patch. I understand it solves the current problem, and continues to protect against this scenario: >>> b = bytearray(b"a") >>> c = ctypes.c_char.from_buffer(b) >>> b *= 1000 BufferError: Existing exports of data:

[issue25498] Python 3.4.3 core dump with simple sample code

2015-10-31 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I rather inclined to commit eryksun's patch. -- ___ Python tracker ___

[issue25498] Python 3.4.3 core dump with simple sample code

2015-10-31 Thread Stefan Krah
Stefan Krah added the comment: The current hack isn't necessary. I didn't review eryksun's patch in depth, but on the surface it looks good. I don't think the other issues you mentioned are closely related: The cause here is that the obj fields of both the second memoryview and the second mbuf

[issue25498] Python 3.4.3 core dump with simple sample code

2015-10-30 Thread Stefan Krah
Stefan Krah added the comment: Per the docs the readonly flag must be consistent for all consumers, so checking for writability after getting the view should be okay in principle. -- ___ Python tracker

[issue25498] Python 3.4.3 core dump with simple sample code

2015-10-30 Thread Martin Panter
Martin Panter added the comment: Okay, so says writability must be consistent. As far as I can see, there is no similar requirement for contiguity. So in theory PyBUF_FULL_RO could produce a discontiguous buffer when

[issue25498] Python 3.4.3 core dump with simple sample code

2015-10-30 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Before committing any solution we first should have understood the cause of the crash. The peculiarity of example ctypes_crash.py is that the argument of ctypes.c_char.from_buffer is a memoryview. With current code we have following chain (the list creates

[issue25498] Python 3.4.3 core dump with simple sample code

2015-10-30 Thread Stefan Krah
Stefan Krah added the comment: If memoryview B is created from memoryview A, then B must be registered with the same ManagedBuffer as A, otherwise the whole scheme breaks down (PyMemoryView_FromObject() performs this check). PyMemoryView_FromBuffer() is really a legacy function that should be

[issue25498] Python 3.4.3 core dump with simple sample code

2015-10-29 Thread Stefan Krah
Stefan Krah added the comment: We should ultimately do something like I suggested in msg235256. Everything else is a hack (N.B.: the issues that 1da9630e9b7f tried to fix were also hacks, so it isn't really the fault of that commit). -- nosy: +skrah

[issue25498] Python 3.4.3 core dump with simple sample code

2015-10-29 Thread Martin Panter
Martin Panter added the comment: Before the Issue 22896 changes, PyObject_AsWriteBuffer() was used, which requests a buffer with the PyBUF_WRITABLE flag. Currently we use “w*” argument parsing format, which also uses PyBUF_WRITABLE. (Incidentally, I suspect the C-contiguity check is redundant

[issue25498] Python 3.4.3 core dump with simple sample code

2015-10-29 Thread eryksun
Changes by eryksun : Added file: http://bugs.python.org/file40890/ctypes_from_buffer_2.patch ___ Python tracker ___

[issue25498] Python 3.4.3 core dump with simple sample code

2015-10-29 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- assignee: -> serhiy.storchaka priority: normal -> high stage: needs patch -> patch review ___ Python tracker

[issue25498] Python 3.4.3 core dump with simple sample code

2015-10-28 Thread Jake Montgomery
New submission from Jake Montgomery: We are seeing a consistent "invalid memory access" crash in Python3.4.3. *Test setup* This is occurring on Ubuntu 14.04.1 LTS. It is occurring on multiple unrelated installs, but has not been tested with any other operating system. It occurs using the

[issue25498] Python 3.4.3 core dump with simple sample code

2015-10-28 Thread R. David Murray
R. David Murray added the comment: The program does not crash for me on gentoo running python 3.4 tip (--with-pydebug). It does crash running gentoo's stock 3.4.3. So, perhaps this bug has already been fixed. -- nosy: +r.david.murray ___ Python

[issue25498] Python 3.4.3 core dump with simple sample code

2015-10-28 Thread eryksun
Changes by eryksun : -- keywords: +patch Added file: http://bugs.python.org/file40884/ctypes_from_buffer_1.patch ___ Python tracker

[issue25498] Python 3.4.3 core dump with simple sample code

2015-10-28 Thread eryksun
Changes by eryksun : Added file: http://bugs.python.org/file40883/ctypes_crash.py ___ Python tracker ___

[issue25498] Python 3.4.3 core dump with simple sample code

2015-10-28 Thread eryksun
Changes by eryksun : Removed file: http://bugs.python.org/file40884/ctypes_from_buffer_1.patch ___ Python tracker ___

[issue25498] Python 3.4.3 core dump with simple sample code

2015-10-28 Thread Martin Panter
Martin Panter added the comment: Crashes on Linux x86-64 for me with and without --with-pydebug, with the default 3.6 branch, 3.5.0, and 3.4 tip. No extra debugging output though in the --with-pydebug cases though. -- nosy: +martin.panter ___

[issue25498] Python 3.4.3 core dump with simple sample code

2015-10-28 Thread Martin Panter
Martin Panter added the comment: I traced this down to part of revision 1da9630e9b7f (Issue #22896). If I revert the changes to CDataType_from_buffer() at , the crash no longer happens. I suspect the offending code is this, that is trying