Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
50793b44
Kaydet (Commit)
50793b44
authored
Haz 07, 2013
tarafından
Brett Cannon
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #18055: Move to importlib from imp for IDLE.
üst
b101435a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
38 deletions
+21
-38
EditorWindow.py
Lib/idlelib/EditorWindow.py
+19
-38
NEWS
Misc/NEWS
+2
-0
No files found.
Lib/idlelib/EditorWindow.py
Dosyayı görüntüle @
50793b44
import
imp
import
importlib
import
importlib
import
importlib.abc
import
os
import
os
import
re
import
re
import
string
import
string
...
@@ -35,34 +35,6 @@ def _sphinx_version():
...
@@ -35,34 +35,6 @@ def _sphinx_version():
release
+=
'
%
s
%
s'
%
(
level
[
0
],
serial
)
release
+=
'
%
s
%
s'
%
(
level
[
0
],
serial
)
return
release
return
release
def
_find_module
(
fullname
,
path
=
None
):
"""Version of imp.find_module() that handles hierarchical module names"""
file
=
None
for
tgt
in
fullname
.
split
(
'.'
):
if
file
is
not
None
:
file
.
close
()
# close intermediate files
(
file
,
filename
,
descr
)
=
imp
.
find_module
(
tgt
,
path
)
if
descr
[
2
]
==
imp
.
PY_SOURCE
:
break
# find but not load the source file
module
=
imp
.
load_module
(
tgt
,
file
,
filename
,
descr
)
try
:
path
=
module
.
__path__
except
AttributeError
:
raise
ImportError
(
'No source for module '
+
module
.
__name__
)
if
descr
[
2
]
!=
imp
.
PY_SOURCE
:
# If all of the above fails and didn't raise an exception,fallback
# to a straight import which can find __init__.py in a package.
m
=
__import__
(
fullname
)
try
:
filename
=
m
.
__file__
except
AttributeError
:
pass
else
:
file
=
None
descr
=
os
.
path
.
splitext
(
filename
)[
1
],
None
,
imp
.
PY_SOURCE
return
file
,
filename
,
descr
class
HelpDialog
(
object
):
class
HelpDialog
(
object
):
...
@@ -687,20 +659,29 @@ class EditorWindow(object):
...
@@ -687,20 +659,29 @@ class EditorWindow(object):
return
return
# XXX Ought to insert current file's directory in front of path
# XXX Ought to insert current file's directory in front of path
try
:
try
:
(
f
,
file
,
(
suffix
,
mode
,
type
))
=
_find_module
(
name
)
loader
=
importlib
.
find_loader
(
name
)
except
(
Nam
eError
,
ImportError
)
as
msg
:
except
(
Valu
eError
,
ImportError
)
as
msg
:
tkMessageBox
.
showerror
(
"Import error"
,
str
(
msg
),
parent
=
self
.
text
)
tkMessageBox
.
showerror
(
"Import error"
,
str
(
msg
),
parent
=
self
.
text
)
return
return
if
type
!=
imp
.
PY_SOURCE
:
if
loader
is
None
:
tkMessageBox
.
showerror
(
"Unsupported type"
,
tkMessageBox
.
showerror
(
"Import error"
,
"module not found"
,
"
%
s is not a source module"
%
name
,
parent
=
self
.
text
)
parent
=
self
.
text
)
return
if
not
isinstance
(
loader
,
importlib
.
abc
.
SourceLoader
):
tkMessageBox
.
showerror
(
"Import error"
,
"not a source-based module"
,
parent
=
self
.
text
)
return
try
:
file_path
=
loader
.
get_filename
(
name
)
except
AttributeError
:
tkMessageBox
.
showerror
(
"Import error"
,
"loader does not support get_filename"
,
parent
=
self
.
text
)
return
return
if
f
:
f
.
close
()
if
self
.
flist
:
if
self
.
flist
:
self
.
flist
.
open
(
file
)
self
.
flist
.
open
(
file
_path
)
else
:
else
:
self
.
io
.
loadfile
(
file
)
self
.
io
.
loadfile
(
file
_path
)
def
open_class_browser
(
self
,
event
=
None
):
def
open_class_browser
(
self
,
event
=
None
):
filename
=
self
.
io
.
filename
filename
=
self
.
io
.
filename
...
...
Misc/NEWS
Dosyayı görüntüle @
50793b44
...
@@ -71,6 +71,8 @@ Library
...
@@ -71,6 +71,8 @@ Library
IDLE
IDLE
----
----
-
Issue
#
18055
:
Move
IDLE
off
of
imp
and
on
to
importlib
.
-
Issue
#
15392
:
Create
a
unittest
framework
for
IDLE
.
-
Issue
#
15392
:
Create
a
unittest
framework
for
IDLE
.
Initial
patch
by
Rajagopalasarma
Jayakrishnan
.
Initial
patch
by
Rajagopalasarma
Jayakrishnan
.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment