[issue28603] traceback module can't format/print unhashable exceptions

2016-11-07 Thread Andreas Stührk

Andreas Stührk added the comment:

It was reported as bug to a project that uses the traceback module 
(https://github.com/bpython/bpython/issues/651). Parsley 
(https://pypi.python.org/pypi/Parsley) is at least one library that uses 
unhashable exceptions, although I guess it's by accident: it defines __eq__, 
but not __hash__ and that makes the exception unhashable under Python 3.

--

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



[issue28603] traceback module can't format/print unhashable exceptions

2016-11-03 Thread Andreas Stührk

New submission from Andreas Stührk:

The traceback module tries to handle loops caused by an exception's __cause__ 
or __context__ attributes when printing tracebacks. To do so, it adds already 
seen exceptions to a set. Unfortunately, it doesn't handle unhashable 
exceptions:

>>> class E(Exception): __hash__ = None
...
>>> traceback.print_exception(E, E(), None)
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python3.5/traceback.py", line 100, in print_exception
type(value), value, tb, limit=limit).format(chain=chain):
  File "/usr/lib/python3.5/traceback.py", line 439, in __init__
_seen.add(exc_value)
TypeError: unhashable type: 'E'

CPython's internal exception printing pretty much does the same, except it 
ignores any exception while operating on the seen set (see 
https://hg.python.org/cpython/file/8ee4ed577c03/Python/pythonrun.c#l813 ff).

Attached is a patch that makes the traceback module ignore TypeErrors while 
operating on the seen set. It also adds a (minimal) test.

--
components: Library (Lib)
files: unhashable_exceptions.diff
keywords: patch
messages: 280022
nosy: Trundle
priority: normal
severity: normal
status: open
title: traceback module can't format/print unhashable exceptions
Added file: http://bugs.python.org/file45342/unhashable_exceptions.diff

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



[issue20637] Support key-sharing dictionaries in subclasses

2014-02-16 Thread Andreas Stührk

Changes by Andreas Stührk andy-pyt...@hammerhartes.de:


--
nosy: +Trundle

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20637
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16612] Integrate Argument Clinic specialized preprocessor into CPython trunk

2012-12-04 Thread Andreas Stührk

Changes by Andreas Stührk andy-pyt...@hammerhartes.de:


--
nosy: +Trundle

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16612
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16047] Tools/freeze no longer works in Python 3

2012-11-13 Thread Andreas Stührk

Andreas Stührk added the comment:

See also issue #11824 for the ABI tags changes.

--
nosy: +Trundle

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16047
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15667] PEP 3121, 384 refactoring applied to pickle module

2012-11-11 Thread Andreas Stührk

Andreas Stührk added the comment:

See also issue #11349.

--
nosy: +Trundle

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15667
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12029] Catching virtual subclasses in except clauses

2012-09-16 Thread Andreas Stührk

Changes by Andreas Stührk andy-pyt...@hammerhartes.de:


--
nosy: +Trundle

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12029
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13908] PyType_FromSpec() lacks PyType_Ready() call

2012-01-29 Thread Andreas Stührk

New submission from Andreas Stührk andy-pyt...@hammerhartes.de:

As already stated by Amaury in 
http://mail.python.org/pipermail/python-dev/2011-October/113829.html, that 
leads to crashes:

 import xxlimited
 repr(xxlimited.Str)
[1]19575 segmentation fault (core dumped)  ./python

--
files: pytype_fromspec.patch
keywords: patch
messages: 152282
nosy: Trundle, amaury.forgeotdarc, loewis
priority: normal
severity: normal
status: open
title: PyType_FromSpec() lacks PyType_Ready() call
type: crash
versions: Python 3.2, Python 3.3
Added file: http://bugs.python.org/file24363/pytype_fromspec.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13908
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11829] inspect.getattr_static code execution with meta-metaclasses

2011-12-21 Thread Andreas Stührk

Andreas Stührk andy-pyt...@hammerhartes.de added the comment:

As the test demonstrates, it's still possible to trigger a dynamic lookup 
without the patch, hence I think this is still needed and valid, yes.

I updated the patch to make it reflect the latest committed changes.

--
Added file: http://bugs.python.org/file24073/getattr_static_metaclasses_v2.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11829
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13390] Hunt memory allocations in addition to reference leaks

2011-11-12 Thread Andreas Stührk

Changes by Andreas Stührk andy-pyt...@hammerhartes.de:


--
nosy: +Trundle

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13390
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13188] generator.throw() ignores __traceback__ of exception

2011-10-18 Thread Andreas Stührk

Andreas Stührk andy-pyt...@hammerhartes.de added the comment:

It leaks because `PyException_GetTraceback()` already returns a new reference, 
hence the Py_XINCREF(tb) is wrong.

--
nosy: +Trundle

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13188
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13204] sys.flags.__new__ crashes

2011-10-17 Thread Andreas Stührk

New submission from Andreas Stührk andy-pyt...@hammerhartes.de:

It's not possible (by intention) to instantiate a new instance of sys.flags. 
This is achieved by setting the tp_new slot to NULL (in `_PySys_Init()`), 
after `PyType_Ready()` is called, which means that a slot wrapper is added to 
the type dict for the tp_new slot (because the slot != NULL at that time). 
The problem is now that if one calls `sys.flags.__new__` directly, a null 
pointer dereference occurs in `tp_new_wrapper()`.

Attached is a patch that fixes the crash and adds a test.

--
files: sys_flags__new__crash.patch
keywords: patch
messages: 145763
nosy: Trundle
priority: normal
severity: normal
status: open
title: sys.flags.__new__ crashes
type: crash
versions: Python 2.7, Python 3.2, Python 3.3
Added file: http://bugs.python.org/file23431/sys_flags__new__crash.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13204
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13204] sys.flags.__new__ crashes

2011-10-17 Thread Andreas Stührk

Changes by Andreas Stührk andy-pyt...@hammerhartes.de:


