google / textfsm

Python module for parsing semi-structured text into python tables.
Apache License 2.0
1.11k stars 171 forks source link

Python-3 deepcopy fix and close all files (except stdin): version 0.3.2 #14

Closed xavierhardy closed 7 years ago

xavierhardy commented 7 years ago

This pull request fixes the tests for Python 3. The file handler in the IndexTable object is not serializable in Python 3, so __copy__ and __deepcopy__ must be overriden to be able to copy them.

This also fixes dangling file descriptors, any opened file must be closed. stdin is kept opened so that it can be reused later on. Python 3 issues a warning when such a thing happen, Python 2 does not.