[issue12643] code.InteractiveConsole ignores sys.excepthook

2011-07-27 Thread aliles

New submission from aliles :

code.InteractiveConsole doesn't match the CPython interactive interpreter with 
respect to allowing sys.excepthook to handle exceptions. Unlike the interactive 
interpreter, replacing sys.excepthook with an alternate function will not 
change exception handling behaviour from inside a code.InteractiveConole

This affects downstream interpreters such as PyPy.
https://bugs.pypy.org/issue811

--
components: Library (Lib)
files: console.py
messages: 141222
nosy: aliles
priority: normal
severity: normal
status: open
title: code.InteractiveConsole ignores sys.excepthook
type: behavior
versions: Python 2.7, Python 3.2
Added file: http://bugs.python.org/file22771/console.py

___
Python tracker 
<http://bugs.python.org/issue12643>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12643] code.InteractiveConsole ignores sys.excepthook

2011-07-27 Thread aliles

aliles  added the comment:

OK. Not something I was expecting to be asked. But cool :D

If it's not possible for InteractiveConsole to allow exceptions to propagate 
through sys.excepthook. (I assume they are being caught in a try: catch: block) 
check sys.excepthook for a custom exception handler and call present.

As InteractiveConsole is supposed to "Closely emulate the behaviour of the 
interactive Python interpreter", any existing code that replies on it's current 
could be viewed as relying on a bug.

I'd be happy to attempt a patch if it's worthwhile preparing one.

--

___
Python tracker 
<http://bugs.python.org/issue12643>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12643] code.InteractiveConsole ignores sys.excepthook

2011-07-27 Thread aliles

aliles  added the comment:

Yes. I have code that behaves differently under CPython and PyPy because of 
this issue.

Admittedly that code is somewhat evil. It's attached for reference, in 
particular the __HelpSyntax class.

--
Added file: http://bugs.python.org/file22773/startup.py

___
Python tracker 
<http://bugs.python.org/issue12643>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14563] Segmentation fault on ctypes.Structure subclass with byte string field names

2012-04-12 Thread aliles

New submission from aliles :

Python 3.2 will exit with a segmentation fault if a byte string is used as a 
field name in a subclass of ctypes.Structure.

Python 3.2.2 (default, Dec 18 2011, 18:56:20) 
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import ctypes
>>> class Point(ctypes.Structure):
... _fields_ = ((b'x', ctypes.c_int), (b'y', ctypes.c_int))
... 
Segmentation fault: 11

This also occurs if None or an int is used as the field name.

I would expect that a TypeError exception would be raised if an attempt is made 
to use an invalid type for the field name.

--
components: ctypes
files: segfault.py
messages: 158127
nosy: aliles
priority: normal
severity: normal
status: open
title: Segmentation fault on ctypes.Structure subclass with byte string field 
names
type: crash
versions: Python 3.2
Added file: http://bugs.python.org/file25189/segfault.py

___
Python tracker 
<http://bugs.python.org/issue14563>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14563] Segmentation fault on ctypes.Structure subclass with byte string field names

2012-04-12 Thread aliles

aliles  added the comment:

Should I build a version from the tip of the 3.2 or default branch on 
hg.python.org?

This version is Python 3.2.2 built using homebrew. The revision is being 
reported as an empty string.

Python 3.2.2 (default, Dec 18 2011, 18:56:20) 
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import platform
>>> platform.python_revision()
''
>>> platform.python_version_tuple()
('3', '2', '2')
>>> platform.python_build()
('default', 'Dec 18 2011 18:56:20')
>>> platform.release()
'11.3.0'
>>> platform.version()
'Darwin Kernel Version 11.3.0: Thu Jan 12 18:47:41 PST 2012; 
root:xnu-1699.24.23~1/RELEASE_X86_64'

Sorry, I did a search but didn't find issue12764. :-(

--

___
Python tracker 
<http://bugs.python.org/issue14563>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12643] code.InteractiveConsole ignores sys.excepthook

2012-08-20 Thread aliles

aliles added the comment:

Submitted patch. Patch creates a new unit test suite with basic unit tests for 
InteractiveConsole. Enhances InteractiveConsole to call sys.excepthook instead 
of it's own handler if the user has overridden the excepthook.

The unit tests use the new unittest.mock module and ExitStack class for 
contextlib.

--
keywords: +patch
nosy: +ncoghlan
Added file: http://bugs.python.org/file26920/issue12643.diff

___
Python tracker 
<http://bugs.python.org/issue12643>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12643] code.InteractiveConsole ignores sys.excepthook

2012-08-20 Thread aliles

aliles added the comment:

New patch to address comments provide by Nick Coghlan in person at PyCon-AU 
2012.

--
Added file: http://bugs.python.org/file26928/issue12643_2.diff

___
Python tracker 
<http://bugs.python.org/issue12643>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7741] Allow multiple statements in code.InteractiveConsole.push

