<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent changes to patches</title><link href="https://sourceforge.net/p/ctypes/patches/" rel="alternate"/><link href="https://sourceforge.net/p/ctypes/patches/feed.atom" rel="self"/><id>https://sourceforge.net/p/ctypes/patches/</id><updated>2010-04-09T22:21:57Z</updated><subtitle>Recent changes to patches</subtitle><entry><title>ctypeslib: Add codegenerator support for volatile types</title><link href="https://sourceforge.net/p/ctypes/patches/20/" rel="alternate"/><published>2010-04-09T22:21:57Z</published><updated>2010-04-09T22:21:57Z</updated><author><name>Michael D Hall</name><uri>https://sourceforge.net/u/mhallsd/</uri></author><id>https://sourceforge.net6f9de46459a84c3759a22bd5fa66107f867f0431</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;When the volatile keyword is used in C code, gccxml uses the type CvQualifiedType. This patch will allow the codegenerator to follow the type field to the true type that is being qualified by the volatile keyword. This change does not cause the generated python code to treat this variable any different but I doubt that such a distention makes any sense.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>for code generator to enable #define'd double constants</title><link href="https://sourceforge.net/p/ctypes/patches/19/" rel="alternate"/><published>2008-10-18T22:32:21Z</published><updated>2008-10-18T22:32:21Z</updated><author><name>guyster</name><uri>https://sourceforge.net/u/guyster/</uri></author><id>https://sourceforge.net69d5f4b97215159dd878adf0fcc763353c9397d6</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;The code generator doesn't handle any #defined constants with doubles. The patch contains a fix for the generator as well as coverage for the unit tests.&lt;/p&gt;
&lt;p&gt;The patch is applied against the ctypeslib-gccxml-0.9 branch, but might similarly work also against trunk.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>import ctypes fails on OS X</title><link href="https://sourceforge.net/p/ctypes/patches/18/" rel="alternate"/><published>2007-03-02T10:09:44Z</published><updated>2007-03-02T10:09:44Z</updated><author><name>Scott F. Johnston</name><uri>https://sourceforge.net/u/sfj/</uri></author><id>https://sourceforge.netbc92773b8d16695c9af04adc5273d2e8806e7457</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Trying to get ctypes to work on a stock MacBook Pro. (Python 2.3)&lt;/p&gt;
&lt;p&gt;easy_install fails due to dead links to starship.python.net.&lt;br /&gt;
Version 1.0.1 from sourceforge builds and installs, but does not import:&lt;/p&gt;
&lt;p&gt;if gestalt.gestalt("sysv") &amp;lt; 0x1040:&lt;br /&gt;
MacOS.Error: (-5551, 'undefined selector was passed to Gestalt')&lt;/p&gt;
&lt;p&gt;That's not a very friendly response.&lt;/p&gt;
&lt;p&gt;As I'm running 10.4.8, I've just commented out those lines.&lt;br /&gt;
However, this should be corrected in ctypes.&lt;/p&gt;
&lt;p&gt;--S&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>ctypeslib: loading libraries to resolve missing references</title><link href="https://sourceforge.net/p/ctypes/patches/17/" rel="alternate"/><published>2007-02-28T11:47:24Z</published><updated>2007-02-28T11:47:24Z</updated><author><name>Michal J. Gajda</name><uri>https://sourceforge.net/u/korek/</uri></author><id>https://sourceforge.net0f48ba0350c492f6102990aa936a28b95bd8b21c</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;The patch below adds the --preload option to resolve missing references from DLLs.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>ctypeslib handling simple variables</title><link href="https://sourceforge.net/p/ctypes/patches/16/" rel="alternate"/><published>2007-02-28T11:44:55Z</published><updated>2007-02-28T11:44:55Z</updated><author><name>Michal J. Gajda</name><uri>https://sourceforge.net/u/korek/</uri></author><id>https://sourceforge.nete714e00e4ac7dd2757d325ce4d9f5be0f4003924</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;xml2py.py doesn't seem to generate code for uninitialized variables. Since&lt;br /&gt;
it may be crucial for library interface (see errno.h), I attach the crude&lt;br /&gt;
patch that does that.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>doc fixes</title><link href="https://sourceforge.net/p/ctypes/patches/15/" rel="alternate"/><published>2007-01-15T21:45:14Z</published><updated>2007-01-15T21:45:14Z</updated><author><name>Tim Mitchell</name><uri>https://sourceforge.net/u/tim-mitchell/</uri></author><id>https://sourceforge.net14b7789fd584fe64f10b61f23c0ee343bdfb06d8</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Mostly changes in tutorials - mainly grammer and prose.&lt;br /&gt;
Also fixed a mistake in the reference manual for the in_dll method - args were reversed.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Python API declarations</title><link href="https://sourceforge.net/p/ctypes/patches/14/" rel="alternate"/><published>2006-12-21T04:28:22Z</published><updated>2006-12-21T04:28:22Z</updated><author><name>Lenard Lindstrom</name><uri>https://sourceforge.net/u/kermode/</uri></author><id>https://sourceforge.netb761c0e02c329e567e1702b1f14ad404e60c4253</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;The is a python module, pythonhdr.py, which declares several, hopefully useful, Python C API declarations and functions. Also includes is a unit test.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Handle borrowed and stolen references</title><link href="https://sourceforge.net/p/ctypes/patches/13/" rel="alternate"/><published>2006-11-24T21:33:49Z</published><updated>2006-11-24T21:33:49Z</updated><author><name>Lenard Lindstrom</name><uri>https://sourceforge.net/u/kermode/</uri></author><id>https://sourceforge.net29dd369fc3559de6ae7eab28b48ffedb8755647d</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;This patch creates a new C type, py_object_incref, for use as a return type for pythonapi functions that borrow a reference and as an argument for functions that steal a reference. py_object_incref cannot be instantiated or used as a structure field. As side benefits a CDataType subclass now accepts an optional _flags_ attribute to set selected stgdict flag fields and a new flag is defined to prevent a C type from being a structure field.&lt;/p&gt;
&lt;p&gt;The patch is applied to ctypes 1.0.1 release. It alters files _ctypes.c, ctypes.h, cfield.c, stgdict.c,__init__.py . The patch includes a new unit test test_py_object_incref.py . The following invocation of GNU patch 2.5 from the directory containing ctypes-1.0.1 seems to work:&lt;/p&gt;
&lt;p&gt;patch -p0 &amp;lt;py_object_incref.diff&lt;/p&gt;
&lt;p&gt;The patch has only been tested with MSVC 6 and Python 2.3. The following Python session is a usage example.&lt;/p&gt;
&lt;p&gt;Python 2.3.5 (#62, Feb  8 2005, 16:23:02) [MSC v.1200 32 bit (Intel)] on win32&lt;br /&gt;
Type "help", "copyright", "credits" or "license" for more information.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from ctypes import *&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; py_object_incref._type_&lt;br /&gt;
'o'&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; py_object_incref._flags_&lt;br /&gt;
256&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; # Borrowed reference&lt;br /&gt;
...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; PyList_GetItem = pythonapi.PyList_GetItem&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; PyList_GetItem.restype = py_object_incref&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; PyList_GetItem.argtypes = [py_object, c_int]&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; PyList_GetItem([1, 2, 3], 1)&lt;br /&gt;
2&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; # Stolen reference&lt;br /&gt;
...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; PyList_SetItem = pythonapi.PyList_SetItem&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; PyList_SetItem.argtypes = [py_object, c_int, py_object_incref]&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; x = [1, 2, 3]&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; PyList_SetItem(x, 2, 5)&lt;br /&gt;
0&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; x&lt;br /&gt;
[1, 2, 5]&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; # py_object_incref instances and fields not allowed&lt;br /&gt;
...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; py_object_incref(None)&lt;br /&gt;
Traceback (most recent call last):&lt;br /&gt;
File "&amp;lt;stdin&amp;gt;", line 1, in ?&lt;br /&gt;
File "C:\prg\ctypes-1.0.1\ctypes\__init__.py", line 148, in __new__&lt;br /&gt;
_type_ = "H"&lt;br /&gt;
NotImplementedError: py_object_incref for argument and return types only.&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; class S(Structure):&lt;br /&gt;
...     _fields_ = ('o', py_object_incref),&lt;br /&gt;
...&lt;br /&gt;
Traceback (most recent call last):&lt;br /&gt;
File "&amp;lt;stdin&amp;gt;", line 1, in ?&lt;br /&gt;
TypeError: field 0 must be an allowed C type: got py_object_incref instead&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>missing imports in documentation examples</title><link href="https://sourceforge.net/p/ctypes/patches/12/" rel="alternate"/><published>2006-09-13T12:32:36Z</published><updated>2006-09-13T12:32:36Z</updated><author><name>Daniele Varrazzo</name><uri>https://sourceforge.net/u/dvarrazzo/</uri></author><id>https://sourceforge.net816d2efeaa716b43325973df026708138bc76582</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;The attached patch fixes a couple of missing imports in&lt;br /&gt;
documentation examples. Original is from r51868.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>byref_at for returning references to array elements</title><link href="https://sourceforge.net/p/ctypes/patches/11/" rel="alternate"/><published>2006-08-14T01:01:20Z</published><updated>2006-08-14T01:01:20Z</updated><author><name>Shane Holloway</name><uri>https://sourceforge.net/u/userid-283742/</uri></author><id>https://sourceforge.net6a40fdfaa6a37be24528ca0dee2457ffa9b802b5</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Implements a simple way to return references to array elements.  Allows &lt;br /&gt;
the following C code::&lt;/p&gt;
&lt;p&gt;// from the OpenGL Programming Guide (Red Book), Fifth Edition, pp &lt;br /&gt;
455&lt;br /&gt;
glTexGenfv(GL_T, GL_OBJECT_PLANE, &amp;amp;tmpMatrix[4]);&lt;/p&gt;
&lt;p&gt;To be written in ctypes like::&lt;/p&gt;
&lt;p&gt;glTexGenfv(GL_T, GL_OBJECT_PLANE, byref_at(tmpMatrix, 4))&lt;/p&gt;
&lt;p&gt;Instead of::&lt;/p&gt;
&lt;p&gt;p = cast(tmpMatrix, c_void_p)&lt;br /&gt;
p.value += sizeof(tmpMatrix._type_) * 4&lt;br /&gt;
glTexGenfv(GL_T, GL_OBJECT_PLANE, cast(p, c_float_p))&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>