Ticket #166 (closed enhancement: wontfix)

Opened 4 years ago

Last modified 2 days ago

PyYAML should use libyaml if libyaml available

Reported by: sgwong Owned by: xi
Priority: normal Component: pyyaml
Severity: normal Keywords:

Description (last modified by xi) (diff)

Currently PyYAML only use python implementation although the libyaml available. The following simple changes on should do: (I'm not sure whats the use of __with_libyaml__)

__version__ = '3.09'

    from cyaml import *
    __with_libyaml__ = True
    Loader = CLoader
    Dumper = CDumper
except ImportError:
    __with_libyaml__ = False 


Change History

comment:1 Changed 4 years ago by xi

  • Status changed from new to closed
  • Resolution set to wontfix
  • Description modified (diff)

You could use __with_libyaml__ to check whether libyaml bindings are available or not. For instance,

import yaml
if yaml.__with_libyaml__:
    data = yaml.load(input, Loader=yaml.CLoader)
    data = yaml.load(input)

The pure-Python and libyaml-based emitters may emit valid, but slightly different representations of the same document, therefore, to make the output deterministic regardless of whether libyaml is available or not, PyYAML always uses pure-Python parser and emitter by default.

comment:2 Changed 2 days ago by maskodok <galihadiputro87@…>

The only thing more I could hope for is documentation of all these features (other than reading through the code).  Cipto Junaedy Is this in process? Can I help? About  Unit Link Terbaik di Indonesia Commonwealth Life Investra Link


Add a comment

Modify Ticket

Change Properties
<Author field>
as closed
The resolution will be deleted. Next status will be 'reopened'

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.