[issue13797] Allow objects implemented in pure Python to export PEP 3118 buffers

2013-08-16 Thread Lenard Lindstrom
Lenard Lindstrom added the comment: A fourth way to add __getbuffer__ and __releasebuffer__ special methods to a Python class is through a new base class/mixin. The Py_buffer struct pointer passed to __getbuffer__ and __releasebuffer__ is wrapped with another special object type, which

[issue10181] Problems with Py_buffer management in memoryobject.c (and elsewhere?)

2011-08-09 Thread Lenard Lindstrom
Changes by Lenard Lindstrom : -- nosy: -kermode ___ Python tracker <http://bugs.python.org/issue10181> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue10181] Problems with Py_buffer management in memoryobject.c (and elsewhere?)

2011-06-27 Thread Lenard Lindstrom
Lenard Lindstrom added the comment: It would if the proposed PyManagedBuffer only releases the Py_buffer struct - calls PyBuffer_Release - when its Python reference count goes to zero. So a separate reference count will be maintained instead

[issue10181] Problems with Py_buffer management in memoryobject.c (and elsewhere?)

2011-06-27 Thread Lenard Lindstrom
Lenard Lindstrom added the comment: Using Python reference counting and the garbage collector to control when PyBuffer_Release is called has problems. First, it assumes the CPython interpreter will always use reference counting. Second, PyBuffer_Release may never get called if circular

[issue9990] PyMemoryView_FromObject alters the Py_buffer after calling PyObject_GetBuffer when ndim 1

2011-02-07 Thread Lenard Lindstrom
Lenard Lindstrom added the comment: I think only a simple solution is needed. From my experience adding the new buffer protocol to pygame.mixer.Sound it would be easy enough for bf_releasebuffer to use the "internal" field to free memory allocated by bf_getbuffer. As long as this

[issue10181] Problems with Py_buffer management in memoryobject.c (and elsewhere?)

2011-01-04 Thread Lenard Lindstrom
Changes by Lenard Lindstrom : -- nosy: +kermode ___ Python tracker <http://bugs.python.org/issue10181> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue9990] PyMemoryView_FromObject alters the Py_buffer after calling PyObject_GetBuffer when ndim 1

2010-10-01 Thread Lenard Lindstrom
Lenard Lindstrom added the comment: Applied patch to: Python 3.2a2+ (py3k:85150M, Oct 1 2010, 14:40:33) [GCC 4.4.5 20100728 (prerelease)] on linux2 Python unit test test_capi.py crashes: internal test_broken_memoryview * ob object : type: str refcount: 0 address : 0xb7171178 * op

[issue10001] ~Py_buffer.obj field is undocumented, though not hidden

2010-10-01 Thread Lenard Lindstrom
Lenard Lindstrom added the comment: This will work for bf_getbuffer, though having PyObject_GetBuffer set the obj field before passing it to the callback might be safer. Also, this does not address the case with wrapper types like memoryview. What happens if ~Py_buffer.obj is not visited in

[issue10001] ~Py_buffer.obj field is undocumented, though not hidden

2010-09-30 Thread Lenard Lindstrom
New submission from Lenard Lindstrom : Python 3.2a2+ (py3k:85072M, Sep 29 2010, 12:11:17) (from SVN) [GCC 4.4.5 20100728 (prerelease)] on linux2 (Debian squeeze) The ~Py_buffer.obj field is undocumented. Yet memoryview, that acts as a wrapper, includes the field in gc traversal. Also, if the

[issue9990] PyMemoryView_FromObject alters the Py_buffer after calling PyObject_GetBuffer when ndim 1

2010-09-29 Thread Lenard Lindstrom
New submission from Lenard Lindstrom : If an exporter returns a Py_buffer with ndim 1, PyMemoryView_FromObject changes the shape and strides pointer fields to point to a local Py_buffer array field. This array field is undocumented. Any heap memory these pointers reference is lost. Should the

[issue9602] PyObject_AsCharBuffer() should only accept read-only objects

2010-09-28 Thread Lenard Lindstrom
Lenard Lindstrom added the comment: That is perfectly fine with me. -- ___ Python tracker <http://bugs.python.org/issue9602> ___ ___ Python-bugs-list mailin

[issue9602] PyObject_AsCharBuffer() should only accept read-only objects

2010-09-28 Thread Lenard Lindstrom
Lenard Lindstrom added the comment: >I don't know why you're saying that. The purpose of PyBuffer_Release is >precisely to solve these kinds of use cases (where you want timely >release of a resource rather than rely on the garbage collector). Yes, I was unclear. This refers

[issue9602] PyObject_AsCharBuffer() should only accept read-only objects

