[issue32313] Wrong inspect.getsource for datetime

2020-08-27 Thread Paul Ganssle
Paul Ganssle added the comment: I think that we should re-examine this issue after GH-20472 is merged. I'm not really sure how that will affect this and indeed *how* it should affect this. I am not sure whether people are relying on the current behavior, or what use cases would be improved

[issue32313] Wrong inspect.getsource for datetime

2020-08-26 Thread Dong-hee Na
Dong-hee Na added the comment: _datetime.datetime's tp_name is datetime.datetime so inspect module guess that _datetime.datetime's module name is datetime, not _datetime. I don't think we have to fix this issue from inspect module side. If the _datetime.datetime's tp_name is updated to

[issue32313] Wrong inspect.getsource for datetime

2020-08-26 Thread శ్రీనివాస్ రెడ్డి తాటిపర్తి
Srinivas Reddy Thatiparthy(శ్రీనివాస్ రెడ్డి తాటిపర్తి) added the comment: Looks like for `getfile` docs should be updated. On python2.7.17_1, import inspect, datetime print(inspect.getfile(datetime.datetime)) outputs,

[issue32313] Wrong inspect.getsource for datetime

2020-08-23 Thread Irit Katriel
Irit Katriel added the comment: The documentation for getfile says "This will fail with a TypeError if the object is a built-in module, class, or function." https://docs.python.org/3/library/inspect.html#inspect.getfile But it doesn't: >>> inspect.getfile(datetime.datetime)

[issue32313] Wrong inspect.getsource for datetime

2018-09-16 Thread Paul Ganssle
Paul Ganssle added the comment: I think this is *mostly* the correct behavior (though it may indeed be confusing). Note that `datetime.py` *is* the source of the module `datetime`, it's just that most of the code in there is shadowed by the line you've linked. If you try and get the source

[issue32313] Wrong inspect.getsource for datetime

2018-09-14 Thread Paul Ganssle
Change by Paul Ganssle : -- nosy: +p-ganssle ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue32313] Wrong inspect.getsource for datetime

2018-09-14 Thread Karthikeyan Singaravelan
Change by Karthikeyan Singaravelan : -- nosy: +xtreak ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue32313] Wrong inspect.getsource for datetime

2017-12-13 Thread Aaron Meurer
New submission from Aaron Meurer : inspect.getsource(datetime) shows the Python source code for datetime, even when it is the C extension. This is very confusing. I believe it's because _datetime is used to override everything in datetime at the end of the file (here