This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author xmorel
Recipients docs@python, xmorel
Date 2017-06-01.08:59:10
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1496307550.81.0.122215532062.issue30535@psf.upfronthosting.co.za>
In-reply-to
Content
Encountered this issue porting Python 2 code manipulating meta_path to Python 3.

In Python 2, meta_path is empty by default and its documentation specifically notes that:

> sys.meta_path is searched before any implicit default finders or sys.path.

As a result, sys.meta_path.append() works perfectly well and is overwhelmingly common[0].

In Python 3, this note was removed but the documentation does not specifically state default finders are present in meta_path, and the old code using sys.meta_path.append may now break as the default finders will silently take precedence on the custom ones if they believe they can do the job.

I'd like to add a warning to the Python 3 documentation (3.5+?) noting the presence of existing default loaders, and to the Python 2 documentation suggesting `sys.meta_path.insert(0, finder)` for future-proofing, would there be objections or issues?

[0] https://github.com/search?q=meta_path.append&type=Code&utf8=
History
Date User Action Args
2017-06-01 08:59:10xmorelsetrecipients: + xmorel, docs@python
2017-06-01 08:59:10xmorelsetmessageid: <1496307550.81.0.122215532062.issue30535@psf.upfronthosting.co.za>
2017-06-01 08:59:10xmorellinkissue30535 messages
2017-06-01 08:59:10xmorelcreate