Issue #24 new

pyyaml hangs under mock

Mike Place
created an issue

The following code forces Pyyaml into an endless loop:

from mock import mock_open, patch
import yaml
with patch('__builtin__.open', mock_open(read_data='test_data'), create=True):
  with open('dummy', 'r') as fp_:                                                                                                             
      yaml.safe_load(fp_)

Comments (2)

  1. Mike Place reporter

    I should also warn that the above sample code will both hang and endlessly (and rapidly) allocate memory until it is exhausted or Python crashes. :]

  2. Log in to comment