summaryrefslogtreecommitdiff
path: root/usr/src/lib/pysolaris/common
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/lib/pysolaris/common')
-rw-r--r--usr/src/lib/pysolaris/common/mapfile-py347
-rw-r--r--usr/src/lib/pysolaris/common/misc.c36
2 files changed, 80 insertions, 3 deletions
diff --git a/usr/src/lib/pysolaris/common/mapfile-py3 b/usr/src/lib/pysolaris/common/mapfile-py3
new file mode 100644
index 0000000000..6e14724a62
--- /dev/null
+++ b/usr/src/lib/pysolaris/common/mapfile-py3
@@ -0,0 +1,47 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright 2018 OmniOS Community Edition (OmniOSce) Association.
+#
+
+#
+# MAPFILE HEADER START
+#
+# WARNING: STOP NOW. DO NOT MODIFY THIS FILE.
+# Object versioning must comply with the rules detailed in
+#
+# usr/src/lib/README.mapfiles
+#
+# You should not be making modifications here until you've read the most current
+# copy of that file. If you need help, contact a gatekeeper for guidance.
+#
+# MAPFILE HEADER END
+#
+
+$mapfile_version 2
+
+SYMBOL_VERSION SUNWprivate {
+ global:
+ PyInit_misc;
+ local:
+ *;
+};
diff --git a/usr/src/lib/pysolaris/common/misc.c b/usr/src/lib/pysolaris/common/misc.c
index 13280d461f..211ab1b983 100644
--- a/usr/src/lib/pysolaris/common/misc.c
+++ b/usr/src/lib/pysolaris/common/misc.c
@@ -21,6 +21,7 @@
/*
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ * Copyright 2018 OmniOS Community Edition (OmniOSce) Association.
*/
#include <Python.h>
@@ -85,7 +86,7 @@ py_sid_to_name(PyObject *self, PyObject *args)
return (NULL);
}
- ret = PyString_FromString(name);
+ ret = PyUnicode_FromString(name);
free(name);
return (ret);
}
@@ -121,8 +122,37 @@ static PyMethodDef solarismethods[] = {
{NULL, NULL, 0, NULL}
};
-void
+#if PY_MAJOR_VERSION >= 3
+static struct PyModuleDef solaris_module = {
+ PyModuleDef_HEAD_INIT,
+ "solaris.misc",
+ NULL,
+ -1,
+ solarismethods
+};
+#endif
+
+static PyObject *
+moduleinit()
+{
+#if PY_MAJOR_VERSION >= 3
+ return (PyModule_Create(&solaris_module));
+#else
+ (void) Py_InitModule("solaris.misc", solarismethods);
+ return (NULL);
+#endif
+}
+
+#if PY_MAJOR_VERSION >= 3
+PyMODINIT_FUNC
+PyInit_misc(void)
+{
+ return (moduleinit());
+}
+#else
+PyMODINIT_FUNC
initmisc(void)
{
- PyObject *solaris_misc = Py_InitModule("solaris.misc", solarismethods);
+ (void) moduleinit();
}
+#endif