Custom Query (121 matches)


Show under each result:

Results (61 - 63 of 121)

Ticket Resolution Summary Owner Reporter
#74 fixed porting yaml to python 3000 xi idadesub@…

Reported by idadesub@…, 10 years ago.



I've started to play around with porting code over to python 3, and since I use yaml, I had to port it over as well. So, here's the patch :) It's pretty heavyweight, though, because of the change of "str" to be unicode. Since there are many incompatible changes, I'd recommend creating a branch for this.

Here's some other notes that you ought to be aware of:

  • In order to do from error import * you now have to specify the full path to the module from yaml.error import *, explicitly specify what you want to import with from .error import YAMLError, or from . import error. I went with from yaml.error import * as that let me touch less code.
  • Removed:
except NameError:
    from sets import Set as set
  • Removed utf_*_decode functions from yaml/
  • file was removed as a function, so I replaced it with open.
  • Since python 3 doesn't have classic-style classes, I removed all the instance code I could find. This means that __initargs__ isn't used anymore.
  • u'...' isn't supported, so it's been replaced with just '...'.
  • Unicode encoding now is str to bytes and decoding is bytes to str, so it required a lot of changes to change the order of encoding and decoding.
  • unichr was replaced with chr.
  • print now requires parenthesis.
  • open('foo', 'rb') now returns a stream object that produces bytes instead of strs, so that had to be specially handled.
  • Automatic tuple extraction with things like def foo(a, b, (c, d)): ... is no longer supported.
  • There is no longer total ordering of all types, so [None, 1].sort() is now a TypeError. So, I added a basic __lt__ to yaml.nodes.Node which might need more attention.
  • exec now requires parenthesis. Also, it doesn't seem like the values that get added to locals() are actually added to the local scope. This might be a bug.
  • StringIO has been moved to the io module.
  • Catching exceptions is now written like except YAMLError as exc.
  • If you catch and then re raise another exception you can write raise YAMLError from other_exception to save the history of the other exception.
  • I left in support for !!python/long and !!python/unicode for backwards compatibility.
  • I removed all the (object) from class definition.
  • mapping.keys() now returns an iterator, so I wrapped all the cases I could find that require it returning a list.
  • I moved the sorting of a mapping to after the items in it have been turned into nodes so that it's more sortable.

Finally, in case it wasn't clear in the patch, I've removed the following tests:

D      tests/data/
D      tests/data/
D      tests/data/construct-python-unicode-utf8.code
D      tests/data/construct-python-unicode-ascii.code

And added:

A      tests/data/
A      tests/data/
A      tests/data/construct-python-bytes-utf8.code
A      tests/data/construct-python-bytes-ascii.code
#77 worksforme libyaml 0.1.1 segmentation faults. xi anonymous

Reported by anonymous, 9 years ago.


python 2.5.2

import yaml
from yaml import CDumper
d = {'x' : []}

yaml.dump(d, Dumper=CDumper)

This uses

#78 wontfix run-scanner.c:61: error: too many arguments to function ‘yaml_parser_get_error’ xi rasmus-flajm-se

Reported by rasmus-flajm-se, 9 years ago.

rasmus@apple:~/src/libyaml-trunk make
Making all in tests
gcc -DHAVE_CONFIG_H -I. -I..  -I../include   -g -O2 -MT run-scanner.o -MD -MP -MF .deps/run-scanner.Tpo -c -o run-scanner.o run-scanner.c
run-scanner.c: In function ‘main’:
run-scanner.c:61: error: too many arguments to function ‘yaml_parser_get_error’
make[2]: *** [run-scanner.o] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
rasmus@apple:~/src/libyaml-trunk svn info
Path: .
Repository Root:
Repository UUID: 18f92427-320e-0410-9341-c67f048884a3
Revision: 267
Node Kind: directory
Schedule: normal
Last Changed Author: xi
Last Changed Rev: 267
Last Changed Date: 2008-01-19 14:54:22 +0100 (Lör, 19 Jan 2008)

rasmus@apple:~/src/libyaml-trunk uname -a
Darwin *** 9.2.2 Darwin Kernel Version 9.2.2: Tue Mar  4 21:17:34 PST 2008; root:xnu-1228.4.31~1/RELEASE_I386 i386
Note: See TracQuery for help on using queries.