2010-09-27 Thread Lenard Lindstrom
Lenard Lindstrom added the comment: PEP 3118 """ Rationale ... 3) There is no way for a consumer to tell the buffer-API-exporting object it is "finished" with its view of the memory and therefore no way for the exporting object to be sure that it is safe to real

[issue1800] ctypes callback fails when called in Python with array argument

2010-09-20 Thread Lenard Lindstrom
Lenard Lindstrom added the comment: I have checked over the proposed patch and made a small change that more elegantly obtains PyCArrayType. Decaying arrays into pointers is not an ideal solution. Ctypes arrays have bounds checking (pointers do not) adding an extra margin of safety when a C

[issue1800] ctypes callback fails when called in Python with array argument

2010-09-19 Thread Lenard Lindstrom
Lenard Lindstrom added the comment: I will check it out. -- ___ Python tracker <http://bugs.python.org/issue1800> ___ ___ Python-bugs-list mailing list Unsub

[issue2698] Extension module build fails for MinGW: missing vcvarsall.bat

2009-08-04 Thread Lenard Lindstrom
Lenard Lindstrom added the comment: Here is the build with Python 2.6.2. It works now. C:\pygame\bug2698>python setup.py build --compiler=mingw32 --verbose running build running build_ext building 'simple' extension creating build creating build\temp.win32-2.6 creating build\t

[issue3440] Starting any program as a subprocess fails when subprocess.Popen has env argument

2009-04-12 Thread Lenard Lindstrom
Lenard Lindstrom added the comment: notepad.exe forms a side-by-side assembly with COMCTL32.DLL. So SystemRoot must be included in the environment. The following example works with Python 2.5.2 on Windows XP. === import struct

[issue3440] Starting any program as a subprocess fails when subprocess.Popen has env argument

2009-04-09 Thread Lenard Lindstrom
Lenard Lindstrom added the comment: The notepad example works with Pythons 2.4.4 and 2.5.4 on Windows 98. So something changed in Windows XP. The 0xc0150004 error code crops up when a side-by-side assembly fails to load. The DLL loader appears to use the SystemRoot environment variable to find

[issue4793] Glossary incorrectly describes a decorator as "merely syntactic sugar"

2008-12-31 Thread Lenard Lindstrom
Lenard Lindstrom added the comment: The claim "merely" syntactic sugar implies that the inverse is also true, the decorator expression: @do_something def foo(): can be replaced it with: def foo(): foo = do_something(foo) This is guaranteed if do_something

[issue4793] Glossary incorrectly describes a decorator as "merely syntactic sugar"

2008-12-31 Thread Lenard Lindstrom
Lenard Lindstrom added the comment: It is distinct behavior. Without a decorator a new function is immediately assigned to the identifier. Any previous reference is lost. A decorator postpones assignment until the decorator returns. That allows the decorator to access the previous object. I

[issue4793] Glossary incorrectly describes a decorator as "merely syntactic sugar"

2008-12-31 Thread Lenard Lindstrom
New submission from Lenard Lindstrom : http://www.python.org/doc/2.6/glossary.html The decorator entry in the Python 2.6 documentation incorrectly describes a decorator as "merely syntactic sugar". It is not, as this example shows: >>> def decorator(f): f.prev = g

[issue3440] Starting Python as a subprocess fails when subprocess.Popen has env argument

2008-07-24 Thread Lenard Lindstrom
New submission from Lenard Lindstrom <[EMAIL PROTECTED]>: Python 2.6b2 (r26b2:65106, Jul 18 2008, 18:22:27) [MSC v.1500 32 bit (Intel)] on win32 Windows XP Professional, SP 2 Library class subprocess.Popen When subprocess.Popen is used to start the python interpreter as a subprocess

[issue2698] Extension module build fails for MinGW: missing vcvarsall.bat

2008-04-26 Thread Lenard Lindstrom
New submission from Lenard Lindstrom <[EMAIL PROTECTED]>: Python 2.6a2 on Windows XP Distutils fails to build an extension module for MinGW. Even though mingw32 is specified as the compiler distutils.msvc9compiler is still loaded and it cannot find vcvarsall.bat. Here is an e

[issue2683] subprocess.Popen.communicate takes bytes, not str

2008-04-24 Thread Lenard Lindstrom
New submission from Lenard Lindstrom <[EMAIL PROTECTED]>: subprocess.Popen.communicate is documented as taking a string as the input argument. Instead is accepts only a binary stream (bytes). Python 3.0a4 (r30a4:62126, Apr 3 2008, 15:34:18) [MSC v.1500 32 bit (Intel)] on win32 Type

[issue2234] cygwinccompiler.py fails for latest MinGW releases.

2008-04-01 Thread Lenard Lindstrom
Lenard Lindstrom <[EMAIL PROTECTED]> added the comment: distutils.version.StrictVersion.parse does not handle x.y.z.n . That is why there is an exception. I have tested the patch both with binutils-2.18.50-20080109 (*), the latest version (a "Technology Preview"), and its pred

[issue2234] cygwinccompiler.py fails for latest MinGW releases.

2008-03-04 Thread Lenard Lindstrom
New submission from Lenard Lindstrom: The cygwinccompiler.py module for distutils on Pythons 2.5 and 2.4 fails with an exception for the latest MinGW tools. running build_ext Traceback (most recent call last): File "setup.py", line 224, in setup(**PACKAGEDATA) File "C:\P

[issue2056] install command rejects --compiler option

2008-02-09 Thread Lenard Lindstrom
Lenard Lindstrom added the comment: Yes, "setup.py build --compiler=mingw32 install" works. It is good enough for me. __ Tracker <[EMAIL PROTECTED]> <http://bugs.p

[issue2056] install command rejects --compiler option

2008-02-09 Thread Lenard Lindstrom
New submission from Lenard Lindstrom: The install command returns the following error when the --compiler option is provided on the command line: >python setup.py install --compiler=mingw32 usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...] or: setup.py --help [cmd1 c

[issue1800] ctypes callback fails when called in Python with array argument

2008-01-11 Thread Lenard Lindstrom
New submission from Lenard Lindstrom: When a callback is created with an array argument and then is called from Python the callback function receives an array full of garbage. Here is an example: Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit (Intel)] on win32 Type "