Custom Query (171 matches)

Filters
 
Or
 
  
 
Columns

Show under each result:


Results (7 - 9 of 171)

1 2 3 4 5 6 7 8 9 10 11 12 13
Ticket Resolution Summary Owner Reporter
#37 invalid Cross referenced aliases unsupported ? xi Pwipwi

Reported by Pwipwi, 8 years ago.

Description

Hi, the following doesn't work :

- &element1
  stuff: "Hey !"
  link: *element2 # this causes trouble

- &element2
  stuff: "Ho !"
  link: *element1

Is it normal, or is it just unsupported for now ? It would be nice to have it :)

#179 duplicate Python-yaml crashes on unhashable key xi Samuel.Hym@…

Reported by Samuel.Hym@…, 4 years ago.

Description

Hello,

Python-yaml (debian version 3.09-5 of python-yaml, on python 2.6.6) refuses to load a yaml document containing a unhashable element as a key.

For example :

>>> yaml.load('[]: a')

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.6/dist-packages/yaml/__init__.py", line 58, in load
    return loader.get_single_data()
  File "/usr/lib/python2.6/dist-packages/yaml/constructor.py", line 44, in get_single_data
    return self.construct_document(node)
  File "/usr/lib/python2.6/dist-packages/yaml/constructor.py", line 53, in construct_document
    for dummy in generator:
  File "/usr/lib/python2.6/dist-packages/yaml/constructor.py", line 403, in construct_yaml_map
    value = self.construct_mapping(node)
  File "/usr/lib/python2.6/dist-packages/yaml/constructor.py", line 213, in construct_mapping
    return BaseConstructor.construct_mapping(self, node, deep=deep)
  File "/usr/lib/python2.6/dist-packages/yaml/constructor.py", line 137, in construct_mapping
    "found unacceptable key (%s)" % exc, key_node.start_mark)
yaml.constructor.ConstructorError: while constructing a mapping
found unacceptable key (unhashable type: 'list')
  in "<string>", line 1, column 1:
    []: a
    ^

I don't know what would be the most desirable python object to build for that kind of yaml source, though :/

Best regards

Samuel Hym

#14 fixed Inf and NaN handling needs re-vamp xi Scott David Daniels <Scott.Daniels@…>

Reported by Scott David Daniels <Scott.Daniels@…>, 8 years ago.

Description

Trying to import YAML fails in Python 2.5. Even simple patches fail, because the root cause is that NaNs and INFs cannot be marshalled/unmarshalled. Marshalling is used to save and restore compiled python modules, so a tested module can work initially, but later fail to load (when not from source).

When handling INFs and NaNs, you need to be careful. 1e300000 is not a safe way to represent infinity, and fails to pickle/unpickle safely from manifest constants. Different C runtimes represent the text for INFs and NaNs differently. Since Python 2.5 folds constants, a simple expression won't solve the problem.

The following changes should allow yaml to work on python 2.5a2 on Win2000 (and I think for 64-bit machines as well):

=============== constructor.py: ===============

*** 231,239 ****
          else:
              return sign*int(value)

-     inf_value = 1e300000
-     nan_value = inf_value/inf_value
-
      def construct_yaml_float(self, node):
          value = str(self.construct_scalar(node))
          value = value.replace('_', '')
--- 231,236 ----
***************
***************
*** 242,251 ****
              sign = -1
          if value[0] in '+-':
              value = value[1:]
!         if value.lower() == '.inf':
!             return sign*self.inf_value
!         elif value.lower() == '.nan':
!             return self.nan_value
          elif ':' in value:
              digits = [float(part) for part in value.split(':')]
              digits.reverse()
--- 239,253 ----
              sign = -1
          if value[0] in '+-':
              value = value[1:]
!         if value.lower() in ('.inf', '.nan'):
!             big = 1e300
!             bigger = big * big
!             while bigger > big and bigger == bigger:
!                 big = bigger
!                 bigger = big * big
!             if value.lower() == '.nan':
!                 return bigger / bigger
!             return sign * bigger
          elif ':' in value:
              digits = [float(part) for part in value.split(':')]
              digits.reverse()

=============== representer.py: ===============

*** 192,200 ****
      def represent_long(self, data):
          return self.represent_scalar(u'tag:yaml.org,2002:int', unicode(data))

!     repr_pos_inf = repr(1e300000)
!     repr_neg_inf = repr(-1e300000)
!     repr_nan = repr(1e300000/1e300000)

      def represent_float(self, data):
          repr_data = repr(data)
--- 192,206 ----
      def represent_long(self, data):
          return self.represent_scalar(u'tag:yaml.org,2002:int', unicode(data))

!     big = 1e300
!     bigger = big * big
!     while bigger > big and bigger == bigger:
!         big = bigger
!         bigger = big * big
!     repr_pos_inf = repr(bigger)
!     repr_neg_inf = repr(-bigger)
!     repr_nan = repr(bigger / bigger)
!     del big, bigger

      def represent_float(self, data):
          repr_data = repr(data)
1 2 3 4 5 6 7 8 9 10 11 12 13
Note: See TracQuery for help on using queries.