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
6eaac13c
Kaydet (Commit)
6eaac13c
authored
May 09, 2014
tarafından
Brett Cannon
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #21156: importlib.abc.InspectLoader.source_to_code() is now a
staticmethod.
üst
a237a987
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
2 deletions
+17
-2
importlib.rst
Doc/library/importlib.rst
+7
-1
3.5.rst
Doc/whatsnew/3.5.rst
+5
-0
abc.py
Lib/importlib/abc.py
+2
-1
NEWS
Misc/NEWS
+3
-0
No files found.
Doc/library/importlib.rst
Dosyayı görüntüle @
6eaac13c
...
...
@@ -499,7 +499,7 @@ ABC hierarchy::
.. versionchanged:: 3.4
Raises :exc:`ImportError` instead of :exc:`NotImplementedError`.
.. method:: source_to_code(data, path='
<
string
>
')
..
static
method:: source_to_code(data, path='
<
string
>
')
Create a code object from Python source.
...
...
@@ -508,8 +508,14 @@ ABC hierarchy::
the "path" to where the source code originated from, which can be an
abstract concept (e.g. location in a zip file).
With the subsequent code object one can execute it in a module by
running ``exec(code, module.__dict__)``.
.. versionadded:: 3.4
.. versionchanged:: 3.5
Made the method static.
.. method:: exec_module(module)
Implementation of :meth:`Loader.exec_module`.
...
...
Doc/whatsnew/3.5.rst
Dosyayı görüntüle @
6eaac13c
...
...
@@ -158,6 +158,11 @@ Improved Modules
*module* contains no docstrings instead of raising :exc:`ValueError`
(contributed by Glenn Jones in :issue:`15916`).
* :func:`importlib.abc.InspectLoader.source_to_code` is now a
static method to make it easier to work with source code in a string.
With a module object that you want to initialize you can then use
``exec(code, module.__dict__)`` to execute the code in the module.
Optimizations
=============
...
...
Lib/importlib/abc.py
Dosyayı görüntüle @
6eaac13c
...
...
@@ -217,7 +217,8 @@ class InspectLoader(Loader):
"""
raise
ImportError
def
source_to_code
(
self
,
data
,
path
=
'<string>'
):
@staticmethod
def
source_to_code
(
data
,
path
=
'<string>'
):
"""Compile 'data' into a code object.
The 'data' argument can be anything that compile() can handle. The'path'
...
...
Misc/NEWS
Dosyayı görüntüle @
6eaac13c
...
...
@@ -73,6 +73,9 @@ Core and Builtins
Library
-------
- Issue #21156: importlib.abc.InspectLoader.source_to_code() is now a
staticmethod.
- Issue #21396: Fix TextIOWrapper(..., write_through=True) to not force a
flush() on the underlying binary stream. Patch by akira.
...
...
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