Added file: http://bugs.python.org/file23432/sys_flags__new__crash_2.7.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13204
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13138] ElementTree's Element.iter() lacks versionadded

2011-10-08 Thread Andreas Stührk

New submission from Andreas Stührk andy-pyt...@hammerhartes.de:

See http://docs.python.org/whatsnew/2.7.html#updated-module-elementtree-1-3

--
assignee: docs@python
components: Documentation
files: Element_iter_versionadded.patch
keywords: patch
messages: 145199
nosy: Trundle, docs@python
priority: normal
severity: normal
status: open
title: ElementTree's Element.iter() lacks versionadded
versions: Python 2.7
Added file: http://bugs.python.org/file23352/Element_iter_versionadded.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13138
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12915] Add inspect.locate and inspect.resolve

2011-09-08 Thread Andreas Stührk

Changes by Andreas Stührk andy-pyt...@hammerhartes.de:


--
nosy: +Trundle

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12915
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12844] Support more than 255 arguments

2011-09-02 Thread Andreas Stührk

Andreas Stührk andy-pyt...@hammerhartes.de added the comment:

Attached is a patch that removes the limit and that allows passing an arbitrary 
number of positional and keyword arguments. Lacks tests for now.

--
keywords: +patch
nosy: +Trundle
Added file: http://bugs.python.org/file23089/issue12844_arbitrary_arguments.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12844
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10588] imp.find_module raises unexpected SyntaxError

2011-08-10 Thread Andreas Stührk

Changes by Andreas Stührk andy-pyt...@hammerhartes.de:


--
nosy: +Trundle

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10588
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12555] PEP 3151 implementation

2011-07-21 Thread Andreas Stührk

Changes by Andreas Stührk andy-pyt...@hammerhartes.de:


--
nosy: +Trundle

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12555
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12575] add a AST validator

2011-07-17 Thread Andreas Stührk

Changes by Andreas Stührk andy-pyt...@hammerhartes.de:


--
nosy: +Trundle

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12575
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12167] test_packaging reference leak

2011-07-07 Thread Andreas Stührk

Andreas Stührk andy-pyt...@hammerhartes.de added the comment:

Attached is a patch that replaces `lib2to3.fixer_Base.BaseFix.set_filename()` 
during tests. With the patch applied, I don't get any refleaks for packaging.

Another approach would be to simply remove the logging attribute of lib2to3 
fixers, as it isn't used anyway.

--
keywords: +patch
nosy: +benjamin.peterson
Added file: http://bugs.python.org/file22604/issue12167_patch_2to3.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12167
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12149] Segfault in _PyObject_GenericGetAttrWithDict

2011-07-05 Thread Andreas Stührk

Changes by Andreas Stührk andy-pyt...@hammerhartes.de:


--
nosy: +Trundle

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12149
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12167] test_packaging reference leak

2011-07-05 Thread Andreas Stührk

Andreas Stührk andy-pyt...@hammerhartes.de added the comment:

At least some of the remaining refleaks are caused by lib2to3. lib2to3 uses a 
logger with the filename as logger name (see 
`lib2to3.fixer_base.BaseFix.set_filename()`), but as the tests use a temporary 
file with an arbitrary name, a new logger is created on each test run iteration.

--
nosy: +Trundle

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12167
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2377] Replace __import__ w/ importlib.__import__

2011-06-26 Thread Andreas Stührk

Changes by Andreas Stührk andy-pyt...@hammerhartes.de:


--
nosy: +Trundle

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue2377
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12292] bpython

2011-06-09 Thread Andreas Stührk

Andreas Stührk andy-pyt...@hammerhartes.de added the comment:

This issue tracker is for reporting issues about Python itself. Issues 
concerning third-party projects should go to the respective issue tracker of 
the project first (in this case https://bitbucket.org/bobf/bpython/issues).

This specific issue is caused by issue #9319 and is already fixed. The fix will 
be included in the next release of Python 3.2. Also, a workaround was added to 
bpython which will be included in the next release of bpython.

--
nosy: +Trundle

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12292
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12265] revamp argument errors

2011-06-05 Thread Andreas Stührk

Changes by Andreas Stührk andy-pyt...@hammerhartes.de:


--
nosy: +Trundle

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12265
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12248] __dir__ semantics changed in Python 2.7.2

2011-06-02 Thread Andreas Stührk

Changes by Andreas Stührk andy-pyt...@hammerhartes.de:


--
nosy: +Trundle

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12248
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11614] import __hello__ is broken in Python 3

2011-05-12 Thread Andreas Stührk

Andreas Stührk andy-pyt...@hammerhartes.de added the comment:

A patch against 3.1. The new bytecode is now:

  1   0 LOAD_CONST   2 (True) 
  3 STORE_NAME   1 (initialized) 

  2   6 LOAD_NAME2 (print) 
  9 LOAD_CONST   0 ('Hello world...') 
 12 CALL_FUNCTION1 
 15 POP_TOP  
 16 LOAD_CONST   1 (None) 
 19 RETURN_VALUE

--
keywords: +patch
Added file: http://bugs.python.org/file21987/issue11614.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11614
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11614] import __hello__ is broken in Python 3

2011-05-12 Thread Andreas Stührk

Changes by Andreas Stührk andy-pyt...@hammerhartes.de:


Added file: http://bugs.python.org/file21988/issue11614_!.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11614
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11988] special method lookup docs don't address some important details

2011-05-03 Thread Andreas Stührk

Changes by Andreas Stührk andy-pyt...@hammerhartes.de:


--
nosy: +Trundle

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11988
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1856] shutdown (exit) can hang or segfault with daemon threads running

2011-05-02 Thread Andreas Stührk

Changes by Andreas Stührk andy-pyt...@hammerhartes.de:


--
nosy: +Trundle

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1856
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11972] input does not strip a trailing newline correctly on Windows

2011-05-01 Thread Andreas Stührk

Andreas Stührk andy-pyt...@hammerhartes.de added the comment:

