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
2d322274
Kaydet (Commit)
2d322274
authored
Nis 04, 2011
tarafından
Victor Stinner
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #11619: _PyImport_LoadDynamicModule() doesn't encode the path to bytes
on Windows.
üst
54e7135f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
17 deletions
+30
-17
NEWS
Misc/NEWS
+3
-0
dynload_win.c
Python/dynload_win.c
+16
-17
importdl.c
Python/importdl.c
+11
-0
No files found.
Misc/NEWS
Dosyayı görüntüle @
2d322274
...
@@ -10,6 +10,9 @@ What's New in Python 3.3 Alpha 1?
...
@@ -10,6 +10,9 @@ What's New in Python 3.3 Alpha 1?
Core and Builtins
Core and Builtins
-----------------
-----------------
- Issue #11619: _PyImport_LoadDynamicModule() doesn'
t
encode
the
path
to
bytes
on
Windows
.
-
Issue
#
10998
:
Remove
mentions
of
-
Q
,
sys
.
flags
.
division_warning
and
-
Issue
#
10998
:
Remove
mentions
of
-
Q
,
sys
.
flags
.
division_warning
and
Py_DivisionWarningFlag
left
over
from
Python
2.
Py_DivisionWarningFlag
left
over
from
Python
2.
...
...
Python/dynload_win.c
Dosyayı görüntüle @
2d322274
...
@@ -171,8 +171,8 @@ static char *GetPythonImport (HINSTANCE hModule)
...
@@ -171,8 +171,8 @@ static char *GetPythonImport (HINSTANCE hModule)
return
NULL
;
return
NULL
;
}
}
dl_funcptr
_PyImport_GetDynLoad
Func
(
const
char
*
shortname
,
dl_funcptr
_PyImport_GetDynLoad
Windows
(
const
char
*
shortname
,
const
char
*
pathname
,
FILE
*
fp
)
PyObject
*
pathname
,
FILE
*
fp
)
{
{
dl_funcptr
p
;
dl_funcptr
p
;
char
funcname
[
258
],
*
import_python
;
char
funcname
[
258
],
*
import_python
;
...
@@ -185,8 +185,7 @@ dl_funcptr _PyImport_GetDynLoadFunc(const char *shortname,
...
@@ -185,8 +185,7 @@ dl_funcptr _PyImport_GetDynLoadFunc(const char *shortname,
{
{
HINSTANCE
hDLL
=
NULL
;
HINSTANCE
hDLL
=
NULL
;
char
pathbuf
[
260
];
wchar_t
pathbuf
[
260
];
LPTSTR
dummy
;
unsigned
int
old_mode
;
unsigned
int
old_mode
;
ULONG_PTR
cookie
=
0
;
ULONG_PTR
cookie
=
0
;
/* We use LoadLibraryEx so Windows looks for dependent DLLs
/* We use LoadLibraryEx so Windows looks for dependent DLLs
...
@@ -198,14 +197,14 @@ dl_funcptr _PyImport_GetDynLoadFunc(const char *shortname,
...
@@ -198,14 +197,14 @@ dl_funcptr _PyImport_GetDynLoadFunc(const char *shortname,
/* Don't display a message box when Python can't load a DLL */
/* Don't display a message box when Python can't load a DLL */
old_mode
=
SetErrorMode
(
SEM_FAILCRITICALERRORS
);
old_mode
=
SetErrorMode
(
SEM_FAILCRITICALERRORS
);
if
(
GetFullPathName
(
pathname
,
if
(
GetFullPathName
W
(
PyUnicode_AS_UNICODE
(
pathname
)
,
sizeof
(
pathbuf
),
sizeof
(
pathbuf
)
/
sizeof
(
pathbuf
[
0
]
),
pathbuf
,
pathbuf
,
&
dummy
))
{
NULL
))
{
ULONG_PTR
cookie
=
_Py_ActivateActCtx
();
ULONG_PTR
cookie
=
_Py_ActivateActCtx
();
/* XXX This call doesn't exist in Windows CE */
/* XXX This call doesn't exist in Windows CE */
hDLL
=
LoadLibraryEx
(
pathname
,
NULL
,
hDLL
=
LoadLibraryEx
W
(
PyUnicode_AS_UNICODE
(
pathname
)
,
NULL
,
LOAD_WITH_ALTERED_SEARCH_PATH
);
LOAD_WITH_ALTERED_SEARCH_PATH
);
_Py_DeactivateActCtx
(
cookie
);
_Py_DeactivateActCtx
(
cookie
);
}
}
...
@@ -264,21 +263,21 @@ dl_funcptr _PyImport_GetDynLoadFunc(const char *shortname,
...
@@ -264,21 +263,21 @@ dl_funcptr _PyImport_GetDynLoadFunc(const char *shortname,
}
else
{
}
else
{
char
buffer
[
256
];
char
buffer
[
256
];
PyOS_snprintf
(
buffer
,
sizeof
(
buffer
),
#ifdef _DEBUG
#ifdef _DEBUG
PyOS_snprintf
(
buffer
,
sizeof
(
buffer
),
"python%d%d_d.dll"
,
"python%d%d_d.dll"
,
#else
#else
PyOS_snprintf
(
buffer
,
sizeof
(
buffer
),
"python%d%d.dll"
,
"python%d%d.dll"
,
#endif
#endif
PY_MAJOR_VERSION
,
PY_MINOR_VERSION
);
PY_MAJOR_VERSION
,
PY_MINOR_VERSION
);
import_python
=
GetPythonImport
(
hDLL
);
import_python
=
GetPythonImport
(
hDLL
);
if
(
import_python
&&
if
(
import_python
&&
strcasecmp
(
buffer
,
import_python
))
{
strcasecmp
(
buffer
,
import_python
))
{
PyOS_snprintf
(
buffer
,
sizeof
(
buffer
),
PyErr_Format
(
PyExc_ImportError
,
"Module use of %.150s conflicts "
"Module use of %.150s conflicts "
"with this version of Python."
,
"with this version of Python."
,
import_python
);
import_python
);
PyErr_SetString
(
PyExc_ImportError
,
buffer
);
FreeLibrary
(
hDLL
);
FreeLibrary
(
hDLL
);
return
NULL
;
return
NULL
;
}
}
...
...
Python/importdl.c
Dosyayı görüntüle @
2d322274
...
@@ -12,8 +12,13 @@
...
@@ -12,8 +12,13 @@
#include "importdl.h"
#include "importdl.h"
#ifdef MS_WINDOWS
extern
dl_funcptr
_PyImport_GetDynLoadWindows
(
const
char
*
shortname
,
PyObject
*
pathname
,
FILE
*
fp
);
#else
extern
dl_funcptr
_PyImport_GetDynLoadFunc
(
const
char
*
shortname
,
extern
dl_funcptr
_PyImport_GetDynLoadFunc
(
const
char
*
shortname
,
const
char
*
pathname
,
FILE
*
fp
);
const
char
*
pathname
,
FILE
*
fp
);
#endif
/* name should be ASCII only because the C language doesn't accept non-ASCII
/* name should be ASCII only because the C language doesn't accept non-ASCII
identifiers, and dynamic modules are written in C. */
identifiers, and dynamic modules are written in C. */
...
@@ -22,7 +27,9 @@ PyObject *
...
@@ -22,7 +27,9 @@ PyObject *
_PyImport_LoadDynamicModule
(
PyObject
*
name
,
PyObject
*
path
,
FILE
*
fp
)
_PyImport_LoadDynamicModule
(
PyObject
*
name
,
PyObject
*
path
,
FILE
*
fp
)
{
{
PyObject
*
m
;
PyObject
*
m
;
#ifndef MS_WINDOWS
PyObject
*
pathbytes
;
PyObject
*
pathbytes
;
#endif
char
*
namestr
,
*
lastdot
,
*
shortname
,
*
packagecontext
,
*
oldcontext
;
char
*
namestr
,
*
lastdot
,
*
shortname
,
*
packagecontext
,
*
oldcontext
;
dl_funcptr
p0
;
dl_funcptr
p0
;
PyObject
*
(
*
p
)(
void
);
PyObject
*
(
*
p
)(
void
);
...
@@ -48,12 +55,16 @@ _PyImport_LoadDynamicModule(PyObject *name, PyObject *path, FILE *fp)
...
@@ -48,12 +55,16 @@ _PyImport_LoadDynamicModule(PyObject *name, PyObject *path, FILE *fp)
shortname
=
lastdot
+
1
;
shortname
=
lastdot
+
1
;
}
}
#ifdef MS_WINDOWS
p0
=
_PyImport_GetDynLoadWindows
(
shortname
,
path
,
fp
);
#else
pathbytes
=
PyUnicode_EncodeFSDefault
(
path
);
pathbytes
=
PyUnicode_EncodeFSDefault
(
path
);
if
(
pathbytes
==
NULL
)
if
(
pathbytes
==
NULL
)
return
NULL
;
return
NULL
;
p0
=
_PyImport_GetDynLoadFunc
(
shortname
,
p0
=
_PyImport_GetDynLoadFunc
(
shortname
,
PyBytes_AS_STRING
(
pathbytes
),
fp
);
PyBytes_AS_STRING
(
pathbytes
),
fp
);
Py_DECREF
(
pathbytes
);
Py_DECREF
(
pathbytes
);
#endif
p
=
(
PyObject
*
(
*
)(
void
))
p0
;
p
=
(
PyObject
*
(
*
)(
void
))
p0
;
if
(
PyErr_Occurred
())
if
(
PyErr_Occurred
())
return
NULL
;
return
NULL
;
...
...
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