Skip to content

Test case for patch, plus fix to not swallow exceptions #13693

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

Closed
wants to merge 3 commits into from

Conversation

bdrosen96
Copy link
Contributor

@bdrosen96 bdrosen96 commented Jul 18, 2016

@gfyoung
Copy link
Member

gfyoung commented Jul 18, 2016

@bdrosen96 : l wonder if you might need another test to further illustrate that these (different) C errors are being generated. The impression I would get from this test alone is that you were testing for an encoding error. @jreback what do you think?

@codecov-io
Copy link

codecov-io commented Jul 18, 2016

Current coverage is 84.54%

Merging #13693 into master will decrease coverage by <.01%

@@             master     #13693   diff @@
==========================================
  Files           141        141          
  Lines         51185      51161    -24   
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
- Hits          43275      43252    -23   
+ Misses         7910       7909     -1   
  Partials          0          0          

Powered by Codecov. Last updated by 506520b...0efe18b

@bdrosen96
Copy link
Contributor Author

With this fix, we get the same exception for both engines, where previously we got one exception for python engine and a different one for c engine (the cparser exception with no indication of the root cause of the failure)

I'm not sure what another deterministic stream error we could test here, unless we try to create a fake stream that errors after some number of bytes read.

@jreback
Copy link
Contributor

jreback commented Jul 18, 2016

fyi if you use the # on an issue it references automatically

@jreback jreback added Bug IO CSV read_csv, to_csv labels Jul 18, 2016
@gfyoung
Copy link
Member

gfyoung commented Jul 18, 2016

@bdrosen : what I meant were there any other errors besides the encoding one that the C engine was previously swallowing that are now surfaced?

Just to emphasize: not a blocker, but a nice to have (i.e. a test for another error that was being swallowed)

cdef:
object old_exc
PyObject *type, *value, *traceback
if PyErr_Occurred():
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The return from PyErr_Occurred does not need to be decrefed. The return from PyErr_Fetch does, and is.

@bdrosen96
Copy link
Contributor Author

Yes, there are other cases that would now be surfaced, but they would be hard to create a test for. For example:

1 HTTP request to get remote file as file like object (stream) passed to read-csv. Something goes wrong with network and exception is raised during read. We should now get a non generic error indicating network trouble rather than the generic read() error from before.

2 Same thing with FTP, HDFS, gluster, S3 or any other network type file operation.

3 Stream handle does decompression/unarchive (ie .csv.bz2 or .csv.gz, .csv.tar.gz, etc)

There are probably other cases that I am not aware of now.

@@ -0,0 +1,14 @@
num, text
1,�T�E�����iSauron�A�A�C�k�A�̑n���̎� - ��O�I3019�N3��25��j�́AJ�ER�ER�E�g�[���L���̒����𕑑�Ƃ�������w�z�r�b�g�̖`���x�w�w�֕���x�w�V���}�����̕���x�̓o��l���B
Copy link
Member

Choose a reason for hiding this comment

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

not for the fix itself, but isn't the copylight still alive?

Copy link
Member

Choose a reason for hiding this comment

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

ah maybe from wikipedia?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, this is annotations on the book, not the text of the book.

@jreback
Copy link
Contributor

jreback commented Jul 18, 2016

@bdrosen96 actually could easily test a network op on a non-existant file (and even an s3 op for the same, just give an invalid bucket).

@jreback jreback added this to the 0.19.0 milestone Jul 18, 2016
@bdrosen96
Copy link
Contributor Author

I don't think testing a network op on invalid bucket or non existant file would work since the exception would likely occur during open rather than read, so that would not help.

@jreback
Copy link
Contributor

jreback commented Jul 18, 2016

pls also add a whatsnew entry, you can put in API section as now better exceptions are passed thru the parser (plus I think the exception type could have changed), e.g. I think previously you would have gotten a CParserError (which is a ValueError), now you can get other things. If you can posit a useful message would be great.

@bdrosen96 bdrosen96 force-pushed the brett/dont_swallow_exc branch from 3b4694a to 0efe18b Compare July 19, 2016 11:12
@bdrosen96
Copy link
Contributor Author

Added whatsnew, closed codec recoder stream and added comment for test

@jreback jreback closed this in 210fea9 Jul 20, 2016
@jreback
Copy link
Contributor

jreback commented Jul 20, 2016

thanks @bdrosen96

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug IO CSV read_csv, to_csv
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Read CSV using c engine silently swallows useful exceptions
5 participants