Re: [code] [textadept] Segmentation fault with Python module

From: Mitchell <m.att.foicica.com>
Date: Thu, 31 Jan 2013 11:59:21 -0500 (Eastern Standard Time)

Robert,

On Wed, 30 Jan 2013, Robert wrote:

> On Wed, Jan 30, 2013 at 3:57 AM, Mitchell <m.att.foicica.com> wrote:
>> Robert,
>>
>>
>> On Sun, 27 Jan 2013, Robert wrote:
>>
>>> Hi,
>>>
>>> using the Python module I get a segmentation fault when trying to save
>>> a file with an incorrect encoding declaration:
>>>
>>> # coding=utf8t
>>>
>>> Directly on the command line I get an error message:
>>>
>>> robert$ python -m py_compile test.py
>>> SyntaxError: ('unknown encoding: utf8t', ('test.py', 0, 0, None))
>>>
>>> Observed this on both Linux an OS X, on the latter I get
>>> Segmentation fault: 11
>>> when Textadept is launched directly from the command line.
>>
>>
>> This is fixed in the python module's hg.
>
> Thanks for the fix, I had assumed the crash had revealed some deeper issue.
> In any case, wouldn't it be better to to turn the line number into '1' if the
> py_compile call returns '0'? That way, the error message would get displayed.

This one is tough because python lets encoding at least be on either the
first or second line of comments. For a file like:

     # foo
     # coding=uft8

py_compile says the error is on line number '0' (I guess because it has
not reached any executable code yet?) so displaying a 'syntax error'
message on line 1 would be rather confusing to the user. I think a
run-time error with a problem like encoding is more descriptive.

Mitchell

-- 
You are subscribed to code.att.foicica.com.
To change subscription settings, send an e-mail to code+help.att.foicica.com.
To unsubscribe, send an e-mail to code+unsubscribe.att.foicica.com.
Received on Thu 31 Jan 2013 - 11:59:21 EST

This archive was generated by hypermail 2.2.0 : Fri 01 Feb 2013 - 06:40:25 EST