Skip to content

Commit e1f0fd3

Browse files
DinoVmeta-codesync[bot]
authored andcommitted
Remove unsupported things from static Python on Windows
Summary: We don't have posixy things for static Python so don't worry about them for now. Reviewed By: jbower-fb Differential Revision: D91526696 fbshipit-source-id: b2cbb9b97d4d9ec3566d6aee7757a432476da728
1 parent 132a914 commit e1f0fd3

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

cinderx/StaticPython/_static.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -763,6 +763,7 @@ PyObject* make_context_decorator_wrapper(
763763

764764
Ci_Py_TYPED_SIGNATURE(Ci_static_rand, Ci_Py_SIG_INT32, NULL);
765765

766+
#ifndef WIN32
766767
static int64_t posix_clock_gettime_ns(PyObject* mod) {
767768
struct timespec result;
768769
int64_t ret;
@@ -773,6 +774,7 @@ static int64_t posix_clock_gettime_ns(PyObject* mod) {
773774
}
774775

775776
Ci_Py_TYPED_SIGNATURE(posix_clock_gettime_ns, Ci_Py_SIG_INT64, NULL);
777+
#endif
776778

777779
static Py_ssize_t static_property_missing_fget(PyObject* mod, PyObject* self) {
778780
PyErr_SetString(PyExc_AttributeError, "unreadable attribute");
@@ -811,6 +813,7 @@ Ci_Py_TYPED_SIGNATURE(
811813

812814
#else
813815

816+
#ifndef _WIN32
814817
static PyObject* posix_clock_gettime_ns(PyObject* mod) {
815818
struct timespec result;
816819
int64_t ret;
@@ -819,6 +822,7 @@ static PyObject* posix_clock_gettime_ns(PyObject* mod) {
819822
ret = result.tv_sec * 1e9 + result.tv_nsec;
820823
return PyLong_FromLong(ret);
821824
}
825+
#endif
822826

823827
static PyObject* static_property_missing_fget(PyObject* mod, PyObject* self) {
824828
PyErr_SetString(PyExc_AttributeError, "unreadable attribute");
@@ -1790,11 +1794,13 @@ static PyMethodDef static_methods[] = {
17901794
METH_FASTCALL,
17911795
""},
17921796
#if PY_VERSION_HEX < 0x030C0000
1797+
#ifndef WIN32
17931798
{"posix_clock_gettime_ns",
17941799
(PyCFunction)&posix_clock_gettime_ns_def,
17951800
Ci_METH_TYPED,
17961801
"Returns time in nanoseconds as an int64. Note: Does no error checks at "
17971802
"all."},
1803+
#endif
17981804
{"_property_missing_fget",
17991805
(PyCFunction)&static_property_missing_fget_def,
18001806
Ci_METH_TYPED,
@@ -1808,11 +1814,13 @@ static PyMethodDef static_methods[] = {
18081814
Ci_METH_TYPED,
18091815
""},
18101816
#else
1817+
#ifndef WIN32
18111818
{"posix_clock_gettime_ns",
18121819
(PyCFunction)&posix_clock_gettime_ns,
18131820
METH_NOARGS,
18141821
"Returns time in nanoseconds as an int64. Note: Does no error checks at "
18151822
"all."},
1823+
#endif
18161824
{"_property_missing_fget",
18171825
(PyCFunction)&static_property_missing_fget,
18181826
METH_O,

cinderx/StaticPython/classloader.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "cinder/exports.h"
2121
#endif
2222

23+
#ifndef WIN32
2324
#include <dlfcn.h>
2425

2526
// This is a dict containing a mapping of lib name to "handle"
@@ -31,6 +32,7 @@ static PyObject* dlopen_cache;
3132
// the raw address as returned by `dlsym()`.
3233
// Dict[Tuple[str, str], int]
3334
static PyObject* dlsym_cache;
35+
#endif
3436

3537
int used_in_vtable(PyObject* value);
3638

@@ -634,6 +636,7 @@ int _PyClassLoader_HasPrimitiveArgs(PyCodeObject* code) {
634636
return 0;
635637
}
636638

639+
#ifndef WIN32
637640
static PyObject* invoke_native_helper = NULL;
638641

639642
static inline int import_invoke_native() {
@@ -907,6 +910,7 @@ void* _PyClassloader_LookupSymbol(PyObject* lib_name, PyObject* symbol_name) {
907910
Py_DECREF(res);
908911
return addr;
909912
}
913+
#endif
910914

911915
// Python list used to cache values
912916
static PyObject* value_cache;

0 commit comments

Comments
 (0)