BUG: Fix Segfault with pd.tslib.get_period_field (GH4519, GH4520)

Fixes the following problem (issues #4519, #4520):

```python
>>> import pandas as pd
>>> pd.tslib.get_period_field(11, 1, 1)
Exception ValueError: ValueError('Unrecognized code: 11',) in 'pandas.tslib._get_accessor_func' ignored
Segmentation fault
```