Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
L
ligo-segments
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Test Cases
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Leo Pound Singer
ligo-segments
Commits
728fae79
Commit
728fae79
authored
Jan 09, 2019
by
Kipp Cannon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove six.h from build
parent
6a8abe27
Pipeline
#44240
failed with stages
in 1 minute and 33 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
114 deletions
+36
-114
src/segments.c
src/segments.c
+36
-22
src/six.h
src/six.h
+0
-92
No files found.
src/segments.c
View file @
728fae79
...
...
@@ -28,7 +28,6 @@
#include <Python.h>
#include <segments.h>
#include "six.h"
/*
...
...
@@ -43,37 +42,51 @@
#define MODULE_DOC "C implementations of the infinity, segment, and segmentlist classes from the segments module."
static
PyModuleDef
moduledef
=
{
PyModuleDef_HEAD_INIT
,
MODULE_NAME
,
MODULE_DOC
,
-
1
,
NULL
};
#if PY_MAJOR_VERSION < 3
PyMODINIT_FUNC
init__segments
(
void
);
/* Silence -Wmissing-prototypes */
PyMODINIT_FUNC
init__segments
(
void
)
#else
PyMODINIT_FUNC
PyInit___segments
(
void
);
/* Silence -Wmissing-prototypes */
PyMODINIT_FUNC
PyInit___segments
(
void
)
#endif
{
PyObject
*
module
=
NULL
;
#if PY_MAJOR_VERSION < 3
PyObject
*
module
=
Py_InitModule3
(
MODULE_NAME
,
NULL
,
MODULE_DOC
);
#else
static
struct
PyModuleDef
modef
=
{
PyModuleDef_HEAD_INIT
,
.
m_name
=
MODULE_NAME
,
.
m_doc
=
MODULE_DOC
,
.
m_size
=
-
1
,
.
m_methods
=
NULL
,
};
PyObject
*
module
=
PyModule_Create
(
&
modef
);
#endif
if
(
!
module
)
goto
done
;
if
(
PyType_Ready
(
&
segments_Infinity_Type
)
<
0
)
if
(
PyType_Ready
(
&
segments_Infinity_Type
)
<
0
)
{
Py_DECREF
(
module
);
module
=
NULL
;
goto
done
;
}
segments_Segment_Type
.
tp_base
=
&
PyTuple_Type
;
if
(
!
segments_Segment_Type
.
tp_hash
)
segments_Segment_Type
.
tp_hash
=
PyTuple_Type
.
tp_hash
;
if
(
PyType_Ready
(
&
segments_Segment_Type
)
<
0
)
if
(
PyType_Ready
(
&
segments_Segment_Type
)
<
0
)
{
Py_DECREF
(
module
);
module
=
NULL
;
goto
done
;
}
segments_SegmentList_Type
.
tp_base
=
&
PyList_Type
;
if
(
PyType_Ready
(
&
segments_SegmentList_Type
)
<
0
)
goto
done
;
/*
* Initialize module
*/
module
=
PyModule_Create
(
&
moduledef
);
if
(
!
module
)
if
(
PyType_Ready
(
&
segments_SegmentList_Type
)
<
0
)
{
Py_DECREF
(
module
);
module
=
NULL
;
goto
done
;
}
/*
* Create infinity class
...
...
@@ -113,8 +126,9 @@ PyMODINIT_FUNC PyInit___segments(void)
PyModule_AddObject
(
module
,
"segmentlist"
,
(
PyObject
*
)
&
segments_SegmentList_Type
);
done
:
#if PY_MAJOR_VERSION < 3
return
;
#else
return
module
;
#endif
}
SIX_COMPAT_MODULE
(
__segments
)
src/six.h
deleted
100644 → 0
View file @
6a8abe27
/*
* Copyright (C) 2016 Leo Singer
*
* Fake implementations of some parts of the Python C API functions to aid
* 2 to 3 porting. Named after the 'six' package that serves a similar
* purpose for pure Python code (https://pypi.python.org/pypi/six).
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <Python.h>
#ifndef _SIX_H
#define _SIX_H
#if PY_MAJOR_VERSION < 3
#ifdef PyMODINIT_FUNC
#undef PyMODINIT_FUNC
#define PyMODINIT_FUNC PyObject*
#endif
#define SIX_COMPAT_MODULE(name) _SIX_COMPAT_MODULE(name)
#define _SIX_COMPAT_MODULE(name) \
void init##name(void);
/* Silence -Wmissing-prototypes */
\
void init##name(void) { \
PyInit_##name(); \
}
typedef
struct
PyModuleDef
{
int
m_base
;
const
char
*
m_name
;
const
char
*
m_doc
;
Py_ssize_t
m_size
;
PyMethodDef
*
m_methods
;
}
PyModuleDef
;
#define PyModuleDef_HEAD_INIT 0
static
PyObject
*
PyModule_Create
(
PyModuleDef
*
def
)
{
(
void
)
PyModule_Create
;
/* Suppress unused function warning */
if
(
def
->
m_size
!=
-
1
)
{
PyErr_SetString
(
PyExc_NotImplementedError
,
"Python 2 does not support per-module state."
);
return
NULL
;
}
return
Py_InitModule3
(
def
->
m_name
,
def
->
m_methods
,
def
->
m_doc
);
}
static
PyObject
*
PyModule_Create2
(
PyModuleDef
*
def
,
int
module_api_version
)
{
(
void
)
PyModule_Create2
;
/* Suppress unused function warning */
if
(
def
->
m_size
!=
-
1
)
{
PyErr_SetString
(
PyExc_NotImplementedError
,
"Python 2 does not support per-module state."
);
return
NULL
;
}
return
Py_InitModule4
(
def
->
m_name
,
def
->
m_methods
,
def
->
m_doc
,
NULL
,
module_api_version
);
}
#ifdef NUMPY_IMPORT_ARRAY_RETVAL
#undef NUMPY_IMPORT_ARRAY_RETVAL
#endif
#define NUMPY_IMPORT_ARRAY_RETVAL NULL
#ifdef NUMPY_IMPORT_UMATH_RETVAL
#undef NUMPY_IMPORT_UMATH_RETVAL
#endif
#define NUMPY_IMPORT_UMATH_RETVAL NULL
#else
/* PY_MAJOR_VERSION >= 3 */
#define SIX_COMPAT_MODULE(name)
#endif
#endif
/* _SIX_H */
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