Skip to content

Commit

Permalink
MAINT: fix int32 default on windows issue
Browse files Browse the repository at this point in the history
  • Loading branch information
bsipocz committed May 3, 2024
1 parent 4422b7e commit 65a00ad
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion astroquery/utils/tap/xmlparser/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,15 @@
import gzip
import io
import json
import sys
import warnings

import numpy as np

from astropy import units as u
from astropy.table import Table as APTable
from astropy.table.table import Table
from astropy.utils.exceptions import AstropyWarning


def util_create_string_from_buffer(buffer):
Expand Down Expand Up @@ -69,7 +74,15 @@ def read_http_response(response, output_format, *, correct_units=True, use_names
elif astropy_format == 'votable':
result = APTable.read(data, format=astropy_format, use_names_over_ids=use_names_over_ids)
else:
result = APTable.read(data, format=astropy_format)
with warnings.catch_warnings():
# Capturing the warning and converting the objid column to int64 is necessary for consistency as
# it was convereted to string on systems with defaul integer int32 due to an overflow.
if sys.platform.startswith('win'):
warnings.filterwarnings("ignore", category=AstropyWarning,
message=r'OverflowError converting to IntType in column.*')
result = APTable.read(data, format=astropy_format)
if 'solution_id' in result.columns:
result['solution_id'] = result['solution_id'].astype(np.uint64)

if correct_units:
modify_unrecognized_table_units(result)
Expand Down

0 comments on commit 65a00ad

Please sign in to comment.