See issue #11272.

--
nosy: +Trundle

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11972
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11966] Typo in PyModule_AddIntMacro's documentation

2011-04-30 Thread Andreas Stührk

New submission from Andreas Stührk andy-pyt...@hammerhartes.de:

The example says PyModule_AddConstant instead of PyModule_AddIntMacro. 
Attached is a patch for 3.1 branch, but it applies to all branches.

--
assignee: docs@python
components: Documentation
files: PyModule_AddIntMacro_doc.patch
keywords: patch
messages: 134879
nosy: Trundle, docs@python
priority: normal
severity: normal
status: open
title: Typo in PyModule_AddIntMacro's documentation
versions: Python 2.7, Python 3.1, Python 3.2, Python 3.3
Added file: http://bugs.python.org/file21843/PyModule_AddIntMacro_doc.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11966
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9756] Crash with custom __getattribute__

2011-04-29 Thread Andreas Stührk

Andreas Stührk andy-pyt...@hammerhartes.de added the comment:

I think it is reasonable to restrict the self argument of method descriptors 
and slot wrapper descriptors to real instances of the type. The called method 
can't cope with the value anyway (in the general case). Alternative Python 
implementations like Jython and PyPy already enforce this.

Attached is a patch against default branch that enforces this.

--
keywords: +patch
Added file: http://bugs.python.org/file21834/issue9756.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9756
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11343] Make errors due to full parser stack identifiable

2011-04-29 Thread Andreas Stührk

Andreas Stührk andy-pyt...@hammerhartes.de added the comment:

FWIW, this also affects `ast.literal_eval()`.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11343
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7517] freeze.py not ported to python3

2011-04-28 Thread Andreas Stührk

Andreas Stührk andy-pyt...@hammerhartes.de added the comment:

Note that I also opened issue #11824 for the abiflags problem.

--
nosy: +Trundle

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7517
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11938] duplicated test name in getattr_static's test case

2011-04-27 Thread Andreas Stührk

New submission from Andreas Stührk andy-pyt...@hammerhartes.de:

There are two tests called test_descriptor in getattr_static's test case. 
Attached is a patch that renames one.

--
components: Tests
files: duplicated_test_descriptor.patch
keywords: patch
messages: 134565
nosy: Trundle, michael.foord
priority: normal
severity: normal
status: open
title: duplicated test name in getattr_static's test case
versions: Python 3.2, Python 3.3
Added file: http://bugs.python.org/file21797/duplicated_test_descriptor.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11938
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11912] Python shouldn't use the mprotect() system call

2011-04-23 Thread Andreas Stührk

Andreas Stührk andy-pyt...@hammerhartes.de added the comment:

glibc's `dlopen()` can call `mprotect()`, which is used for loading C 
extensions.

--
nosy: +Trundle

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11912
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11906] Test_argparse failure but only in interactive mode

2011-04-22 Thread Andreas Stührk

Andreas Stührk andy-pyt...@hammerhartes.de added the comment:

That happens because argparse uses `os.basename(sys.argv[0])` (per default) as 
program name, but `sys.argv[0]` is usually a string of length 0 at interactive 
sessions. The tests use ``usage: {} format(program_name)`` (note that 
there will be two spaces for an empty `program_name`) for the expected output, 
while argparse only outputs one space in that case.

--
nosy: +Trundle

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11906
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9319] imp.find_module('test/badsyntax_pep3120') causes segfault

2011-04-18 Thread Andreas Stührk

Andreas Stührk andy-pyt...@hammerhartes.de added the comment:

How about applying the workaround patch to Python 3.2? An unprecise error 
message is way better than a segfault.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9319
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11506] b'' += gives SystemError instead of SyntaxError

2011-04-12 Thread Andreas Stührk

Andreas Stührk andy-pyt...@hammerhartes.de added the comment:

Benjamin told me that test_syntax is the right place for the test and indeed, 
there are quite some literals already tested.

--
nosy: +benjamin.peterson
Added file: http://bugs.python.org/file21637/issue_11506_v2.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11506
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11829] inspect.getattr_static code execution with meta-metaclasses

2011-04-11 Thread Andreas Stührk

New submission from Andreas Stührk andy-pyt...@hammerhartes.de:

The commit for issue #11133 omitted a part of the patch that checked whether 
the __dict__ attribute of metaclasses are shadowed. That makes it possible to 
trigger code execution in the case of metaclasses that have metaclasses.

Attached is a patch with a test and a fix.

--
components: Library (Lib)
files: getattr_static_metaclasses.patch
keywords: patch
messages: 133549
nosy: Trundle, michael.foord
priority: normal
severity: normal
status: open
title: inspect.getattr_static code execution with meta-metaclasses
type: behavior
versions: Python 3.2, Python 3.3
Added file: http://bugs.python.org/file21621/getattr_static_metaclasses.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11829
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11824] freeze.py broken due to ABI flags

2011-04-10 Thread Andreas Stührk

New submission from Andreas Stührk andy-pyt...@hammerhartes.de:

The recent addition of ABI flags broke the freeze tool as it doesn't construct 
the paths to required files correctly any longer. The attached patch fixes the 
issue for me, but I'm not too sure that I used the right config values.

--
components: Demos and Tools
files: freeze.patch
keywords: patch
messages: 133495
nosy: Trundle
priority: normal
severity: normal
status: open
title: freeze.py broken due to ABI flags
type: behavior
versions: Python 3.2, Python 3.3
Added file: http://bugs.python.org/file21609/freeze.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11824
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11813] inspect.getattr_static doesn't get module attributes

2011-04-09 Thread Andreas Stührk

New submission from Andreas Stührk andy-pyt...@hammerhartes.de:

