<feed xmlns='http://www.w3.org/2005/Atom'>
<title>python.git/Objects/unicodeobject.c, branch 2.1</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.</subtitle>
<id>http://dangofactory.net/cgit/cgit.cgi/Server/python.git/atom/Objects/unicodeobject.c?h=2.1</id>
<link rel='self' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/atom/Objects/unicodeobject.c?h=2.1'/>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/'/>
<updated>2002-04-30T03:58:47Z</updated>
<entry>
<title>backport tim_one's patch:</title>
<updated>2002-04-30T03:58:47Z</updated>
<author>
<name>Anthony Baxter</name>
<email>anthonybaxter@gmail.com</email>
</author>
<published>2002-04-30T03:58:47Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=88c646e99e6969b0933f2e4d8bedd5ef530f2412'/>
<id>urn:sha1:88c646e99e6969b0933f2e4d8bedd5ef530f2412</id>
<content type='text'>
[Re-did unicodeobject.c - it's changed a lot since 2.1 :) Pretty confident
that it's correct]

Repair widespread misuse of _PyString_Resize.  Since it's clear people
don't understand how this function works, also beefed up the docs.  The
most common usage error is of this form (often spread out across gotos):

	if (_PyString_Resize(&amp;s, n) &lt; 0) {
		Py_DECREF(s);
		s = NULL;
		goto outtahere;
	}

The error is that if _PyString_Resize runs out of memory, it automatically
decrefs the input string object s (which also deallocates it, since its
refcount must be 1 upon entry), and sets s to NULL.  So if the "if"
branch ever triggers, it's an error to call Py_DECREF(s):  s is already
NULL!  A correct way to write the above is the simpler (and intended)

	if (_PyString_Resize(&amp;s, n) &lt; 0)
		goto outtahere;

Bugfix candidate.

Original patch(es):
python/dist/src/Objects/fileobject.c:2.161
python/dist/src/Objects/stringobject.c:2.161
python/dist/src/Objects/unicodeobject.c:2.147
</content>
</entry>
<entry>
<title>Backport of Tim's checkin 2.88:</title>
<updated>2001-05-23T12:31:25Z</updated>
<author>
<name>Thomas Wouters</name>
<email>thomas@python.org</email>
</author>
<published>2001-05-23T12:31:25Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=930874efdd5bbe3b90518e52f59acc0bd5e41180'/>
<id>urn:sha1:930874efdd5bbe3b90518e52f59acc0bd5e41180</id>
<content type='text'>
A different approach to the problem reported in
Patch #419651: Metrowerks on Mac adds 0x itself
C std says %#x and %#X conversion of 0 do not add the 0x/0X base marker.
Metrowerks apparently does.  Mark Favas reported the same bug under a
Compaq compiler on Tru64 Unix, but no other libc broken in this respect
is known (known to be OK under MSVC and gcc).
So just try the damn thing at runtime and see what the platform does.
Note that we've always had bugs here, but never knew it before because
a relevant test case didn't exist before 2.1.
</content>
</entry>
<entry>
<title>Bug 415514 reported that e.g.</title>
<updated>2001-04-12T18:38:48Z</updated>
<author>
<name>Tim Peters</name>
<email>tim.peters@gmail.com</email>
</author>
<published>2001-04-12T18:38:48Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=fff53250789c3879e5f63d4dde80d17e0b9c4dbb'/>
<id>urn:sha1:fff53250789c3879e5f63d4dde80d17e0b9c4dbb</id>
<content type='text'>
    "%#x" % 0
blew up, at heart because C sprintf supplies a base marker if and only if
the value is not 0.  I then fixed that, by tolerating C's inconsistency
when it does %#x, and taking away that *Python* produced 0x0 when
formatting 0L (the "long" flavor of 0) under %#x itself.  But after talking
with Guido, we agreed it would be better to supply 0x for the short int
case too, despite that it's inconsistent with C, because C is inconsistent
with itself and with Python's hex(0) (plus, while "%#x" % 0 didn't work
before, "%#x" % 0L *did*, and returned "0x0").  Similarly for %#X conversion.
</content>
</entry>
<entry>
<title>Fix for SF bug #415514: "%#x" % 0 caused assertion failure/abort.</title>
<updated>2001-04-12T00:35:51Z</updated>
<author>
<name>Tim Peters</name>
<email>tim.peters@gmail.com</email>
</author>
<published>2001-04-12T00:35:51Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=711088d9b8c6898aad571fb251cb40a8b7d42f64'/>
<id>urn:sha1:711088d9b8c6898aad571fb251cb40a8b7d42f64</id>
<content type='text'>
http://sourceforge.net/tracker/index.php?func=detail&amp;aid=415514&amp;group_id=5470&amp;atid=105470
For short ints, Python defers to the platform C library to figure out what
%#x should do.  The code asserted that the platform C returned a string
beginning with "0x".  However, that's not true when-- and only when --the
*value* being formatted is 0.  Changed the code to live with C's inconsistency
here.  In the meantime, the problem does not arise if you format a long 0 (0L)
instead.  However, that's because the code *we* wrote to do %#x conversions on
longs produces a leading "0x" regardless of value.  That's probably wrong too:
we should drop leading "0x", for consistency with C, when (&amp; only when) formatting
0L.  So I changed the long formatting code to do that too.
</content>
</entry>
<entry>
<title>reorganized PyUnicode_DecodeUnicodeEscape a bit (in order to make it</title>
<updated>2001-02-18T22:13:49Z</updated>
<author>
<name>Fredrik Lundh</name>
<email>fredrik@pythonware.com</email>
</author>
<published>2001-02-18T22:13:49Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=ccc7473fc8593a19b9d8d26118c22eb759350a53'/>
<id>urn:sha1:ccc7473fc8593a19b9d8d26118c22eb759350a53</id>
<content type='text'>
less likely that bug #132817 ever appears again)
</content>
</entry>
<entry>
<title>Fixed .capitalize() method of Unicode objects to work like the</title>
<updated>2001-01-29T11:14:16Z</updated>
<author>
<name>Marc-André Lemburg</name>
<email>mal@egenix.com</email>
</author>
<published>2001-01-29T11:14:16Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=fde66e1bcc4431a59f36bad0ca0dd7a848ce794b'/>
<id>urn:sha1:fde66e1bcc4431a59f36bad0ca0dd7a848ce794b</id>
<content type='text'>
corresponding string method. Added tests for this too.

Patch written by Marc-Andre Lemburg. Copyright assigned to Guido van Rossum.
</content>
</entry>
<entry>
<title>Show '\011', '\012', and '\015' as '\t', '\n', '\r' in strings.</title>
<updated>2001-01-24T17:19:08Z</updated>
<author>
<name>Ka-Ping Yee</name>
<email>ping@zesty.ca</email>
</author>
<published>2001-01-24T17:19:08Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=fa004ad36c86f4af406cfa3a84ec8b6cb391e6dd'/>
<id>urn:sha1:fa004ad36c86f4af406cfa3a84ec8b6cb391e6dd</id>
<content type='text'>
Switch from octal escapes to hex escapes for other nonprintable characters.
</content>
</entry>
<entry>
<title>Move uchhash functionality into unicodedata (after the recent</title>
<updated>2001-01-24T07:59:11Z</updated>
<author>
<name>Fredrik Lundh</name>
<email>fredrik@pythonware.com</email>
</author>
<published>2001-01-24T07:59:11Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=06d126803c66515f5cdb272dfd7807716f04d33f'/>
<id>urn:sha1:06d126803c66515f5cdb272dfd7807716f04d33f</id>
<content type='text'>
crop of changes, the files are small enough to do this).  Also
adds "name" and "lookup" functions to unicodedata.
</content>
</entry>
<entry>
<title>Better error message if ucnhash cannot be found (obscure attribute</title>
<updated>2001-01-20T11:15:25Z</updated>
<author>
<name>Fredrik Lundh</name>
<email>fredrik@pythonware.com</email>
</author>
<published>2001-01-20T11:15:25Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=f60560626ce4fadf32fcbfac5e762242f661d508'/>
<id>urn:sha1:f60560626ce4fadf32fcbfac5e762242f661d508</id>
<content type='text'>
errors aren't that helpful), or doesn't contain what's expected from
it.  Also tweaked the test script so it compiles even if ucnhash is
missing.
</content>
</entry>
<entry>
<title>refactored the unicodeobject/ucnhash interface, to hide the</title>
<updated>2001-01-19T09:45:02Z</updated>
<author>
<name>Fredrik Lundh</name>
<email>fredrik@pythonware.com</email>
</author>
<published>2001-01-19T09:45:02Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=0fdb90cafe596a03a5c3005a21e8fa2a230803e5'/>
<id>urn:sha1:0fdb90cafe596a03a5c3005a21e8fa2a230803e5</id>
<content type='text'>
implementation details inside the ucnhash module.

also cleaned up the unicode copyright blurb a little; Secret Labs'
internal revision history isn't that interesting...
</content>
</entry>
</feed>
