<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>NIL: .to write(1) ~ help:about &#187; Errata</title>
	<atom:link href="http://tech.blog.aknin.name/category/errata/feed/" rel="self" type="application/rss+xml" />
	<link>http://tech.blog.aknin.name</link>
	<description>Glossolalia about technology by @aknin</description>
	<lastBuildDate>Mon, 15 Apr 2013 16:51:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='tech.blog.aknin.name' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://0.gravatar.com/blavatar/488efa50a3512ade2d4fd7910a778a2c?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>NIL: .to write(1) ~ help:about &#187; Errata</title>
		<link>http://tech.blog.aknin.name</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://tech.blog.aknin.name/osd.xml" title="NIL: .to write(1) ~ help:about" />
	<atom:link rel='hub' href='http://tech.blog.aknin.name/?pushpress=hub'/>
		<item>
		<title>Correction for &#8216;Python&#8217;s Innards: pystate&#8217;</title>
		<link>http://tech.blog.aknin.name/2010/06/05/correction-for-pythons-innards-pystate/</link>
		<comments>http://tech.blog.aknin.name/2010/06/05/correction-for-pythons-innards-pystate/#comments</comments>
		<pubDate>Sat, 05 Jun 2010 15:04:59 +0000</pubDate>
		<dc:creator>Yaniv Aknin</dc:creator>
				<category><![CDATA[Errata]]></category>
		<category><![CDATA[frame object]]></category>
		<category><![CDATA[GIL]]></category>
		<category><![CDATA[internals]]></category>
		<category><![CDATA[interpreter state]]></category>
		<category><![CDATA[thread state]]></category>

		<guid isPermaLink="false">http://tech.blog.aknin.name/?p=715</guid>
		<description><![CDATA[Graham Dumpleton (of mod_wsgi fame) pointed out a glaring omission and subtle inaccuracy in my post about Python&#8217;s state structures. When discussing what I called &#8220;Pythonic threads&#8221;, which are threads created and managed by Python, which have a PyThreadState structure allocated to them and that are able to call into the Python API and run [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tech.blog.aknin.name&#038;blog=12830832&#038;post=715&#038;subd=niltowrite&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p><a href="http://blog.dscpl.com.au/">Graham Dumpleton</a> (of <a href="http://code.google.com/p/modwsgi/" class="code">mod_wsgi</a> fame) <a href="http://tech.blog.aknin.name/2010/05/26/pythons-innards-pystate/#comment-361">pointed</a> out a glaring omission and subtle inaccuracy in my <a href="http://tech.blog.aknin.name/2010/05/26/pythons-innards-pystate/">post</a> about Python&#8217;s state structures.</p>
<p>When discussing what I called &#8220;Pythonic threads&#8221;, which are threads created and managed by Python, which have a <tt>PyThreadState</tt> structure allocated to them and that are able to call into the Python API and run Python code, I said: &#8220;<em>theoretically threads can be created which will not be under the interpreter&#8217;s control; these threads won&#8217;t have a <tt>PyThreadState</tt> structure and must never call a Python API; this is not very common</em>&#8220;. This is sort of correct, but misleading: such threads are quite obvious to have in a non-Python applications that has a Python interpreter embedded in it (something Graham probably knows a thing or two about :). These &#8216;foreign&#8217; (I don&#8217;t know of formal term) threads indeed can&#8217;t call the Python API and run Python code unless they&#8217;re &#8216;migrated&#8217; (don&#8217;t know of a formal term) to come under the control of a Python interpreter, having the correct bookkeeping structures allocated and initialized for them.</p>
<p>Graham also noted correctly that such &#8216;migration&#8217; is easier when there&#8217;s just one Python interpreter in the process, and harder if there&#8217;s more than one. If you have just one interpreter, you can use the (somewhat confusingly named) <a href="http://docs.python.org/py3k/c-api/init.html#PyGILState_Ensure" class="code">PyGILState_Ensure</a> and <a href="http://docs.python.org/py3k/c-api/init.html#PyGILState_Release" class="code">PyGILState_Release</a> calls to do the job. These calls allow a thread to ensure it has the GIL (blocking if necessary until it can be acquired), but importantly can be called by a thread that isn&#8217;t under Python&#8217;s control at all; the necessary work to allow the thread to call Python&#8217;s API will be done for you. These calls assume there is only one Python interpreter (<tt>interp_head</tt> points to a <tt>PyInterpreterState</tt> which points to NULL), hence they mustn&#8217;t be used in a multi-interpreter process, if that is your case you&#8217;ll have to &#8216;migrate&#8217; the threat manually with lower level primitives.</p>
<p>As per my <a href="http://tech.blog.aknin.name/metablogging/errata-policy/">errata policy</a>, I&#8217;ve chosen to update the original post as if the error never happened and write this post note the mistake for future reference and for those subscribed to the <a href="http://tech.blog.aknin.name/category/errata/feed">RSS feed of the Errata category</a>.</p>
<p>I&#8217;d like to thank Graham for the important correction.</p>
<br /> Tagged: <a href='http://tech.blog.aknin.name/tag/frame-object/'>frame object</a>, <a href='http://tech.blog.aknin.name/tag/gil/'>GIL</a>, <a href='http://tech.blog.aknin.name/tag/internals/'>internals</a>, <a href='http://tech.blog.aknin.name/tag/interpreter-state/'>interpreter state</a>, <a href='http://tech.blog.aknin.name/tag/thread-state/'>thread state</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/niltowrite.wordpress.com/715/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/niltowrite.wordpress.com/715/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tech.blog.aknin.name&#038;blog=12830832&#038;post=715&#038;subd=niltowrite&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://tech.blog.aknin.name/2010/06/05/correction-for-pythons-innards-pystate/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/9e42ce18ec8a40b6334a6b0283d72528?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">yanivaknin</media:title>
		</media:content>
	</item>
		<item>
		<title>Python&#8217;s Innards: Series Renamed</title>
		<link>http://tech.blog.aknin.name/2010/05/22/pythons-innards-series-rename/</link>
		<comments>http://tech.blog.aknin.name/2010/05/22/pythons-innards-series-rename/#comments</comments>
		<pubDate>Sat, 22 May 2010 12:40:24 +0000</pubDate>
		<dc:creator>Yaniv Aknin</dc:creator>
				<category><![CDATA[Errata]]></category>
		<category><![CDATA[Guido&#039;s Python]]></category>
		<category><![CDATA[ouch]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://tech.blog.aknin.name/?p=496</guid>
		<description><![CDATA[Just yesterday I promised to tell you if I make significant mistakes, hoping it would be a seldom occasion. Yet here I am writing to you about another mistake I made, though this time not one of technical nature. I chose the old name for this series of articles about Python&#8217;s inner working as I [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tech.blog.aknin.name&#038;blog=12830832&#038;post=496&#038;subd=niltowrite&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Just yesterday I promised to tell you if I make significant mistakes, hoping it would be a seldom occasion. Yet here I am writing to you about another mistake I made, though this time not one of technical nature. I chose the old name for this <a href="http://tech.blog.aknin.name/tag/pythons-innards/">series</a> of articles about Python&#8217;s inner working as I was musing about how creators may see their creations far more thoroughly than other people possibly can (the old name of the series was &#8220;Guido&#8217;s Python&#8221;). It was recently brought to my attention that the name I chose might have been incorrect, misleading and/or simply tasteless. I certainly did not mean to give a false impression of affiliation or endorsement; of course Python&#8217;s creator and community leader never had anything to do with the series. Due to these reasons and to set things straight, the series will be promptly and retroactively renamed to &#8220;Python&#8217;s Innards&#8221;. </p>
<p>Since the series&#8217; old name was used in URLs and category names, things will break as I do the rename and readers will have to update their bookmarks. I&#8217;m sorry for the discomfort I&#8217;ll cause my readers with the rename, but far worse, I apologize if I misled anyone or tainted someone&#8217;s good name. I&#8217;ll use this unfortunate opportunity to say explicitly that unless stated otherwise, everything you can find anywhere under the aknin.name domain (so far there&#8217;s only this blog) is solely my creation, not endorsed nor affiliated with anyone else (be assured that I&#8217;ll give credit where such is due if I&#8217;ll receive some kind of help in the future). </p>
<p>Genuinely no malice was intended and I hope this will be forgotten soon enough; I&#8217;m working on the next article and look forward to see you as we continue this journey into Python.</p>
<br /> Tagged: <a href='http://tech.blog.aknin.name/tag/ouch/'>ouch</a>, <a href='http://tech.blog.aknin.name/tag/python/'>python</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/niltowrite.wordpress.com/496/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/niltowrite.wordpress.com/496/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tech.blog.aknin.name&#038;blog=12830832&#038;post=496&#038;subd=niltowrite&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://tech.blog.aknin.name/2010/05/22/pythons-innards-series-rename/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/9e42ce18ec8a40b6334a6b0283d72528?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">yanivaknin</media:title>
		</media:content>
	</item>
		<item>
		<title>Correction for &#8216;Python&#8217;s Innards: Objects 102&#8242;</title>
		<link>http://tech.blog.aknin.name/2010/05/20/correction-for-pythons-innards-objects-102/</link>
		<comments>http://tech.blog.aknin.name/2010/05/20/correction-for-pythons-innards-objects-102/#comments</comments>
		<pubDate>Thu, 20 May 2010 09:16:42 +0000</pubDate>
		<dc:creator>Yaniv Aknin</dc:creator>
				<category><![CDATA[Errata]]></category>
		<category><![CDATA[Python's Innards]]></category>
		<category><![CDATA[descriptors]]></category>
		<category><![CDATA[internals]]></category>
		<category><![CDATA[objects]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[slots]]></category>
		<category><![CDATA[types]]></category>
		<category><![CDATA[__dict__]]></category>

		<guid isPermaLink="false">http://tech.blog.aknin.name/?p=462</guid>
		<description><![CDATA[Alas, it has happened, the first mistake in the &#8216;Python&#8217;s Innards&#8217; series has been found. I was trying to answer a question raised by one of my Reddit readers regarding properties, and realized that I have overlooked a fine point about descriptors in my post. Oops. As was originally (and correctly) written in the post, [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tech.blog.aknin.name&#038;blog=12830832&#038;post=462&#038;subd=niltowrite&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Alas, it has happened, the first mistake in the &#8216;Python&#8217;s Innards&#8217; <a href="tech.blog.aknin.name/tag/pythons-innards">series</a> has been found. I was trying to answer a <a href="http://www.reddit.com/r/Python/comments/c5urj/guidos_python_objects_102/">question</a> raised by one of my Reddit readers regarding <a href="http://docs.python.org/py3k/library/functions.html#property">properties</a>, and realized that I have overlooked a fine point about descriptors in my post. Oops.</p>
<p>As was originally (and correctly) written in the post, descriptors are objects whose type has their <tt>tp_descr_get</tt> and/or <tt>tp_descr_set</tt> slots set to non-NULL. However, I also wrote, incorrectly, that descriptors take precedence over regular instance attributes (i.e., attributes in the object&#8217;s <tt>__dict__</tt>). This is partly correct but misleading, as it doesn&#8217;t distinguish non-data descriptors from data-descriptors. An object is said to be a data descriptor if its type has its <tt>tp_descr_set</tt> slot implemented (there&#8217;s no particularly special term for a non-data descriptor). Only data descriptors override regular object attributes, non-data descriptors do not.</p>
<p>I apologize for the mistake, but alas can&#8217;t <em>promise</em> it will never happen again. I&#8217;ve created an <a href="http://tech.blog.aknin.name/metablogging/errata-policy/">Errata Policy</a> page which explains how I intend to treat mistakes that will be found from now on. Briefly, it says that the policy is to correct the original page as if the mistake never existed, and if the mistake is significant enough, also write a separate post (like this one) which explains what happened. I plan <strong>not</strong> to tag errata posts with all the tags of the original post (I&#8217;ve done it with this post as an exception), so unless you explicitly register to the <a href="http://tech.blog.aknin.name/category/errata/feed">RSS feed of the Errata category</a> in my blog, you won&#8217;t get further errata via Planet Python or other aggregation services that rely on the &#8216;python&#8217; or &#8216;pythons-innards&#8217; tags.</p>
<p>I hope you will keep enjoying and relying on this blog.</p>
<br /> Tagged: <a href='http://tech.blog.aknin.name/tag/descriptors/'>descriptors</a>, <a href='http://tech.blog.aknin.name/tag/internals/'>internals</a>, <a href='http://tech.blog.aknin.name/tag/objects/'>objects</a>, <a href='http://tech.blog.aknin.name/tag/python/'>python</a>, <a href='http://tech.blog.aknin.name/tag/slots/'>slots</a>, <a href='http://tech.blog.aknin.name/tag/types/'>types</a>, <a href='http://tech.blog.aknin.name/tag/__dict__/'>__dict__</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/niltowrite.wordpress.com/462/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/niltowrite.wordpress.com/462/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tech.blog.aknin.name&#038;blog=12830832&#038;post=462&#038;subd=niltowrite&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://tech.blog.aknin.name/2010/05/20/correction-for-pythons-innards-objects-102/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/9e42ce18ec8a40b6334a6b0283d72528?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">yanivaknin</media:title>
		</media:content>
	</item>
	</channel>
</rss>