My patch for issue #11133 introduced a regression: it is no longer possible to 
get attributes of modules. That is because modules use tp_dictoffset (at C 
level). The instance __dict__ is exposed to Python code using a 
types.MemberDescriptorType. My patch for issue #11133 currently assumes that 
accessing the instance __dict__ can trigger code execution, but that is 
impossible: The access itself can't trigger code execution (it just returns a 
PyObject in the C struct). Theoretically, it could return any Python object, 
but that doesn't matter, as the code that uses the object only calls dict 
methods directly, hence a TypeError is the worst thing that can happen 
(although it shouldn't ever happen in practise).

Attached is a patch that adds a test and fixes the issue.

--
components: Library (Lib)
files: getattr_static_modules.patch
keywords: patch
messages: 133432
nosy: Trundle, michael.foord
priority: normal
severity: normal
status: open
title: inspect.getattr_static doesn't get module attributes
type: behavior
versions: Python 3.2, Python 3.3
Added file: http://bugs.python.org/file21596/getattr_static_modules.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11813
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11770] inspect.dir_static

2011-04-09 Thread Andreas Stührk

Andreas Stührk andy-pyt...@hammerhartes.de added the comment:

See issue #11813 for the module problem.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11770
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11796] list and generator expressions in a class definition fail if expression condition refers to a class variable

2011-04-08 Thread Andreas Stührk

Changes by Andreas Stührk andy-pyt...@hammerhartes.de:


--
nosy: +Trundle

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11796
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11770] inspect.dir_static

2011-04-08 Thread Andreas Stührk

Andreas Stührk andy-pyt...@hammerhartes.de added the comment:

A first patch, misses any documentation changes. While working on it, I 
realised that modules technically shadow the __dict__ attribute (because 
modules use tp_dictoffset, hence module have a __dict__ member that points to 
the instance dict). I updated `_shadowed_dict()` so that it now disregards 
member descriptors as shadowing (as they will never trigger any code 
execution), but theoretically, the members can be any object (not just dicts), 
so I have to think a bit more about that case (as a custom object still can 
trigger code execution).

Also, `dir_static()` behaves slightly different from `dir()` (e.g. `dir()` 
raises a `TypeError` if the module's __dict__ attribute isn't a dictionary, 
which is kind of impossible for `dir_static` as it doesn't even try to acccess 
`__dict__` if it is shadowed), but IMHO such edge-cases are expected to behave 
differently for a static version and hence we don't care at all about that.

--
keywords: +patch
Added file: http://bugs.python.org/file21591/issue11770.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11770
___
___
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

2011-04-08 Thread Andreas Stührk

Changes by Andreas Stührk andy-pyt...@hammerhartes.de:


--
nosy: +Trundle

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



[issue11778] __subclasscheck__ : class P(M): __metaclass__=M causes maximum recursion depth exceeded.

2011-04-07 Thread Andreas Stührk

Andreas Stührk andy-pyt...@hammerhartes.de added the comment:

That issue is already fixed in 2.7 and 3.x (by ae006386ec39). Also, it's a 
duplicate of issue #2325, hence I think this one can be closed.

--
nosy: +Trundle

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11778
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11770] inspect.dir_static

2011-04-07 Thread Andreas Stührk

Changes by Andreas Stührk andy-pyt...@hammerhartes.de:


--
nosy: +Trundle

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11770
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11764] inspect.getattr_static code execution w/ class body as non dict

2011-04-07 Thread Andreas Stührk

Changes by Andreas Stührk andy-pyt...@hammerhartes.de:


--
nosy: +Trundle

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11764
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11764] inspect.getattr_static code execution w/ class body as non dict

2011-04-07 Thread Andreas Stührk

Andreas Stührk andy-pyt...@hammerhartes.de added the comment:

Can you perhaps elaborate on the first part? I really can't see right now how a 
class __dict__ can be something different from a dictionary. It's true that the 
class dict can be any mapping while the class is being created, but that's 
uninteresting for getattr_static as there is no class object yet that one can 
pass to getattr_static.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11764
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6498] Py_Main() does not return on SystemExit

2011-03-29 Thread Andreas Stührk

Andreas Stührk andy-pyt...@hammerhartes.de added the comment:

The comment in the source that describes `Py_InspectFlag` also says 
`SystemError` instead of `SystemExit`. I changed that and added the missing 
:exc: for the SystemExit and created a patch for 3.1.

--
nosy: +Trundle
Added file: http://bugs.python.org/file21461/issue6498_27.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6498
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6498] Py_Main() does not return on SystemExit

2011-03-29 Thread Andreas Stührk

Changes by Andreas Stührk andy-pyt...@hammerhartes.de:


Added file: http://bugs.python.org/file21462/issue6498_31.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6498
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11705] sys.excepthook doesn't work in imported modules

2011-03-28 Thread Andreas Stührk

Andreas Stührk andy-pyt...@hammerhartes.de added the comment:

I really doubt that this issue has anything to do with `sys.excepthook` at all. 
It's rather that module members are set to `None` during module cleanup. 
Because the module raises an exception when one tries to import it, it will be 
cleaned up immediately (see `PyImport_ExecCodeModuleEx`: it calls 
`remove_module` which will call at some point `_PyModule_Clear`). At the time 
when `sys.excepthook` is called, all module members are already set to `None`.

One can easily demonstrate that this is really the problem by removing the 
exception raise in your example code: If one then imports loggingTest in an 
interactive session and raises an exception, the expected behaviour can be 
observed.

Another workaround is to bind `logger` as a default argument (i.e. ``def 
handleException(excType, excValue, traceback, logger=logger):``).

--
nosy: +Trundle

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11705
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11705] sys.excepthook doesn't work in imported modules

2011-03-28 Thread Andreas Stührk

Andreas Stührk andy-pyt...@hammerhartes.de added the comment:

The difference between 2.7 and 2.7.1 is issue #10068 (e2aa3b1d08bc).

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11705
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11705] sys.excepthook doesn't work in imported modules

2011-03-28 Thread Andreas Stührk

Andreas Stührk andy-pyt...@hammerhartes.de added the comment:

