2021-12-20 20:02:04 +01:00
|
|
|
From aa169302f4acbbcae616154bf54c70167dbd1fd5 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Nikita Kniazev <nok.raven@gmail.com>
|
|
|
|
Date: Sat, 4 Dec 2021 19:32:13 +0300
|
|
|
|
Subject: [PATCH 1/2] Everything is an object and has a `__class__` in Python 3
|
|
|
|
|
|
|
|
---
|
2022-01-15 15:38:59 +01:00
|
|
|
IPython/core/oinspect.py | 2 +-
|
|
|
|
IPython/core/tests/test_oinspect.py | 6 +++++-
|
|
|
|
2 files changed, 6 insertions(+), 2 deletions(-)
|
2021-12-20 20:02:04 +01:00
|
|
|
|
2022-01-15 15:38:59 +01:00
|
|
|
--- a/IPython/core/oinspect.py
|
|
|
|
+++ b/IPython/core/oinspect.py
|
|
|
|
@@ -309,7 +309,7 @@ def find_file(obj) -> str:
|
2021-12-20 20:02:04 +01:00
|
|
|
fname = None
|
|
|
|
try:
|
|
|
|
fname = inspect.getabsfile(obj)
|
|
|
|
- except (OSError, TypeError):
|
|
|
|
+ except TypeError:
|
|
|
|
# For an instance, the file that matters is where its class was
|
|
|
|
# declared.
|
|
|
|
try:
|
2022-01-15 15:38:59 +01:00
|
|
|
--- a/IPython/core/tests/test_oinspect.py
|
|
|
|
+++ b/IPython/core/tests/test_oinspect.py
|
|
|
|
@@ -35,6 +35,10 @@ class SourceModuleMainTest:
|
|
|
|
__module__ = "__main__"
|
2021-12-20 20:02:04 +01:00
|
|
|
|
|
|
|
|
|
|
|
+class SourceModuleMainTest:
|
|
|
|
+ __module__ = "__main__"
|
|
|
|
+
|
|
|
|
+
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
# Local utilities
|
|
|
|
#-----------------------------------------------------------------------------
|
2022-01-15 15:38:59 +01:00
|
|
|
@@ -43,7 +47,7 @@ class SourceModuleMainTest:
|
2021-12-20 20:02:04 +01:00
|
|
|
# defined, if any code is inserted above, the following line will need to be
|
|
|
|
# updated. Do NOT insert any whitespace between the next line and the function
|
|
|
|
# definition below.
|
2022-01-15 15:38:59 +01:00
|
|
|
-THIS_LINE_NUMBER = 46 # Put here the actual number of this line
|
|
|
|
+THIS_LINE_NUMBER = 50 # Put here the actual number of this line
|
2021-12-20 20:02:04 +01:00
|
|
|
|
|
|
|
|
2022-01-15 15:38:59 +01:00
|
|
|
def test_find_source_lines():
|