Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-ephem for openSUSE:Factory checked in at 2023-01-03 15:05:25 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-ephem (Old) and /work/SRC/openSUSE:Factory/.python-ephem.new.1563 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-ephem" Tue Jan 3 15:05:25 2023 rev:7 rq:1046298 version:4.1.4 Changes: -------- --- /work/SRC/openSUSE:Factory/python-ephem/python-ephem.changes 2022-01-17 23:48:50.840411646 +0100 +++ /work/SRC/openSUSE:Factory/.python-ephem.new.1563/python-ephem.changes 2023-01-03 15:05:44.098639298 +0100 @@ -1,0 +2,20 @@ +Mon Jan 2 19:57:05 UTC 2023 - Dirk Müller <dmuel...@suse.com> + +- update to 4.1.4: + * A memory leak has been resolved, that was failing to free the storage + for the satellite name (a Python string) and catalog number (a Python + integer) when the satellite object itself was freed. + * In previous versions, if you asked for the position of a body + (a) whose elliptical or hyperbolic orbit has an eccentricity very + close to 1.0 and (b) which is very far from perihelion, then the + underlying C library would print a warning ``Near-parabolic orbit: + inaccurate result`` but let your Python script continue on unawares. + Now, no message is printed directly to the screen, and instead a + ``RuntimeError`` will tell you why PyEphem canât compute the bodyâs + position. + * The underlying C library should no longer produce a segmentation fault + if given the floating point number ``NaN`` as a date. The Python + rising and setting logic now also watches out for ``NaN`` dates, and + raises a ``ValueError`` when one is detected. + +------------------------------------------------------------------- Old: ---- ephem-4.1.3.tar.gz New: ---- ephem-4.1.4.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-ephem.spec ++++++ --- /var/tmp/diff_new_pack.iE0LZ3/_old 2023-01-03 15:05:45.622648193 +0100 +++ /var/tmp/diff_new_pack.iE0LZ3/_new 2023-01-03 15:05:45.630648239 +0100 @@ -1,7 +1,7 @@ # # spec file for package python-ephem # -# Copyright (c) 2022 SUSE LLC +# Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,7 +18,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-ephem -Version: 4.1.3 +Version: 4.1.4 Release: 0 Summary: Scientific-grade astronomy routines for Python License: MIT ++++++ ephem-4.1.3.tar.gz -> ephem-4.1.4.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ephem-4.1.3/PKG-INFO new/ephem-4.1.4/PKG-INFO --- old/ephem-4.1.3/PKG-INFO 2021-12-13 12:19:43.126785500 +0100 +++ new/ephem-4.1.4/PKG-INFO 2022-12-21 16:52:33.996783500 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: ephem -Version: 4.1.3 +Version: 4.1.4 Summary: Compute positions of the planets and stars Home-page: http://rhodesmill.org/pyephem/ Author: Brandon Rhodes diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ephem-4.1.3/ephem/__init__.py new/ephem-4.1.4/ephem/__init__.py --- old/ephem-4.1.3/ephem/__init__.py 2021-12-13 12:19:41.382771700 +0100 +++ new/ephem-4.1.4/ephem/__init__.py 2022-12-21 16:52:33.464756700 +0100 @@ -7,10 +7,10 @@ from datetime import datetime as _datetime from datetime import timedelta as _timedelta from datetime import tzinfo as _tzinfo -from math import acos, cos, pi, sin +from math import acos, cos, isnan, pi, sin from time import localtime as _localtime -__version__ = '4.1.3' +__version__ = '4.1.4' # As a favor, compile a regular expression that our C library would # really rather not compile for itself. @@ -459,6 +459,9 @@ self.date = start prev_ha = None while True: + if isnan(self.date): + raise ValueError('cannot find a next rising or setting' + ' if the date is NaN') body.compute(self) horizon = self.horizon if not use_center: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ephem-4.1.3/ephem/doc/CHANGELOG.rst new/ephem-4.1.4/ephem/doc/CHANGELOG.rst --- old/ephem-4.1.3/ephem/doc/CHANGELOG.rst 2021-12-13 12:19:41.382771700 +0100 +++ new/ephem-4.1.4/ephem/doc/CHANGELOG.rst 2022-12-21 16:52:33.468757000 +0100 @@ -2,6 +2,29 @@ PyEphem CHANGELOG ================= +Version 4.1.4 (2022 December 21) +-------------------------------- + +- A memory leak has been resolved, that was failing to free the storage + for the satellite name (a Python string) and catalog number (a Python + integer) when the satellite object itself was freed. + +- In previous versions, if you asked for the position of a body + (a) whose elliptical or hyperbolic orbit has an eccentricity very + close to 1.0 and (b) which is very far from perihelion, then the + underlying C library would print a warning ``Near-parabolic orbit: + inaccurate result`` but let your Python script continue on unawares. + Now, no message is printed directly to the screen, and instead a + ``RuntimeError`` will tell you why PyEphem canât compute the bodyâs + position. + `#239 <https://github.com/brandon-rhodes/pyephem/issues/239>`_ + +- The underlying C library should no longer produce a segmentation fault + if given the floating point number ``NaN`` as a date. The Python + rising and setting logic now also watches out for ``NaN`` dates, and + raises a ``ValueError`` when one is detected. + `#237 <https://github.com/brandon-rhodes/pyephem/issues/237>`_ + Version 4.1.3 (2021 December 13) -------------------------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ephem-4.1.3/ephem/doc/quick.rst new/ephem-4.1.4/ephem/doc/quick.rst --- old/ephem-4.1.3/ephem/doc/quick.rst 2021-12-13 12:19:41.382771700 +0100 +++ new/ephem-4.1.4/ephem/doc/quick.rst 2022-12-21 16:52:33.468757000 +0100 @@ -598,6 +598,10 @@ * The ``next_pass()`` method takes an ``EarthSatellite`` body and determines when it will next cross above the horizon. + * The ``next_pass()`` method is implemented + by the C library thatâs wrapped by PyEphem, + so it unfortunately ignores the ``horizon`` attribute + that controls PyEphemâs own rising and setting routines. * It returns a six-element tuple giving:: 0 Rise time diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ephem-4.1.3/ephem/tests/test_bodies.py new/ephem-4.1.4/ephem/tests/test_bodies.py --- old/ephem-4.1.3/ephem/tests/test_bodies.py 2021-12-13 12:19:41.386772000 +0100 +++ new/ephem-4.1.4/ephem/tests/test_bodies.py 2022-12-21 16:52:33.468757000 +0100 @@ -71,7 +71,7 @@ # Determine whether each kind of body supports the set of attributes # we believe it should. -class BodyTests(unittest.TestCase): +class BodyBuilderTests(unittest.TestCase): def setUp(self): self.date = Date('2004/05/21') @@ -290,6 +290,18 @@ '2 20580 28.4694 17.3953 0004117 265.2946 ' '94.7172 14.99359833594524') + +class BodyFailureTests(unittest.TestCase): + def test_nearly_parabolic_EllipticalBody_and_far_from_Sun(self): + line = ( + "C/1980 Y1 (Bradfield),e,138.5850,115.3515,358.2941,945.0557," + "0.0000339,0.999725,359.9999,12/27.0/1980,2000,g 9.0,4.0" + ) + b = readdb(line) + b.compute('2022/7/15') + with self.assertRaises(RuntimeError): + b.ra + # A user reported that Saturn's ring tilt was misbehaving, and there was # indeed a major error occuring in its calculation. This small test # should assure that reasonable values are returned from now on. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ephem-4.1.3/ephem/tests/test_rise_set.py new/ephem-4.1.4/ephem/tests/test_rise_set.py --- old/ephem-4.1.3/ephem/tests/test_rise_set.py 2021-12-13 12:19:41.386772000 +0100 +++ new/ephem-4.1.4/ephem/tests/test_rise_set.py 2022-12-21 16:52:33.468757000 +0100 @@ -74,6 +74,13 @@ o.lat = '-70' self.assertRaises(ephem.AlwaysUpError, o.next_rising, m) + def test_raises_error_for_NaN(self): + m = ephem.Moon() + o = ephem.Observer() + o.date = float('nan') + with self.assertRaises(ValueError): + o.next_rising(m) + def test_sun(self): s = ephem.Sun() o = ephem.Observer() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ephem-4.1.3/extensions/_libastro.c new/ephem-4.1.4/extensions/_libastro.c --- old/ephem-4.1.3/extensions/_libastro.c 2021-12-13 12:19:41.386772000 +0100 +++ new/ephem-4.1.4/extensions/_libastro.c 2022-12-21 16:52:33.472757000 +0100 @@ -372,7 +372,11 @@ sizeof(AngleObject), 0, 0, /* tp_dealloc */ +#if PY_MAJOR_VERSION < 3 Angle_print, /* tp_print */ +#else + 0, /* reserved in 3.x */ +#endif 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_compare */ @@ -669,7 +673,11 @@ sizeof(PyFloatObject), 0, 0, /* tp_dealloc */ +#if PY_MAJOR_VERSION < 3 Date_print, /* tp_print */ +#else + 0, /* tp_print slot is reserved and unused in Python 3 */ +#endif 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_compare */ @@ -1285,6 +1293,14 @@ return 0; } +static void EarthSatellite_dealloc(PyObject *self) +{ + EarthSatellite *e = (EarthSatellite*) self; + Py_XDECREF(e->name); + Py_XDECREF(e->catalog_number); + Py_TYPE(self)->tp_free(self); +} + #undef INIT /* This compute() method does not actually compute anything, since @@ -1489,9 +1505,17 @@ return 0; pref_set(PREF_EQUATORIAL, body->obj.o_flags & VALID_TOPO ? PREF_TOPO : PREF_GEO); - if (obj_cir(& body->now, & body->obj) == -1) { + + int is_error = obj_cir(& body->now, & body->obj) == -1; + int is_inaccurate = body->obj.o_flags & NOCIRCUM; + + if (is_error || is_inaccurate) { + char *extra = ""; + if (is_inaccurate) + extra = " with any accuracy because its orbit is nearly" + " parabolic and it is very far from the Sun"; PyErr_Format(PyExc_RuntimeError, "cannot compute the body's position" - " at %s", Date_format_value(body->now.n_mjd)); + " at %s%s", Date_format_value(body->now.n_mjd), extra); return -1; } body->obj.o_flags |= VALID_OBJ; @@ -2575,7 +2599,7 @@ "ephem.EarthSatellite", sizeof(EarthSatellite), 0, - 0, /* tp_dealloc */ + EarthSatellite_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ @@ -2703,7 +2727,9 @@ return new_Angle(acos(cosine), raddeg(1)); } -/* Read various database formats, with strings as input. */ +/* Read various database formats, with strings as input. Note that + `build_body_from_obj()` operates on a pair of borrowed references; + the caller should DECREF `name` when the caller is done with it. */ static PyObject *build_body_from_obj(PyObject *name, Obj *op) { @@ -2729,21 +2755,16 @@ PyErr_Format(PyExc_ValueError, "cannot build object of unexpected type %d", op->o_type); - Py_DECREF(name); return 0; } body = (Body*) PyType_GenericNew(type, 0, 0); - if (!body) { - Py_DECREF(name); + if (!body) return 0; - } body->obj = *op; if (Set_name((PyObject*) body, name, 0) == -1) { Py_DECREF(body); - Py_DECREF(name); return 0; } - Py_DECREF(name); return (PyObject*) body; } @@ -2766,7 +2787,9 @@ name = PyUnicode_FromString(line); if (!name) return 0; - return build_body_from_obj(name, &obj); + PyObject *body = build_body_from_obj(name, &obj); + Py_DECREF(name); + return body; } static PyObject* readtle(PyObject *self, PyObject *args) @@ -2793,11 +2816,14 @@ if (!stripped_name) return 0; body = build_body_from_obj(stripped_name, &obj); + Py_DECREF(stripped_name); if (!body) return 0; catalog_number = PyLong_FromLong((long) strtod(l1+2, 0)); - if (!catalog_number) + if (!catalog_number) { + Py_DECREF(body); return 0; + } ((EarthSatellite*) body)->catalog_number = catalog_number; return body; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ephem-4.1.3/libastro/deltat.c new/ephem-4.1.4/libastro/deltat.c --- old/ephem-4.1.3/libastro/deltat.c 2021-12-13 12:19:41.406772100 +0100 +++ new/ephem-4.1.4/libastro/deltat.c 2022-12-21 16:52:33.492758000 +0100 @@ -237,6 +237,9 @@ * See AA page K11. */ + /* Avoid Segmentation fault if year is NaN. */ + if (Y != Y) + return 0.0; /* Index into the table. */ p = floor(Y); iy = (int) (p - TABSTART); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ephem-4.1.3/libastro/twobody.c new/ephem-4.1.4/libastro/twobody.c --- old/ephem-4.1.3/libastro/twobody.c 2021-12-13 12:19:41.410772000 +0100 +++ new/ephem-4.1.4/libastro/twobody.c 2022-12-21 16:52:33.492758000 +0100 @@ -174,11 +174,7 @@ * the orbit of Pluto. For any reasonable orbit this will * never happen in practice. * - * You might want to code a more graceful error exit here though. - * */ - printf( "\nNear-parabolic orbit: inaccurate result." - "\n e = %f, lambda = %f, w = %f", e, lambda, w ); return -1; } else diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ephem-4.1.3/setup.py new/ephem-4.1.4/setup.py --- old/ephem-4.1.3/setup.py 2021-12-13 12:19:41.410772000 +0100 +++ new/ephem-4.1.4/setup.py 2022-12-21 16:52:33.496758200 +0100 @@ -56,6 +56,9 @@ author = 'Brandon Rhodes', author_email = 'bran...@rhodesmill.org', url = 'http://rhodesmill.org/pyephem/', + project_urls = { + 'Source': 'https://github.com/brandon-rhodes/pyephem', + }, classifiers = [ 'Development Status :: 6 - Mature', 'Intended Audience :: Science/Research',