In my opinion, it is expected behaviour (but then, I'm not a core developer).

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11705
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11676] imp.load_module and submodules - doc issue, or bug?

2011-03-28 Thread Andreas Stührk

Changes by Andreas Stührk andy-pyt...@hammerhartes.de:


--
nosy: +Trundle

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11676
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11614] import __hello__ is broken in Python 3

2011-03-26 Thread Andreas Stührk

Andreas Stührk andy-pyt...@hammerhartes.de added the comment:

On Fri, Mar 25, 2011 at 5:52 PM, Éric Araujo rep...@bugs.python.org wrote:
 Okay, it doesn’t work with -m __hello__, but using -c import __hello__ I 
 can see the message in all versions.

Can you elaborate on that? I.e. the versions and the actual message.
The current bytecode of the __hello__ module is (default branch):

  1   0 LOAD_CONST   1 (True)
  3 STORE_NAME   1 (initialized)
  6 LOAD_CONST   0 (None)
  9 RETURN_VALUE

I'd be a bit surprised if that really prints a message.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11614
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11343] Make errors due to full parser stack identifiable

2011-03-24 Thread Andreas Stührk

Andreas Stührk andy-pyt...@hammerhartes.de added the comment:

On Fri, Mar 4, 2011 at 9:30 PM, Terry J. Reedy rep...@bugs.python.org wrote:
 I agree with Martin (from 2000) that SyntaxError is not right either. Perhaps 
 a new ParseError subclass thereof.

I added a new `ParserError` that inherits from `SyntaxError`.

 I presume REPL == read-eval-print-loop (from Google). Would a new error help 
 such programs (like code.interact, or IDLE)?

Yes, I meant a read-eval-print-loop. A new error would help and if
it's a subclass of SyntaxError, they most likely need no changes at
all to handle that new error, as they have to deal with SyntaxErrors
anyway.

--
Added file: http://bugs.python.org/file21387/issue11343.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11343
___diff -r a729dfdbd24b Doc/library/exceptions.rst
--- a/Doc/library/exceptions.rstThu Mar 24 22:32:56 2011 +0200
+++ b/Doc/library/exceptions.rstFri Mar 25 01:43:13 2011 +0100
@@ -289,6 +289,12 @@
This is a subclass of :exc:`IndentationError`.
 
 
+.. exception:: ParserError
+
+   Raised when the parser encounters an error due to internal limitations.
+   This is a subclass of :exc:`SyntaxError`.
+
+
 .. exception:: SystemError
 
Raised when the interpreter finds an internal error, but the situation does 
not
diff -r a729dfdbd24b Include/errcode.h
--- a/Include/errcode.h Thu Mar 24 22:32:56 2011 +0200
+++ b/Include/errcode.h Fri Mar 25 01:43:13 2011 +0100
@@ -30,6 +30,7 @@
 #define E_EOLS 24  /* EOL in single-quoted string */
 #define E_LINECONT 25  /* Unexpected characters after a line 
continuation */
 #define E_IDENTIFIER26  /* Invalid characters in identifier */
+#define E_TOONESTED 27  /* Too many opening parens */
 
 #ifdef __cplusplus
 }
diff -r a729dfdbd24b Include/pyerrors.h
--- a/Include/pyerrors.hThu Mar 24 22:32:56 2011 +0200
+++ b/Include/pyerrors.hFri Mar 25 01:43:13 2011 +0100
@@ -149,6 +149,7 @@
 PyAPI_DATA(PyObject *) PyExc_SyntaxError;
 PyAPI_DATA(PyObject *) PyExc_IndentationError;
 PyAPI_DATA(PyObject *) PyExc_TabError;
+PyAPI_DATA(PyObject *) PyExc_ParserError;
 PyAPI_DATA(PyObject *) PyExc_ReferenceError;
 PyAPI_DATA(PyObject *) PyExc_SystemError;
 PyAPI_DATA(PyObject *) PyExc_SystemExit;
diff -r a729dfdbd24b Lib/test/exception_hierarchy.txt
--- a/Lib/test/exception_hierarchy.txt  Thu Mar 24 22:32:56 2011 +0200
+++ b/Lib/test/exception_hierarchy.txt  Fri Mar 25 01:43:13 2011 +0100
@@ -29,7 +29,8 @@
   |+-- NotImplementedError
   +-- SyntaxError
   |+-- IndentationError
-  | +-- TabError
+  ||+-- TabError
+  |+-- ParserError
   +-- SystemError
   +-- TypeError
   +-- ValueError
diff -r a729dfdbd24b Lib/test/test_parser.py
--- a/Lib/test/test_parser.py   Thu Mar 24 22:32:56 2011 +0200
+++ b/Lib/test/test_parser.py   Fri Mar 25 01:43:13 2011 +0100
@@ -542,10 +542,7 @@
 
 def test_trigger_memory_error(self):
 e = self._nested_expression(100)
-print(Expecting 's_push: parser stack overflow' in next line,
-  file=sys.stderr)
-sys.stderr.flush()
-self.assertRaises(MemoryError, parser.expr, e)
+self.assertRaises(ParserError, parser.expr, e)
 
 class STObjectTestCase(unittest.TestCase):
 Test operations on ST objects themselves
