[issue9259] Python 2.7 breaks assigned __exit__s

2010-07-26 Thread Dave Malcolm

Changes by Dave Malcolm dmalc...@redhat.com:


--
nosy: +dmalcolm

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



[issue9259] Python 2.7 breaks assigned __exit__s

2010-07-14 Thread Ariel Ben-Yehuda

New submission from Ariel Ben-Yehuda ariel@gmail.com:

Hello, I think there is a problem with Python 2.7: I installed it, and tried to 
compile GObject-Introspection 0.9.2. Here is the result:

...
  GISCAN GLib-2.0.gir
Traceback (most recent call last):
  File ../tools/g-ir-scanner, line 36, in module
from giscanner.scannermain import scanner_main
  File /sources/gobject-introspection-0.9.2/giscanner/scannermain.py, line 
31, in module
from giscanner.dumper import compile_introspection_binary
  File /sources/gobject-introspection-0.9.2/giscanner/dumper.py, line 26, in 
module
from .glibtransformer import IntrospectionBinary
  File /sources/gobject-introspection-0.9.2/giscanner/glibtransformer.py, 
line 34, in module
from .transformer import Names
  File /sources/gobject-introspection-0.9.2/giscanner/transformer.py, line 
31, in module
from .girparser import GIRParser
  File /sources/gobject-introspection-0.9.2/giscanner/girparser.py, line 32, 
in module
from .girwriter import COMPATIBLE_GIR_VERSION
  File /sources/gobject-introspection-0.9.2/giscanner/girwriter.py, line 30, 
in module
from .xmlwriter import XMLWriter
  File /sources/gobject-introspection-0.9.2/giscanner/xmlwriter.py, line 70, 
in module
with LibtoolImporter:
AttributeError: __exit__

Oops, no GObject-Introspection for me. Investigating the bug, I looked in the 
recent changes in Python2.7 for something interesting, and found this: 
A new opcode was added to perform the initial setup for with statements, 
looking up the __enter__()  and __exit__()  methods. (Contributed by Benjamin 
Peterson.)

Finally, I made 3 test cases to the bug. All 3 produce no input in Python 2.6, 
but crash pretty nicely in 2.7, the first 2 not finding __exit__ and the last 
missing __enter__.

I will try to make a patch, however my CPython skills are not so great, so you 
will probably make a better one.

--
components: Interpreter Core
files: tests.tar.xz
messages: 110268
nosy: arielbyd
priority: normal
severity: normal
status: open
title: Python 2.7 breaks assigned __exit__s
versions: Python 2.7
Added file: http://bugs.python.org/file17996/tests.tar.xz

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



[issue9259] Python 2.7 breaks assigned __exit__s

2010-07-14 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


--
nosy: +benjamin.peterson

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



[issue9259] Python 2.7 breaks assigned __exit__s

2010-07-14 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

Thank you for the report. Unfortunately, the 2.6 behavior was a bug, as I 
explained on #9220: Magic methods are looked up on the object’s class, not in 
the object’s __dict__. http://docs.python.org/reference/datamodel#specialnames

(Your test with class methods was a clever idea, but a class is a type 
instance, so it’s the same behavior: __enter__ is looked up on type, not on the 
class. Nice try :)

Tip for future bug reports: We prefer regular files over archives. Thanks again!

--
nosy: +merwok

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



[issue9259] Python 2.7 breaks assigned __exit__s

2010-07-14 Thread Éric Araujo

Changes by Éric Araujo mer...@netwok.org:


--
resolution:  - invalid
stage:  - committed/rejected
status: open - closed
type:  - behavior

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



[issue9259] Python 2.7 breaks assigned __exit__s

2010-07-14 Thread Ariel Ben-Yehuda

Ariel Ben-Yehuda ariel@gmail.com added the comment:

Bug or not bug, Python2.7 breaks Gobject-Introspection.

--
status: closed - open

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



[issue9259] Python 2.7 breaks assigned __exit__s

2010-07-14 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

Please produce a test to prove that Python behaves in contradiction to the 
documentation. Otherwise I’m afraid it’s a GI bug, like in your tests :)

--

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



[issue9259] Python 2.7 breaks assigned __exit__s

2010-07-14 Thread Ariel Ben-Yehuda

Ariel Ben-Yehuda ariel@gmail.com added the comment:

My test on Class Methods was based on the GI Code that does not run on Python 
2.7.

--

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



[issue9259] Python 2.7 breaks assigned __exit__s

2010-07-14 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

I am afraid we have conflicting viewpoints. You are saying that upgrading 
Python broke code, and I agree it’s a bad thing. Usually such regression 
reports are accepted and fixed.

In this case however, the code was already broken in the previous version, it 
was only working because of a problem in the implementation. So from the 
viewpoint of GI users, it’s a regression, but from the viewpoint of Python the 
2.7 behavior fixes a regression in 2.6. It is not supported to find magic 
methods (“__name__”) on instances.

--

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



[issue9259] Python 2.7 breaks assigned __exit__s

2010-07-14 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

Since Benjamin Peterson, release manager for 2.7, confirmed that the change was 
intentional, I’m closing again.

To solve the bug in GI, you need to define a metaclass with those __enter__ and 
__exit__ methods, then use it as metaclass for LibtoolImporter. Please send me 
private email if you want more details.

--
status: open - closed

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



[issue9259] Python 2.7 breaks assigned __exit__s

2010-07-14 Thread Ariel Ben-Yehuda

Ariel Ben-Yehuda ariel@gmail.com added the comment:

Done it for myself. However, I am not a GI Maintainer - you should talk with 
them and send them this patch.

--

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



[issue9259] Python 2.7 breaks assigned __exit__s

2010-07-14 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

Since you know the project, the bug and the fix, I think you’re in a better 
position than me to talk with them.

--

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