<feed xmlns='http://www.w3.org/2005/Atom'>
<title>python.git/Objects/stringobject.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/stringobject.c?h=2.1</id>
<link rel='self' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/atom/Objects/stringobject.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>Net result of Tim's checkins to stropmodule.c (2.78, 2.79, 2.80, 2.81),</title>
<updated>2001-05-23T14:38:53Z</updated>
<author>
<name>Thomas Wouters</name>
<email>thomas@python.org</email>
</author>
<published>2001-05-23T14:38:53Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=1648e53efce867513ffdbdbdc044b9a8a810b8ad'/>
<id>urn:sha1:1648e53efce867513ffdbdbdc044b9a8a810b8ad</id>
<content type='text'>
stringobject.c (2.114, 2.115) and test_strop.py (1.11, 1.12). Fixes
'replace' behaviour on systems on which 'malloc(0)' returns NULL (together
with previous checkins) and re-synchs the string-operation code in
stringobject.c and stropmodule.c, with the exception of 'replace', which has
the old semantics in stropmodule but the new semantics in stringobjects.
</content>
</entry>
<entry>
<title>Backport MAL's checkin 2.105:</title>
<updated>2001-05-23T13:14:24Z</updated>
<author>
<name>Thomas Wouters</name>
<email>thomas@python.org</email>
</author>
<published>2001-05-23T13:14:24Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=140e1d36a6b9c60a0b74691a680d47c04d9e3671'/>
<id>urn:sha1:140e1d36a6b9c60a0b74691a680d47c04d9e3671</id>
<content type='text'>
Fix for bug #417030: "print '%*s' fails for unicode string"
</content>
</entry>
<entry>
<title>Net result of Guido's checkins of object.c (2.125 and 2.126), classobject.c</title>
<updated>2001-05-23T13:03:13Z</updated>
<author>
<name>Thomas Wouters</name>
<email>thomas@python.org</email>
</author>
<published>2001-05-23T13:03:13Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=c922bfa4cd5beffafb7b912b01da8460b5005116'/>
<id>urn:sha1:c922bfa4cd5beffafb7b912b01da8460b5005116</id>
<content type='text'>
(2.128) and stringobject.c (2.105), which reworks PyObject_Str() and
PyObject_Repr() so strings and instances aren't special-cased, and
    print &gt;&gt; file, instance
works like expected in all cases.
</content>
</entry>
<entry>
<title>Backport Tim's checkin 2.104:</title>
<updated>2001-05-23T12:30:59Z</updated>
<author>
<name>Thomas Wouters</name>
<email>thomas@python.org</email>
</author>
<published>2001-05-23T12:30:59Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=4a11bb3f86a5d5ca975f800cf1740b9253794ab7'/>
<id>urn:sha1:4a11bb3f86a5d5ca975f800cf1740b9253794ab7</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>_Py_ReleaseInternedStrings(): Private API function to decref and</title>
<updated>2001-02-23T16:40:48Z</updated>
<author>
<name>Barry Warsaw</name>
<email>barry@python.org</email>
</author>
<published>2001-02-23T16:40:48Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=a903ad9855947ae885c4407be8d10ef8d5521010'/>
<id>urn:sha1:a903ad9855947ae885c4407be8d10ef8d5521010</id>
<content type='text'>
release the interned string dictionary.  This is useful for memory
use debugging because it eliminates a huge source of noise from the
reports.  Only defined when INTERN_STRINGS is defined.
</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>Derivative of patch #102549, "simpler, faster(!) implementation of string.join".</title>
<updated>2001-01-19T03:03:47Z</updated>
<author>
<name>Tim Peters</name>
<email>tim.peters@gmail.com</email>
</author>
<published>2001-01-19T03:03:47Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=19fe14e76ac3619e633b10c0e31effc2dad3c543'/>
<id>urn:sha1:19fe14e76ac3619e633b10c0e31effc2dad3c543</id>
<content type='text'>
Also fixes two long-standing bugs (present in 2.0):
1. .join() didn't check that the result size fit in an int.
2. string.join(s) when len(s)==1 returned s[0] regardless of s[0]'s
   type; e.g., "".join([3]) returned 3 (overly optimistic optimization).
I resisted a keen temptation to make .join() apply str() automagically.
</content>
</entry>
</feed>
