Skip to content

Commit

Permalink
Apply patch for _PyFloat_Unpack4 error for mlat-client
Browse files Browse the repository at this point in the history
  • Loading branch information
WhoAmI0501 committed Jul 19, 2023
1 parent 219425d commit 68fa6ac
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,8 @@ piaware*.buildinfo
piaware*.ddeb
package-*

# package directories
package-*/

# PyCharm stuff
.idea/
31 changes: 31 additions & 0 deletions mlat-client.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
diff -ur mlat-client/modes_reader.c mlat-client.new/modes_reader.c
--- mlat-client/modes_reader.c 2023-07-19 16:16:39.000000000 +0200
+++ mlat-client.new/modes_reader.c 2023-07-19 16:20:36.640656745 +0200
@@ -503,6 +503,19 @@
{
float lat, lon, alt;

+#if PY_MAJOR_VERSION >= 3 && PY_MINOR_VERSION >=11
+ lat = PyFloat_Unpack4(data + 4, 1);
+ if (lat == -1.0 && PyErr_Occurred())
+ return NULL;
+
+ lon = PyFloat_Unpack4(data + 8, 1);
+ if (lon == -1.0 && PyErr_Occurred())
+ return NULL;
+
+ alt = PyFloat_Unpack4(data + 12, 1);
+ if (alt == -1.0 && PyErr_Occurred())
+ return NULL;
+#else
lat = _PyFloat_Unpack4(data + 4, 1);
if (lat == -1.0 && PyErr_Occurred())
return NULL;
@@ -514,6 +527,7 @@
alt = _PyFloat_Unpack4(data + 12, 1);
if (alt == -1.0 && PyErr_Occurred())
return NULL;
+#endif

return Py_BuildValue("{s:f,s:f,s:f}",
"lat", lat,
6 changes: 6 additions & 0 deletions sensible-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,18 @@ shallow_clone() {
repo=$1
branch=$2
target=$3
name="$(basename $3)"

echo "Retrieving $branch from $repo"
rm -fr $target
git clone -c advice.detachedHead=false --depth=1 --branch $branch $repo $target
(cd $target && git checkout --detach $branch)
(cd $target && git --no-pager log -1 --oneline)

if [ -f $TOP/$name.patch ]; then
echo "applying $name.patch .."
patch -d $OUTDIR/$name -p1 <$TOP/$name.patch
fi
}

# setup:
Expand Down

0 comments on commit 68fa6ac

Please sign in to comment.