title: ast.literal_eval memory error on nested list
body: <p>I'm trying to use ast.literal_eval on a string, but am getting a memory error. Is the list too nested or what is the problem? Is there an alternative?</p>
  
  <pre><code>MemoryError                               Traceback (most recent call last)
  &lt;ipython-input-138-3ea9110f7dc3&gt; in &lt;module&gt;()
        1 s = "[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[['Xenophrys_bairdii'],'Vulpanser_spaldingi'],'Vipera_yeltoniensis'],'Vipera_minutus'],'Vanellus_vegans'],'Vanellus_bedriagai'],'Ursus_gratiosa'],'Uroplatus_flavomaculatus'],'Trionyx_leporosum'],'Tringa_aspera'],'Trachemys_sirtalis'],'Terpsihone_varius'],'Spermophilus_hassanica'],'Siniperca_decor'],'Scolopendra_marcianus'],'Rufibrenta_montela'],'Riparia_clinatus'],'Rhinolophus_tuberculosus'],'Rhacodactylus_citrsola'],'Remiz_niloticus'],'Pterinochilus_physalus'],'Procellaria_truncatus'],'Procellaria_lutris'],'Poephagus_indica'],'Platemys_albopillosum'],'Pica_totanus'],'Pica_mexicana'],'Phrynomerus_pelagicus'],'Philothamnus_tuberculosus'],'Petrocincla_acuta'],'Pelomedusa_rusticolus'],'Pagophila_metallica'],'Pachytriton_sibiricus'],'Otis_moschata'],'Otis_franckii'],'Otis_emarginatus'],'Opheodrys_clarus'],'Mylopharyngodon_diffidens'],'Mergus_carinata'],'Meles_carbonaria'],'Mabuya_carnivorus'],'Lystrophis_siebenrocki'],'Lyrurus_tinctorius'],'Lycodon_dendrophila'],'Lutra_plathyrhychos'],'Leptopelis_plumipes'],'Leptopelis_licin'],'Leiurus_grossmani'],'Lasiodora_hipposideros'],'Larus_pulchripes'],'Kinosternon_guineti'],'Kassina_canorus'],'Hysterocrates_chukar'],'Hydrochelidon_euptilura'],'Hemitheconyx_pulchripes'],'Haplopelma_arcticus'],'Hadrurus_dominus'],'Gypaetus_schneideri'],'Glareola_leucophyllata'],'Gerrhosaurus_ruficollis'],'Geochelone_filipjevi'],'Gallinago_pallasii'],'Eutamias_multifasciata'],'Eulabeia_tinnunculus'],'Eudrornias_penelope'],'Eudramias_tadorna'],'Eschrichtius_pulchra'],'Eremophila_similis'],'Equus_fluviatilis'],'Epicrates_carinatus'],'Emydura_avosetta'],'Emberiza_japonica'],'Dyscophus_rubicola'],'Dendrelaphis_griseus'],'Cypselus_ceterus'],'Cynops_rutila'],'Cygnus_rubicola'],'Ctenosaura_sphenocercus'],'Coenobita_variabilis'],'Clemmys_caudata'],'Cervus_comicus'],'Castor_prominanus'],'Casarca_holbrooki'],'Capella_aestivus'],'Buthus_nebularia'],'Bronchocela_bicoloratum'],'Branta_ferrumequinum'],'Balaenoptera_piscator'],'Athene_musculus'],'Argynnis_versicolor'],'Arenaria_javanica'],'Anthropoides_aestivus'],'Anolis_medirostris'],'Anodonta_infrafrenata'],'Ambystoma_alcinous'],'Acanthoceros_euptilura']"
  ----&gt; 2 ast.literal_eval(s)
  
  ~\Anaconda3\lib\ast.py in literal_eval(node_or_string)
       46     """
       47     if isinstance(node_or_string, str):
  ---&gt; 48         node_or_string = parse(node_or_string, mode='eval')
       49     if isinstance(node_or_string, Expression):
       50         node_or_string = node_or_string.body
  
  ~\Anaconda3\lib\ast.py in parse(source, filename, mode)
       33     Equivalent to compile(source, filename, mode, PyCF_ONLY_AST).
       34     """
  ---&gt; 35     return compile(source, filename, mode, PyCF_ONLY_AST)
       36 
       37 
  
  MemoryError: 
  </code></pre>