diff -r a729dfdbd24b Objects/exceptions.c
--- a/Objects/exceptions.c  Thu Mar 24 22:32:56 2011 +0200
+++ b/Objects/exceptions.c  Fri Mar 25 01:43:13 2011 +0100
@@ -1063,6 +1063,14 @@
 
 
 /*
+ *ParserError extends SyntaxError
+ */
+MiddlingExtendsException(PyExc_SyntaxError, ParserError, SyntaxError,
+ Raised when the parser encounters an error due 
+ to internal limitations.);
+
+
+/*
  *LookupError extends Exception
  */
 SimpleExtendsException(PyExc_Exception, LookupError,
@@ -1998,6 +2006,7 @@
 PRE_INIT(SyntaxError)
 PRE_INIT(IndentationError)
 PRE_INIT(TabError)
+PRE_INIT(ParserError)
 PRE_INIT(LookupError)
 PRE_INIT(IndexError)
 PRE_INIT(KeyError)
@@ -2061,6 +2070,7 @@
 POST_INIT(SyntaxError)
 POST_INIT(IndentationError)
 POST_INIT(TabError)
+POST_INIT(ParserError)
 POST_INIT(LookupError)
 POST_INIT(IndexError)
 POST_INIT(KeyError)
diff -r a729dfdbd24b Parser/parser.c
--- a/Parser/parser.c   Thu Mar 24 22:32:56 2011 +0200
+++ b/Parser/parser.c   Fri Mar 25 01:43:13 2011 +0100
@@ -39,8 +39,7 @@
 {
 register stackentry *top;
 if (s-s_top == s-s_base) {
-fprintf(stderr, s_push: parser stack overflow\n);
-return E_NOMEM;
+return E_TOONESTED;
 }
 top = --s-s_top;
 top-s_dfa = d;
diff -r a729dfdbd24b Python/pythonrun.c
--- a/Python/pythonrun.cThu Mar 24 22:32:56 2011 +0200
+++ b/Python/pythonrun.cFri Mar 25 01:43:13 2011 +0100
@@ 

[issue11343] Make errors due to full parser stack identifiable

2011-03-24 Thread Andreas Stührk

Changes by Andreas Stührk andy-pyt...@hammerhartes.de:


Removed file: http://bugs.python.org/file20926/parser_nested_SyntaxError.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11343
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11343] Make errors due to full parser stack identifiable

2011-03-24 Thread Andreas Stührk

Changes by Andreas Stührk andy-pyt...@hammerhartes.de:


Removed file: http://bugs.python.org/file20925/parser_nested_MemoryError.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11343
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11627] segfault raising an arbitrary object as an exception

2011-03-22 Thread Andreas Stührk

Andreas Stührk andy-pyt...@hammerhartes.de added the comment:

Thanks Nick, that is indeed much nicer. I updated the patch.

I also created a patch for 2.7, in case anyone thinks it's a good idea to fix 
it there, too.

--
Added file: http://bugs.python.org/file21346/issue11627_3.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11627
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11627] segfault raising an arbitrary object as an exception

2011-03-22 Thread Andreas Stührk

Changes by Andreas Stührk andy-pyt...@hammerhartes.de:


Added file: http://bugs.python.org/file21347/issue11627_py27.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11627
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11641] raw_input() - input() security issue

2011-03-22 Thread Andreas Stührk

Andreas Stührk andy-pyt...@hammerhartes.de added the comment:

`input()` in Python 3 is the same as `raw_input()` in Python 2. It does not 
evaluate the input as Python code.

--
nosy: +Trundle

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11641
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11642] regression: input() doesn't strip a trailing newline on Windows

2011-03-22 Thread Andreas Stührk

Andreas Stührk andy-pyt...@hammerhartes.de added the comment:

This is a duplicate of issue #11272.

--
nosy: +Trundle

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11642
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11627] segfault raising an arbitrary object as an exception

2011-03-22 Thread Andreas Stührk

Andreas Stührk andy-pyt...@hammerhartes.de added the comment:

Another thing that can happen is that `__new__()` does return an instance of 
BaseException, but that the return value is not an instance of the expected 
class.

Example:

class MyException(OSError):
def __new__(*args):
return Exception()

try:
raise MyException
except OSError as e:
print(isinstance(e, OSError))

That would print False. Currently, the patch doesn't check for that, should 
it do so?

Also, the error message for the 2.7 patch doesn't include that old-style 
classes are allowed, hence the patch needs to be updated if it should go into 
2.7.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11627
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11627] segfault raising an arbitrary object as an exception

2011-03-21 Thread Andreas Stührk

Changes by Andreas Stührk andy-pyt...@hammerhartes.de:


--
nosy: +Trundle

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11627
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11627] segfault raising an arbitrary object as an exception

2011-03-21 Thread Andreas Stührk

Andreas Stührk andy-pyt...@hammerhartes.de added the comment:

On Mon, Mar 21, 2011 at 10:27 PM, Santoso Wijaya rep...@bugs.python.org wrote:

 Santoso Wijaya santoso.wij...@gmail.com added the comment:

 Also, why is the print() in __new__ executed twice?

Because `PyErr_NormalizeException()` is called twice: First time when
the exceptions is raised, and then a second time when the exception is
caught. Because the previous call didn't instantiate an instance of a
exception, the second call will (try to) create a new exception
instance.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11627
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11627] segfault raising an arbitrary object as an exception

2011-03-21 Thread Andreas Stührk

Andreas Stührk andy-pyt...@hammerhartes.de added the comment:

Attached is a patch. I'm not too happy about the error message though, I think 
it's more confusing than helpful.

--
keywords: +patch
Added file: http://bugs.python.org/file21328/issue11627.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11627
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11627] segfault raising an arbitrary object as an exception

2011-03-21 Thread Andreas Stührk

Andreas Stührk andy-pyt...@hammerhartes.de added the comment:

 Antoine Pitrou pit...@free.fr added the comment:
 You could try something more explicit, such as
 calling %s() should have returned an instance of BaseException, not %s
 % (type, Py_TYPE(value))

Thanks, updated the patch.

 By the way, you have a tab character in your patch. Please only use
 spaces for indentation.

I am terribly sorry for that. I always realise after the first changed
line that my editor is in the wrong C mode.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11627
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11627] segfault raising an arbitrary object as an exception

2011-03-21 Thread Andreas Stührk

Changes by Andreas Stührk andy-pyt...@hammerhartes.de:


Added file: http://bugs.python.org/file21329/issue11627_2.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11627
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11393] Integrate faulthandler module into Python 3.3

2011-03-21 Thread Andreas Stührk

Changes by Andreas Stührk andy-pyt...@hammerhartes.de:


