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
e0e69628
Kaydet (Commit)
e0e69628
authored
Ock 22, 1997
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Added PyCObject_Import.
üst
43d287ad
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
18 deletions
+44
-18
cobject.h
Include/cobject.h
+4
-0
cobject.c
Objects/cobject.c
+39
-18
python_nt.def
PC/python_nt.def
+1
-0
No files found.
Include/cobject.h
Dosyayı görüntüle @
e0e69628
...
...
@@ -62,6 +62,10 @@ PyCObject_FromVoidPtr Py_PROTO((void *cobj, void (*destruct)(void*)));
extern
void
*
PyCObject_AsVoidPtr
Py_PROTO
((
PyObject
*
));
/* Import a pointer to a C object from a module using a PyCObject. */
extern
void
*
PyCObject_Import
Py_PROTO
((
char
*
module_name
,
char
*
cobject_name
));
#ifdef __cplusplus
}
#endif
...
...
Objects/cobject.c
Dosyayı görüntüle @
e0e69628
...
...
@@ -57,6 +57,44 @@ PyCObject_FromVoidPtr(cobj, destr)
return
(
PyObject
*
)
self
;
}
void
*
PyCObject_AsVoidPtr
(
self
)
PyObject
*
self
;
{
if
(
self
)
{
if
(
self
->
ob_type
==
&
PyCObject_Type
)
return
((
PyCObject
*
)
self
)
->
cobject
;
PyErr_SetString
(
PyExc_TypeError
,
"PyCObject_AsVoidPtr with non-C-object"
);
}
if
(
!
PyErr_Occurred
())
PyErr_SetString
(
PyExc_TypeError
,
"PyCObject_AsVoidPtr called with null pointer"
);
return
NULL
;
}
void
*
PyCObject_Import
(
module_name
,
name
)
char
*
module_name
;
char
*
name
;
{
PyObject
*
m
,
*
c
;
void
*
r
=
NULL
;
if
(
m
=
PyImport_ImportModule
(
module_name
))
{
if
(
c
=
PyObject_GetAttrString
(
m
,
name
))
{
r
=
PyCObject_AsVoidPtr
(
c
);
Py_DECREF
(
c
);
}
Py_DECREF
(
m
);
}
return
r
;
}
static
void
PyCObject_dealloc
(
self
)
PyCObject
*
self
;
...
...
@@ -65,6 +103,7 @@ PyCObject_dealloc(self)
PyMem_DEL
(
self
);
}
static
char
PyCObject_Type__doc__
[]
=
"C objects to be exported from one extension module to another
\n
\
\n
\
...
...
@@ -98,21 +137,3 @@ PyTypeObject PyCObject_Type = {
0L
,
0L
,
0L
,
0L
,
PyCObject_Type__doc__
/* Documentation string */
};
void
*
PyCObject_AsVoidPtr
(
self
)
PyObject
*
self
;
{
if
(
self
)
{
if
(
self
->
ob_type
==
&
PyCObject_Type
)
return
((
PyCObject
*
)
self
)
->
cobject
;
PyErr_SetString
(
PyExc_TypeError
,
"PyCObject_AsVoidPtr with non-C-object"
);
}
if
(
!
PyErr_Occurred
())
PyErr_SetString
(
PyExc_TypeError
,
"PyCObject_AsVoidPtr called with null pointer"
);
return
NULL
;
}
PC/python_nt.def
Dosyayı görüntüle @
e0e69628
...
...
@@ -351,4 +351,5 @@ EXPORTS
_Py_c_diff
PyCObject_FromVoidPtr
PyCObject_AsVoidPtr
PyCObject_Import
Py_GetBuildInfo
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