Pewarta Proxy

📋 Server Request & Proxy Logs

Loading active proxy settings...
Developed by Khairul Adha (adhexa.id)
Mengambil log server...

⚙️ Pengaturan Proxy Target

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
bpo-1635741: Port _stat module to multiphase initialization
  • Loading branch information
corona10 committed Apr 29, 2020
commit 0d534df115a126286c00ada64f26989814197fb5
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Port _stat module to multiphase initialization (:pep:`489`).
348 changes: 248 additions & 100 deletions Modules/_stat.c
Original file line number Diff line number Diff line change
Expand Up @@ -492,113 +492,261 @@ ST_CTIME\n\
");


static int
stat_exec(PyObject *module)
{
if (PyModule_AddIntMacro(module, S_IFDIR) < 0) {
return -1;
}
Comment thread
corona10 marked this conversation as resolved.
Resolved
if (PyModule_AddIntMacro(module, S_IFCHR) < 0) {
return -1;
}
if (PyModule_AddIntMacro(module, S_IFBLK) < 0) {
return -1;
}
if (PyModule_AddIntMacro(module, S_IFREG) < 0) {
return -1;
}
if (PyModule_AddIntMacro(module, S_IFIFO) < 0) {
return -1;
}
if (PyModule_AddIntMacro(module, S_IFLNK) < 0) {
return -1;
}
if (PyModule_AddIntMacro(module, S_IFSOCK) < 0) {
return -1;
}
if (PyModule_AddIntMacro(module, S_IFDOOR) < 0) {
return -1;
}
if (PyModule_AddIntMacro(module, S_IFPORT) < 0) {
return -1;
}
if (PyModule_AddIntMacro(module, S_IFWHT) < 0) {
return -1;
}

if (PyModule_AddIntMacro(module, S_ISUID) < 0) {
return -1;
}
if (PyModule_AddIntMacro(module, S_ISGID) < 0) {
return -1;
}
if (PyModule_AddIntMacro(module, S_ISVTX) < 0) {
return -1;
}
if (PyModule_AddIntMacro(module, S_ENFMT) < 0) {
return -1;
}

if (PyModule_AddIntMacro(module, S_IREAD) < 0) {
return -1;
}
if (PyModule_AddIntMacro(module, S_IWRITE) < 0) {
return -1;
}
if (PyModule_AddIntMacro(module, S_IEXEC) < 0) {
return -1;
}

if (PyModule_AddIntMacro(module, S_IRWXU) < 0) {
return -1;
}
if (PyModule_AddIntMacro(module, S_IRUSR) < 0) {
return -1;
}
if (PyModule_AddIntMacro(module, S_IWUSR) < 0) {
return -1;
}
if (PyModule_AddIntMacro(module, S_IXUSR) < 0) {
return -1;
}

if (PyModule_AddIntMacro(module, S_IRWXG) < 0) {
return -1;
}
if (PyModule_AddIntMacro(module, S_IRGRP) < 0) {
return -1;
}
if (PyModule_AddIntMacro(module, S_IWGRP) < 0) {
return -1;
}
if (PyModule_AddIntMacro(module, S_IXGRP) < 0) {
return -1;
}

if (PyModule_AddIntMacro(module, S_IRWXO) < 0) {
return -1;
}
if (PyModule_AddIntMacro(module, S_IROTH) < 0) {
return -1;
}
if (PyModule_AddIntMacro(module, S_IWOTH) < 0) {
return -1;
}
if (PyModule_AddIntMacro(module, S_IXOTH) < 0) {
return -1;
}

if (PyModule_AddIntMacro(module, UF_NODUMP) < 0) {
return -1;
}
if (PyModule_AddIntMacro(module, UF_IMMUTABLE) < 0) {
return -1;
}
if (PyModule_AddIntMacro(module, UF_APPEND) < 0) {
return -1;
}
if (PyModule_AddIntMacro(module, UF_OPAQUE) < 0) {
return -1;
}
if (PyModule_AddIntMacro(module, UF_NOUNLINK) < 0) {
return -1;
}
if (PyModule_AddIntMacro(module, UF_COMPRESSED) < 0) {
return -1;
}
if (PyModule_AddIntMacro(module, UF_HIDDEN) < 0) {
return -1;
}
if (PyModule_AddIntMacro(module, SF_ARCHIVED) < 0) {
return -1;
}
if (PyModule_AddIntMacro(module, SF_IMMUTABLE) < 0) {
return -1;
}
if (PyModule_AddIntMacro(module, SF_APPEND) < 0) {
return -1;
}
if (PyModule_AddIntMacro(module, SF_NOUNLINK) < 0) {
return -1;
}
if (PyModule_AddIntMacro(module, SF_SNAPSHOT) < 0) {
return -1;
}

if (PyModule_AddIntConstant(module, "ST_MODE", 0) < 0) {
return -1;
}
if (PyModule_AddIntConstant(module, "ST_INO", 1) < 0) {
return -1;
}
if (PyModule_AddIntConstant(module, "ST_DEV", 2) < 0) {
return -1;
}
if (PyModule_AddIntConstant(module, "ST_NLINK", 3) < 0) {
return -1;
}
if (PyModule_AddIntConstant(module, "ST_UID", 4) < 0) {
return -1;
}
if (PyModule_AddIntConstant(module, "ST_GID", 5) < 0) {
return -1;
}
if (PyModule_AddIntConstant(module, "ST_SIZE", 6) < 0) {
return -1;
}
if (PyModule_AddIntConstant(module, "ST_ATIME", 7) < 0) {
return -1;
}
if (PyModule_AddIntConstant(module, "ST_MTIME", 8) < 0) {
return -1;
}
if (PyModule_AddIntConstant(module, "ST_CTIME", 9) < 0) {
return -1;
}
Comment thread
corona10 marked this conversation as resolved.
Resolved

#ifdef MS_WINDOWS
if (PyModule_AddIntMacro(module, FILE_ATTRIBUTE_ARCHIVE) < 0) {
return -1;
}
if (PyModule_AddIntMacro(module, FILE_ATTRIBUTE_COMPRESSED) < 0) {
return -1;
}
if (PyModule_AddIntMacro(module, FILE_ATTRIBUTE_DEVICE) < 0) {
return -1;
}
if (PyModule_AddIntMacro(module, FILE_ATTRIBUTE_DIRECTORY) < 0) {
return -1;
}
if (PyModule_AddIntMacro(module, FILE_ATTRIBUTE_ENCRYPTED) < 0) {
return -1;
}
if (PyModule_AddIntMacro(module, FILE_ATTRIBUTE_HIDDEN) < 0) {
return -1;
}
if (PyModule_AddIntMacro(module, FILE_ATTRIBUTE_INTEGRITY_STREAM) < 0) {
return -1;
}
if (PyModule_AddIntMacro(module, FILE_ATTRIBUTE_NORMAL) < 0) {
return -1;
}
if (PyModule_AddIntMacro(module, FILE_ATTRIBUTE_NOT_CONTENT_INDEXED) < 0) {
return -1;
}
if (PyModule_AddIntMacro(module, FILE_ATTRIBUTE_NO_SCRUB_DATA) < 0) {
return -1;
}
if (PyModule_AddIntMacro(module, FILE_ATTRIBUTE_OFFLINE) < 0) {
return -1;
}
if (PyModule_AddIntMacro(module, FILE_ATTRIBUTE_READONLY) < 0) {
return -1;
}
if (PyModule_AddIntMacro(module, FILE_ATTRIBUTE_REPARSE_POINT) < 0) {
return -1;
}
if (PyModule_AddIntMacro(module, FILE_ATTRIBUTE_SPARSE_FILE) < 0) {
return -1;
}
if (PyModule_AddIntMacro(module, FILE_ATTRIBUTE_SYSTEM) < 0) {
return -1;
}
if (PyModule_AddIntMacro(module, FILE_ATTRIBUTE_TEMPORARY) < 0) {
return -1;
}
if (PyModule_AddIntMacro(module, FILE_ATTRIBUTE_VIRTUAL) < 0) {
return -1;
}

if (PyModule_AddObject(module, "IO_REPARSE_TAG_SYMLINK",
PyLong_FromUnsignedLong(IO_REPARSE_TAG_SYMLINK)) < 0) {
Comment thread
corona10 marked this conversation as resolved.
Resolved
return -1;
}
if (PyModule_AddObject(module, "IO_REPARSE_TAG_MOUNT_POINT",
PyLong_FromUnsignedLong(IO_REPARSE_TAG_MOUNT_POINT)) < 0) {
return -1;
}
if (PyModule_AddObject(module, "IO_REPARSE_TAG_APPEXECLINK",
PyLong_FromUnsignedLong(IO_REPARSE_TAG_APPEXECLINK)) < 0) {
return -1;
}
#endif

return 0;
}


