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 AWhetter
Recipients AWhetter, Arfrever, Ramchandra Apte, eric.araujo, ericlammerts, r.david.murray
Date 2019-10-04.17:05:49
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1570208750.07.0.585902826142.issue16974@roundup.psfhosted.org>
In-reply-to
Content
If we were to add a new attribute to indicate whether a file is real or not, there would need to be a way for users to indicate whether a file is real or not to functions such as `compile()` (there's lots more!) that take a filename. Without enforcing this being set and introducing backward incompatible changes, it would need a default value. To be backwards compatible we could default to True and the existing behaviour persists.

It's also worth mentioning that there's a few places (there might be more!) where Python already assumes that a file in angle brackets is not a real file:
* https://github.com/python/cpython/blob/abd7cd856ba326bd7574135c7d034e98492ab695/Lib/bdb.py#L45
* https://github.com/python/cpython/blob/abd7cd856ba326bd7574135c7d034e98492ab695/Lib/pdb.py#L694
* https://github.com/python/cpython/blob/abd7cd856ba326bd7574135c7d034e98492ab695/Lib/pickle.py#L324

Nothing major though and easily changeable so it's definitely possible but it would be a lot of work to make sure that everything is setting the new attribute properly.

Is there a preference on what the name of this attribute should be? Maybe `__is_real_file__`. It's clear but long.
History
Date User Action Args
2019-10-04 17:05:50AWhettersetrecipients: + AWhetter, eric.araujo, Arfrever, r.david.murray, Ramchandra Apte, ericlammerts
2019-10-04 17:05:50AWhettersetmessageid: <1570208750.07.0.585902826142.issue16974@roundup.psfhosted.org>
2019-10-04 17:05:50AWhetterlinkissue16974 messages
2019-10-04 17:05:49AWhettercreate