Custom Query (121 matches)

Filters
 
Or
 
  
 
Columns

Show under each result:


Results (37 - 39 of 121)

3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
Ticket Resolution Summary Owner Reporter
#43 fixed path resolver has bug xi jstroud@…

Reported by jstroud@…, 8 years ago.

Description

Path resolving does not work for Nodes within Sequence Nodes

[This is current for pyyaml 3.04.]

For example:

yaml.add_path_resolver(u'!MyObject', (u'myobjs', [list, False]))

should match all of the items in the myobjs sequence in this yaml:

"""
--- !MyConfig
myobjs :
    - name: x
      root: z
    - name: p
      root: q
...
"""

The problem is here in resolver.py (line 210):

elif isinstance(index_check, int):
    if index_check != current_index:
         return

If I'm infering the intent of the code correctly

(u'myobjs', (list, False))

should match all elements of the sequence keyed by "myobjs". However,

isinstance(False, int)

always returns True because bool is a subclass of int, so index_check will only equal current_index for the first element when False is specified as the index_check.


Additionally, I believe another bug exists in resolver.py. According to the code in add_path_resolver(), index_check defaults to True when not specified (resolver.py, line 39):

if isinstance(element, (list, tuple)):
    if len(element) == 2:
        node_check, index_check = element
    elif len(element) == 1:
        node_check = element[0]
        index_check = True

The intendend meaning of True here is not clear because True causes every element in the sequence to fail the match. The relevant test is in check_resolver_prefix() (resolver.py, line 116):

if index_check is True and current_index is not None:
    return

Thus, any path not specifying an index_check will never match. Most insidious to the user is that this case is never reported nor an exception thrown. If index_check is True, this code will only continue to test if current_index is None, which should never happen for any node of any sequence, because any node of a sequence must, by virtue of its existence, have an index.


To fix these problems, I propose the following patch to resolver.py:

44c44
<                     index_check = True
---
>                     index_check = False
122c122
<         elif isinstance(index_check, int):
---
>         elif isinstance(index_check, int) and index_check is not False:

This will set the default value of index_check to match all elements of a sequence if no index_check is given and will not attempt to compare False to the value of index_check.

At the bare minimum, the following patch should be strongly considered if a good reason exists to leave the defalut of index_check to True.

122c122
<         elif isinstance(index_check, int):
---
>         elif isinstance(index_check, int) and index_check is not False:

Moreover, the code should provide some indication for what an index_check value of True actually means.

In fact, I propose re-writing the code to use None to match all elements, because

isinstance(None, int)

will always evaluate to False. This will also remove the question as to what the "other" bool value means because bools will not be used. I can provide a patch if this latter proposal sounds good to the developers.

#44 fixed easy_install b0rked xi anseljh@…

Reported by anseljh@…, 8 years ago.

Description

All I want is to easy_install pysyck... :(

Here's what happens on my Mac (OS X 10.4.8; Python 2.4.4):

$ sudo easy_install pysyck
Password:
Searching for pysyck
Reading http://cheeseshop.python.org/pypi/pysyck/
Couldn't find index page for 'pysyck' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading http://cheeseshop.python.org/pypi/
Reading http://cheeseshop.python.org/pypi/PySyck/0.61.2
Reading http://pyyaml.org/wiki/PySyck
Best match: PySyck 0.61.2
Downloading http://pyyaml.org/download/pysyck/PySyck-0.61.2.zip
Processing PySyck-0.61.2.zip
Running PySyck-0.61.2/setup.py -q bdist_egg --dist-dir /tmp/easy_install-y67SG5/PySyck-0.61.2/egg-dist-tmp-pDzaUo
./_check_syck.c:2:18: error: syck.h: No such file or directory
./_check_syck.c:2:18: error: syck.h: No such file or directory
./_check_syck.c: In function 'main':
./_check_syck.c:7: error: 'SYCK_VERSION' undeclared (first use in this function)
./_check_syck.c:7: error: (Each undeclared identifier is reported only once
./_check_syck.c:7: error: for each function it appears in.)
./_check_syck.c: In function 'main':
./_check_syck.c:7: error: 'SYCK_VERSION' undeclared (first use in this function)
./_check_syck.c:7: error: (Each undeclared identifier is reported only once
./_check_syck.c:7: error: for each function it appears in.)
lipo: can't figure out the architecture type of: /var/tmp//ccX0yyzM.out
error: Setup script exited with error: syck.h is not found, try to uncomment the include_dirs parameter in setup.cfg

...and on my Fedora Core 6 box (also Python 2.4.4):

$ sudo easy_install pysyck
Password:
Searching for pysyck
Reading http://cheeseshop.python.org/pypi/pysyck/
Couldn't find index page for 'pysyck' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading http://cheeseshop.python.org/pypi/
Reading http://cheeseshop.python.org/pypi/PySyck/0.61.2
Reading http://pyyaml.org/wiki/PySyck
Best match: PySyck 0.61.2
Downloading http://pyyaml.org/download/pysyck/PySyck-0.61.2.zip
Processing PySyck-0.61.2.zip
Running PySyck-0.61.2/setup.py -q bdist_egg --dist-dir /tmp/easy_install-waHbzc/PySyck-0.61.2/egg-dist-tmp-ltTkBA
./_check_syck.c:2:18: error: syck.h: No such file or directory
./_check_syck.c: In function ‘main’:
./_check_syck.c:5: warning: implicit declaration of function ‘syck_free_parser’
./_check_syck.c:5: warning: implicit declaration of function ‘syck_new_parser’
./_check_syck.c:6: warning: implicit declaration of function ‘syck_free_emitter’
./_check_syck.c:6: warning: implicit declaration of function ‘syck_new_emitter’
./_check_syck.c:7: error: ‘SYCK_VERSION’ undeclared (first use in this function)
./_check_syck.c:7: error: (Each undeclared identifier is reported only once
./_check_syck.c:7: error: for each function it appears in.)
error: Setup script exited with error: syck.h is not found, try to uncomment the include_dirs parameter in setup.cfg

Help?

#46 worksforme syck.dump is not here ! xi jean.philippe.mague _at_ gmail _d.o.t_ com

Reported by jean.philippe.mague _at_ gmail _d.o.t_ com, 8 years ago.

Description

when installing pysyck from syck-0.61+svn231+patches.tar.gz, I end up with a module with only the Node type and the load function (and several blah funtions). When I install it from PySyck-0.61.2.tar.gz (with syck previouly installed) every goes just fine. I use python 2.4 on a Ubuntu Edgy

3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
Note: See TracQuery for help on using queries.