Repository: redis/redis-py

Issue:
Wrong number of arguments for 'geosearch' command
**Version**: 
redis-py: 4.3.4
Redis: 7.0.5

**Platform**:
Python 3.9.15 (main, Oct 11 2022, 21:39:54) 
[Clang 14.0.0 (clang-1400.0.29.102)] on darwin
MacOS

**Description**:
Passing 0.0 longitude or latitude to geosearch results in:
`redis.exceptions.ResponseError: wrong number of arguments for 'geosearch' command`

```
def main():
    redis = Redis.from_url(url="redis://localhost:6379")
    key = "theindex"
    lon: float = 0.0
    lat: float = 1.0
    redis.geoadd(name=key, values=[lon, lat, "foo"])
    results = redis.geosearch(name=key, longitude=lon, latitude=lat, radius=1, unit="km")
    print(results)
```

**Stack trace**:
```
poetry run python playground/bug/main.py
Traceback (most recent call last):
  File "/Users/petru/PLAY/redis-playground/playground/bug/main.py", line 22, in <module>
    main()
  File "/Users/petru/PLAY/redis-playground/playground/bug/main.py", line 18, in main
    results = redis.geosearch(name=key, longitude=lon, latitude=lat, radius=1, unit="km")
  File "/.../python3.9/site-packages/redis/commands/core.py", line 5474, in geosearch
    return self._geosearchgeneric(
  File "/.../python3.9/site-packages/redis/commands/core.py", line 5605, in _geosearchgeneric
    return self.execute_command(command, *pieces, **kwargs)
  File "/.../python3.9/site-packages/redis/client.py", line 1238, in execute_command
    return conn.retry.call_with_retry(
  File "/.../python3.9/site-packages/redis/retry.py", line 46, in call_with_retry
    return do()
  File "/.../python3.9/site-packages/redis/client.py", line 1239, in <lambda>
    lambda: self._send_command_parse_response(
  File "/.../python3.9/site-packages/redis/client.py", line 1215, in _send_command_parse_response
    return self.parse_response(conn, command_name, **options)
  File "/.../python3.9/site-packages/redis/client.py", line 1254, in parse_response
    response = connection.read_response()
  File "/.../python3.9/site-packages/redis/connection.py", line 839, in read_response
    raise response
redis.exceptions.ResponseError: wrong number of arguments for 'geosearch' command
```


Discussion:
The issue gets fixed if lat and lon are passed as strings. This will work:

```
def main():
    redis = Redis.from_url(url="redis://localhost:6379")
    key = "theindex"
    lon = "0.0"
    lat = "1.0"
    redis.geoadd(name=key, values=[lon, lat, "foo"])
    results = redis.geosearch(name=key, longitude=lon, latitude=lat, radius=1, unit="km")
    print(results)
```

Resolving patch:
diff --git a/redis/commands/core.py b/redis/commands/core.py
--- a/redis/commands/core.py
+++ b/redis/commands/core.py
@@ -5581,7 +5581,7 @@ def _geosearchgeneric(
                     "GEOSEARCH member and longitude or latitude" " cant be set together"
                 )
             pieces.extend([b"FROMMEMBER", kwargs["member"]])
-        if kwargs["longitude"] and kwargs["latitude"]:
+        if kwargs["longitude"] is not None and kwargs["latitude"] is not None:
             pieces.extend([b"FROMLONLAT", kwargs["longitude"], kwargs["latitude"]])
 
         # BYRADIUS or BYBOX


Test patch: