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
ee48519b
Kaydet (Commit)
ee48519b
authored
Nis 12, 2002
tarafından
Fred Drake
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Modernize the minimal example of an extension type.
üst
28de8d4b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
7 deletions
+15
-7
noddy.c
Doc/ext/noddy.c
+15
-7
No files found.
Doc/ext/noddy.c
Dosyayı görüntüle @
ee48519b
...
...
@@ -4,6 +4,7 @@ staticforward PyTypeObject noddy_NoddyType;
typedef
struct
{
PyObject_HEAD
/* Type-specific fields go here. */
}
noddy_NoddyObject
;
static
PyObject
*
...
...
@@ -11,21 +12,24 @@ noddy_new_noddy(PyObject* self, PyObject* args)
{
noddy_NoddyObject
*
noddy
;
if
(
!
PyArg_ParseTuple
(
args
,
":new_noddy"
))
return
NULL
;
noddy
=
PyObject_New
(
noddy_NoddyObject
,
&
noddy_NoddyType
);
/* Initialize type-specific fields here. */
return
(
PyObject
*
)
noddy
;
}
static
void
noddy_noddy_dealloc
(
PyObject
*
self
)
{
/* Free any external resources here;
* if the instance owns references to any Python
* objects, call Py_DECREF() on them here.
*/
PyObject_Del
(
self
);
}
static
PyTypeObject
noddy_NoddyType
=
{
static
here
PyTypeObject
noddy_NoddyType
=
{
PyObject_HEAD_INIT
(
NULL
)
0
,
"Noddy"
,
...
...
@@ -44,15 +48,19 @@ static PyTypeObject noddy_NoddyType = {
};
static
PyMethodDef
noddy_methods
[]
=
{
{
"new_noddy"
,
noddy_new_noddy
,
METH_
VAR
ARGS
,
{
"new_noddy"
,
noddy_new_noddy
,
METH_
NO
ARGS
,
"Create a new Noddy object."
},
{
NULL
,
NULL
,
0
,
NULL
}
{
NULL
}
/* Sentinel */
};
DL_EXPORT
(
void
)
initnoddy
(
void
)
{
noddy_NoddyType
.
ob_type
=
&
PyType_Type
;
if
(
PyType_Ready
(
&
noddy_NoddyType
))
return
;
Py_InitModule
(
"noddy"
,
noddy_methods
);
Py_InitModule3
(
"noddy"
,
noddy_methods
"Example module that creates an extension type."
);
}
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