Modify

Ticket #204 (new defect)

Opened 3 years ago

Last modified 27 hours ago

In pure-python implementation yaml.load cannot read files generated by yaml.dump/safe_dump when allow_unicode=True

Reported by: kpp.live@… Owned by: xi
Priority: high Component: pyyaml
Severity: normal Keywords:
Cc:

Description

Consider we're running:

Jython 2.5.1+ (Release_2_5_1, Aug 4 2010, 07:18:19) 
[OpenJDK 64-Bit Server VM (Sun Microsystems Inc.)] on java1.6.0_23
Type "help", "copyright", "credits" or "license" for more information.
>>> import yaml; yaml.__version__
'3.10'
>>> f = file('tmp.yaml', 'wb')
>>> yaml.dump(u'Even just latin in unicode', allow_unicode=True)
"!!python/unicode 'Even just latin in unicode'\n"
>>> yaml.dump(u'Even just latin in unicode', f, allow_unicode=True)
>>> f.close()
>>> f = file('tmp.yaml')
>>> yaml.load(f)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/share/jython/Lib/site-packages/yaml/__init__.py", line 69, in load
  File "/usr/share/jython/Lib/site-packages/yaml/loader.py", line 34, in __init__
  File "/usr/share/jython/Lib/site-packages/yaml/reader.py", line 85, in __init__
  File "/usr/share/jython/Lib/site-packages/yaml/reader.py", line 135, in determine_encoding
  File "/usr/share/jython/Lib/site-packages/yaml/reader.py", line 169, in update
  File "/usr/share/jython/Lib/site-packages/yaml/reader.py", line 143, in check_printable
yaml.reader.ReaderError: unacceptable character #x0000: special characters are not allowed
  in "tmp.yaml", position 16

In cpython (with yaml with c-extension) yaml.load works with this file.

Attachments

Change History

comment:1 Changed 27 hours 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

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as new
as The resolution will be set. Next status will be 'closed'
to The owner will be changed from xi. Next status will be 'new'
The owner will be changed from xi to anonymous. Next status will be 'assigned'
Author


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

 
Note: See TracTickets for help on using tickets.