<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/cpython-git.git/Objects/stringobject.c, branch v2.2.3c1</title>
<subtitle>github.com: python/cpython.git
</subtitle>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/cpython-git.git/'/>
<entry>
<title>Backport:</title>
<updated>2003-04-11T18:21:22+00:00</updated>
<author>
<name>Neal Norwitz</name>
<email>nnorwitz@gmail.com</email>
</author>
<published>2003-04-11T18:21:22+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/cpython-git.git/commit/?id=9976fdf83cd75816e2d370197f030074c6cc1697'/>
<id>9976fdf83cd75816e2d370197f030074c6cc1697</id>
<content type='text'>
Fix SF bug #697220, string.strip implementation/doc mismatch

Attempt to make all the various string/unicode *strip methods the same.
 * Doc - add doc for when functions were added
 * UserString
 * string/unicode object methods
 * string module functions
'chars' is used for the last parameter everywhere.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fix SF bug #697220, string.strip implementation/doc mismatch

Attempt to make all the various string/unicode *strip methods the same.
 * Doc - add doc for when functions were added
 * UserString
 * string/unicode object methods
 * string module functions
'chars' is used for the last parameter everywhere.
</pre>
</div>
</content>
</entry>
<entry>
<title>Backport MAL's patch for bug #659709: bogus computation of float length</title>
<updated>2003-01-02T22:08:39+00:00</updated>
<author>
<name>Raymond Hettinger</name>
<email>python@rcn.com</email>
</author>
<published>2003-01-02T22:08:39+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/cpython-git.git/commit/?id=65b5e1fdbebe4ca35b665bc22bc51e9a806b4669'/>
<id>65b5e1fdbebe4ca35b665bc22bc51e9a806b4669</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Backport stringobject.c 2.194 and unicodeobject.c 2.172:</title>
<updated>2002-10-11T00:47:20+00:00</updated>
<author>
<name>Guido van Rossum</name>
<email>guido@python.org</email>
</author>
<published>2002-10-11T00:47:20+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/cpython-git.git/commit/?id=d9ddf59d28dd17f4a3aecf5e1964ae849805cf48'/>
<id>d9ddf59d28dd17f4a3aecf5e1964ae849805cf48</id>
<content type='text'>
Fix a nasty endcase reported by Armin Rigo in SF bug 618623:
'%2147483647d' % -123 segfaults.  This was because an integer overflow
in a comparison caused the string resize to be skipped.  After fixing
the overflow, this could call _PyString_Resize() with a negative size,
so I (1) test for that and raise MemoryError instead; (2) also added a
test for negative newsize to _PyString_Resize(), raising SystemError
as for all bad arguments.

An identical bug existed in unicodeobject.c, of course.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fix a nasty endcase reported by Armin Rigo in SF bug 618623:
'%2147483647d' % -123 segfaults.  This was because an integer overflow
in a comparison caused the string resize to be skipped.  After fixing
the overflow, this could call _PyString_Resize() with a negative size,
so I (1) test for that and raise MemoryError instead; (2) also added a
test for negative newsize to _PyString_Resize(), raising SystemError
as for all bad arguments.

An identical bug existed in unicodeobject.c, of course.
</pre>
</div>
</content>
</entry>
<entry>
<title>Backport the relevant part of 2.192:</title>
<updated>2002-10-11T00:09:51+00:00</updated>
<author>
<name>Guido van Rossum</name>
<email>guido@python.org</email>
</author>
<published>2002-10-11T00:09:51+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/cpython-git.git/commit/?id=a1eb2274943e86987fdd5a4c08ebd8c301522e3b'/>
<id>a1eb2274943e86987fdd5a4c08ebd8c301522e3b</id>
<content type='text'>
The string formatting code has a test to switch to Unicode when %s
sees a Unicode argument.  Unfortunately this test was also executed
for %r, because %s and %r share almost all of their code.  This meant
that, if u is a unicode object while repr(u) is an 8-bit string
containing ASCII characters, '%r' % u is a *unicode* string containing
only ASCII characters!

Fixed by executing the test only for %s.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The string formatting code has a test to switch to Unicode when %s
sees a Unicode argument.  Unfortunately this test was also executed
for %r, because %s and %r share almost all of their code.  This meant
that, if u is a unicode object while repr(u) is an 8-bit string
containing ASCII characters, '%r' % u is a *unicode* string containing
only ASCII characters!