--
nosy: +Trundle

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11393
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10977] Concrete object C API needs abstract path for subclasses of builtin types

2011-03-20 Thread Andreas Stührk

Changes by Andreas Stührk andy-pyt...@hammerhartes.de:


--
nosy: +Trundle

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10977
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11614] import __hello__ is broken in Python 3

2011-03-20 Thread Andreas Stührk

Andreas Stührk andy-pyt...@hammerhartes.de added the comment:

That was changed in [a2213060d9dd], see issue #1414.

--
nosy: +Trundle

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11614
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11603] Python crashes or hangs when rebinding __repr__ as __str__

2011-03-19 Thread Andreas Stührk

Andreas Stührk andy-pyt...@hammerhartes.de added the comment:

On Sat, Mar 19, 2011 at 12:41 AM, Terry J. Reedy rep...@bugs.python.org wrote:
 Whether or not this fixes issue ('should' is a bit vague, confirmation is 
 needed) this seems like a good idea.

Yes, it fixes the issue. I wrote should because I was a bit in a
hurry and hadn't put much thought into whether it's the best way to
fix that issue (or if there even is an issue that should be fixed).
Now that I thought a bit more about it, I think it's a decent fix for
the issue. There is still the possibility that a custom __repr__
method calls `object.__str__`, but that will either raise a
RuntimeError at some point (due to stack exhaustion; if the method is
a Python method) or it's a case of well, don't do that (if the
method is implemented in C).

 However, I also do not know where to put it as there is no test_object or 
 test_typeobject file that I see.

I updated the patch and put a test into test_class which seemed like a
good place for it to me. Also, I did the patch against the 3.1 branch
this time, so it can be forward-ported.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11603
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11603] Python crashes or hangs when rebinding __repr__ as __str__

2011-03-19 Thread Andreas Stührk

Changes by Andreas Stührk andy-pyt...@hammerhartes.de:


Removed file: http://bugs.python.org/file21283/issue_11603.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11603
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11603] Python crashes or hangs when rebinding __repr__ as __str__

2011-03-19 Thread Andreas Stührk

Changes by Andreas Stührk andy-pyt...@hammerhartes.de:


Added file: http://bugs.python.org/file21300/issue_11603.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11603
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11603] Python crashes or hangs when rebinding __repr__ as __str__

2011-03-18 Thread Andreas Stührk

Andreas Stührk andy-pyt...@hammerhartes.de added the comment:

Confirmed under 3.2 and 2.7. The attached patch should fix the issue.

--
keywords: +patch
nosy: +Trundle
Added file: http://bugs.python.org/file21283/issue_11603.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11603
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11506] b'' += gives SystemError instead of SyntaxError

2011-03-17 Thread Andreas Stührk

Changes by Andreas Stührk andy-pyt...@hammerhartes.de:


Removed file: http://bugs.python.org/file21140/issue_11506.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11506
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11506] b'' += gives SystemError instead of SyntaxError

2011-03-17 Thread Andreas Stührk

Andreas Stührk andy-pyt...@hammerhartes.de added the comment:

Added a test. Perhaps that should be done for other literals as well?

--
Added file: http://bugs.python.org/file21272/issue_11506.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11506
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11550] Fix ResourceWarning in test_pulldom

2011-03-15 Thread Andreas Stührk

Andreas Stührk andy-pyt...@hammerhartes.de added the comment:

Any reason why the patch removes the `list()` calls? Without them, no parsing 
happens at all.

--
nosy: +Trundle

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11550
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11506] b'' += gives SystemError instead of SyntaxError

2011-03-14 Thread Andreas Stührk

Andreas Stührk andy-pyt...@hammerhartes.de added the comment:

Seems like like a case for Bytes_kind is missing in `set_context()`. Attached 
is a patch, without a test though.

--
keywords: +patch
nosy: +Trundle
Added file: http://bugs.python.org/file21140/issue_11506.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11506
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11510] Peephole breaks set unpacking

2011-03-14 Thread Andreas Stührk

Changes by Andreas Stührk andy-pyt...@hammerhartes.de:


--
nosy: +Trundle

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11510
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1559549] ImportError needs attributes for module and file name

2011-03-14 Thread Andreas Stührk

Andreas Stührk andy-pyt...@hammerhartes.de added the comment:

 I am sorry again for those mistakes, it's all completely new to me.

No worries!

I have fixed those issues and created new patch. Using hg export, that now 
spans over two commits. Is it the way those patches should be provided, or 
should I gather all changes into a one commit?

A single patch (where all changesets are flattened into one) is the
preferred way. For general advice, you can read the Developer's Guide
at http://docs.python.org/devguide/ (e.g.
http://docs.python.org/devguide/patch.html).

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1559549
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11549] Rewrite peephole to work on AST

2011-03-14 Thread Andreas Stührk

Changes by Andreas Stührk andy-pyt...@hammerhartes.de:


--
nosy: +Trundle

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11549
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11477] Bug in code dispatching based on internal slots

2011-03-12 Thread Andreas Stührk

Changes by Andreas Stührk andy-pyt...@hammerhartes.de:


--
nosy: +Trundle

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11477
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11470] Flag inappropriate uses of callable class attributes

2011-03-11 Thread Andreas Stührk

Changes by Andreas Stührk andy-pyt...@hammerhartes.de:


--
nosy: +Trundle

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11470
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11434] Python 3.2 input() does not remove \r at the end of returned string.

2011-03-07 Thread Andreas Stührk

Andreas Stührk andy-pyt...@hammerhartes.de added the comment:

This is a duplicate of issue #11272.

--
nosy: +Trundle

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11434
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9651] ctypes crash when writing zerolength string buffer to file

2011-03-07 Thread Andreas Stührk

Andreas Stührk andy-pyt...@hammerhartes.de added the comment:

Looks good to me.

--
nosy: +Trundle

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9651
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1559549] ImportError needs attributes for module and file name

2011-03-06 Thread Andreas Stührk

