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
43cfd824
Kaydet (Commit)
43cfd824
authored
Ock 15, 2016
tarafından
Brett Cannon
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Merge for issue #17633
üst
43dab4bf
56aae8f3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
16 deletions
+32
-16
test_zipimport.py
Lib/test/test_zipimport.py
+0
-0
zipimport.c
Modules/zipimport.c
+32
-16
No files found.
Lib/test/test_zipimport.py
Dosyayı görüntüle @
43cfd824
This diff is collapsed.
Click to expand it.
Modules/zipimport.c
Dosyayı görüntüle @
43cfd824
...
...
@@ -324,17 +324,14 @@ get_module_info(ZipImporter *self, PyObject *fullname)
}
typedef
enum
{
FL_ERROR
,
FL_NOT_FOUND
,
FL_MODULE_FOUND
,
FL_NS_FOUND
FL_ERROR
=
-
1
,
/* error */
FL_NOT_FOUND
,
/* no loader or namespace portions found */
FL_MODULE_FOUND
,
/* module/package found */
FL_NS_FOUND
/* namespace portion found: */
/* *namespace_portion will point to the name */
}
find_loader_result
;
/* The guts of "find_loader" and "find_module". Return values:
-1: error
0: no loader or namespace portions found
1: module/package found
2: namespace portion found: *namespace_portion will point to the name
/* The guts of "find_loader" and "find_module".
*/
static
find_loader_result
find_loader
(
ZipImporter
*
self
,
PyObject
*
fullname
,
PyObject
**
namespace_portion
)
...
...
@@ -349,21 +346,34 @@ find_loader(ZipImporter *self, PyObject *fullname, PyObject **namespace_portion)
if
(
mi
==
MI_NOT_FOUND
)
{
/* Not a module or regular package. See if this is a directory, and
therefore possibly a portion of a namespace package. */
int
is_dir
=
check_is_directory
(
self
,
self
->
prefix
,
fullname
);
find_loader_result
result
=
FL_NOT_FOUND
;
PyObject
*
subname
;
int
is_dir
;
/* We're only interested in the last path component of fullname;
earlier components are recorded in self->prefix. */
subname
=
get_subname
(
fullname
);
if
(
subname
==
NULL
)
{
return
FL_ERROR
;
}
is_dir
=
check_is_directory
(
self
,
self
->
prefix
,
subname
);
if
(
is_dir
<
0
)
re
turn
-
1
;
if
(
is_dir
)
{
re
sult
=
FL_ERROR
;
else
if
(
is_dir
)
{
/* This is possibly a portion of a namespace
package. Return the string representing its path,
without a trailing separator. */
*
namespace_portion
=
PyUnicode_FromFormat
(
"%U%c%U%U"
,
self
->
archive
,
SEP
,
self
->
prefix
,
full
name
);
self
->
prefix
,
sub
name
);
if
(
*
namespace_portion
==
NULL
)
return
FL_ERROR
;
return
FL_NS_FOUND
;
result
=
FL_ERROR
;
else
result
=
FL_NS_FOUND
;
}
return
FL_NOT_FOUND
;
Py_DECREF
(
subname
);
return
result
;
}
/* This is a module or package. */
return
FL_MODULE_FOUND
;
...
...
@@ -397,6 +407,9 @@ zipimporter_find_module(PyObject *obj, PyObject *args)
case
FL_MODULE_FOUND
:
result
=
(
PyObject
*
)
self
;
break
;
default:
PyErr_BadInternalCall
();
return
NULL
;
}
Py_INCREF
(
result
);
return
result
;
...
...
@@ -433,6 +446,9 @@ zipimporter_find_loader(PyObject *obj, PyObject *args)
result
=
Py_BuildValue
(
"O[O]"
,
Py_None
,
namespace_portion
);
Py_DECREF
(
namespace_portion
);
return
result
;
default:
PyErr_BadInternalCall
();
return
NULL
;
}
return
result
;
}
...
...
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