Fixed by executing the test only for %s.
</pre>
</div>
</content>
</entry>
<entry>
<title>Backport from trunk:</title>
<updated>2002-09-23T21:17:27+00:00</updated>
<author>
<name>Guido van Rossum</name>
<email>guido@python.org</email>
</author>
<published>2002-09-23T21:17:27+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/cpython-git.git/commit/?id=67c87194fb030a584d087231d29b6676e24b7d5d'/>
<id>67c87194fb030a584d087231d29b6676e24b7d5d</id>
<content type='text'>
unicodeobject.c 2.169
stringobject.c 2.189

Fix warnings on 64-bit platforms about casts from pointers to ints.
Two of these were real bugs.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
unicodeobject.c 2.169
stringobject.c 2.189

Fix warnings on 64-bit platforms about casts from pointers to ints.
Two of these were real bugs.
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix some endcase bugs in unicode rfind()/rindex() and endswith().</title>
<updated>2002-08-20T16:57:58+00:00</updated>
<author>
<name>Guido van Rossum</name>
<email>guido@python.org</email>
</author>
<published>2002-08-20T16:57:58+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/cpython-git.git/commit/?id=96303ce055e0bdc1b5f53f38bd424e747e289621'/>
<id>96303ce055e0bdc1b5f53f38bd424e747e289621</id>
<content type='text'>
These were reported and fixed by Inyeol Lee in SF bug 595350.  The
endswith() bug is already fixed in 2.3; I'll fix the others in
2.3 next.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
These were reported and fixed by Inyeol Lee in SF bug 595350.  The
endswith() bug is already fixed in 2.3; I'll fix the others in
2.3 next.
</pre>
</div>
</content>
</entry>
<entry>
<title>SF 582071 clarified the .split() method's docstring to note that sep=None</title>
<updated>2002-08-05T06:28:55+00:00</updated>
<author>
<name>Raymond Hettinger</name>
<email>python@rcn.com</email>
</author>
<published>2002-08-05T06:28:55+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/cpython-git.git/commit/?id=3bef3faa21e83256618eeb70ab8e7e95d69cccea'/>
<id>3bef3faa21e83256618eeb70ab8e7e95d69cccea</id>
<content type='text'>
will trigger splitting on any whitespace.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
will trigger splitting on any whitespace.
</pre>
</div>
</content>
</entry>
<entry>
<title>Patch #554716: Use __va_copy where available.</title>
<updated>2002-07-28T10:21:31+00:00</updated>
<author>
<name>Martin v. Löwis</name>
<email>martin@v.loewis.de</email>
</author>
<published>2002-07-28T10:21:31+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/cpython-git.git/commit/?id=59b5b4720b9bb11e0dcbb4cb255c6cc571df0a5c'/>
<id>59b5b4720b9bb11e0dcbb4cb255c6cc571df0a5c</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Backport checkin:</title>
<updated>2002-05-13T09:11:44+00:00</updated>
<author>
<name>Walter Dörwald</name>
<email>walter@livinglogic.de</email>
</author>
<published>2002-05-13T09:11:44+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/cpython-git.git/commit/?id=332a458dd1527be21bc3c93e4eff692070439f24'/>
<id>332a458dd1527be21bc3c93e4eff692070439f24</id>
<content type='text'>
Add #ifdef PY_USING_UNICODE sections, so that
stringobject.c compiles again with --disable-unicode.

Fixes SF bug http://www.python.org/sf/554912
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Add #ifdef PY_USING_UNICODE sections, so that
stringobject.c compiles again with --disable-unicode.

Fixes SF bug http://www.python.org/sf/554912
</pre>
</div>
</content>
</entry>
<entry>
<title>backport tim_one's patch:</title>
<updated>2002-04-30T03:41:53+00:00</updated>
<author>
<name>Anthony Baxter</name>
<email>anthonybaxter@gmail.com</email>
</author>
<published>2002-04-30T03:41:53+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/cpython-git.git/commit/?id=3864a45cd3a142ef168ffb69de1b407fbeda80bf'/>
<id>3864a45cd3a142ef168ffb69de1b407fbeda80bf</id>
<content type='text'>
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>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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
</pre>
</div>
</content>
</entry>
</feed>