Andreas Stührk andy-pyt...@hammerhartes.de added the comment:

There are some issues with the patch:

- The check for size of `args` in `ImportError_init()` is wrong: You can't 
create an `ImportError` with 3 arguments now (TypeError: ImportError expected 
2 arguments, got 3)
- `ImportError_clear()` doesn't clear ``self-msg``.
- `ImportError_str()` doesn't increase the reference count for ``self-msg`` 
before returning it.
- The code that raises the exception (Python/import.c) doesn't check for error 
return values: All the calls can return NULL which will cause a segfault due to 
the uncoditional Py_DECREFs.
- Using `PyUnicode_DecodeASCII()` for the module name is wrong (IMHO), it 
should rather be something like `PyUnicode_DecodeUTF8()` as module names can 
contain non-ASCII characters in Python 3 and are AFAIK (at least right now) 
always encoded using utf-8.

--
nosy: +Trundle, haypo

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1559549
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11406] There is no os.listdir() equivalent returning generator instead of list

2011-03-05 Thread Andreas Stührk

Changes by Andreas Stührk andy-pyt...@hammerhartes.de:


--
nosy: +Trundle

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11406
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11321] 9th import of module _pickle always crashes

2011-02-27 Thread Andreas Stührk

Andreas Stührk andy-pyt...@hammerhartes.de added the comment:

It's because the _pickle module doesn't incref Pickler_Type and Unpickler_Type 
before calling `PyModule_AddObject()` (which steals a reference).

The attached patch fixes the issue.

--
keywords: +patch
nosy: +Trundle
Added file: http://bugs.python.org/file20931/issue11321.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11321
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11342] ResourceWarning: unclosed file _io.TextIOWrapper

2011-02-27 Thread Andreas Stührk

Andreas Stührk andy-pyt...@hammerhartes.de added the comment:

@Éric: You should probably strip the colour from your diff :-)

--
nosy: +Trundle

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11342
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4600] __class__ assignment: new-style? heap? == confusing

2011-02-27 Thread Andreas Stührk

Changes by Andreas Stührk andy-pyt...@hammerhartes.de:


--
nosy: +Trundle

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4600
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11321] 9th import of module _pickle always crashes

2011-02-27 Thread Andreas Stührk

Andreas Stührk andy-pyt...@hammerhartes.de added the comment:

That initial increase you can see happens because the module's dict is copied 
in `_PyImport_FixupExtensionUnicode()`.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11321
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11349] _pickle should implement the module finalisation protocol

2011-02-27 Thread Andreas Stührk

Changes by Andreas Stührk andy-pyt...@hammerhartes.de:


--
nosy: +Trundle

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11349
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11343] Make errors due to full parser stack identifiable

2011-02-26 Thread Andreas Stührk

New submission from Andreas Stührk andy-pyt...@hammerhartes.de:

Currently, if the parser's internal stack is full (as it happens when
the parser tries to parse a deeply nested structure), the parser
writes an error message to stderr and a bare MemoryError is
raised. That way, it is really hard for REPLs do handle input that
causes the parser to exhaust its stack correctly (see e.g. ``python -c
print '(' * 100 + ')' * 100 | python -c import code;
code.interact()``).

In my opinion, a SyntaxError would be great because that way one can
easily see where in the source code the error is caused. One reason
against that (stated by MvL in msg1687) is that it's really
syntactically correct Python and only the parser can't parse it. But
then, the same is also true when there are too many indentation levels
in which case an `IndentationError` is raised (which is a subclass of
`SyntaxError`).

I have attached two patches: The first still raises a `MemoryError`
(for the sake of backward compatibility) but adds a message (too many
opening parens) to it. The second raises a `SyntaxError` instead.

--
components: Interpreter Core
files: parser_nested_MemoryError.patch
keywords: patch
messages: 129604
nosy: Trundle, marienz
priority: normal
severity: normal
status: open
title: Make errors due to full parser stack identifiable
type: feature request
versions: Python 3.3
Added file: http://bugs.python.org/file20925/parser_nested_MemoryError.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11343
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11343] Make errors due to full parser stack identifiable

2011-02-26 Thread Andreas Stührk

Changes by Andreas Stührk andy-pyt...@hammerhartes.de:


Added file: http://bugs.python.org/file20926/parser_nested_SyntaxError.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11343
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11256] inspect.getcallargs raises TypeError on valid arguments

2011-02-26 Thread Andreas Stührk

Andreas Stührk andy-pyt...@hammerhartes.de added the comment:

Confirmed under Python 2.7, 3.2 and 3.3. Patch looks good to me. Attached is a 
patch for 2.7.

--
nosy: +Trundle
Added file: http://bugs.python.org/file20927/issue11256_py27.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11256
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11133] inspect.getattr_static code execution

2011-02-21 Thread Andreas Stührk

Andreas Stührk andy-pyt...@hammerhartes.de added the comment:

 The patch is not sufficient - instances may have a class member __dict__ 
 whilst still having an instance __dict__.

Sure, but I don't think there is a way how you can access the instance
__dict__ in that case inside Python code. At least I can't think of
one.

Alternatively the __dict__ property may be provided by a base class and so 
not available in type(obj).__dict__ but still be provided by a property.

 I don't think there is any general way to tell whether fetching obj.__dict__ 
 will get an instance dictionary or fetch a __dict__ member from the class 
 or a base-class... (Hence the documented exception.)

Why not? ``obj.__dict__`` will fetch the instance dictionary iff there
is no class attribute __dict__ in any of the base classes. In the
patch,``type.__dict__[__dict__].__get__()`` is used to get (without
any doubt) the class dictionary. By looking inside that dictionary, we
can now tell whether __dict__ is overwritten: If it isn't
overwritten, the dictionary either doesn't have a __dict__ entry at
all or the value is a getset_descriptor. So we just need to iterate
over a type's mro, look inside each entries' dictionary and stop when
a __dict__ entry is found.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11133
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



  1   2   >