Skip to content

Properly propagate exceptions in sas.pyx #47149

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 5, 2022

Conversation

jonashaag
Copy link
Contributor

@jonashaag jonashaag commented May 27, 2022

  • closes #xxxx (Replace xxxx with the Github issue number)
  • Tests added and passed if fixing a bug or adding a new feature
  • All code checks passed.
  • Added an entry in the latest doc/source/whatsnew/vX.X.X.rst file if fixing a bug or adding a new feature.

ofs = cnt + 3
ofs += <uint16_t>inbuff[ipos] << 4
ipos += 1
for k in range(cmd):
outbuff[rpos + k] = outbuff[rpos - <int>ofs + k]
rpos += cmd

else:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This case is actually impossible and I removed it so that nobody is confused why we aren't testing the raise ValueError.

@@ -294,7 +291,7 @@ cdef class Parser:
self.parser._current_row_in_chunk_index = self.current_row_in_chunk_index
self.parser._current_row_in_file_index = self.current_row_in_file_index

cdef bint read_next_page(self):
cdef read_next_page(self):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was the bint here removed?

Copy link
Contributor Author

@jonashaag jonashaag May 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because otherwise read_next_page doesn't propagate exceptions. Alternative could be cdef bint read_next_page(self) except * or cdef bint read_next_page(self) except 1

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The alternatives would be preferred IMO

@jreback jreback added the IO SAS SAS: read_sas label May 29, 2022
@jonashaag jonashaag force-pushed the sasbdat-exceptions branch from 2a5438f to ac4c2f1 Compare May 31, 2022 07:20
@jonashaag jonashaag requested a review from mroeschke May 31, 2022 07:25
@mroeschke mroeschke added this to the 1.5 milestone May 31, 2022
@jreback jreback added the Error Reporting Incorrect or improved errors from pandas label Jun 5, 2022
@jreback jreback merged commit 0ede847 into pandas-dev:main Jun 5, 2022
@jreback
Copy link
Contributor

jreback commented Jun 5, 2022

thanks @jonashaag

yehoshuadimarsky pushed a commit to yehoshuadimarsky/pandas that referenced this pull request Jul 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Error Reporting Incorrect or improved errors from pandas IO SAS SAS: read_sas
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants