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.

classification
Title: issubclass can fail after module reloading
Type: behavior Stage: resolved
Components: Versions: Python 3.4, Python 3.5, Python 2.7
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: brett.cannon, pitrou, serhiy.storchaka, yselivanov
Priority: normal Keywords:

Created on 2014-10-03 18:29 by serhiy.storchaka, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (3)
msg228362 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-10-03 18:29
Inspired by test failure in issue22540. This is still looks as a bug to me:

>>> import sys, decimal, numbers
>>> issubclass(decimal.Decimal, numbers.Number)
True
>>> del sys.modules['numbers']
>>> import numbers
>>> issubclass(decimal.Decimal, numbers.Number)
False
msg228364 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2014-10-03 19:18
How would Decimal know that someone has swapped the decimal module in sys.modules?
msg228386 - (view) Author: Yury Selivanov (yselivanov) * (Python committer) Date: 2014-10-03 21:26
I don't think it a bug or that it's possible to do something about it. Reloading modules in Python should usually be just avoided by all means.
History
Date User Action Args
2022-04-11 14:58:08adminsetgithub: 66740
2014-10-08 18:21:07serhiy.storchakasetstatus: open -> closed
resolution: wont fix
stage: resolved
2014-10-03 21:26:18yselivanovsetnosy: + brett.cannon, yselivanov
messages: + msg228386
2014-10-03 19:18:15pitrousetmessages: + msg228364
2014-10-03 18:30:04serhiy.storchakasetnosy: + pitrou
2014-10-03 18:29:35serhiy.storchakacreate