Repository navigation
Conversation
Documentation build overview
465 files changed ·
|
|
This PR is stale because it has been open for 90 days with no activity. |
kushaldas
left a comment
There was a problem hiding this comment.
This breaks the pre-existing promise:
cpython/Lib/test/test_importlib/test_lazy.py
Line 110 in 1d64195
For example if you add the following in Lib/test/test_importlib/test_lazy.py , this passes in the current implementation but fails after applying the patch.
def test_mutated_name_survives_loading(self):
module = self.new_module()
module.__name__ = 'bogus'
# Reading __name__ no longer triggers loading.
self.assertEqual(module.__name__, 'bogus')
# Accessing attr executes TestingImporter's source, which assigns
# __name__ = 'changed'. The earlier user assignment should survive.
self.assertEqual(module.attr, 42)
self.assertEqual(module.__name__, 'bogus'The __name__ assignment should survive the loading.
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
46b17f7 to
c8188dc
Compare
|
I have made the requested changes; please review again |
|
Thanks for making the requested changes! @kushaldas: please review the changes made to this pull request. |
This PR makes
__name__and__file__, as a proxy for_LazyModule.__spec__. That says, reading & writing both will be directly forwarded to_LazyModule.__spec__, which will NOT trigger the lazy loading.