<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Thomas Brox R&#248;st &#187; pytst</title>
	<atom:link href="http://thomas.broxrost.com/category/pytst/feed/" rel="self" type="application/rss+xml" />
	<link>http://thomas.broxrost.com</link>
	<description></description>
	<lastBuildDate>Tue, 04 May 2010 13:55:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Running pytst 1.15 on a 64-bit platform</title>
		<link>http://thomas.broxrost.com/2009/01/25/running-pytst-115-on-a-64-bit-platform/#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed</link>
		<comments>http://thomas.broxrost.com/2009/01/25/running-pytst-115-on-a-64-bit-platform/#comments</comments>
		<pubDate>Sat, 24 Jan 2009 23:49:43 +0000</pubDate>
		<dc:creator>Thomas Brox Røst</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[pytst]]></category>

		<guid isPermaLink="false">http://thomas.broxrost.com/?p=130</guid>
		<description><![CDATA[Update: The latest version, 1.17, compiles on 64-bit platforms out of the box, so the patch below is no longer necessary. Nicolas Lehuen&#8217;s pytst is a C++ ternary search tree implementation with a Python interface. It&#8217;s an excellent tool&#8212;and it is also really, really fast. Unfortunately version 1.15 doesn&#8217;t compile on 64-bit platforms, giving the [...]]]></description>
			<content:encoded><![CDATA[<p><b>Update: The latest version, 1.17, compiles on 64-bit platforms out of the box, so the patch below is no longer necessary.</b></p>
<p>Nicolas Lehuen&#8217;s <a href="http://nicolas.lehuen.com/download/pytst/">pytst</a> is a C++ ternary search tree implementation with a Python interface. It&#8217;s an excellent tool&mdash;and it is also really, really fast.</p>
<p>Unfortunately version 1.15 doesn&#8217;t compile on 64-bit platforms, giving the following error messages:</p>
<pre class="brush: bash">
pythonTST.h:178: error: cannot convert &#039;int*&#039; to &#039;Py_ssize_t*&#039; for argument &#039;3&#039;
to &#039;int PyString_AsStringAndSize(PyObject*, char**, Py_ssize_t*)&#039;
tst_wrap.cxx: In function &#039;PyObject* _wrap__TST_walk__SWIG_1(PyObject*, int, PyO
bject**)&#039;:
tst_wrap.cxx:3175: error: cannot convert &#039;int*&#039; to &#039;Py_ssize_t*&#039; for argument &#039;3
&#039; to &#039;int PyString_AsStringAndSize(PyObject*, char**, Py_ssize_t*)&#039;
tst_wrap.cxx: In function &#039;PyObject* _wrap__TST_close_match(PyObject*, PyObject*
)&#039;:
tst_wrap.cxx:3250: error: cannot convert &#039;int*&#039; to &#039;Py_ssize_t*&#039; for argument &#039;3
&#039; to &#039;int PyString_AsStringAndSize(PyObject*, char**, Py_ssize_t*)&#039;
tst_wrap.cxx: In function &#039;PyObject* _wrap__TST_prefix_match(PyObject*, PyObject
*)&#039;:
[...and so on...]
</pre>
<p>Until Nicolas releases an updated version, here is the quick fix:</p>
<pre class="brush: python">
cp pythonTST.h pythonTST.h.orig
cp tst_wrap.cxx tst_wrap.cxx.orig
sed -r &#039;s/int size/Py_ssize_t size/&#039; &lt; tst_wrap.cxx.orig &gt; tst_wrap.cxx
sed -r &#039;s/int length/Py_ssize_t length/&#039; &lt; pythonTST.h.orig &gt; tmpfile
sed -r &#039;s/sizeof\(int\)/sizeof(long)/&#039; &lt; tmpfile &gt; pythonTST.h
</pre>
<p>Run these commands from the pytst source directory and you should be all set. I&#8217;m not sure if this a fully satisfactory solution, but at least this will get the test suite running again.</p>
<div id="wherego_related"><h3>Readers who viewed this page, also viewed:</h3><ul><li><a href="http://thomas.broxrost.com/2009/06/01/how-to-compile-simpleparse-210a1-for-python-26-on-windows-vista/" rel="bookmark" class="wherego_title">How to compile SimpleParse 2.1.0a1 for Python 2.6 on Windows Vista</a></li><li>Powered by <a href="http://ajaydsouza.com/wordpress/plugins/where-did-they-go-from-here/">Where did they go from here?</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://thomas.broxrost.com/2009/01/25/running-pytst-115-on-a-64-bit-platform/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