2012-08-20 Thread aliles

aliles added the comment:

Patch option 1 of 2.

Incorporates Kristjan's patch and adds unit tests. This has the side effect of 
changing InteractiveConsole's behaviour with respect to displayhook(). I'm 
unsure if this is desirable.

------
nosy: +aliles
Added file: http://bugs.python.org/file26939/issue7741_x.patch

___
Python tracker 
<http://bugs.python.org/issue7741>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7741] Allow multiple statements in code.InteractiveConsole.push

2012-08-20 Thread aliles

aliles added the comment:

Patch option 2 of 2.

Alternative patch that adds a new method to InteractiveConsole to split the 
string into multiple lines, feeding each line to interpreter using push().

This doesn't change the behaviour regarding the displayhook. But this may not 
meet Kristjan's original goals.

--
Added file: http://bugs.python.org/file26940/issue7741_y.patch

___
Python tracker 
<http://bugs.python.org/issue7741>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7741] Allow multiple statements in code.InteractiveConsole.push

2012-08-20 Thread aliles

aliles added the comment:

A quick note regarding the last two patches submitted. These patches add unit 
tests using the test suite added for Issue #12643. This limits the patches 
suitable to Python 3.3 and up.

--
nosy: +ncoghlan

___
Python tracker 
<http://bugs.python.org/issue7741>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1228112] code.py use sys.excepthook to display exceptions

2012-08-20 Thread aliles

aliles added the comment:

Has this issue been resolved by issue been resolved by #12643, which has been 
merged for Python 3.3?

--
nosy: +aliles, ncoghlan

___
Python tracker 
<http://bugs.python.org/issue1228112>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14563] Segmentation fault on ctypes.Structure subclass with byte string field names

2012-08-20 Thread aliles

aliles added the comment:

Tested with Python 3.3b2 built from trunk. This issue is resolved.

--
resolution:  -> fixed
status: open -> closed

___
Python tracker 
<http://bugs.python.org/issue14563>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15749] cgitb prints html for text when display disabled.

2012-08-20 Thread aliles

New submission from aliles:

If cgitb has been enabled to format as text but suppress the display, the 
output is formated as html. (Prefixed with )

 >>> gitb.enable(display=0, format='txt')
 >>> raise ValueError('Oops!')
 A problem occurred in a Python script.

The patch changes the prefix used when display is suppressed based on whether 
output is formatted as html or text. Includes unit tests and documentation 
updates.

--
components: Library (Lib)
files: p1345523495.diff
keywords: patch
messages: 168735
nosy: aliles, ncoghlan
priority: normal
severity: normal
status: open
title: cgitb prints html for text when display disabled.
type: behavior
versions: Python 3.2
Added file: http://bugs.python.org/file26941/p1345523495.diff

___
Python tracker 
<http://bugs.python.org/issue15749>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7741] Allow multiple statements in code.InteractiveConsole.push

2012-08-22 Thread aliles

aliles added the comment:

I agree that the second patch adds little value to InteractiveConsole.

A third alternative would be to accept default grammar start symbol to be 
passed to __init__(). Although this would prevent mixing use of 'single' with 
'exec'.

--

___
Python tracker 
<http://bugs.python.org/issue7741>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8256] input() doesn't catch _PyUnicode_AsString() exception; io.StringIO().encoding is None

2012-08-22 Thread aliles

aliles added the comment:

Replicated this issue on Python 3.3b2. The cause is the 'encoding' and 'errors' 
attributes on io.StringIO() being None. Doctest replaces sys.stdout with a 
StringIO subclass. The exception raised is still a TypeError.

At this point I'm unsure what the fix should be:

1. Should the exception raised be more descriptive of the problem?
2. Should io.StringIO have real values for encoding and errors?
3. Should Doctest's StingIO class provide encoding and errors?

--
nosy: +aliles

___
Python tracker 
<http://bugs.python.org/issue8256>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15749] cgitb prints html for text when display disabled.

2012-08-25 Thread aliles

aliles added the comment:

Not an exact duplicate, although I should have seen that issue. Oops.

The 'display' and 'logdir' arguments are independent. Although I do appear to 
have gone a little overboard and fixed 12890 issue as well. Should I wait for 
that fix to be merged then reissue the patch?

--

___
Python tracker 
<http://bugs.python.org/issue15749>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8256] input() doesn't catch _PyUnicode_AsString() exception; io.StringIO().encoding is None

2012-08-26 Thread aliles

aliles added the comment:

Upload new patch that uses encoding and errors from stderr if stdout values are 
invalid unicode. Includes unit test in test_builtin.py.

With this patch I am no longer able to replicate this issue.

--
Added file: http://bugs.python.org/file27006/p1345978092.diff

___
Python tracker 
<http://bugs.python.org/issue8256>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com