Skip to content

Commit

Permalink
Cleanup Python 2 leftovers + Sphinx deprectation warnings. (#284)
Browse files Browse the repository at this point in the history
* Fix Sphinx 8 deprecation warnings.

* Remove leftover Python 2 support code.
  • Loading branch information
icemac committed Feb 15, 2024
1 parent 4ed7ad3 commit ae03614
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 23 deletions.
6 changes: 3 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,9 +263,9 @@

# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {
'https://docs.python.org/': None,
'https://persistent.readthedocs.io/en/latest/': None,
'https://btrees.readthedocs.io/en/latest/': None,
'python': ('https://docs.python.org/', None),
'persistent': ('https://persistent.readthedocs.io/en/latest/', None),
'btrees': ('https://btrees.readthedocs.io/en/latest/', None),
}

# Sphinx 1.8+ prefers this to `autodoc_default_flags`. It's documented that
Expand Down
20 changes: 0 additions & 20 deletions src/zope/interface/_zope_interface_coptimizations.c
Original file line number Diff line number Diff line change
Expand Up @@ -1977,7 +1977,6 @@ static struct PyMethodDef m_methods[] = {
{NULL, (PyCFunction)NULL, 0, NULL} /* sentinel */
};

#if PY_MAJOR_VERSION >= 3
static char module_doc[] = "C optimizations for zope.interface\n\n";

static struct PyModuleDef _zic_module = {
Expand All @@ -1991,20 +1990,14 @@ static struct PyModuleDef _zic_module = {
NULL,
NULL
};
#endif

static PyObject *
init(void)
{
PyObject *m;

#if PY_MAJOR_VERSION < 3
#define DEFINE_STRING(S) \
if(! (str ## S = PyString_FromString(# S))) return NULL
#else
#define DEFINE_STRING(S) \
if(! (str ## S = PyUnicode_FromString(# S))) return NULL
#endif

DEFINE_STRING(__dict__);
DEFINE_STRING(__implemented__);
Expand Down Expand Up @@ -2054,13 +2047,7 @@ init(void)
if (PyType_Ready(&VerifyingBase) < 0)
return NULL;

#if PY_MAJOR_VERSION < 3
/* Create the module and add the functions */
m = Py_InitModule3("_zope_interface_coptimizations", m_methods,
"C optimizations for zope.interface\n\n");
#else
m = PyModule_Create(&_zic_module);
#endif
if (m == NULL)
return NULL;

Expand All @@ -2084,17 +2071,10 @@ init(void)
}

PyMODINIT_FUNC
#if PY_MAJOR_VERSION < 3
init_zope_interface_coptimizations(void)
{
init();
}
#else
PyInit__zope_interface_coptimizations(void)
{
return init();
}
#endif

#ifdef __clang__
#pragma clang diagnostic pop
Expand Down

0 comments on commit ae03614

Please sign in to comment.