Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Bugs

[issue7330] PyUnicode_FromFormat segfault when using widths.

 

 

Python bugs RSS feed   Index | Next | Previous | View Threaded


report at bugs

Nov 15, 2009, 11:42 AM

Post #1 of 2 (229 views)
Permalink
[issue7330] PyUnicode_FromFormat segfault when using widths.

New submission from Mark Dickinson <dickinsm [at] gmail>:

There seems to be something wrong with the width handling code in
PyUnicode_FromFormat; or perhaps I'm misusing it.

To reproduce: replace the line

return PyUnicode_FromFormat("range(%R, %R)", r->start, r->stop);

in range_repr in Objects/rangeobject.c with

return PyUnicode_FromFormat("range(%20R, %20R)", r->start, r->stop);

On my machine (OS X 10.6), this results in a segfault when invoking
range_repr:

Python 3.2a0 (py3k:76311M, Nov 15 2009, 19:16:40)
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> range(0, 10)
Segmentation fault

Perhaps these modifiers aren't supposed to be used with a width?

----------
messages: 95306
nosy: mark.dickinson
severity: normal
status: open
title: PyUnicode_FromFormat segfault when using widths.
type: crash
versions: Python 3.2

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue7330>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Nov 15, 2009, 1:35 PM

Post #2 of 2 (202 views)
Permalink
[issue7330] PyUnicode_FromFormat segfault when using widths. [In reply to]

Eric Smith <eric [at] trueblade> added the comment:

It looks like PyUnicode_FromFormatV is computing callcount incorrectly.
It's looking for 'S', 'R', or 'A' immediately following '%', before the
width. It seems to me it should be treating them the same as 's',
although I'll admit to not having looked at it close enough to know
exactly what's going on.

The whole routine could use some attention, I think.

----------
nosy: +eric.smith

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue7330>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com

Python bugs RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.