[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 le...@telus.net: -- nosy: -kermode ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10181 ___ ___ Python-bugs-list

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

2011-06-27 Thread Lenard Lindstrom
Lenard Lindstrom le...@telus.net 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

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

2011-06-27 Thread Lenard Lindstrom
Lenard Lindstrom le...@telus.net 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

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

2011-02-07 Thread Lenard Lindstrom
Lenard Lindstrom le...@telus.net 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

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

2011-01-04 Thread Lenard Lindstrom
Changes by Lenard Lindstrom le...@telus.net: -- nosy: +kermode ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10181 ___ ___ Python-bugs-list

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

2010-10-01 Thread Lenard Lindstrom
Lenard Lindstrom le...@telus.net 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

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

2010-10-01 Thread Lenard Lindstrom
Lenard Lindstrom le...@telus.net 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 : refcnt 0 at 0xb7171178 type: str

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

2010-09-30 Thread Lenard Lindstrom
New submission from Lenard Lindstrom le...@telus.net: 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

[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 le...@telus.net: 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

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

2010-09-28 Thread Lenard Lindstrom
Lenard Lindstrom le...@telus.net 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-28 Thread Lenard Lindstrom
Lenard Lindstrom le...@telus.net added the comment: That is perfectly fine with me. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9602

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

2010-09-27 Thread Lenard Lindstrom
Lenard Lindstrom le...@telus.net 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 reallocate the pointer

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

2010-09-20 Thread Lenard Lindstrom
Lenard Lindstrom le...@telus.net 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

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

2010-09-19 Thread Lenard Lindstrom
Lenard Lindstrom le...@telus.net added the comment: I will check it out. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1800 ___ ___ Python-bugs

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

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

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

2009-04-12 Thread Lenard Lindstrom
Lenard Lindstrom le...@telus.net 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

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

2009-04-09 Thread Lenard Lindstrom
Lenard Lindstrom le...@telus.net 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

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

2008-12-31 Thread Lenard Lindstrom
New submission from Lenard Lindstrom le...@telus.net: 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 = globals()[f

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

2008-12-31 Thread Lenard Lindstrom
Lenard Lindstrom le...@telus.net 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

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

2008-12-31 Thread Lenard Lindstrom
Lenard Lindstrom le...@telus.net 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

[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 example: Microsoft

[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 help

[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 predecessor binutils

[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 cmd2

[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.python.org/issue2056

[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 help