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
864cc670
Kaydet (Commit)
864cc670
authored
Agu 08, 2010
tarafından
Thomas Heller
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fix issue5504: ctypes does now work with systems where mmap can't be
PROT_WRITE and PROT_EXEC.
üst
93d768d6
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
35 additions
and
20 deletions
+35
-20
NEWS
Misc/NEWS
+3
-0
_ctypes.c
Modules/_ctypes/_ctypes.c
+1
-1
callbacks.c
Modules/_ctypes/callbacks.c
+10
-6
ctypes.h
Modules/_ctypes/ctypes.h
+2
-1
fficonfig.py.in
Modules/_ctypes/libffi/fficonfig.py.in
+2
-0
ffi.c
Modules/_ctypes/libffi_msvc/ffi.c
+5
-5
ffi.h
Modules/_ctypes/libffi_msvc/ffi.h
+6
-2
malloc_closure.c
Modules/_ctypes/malloc_closure.c
+5
-3
setup.py
setup.py
+1
-2
No files found.
Misc/NEWS
Dosyayı görüntüle @
864cc670
...
@@ -24,6 +24,9 @@ Core and Builtins
...
@@ -24,6 +24,9 @@ Core and Builtins
Extensions
Extensions
----------
----------
- Issue #5504 - ctypes should now work with systems where mmap can't
be PROT_WRITE and PROT_EXEC.
- Issue #9507: Named tuple repr will now automatically display the right
- Issue #9507: Named tuple repr will now automatically display the right
name in a tuple subclass.
name in a tuple subclass.
...
...
Modules/_ctypes/_ctypes.c
Dosyayı görüntüle @
864cc670
...
@@ -3353,7 +3353,7 @@ PyCFuncPtr_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
...
@@ -3353,7 +3353,7 @@ PyCFuncPtr_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
self
->
callable
=
callable
;
self
->
callable
=
callable
;
self
->
thunk
=
thunk
;
self
->
thunk
=
thunk
;
*
(
void
**
)
self
->
b_ptr
=
(
void
*
)
thunk
->
pcl
;
*
(
void
**
)
self
->
b_ptr
=
(
void
*
)
thunk
->
pcl
_exec
;
Py_INCREF
((
PyObject
*
)
thunk
);
/* for KeepRef */
Py_INCREF
((
PyObject
*
)
thunk
);
/* for KeepRef */
if
(
-
1
==
KeepRef
((
CDataObject
*
)
self
,
0
,
(
PyObject
*
)
thunk
))
{
if
(
-
1
==
KeepRef
((
CDataObject
*
)
self
,
0
,
(
PyObject
*
)
thunk
))
{
...
...
Modules/_ctypes/callbacks.c
Dosyayı görüntüle @
864cc670
...
@@ -16,8 +16,8 @@ CThunkObject_dealloc(PyObject *_self)
...
@@ -16,8 +16,8 @@ CThunkObject_dealloc(PyObject *_self)
Py_XDECREF
(
self
->
converters
);
Py_XDECREF
(
self
->
converters
);
Py_XDECREF
(
self
->
callable
);
Py_XDECREF
(
self
->
callable
);
Py_XDECREF
(
self
->
restype
);
Py_XDECREF
(
self
->
restype
);
if
(
self
->
pcl
)
if
(
self
->
pcl
_write
)
_ctypes_free_closure
(
self
->
pcl
);
ffi_closure_free
(
self
->
pcl_write
);
PyObject_GC_Del
(
self
);
PyObject_GC_Del
(
self
);
}
}
...
@@ -338,7 +338,8 @@ static CThunkObject* CThunkObject_new(Py_ssize_t nArgs)
...
@@ -338,7 +338,8 @@ static CThunkObject* CThunkObject_new(Py_ssize_t nArgs)
return
NULL
;
return
NULL
;
}
}
p
->
pcl
=
NULL
;
p
->
pcl_exec
=
NULL
;
p
->
pcl_write
=
NULL
;
memset
(
&
p
->
cif
,
0
,
sizeof
(
p
->
cif
));
memset
(
&
p
->
cif
,
0
,
sizeof
(
p
->
cif
));
p
->
converters
=
NULL
;
p
->
converters
=
NULL
;
p
->
callable
=
NULL
;
p
->
callable
=
NULL
;
...
@@ -368,8 +369,9 @@ CThunkObject *_ctypes_alloc_callback(PyObject *callable,
...
@@ -368,8 +369,9 @@ CThunkObject *_ctypes_alloc_callback(PyObject *callable,
assert
(
CThunk_CheckExact
((
PyObject
*
)
p
));
assert
(
CThunk_CheckExact
((
PyObject
*
)
p
));
p
->
pcl
=
_ctypes_alloc_closure
();
p
->
pcl_write
=
ffi_closure_alloc
(
sizeof
(
ffi_closure
),
if
(
p
->
pcl
==
NULL
)
{
&
p
->
pcl_exec
);
if
(
p
->
pcl_write
==
NULL
)
{
PyErr_NoMemory
();
PyErr_NoMemory
();
goto
error
;
goto
error
;
}
}
...
@@ -414,7 +416,9 @@ CThunkObject *_ctypes_alloc_callback(PyObject *callable,
...
@@ -414,7 +416,9 @@ CThunkObject *_ctypes_alloc_callback(PyObject *callable,
"ffi_prep_cif failed with %d"
,
result
);
"ffi_prep_cif failed with %d"
,
result
);
goto
error
;
goto
error
;
}
}
result
=
ffi_prep_closure
(
p
->
pcl
,
&
p
->
cif
,
closure_fcn
,
p
);
result
=
ffi_prep_closure_loc
(
p
->
pcl_write
,
&
p
->
cif
,
closure_fcn
,
p
,
p
->
pcl_exec
);
if
(
result
!=
FFI_OK
)
{
if
(
result
!=
FFI_OK
)
{
PyErr_Format
(
PyExc_RuntimeError
,
PyErr_Format
(
PyExc_RuntimeError
,
"ffi_prep_closure failed with %d"
,
result
);
"ffi_prep_closure failed with %d"
,
result
);
...
...
Modules/_ctypes/ctypes.h
Dosyayı görüntüle @
864cc670
...
@@ -58,7 +58,8 @@ struct tagCDataObject {
...
@@ -58,7 +58,8 @@ struct tagCDataObject {
typedef
struct
{
typedef
struct
{
PyObject_VAR_HEAD
PyObject_VAR_HEAD
ffi_closure
*
pcl
;
/* the C callable */
ffi_closure
*
pcl_write
;
/* the C callable, writeable */
void
*
pcl_exec
;
/* the C callable, executable */
ffi_cif
cif
;
ffi_cif
cif
;
int
flags
;
int
flags
;
PyObject
*
converters
;
PyObject
*
converters
;
...
...
Modules/_ctypes/libffi/fficonfig.py.in
Dosyayı görüntüle @
864cc670
ffi_sources = """
ffi_sources = """
src/prep_cif.c
src/prep_cif.c
src/closures.c
src/dlmalloc.c
""".split()
""".split()
ffi_platforms = {
ffi_platforms = {
...
...
Modules/_ctypes/libffi_msvc/ffi.c
Dosyayı görüntüle @
864cc670
...
@@ -371,10 +371,11 @@ ffi_prep_incoming_args_SYSV(char *stack, void **rvalue,
...
@@ -371,10 +371,11 @@ ffi_prep_incoming_args_SYSV(char *stack, void **rvalue,
extern
void
ffi_closure_OUTER
();
extern
void
ffi_closure_OUTER
();
ffi_status
ffi_status
ffi_prep_closure
(
ffi_closure
*
closure
,
ffi_prep_closure_loc
(
ffi_closure
*
closure
,
ffi_cif
*
cif
,
ffi_cif
*
cif
,
void
(
*
fun
)(
ffi_cif
*
,
void
*
,
void
**
,
void
*
),
void
(
*
fun
)(
ffi_cif
*
,
void
*
,
void
**
,
void
*
),
void
*
user_data
)
void
*
user_data
,
void
*
codeloc
)
{
{
short
bytes
;
short
bytes
;
char
*
tramp
;
char
*
tramp
;
...
@@ -452,6 +453,5 @@ ffi_prep_closure (ffi_closure* closure,
...
@@ -452,6 +453,5 @@ ffi_prep_closure (ffi_closure* closure,
closure
->
cif
=
cif
;
closure
->
cif
=
cif
;
closure
->
user_data
=
user_data
;
closure
->
user_data
=
user_data
;
closure
->
fun
=
fun
;
closure
->
fun
=
fun
;
return
FFI_OK
;
return
FFI_OK
;
}
}
Modules/_ctypes/libffi_msvc/ffi.h
Dosyayı görüntüle @
864cc670
...
@@ -221,11 +221,15 @@ typedef struct {
...
@@ -221,11 +221,15 @@ typedef struct {
void
*
user_data
;
void
*
user_data
;
}
ffi_closure
;
}
ffi_closure
;
void
ffi_closure_free
(
void
*
);
void
*
ffi_closure_alloc
(
size_t
size
,
void
**
code
);
ffi_status
ffi_status
ffi_prep_closure
(
ffi_closure
*
,
ffi_prep_closure
_loc
(
ffi_closure
*
,
ffi_cif
*
,
ffi_cif
*
,
void
(
*
fun
)(
ffi_cif
*
,
void
*
,
void
**
,
void
*
),
void
(
*
fun
)(
ffi_cif
*
,
void
*
,
void
**
,
void
*
),
void
*
user_data
);
void
*
user_data
,
void
*
codeloc
);
typedef
struct
{
typedef
struct
{
char
tramp
[
FFI_TRAMPOLINE_SIZE
];
char
tramp
[
FFI_TRAMPOLINE_SIZE
];
...
...
Modules/_ctypes/malloc_closure.c
Dosyayı görüntüle @
864cc670
...
@@ -89,7 +89,7 @@ static void more_core(void)
...
@@ -89,7 +89,7 @@ static void more_core(void)
/******************************************************************/
/******************************************************************/
/* put the item back into the free list */
/* put the item back into the free list */
void
_ctypes_free_closur
e
(
void
*
p
)
void
ffi_closure_fre
e
(
void
*
p
)
{
{
ITEM
*
item
=
(
ITEM
*
)
p
;
ITEM
*
item
=
(
ITEM
*
)
p
;
item
->
next
=
free_list
;
item
->
next
=
free_list
;
...
@@ -97,7 +97,7 @@ void _ctypes_free_closure(void *p)
...
@@ -97,7 +97,7 @@ void _ctypes_free_closure(void *p)
}
}
/* return one item from the free list, allocating more if needed */
/* return one item from the free list, allocating more if needed */
void
*
_ctypes_alloc_closure
(
void
)
void
*
ffi_closure_alloc
(
size_t
ignored
,
void
**
codeloc
)
{
{
ITEM
*
item
;
ITEM
*
item
;
if
(
!
free_list
)
if
(
!
free_list
)
...
@@ -106,5 +106,7 @@ void *_ctypes_alloc_closure(void)
...
@@ -106,5 +106,7 @@ void *_ctypes_alloc_closure(void)
return
NULL
;
return
NULL
;
item
=
free_list
;
item
=
free_list
;
free_list
=
item
->
next
;
free_list
=
item
->
next
;
return
item
;
*
codeloc
=
(
void
*
)
item
;
return
(
void
*
)
item
;
}
}
setup.py
Dosyayı görüntüle @
864cc670
...
@@ -1639,8 +1639,7 @@ class PyBuildExt(build_ext):
...
@@ -1639,8 +1639,7 @@ class PyBuildExt(build_ext):
'_ctypes/callbacks.c'
,
'_ctypes/callbacks.c'
,
'_ctypes/callproc.c'
,
'_ctypes/callproc.c'
,
'_ctypes/stgdict.c'
,
'_ctypes/stgdict.c'
,
'_ctypes/cfield.c'
,
'_ctypes/cfield.c'
]
'_ctypes/malloc_closure.c'
]
depends
=
[
'_ctypes/ctypes.h'
]
depends
=
[
'_ctypes/ctypes.h'
]
if
sys
.
platform
==
'darwin'
:
if
sys
.
platform
==
'darwin'
:
...
...
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