Brett Cannon | 28 Jul 21:26 2015
Picon

Datetime SIG created

https://mail.python.org/mailman/listinfo/datetime-sig

In the future feel free to redirect date- and time-related discussions to the SIG since datetime stuff requires such a specific domain knowledge that most of us have.

I am also looking for people to be admins of the list. If you're willing to admin the list please let me know and I will add you.
<div><div dir="ltr">
<a href="https://mail.python.org/mailman/listinfo/datetime-sig">https://mail.python.org/mailman/listinfo/datetime-sig</a><br><div><br></div>
<div>In the future feel free to redirect date- and time-related discussions to the SIG since datetime stuff requires such a specific domain knowledge that most of us have.</div>
<div><br></div>
<div>I am also looking for people to be admins of the list. If you're willing to admin the list please let me know and I will add you.</div>
</div></div>
Brett Cannon | 28 Jul 00:33 2015
Picon

Please create the datetime-sig mailing list

[bcc'ed python-dev]

Initial admin can be me and I will be in charge of finding more suitable admins to manage the list.
<div><div dir="ltr">
<div>[bcc'ed python-dev]</div>
<div><br></div>Initial admin can be me and I will be in charge of finding more suitable admins to manage the list.</div></div>
Robert Collins | 25 Jul 21:28 2015
Picon

Burning down the backlog.

On 21 July 2015 at 19:40, Nick Coghlan <ncoghlan <at> gmail.com> wrote:

> All of this is why the chart that I believe should be worrying people
> is the topmost one on this page:
> http://bugs.python.org/issue? <at> template=stats
>
> Both the number of open issues and the number of open issues with
> patches are steadily trending upwards. That means the bottleneck in
> the current process *isn't* getting patches written in the first
> place, it's getting them up to the appropriate standards and applied.
> Yet the answer to the problem isn't a simple "recruit more core
> developers", as the existing core developers are *also* the bottleneck
> in the review and mentoring process for *new* core developers.

Those charts doesn't show patches in 'commit-review' -
http://bugs.python.org/issue?%40columns=title&%40columns=id&stage=5&%40columns=activity&%40sort=activity&status=1&%40columns=status&%40pagesize=50&%40startwith=0&%40sortdir=on&%40action=search

There are only 45 of those patches.

AIUI - and I'm very new to core here - anyone in triagers can get
patches up to commit-review status.

I think we should set a goal to keep inventory low here - e.g. review
and either bounce back to patch review, or commit, in less than a
month. Now - a month isn't super low, but we have lots of stuff
greater than a month.

For my part, I'm going to pick up more or less one thing a day and
review it, but I think it would be great if other committers were to
also to do this: if we had 5 of us doing 1 a day, I think we'd burn
down this 45 patch backlog rapidly without significant individual
cost. At which point, we can fairly say to folk doing triage that
we're ready for patches :)

-Rob

--

-- 
Robert Collins <rbtcollins <at> hp.com>
Distinguished Technologist
HP Converged Cloud
John Dennis | 25 Jul 01:41 2015
Picon

PyCapsule_Import semantics, relative imports, module names etc.

While porting several existing CPython extension modules that form a 
package to be 2.7 and 3.x compatible the existing PyObject_* API was 
replaced with PyCapsule_*. This introduced some issues the existing 
CPython docs are silent on. I'd like clarification on a few issues and 
wish to raise some questions.

1. Should an extension module name as provided in PyModule_Create (Py3) 
or Py_InitModule3 (Py2) be fully package qualified or just the module 
name? I believe it's just the module name (see item 5 below) Yes/No?

2. PyCapsule_Import does not adhere to the general import semantics. The 
module name must be fully qualified, relative imports are not supported.

3. PyCapsule_Import requires the package (e.g. __init__.py) to import 
*all* of it's submodules which utilize the PyCapsule mechanism 
preventing lazy on demand loading. This is because PyCapsule_Import only 
imports the top level module (e.g. the package). From there it iterates 
over each of the module names in the module path. However the parent 
module (e.g. globals) will not contain an attribute for the submodule 
unless it's already been loaded. If the submodule has not been loaded 
into the parent PyCapsule_Import throws an error instead of trying to 
load the submodule. The only apparent solution is for the package to 
load every possible submodule whether required or not just to avoid a 
loading error. The inability to load modules on demand seems like a 
design flaw and change in semantics from the prior use of 
PyImport_ImportModule in combination with PyObject. [One of the nice 
features with normal import loading is setting the submodule name in the 
parent, the fact this step is omitted is what causes PyCapsule_Import to 
fail unless all submodules are unconditionally loaded). Shouldn't 
PyCapsule_Import utilize PyImport_ImportModule?

4. Relative imports seem much more useful for cooperating submodules in 
a package as opposed to fully qualified package names. Being able to 
import a C_API from the current package (the package I'm a member of) 
seems much more elegant and robust for cooperating modules but this 
semantic isn't supported (in fact the leading dot syntax completely 
confuses PyCapsule_Import, doc should clarify this).

5. The requirement that a module specifies it's name as unqualified when 
it is initializing but then also has to use a fully qualified package 
name for PyCapsule_New, both of which occur inside the same 
initialization function seems like an odd inconsistency (documentation 
clarification would help here). Also, depending on your point of view 
package names could be considered a deployment/packaging decision, a 
module obtains it's fully qualified name by virtue of it's position in 
the filesystem, something at compile time the module will not be aware 
of, another reason why relative imports make sense. Note the identical 
comment regarding _Py_PackageContext in  modsupport.c (Py2) and 
moduleobject.c (Py3) regarding how a module obtains it's fully qualified 
package name (see item 1).

Thanks!

--

-- 
John
Python tracker | 24 Jul 18:08 2015

Summary of Python tracker Issues


ACTIVITY SUMMARY (2015-07-17 - 2015-07-24)
Python tracker at http://bugs.python.org/

To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.

Issues counts and deltas:
  open    4957 (+10)
  closed 31511 (+43)
  total  36468 (+53)

Open issues with patches: 2254 

Issues opened (34)
==================

#23591: Add IntFlags
http://bugs.python.org/issue23591  reopened by r.david.murray

#24619: async/await parser issues
http://bugs.python.org/issue24619  reopened by yselivanov

#24653: Mock.assert_has_calls([]) is surprising for users
http://bugs.python.org/issue24653  reopened by rbcollins

#24657: CGIHTTPServer module discard continuous '/' letters from param
http://bugs.python.org/issue24657  opened by takayuki

#24658: open().write() fails on 2 GB+ data (OS X)
http://bugs.python.org/issue24658  opened by lebigot

#24659: dict() built-in fails on iterators with a "keys" attribute
http://bugs.python.org/issue24659  opened by christian.barcenas

#24661: CGIHTTPServer: premature unescaping of query string
http://bugs.python.org/issue24661  opened by johnseman

#24665: CJK support for textwrap
http://bugs.python.org/issue24665  opened by fgallaire

#24666: Buffered I/O does not take file position into account when rea
http://bugs.python.org/issue24666  opened by ericpruitt

#24667: OrderedDict.popitem()/__str__() raises KeyError
http://bugs.python.org/issue24667  opened by xZise

#24668: Deprecate 00000 as a synonym for 0
http://bugs.python.org/issue24668  opened by steven.daprano

#24670: os.chdir breaks result of os.path.abspath(__file__) and os.pat
http://bugs.python.org/issue24670  opened by LordBlick

#24671: idlelib 2.7: finish converting print statements
http://bugs.python.org/issue24671  opened by terry.reedy

#24672: shutil.rmtree failes on non ascii filenames
http://bugs.python.org/issue24672  opened by Steffen Kampmann

#24673: distutils/_msvccompiler does not remove /DLL during link(CComp
http://bugs.python.org/issue24673  opened by James Salter

#24674: pyclbr not recursively showing classes in packages
http://bugs.python.org/issue24674  opened by worenklein

#24681: Put most likely test first in set_add_entry()
http://bugs.python.org/issue24681  opened by rhettinger

#24682: Add Quick Start: Communications section to devguide
http://bugs.python.org/issue24682  opened by willingc

#24683: Type confusion in json encoding
http://bugs.python.org/issue24683  opened by pkt

#24684: socket.getaddrinfo(host) doesn't ensure that host.encode() ret
http://bugs.python.org/issue24684  opened by pkt

#24685: collections.OrderedDict collaborative subclassing
http://bugs.python.org/issue24685  opened by eric.frederich

#24686: zipfile is intolerant of extra bytes
http://bugs.python.org/issue24686  opened by Devin Fisher

#24689: Add tips for effective online communication to devguide
http://bugs.python.org/issue24689  opened by willingc

#24691: out of memory in distutils.upload with large files
http://bugs.python.org/issue24691  opened by Jan.Stürtz

#24692: types.coroutines() idempotence documentation
http://bugs.python.org/issue24692  opened by seirl

#24693: zipfile: change RuntimeError to more appropriate exception typ
http://bugs.python.org/issue24693  opened by serhiy.storchaka

#24696: Don't use None as sentinel for traceback
http://bugs.python.org/issue24696  opened by Drekin

#24697: Add CoroutineReturn and CoroutineExit builtin exceptions for c
http://bugs.python.org/issue24697  opened by yselivanov

#24698: get_externals.bat script fails
http://bugs.python.org/issue24698  opened by Alex Budovski

#24699: TemporaryDirectory is cleaned up twice
http://bugs.python.org/issue24699  opened by Ilya.Kulakov

#24700: array compare is hideously slow
http://bugs.python.org/issue24700  opened by swanson

#24705: sysconfig._parse_makefile doesn't expand ${} vars appearing be
http://bugs.python.org/issue24705  opened by doko

#24706: poplib: Line too long error causes knock-on failure to retriev
http://bugs.python.org/issue24706  opened by Chris Smowton

#24707: Assertion failed in pymonotonic_new
http://bugs.python.org/issue24707  opened by berker.peksag

Most recent 15 issues with no replies (15)
==========================================

#24707: Assertion failed in pymonotonic_new
http://bugs.python.org/issue24707

#24706: poplib: Line too long error causes knock-on failure to retriev
http://bugs.python.org/issue24706

#24696: Don't use None as sentinel for traceback
http://bugs.python.org/issue24696

#24693: zipfile: change RuntimeError to more appropriate exception typ
http://bugs.python.org/issue24693

#24691: out of memory in distutils.upload with large files
http://bugs.python.org/issue24691

#24673: distutils/_msvccompiler does not remove /DLL during link(CComp
http://bugs.python.org/issue24673

#24666: Buffered I/O does not take file position into account when rea
http://bugs.python.org/issue24666

#24657: CGIHTTPServer module discard continuous '/' letters from param
http://bugs.python.org/issue24657

#24652: C-API Pure Embedding enhancement
http://bugs.python.org/issue24652

#24647: Document argparse.REMAINDER as being equal to "..."
http://bugs.python.org/issue24647

#24637: locals dictionary in PyRun_String
http://bugs.python.org/issue24637

#24626: please sync cgi.parse document
http://bugs.python.org/issue24626

#24623: Parser: broken line numbers for triple-quoted strings
http://bugs.python.org/issue24623

#24618: Invalid read in PyCode_New
http://bugs.python.org/issue24618

#24591: offer option to suppress "clean --all" output relating to none
http://bugs.python.org/issue24591

Most recent 15 issues waiting for review (15)
=============================================

#24698: get_externals.bat script fails
http://bugs.python.org/issue24698

#24693: zipfile: change RuntimeError to more appropriate exception typ
http://bugs.python.org/issue24693

#24682: Add Quick Start: Communications section to devguide
http://bugs.python.org/issue24682

#24681: Put most likely test first in set_add_entry()
http://bugs.python.org/issue24681

#24674: pyclbr not recursively showing classes in packages
http://bugs.python.org/issue24674

#24673: distutils/_msvccompiler does not remove /DLL during link(CComp
http://bugs.python.org/issue24673

#24665: CJK support for textwrap
http://bugs.python.org/issue24665

#24658: open().write() fails on 2 GB+ data (OS X)
http://bugs.python.org/issue24658

#24645: logging.handlers.QueueHandler should not lock when handling a 
http://bugs.python.org/issue24645

#24637: locals dictionary in PyRun_String
http://bugs.python.org/issue24637

#24634: Importing uuid should not try to load libc on Windows
http://bugs.python.org/issue24634

#24633: README file installed into site-packages conflicts with packag
http://bugs.python.org/issue24633

#24622: tokenize.py: missing EXACT_TOKEN_TYPES
http://bugs.python.org/issue24622

#24619: async/await parser issues
http://bugs.python.org/issue24619

#24613: array.fromstring Use After Free
http://bugs.python.org/issue24613

Top 10 most discussed issues (10)
=================================

#24681: Put most likely test first in set_add_entry()
http://bugs.python.org/issue24681  16 msgs

#21750: mock_open data is visible only once for the life of the class
http://bugs.python.org/issue21750  14 msgs

#24667: OrderedDict.popitem()/__str__() raises KeyError
http://bugs.python.org/issue24667  13 msgs

#24619: async/await parser issues
http://bugs.python.org/issue24619  12 msgs

#24658: open().write() fails on 2 GB+ data (OS X)
http://bugs.python.org/issue24658  10 msgs

#24646: Python accepts SSL certificate that should be rejected on OSX
http://bugs.python.org/issue24646   9 msgs

#24665: CJK support for textwrap
http://bugs.python.org/issue24665   8 msgs

#23883: __all__ lists are incomplete
http://bugs.python.org/issue23883   6 msgs

#24651: Mock.assert* API is in user namespace
http://bugs.python.org/issue24651   6 msgs

#24682: Add Quick Start: Communications section to devguide
http://bugs.python.org/issue24682   6 msgs

Issues closed (41)
==================

#1615: PyObject_GenericGetAttr suppresses AttributeErrors in descript
http://bugs.python.org/issue1615  closed by ethan.furman

#6549: ttk.Style -- minor issues with element_names and configure
http://bugs.python.org/issue6549  closed by python-dev

#8585: zipimporter.find_module is untested
http://bugs.python.org/issue8585  closed by rbcollins

#13124: Add "Running a Build Slave" page to the devguide
http://bugs.python.org/issue13124  closed by willingc

#13938: 2to3 fails to convert types.StringTypes appropriately
http://bugs.python.org/issue13938  closed by rbcollins

#19624: Switch constants in the errno module to IntEnum
http://bugs.python.org/issue19624  closed by ethan.furman

#19663: Not so correct error message when initializing defaultdict
http://bugs.python.org/issue19663  closed by rhettinger

#21406: Some socket constants are not enums
http://bugs.python.org/issue21406  closed by ethan.furman

#22153: Documentation of TestCase.runTest is incorrect and confusing
http://bugs.python.org/issue22153  closed by rbcollins

#23054: ConnectionError: ('Connection aborted.', BadStatusLine(""''''"
http://bugs.python.org/issue23054  closed by vadmium

#23440: Extend http.server.SimpleHTTPRequestHandler testing
http://bugs.python.org/issue23440  closed by berker.peksag

#24206: Issues with equality of inspect objects
http://bugs.python.org/issue24206  closed by serhiy.storchaka

#24300: Code Refactoring  in function nis_mapname()
http://bugs.python.org/issue24300  closed by rhettinger

#24470: ctypes incorrect handling of long int on 64bits Linux
http://bugs.python.org/issue24470  closed by Marco Clemencic

#24485: Function source inspection fails on closures
http://bugs.python.org/issue24485  closed by meador.inge

#24503: csv.writer fails when within csv.reader
http://bugs.python.org/issue24503  closed by ezzieyguywuf

#24620: Segfault with nonsensical random state
http://bugs.python.org/issue24620  closed by serhiy.storchaka

#24642: Will there be an MSI installer?
http://bugs.python.org/issue24642  closed by tritium

#24654: PEP 492 - example benchmark doesn't work (TypeError)
http://bugs.python.org/issue24654  closed by yselivanov

#24655: _ssl.c: Missing "do" for do {} while(0) idiom
http://bugs.python.org/issue24655  closed by benjamin.peterson

#24656: remove "assret" from mock error checking
http://bugs.python.org/issue24656  closed by ncoghlan

#24660: Heapq + functools.partial : TypeError: unorderable types
http://bugs.python.org/issue24660  closed by vadmium

#24662: While condition not satisfied embarrassingly
http://bugs.python.org/issue24662  closed by ezio.melotti

#24663: ast.literal_eval does not handle empty set literals
http://bugs.python.org/issue24663  closed by ezio.melotti

#24664: build failure with _Py_BEGIN_SUPPRESS_IPH undefined
http://bugs.python.org/issue24664  closed by zbysz

#24669: inspect.getsource() returns the wrong lines for coroutine func
http://bugs.python.org/issue24669  closed by yselivanov

#24675: Avoid DeprecationWarning in test_os
http://bugs.python.org/issue24675  closed by haypo

#24676: Error in pickle using cProfile
http://bugs.python.org/issue24676  closed by serhiy.storchaka

#24677: "def f(*args, ): pass" does not compile
http://bugs.python.org/issue24677  closed by vadmium

#24678: raiseExceptions typo fix in logging tests
http://bugs.python.org/issue24678  closed by serhiy.storchaka

#24679: Windows embeddable Python zip file crashes (cannot find a dll)
http://bugs.python.org/issue24679  closed by steve.dower

#24680: typo in documentation, section extending python
http://bugs.python.org/issue24680  closed by python-dev

#24687: refleak on SyntaxError in function parameter annotation
http://bugs.python.org/issue24687  closed by yselivanov

#24688: Fix ast.get_docstring to support 'async def' functions
http://bugs.python.org/issue24688  closed by yselivanov

#24690: find_executable should expand ~
http://bugs.python.org/issue24690  closed by r.david.murray

#24694: callables registered in TestCase.addCleanup should be run befo
http://bugs.python.org/issue24694  closed by yselivanov

#24695: Don't print traceback header if traceback is None in Traceback
http://bugs.python.org/issue24695  closed by berker.peksag

#24701: list.pop() removes items from multiple lists
http://bugs.python.org/issue24701  closed by r.david.murray

#24702: Uninitialised Pointer buf.outobj
http://bugs.python.org/issue24702  closed by serhiy.storchaka

#24703: Resource Leak
http://bugs.python.org/issue24703  closed by serhiy.storchaka

#24704: Dereferencing  a Null Pointer
http://bugs.python.org/issue24704  closed by serhiy.storchaka

ACTIVITY SUMMARY (2015-07-17 - 2015-07-24)
Python tracker at http://bugs.python.org/

To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.

Issues counts and deltas:
  open    4957 (+10)
  closed 31511 (+43)
  total  36468 (+53)

Open issues with patches: 2254 

Issues opened (34)
==================

#23591: Add IntFlags
http://bugs.python.org/issue23591  reopened by r.david.murray

#24619: async/await parser issues
http://bugs.python.org/issue24619  reopened by yselivanov

#24653: Mock.assert_has_calls([]) is surprising for users
http://bugs.python.org/issue24653  reopened by rbcollins

#24657: CGIHTTPServer module discard continuous '/' letters from param
http://bugs.python.org/issue24657  opened by takayuki

#24658: open().write() fails on 2 GB+ data (OS X)
http://bugs.python.org/issue24658  opened by lebigot

#24659: dict() built-in fails on iterators with a "keys" attribute
http://bugs.python.org/issue24659  opened by christian.barcenas

#24661: CGIHTTPServer: premature unescaping of query string
http://bugs.python.org/issue24661  opened by johnseman

#24665: CJK support for textwrap
http://bugs.python.org/issue24665  opened by fgallaire

#24666: Buffered I/O does not take file position into account when rea
http://bugs.python.org/issue24666  opened by ericpruitt

#24667: OrderedDict.popitem()/__str__() raises KeyError
http://bugs.python.org/issue24667  opened by xZise

#24668: Deprecate 00000 as a synonym for 0
http://bugs.python.org/issue24668  opened by steven.daprano

#24670: os.chdir breaks result of os.path.abspath(__file__) and os.pat
http://bugs.python.org/issue24670  opened by LordBlick

#24671: idlelib 2.7: finish converting print statements
http://bugs.python.org/issue24671  opened by terry.reedy

#24672: shutil.rmtree failes on non ascii filenames
http://bugs.python.org/issue24672  opened by Steffen Kampmann

#24673: distutils/_msvccompiler does not remove /DLL during link(CComp
http://bugs.python.org/issue24673  opened by James Salter

#24674: pyclbr not recursively showing classes in packages
http://bugs.python.org/issue24674  opened by worenklein

#24681: Put most likely test first in set_add_entry()
http://bugs.python.org/issue24681  opened by rhettinger

#24682: Add Quick Start: Communications section to devguide
http://bugs.python.org/issue24682  opened by willingc

#24683: Type confusion in json encoding
http://bugs.python.org/issue24683  opened by pkt

#24684: socket.getaddrinfo(host) doesn't ensure that host.encode() ret
http://bugs.python.org/issue24684  opened by pkt

#24685: collections.OrderedDict collaborative subclassing
http://bugs.python.org/issue24685  opened by eric.frederich

#24686: zipfile is intolerant of extra bytes
http://bugs.python.org/issue24686  opened by Devin Fisher

#24689: Add tips for effective online communication to devguide
http://bugs.python.org/issue24689  opened by willingc

#24691: out of memory in distutils.upload with large files
http://bugs.python.org/issue24691  opened by Jan.Stürtz

#24692: types.coroutines() idempotence documentation
http://bugs.python.org/issue24692  opened by seirl

#24693: zipfile: change RuntimeError to more appropriate exception typ
http://bugs.python.org/issue24693  opened by serhiy.storchaka

#24696: Don't use None as sentinel for traceback
http://bugs.python.org/issue24696  opened by Drekin

#24697: Add CoroutineReturn and CoroutineExit builtin exceptions for c
http://bugs.python.org/issue24697  opened by yselivanov

#24698: get_externals.bat script fails
http://bugs.python.org/issue24698  opened by Alex Budovski

#24699: TemporaryDirectory is cleaned up twice
http://bugs.python.org/issue24699  opened by Ilya.Kulakov

#24700: array compare is hideously slow
http://bugs.python.org/issue24700  opened by swanson

#24705: sysconfig._parse_makefile doesn't expand ${} vars appearing be
http://bugs.python.org/issue24705  opened by doko

#24706: poplib: Line too long error causes knock-on failure to retriev
http://bugs.python.org/issue24706  opened by Chris Smowton

#24707: Assertion failed in pymonotonic_new
http://bugs.python.org/issue24707  opened by berker.peksag

Most recent 15 issues with no replies (15)
==========================================

#24707: Assertion failed in pymonotonic_new
http://bugs.python.org/issue24707

#24706: poplib: Line too long error causes knock-on failure to retriev
http://bugs.python.org/issue24706

#24696: Don't use None as sentinel for traceback
http://bugs.python.org/issue24696

#24693: zipfile: change RuntimeError to more appropriate exception typ
http://bugs.python.org/issue24693

#24691: out of memory in distutils.upload with large files
http://bugs.python.org/issue24691

#24673: distutils/_msvccompiler does not remove /DLL during link(CComp
http://bugs.python.org/issue24673

#24666: Buffered I/O does not take file position into account when rea
http://bugs.python.org/issue24666

#24657: CGIHTTPServer module discard continuous '/' letters from param
http://bugs.python.org/issue24657

#24652: C-API Pure Embedding enhancement
http://bugs.python.org/issue24652

#24647: Document argparse.REMAINDER as being equal to "..."
http://bugs.python.org/issue24647

#24637: locals dictionary in PyRun_String
http://bugs.python.org/issue24637

#24626: please sync cgi.parse document
http://bugs.python.org/issue24626

#24623: Parser: broken line numbers for triple-quoted strings
http://bugs.python.org/issue24623

#24618: Invalid read in PyCode_New
http://bugs.python.org/issue24618

#24591: offer option to suppress "clean --all" output relating to none
http://bugs.python.org/issue24591

Most recent 15 issues waiting for review (15)
=============================================

#24698: get_externals.bat script fails
http://bugs.python.org/issue24698

#24693: zipfile: change RuntimeError to more appropriate exception typ
http://bugs.python.org/issue24693

#24682: Add Quick Start: Communications section to devguide
http://bugs.python.org/issue24682

#24681: Put most likely test first in set_add_entry()
http://bugs.python.org/issue24681

#24674: pyclbr not recursively showing classes in packages
http://bugs.python.org/issue24674

#24673: distutils/_msvccompiler does not remove /DLL during link(CComp
http://bugs.python.org/issue24673

#24665: CJK support for textwrap
http://bugs.python.org/issue24665

#24658: open().write() fails on 2 GB+ data (OS X)
http://bugs.python.org/issue24658

#24645: logging.handlers.QueueHandler should not lock when handling a 
http://bugs.python.org/issue24645

#24637: locals dictionary in PyRun_String
http://bugs.python.org/issue24637

#24634: Importing uuid should not try to load libc on Windows
http://bugs.python.org/issue24634

#24633: README file installed into site-packages conflicts with packag
http://bugs.python.org/issue24633

#24622: tokenize.py: missing EXACT_TOKEN_TYPES
http://bugs.python.org/issue24622

#24619: async/await parser issues
http://bugs.python.org/issue24619

#24613: array.fromstring Use After Free
http://bugs.python.org/issue24613

Top 10 most discussed issues (10)
=================================

#24681: Put most likely test first in set_add_entry()
http://bugs.python.org/issue24681  16 msgs

#21750: mock_open data is visible only once for the life of the class
http://bugs.python.org/issue21750  14 msgs

#24667: OrderedDict.popitem()/__str__() raises KeyError
http://bugs.python.org/issue24667  13 msgs

#24619: async/await parser issues
http://bugs.python.org/issue24619  12 msgs

#24658: open().write() fails on 2 GB+ data (OS X)
http://bugs.python.org/issue24658  10 msgs

#24646: Python accepts SSL certificate that should be rejected on OSX
http://bugs.python.org/issue24646   9 msgs

#24665: CJK support for textwrap
http://bugs.python.org/issue24665   8 msgs

#23883: __all__ lists are incomplete
http://bugs.python.org/issue23883   6 msgs

#24651: Mock.assert* API is in user namespace
http://bugs.python.org/issue24651   6 msgs

#24682: Add Quick Start: Communications section to devguide
http://bugs.python.org/issue24682   6 msgs

Issues closed (41)
==================

#1615: PyObject_GenericGetAttr suppresses AttributeErrors in descript
http://bugs.python.org/issue1615  closed by ethan.furman

#6549: ttk.Style -- minor issues with element_names and configure
http://bugs.python.org/issue6549  closed by python-dev

#8585: zipimporter.find_module is untested
http://bugs.python.org/issue8585  closed by rbcollins

#13124: Add "Running a Build Slave" page to the devguide
http://bugs.python.org/issue13124  closed by willingc

#13938: 2to3 fails to convert types.StringTypes appropriately
http://bugs.python.org/issue13938  closed by rbcollins

#19624: Switch constants in the errno module to IntEnum
http://bugs.python.org/issue19624  closed by ethan.furman

#19663: Not so correct error message when initializing defaultdict
http://bugs.python.org/issue19663  closed by rhettinger

#21406: Some socket constants are not enums
http://bugs.python.org/issue21406  closed by ethan.furman

#22153: Documentation of TestCase.runTest is incorrect and confusing
http://bugs.python.org/issue22153  closed by rbcollins

#23054: ConnectionError: ('Connection aborted.', BadStatusLine(""''''"
http://bugs.python.org/issue23054  closed by vadmium

#23440: Extend http.server.SimpleHTTPRequestHandler testing
http://bugs.python.org/issue23440  closed by berker.peksag

#24206: Issues with equality of inspect objects
http://bugs.python.org/issue24206  closed by serhiy.storchaka

#24300: Code Refactoring  in function nis_mapname()
http://bugs.python.org/issue24300  closed by rhettinger

#24470: ctypes incorrect handling of long int on 64bits Linux
http://bugs.python.org/issue24470  closed by Marco Clemencic

#24485: Function source inspection fails on closures
http://bugs.python.org/issue24485  closed by meador.inge

#24503: csv.writer fails when within csv.reader
http://bugs.python.org/issue24503  closed by ezzieyguywuf

#24620: Segfault with nonsensical random state
http://bugs.python.org/issue24620  closed by serhiy.storchaka

#24642: Will there be an MSI installer?
http://bugs.python.org/issue24642  closed by tritium

#24654: PEP 492 - example benchmark doesn't work (TypeError)
http://bugs.python.org/issue24654  closed by yselivanov

#24655: _ssl.c: Missing "do" for do {} while(0) idiom
http://bugs.python.org/issue24655  closed by benjamin.peterson

#24656: remove "assret" from mock error checking
http://bugs.python.org/issue24656  closed by ncoghlan

#24660: Heapq + functools.partial : TypeError: unorderable types
http://bugs.python.org/issue24660  closed by vadmium

#24662: While condition not satisfied embarrassingly
http://bugs.python.org/issue24662  closed by ezio.melotti

#24663: ast.literal_eval does not handle empty set literals
http://bugs.python.org/issue24663  closed by ezio.melotti

#24664: build failure with _Py_BEGIN_SUPPRESS_IPH undefined
http://bugs.python.org/issue24664  closed by zbysz

#24669: inspect.getsource() returns the wrong lines for coroutine func
http://bugs.python.org/issue24669  closed by yselivanov

#24675: Avoid DeprecationWarning in test_os
http://bugs.python.org/issue24675  closed by haypo

#24676: Error in pickle using cProfile
http://bugs.python.org/issue24676  closed by serhiy.storchaka

#24677: "def f(*args, ): pass" does not compile
http://bugs.python.org/issue24677  closed by vadmium

#24678: raiseExceptions typo fix in logging tests
http://bugs.python.org/issue24678  closed by serhiy.storchaka

#24679: Windows embeddable Python zip file crashes (cannot find a dll)
http://bugs.python.org/issue24679  closed by steve.dower

#24680: typo in documentation, section extending python
http://bugs.python.org/issue24680  closed by python-dev

#24687: refleak on SyntaxError in function parameter annotation
http://bugs.python.org/issue24687  closed by yselivanov

#24688: Fix ast.get_docstring to support 'async def' functions
http://bugs.python.org/issue24688  closed by yselivanov

#24690: find_executable should expand ~
http://bugs.python.org/issue24690  closed by r.david.murray

#24694: callables registered in TestCase.addCleanup should be run befo
http://bugs.python.org/issue24694  closed by yselivanov

#24695: Don't print traceback header if traceback is None in Traceback
http://bugs.python.org/issue24695  closed by berker.peksag

#24701: list.pop() removes items from multiple lists
http://bugs.python.org/issue24701  closed by r.david.murray

#24702: Uninitialised Pointer buf.outobj
http://bugs.python.org/issue24702  closed by serhiy.storchaka

#24703: Resource Leak
http://bugs.python.org/issue24703  closed by serhiy.storchaka

#24704: Dereferencing  a Null Pointer
http://bugs.python.org/issue24704  closed by serhiy.storchaka
lp_benchmark_robot | 24 Jul 14:34 2015
Picon

Benchmark Results for Python Default 2015-07-24

Hi Internals, 

This is the first message from Intel's language optimization team.
We would like to provide the Python internals developer community
with a daily service which will monitor latest committed patches
performance regressions against well known workloads.
Our aim is to run a multitude of workloads as well as real-life scenarios
which the community considers relevant. The service will send daily bulletins
containing latest measurements for daily variations and variations against
latest stable release run on our Intel-enabled servers.

The community's feedback is very important for us. For any questions,
comments or suggestions you can also contact us on our mailing list
lp <at> lists.01.org. You can also check our website: https://www.01.org/lp

Results for project python_default-nightly, build date 2015-07-24 09:02:02 
commit:		3bbd0cbfe836511dd3e05fcc30ffb5bdbfe686ea
revision date:	2015-07-24 07:43:44 
environment:	Haswell-EP
	cpu:	Intel(R) Xeon(R) CPU E5-2699 v3  <at>  2.30GHz 2x18 cores, stepping 2, LLC 45 MB
	mem:	128 GB
	os:	CentOS 7.1
	kernel:	Linux 3.10.0-229.4.2.el7.x86_64

Note: Baseline results were generated using release v3.4.3, with hash
b4cbecbc0781e89a309d03b60a1f75f8499250e6 from 2015-02-25 12:15:33+00:00

--------------------------------------------------------------------------------
               benchmark    unit            change since            change since
                                                last run                  v3.4.3
--------------------------------------------------------------------------------
:-)            django_v2     sec                1.12735%                7.47953%
:-(              pybench     sec               -0.53822%               -2.40216%
:-(             regex_v8     sec                0.61774%               -2.32010%
:-|                nbody     sec                1.75860%               -0.76206%
:-)         json_dump_v2     sec                2.13422%               -0.56930%

Our lab does a nightly source pull and build of the Python project and measures
performance changes against the previous stable version and the previous nightly
measurement. This is provided as a service to the community so that quality
issues with current hardware can be identified quickly.

Intel technologies' features and benefits depend on system configuration and may
require enabled hardware, software or service activation. Performance varies
depending on system configuration.  No license (express or implied, by estoppel
or otherwise) to any intellectual property rights is granted by this document.
Intel disclaims all express and implied warranties, including without
limitation, the implied warranties of merchantability, fitness for a particular
purpose, and non-infringement, as well as any warranty arising from course of
performance, course of dealing, or usage in trade.  This document may contain
information on products, services and/or processes in development. Contact your
Intel representative to obtain the latest forecast, schedule, specifications and
roadmaps.  The products and services described may contain defects or errors
known as errata which may cause deviations from published specifications.
Current characterized errata are available on request.

(C) 2015 Intel Corporation.
lp_benchmark_robot | 24 Jul 13:29 2015
Picon

[python_default-nightly] Benchmark Results for 3bbd0cbfe836511dd3e05fcc30ffb5bdbfe686ea

Hi Internals, 

This is the first message from Intel's language optimization team.
We would like to provide the Python internals developer community
with a daily service which will monitor latest committed patches
performance regressions against well known workloads.
Our aim is to run a multitude of workloads as well as real-life scenarios
which the community considers relevant. The service will send daily bulletins
containing latest measurements for daily variations and variations against
latest stable release run on our Intel-enabled servers.

The community's feedback is very important for us. For any questions,
comments or suggestions you can also contact us on our mailing list
lp <at> lists.01.org. You can also check our website: https://www.01.org/lp

Results for project python_default-nightly, build date 2015-07-24 09:02:02 
commit:		3bbd0cbfe836511dd3e05fcc30ffb5bdbfe686ea
revision date:	2015-07-24 07:43:44 
environment:	Haswell-EP
	cpu:	Intel(R) Xeon(R) CPU E5-2699 v3  <at>  2.30GHz 2x18 cores, stepping 2, LLC 45 MB
	mem:	128 GB
	os:	CentOS 7.1
	kernel:	Linux 3.10.0-229.4.2.el7.x86_64

Note: Baseline results were generated using release v3.4.3, with hash
b4cbecbc0781e89a309d03b60a1f75f8499250e6 from 2015-02-25 12:15:33+00:00

--------------------------------------------------------------------------------
               benchmark    unit            change since            change since
                                                last run                  v3.4.3
--------------------------------------------------------------------------------
:-)            django_v2     sec                1.12735%                7.47953%
:-(              pybench     sec               -0.53822%               -2.40216%
:-(             regex_v8     sec                0.61774%               -2.32010%
:-|                nbody     sec                1.75860%               -0.76206%
:-)         json_dump_v2     sec                2.13422%               -0.56930%

Our lab does a nightly source pull and build of the Python project and measures
performance changes against the previous stable version and the previous nightly
measurement. This is provided as a service to the community so that quality
issues with current hardware can be identified quickly.

Intel technologies' features and benefits depend on system configuration and may
require enabled hardware, software or service activation. Performance varies
depending on system configuration.  No license (express or implied, by estoppel
or otherwise) to any intellectual property rights is granted by this document.
Intel disclaims all express and implied warranties, including without
limitation, the implied warranties of merchantability, fitness for a particular
purpose, and non-infringement, as well as any warranty arising from course of
performance, course of dealing, or usage in trade.  This document may contain
information on products, services and/or processes in development. Contact your
Intel representative to obtain the latest forecast, schedule, specifications and
roadmaps.  The products and services described may contain defects or errors
known as errata which may cause deviations from published specifications.
Current characterized errata are available on request.

(C) 2015 Intel Corporation.
Mark Kelley | 24 Jul 12:50 2015
Picon

Building python 2.7.10 for Windows from source

I have been using Python for some time but it's been a decade since
I've tried to build it from source, back in the 2.4 days.  Things seem
to have gotten a little more complicated now.

I've read through the PCBuild/README file and got most stuff
compiling.  I find it a little odd that there are special instructions
for the building the release version of tcl/tk.  Is that what the
developers actually do when they cut a release, or is there some
other, top-level script that does this automatically? It just seems
odd.

Anyhow, my specific question is around the distutils wininst stubs,
provided as binaries in the release tarball.  Where can I find the
source files that those binaries are built from?

Many thanks,
Mark.

Python automatic optimization

Hello everybody,

I am using Python 2.7 as a backbone for some mathematical simulations. I recently discovered a tool called AutoFDO and I tried compiling my own Python version, but I did not manage to get it working. My question is, will sometime in the future Python include this tool?

Thank you,
Andrew
<div><div>
<div>Hello everybody,</div>
<div><br></div>
<div dir="ltr">I am using Python 2.7 as a backbone for some mathematical simulations. I recently discovered a tool called AutoFDO and I tried compiling my own Python version, but I did not manage to get it working. My question is, will sometime in the future Python include this tool?</div>
<div dir="ltr"><br></div>
<div dir="ltr">Thank you,</div>
<div dir="ltr">Andrew</div>
</div></div>
Ronald Oussoren | 22 Jul 09:25 2015
Picon

PEP 447 (type.__getdescriptor__)

Hi,

Another summer with another EuroPython, which means its time again to try to revive PEP 447…

I’ve just pushes a minor update to the PEP and would like to get some feedback on this, arguably fairly esoteric, PEP.

The PEP proposes to to replace direct access to the class __dict__ in object.__getattribute__ and super.__getattribute__ by calls to a new special method to give the metaclass more control over attribute lookup, especially for access using a super() object.  This is needed for classes that cannot store (all) descriptors in the class dict for some reason, see the PEP text for a real-world example of that.

Regards,

  Ronald


The PEP text (with an outdated section with benchmarks removed):

PEP: 447
Title: Add __getdescriptor__ method to metaclass
Version: $Revision$
Last-Modified: $Date$
Author: Ronald Oussoren <ronaldoussoren <at> mac.com>
Status: Draft
Type: Standards Track
Content-Type: text/x-rst
Created: 12-Jun-2013
Post-History: 2-Jul-2013, 15-Jul-2013, 29-Jul-2013, 22-Jul-2015


Abstract
========

Currently ``object.__getattribute__`` and ``super.__getattribute__`` peek
in the ``__dict__`` of classes on the MRO for a class when looking for
an attribute. This PEP adds an optional ``__getdescriptor__`` method to
a metaclass that replaces this behavior and gives more control over attribute
lookup, especially when using a `super`_ object.

That is, the MRO walking loop in ``_PyType_Lookup`` and
``super.__getattribute__`` gets changed from::

     def lookup(mro_list, name):
         for cls in mro_list:
             if name in cls.__dict__:
                 return cls.__dict__

         return NotFound

to::

     def lookup(mro_list, name):
         for cls in mro_list:
             try:
                 return cls.__getdescriptor__(name)
             except AttributeError:
                 pass

         return NotFound

The default implemention of ``__getdescriptor__`` looks in the class
dictionary::

   class type:
      def __getdescriptor__(cls, name):
          try:
      return cls.__dict__[name]
  except KeyError:
      raise AttributeError(name) from None

Rationale
=========

It is currently not possible to influence how the `super class`_ looks
up attributes (that is, ``super.__getattribute__`` unconditionally
peeks in the class ``__dict__``), and that can be problematic for
dynamic classes that can grow new methods on demand.

The ``__getdescriptor__`` method makes it possible to dynamically add
attributes even when looking them up using the `super class`_.

The new method affects ``object.__getattribute__`` (and
`PyObject_GenericGetAttr`_) as well for consistency and to have a single
place to implement dynamic attribute resolution for classes.

Background
----------

The current behavior of ``super.__getattribute__`` causes problems for
classes that are dynamic proxies for other (non-Python) classes or types,
an example of which is `PyObjC`_. PyObjC creates a Python class for every
class in the Objective-C runtime, and looks up methods in the Objective-C
runtime when they are used. This works fine for normal access, but doesn't
work for access with `super`_ objects. Because of this PyObjC currently
includes a custom `super`_ that must be used with its classes, as well as
completely reimplementing `PyObject_GenericGetAttr`_ for normal attribute
access.

The API in this PEP makes it possible to remove the custom `super`_ and
simplifies the implementation because the custom lookup behavior can be
added in a central location.

.. note::

   `PyObjC`_ cannot precalculate the contents of the class ``__dict__``
   because Objective-C classes can grow new methods at runtime. Furthermore
   Objective-C classes tend to contain a lot of methods while most Python
   code will only use a small subset of them, this makes precalculating
   unnecessarily expensive.


The superclass attribute lookup hook
====================================

Both ``super.__getattribute__`` and ``object.__getattribute__`` (or
`PyObject_GenericGetAttr`_ and in particular ``_PyType_Lookup`` in C code)
walk an object's MRO and currently peek in the class' ``__dict__`` to look up
attributes.

With this proposal both lookup methods no longer peek in the class ``__dict__``
but call the special method ``__getdescriptor__``, which is a slot defined
on the metaclass. The default implementation of that method looks
up the name the class ``__dict__``, which means that attribute lookup is
unchanged unless a metatype actually defines the new special method.

Aside: Attribute resolution algorithm in Python
-----------------------------------------------

The attribute resolution proces as implemented by ``object.__getattribute__``
(or PyObject_GenericGetAttr`` in CPython's implementation) is fairly
straightforward, but not entirely so without reading C code.

The current CPython implementation of object.__getattribute__ is basicly
equivalent to the following (pseudo-) Python code (excluding some house keeping and speed tricks)::


    def _PyType_Lookup(tp, name):
        mro = tp.mro()
assert isinstance(mro, tuple)

for base in mro:
  assert isinstance(base, type)

  # PEP 447 will change these lines:
  try:
      return base.__dict__[name]
  except KeyError:
      pass

return None


    class object:
        def __getattribute__(self, name):
    assert isinstance(name, str)

    tp = type(self)
    descr = _PyType_Lookup(tp, name)

    f = None
    if descr is not None:
        f = descr.__get__
if f is not None and descr.__set__ is not None:
    # Data descriptor
    return f(descr, self, type(self))

            dict = self.__dict__
    if dict is not None:
        try:
    return self.__dict__[name]
                except KeyError:
            pass

            if f is not None:
        # Non-data descriptor
        return f(descr, self, type(self))

            if descr is not None:
        # Regular class attribute
        return descr

            raise AttributeError(name)


    class super:
        def __getattribute__(self, name):
  assert isinstance(name, unicode)

  if name != '__class__':
      starttype = self.__self_type__
      mro = startype.mro()

      try:
          idx = mro.index(self.__thisclass__)

      except ValueError:
          pass

      else:
          for base in mro[idx+1:]:
      # PEP 447 will change these lines:
      try:
          descr = base.__dict__[name]
                       except KeyError:
          continue

      f = descr.__get__
      if f is not None:
          return f(descr,
      None if (self.__self__ is self.__self_type__) else self.__self__,
      starttype)

      else:
          return descr

  return object.__getattribute__(self, name)


This PEP should change the dict lookup at the lines starting at "# PEP 447" with
a method call to perform the actual lookup, making is possible to affect that
lookup both for normal attribute access and access through the `super proxy`_.

Note that specific classes can already completely override the default
behaviour by implementing their own ``__getattribute__`` slot (with or without
calling the super class implementation).


In Python code
--------------

A meta type can define a method ``__getdescriptor__`` that is called during
attribute resolution by both ``super.__getattribute__``
and ``object.__getattribute``::

    class MetaType(type):
        def __getdescriptor__(cls, name):
            try:
                return cls.__dict__[name]
            except KeyError:
                raise AttributeError(name) from None

The ``__getdescriptor__`` method has as its arguments a class (which is an
instance of the meta type) and the name of the attribute that is looked up.
It should return the value of the attribute without invoking descriptors,
and should raise `AttributeError`_ when the name cannot be found.

The `type`_ class provides a default implementation for ``__getdescriptor__``,
that looks up the name in the class dictionary.

Example usage
.............

The code below implements a silly metaclass that redirects attribute lookup to
uppercase versions of names::

    class UpperCaseAccess (type):
        def __getdescriptor__(cls, name):
    try:
                return cls.__dict__[name.upper()]
    except KeyError:
        raise AttributeError(name) from None

    class SillyObject (metaclass=UpperCaseAccess):
        def m(self):
            return 42

        def M(self):
            return "fourtytwo"

    obj = SillyObject()
    assert obj.m() == "fortytwo"

As mentioned earlier in this PEP a more realistic use case of this
functionallity is a ``__getdescriptor__`` method that dynamicly populates the
class ``__dict__`` based on attribute access, primarily when it is not
possible to reliably keep the class dict in sync with its source, for example
because the source used to populate ``__dict__`` is dynamic as well and does
not have triggers that can be used to detect changes to that source.

An example of that are the class bridges in PyObjC: the class bridge is a
Python object (class) that represents an Objective-C class and conceptually
has a Python method for every Objective-C method in the Objective-C class.
As with Python it is possible to add new methods to an Objective-C class, or
replace existing ones, and there are no callbacks that can be used to detect
this.

In C code
---------

A new slot ``tp_getdescriptor`` is added to the ``PyTypeObject`` struct, this
slot corresponds to the ``__getdescriptor__`` method on `type`_.

The slot has the following prototype::

    PyObject* (*getdescriptorfunc)(PyTypeObject* cls, PyObject* name);

This method should lookup *name* in the namespace of *cls*, without looking at
superclasses, and should not invoke descriptors. The method returns ``NULL``
without setting an exception when the *name* cannot be found, and returns a
new reference otherwise (not a borrowed reference).

Use of this hook by the interpreter
-----------------------------------

The new method is required for metatypes and as such is defined on `type_`.
Both ``super.__getattribute__`` and
``object.__getattribute__``/`PyObject_GenericGetAttr`_
(through ``_PyType_Lookup``) use the this ``__getdescriptor__`` method when
walking the MRO.

Other changes to the implementation
-----------------------------------

The change for `PyObject_GenericGetAttr`_ will be done by changing the private
function ``_PyType_Lookup``. This currently returns a borrowed reference, but
must return a new reference when the ``__getdescriptor__`` method is present.
Because of this ``_PyType_Lookup`` will be renamed to ``_PyType_LookupName``,
this will cause compile-time errors for all out-of-tree users of this
private API.

The attribute lookup cache in ``Objects/typeobject.c`` is disabled for classes
that have a metaclass that overrides ``__getdescriptor__``, because using the
cache might not be valid for such classes.

Impact of this PEP on introspection
-----------------------------------

Use of the method introduced in this PEP can affect introspection of classes
with a metaclass that uses a custom ``__getdescriptor__`` method. This section
lists those changes.

The items listed below are only affected by custom ``__getdescriptor__``
methods, the default implementation for ``object`` won't cause problems
because that still only uses the class ``__dict__`` and won't cause visible
changes to the visible behaviour of the ``object.__getattribute__``.

* ``dir`` might not show all attributes

  As with a custom ``__getattribute__`` method `dir()`_ might not see all
  (instance) attributes when using the ``__getdescriptor__()`` method to
  dynamicly resolve attributes.

  The solution for that is quite simple: classes using ``__getdescriptor__``
  should also implement `__dir__()`_ if they want full support for the builtin
  `dir()`_ function.

* ``inspect.getattr_static`` might not show all attributes

  The function ``inspect.getattr_static`` intentionally does not invoke
  ``__getattribute__`` and descriptors to avoid invoking user code during
  introspection with this function. The ``__getdescriptor__`` method will also
  be ignored and is another way in which the result of ``inspect.getattr_static``
  can be different from that of ``builtin.getattr``.

* ``inspect.getmembers`` and ``inspect.get_class_attrs``

  Both of these functions directly access the class __dict__ of classes along
  the MRO, and hence can be affected by a custom ``__getdescriptor__`` method.

  **TODO**: I haven't fully worked out what the impact of this is, and if there
  are mitigations for those using either updates to these functions, or
  additional methods that users should implement to be fully compatible with
  these functions.

  One possible mitigation is to have a custom ``__getattribute__`` for these
  classes that fills ``__dict__`` before returning and and defers to the
  default implementation for other attributes.

* Direct introspection of the class ``__dict__``

  Any code that directly access the class ``__dict__`` for introspection
  can be affected by a custom ``__getdescriptor__`` method.


Performance impact
------------------

**WARNING**: The benchmark results in this section are old, and will be updated
when I've ported the patch to the current trunk. I don't expect significant
changes to the results in this section.

[snipped]


Alternative proposals
---------------------

``__getattribute_super__``
..........................

An earlier version of this PEP used the following static method on classes::

    def __getattribute_super__(cls, name, object, owner): pass

This method performed name lookup as well as invoking descriptors and was
necessarily limited to working only with ``super.__getattribute__``.


Reuse ``tp_getattro``
.....................

It would be nice to avoid adding a new slot, thus keeping the API simpler and
easier to understand.  A comment on `Issue 18181`_ asked about reusing the
``tp_getattro`` slot, that is super could call the ``tp_getattro`` slot of all
methods along the MRO.

That won't work because ``tp_getattro`` will look in the instance
``__dict__`` before it tries to resolve attributes using classes in the MRO.
This would mean that using ``tp_getattro`` instead of peeking the class
dictionaries changes the semantics of the `super class`_.

Alternate placement of the new method
.....................................

This PEP proposes to add ``__getdescriptor__`` as a method on the metaclass.
An alternative would be to add it as a class method on the class itself
(simular to how ``__new__`` is a `staticmethod`_ of the class and not a method
of the metaclass).

The two are functionally equivalent, and there's something to be said about
not requiring the use of a meta class.


References
==========

* `Issue 18181`_ contains an out of date prototype implementation

Copyright
=========

This document has been placed in the public domain.













<div>Hi,<div class=""><br class=""></div>
<div class="">Another summer with another EuroPython, which means its time again to try to revive PEP 447&hellip;</div>
<div class=""><br class=""></div>
<div class="">I&rsquo;ve just pushes a minor update to the PEP and would like to get some feedback on this, arguably fairly esoteric, PEP.</div>
<div class=""><br class=""></div>
<div class="">The PEP proposes to to replace direct access to the class __dict__ in object.__getattribute__ and super.__getattribute__ by calls to a new special method to give the metaclass more control over attribute lookup, especially for access using a super() object. &nbsp;This is needed for classes that cannot store (all) descriptors in the class dict for some reason, see the PEP text for a real-world example of that.</div>
<div class=""><br class=""></div>
<div class="">Regards,</div>
<div class=""><br class=""></div>
<div class="">&nbsp; Ronald</div>
<div class=""><br class=""></div>
<div class=""><br class=""></div>
<div class="">The PEP text (with an outdated section with benchmarks removed):</div>
<div class=""><br class=""></div>
<div class="">
<div class="">PEP: 447</div>
<div class="">Title: Add __getdescriptor__ method to metaclass</div>
<div class="">Version: $Revision$</div>
<div class="">Last-Modified: $Date$</div>
<div class="">Author: Ronald Oussoren &lt;<a href="mailto:ronaldoussoren <at> mac.com" class="">ronaldoussoren <at> mac.com</a>&gt;</div>
<div class="">Status: Draft</div>
<div class="">Type: Standards Track</div>
<div class="">Content-Type: text/x-rst</div>
<div class="">Created: 12-Jun-2013</div>
<div class="">Post-History: 2-Jul-2013, 15-Jul-2013, 29-Jul-2013, 22-Jul-2015</div>
<div class=""><br class=""></div>
<div class=""><br class=""></div>
<div class="">Abstract</div>
<div class="">========</div>
<div class=""><br class=""></div>
<div class="">Currently ``object.__getattribute__`` and ``super.__getattribute__`` peek</div>
<div class="">in the ``__dict__`` of classes on the MRO for a class when looking for</div>
<div class="">an attribute. This PEP adds an optional ``__getdescriptor__`` method to</div>
<div class="">a metaclass that replaces this behavior and gives more control over attribute</div>
<div class="">lookup, especially when using a `super`_ object.</div>
<div class=""><br class=""></div>
<div class="">That is, the MRO walking loop in ``_PyType_Lookup`` and</div>
<div class="">``super.__getattribute__`` gets changed from::</div>
<div class=""><br class=""></div>
<div class="">&nbsp;&nbsp; &nbsp; def lookup(mro_list, name):</div>
<div class="">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; for cls in mro_list:</div>
<div class="">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if name in cls.__dict__:</div>
<div class="">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return cls.__dict__</div>
<div class=""><br class=""></div>
<div class="">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; return NotFound</div>
<div class=""><br class=""></div>
<div class="">to::</div>
<div class=""><br class=""></div>
<div class="">&nbsp;&nbsp; &nbsp; def lookup(mro_list, name):</div>
<div class="">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; for cls in mro_list:</div>
<div class="">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; try:</div>
<div class="">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return cls.__getdescriptor__(name)</div>
<div class="">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; except AttributeError:</div>
<div class="">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pass</div>
<div class=""><br class=""></div>
<div class="">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; return NotFound</div>
<div class=""><br class=""></div>
<div class="">The default implemention of ``__getdescriptor__`` looks in the class</div>
<div class="">dictionary::</div>
<div class=""><br class=""></div>
<div class="">&nbsp;&nbsp; class type:</div>
<div class="">&nbsp; &nbsp; &nbsp; def __getdescriptor__(cls, name):</div>
<div class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; try:</div>
<div class="">
<span class="Apple-tab-span">	</span>&nbsp; &nbsp; &nbsp; return cls.__dict__[name]</div>
<div class="">
<span class="Apple-tab-span">	</span>&nbsp; except KeyError:</div>
<div class="">
<span class="Apple-tab-span">	</span>&nbsp; &nbsp; &nbsp; raise AttributeError(name) from None</div>
<div class=""><br class=""></div>
<div class="">Rationale</div>
<div class="">=========</div>
<div class=""><br class=""></div>
<div class="">It is currently not possible to influence how the `super class`_ looks</div>
<div class="">up attributes (that is, ``super.__getattribute__`` unconditionally</div>
<div class="">peeks in the class ``__dict__``), and that can be problematic for</div>
<div class="">dynamic classes that can grow new methods on demand.</div>
<div class=""><br class=""></div>
<div class="">The ``__getdescriptor__`` method makes it possible to dynamically add</div>
<div class="">attributes even when looking them up using the `super class`_.</div>
<div class=""><br class=""></div>
<div class="">The new method affects ``object.__getattribute__`` (and</div>
<div class="">`PyObject_GenericGetAttr`_) as well for consistency and to have a single</div>
<div class="">place to implement dynamic attribute resolution for classes.</div>
<div class=""><br class=""></div>
<div class="">Background</div>
<div class="">----------</div>
<div class=""><br class=""></div>
<div class="">The current behavior of ``super.__getattribute__`` causes problems for</div>
<div class="">classes that are dynamic proxies for other (non-Python) classes or types,</div>
<div class="">an example of which is `PyObjC`_. PyObjC creates a Python class for every</div>
<div class="">class in the Objective-C runtime, and looks up methods in the Objective-C</div>
<div class="">runtime when they are used. This works fine for normal access, but doesn't</div>
<div class="">work for access with `super`_ objects. Because of this PyObjC currently</div>
<div class="">includes a custom `super`_ that must be used with its classes, as well as</div>
<div class="">completely reimplementing `PyObject_GenericGetAttr`_ for normal attribute</div>
<div class="">access.</div>
<div class=""><br class=""></div>
<div class="">The API in this PEP makes it possible to remove the custom `super`_ and</div>
<div class="">simplifies the implementation because the custom lookup behavior can be</div>
<div class="">added in a central location.</div>
<div class=""><br class=""></div>
<div class="">.. note::</div>
<div class=""><br class=""></div>
<div class="">&nbsp;&nbsp; `PyObjC`_ cannot precalculate the contents of the class ``__dict__``</div>
<div class="">&nbsp;&nbsp; because Objective-C classes can grow new methods at runtime. Furthermore</div>
<div class="">&nbsp;&nbsp; Objective-C classes tend to contain a lot of methods while most Python</div>
<div class="">&nbsp;&nbsp; code will only use a small subset of them, this makes precalculating</div>
<div class="">&nbsp;&nbsp; unnecessarily expensive.</div>
<div class=""><br class=""></div>
<div class=""><br class=""></div>
<div class="">The superclass attribute lookup hook</div>
<div class="">====================================</div>
<div class=""><br class=""></div>
<div class="">Both ``super.__getattribute__`` and ``object.__getattribute__`` (or</div>
<div class="">`PyObject_GenericGetAttr`_ and in particular ``_PyType_Lookup`` in C code)</div>
<div class="">walk an object's MRO and currently peek in the class' ``__dict__`` to look up</div>
<div class="">attributes.</div>
<div class=""><br class=""></div>
<div class="">With this proposal both lookup methods no longer peek in the class ``__dict__``</div>
<div class="">but call the special method ``__getdescriptor__``, which is a slot defined</div>
<div class="">on the metaclass. The default implementation of that method looks</div>
<div class="">up the name the class ``__dict__``, which means that attribute lookup is</div>
<div class="">unchanged unless a metatype actually defines the new special method.</div>
<div class=""><br class=""></div>
<div class="">Aside: Attribute resolution algorithm in Python</div>
<div class="">-----------------------------------------------</div>
<div class=""><br class=""></div>
<div class="">The attribute resolution proces as implemented by ``object.__getattribute__``</div>
<div class="">(or PyObject_GenericGetAttr`` in CPython's implementation) is fairly</div>
<div class="">straightforward, but not entirely so without reading C code.</div>
<div class=""><br class=""></div>
<div class="">The current CPython implementation of object.__getattribute__ is basicly</div>
<div class="">equivalent to the following (pseudo-) Python code (excluding some house keeping and speed tricks)::</div>
<div class=""><br class=""></div>
<div class=""><br class=""></div>
<div class="">&nbsp; &nbsp; def _PyType_Lookup(tp, name):</div>
<div class="">&nbsp; &nbsp; &nbsp; &nbsp; mro = tp.mro()</div>
<div class="">
<span class="Apple-tab-span">	</span>assert isinstance(mro, tuple)</div>
<div class=""><br class=""></div>
<div class="">
<span class="Apple-tab-span">	</span>for base in mro:</div>
<div class="">
<span class="Apple-tab-span">	</span> &nbsp; assert isinstance(base, type)</div>
<div class=""><br class=""></div>
<div class="">
<span class="Apple-tab-span">	</span> &nbsp; # PEP 447 will change these lines:</div>
<div class="">
<span class="Apple-tab-span">	</span> &nbsp; try:</div>
<div class="">
<span class="Apple-tab-span">	</span> &nbsp; &nbsp; &nbsp; return base.__dict__[name]</div>
<div class="">
<span class="Apple-tab-span">	</span> &nbsp; except KeyError:</div>
<div class="">
<span class="Apple-tab-span">	</span> &nbsp; &nbsp; &nbsp; pass</div>
<div class=""><br class=""></div>
<div class="">
<span class="Apple-tab-span">	</span>return None</div>
<div class=""><br class=""></div>
<div class=""><br class=""></div>
<div class="">&nbsp; &nbsp; class object:</div>
<div class="">&nbsp; &nbsp; &nbsp; &nbsp; def __getattribute__(self, name):</div>
<div class="">
<span class="Apple-tab-span">	</span>&nbsp; &nbsp; assert isinstance(name, str)</div>
<div class=""><br class=""></div>
<div class="">
<span class="Apple-tab-span">	</span>&nbsp; &nbsp; tp = type(self)</div>
<div class="">
<span class="Apple-tab-span">	</span>&nbsp; &nbsp; descr = _PyType_Lookup(tp, name)</div>
<div class=""><br class=""></div>
<div class="">
<span class="Apple-tab-span">	</span>&nbsp; &nbsp; f = None</div>
<div class="">
<span class="Apple-tab-span">	</span>&nbsp; &nbsp; if descr is not None:</div>
<div class="">
<span class="Apple-tab-span">	</span>&nbsp; &nbsp; &nbsp; &nbsp; f = descr.__get__</div>
<div class="">
<span class="Apple-tab-span">		</span>if f is not None and descr.__set__ is not None:</div>
<div class="">
<span class="Apple-tab-span">		</span>&nbsp; &nbsp; # Data descriptor</div>
<div class="">
<span class="Apple-tab-span">		</span>&nbsp; &nbsp; return f(descr, self, type(self))</div>
<div class=""><br class=""></div>
<div class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dict = self.__dict__</div>
<div class="">
<span class="Apple-tab-span">	</span>&nbsp; &nbsp; if dict is not None:</div>
<div class="">
<span class="Apple-tab-span">	</span>&nbsp; &nbsp; &nbsp; &nbsp; try:</div>
<div class="">
<span class="Apple-tab-span">		</span>&nbsp; &nbsp; return self.__dict__[name]</div>
<div class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; except KeyError:</div>
<div class="">
<span class="Apple-tab-span">	</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pass</div>
<div class=""><br class=""></div>
<div class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if f is not None:</div>
<div class="">
<span class="Apple-tab-span">	</span>&nbsp; &nbsp; &nbsp; &nbsp; # Non-data descriptor</div>
<div class="">
<span class="Apple-tab-span">	</span>&nbsp; &nbsp; &nbsp; &nbsp; return f(descr, self, type(self))</div>
<div class=""><br class=""></div>
<div class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if descr is not None:</div>
<div class="">
<span class="Apple-tab-span">	</span>&nbsp; &nbsp; &nbsp; &nbsp; # Regular class attribute</div>
<div class="">
<span class="Apple-tab-span">	</span>&nbsp; &nbsp; &nbsp; &nbsp; return descr</div>
<div class=""><br class=""></div>
<div class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; raise AttributeError(name)</div>
<div class=""><br class=""></div>
<div class=""><br class=""></div>
<div class="">&nbsp; &nbsp; class super:</div>
<div class="">&nbsp; &nbsp; &nbsp; &nbsp; def __getattribute__(self, name):</div>
<div class="">
<span class="Apple-tab-span">	</span> &nbsp; assert isinstance(name, unicode)</div>
<div class=""><br class=""></div>
<div class="">
<span class="Apple-tab-span">	</span> &nbsp; if name != '__class__':</div>
<div class="">
<span class="Apple-tab-span">	</span> &nbsp; &nbsp; &nbsp; starttype = self.__self_type__</div>
<div class="">
<span class="Apple-tab-span">	</span> &nbsp; &nbsp; &nbsp; mro = startype.mro()</div>
<div class=""><br class=""></div>
<div class="">
<span class="Apple-tab-span">	</span> &nbsp; &nbsp; &nbsp; try:</div>
<div class="">
<span class="Apple-tab-span">	</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; idx = mro.index(self.__thisclass__)</div>
<div class=""><br class=""></div>
<div class="">
<span class="Apple-tab-span">	</span> &nbsp; &nbsp; &nbsp; except ValueError:</div>
<div class="">
<span class="Apple-tab-span">	</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pass</div>
<div class=""><br class=""></div>
<div class="">
<span class="Apple-tab-span">	</span> &nbsp; &nbsp; &nbsp; else:</div>
<div class="">
<span class="Apple-tab-span">	</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for base in mro[idx+1:]:</div>
<div class="">
<span class="Apple-tab-span">		</span> &nbsp; &nbsp; &nbsp; # PEP 447 will change these lines:</div>
<div class="">
<span class="Apple-tab-span">		</span> &nbsp; &nbsp; &nbsp; try:</div>
<div class="">
<span class="Apple-tab-span">		</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; descr = base.__dict__[name]</div>
<div class="">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; except KeyError:</div>
<div class="">
<span class="Apple-tab-span">		</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; continue</div>
<div class=""><br class=""></div>
<div class="">
<span class="Apple-tab-span">		</span> &nbsp; &nbsp; &nbsp; f = descr.__get__</div>
<div class="">
<span class="Apple-tab-span">		</span> &nbsp; &nbsp; &nbsp; if f is not None:</div>
<div class="">
<span class="Apple-tab-span">		</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return f(descr,</div>
<div class="">
<span class="Apple-tab-span">			</span> &nbsp; &nbsp; &nbsp; None if (self.__self__ is self.__self_type__) else self.__self__,</div>
<div class="">
<span class="Apple-tab-span">			</span> &nbsp; &nbsp; &nbsp; starttype)</div>
<div class=""><br class=""></div>
<div class="">
<span class="Apple-tab-span">		</span> &nbsp; &nbsp; &nbsp; else:</div>
<div class="">
<span class="Apple-tab-span">		</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return descr</div>
<div class=""><br class=""></div>
<div class="">
<span class="Apple-tab-span">	</span> &nbsp; return object.__getattribute__(self, name)</div>
<div class=""><br class=""></div>
<div class=""><br class=""></div>
<div class="">This PEP should change the dict lookup at the lines starting at "# PEP 447" with</div>
<div class="">a method call to perform the actual lookup, making is possible to affect that</div>
<div class="">lookup both for normal attribute access and access through the `super proxy`_.</div>
<div class=""><br class=""></div>
<div class="">Note that specific classes can already completely override the default</div>
<div class="">behaviour by implementing their own ``__getattribute__`` slot (with or without</div>
<div class="">calling the super class implementation).</div>
<div class=""><br class=""></div>
<div class=""><br class=""></div>
<div class="">In Python code</div>
<div class="">--------------</div>
<div class=""><br class=""></div>
<div class="">A meta type can define a method ``__getdescriptor__`` that is called during</div>
<div class="">attribute resolution by both ``super.__getattribute__``</div>
<div class="">and ``object.__getattribute``::</div>
<div class=""><br class=""></div>
<div class="">&nbsp; &nbsp; class MetaType(type):</div>
<div class="">&nbsp; &nbsp; &nbsp; &nbsp; def __getdescriptor__(cls, name):</div>
<div class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; try:</div>
<div class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return cls.__dict__[name]</div>
<div class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; except KeyError:</div>
<div class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; raise AttributeError(name) from None</div>
<div class=""><br class=""></div>
<div class="">The ``__getdescriptor__`` method has as its arguments a class (which is an</div>
<div class="">instance of the meta type) and the name of the attribute that is looked up.</div>
<div class="">It should return the value of the attribute without invoking descriptors,</div>
<div class="">and should raise `AttributeError`_ when the name cannot be found.</div>
<div class=""><br class=""></div>
<div class="">The `type`_ class provides a default implementation for ``__getdescriptor__``,</div>
<div class="">that looks up the name in the class dictionary.</div>
<div class=""><br class=""></div>
<div class="">Example usage</div>
<div class="">.............</div>
<div class=""><br class=""></div>
<div class="">The code below implements a silly metaclass that redirects attribute lookup to</div>
<div class="">uppercase versions of names::</div>
<div class=""><br class=""></div>
<div class="">&nbsp; &nbsp; class UpperCaseAccess (type):</div>
<div class="">&nbsp; &nbsp; &nbsp; &nbsp; def __getdescriptor__(cls, name):</div>
<div class="">
<span class="Apple-tab-span">	</span>&nbsp; &nbsp; try:</div>
<div class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return cls.__dict__[name.upper()]</div>
<div class="">
<span class="Apple-tab-span">	</span>&nbsp; &nbsp; except KeyError:</div>
<div class="">
<span class="Apple-tab-span">	</span>&nbsp; &nbsp; &nbsp; &nbsp; raise AttributeError(name) from None</div>
<div class=""><br class=""></div>
<div class="">&nbsp; &nbsp; class SillyObject (metaclass=UpperCaseAccess):</div>
<div class="">&nbsp; &nbsp; &nbsp; &nbsp; def m(self):</div>
<div class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return 42</div>
<div class=""><br class=""></div>
<div class="">&nbsp; &nbsp; &nbsp; &nbsp; def M(self):</div>
<div class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return "fourtytwo"</div>
<div class=""><br class=""></div>
<div class="">&nbsp; &nbsp; obj = SillyObject()</div>
<div class="">&nbsp; &nbsp; assert obj.m() == "fortytwo"</div>
<div class=""><br class=""></div>
<div class="">As mentioned earlier in this PEP a more realistic use case of this</div>
<div class="">functionallity is a ``__getdescriptor__`` method that dynamicly populates the</div>
<div class="">class ``__dict__`` based on attribute access, primarily when it is not</div>
<div class="">possible to reliably keep the class dict in sync with its source, for example</div>
<div class="">because the source used to populate ``__dict__`` is dynamic as well and does</div>
<div class="">not have triggers that can be used to detect changes to that source.</div>
<div class=""><br class=""></div>
<div class="">An example of that are the class bridges in PyObjC: the class bridge is a</div>
<div class="">Python object (class) that represents an Objective-C class and conceptually</div>
<div class="">has a Python method for every Objective-C method in the Objective-C class.</div>
<div class="">As with Python it is possible to add new methods to an Objective-C class, or</div>
<div class="">replace existing ones, and there are no callbacks that can be used to detect</div>
<div class="">this.</div>
<div class=""><br class=""></div>
<div class="">In C code</div>
<div class="">---------</div>
<div class=""><br class=""></div>
<div class="">A new slot ``tp_getdescriptor`` is added to the ``PyTypeObject`` struct, this</div>
<div class="">slot corresponds to the ``__getdescriptor__`` method on `type`_.</div>
<div class=""><br class=""></div>
<div class="">The slot has the following prototype::</div>
<div class=""><br class=""></div>
<div class="">&nbsp; &nbsp; PyObject* (*getdescriptorfunc)(PyTypeObject* cls, PyObject* name);</div>
<div class=""><br class=""></div>
<div class="">This method should lookup *name* in the namespace of *cls*, without looking at</div>
<div class="">superclasses, and should not invoke descriptors. The method returns ``NULL``</div>
<div class="">without setting an exception when the *name* cannot be found, and returns a</div>
<div class="">new reference otherwise (not a borrowed reference).</div>
<div class=""><br class=""></div>
<div class="">Use of this hook by the interpreter</div>
<div class="">-----------------------------------</div>
<div class=""><br class=""></div>
<div class="">The new method is required for metatypes and as such is defined on `type_`.</div>
<div class="">Both ``super.__getattribute__`` and</div>
<div class="">``object.__getattribute__``/`PyObject_GenericGetAttr`_</div>
<div class="">(through ``_PyType_Lookup``) use the this ``__getdescriptor__`` method when</div>
<div class="">walking the MRO.</div>
<div class=""><br class=""></div>
<div class="">Other changes to the implementation</div>
<div class="">-----------------------------------</div>
<div class=""><br class=""></div>
<div class="">The change for `PyObject_GenericGetAttr`_ will be done by changing the private</div>
<div class="">function ``_PyType_Lookup``. This currently returns a borrowed reference, but</div>
<div class="">must return a new reference when the ``__getdescriptor__`` method is present.</div>
<div class="">Because of this ``_PyType_Lookup`` will be renamed to ``_PyType_LookupName``,</div>
<div class="">this will cause compile-time errors for all out-of-tree users of this</div>
<div class="">private API.</div>
<div class=""><br class=""></div>
<div class="">The attribute lookup cache in ``Objects/typeobject.c`` is disabled for classes</div>
<div class="">that have a metaclass that overrides ``__getdescriptor__``, because using the</div>
<div class="">cache might not be valid for such classes.</div>
<div class=""><br class=""></div>
<div class="">Impact of this PEP on introspection</div>
<div class="">-----------------------------------</div>
<div class=""><br class=""></div>
<div class="">Use of the method introduced in this PEP can affect introspection of classes</div>
<div class="">with a metaclass that uses a custom ``__getdescriptor__`` method. This section</div>
<div class="">lists those changes.</div>
<div class=""><br class=""></div>
<div class="">The items listed below are only affected by custom ``__getdescriptor__``</div>
<div class="">methods, the default implementation for ``object`` won't cause problems</div>
<div class="">because that still only uses the class ``__dict__`` and won't cause visible</div>
<div class="">changes to the visible behaviour of the ``object.__getattribute__``.</div>
<div class=""><br class=""></div>
<div class="">* ``dir`` might not show all attributes</div>
<div class=""><br class=""></div>
<div class="">&nbsp; As with a custom ``__getattribute__`` method `dir()`_ might not see all</div>
<div class="">&nbsp; (instance) attributes when using the ``__getdescriptor__()`` method to</div>
<div class="">&nbsp; dynamicly resolve attributes.</div>
<div class=""><br class=""></div>
<div class="">&nbsp; The solution for that is quite simple: classes using ``__getdescriptor__``</div>
<div class="">&nbsp; should also implement `__dir__()`_ if they want full support for the builtin</div>
<div class="">&nbsp; `dir()`_ function.</div>
<div class=""><br class=""></div>
<div class="">* ``inspect.getattr_static`` might not show all attributes</div>
<div class=""><br class=""></div>
<div class="">&nbsp; The function ``inspect.getattr_static`` intentionally does not invoke</div>
<div class="">&nbsp; ``__getattribute__`` and descriptors to avoid invoking user code during</div>
<div class="">&nbsp; introspection with this function. The ``__getdescriptor__`` method will also</div>
<div class="">&nbsp; be ignored and is another way in which the result of ``inspect.getattr_static``</div>
<div class="">&nbsp; can be different from that of ``builtin.getattr``.</div>
<div class=""><br class=""></div>
<div class="">* ``inspect.getmembers`` and ``inspect.get_class_attrs``</div>
<div class=""><br class=""></div>
<div class="">&nbsp; Both of these functions directly access the class __dict__ of classes along</div>
<div class="">&nbsp; the MRO, and hence can be affected by a custom ``__getdescriptor__`` method.</div>
<div class=""><br class=""></div>
<div class="">&nbsp; **TODO**: I haven't fully worked out what the impact of this is, and if there</div>
<div class="">&nbsp; are mitigations for those using either updates to these functions, or</div>
<div class="">&nbsp; additional methods that users should implement to be fully compatible with</div>
<div class="">&nbsp; these functions.</div>
<div class=""><br class=""></div>
<div class="">&nbsp; One possible mitigation is to have a custom ``__getattribute__`` for these</div>
<div class="">&nbsp; classes that fills ``__dict__`` before returning and and defers to the</div>
<div class="">&nbsp; default implementation for other attributes.</div>
<div class=""><br class=""></div>
<div class="">* Direct introspection of the class ``__dict__``</div>
<div class=""><br class=""></div>
<div class="">&nbsp; Any code that directly access the class ``__dict__`` for introspection</div>
<div class="">&nbsp; can be affected by a custom ``__getdescriptor__`` method.</div>
<div class=""><br class=""></div>
<div class=""><br class=""></div>
<div class="">Performance impact</div>
<div class="">------------------</div>
<div class=""><br class=""></div>
<div class="">**WARNING**: The benchmark results in this section are old, and will be updated</div>
<div class="">when I've ported the patch to the current trunk. I don't expect significant</div>
<div class="">changes to the results in this section.</div>
<div class=""><br class=""></div>
<div class="">[snipped]</div>
<div class=""><br class=""></div>
<div class=""><br class=""></div>
<div class="">Alternative proposals</div>
<div class="">---------------------</div>
<div class=""><br class=""></div>
<div class="">``__getattribute_super__``</div>
<div class="">..........................</div>
<div class=""><br class=""></div>
<div class="">An earlier version of this PEP used the following static method on classes::</div>
<div class=""><br class=""></div>
<div class="">&nbsp; &nbsp; def __getattribute_super__(cls, name, object, owner): pass</div>
<div class=""><br class=""></div>
<div class="">This method performed name lookup as well as invoking descriptors and was</div>
<div class="">necessarily limited to working only with ``super.__getattribute__``.</div>
<div class=""><br class=""></div>
<div class=""><br class=""></div>
<div class="">Reuse ``tp_getattro``</div>
<div class="">.....................</div>
<div class=""><br class=""></div>
<div class="">It would be nice to avoid adding a new slot, thus keeping the API simpler and</div>
<div class="">easier to understand.&nbsp; A comment on `Issue 18181`_ asked about reusing the</div>
<div class="">``tp_getattro`` slot, that is super could call the ``tp_getattro`` slot of all</div>
<div class="">methods along the MRO.</div>
<div class=""><br class=""></div>
<div class="">That won't work because ``tp_getattro`` will look in the instance</div>
<div class="">``__dict__`` before it tries to resolve attributes using classes in the MRO.</div>
<div class="">This would mean that using ``tp_getattro`` instead of peeking the class</div>
<div class="">dictionaries changes the semantics of the `super class`_.</div>
<div class=""><br class=""></div>
<div class="">Alternate placement of the new method</div>
<div class="">.....................................</div>
<div class=""><br class=""></div>
<div class="">This PEP proposes to add ``__getdescriptor__`` as a method on the metaclass.</div>
<div class="">An alternative would be to add it as a class method on the class itself</div>
<div class="">(simular to how ``__new__`` is a `staticmethod`_ of the class and not a method</div>
<div class="">of the metaclass).</div>
<div class=""><br class=""></div>
<div class="">The two are functionally equivalent, and there's something to be said about</div>
<div class="">not requiring the use of a meta class.</div>
<div class=""><br class=""></div>
<div class=""><br class=""></div>
<div class="">References</div>
<div class="">==========</div>
<div class=""><br class=""></div>
<div class="">* `Issue 18181`_ contains an out of date prototype implementation</div>
<div class=""><br class=""></div>
<div class="">Copyright</div>
<div class="">=========</div>
<div class=""><br class=""></div>
<div class="">This document has been placed in the public domain.</div>
<div class=""><br class=""></div>
<div class="">.. _`Issue 18181`: <a href="http://bugs.python.org/issue18181" class="">http://bugs.python.org/issue18181</a>
</div>
<div class=""><br class=""></div>
<div class="">.. _`super class`: <a href="http://docs.python.org/3/library/functions.html#super" class="">http://docs.python.org/3/library/functions.html#super</a>
</div>
<div class=""><br class=""></div>
<div class="">.. _`super proxy`: <a href="http://docs.python.org/3/library/functions.html#super" class="">http://docs.python.org/3/library/functions.html#super</a>
</div>
<div class=""><br class=""></div>
<div class="">.. _`super`: <a href="http://docs.python.org/3/library/functions.html#super" class="">http://docs.python.org/3/library/functions.html#super</a>
</div>
<div class=""><br class=""></div>
<div class="">.. _`dir()`: <a href="http://docs.python.org/3/library/functions.html#dir" class="">http://docs.python.org/3/library/functions.html#dir</a>
</div>
<div class=""><br class=""></div>
<div class="">.. _`staticmethod`: <a href="http://docs.python.org/3/library/functions.html#staticmethod" class="">http://docs.python.org/3/library/functions.html#staticmethod</a>
</div>
<div class=""><br class=""></div>
<div class="">.. _`__dir__()`: <a href="https://docs.python.org/3/reference/datamodel.html#object.__dir__" class="">https://docs.python.org/3/reference/datamodel.html#object.__dir__</a>
</div>
<div class=""><br class=""></div>
<div class="">.. _`NotImplemented`: <a href="http://docs.python.org/3/library/constants.html#NotImplemented" class="">http://docs.python.org/3/library/constants.html#NotImplemented</a>
</div>
<div class=""><br class=""></div>
<div class="">.. _`PyObject_GenericGetAttr`: <a href="http://docs.python.org/3/c-api/object.html#PyObject_GenericGetAttr" class="">http://docs.python.org/3/c-api/object.html#PyObject_GenericGetAttr</a>
</div>
<div class=""><br class=""></div>
<div class="">.. _`type`: <a href="http://docs.python.org/3/library/functions.html#type" class="">http://docs.python.org/3/library/functions.html#type</a>
</div>
<div class=""><br class=""></div>
<div class="">.. _`AttributeError`: <a href="http://docs.python.org/3/library/exceptions.html#AttributeError" class="">http://docs.python.org/3/library/exceptions.html#AttributeError</a>
</div>
<div class=""><br class=""></div>
<div class="">.. _`PyObjC`: <a href="http://pyobjc.sourceforge.net/" class="">http://pyobjc.sourceforge.net/</a>
</div>
<div class=""><br class=""></div>
<div class="">.. _`classmethod`: <a href="http://docs.python.org/3/library/functions.html#classmethod" class="">http://docs.python.org/3/library/functions.html#classmethod</a>
</div>
</div>
</div>
Vitale, Joseph | 22 Jul 00:20 2015

Python 3.4.3 on RedHat 6.6 s390x make fails with: make: *** [sharedmods] Error 139

Hello,

 

Trying to install Python 3.4.3  on Red Hat  6.6 zLinux(s390x)  but “make” fails and core dumps.  Not using OpenSSL and did not configure for it.

 

Can you provide direction?

 

./configure

make

 gcc -pthread -fPIC -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes

 -Werror=declaration-after-statement -I/usr/local/ssl/include

 -I./Include -I. -IInclude -I/usr/local/include

 -I/xjp/Python-3.4.3/Include -I/xjp/Python-3.4.3 -c

 /xjp/Python-3.4.3/Modules/_ssl.c -o

 build/temp.linux-s390x-3.4/xjp/Python-3.4.3/Modules/_ssl.o

gcc -pthread -shared

 build/temp.linux-s390x-3.4/xjp/Python-3.4.3/Modules/_ssl.o

 -L/usr/local/ssl/lib -L/usr/local/lib -lssl -lcrypto -o

 build/lib.linux-s390x-3.4/_ssl.cpython-34

m.so

 

/bin/sh: line 6: 48734 Segmentation fault      (core dumped) CC='gcc -pthread' LDSHARED='gcc -pthread -shared  ' OPT='-DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes' _TCLTK_I

NCLUDES='' _TCLTK_LIBS='' ./python -E ./setup.py $quiet build

make: *** [sharedmods] Error 139

 

Thanks

 

Joe


The information contained in this e-mail, and any attachment, is confidential and is intended solely for the use of the intended recipient. Access, copying or re-use of the e-mail or any attachment, or any information contained therein, by any other person is not authorized. If you are not the intended recipient please return the e-mail to the sender and delete it from your computer. Although we attempt to sweep e-mail and attachments for viruses, we do not guarantee that either are virus-free and accept no liability for any damage sustained as a result of viruses.

Please refer to http://disclaimer.bnymellon.com/eu.htm for certain disclosures relating to European legal entities.
<div>
<div class="WordSection1">
<p class="MsoNormal">Hello,<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">Trying to install Python 3.4.3&nbsp; on Red Hat&nbsp; 6.6 zLinux(s390x)&nbsp; but &ldquo;make&rdquo; fails and core dumps.&nbsp; Not using OpenSSL and did not configure for it.<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">Can you provide direction?<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoPlainText">./configure<p></p></p>
<p class="MsoPlainText">make<p></p></p>
<p class="MsoPlainText"><p></p></p>
<p class="MsoPlainText">&nbsp;gcc -pthread -fPIC -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes
<p></p></p>
<p class="MsoPlainText">&nbsp;-Werror=declaration-after-statement -I/usr/local/ssl/include
<p></p></p>
<p class="MsoPlainText">&nbsp;-I./Include -I. -IInclude -I/usr/local/include <p></p></p>
<p class="MsoPlainText">&nbsp;-I/xjp/Python-3.4.3/Include -I/xjp/Python-3.4.3 -c <p></p></p>
<p class="MsoPlainText">&nbsp;/xjp/Python-3.4.3/Modules/_ssl.c -o <p></p></p>
<p class="MsoPlainText">&nbsp;build/temp.linux-s390x-3.4/xjp/Python-3.4.3/Modules/_ssl.o<p></p></p>
<p class="MsoPlainText">gcc -pthread -shared <p></p></p>
<p class="MsoPlainText">&nbsp;build/temp.linux-s390x-3.4/xjp/Python-3.4.3/Modules/_ssl.o
<p></p></p>
<p class="MsoPlainText">&nbsp;-L/usr/local/ssl/lib -L/usr/local/lib -lssl -lcrypto -o <p></p></p>
<p class="MsoPlainText">&nbsp;build/lib.linux-s390x-3.4/_ssl.cpython-34<p></p></p>
<p class="MsoPlainText">m.so<p></p></p>
<p class="MsoPlainText"><p>&nbsp;</p></p>
<p class="MsoPlainText">/bin/sh: line 6: 48734 Segmentation fault&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (core dumped) CC='gcc -pthread' LDSHARED='gcc -pthread -shared&nbsp; ' OPT='-DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes' _TCLTK_I<p></p></p>
<p class="MsoPlainText">NCLUDES='' _TCLTK_LIBS='' ./python -E ./setup.py $quiet build<p></p></p>
<p class="MsoPlainText">make: *** [sharedmods] Error 139<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">Thanks<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal"><span>Joe</span><p></p></p>
</div>
<br clear="both">
The information contained in this e-mail, and any attachment, is confidential and is intended solely for the use of the intended recipient. Access, copying or re-use of the e-mail or any attachment, or any information contained therein, by any other person is not authorized. If you are not the intended recipient please return the e-mail to the sender and delete it from your computer. Although we attempt to sweep e-mail and attachments for viruses, we do not guarantee that either are virus-free and accept no liability for any damage sustained as a result of viruses. <br><br>
Please refer to http://disclaimer.bnymellon.com/eu.htm for certain disclosures relating to European legal entities.<br>
</div>

Gmane