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
4a342094
Kaydet (Commit)
4a342094
authored
Ara 19, 1996
tarafından
Barry Warsaw
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
1. Export open(2) flag constants for every defined constant
2. Reworked error checking in initposix() and initnt().
üst
e8e9ed17
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
88 additions
and
16 deletions
+88
-16
posixmodule.c
Modules/posixmodule.c
+88
-16
No files found.
Modules/posixmodule.c
Dosyayı görüntüle @
4a342094
...
...
@@ -1757,6 +1757,72 @@ static PyMethodDef posix_methods[] = {
};
static
int
ins
(
d
,
symbol
,
value
)
PyObject
*
d
;
char
*
symbol
;
long
value
;
{
PyObject
*
v
=
PyInt_FromLong
(
value
);
if
(
!
v
||
PyDict_SetItemString
(
d
,
symbol
,
v
)
<
0
)
return
-
1
;
/* triggers fatal error */
Py_DECREF
(
v
);
return
0
;
}
static
int
all_ins
(
d
)
PyObject
*
d
;
{
#ifdef WNOHANG
if
(
ins
(
d
,
"WNOHANG"
,
(
long
)
WNOHANG
))
return
-
1
;
#endif
#ifdef O_RDONLY
if
(
ins
(
d
,
"O_RDONLY"
,
(
long
)
O_RDONLY
))
return
-
1
;
#endif
#ifdef O_WRONLY
if
(
ins
(
d
,
"O_WRONLY"
,
(
long
)
O_WRONLY
))
return
-
1
;
#endif
#ifdef O_RDWR
if
(
ins
(
d
,
"O_RDWR"
,
(
long
)
O_RDWR
))
return
-
1
;
#endif
#ifdef O_NDELAY
if
(
ins
(
d
,
"O_NDELAY"
,
(
long
)
O_NDELAY
))
return
-
1
;
#endif
#ifdef O_NONBLOCK
if
(
ins
(
d
,
"O_NONBLOCK"
,
(
long
)
O_NONBLOCK
))
return
-
1
;
#endif
#ifdef O_APPEND
if
(
ins
(
d
,
"O_APPEND"
,
(
long
)
O_APPEND
))
return
-
1
;
#endif
#ifdef O_DSYNC
if
(
ins
(
d
,
"O_DSYNC"
,
(
long
)
O_DSYNC
))
return
-
1
;
#endif
#ifdef O_RSYNC
if
(
ins
(
d
,
"O_RSYNC"
,
(
long
)
O_RSYNC
))
return
-
1
;
#endif
#ifdef O_SYNC
if
(
ins
(
d
,
"O_SYNC"
,
(
long
)
O_SYNC
))
return
-
1
;
#endif
#ifdef O_NOCTTY
if
(
ins
(
d
,
"O_NOCTTY"
,
(
long
)
O_NOCTTY
))
return
-
1
;
#endif
#ifdef O_CREAT
if
(
ins
(
d
,
"O_CREAT"
,
(
long
)
O_CREAT
))
return
-
1
;
#endif
#ifdef O_EXCL
if
(
ins
(
d
,
"O_EXCL"
,
(
long
)
O_EXCL
))
return
-
1
;
#endif
#ifdef O_TRUNC
if
(
ins
(
d
,
"O_TRUNC"
,
(
long
)
O_TRUNC
))
return
-
1
;
#endif
return
0
;
}
#if defined(_MSC_VER) || defined(__WATCOMC__)
void
initnt
()
...
...
@@ -1769,14 +1835,21 @@ initnt()
/* Initialize nt.environ dictionary */
v
=
convertenviron
();
if
(
v
==
NULL
||
PyDict_SetItemString
(
d
,
"environ"
,
v
)
!=
0
)
Py_FatalError
(
"can't define nt.environ"
)
;
goto
finally
;
Py_DECREF
(
v
);
if
(
all_ins
(
d
))
goto
finally
;
/* Initialize nt.error exception */
PosixError
=
PyString_FromString
(
"nt.error"
);
if
(
PosixError
==
NULL
||
PyDict_SetItemString
(
d
,
"error"
,
PosixError
)
!=
0
)
Py_FatalError
(
"can't define nt.error"
);
PyDict_SetItemString
(
d
,
"error"
,
PosixError
);
if
(
!
PyErr_Occurred
())
return
;
finally
:
Py_FatalError
(
"can't initialize NT posixmodule"
);
}
#else
/* not a PC port */
void
...
...
@@ -1790,21 +1863,20 @@ initposix()
/* Initialize posix.environ dictionary */
v
=
convertenviron
();
if
(
v
==
NULL
||
PyDict_SetItemString
(
d
,
"environ"
,
v
)
!=
0
)
Py_FatalError
(
"can't define posix.environ"
);
Py_DECREF
(
v
);
#ifdef WNOHANG
/* Export WNOHANG symbol */
v
=
PyInt_FromLong
((
long
)
WNOHANG
);
if
(
v
==
NULL
||
PyDict_SetItemString
(
d
,
"WNOHANG"
,
v
)
!=
0
)
Py_FatalError
(
"can't define posix.WNOHANG"
);
goto
finally
;
Py_DECREF
(
v
);
#endif
if
(
all_ins
(
d
))
goto
finally
;
/* Initialize posix.error exception */
PosixError
=
PyString_FromString
(
"posix.error"
);
if
(
PosixError
==
NULL
||
PyDict_SetItemString
(
d
,
"error"
,
PosixError
)
!=
0
)
Py_FatalError
(
"can't define posix.error"
);
PyDict_SetItemString
(
d
,
"error"
,
PosixError
);
if
(
!
PyErr_Occurred
())
return
;
finally
:
Py_FatalError
(
"can't initialize posix module"
);
}
#endif
/* !_MSC_VER */
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