1
0
python-ipython/ipython-pr13371-py310-oserror.patch

44 lines
1.5 KiB
Diff
Raw Normal View History

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
---
IPython/core/oinspect.py | 2 +-
IPython/core/tests/test_oinspect.py | 6 +++++-
2 files changed, 6 insertions(+), 2 deletions(-)
--- a/IPython/core/oinspect.py
+++ b/IPython/core/oinspect.py
@@ -309,7 +309,7 @@ def find_file(obj) -> str:
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:
--- a/IPython/core/tests/test_oinspect.py
+++ b/IPython/core/tests/test_oinspect.py
@@ -35,6 +35,10 @@ class SourceModuleMainTest:
__module__ = "__main__"
+class SourceModuleMainTest:
+ __module__ = "__main__"
+
+
#-----------------------------------------------------------------------------
# Local utilities
#-----------------------------------------------------------------------------
@@ -43,7 +47,7 @@ class SourceModuleMainTest:
# 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.
-THIS_LINE_NUMBER = 46 # Put here the actual number of this line
+THIS_LINE_NUMBER = 50 # Put here the actual number of this line
def test_find_source_lines():