diff options
author | Stefan Behnel <stefan_ml@behnel.de> | 2018-11-24 10:27:27 +0100 |
---|---|---|
committer | Stefan Behnel <stefan_ml@behnel.de> | 2018-11-24 10:27:27 +0100 |
commit | 34eac74e30021e28b5f87cd0e4db2d9b03ca93e1 (patch) | |
tree | 7693916b565cc9227d6821aabfd1278b9107c2f5 | |
parent | a29411eedf586c056866e558ebd789c63365f0c9 (diff) | |
parent | 3eb9e2b1af0a717bf4b73b57025dc8f1c0fa6269 (diff) | |
download | cython-34eac74e30021e28b5f87cd0e4db2d9b03ca93e1.tar.gz |
Merge branch 'release'
-rw-r--r-- | CHANGES.rst | 2 | ||||
-rw-r--r-- | Cython/Utility/ModuleSetupCode.c | 14 |
2 files changed, 9 insertions, 7 deletions
diff --git a/CHANGES.rst b/CHANGES.rst index 395722bd2..95cb58b38 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -31,7 +31,7 @@ Other changes * Support for Python 2.6 was removed. -0.29.1 (2018-1?-??) +0.29.1 (2018-11-24) =================== Bugs fixed diff --git a/Cython/Utility/ModuleSetupCode.c b/Cython/Utility/ModuleSetupCode.c index 6a9f75b20..2001334eb 100644 --- a/Cython/Utility/ModuleSetupCode.c +++ b/Cython/Utility/ModuleSetupCode.c @@ -935,11 +935,13 @@ static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) { return 0; } -static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name) { +static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) { PyObject *value = PyObject_GetAttrString(spec, from_name); int result = 0; if (likely(value)) { - result = PyDict_SetItemString(moddict, to_name, value); + if (allow_none || value != Py_None) { + result = PyDict_SetItemString(moddict, to_name, value); + } Py_DECREF(value); } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) { PyErr_Clear(); @@ -969,10 +971,10 @@ static CYTHON_SMALL_CODE PyObject* ${pymodule_create_func_cname}(PyObject *spec, if (unlikely(!moddict)) goto bad; // moddict is a borrowed reference - if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__") < 0)) goto bad; - if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__") < 0)) goto bad; - if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__") < 0)) goto bad; - if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__") < 0)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad; return module; bad: |