[New-bugs-announce] [issue12248] __dir__ semantics changed in Python 2.7.2

Barry A. Warsaw report at bugs.python.org
Fri Jun 3 01:32:34 CEST 2011

New submission from Barry A. Warsaw <barry at python.org>:

I'm making this a release blocker for 2.7.2 because I want to ensure that the change is deliberate and appropriate.  This is triggered by a bug report in Ubuntu where the change in behavior was noticed:


I have two problems with the change that I'd like to describe.  First is the NEWS file entry:

- Correct lookup of __dir__ on objects. Among other things, this causes errors
  besides AttributeError found on lookup to be propagated.

This isn't associated with a tracker issue, so it's hard to know why this change was made, or whether there was any discussion of its impact.

Second, is this change appropriate for a maintenance release?  What problem does it fix and is that worth breaking existing packages for it?

I'll attach a simple test program.  Run this under 2.7.1 and it works, run it under 2.7.2rc1 and you get a TypeError.

assignee: benjamin.peterson
components: Interpreter Core
files: foo.py
messages: 137500
nosy: barry, benjamin.peterson
priority: release blocker
severity: normal
status: open
title: __dir__ semantics changed in Python 2.7.2
type: behavior
versions: Python 2.7
Added file: http://bugs.python.org/file22225/foo.py

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list