static PyModuleDef_Slot stat_slots[] = {
{Py_mod_exec, stat_exec},
{0, NULL}
};


static struct PyModuleDef statmodule = {
PyModuleDef_HEAD_INIT,
"_stat",
module_doc,
-1,
stat_methods,
NULL,
NULL,
NULL,
NULL
.m_name = "_stat",
.m_doc = module_doc,
.m_size = 0,
.m_methods = stat_methods,
.m_slots = stat_slots,
};


PyMODINIT_FUNC
PyInit__stat(void)
{
PyObject *m;
m = PyModule_Create(&statmodule);
if (m == NULL)
return NULL;

if (PyModule_AddIntMacro(m, S_IFDIR)) return NULL;
if (PyModule_AddIntMacro(m, S_IFCHR)) return NULL;
if (PyModule_AddIntMacro(m, S_IFBLK)) return NULL;
if (PyModule_AddIntMacro(m, S_IFREG)) return NULL;
if (PyModule_AddIntMacro(m, S_IFIFO)) return NULL;
if (PyModule_AddIntMacro(m, S_IFLNK)) return NULL;
if (PyModule_AddIntMacro(m, S_IFSOCK)) return NULL;
if (PyModule_AddIntMacro(m, S_IFDOOR)) return NULL;
if (PyModule_AddIntMacro(m, S_IFPORT)) return NULL;
if (PyModule_AddIntMacro(m, S_IFWHT)) return NULL;

if (PyModule_AddIntMacro(m, S_ISUID)) return NULL;
if (PyModule_AddIntMacro(m, S_ISGID)) return NULL;
if (PyModule_AddIntMacro(m, S_ISVTX)) return NULL;
if (PyModule_AddIntMacro(m, S_ENFMT)) return NULL;

if (PyModule_AddIntMacro(m, S_IREAD)) return NULL;
if (PyModule_AddIntMacro(m, S_IWRITE)) return NULL;
if (PyModule_AddIntMacro(m, S_IEXEC)) return NULL;

if (PyModule_AddIntMacro(m, S_IRWXU)) return NULL;
if (PyModule_AddIntMacro(m, S_IRUSR)) return NULL;
if (PyModule_AddIntMacro(m, S_IWUSR)) return NULL;
if (PyModule_AddIntMacro(m, S_IXUSR)) return NULL;

if (PyModule_AddIntMacro(m, S_IRWXG)) return NULL;
if (PyModule_AddIntMacro(m, S_IRGRP)) return NULL;
if (PyModule_AddIntMacro(m, S_IWGRP)) return NULL;
if (PyModule_AddIntMacro(m, S_IXGRP)) return NULL;

if (PyModule_AddIntMacro(m, S_IRWXO)) return NULL;
if (PyModule_AddIntMacro(m, S_IROTH)) return NULL;
if (PyModule_AddIntMacro(m, S_IWOTH)) return NULL;
if (PyModule_AddIntMacro(m, S_IXOTH)) return NULL;

if (PyModule_AddIntMacro(m, UF_NODUMP)) return NULL;
if (PyModule_AddIntMacro(m, UF_IMMUTABLE)) return NULL;
if (PyModule_AddIntMacro(m, UF_APPEND)) return NULL;
if (PyModule_AddIntMacro(m, UF_OPAQUE)) return NULL;
if (PyModule_AddIntMacro(m, UF_NOUNLINK)) return NULL;
if (PyModule_AddIntMacro(m, UF_COMPRESSED)) return NULL;
if (PyModule_AddIntMacro(m, UF_HIDDEN)) return NULL;
if (PyModule_AddIntMacro(m, SF_ARCHIVED)) return NULL;
if (PyModule_AddIntMacro(m, SF_IMMUTABLE)) return NULL;
if (PyModule_AddIntMacro(m, SF_APPEND)) return NULL;
if (PyModule_AddIntMacro(m, SF_NOUNLINK)) return NULL;
if (PyModule_AddIntMacro(m, SF_SNAPSHOT)) return NULL;

if (PyModule_AddIntConstant(m, "ST_MODE", 0)) return NULL;
if (PyModule_AddIntConstant(m, "ST_INO", 1)) return NULL;
if (PyModule_AddIntConstant(m, "ST_DEV", 2)) return NULL;
if (PyModule_AddIntConstant(m, "ST_NLINK", 3)) return NULL;
if (PyModule_AddIntConstant(m, "ST_UID", 4)) return NULL;
if (PyModule_AddIntConstant(m, "ST_GID", 5)) return NULL;
if (PyModule_AddIntConstant(m, "ST_SIZE", 6)) return NULL;
if (PyModule_AddIntConstant(m, "ST_ATIME", 7)) return NULL;
if (PyModule_AddIntConstant(m, "ST_MTIME", 8)) return NULL;
if (PyModule_AddIntConstant(m, "ST_CTIME", 9)) return NULL;

#ifdef MS_WINDOWS
if (PyModule_AddIntMacro(m, FILE_ATTRIBUTE_ARCHIVE)) return NULL;
if (PyModule_AddIntMacro(m, FILE_ATTRIBUTE_COMPRESSED)) return NULL;
if (PyModule_AddIntMacro(m, FILE_ATTRIBUTE_DEVICE)) return NULL;
if (PyModule_AddIntMacro(m, FILE_ATTRIBUTE_DIRECTORY)) return NULL;
if (PyModule_AddIntMacro(m, FILE_ATTRIBUTE_ENCRYPTED)) return NULL;
if (PyModule_AddIntMacro(m, FILE_ATTRIBUTE_HIDDEN)) return NULL;
if (PyModule_AddIntMacro(m, FILE_ATTRIBUTE_INTEGRITY_STREAM)) return NULL;
if (PyModule_AddIntMacro(m, FILE_ATTRIBUTE_NORMAL)) return NULL;
if (PyModule_AddIntMacro(m, FILE_ATTRIBUTE_NOT_CONTENT_INDEXED)) return NULL;
if (PyModule_AddIntMacro(m, FILE_ATTRIBUTE_NO_SCRUB_DATA)) return NULL;
if (PyModule_AddIntMacro(m, FILE_ATTRIBUTE_OFFLINE)) return NULL;
if (PyModule_AddIntMacro(m, FILE_ATTRIBUTE_READONLY)) return NULL;
if (PyModule_AddIntMacro(m, FILE_ATTRIBUTE_REPARSE_POINT)) return NULL;
if (PyModule_AddIntMacro(m, FILE_ATTRIBUTE_SPARSE_FILE)) return NULL;
if (PyModule_AddIntMacro(m, FILE_ATTRIBUTE_SYSTEM)) return NULL;
if (PyModule_AddIntMacro(m, FILE_ATTRIBUTE_TEMPORARY)) return NULL;
if (PyModule_AddIntMacro(m, FILE_ATTRIBUTE_VIRTUAL)) return NULL;

if (PyModule_AddObject(m, "IO_REPARSE_TAG_SYMLINK",
PyLong_FromUnsignedLong(IO_REPARSE_TAG_SYMLINK))) return NULL;
if (PyModule_AddObject(m, "IO_REPARSE_TAG_MOUNT_POINT",
PyLong_FromUnsignedLong(IO_REPARSE_TAG_MOUNT_POINT))) return NULL;
if (PyModule_AddObject(m, "IO_REPARSE_TAG_APPEXECLINK",
PyLong_FromUnsignedLong(IO_REPARSE_TAG_APPEXECLINK))) return NULL;
#endif

return m;
return PyModuleDef_Init(&statmodule);
}

#ifdef __cplusplus
Expand Down